index.vue 10 KB

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