index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-09 18:08:13
  4. * @LastEditTime: 2025-02-26 10:45:08
  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="500"
  40. v-slot="{ item, index }"
  41. >
  42. <TwoDMarkersChart
  43. :setUpImgData="setUpImgData"
  44. :key="item.fieldEngineCode"
  45. :index="`${new Date().getTime()}` + index"
  46. :ref="item.fieldEngineCode"
  47. :fileAddr="item.fileAddr"
  48. ></TwoDMarkersChart>
  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 TwoDMarkersChart from "@/views/performance/components/chartsCom/TwoDMarkersChart.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. TwoDMarkersChart,
  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. console.log(
  217. this.initBatchCode,
  218. this.analysisTypeCode,
  219. "请求详情 分钟级"
  220. );
  221. // 获取分析详情
  222. await this.getAnalysisDetail();
  223. // 获取风机列表
  224. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  225. } catch (err) {
  226. console.error("Failed to fetch data:", err);
  227. }
  228. },
  229. // 获取分析详情接口
  230. async getAnalysisDetail() {
  231. try {
  232. const result = await analysisDetail({
  233. batchCode: this.initBatchCode,
  234. analysisTypeCode: this.analysisTypeCode,
  235. fieldEngineCodes:
  236. this.fieldEngineCodes.length === 0
  237. ? undefined
  238. : this.fieldEngineCodes.join(","),
  239. });
  240. if (result.data.length > 0) {
  241. this.isShowDescription = true;
  242. }
  243. if (
  244. result.data &&
  245. result.data[0] &&
  246. result.data[0].commentTypeRelations
  247. ) {
  248. this.editableTabs = result.data[0].commentTypeRelations;
  249. }
  250. //当前评论展示获取
  251. if (
  252. result.data &&
  253. result.data[0] &&
  254. result.data[0].commentDescriptionVos
  255. ) {
  256. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  257. }
  258. this.generalFilesDatas =
  259. (result.data &&
  260. result.data[0] &&
  261. result.data[0].generalFiles &&
  262. result.data[0].generalFiles.filter((item) =>
  263. item.fileAddr.endsWith(".json")
  264. )) ||
  265. []; //总图数据
  266. this.diagramRelationsDatas =
  267. (result.data &&
  268. result.data[0] &&
  269. result.data[0].diagramRelations &&
  270. result.data[0].diagramRelations.filter((item) =>
  271. item.fileAddr.endsWith(".json")
  272. )) ||
  273. [];
  274. } catch (err) {
  275. console.error("Failed to fetch analysis details:", err);
  276. }
  277. },
  278. // 请求风机列表
  279. async getWindEnfineList(batchCode, analysisTypeCode) {
  280. // console.log("请求风机列表 分钟级");
  281. const resEngineList = await queryAnalysisedEngine({
  282. batchCode: batchCode,
  283. analysisTypeCode,
  284. });
  285. this.windEngineGroupList = resEngineList.data;
  286. },
  287. handleEditorInput(index, newVal) {
  288. // 更新对应的 comment 值
  289. // 如果该功能没有实现,可以删除这个方法
  290. },
  291. //获取选中风机list
  292. getEnfineList(data, setUpImg) {
  293. this.fieldEngineCodes = data;
  294. this.setUpImgData = [...setUpImg];
  295. this.getAnalysisDetail();
  296. },
  297. //下一条
  298. handleNext() {
  299. const index = this.batchCodeList.findIndex(
  300. (item) => item === this.initBatchCode
  301. );
  302. if (index === this.batchCodeList.length - 1) {
  303. this.$message.warning("已经是最后一个分析结果了");
  304. return;
  305. }
  306. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  307. },
  308. //上一条
  309. handlePrevious() {
  310. const index = this.batchCodeList.findIndex(
  311. (item) => item === this.initBatchCode
  312. );
  313. if (index === 0) {
  314. this.$message.warning("没有上一条了");
  315. return;
  316. }
  317. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  318. },
  319. onClick() {},
  320. },
  321. };
  322. </script>
  323. <style scoped lang="scss">
  324. .type-variable {
  325. display: flex;
  326. height: 90%;
  327. overflow: hidden;
  328. .left {
  329. width: 30%;
  330. height: 100%;
  331. overflow: auto;
  332. padding: 20px;
  333. flex: 1;
  334. /* 滚动条整体样式 */
  335. &::-webkit-scrollbar {
  336. width: 6px; /* 滚动条宽度 */
  337. }
  338. /* 滚动条轨道 */
  339. &::-webkit-scrollbar-track {
  340. background: #f5f7fa;
  341. border-radius: 3px;
  342. }
  343. /* 滚动条滑块 */
  344. &::-webkit-scrollbar-thumb {
  345. background: #c0c4cc;
  346. border-radius: 3px;
  347. }
  348. /* 滚动条滑块悬停时 */
  349. &::-webkit-scrollbar-thumb:hover {
  350. background: #909399;
  351. }
  352. }
  353. .right {
  354. width: 250px;
  355. height: 100%;
  356. overflow: hidden;
  357. }
  358. }
  359. .el-dialog__wrapper {
  360. position: relative !important;
  361. }
  362. ::v-deep .el-dialog {
  363. position: fixed !important;
  364. z-index: 999 !important;
  365. top: 50%;
  366. left: 50%;
  367. transform: translate(0, -50%);
  368. }
  369. .titleCharts {
  370. font-size: 16px;
  371. font-weight: 500;
  372. margin-top: 20px;
  373. }
  374. </style>