index.vue 10 KB

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