index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-09 18:09:55
  4. * @LastEditTime: 2025-02-26 11:18:50
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/components/pitch_tsr_cp/index.vue
  8. -->
  9. <!-- pitchTsrCp -->
  10. <template>
  11. <div class="type-variable">
  12. <!-- 变桨和叶尖速比及风能利用系数分析--只有分图不存在总图 -->
  13. <div class="left">
  14. <FilterChart
  15. :setUpimg="['叶尖速比', '风能利用系数']"
  16. :windList="windEngineGroupList"
  17. @getEnfineList="getEnfineList"
  18. @handlePrevious="handlePrevious"
  19. @handleNext="handleNext"
  20. ></FilterChart>
  21. <el-alert type="info" :closable="false">
  22. <template v-slot:title>
  23. <div style="display: flex; align-items: center">
  24. <i
  25. class="el-icon-info"
  26. style="font-size: 20px; margin-right: 5px"
  27. ></i>
  28. <h3>分析说明:</h3>
  29. </div>
  30. </template>
  31. <div style="font-size: 12px; margin-top: 10px">
  32. 风能利用系数可以表示为变桨角度和叶尖速比的函数。每一个确定的桨距角,都存在一个最大风力利用系数,随着桨距角的变大,最大风力利用系数降低,其对应的叶尖速比也降低。此分析可以看出机组的发电情况表现。
  33. </div>
  34. </el-alert>
  35. <VirtualList
  36. :list="diagramRelationsDatas"
  37. keyField="fileAddr"
  38. :itemSize="500"
  39. v-slot="{ item, index }"
  40. >
  41. <TwoDMarkersChart
  42. :setUpImgData="setUpImgData"
  43. :key="item.fieldEngineCode + index"
  44. :index="`${new Date().getTime()}` + index"
  45. :ref="item.fieldEngineCode"
  46. :fileAddr="item.fileAddr"
  47. ></TwoDMarkersChart>
  48. </VirtualList>
  49. <el-dialog
  50. v-if="isShowDescription"
  51. title="添加评论"
  52. :visible="isShow"
  53. width="30%"
  54. v-dialogDrag
  55. :modal="false"
  56. :lock-scroll="false"
  57. :modal-append-to-body="false"
  58. @close="handleClose"
  59. >
  60. <el-tabs value="first">
  61. <el-tab-pane label="意见描述" name="first">
  62. <TinymceEditor
  63. ref="editor"
  64. v-model="comment"
  65. @input="handleEditorInput($event)"
  66. @onClick="onClick"
  67. >
  68. </TinymceEditor>
  69. </el-tab-pane>
  70. </el-tabs>
  71. <el-row
  72. type="flex"
  73. class="row-bg"
  74. justify="end"
  75. style="margin: 20px 60px 0 0"
  76. >
  77. <el-col :span="2">
  78. <el-button type="primary" size="small" @click="handleComment"
  79. >提交评论</el-button
  80. >
  81. </el-col>
  82. </el-row>
  83. </el-dialog>
  84. </div>
  85. <div class="right" v-if="isShowTinymceEditorCom">
  86. <DicCard
  87. :batchCode="initBatchCode"
  88. :analysisTypeCode="analysisTypeCode"
  89. :commentDescriptionVos="commentDescriptionVos"
  90. >
  91. </DicCard>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. import DicCard from "@/views/overview/components/dicCard/index.vue";
  97. import FilterChart from "@/views/overview/components/filterChart/index.vue";
  98. import TwoDMarkersChart from "@/views/performance/components/chartsCom/TwoDMarkersChart.vue";
  99. import TinymceEditor from "@/components/Tinymce.vue";
  100. import {
  101. analysisDetail,
  102. queryAnalysisedEngine,
  103. analysisCommentEdit,
  104. } from "@/api/performance";
  105. export default {
  106. name: "pitchTsrCp",
  107. components: {
  108. DicCard,
  109. FilterChart,
  110. TwoDMarkersChart,
  111. TinymceEditor,
  112. },
  113. props: {
  114. initBatchCode: {
  115. default: "",
  116. type: String,
  117. },
  118. isShowTinymceEditorCom: {
  119. default: true,
  120. type: Boolean,
  121. },
  122. isShow: {
  123. default: false,
  124. type: Boolean,
  125. },
  126. analysisTypeCode: {
  127. default: "",
  128. type: String,
  129. },
  130. batchCodeList: {
  131. default: "",
  132. type: Array,
  133. },
  134. },
  135. data() {
  136. return {
  137. form: {
  138. value2: "",
  139. },
  140. setUpImgData: [],
  141. windEngineGroupList: [], //批次风机列表
  142. fieldEngineCodes: [], //选中风机
  143. comment: "",
  144. options: [],
  145. generalFilesDatas: [], //总图
  146. diagramRelationsDatas: [], //分图,
  147. commentDescriptionVos: [], //评论列表
  148. editableTabs: [],
  149. isShowDescription: false,
  150. };
  151. },
  152. watch: {
  153. initBatchCode(newVal) {
  154. if (newVal) {
  155. this.fetchData(); // 调用合并后的函数
  156. }
  157. },
  158. analysisTypeCode(newVal) {
  159. if (newVal) {
  160. this.fetchData(); // 调用合并后的函数
  161. }
  162. },
  163. isShow() {
  164. if (this.isShow) {
  165. if (!this.isShowDescription) {
  166. this.$message({
  167. message: "当前分析模型暂无分析,不能进行评论操作",
  168. type: "warning",
  169. });
  170. this.$emit("setIsShow");
  171. }
  172. }
  173. },
  174. },
  175. mounted() {
  176. if (this.initBatchCode && this.analysisTypeCode) {
  177. this.fetchData(); // 调用合并后的函数
  178. }
  179. },
  180. methods: {
  181. handleClose() {
  182. //关闭评论弹框
  183. this.$emit("setIsShow");
  184. },
  185. async handleComment() {
  186. try {
  187. await analysisCommentEdit({
  188. batchCode: this.initBatchCode,
  189. analysisTypeCode: this.analysisTypeCode,
  190. commentList: this.editableTabs.map((item) => {
  191. return {
  192. commentTypeCode: item.commentTypeCode,
  193. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  194. };
  195. }),
  196. });
  197. this.$message({
  198. type: "success",
  199. message: "保存成功",
  200. });
  201. this.comment = "";
  202. this.getAnalysisDetail();
  203. this.$emit("setIsShow");
  204. } catch (e) {
  205. console.error(e);
  206. this.loading = false;
  207. }
  208. },
  209. onSubmit() {
  210. console.log("submit!");
  211. },
  212. // 合并后的函数,处理数据请求
  213. async fetchData() {
  214. try {
  215. console.log(
  216. this.initBatchCode,
  217. this.analysisTypeCode,
  218. "请求详情 分钟级"
  219. );
  220. // 获取分析详情
  221. await this.getAnalysisDetail();
  222. // 获取风机列表
  223. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  224. } catch (err) {
  225. console.error("Failed to fetch data:", err);
  226. }
  227. },
  228. // 获取分析详情接口
  229. async getAnalysisDetail() {
  230. try {
  231. const result = await analysisDetail({
  232. batchCode: this.initBatchCode,
  233. analysisTypeCode: this.analysisTypeCode,
  234. fieldEngineCodes:
  235. this.fieldEngineCodes.length === 0
  236. ? undefined
  237. : this.fieldEngineCodes.join(","),
  238. });
  239. if (result.data.length > 0) {
  240. this.isShowDescription = true;
  241. }
  242. if (
  243. result.data &&
  244. result.data[0] &&
  245. result.data[0].commentTypeRelations
  246. ) {
  247. this.editableTabs = result.data[0].commentTypeRelations;
  248. }
  249. //当前评论展示获取
  250. if (
  251. result.data &&
  252. result.data[0] &&
  253. result.data[0].commentDescriptionVos
  254. ) {
  255. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  256. }
  257. this.generalFilesDatas =
  258. (result.data &&
  259. result.data[0] &&
  260. result.data[0].generalFiles &&
  261. result.data[0].generalFiles.filter((item) =>
  262. item.fileAddr.endsWith(".json")
  263. )) ||
  264. []; //总图数据
  265. this.diagramRelationsDatas =
  266. (result.data &&
  267. result.data[0] &&
  268. result.data[0].diagramRelations &&
  269. result.data[0].diagramRelations.filter((item) =>
  270. item.fileAddr.endsWith(".json")
  271. )) ||
  272. [];
  273. } catch (err) {
  274. console.error("Failed to fetch analysis details:", err);
  275. }
  276. },
  277. // 请求风机列表
  278. async getWindEnfineList(batchCode, analysisTypeCode) {
  279. // console.log("请求风机列表 分钟级");
  280. const resEngineList = await queryAnalysisedEngine({
  281. batchCode: batchCode,
  282. analysisTypeCode,
  283. });
  284. this.windEngineGroupList = resEngineList.data;
  285. },
  286. handleEditorInput(index, newVal) {
  287. // 更新对应的 comment 值
  288. // 如果该功能没有实现,可以删除这个方法
  289. },
  290. //获取选中风机list
  291. getEnfineList(data, setUpImg) {
  292. this.fieldEngineCodes = data;
  293. this.setUpImgData = [...setUpImg];
  294. this.getAnalysisDetail();
  295. },
  296. //下一条
  297. handleNext() {
  298. const index = this.batchCodeList.findIndex(
  299. (item) => item === this.initBatchCode
  300. );
  301. if (index === this.batchCodeList.length - 1) {
  302. this.$message.warning("已经是最后一个分析结果了");
  303. return;
  304. }
  305. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  306. },
  307. //上一条
  308. handlePrevious() {
  309. const index = this.batchCodeList.findIndex(
  310. (item) => item === this.initBatchCode
  311. );
  312. if (index === 0) {
  313. this.$message.warning("没有上一条了");
  314. return;
  315. }
  316. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  317. },
  318. onClick() {},
  319. },
  320. };
  321. </script>
  322. <style scoped lang="scss">
  323. .type-variable {
  324. display: flex;
  325. height: 90%;
  326. overflow: hidden;
  327. .left {
  328. width: 30%;
  329. height: 100%;
  330. overflow: auto;
  331. padding: 20px;
  332. flex: 1;
  333. /* 滚动条整体样式 */
  334. &::-webkit-scrollbar {
  335. width: 6px; /* 滚动条宽度 */
  336. }
  337. /* 滚动条轨道 */
  338. &::-webkit-scrollbar-track {
  339. background: #f5f7fa;
  340. border-radius: 3px;
  341. }
  342. /* 滚动条滑块 */
  343. &::-webkit-scrollbar-thumb {
  344. background: #c0c4cc;
  345. border-radius: 3px;
  346. }
  347. /* 滚动条滑块悬停时 */
  348. &::-webkit-scrollbar-thumb:hover {
  349. background: #909399;
  350. }
  351. }
  352. .right {
  353. width: 250px;
  354. height: 100%;
  355. overflow: hidden;
  356. }
  357. }
  358. .el-dialog__wrapper {
  359. position: relative !important;
  360. }
  361. ::v-deep .el-dialog {
  362. position: fixed !important;
  363. z-index: 999 !important;
  364. top: 50%;
  365. left: 50%;
  366. transform: translate(0, -50%);
  367. }
  368. </style>