index.vue 10 KB

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