index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <!--
  2. * @Author: your name
  3. * @Date: 2025-01-09 18:10:47
  4. * @LastEditTime: 2025-02-10 14:51:48
  5. * @LastEditors: bogon
  6. * @Description: In User Settings Edit
  7. * @FilePath: /performance-test/src/views/overview/components/rated_power_windspeed/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 class="titleCharts">分析总图 :</div>
  34. <VirtualList
  35. :list="generalFilesDatas"
  36. keyField="batchCode"
  37. :itemSize="452"
  38. v-slot="{ item, index }"
  39. >
  40. <BoxLineCharts
  41. :key="item.batchCode + index"
  42. :index="index"
  43. :ref="item.batchCode + index"
  44. :fileAddr="item.fileAddr"
  45. >
  46. </BoxLineCharts>
  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">
  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 BoxLineCharts from "@/views/performance/components/chartsCom/BoxLineCharts.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: "ratedPowerWindspeed",
  106. components: {
  107. DicCard,
  108. FilterChart,
  109. BoxLineCharts,
  110. TinymceEditor,
  111. },
  112. props: {
  113. initBatchCode: {
  114. default: "",
  115. type: String,
  116. },
  117. isShow: {
  118. default: false,
  119. type: Boolean,
  120. },
  121. analysisTypeCode: {
  122. default: "",
  123. type: String,
  124. },
  125. batchCodeList: {
  126. default: "",
  127. type: Array,
  128. },
  129. },
  130. data() {
  131. return {
  132. form: {
  133. value2: "",
  134. },
  135. windEngineGroupList: [], //批次风机列表
  136. fieldEngineCodes: [], //选中风机
  137. comment: "",
  138. options: [],
  139. generalFilesDatas: [], //总图
  140. diagramRelationsDatas: [], //分图,
  141. commentDescriptionVos: [], //评论列表
  142. editableTabs: [],
  143. isShowDescription: false,
  144. };
  145. },
  146. watch: {
  147. initBatchCode(newVal) {
  148. if (newVal) {
  149. this.fetchData(); // 调用合并后的函数
  150. }
  151. },
  152. analysisTypeCode(newVal) {
  153. if (newVal) {
  154. this.fetchData(); // 调用合并后的函数
  155. }
  156. },
  157. isShow() {
  158. if (this.isShow) {
  159. if (!this.isShowDescription) {
  160. this.$message({
  161. message: "当前分析类型暂无分析,不能进行评论操作",
  162. type: "warning",
  163. });
  164. this.$emit("setIsShow");
  165. }
  166. }
  167. },
  168. },
  169. mounted() {
  170. if (this.initBatchCode && this.analysisTypeCode) {
  171. this.fetchData(); // 调用合并后的函数
  172. }
  173. },
  174. methods: {
  175. handleClose() {
  176. //关闭评论弹框
  177. this.$emit("setIsShow");
  178. },
  179. async handleComment() {
  180. try {
  181. await analysisCommentEdit({
  182. batchCode: this.initBatchCode,
  183. analysisTypeCode: this.analysisTypeCode,
  184. commentList: this.editableTabs.map((item) => {
  185. return {
  186. commentTypeCode: item.commentTypeCode,
  187. comment: item.commentTypeName === "分析评论" ? this.comment : "",
  188. };
  189. }),
  190. });
  191. this.$message({
  192. type: "success",
  193. message: "保存成功",
  194. });
  195. this.comment = "";
  196. this.getAnalysisDetail();
  197. this.$emit("setIsShow");
  198. } catch (e) {
  199. console.error(e);
  200. this.loading = false;
  201. }
  202. },
  203. onSubmit() {
  204. console.log("submit!");
  205. },
  206. // 合并后的函数,处理数据请求
  207. async fetchData() {
  208. try {
  209. console.log(
  210. this.initBatchCode,
  211. this.analysisTypeCode,
  212. "请求详情 分钟级"
  213. );
  214. // 获取分析详情
  215. await this.getAnalysisDetail();
  216. // 获取风机列表
  217. await this.getWindEnfineList(this.initBatchCode, this.analysisTypeCode);
  218. } catch (err) {
  219. console.error("Failed to fetch data:", err);
  220. }
  221. },
  222. // 获取分析详情接口
  223. async getAnalysisDetail() {
  224. try {
  225. const result = await analysisDetail({
  226. batchCode: this.initBatchCode,
  227. analysisTypeCode: this.analysisTypeCode,
  228. fieldEngineCodes:
  229. this.fieldEngineCodes.length === 0
  230. ? undefined
  231. : this.fieldEngineCodes.join(","),
  232. });
  233. if (result.data.length > 0) {
  234. this.isShowDescription = true;
  235. }
  236. if (
  237. result.data &&
  238. result.data[0] &&
  239. result.data[0].commentTypeRelations
  240. ) {
  241. this.editableTabs = result.data[0].commentTypeRelations;
  242. }
  243. //当前评论展示获取
  244. if (
  245. result.data &&
  246. result.data[0] &&
  247. result.data[0].commentDescriptionVos
  248. ) {
  249. this.commentDescriptionVos = result.data[0].commentDescriptionVos;
  250. }
  251. this.generalFilesDatas =
  252. (result.data &&
  253. result.data[0] &&
  254. result.data[0].generalFiles &&
  255. result.data[0].generalFiles.filter((item) =>
  256. item.fileAddr.endsWith(".json")
  257. )) ||
  258. []; //总图数据
  259. this.diagramRelationsDatas =
  260. (result.data &&
  261. result.data[0] &&
  262. result.data[0].diagramRelations &&
  263. result.data[0].diagramRelations.filter((item) =>
  264. item.fileAddr.endsWith(".json")
  265. )) ||
  266. [];
  267. } catch (err) {
  268. console.error("Failed to fetch analysis details:", err);
  269. }
  270. },
  271. // 请求风机列表
  272. async getWindEnfineList(batchCode, analysisTypeCode) {
  273. // console.log("请求风机列表 分钟级");
  274. const resEngineList = await queryAnalysisedEngine({
  275. batchCode: batchCode,
  276. analysisTypeCode,
  277. });
  278. this.windEngineGroupList = resEngineList.data;
  279. },
  280. handleEditorInput(index, newVal) {
  281. // 更新对应的 comment 值
  282. // 如果该功能没有实现,可以删除这个方法
  283. },
  284. //获取选中风机list
  285. getEnfineList(data) {
  286. this.fieldEngineCodes = data;
  287. this.getAnalysisDetail();
  288. console.log(this.fieldEngineCodes, "this.fieldEngineCodes");
  289. },
  290. //下一条
  291. handleNext() {
  292. const index = this.batchCodeList.findIndex(
  293. (item) => item === this.initBatchCode
  294. );
  295. if (index === this.batchCodeList.length - 1) {
  296. this.$message.warning("已经是最后一个分析结果了");
  297. return;
  298. }
  299. this.$emit("setInitBathCode", this.batchCodeList[index + 1]);
  300. },
  301. //上一条
  302. handlePrevious() {
  303. const index = this.batchCodeList.findIndex(
  304. (item) => item === this.initBatchCode
  305. );
  306. if (index === 0) {
  307. this.$message.warning("没有上一条了");
  308. return;
  309. }
  310. this.$emit("setInitBathCode", this.batchCodeList[index - 1]);
  311. },
  312. onClick() {},
  313. },
  314. };
  315. </script>
  316. <style scoped lang="scss">
  317. .type-variable {
  318. display: flex;
  319. height: 90%;
  320. overflow: hidden;
  321. .left {
  322. width: 30%;
  323. height: 100%;
  324. overflow: auto;
  325. padding: 20px;
  326. flex: 1;
  327. /* 滚动条整体样式 */
  328. &::-webkit-scrollbar {
  329. width: 6px; /* 滚动条宽度 */
  330. }
  331. /* 滚动条轨道 */
  332. &::-webkit-scrollbar-track {
  333. background: #f5f7fa;
  334. border-radius: 3px;
  335. }
  336. /* 滚动条滑块 */
  337. &::-webkit-scrollbar-thumb {
  338. background: #c0c4cc;
  339. border-radius: 3px;
  340. }
  341. /* 滚动条滑块悬停时 */
  342. &::-webkit-scrollbar-thumb:hover {
  343. background: #909399;
  344. }
  345. }
  346. .right {
  347. width: 250px;
  348. height: 100%;
  349. overflow: hidden;
  350. }
  351. }
  352. .el-dialog__wrapper {
  353. position: relative !important;
  354. }
  355. ::v-deep .el-dialog {
  356. position: fixed !important;
  357. z-index: 999 !important;
  358. top: 50%;
  359. left: 50%;
  360. transform: translate(0, -50%);
  361. }
  362. .titleCharts {
  363. font-size: 16px;
  364. font-weight: 500;
  365. margin-top: 20px;
  366. }
  367. </style>