assetssMag.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955
  1. <template>
  2. <div class="global-variable">
  3. <div class="condition">
  4. <el-alert
  5. title="分析前请核对数据是否导入,点击查看是否导入即可查看"
  6. type="warning"
  7. show-icon
  8. >
  9. </el-alert>
  10. <el-form
  11. :inline="true"
  12. ref="ruleForm"
  13. :model="formInline"
  14. class="demo-form-inline"
  15. :rules="rules"
  16. >
  17. <el-form-item label="分析主题:" prop="analysisName">
  18. <el-input
  19. size="small"
  20. v-model="formInline.analysisName"
  21. placeholder="请输入分析主题"
  22. ></el-input>
  23. </el-form-item>
  24. <el-form-item label="风场名称:" prop="fieldName">
  25. <el-input
  26. size="small"
  27. v-model="formInline.fieldName"
  28. placeholder="请输入风场名称"
  29. ></el-input>
  30. </el-form-item>
  31. <el-form-item label="分析状态:" prop="analysisState">
  32. <el-select
  33. size="small"
  34. v-model="formInline.analysisState"
  35. placeholder="请选择分析状态"
  36. >
  37. <el-option
  38. v-for="item in options"
  39. :key="item.value"
  40. :label="item.label"
  41. :value="item.value"
  42. >
  43. </el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" @click="onSubmit" size="small"
  48. >查询</el-button
  49. >
  50. <el-button @click="reset('ruleForm')" size="small">重置</el-button>
  51. </el-form-item>
  52. <el-form-item class="right-align">
  53. <el-button @click="Newanalyse" size="small">创建分析</el-button>
  54. <el-button @click="examine" size="small">查看导入数据</el-button>
  55. </el-form-item>
  56. </el-form>
  57. </div>
  58. <div class="list-page">
  59. <el-table
  60. class="center-align-table"
  61. :data="tableData"
  62. border
  63. :cell-style="rowStyle"
  64. >
  65. <el-table-column
  66. align="center"
  67. label="分析主题"
  68. prop="analysisName"
  69. min-width="200"
  70. fixed
  71. >
  72. <template slot-scope="scope">
  73. <el-tooltip
  74. class="item"
  75. effect="dark"
  76. :content="scope.row.sketch || '暂无分析简述'"
  77. placement="top"
  78. >
  79. <span>{{ scope.row.analysisName }}</span>
  80. </el-tooltip>
  81. </template>
  82. </el-table-column>
  83. <el-table-column
  84. align="center"
  85. prop="fieldName"
  86. label="风场名称"
  87. min-width="200"
  88. >
  89. </el-table-column>
  90. <el-table-column
  91. prop="loginName"
  92. align="center"
  93. label="分析状态"
  94. min-width="150"
  95. >
  96. <template slot-scope="scope">
  97. <span v-if="scope.row.analysisState == -1">未关联</span>
  98. <span
  99. v-else-if="
  100. scope.row.analysisState == 20 && scope.row.errState == 0
  101. "
  102. style="color: #f90"
  103. >分析中</span
  104. >
  105. <span v-else-if="scope.row.errState == 1" style="color: #f00"
  106. >分析异常</span
  107. >
  108. <span
  109. v-else-if="scope.row.analysisState == 30"
  110. style="color: #4caf50"
  111. >分析完成</span
  112. >
  113. <span
  114. v-else-if="scope.row.analysisState == 10"
  115. style="color: #4caf50"
  116. >排队中</span
  117. >
  118. <span v-else>/</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column
  122. prop="loginName"
  123. align="center"
  124. label="进度"
  125. min-width="150"
  126. >
  127. <template slot-scope="scope">
  128. <el-progress
  129. v-if="scope.row.analysisState == 20"
  130. :text-inside="true"
  131. :stroke-width="20"
  132. :percentage="scope.row.analysisProgress"
  133. :class="{
  134. 'indeterminate-progress': scope.row.analysisProgress < 100,
  135. 'animated-progress': true,
  136. }"
  137. ></el-progress>
  138. <span v-else>/</span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column
  142. align="center"
  143. label="待分析排位"
  144. prop="orderNum"
  145. min-width="200"
  146. >
  147. <template slot-scope="scope">
  148. <span> {{ scope.row.orderNum }}</span>
  149. </template>
  150. </el-table-column>
  151. <!-- <el-table-column
  152. align="center"
  153. label="排队序号"
  154. prop="orderNum"
  155. min-width="200"
  156. >
  157. </el-table-column> -->
  158. <el-table-column
  159. align="center"
  160. label="数据类型名称"
  161. prop="dataTypeName"
  162. min-width="200"
  163. >
  164. </el-table-column>
  165. <!-- <el-table-column
  166. prop="errState"
  167. align="center"
  168. label="异常状态"
  169. min-width="120"
  170. >
  171. <template slot-scope="scope">
  172. <span>
  173. {{
  174. scope.row.errState == 0 && scope.row.analysisState !== -1
  175. ? "未异常"
  176. : scope.row.errState === 1
  177. ? "异常"
  178. : "/"
  179. }}</span
  180. >
  181. </template>
  182. </el-table-column> -->
  183. <el-table-column
  184. prop="roleName"
  185. align="center"
  186. label="异常信息"
  187. min-width="120"
  188. >
  189. <template slot-scope="scope">
  190. <el-button
  191. v-if="scope.row.errState == 1"
  192. @click="abnormalDialog(scope.row, '异常详情')"
  193. type="text"
  194. size="small"
  195. >异常详情</el-button
  196. >
  197. <span v-else>/</span>
  198. </template>
  199. </el-table-column>
  200. <el-table-column
  201. prop="roleName"
  202. align="center"
  203. label="分析记录"
  204. min-width="120"
  205. >
  206. <template slot-scope="scope">
  207. <!-- 分析完成 -->
  208. <el-button
  209. v-if="scope.row.analysisState == 30 && scope.row.errState !== 1"
  210. @click="handleAssetssDetail(scope.row, '1')"
  211. type="text"
  212. size="small"
  213. >分析详情</el-button
  214. >
  215. <!-- 分析中 -->
  216. <el-button
  217. v-else-if="
  218. scope.row.analysisState == 20 && scope.row.errState == 0
  219. "
  220. @click="handleAssetssDetail(scope.row, '0')"
  221. type="text"
  222. size="small"
  223. >分析详情</el-button
  224. >
  225. <span v-else>/</span>
  226. </template>
  227. </el-table-column>
  228. <el-table-column
  229. prop="reportVos"
  230. align="center"
  231. label="报告"
  232. min-width="120"
  233. >
  234. <template slot-scope="scope">
  235. <el-dropdown v-if="scope.row.reportVos.length > 0" trigger="click">
  236. <el-button type="text" size="small" class="el-dropdown-link">
  237. 查看报告
  238. </el-button>
  239. <el-dropdown-menu slot="dropdown">
  240. <el-dropdown-item
  241. v-for="val in scope.row.reportVos"
  242. class="reportItemVal"
  243. >
  244. <div class="reportLeft">
  245. <span>{{ val.reportName }}</span>
  246. </div>
  247. <div class="reportRight">
  248. <el-button
  249. type="text"
  250. size="small"
  251. @click="detailReportAssetss(val)"
  252. >
  253. 查看
  254. </el-button>
  255. <el-button
  256. type="text"
  257. size="small"
  258. @click="downLoadeAssetss(val)"
  259. >
  260. 下载
  261. </el-button>
  262. </div>
  263. </el-dropdown-item>
  264. </el-dropdown-menu>
  265. </el-dropdown>
  266. <span v-else>/</span>
  267. </template>
  268. </el-table-column>
  269. <el-table-column
  270. prop="dataStartTime"
  271. align="center"
  272. label="开始时间"
  273. min-width="230"
  274. >
  275. </el-table-column>
  276. <el-table-column
  277. prop="dataEndTime"
  278. align="center"
  279. label="结束时间"
  280. min-width="230"
  281. >
  282. </el-table-column>
  283. <el-table-column
  284. prop="transition"
  285. align="center"
  286. fixed="right"
  287. label="操作"
  288. min-width="300"
  289. >
  290. <template slot-scope="scope">
  291. <el-button
  292. @click="abnormalDialog(scope.row, '上传报告')"
  293. type="text"
  294. size="small"
  295. >上传报告</el-button
  296. >
  297. <el-button
  298. @click="handleAssetss(scope.row)"
  299. type="text"
  300. :disabled="
  301. (scope.row.analysisState == 20 && scope.row.errState == 0) ||
  302. scope.row.analysisState == 10
  303. "
  304. size="small"
  305. >分析</el-button
  306. >
  307. <el-button
  308. @click="abnormalDialog(scope.row, '异常描述')"
  309. type="text"
  310. size="small"
  311. >异常描述</el-button
  312. >
  313. <el-button
  314. v-if="scope.row.analysisState == 10"
  315. @click="insertQueue(scope.row)"
  316. type="text"
  317. size="small"
  318. >插队</el-button
  319. >
  320. <!-- <el-button
  321. @click="HandleOnOffAuto(scope.row)"
  322. type="text"
  323. size="small"
  324. >{{
  325. scope.row.onOffCall === 0 ? "开启自动分析" : "关闭自动分析"
  326. }}</el-button
  327. > -->
  328. </template>
  329. </el-table-column>
  330. </el-table>
  331. <div class="pagination-container">
  332. <el-pagination
  333. @current-change="handleCurrentChange"
  334. :current-page.sync="formInline.pageNum"
  335. layout="total, prev, pager, next"
  336. :page-size="formInline.pageSize"
  337. :total="formInline.totalSize"
  338. >
  339. </el-pagination>
  340. </div>
  341. </div>
  342. <!-- 弹出层 -->
  343. <!-- 异常信息 /异常描述 /上传报告-->
  344. <my-dialog
  345. :visible="dialogVisible"
  346. :title="title"
  347. :rowInfo="rowInfo"
  348. @confirm="handleConfirm"
  349. @getTableList="getTableList"
  350. >
  351. <div slot="tableEl">
  352. <el-empty description="暂无数据"></el-empty>
  353. </div>
  354. </my-dialog>
  355. <!-- 查看报告详情 -->
  356. <el-dialog
  357. title="PDF 预览"
  358. :visible.sync="dialogReportVisible"
  359. :width="dialogWidth"
  360. class="pdfDialog"
  361. :before-close="handleCloses"
  362. >
  363. <span>
  364. <div
  365. style="
  366. float: right;
  367. color: #fff;
  368. cursor: pointer;
  369. position: absolute;
  370. left: 90%;
  371. top: 21px;
  372. "
  373. >
  374. <span
  375. v-if="dialogWidth === '80%'"
  376. @click="() => (dialogWidth = '100%')"
  377. >全屏查看</span
  378. >
  379. <span
  380. v-if="dialogWidth === '100%'"
  381. @click="() => (dialogWidth = '80%')"
  382. >还原</span
  383. >
  384. <!-- {{ isFullscreen ? "还原" : "全屏" }} -->
  385. </div>
  386. </span>
  387. <div class="pdf-container" ref="viewer">
  388. <iframe :src="pdfUrl" width="100%" height="100%"></iframe>
  389. </div>
  390. <div></div>
  391. </el-dialog>
  392. <!-- 创建分析弹出框 -->
  393. <el-dialog
  394. title="创建分析"
  395. :visible.sync="addDialogVisible"
  396. width="30%"
  397. :before-close="AddHandleCloses"
  398. >
  399. <el-form
  400. :model="addRuleForm"
  401. :rules="addRules"
  402. ref="addRuleForm"
  403. label-width="100px"
  404. class="add-ruleForm"
  405. >
  406. <el-form-item label="关联风场" prop="fieldCode">
  407. <el-select
  408. v-model="addRuleForm.fieldCode"
  409. placeholder="请选择关联风场"
  410. >
  411. <el-option
  412. :label="item.fieldName"
  413. v-for="item in fieldCodeList"
  414. :value="item.codeNumber"
  415. ></el-option>
  416. </el-select>
  417. </el-form-item>
  418. <el-form-item label="" prop="analysisName">
  419. <b style="color: #f00; font-size: 12px"
  420. >不填写分析主题,自动采用系统生成的主题!</b
  421. >
  422. </el-form-item>
  423. <el-form-item label="分析主题" prop="analysisName">
  424. <el-input v-model="addRuleForm.analysisName"></el-input>
  425. </el-form-item>
  426. <el-form-item label="分析简述" prop="sketch">
  427. <el-input type="textarea" v-model="addRuleForm.sketch"></el-input>
  428. </el-form-item>
  429. <el-form-item>
  430. <el-button type="primary" @click="addRuleFormSubmit">提交</el-button>
  431. <el-button @click="AddHandleCloses">取消</el-button>
  432. </el-form-item>
  433. </el-form>
  434. </el-dialog>
  435. </div>
  436. </template>
  437. <script>
  438. import MyDialog from "./components/dialogCom.vue";
  439. import { downloadPDF } from "@/utils/common";
  440. import {
  441. onOffAutoAnalysis,
  442. analysisResultList,
  443. addAnalysisResult,
  444. queryCodeNum,
  445. editPriority,
  446. } from "@/api/performance";
  447. import { from } from "plotly.js-dist";
  448. import { disable } from "ol/rotationconstraint";
  449. export default {
  450. components: {
  451. MyDialog,
  452. },
  453. data() {
  454. return {
  455. fieldCodeList: [],
  456. addDialogVisible: false,
  457. dialogWidth: "80%",
  458. intervalId: null,
  459. startTime: null,
  460. maxPollingTime: 3 * 60 * 1000, //轮询最大时间
  461. dialogVisible: false,
  462. loadingView: false,
  463. loading: false, //数据加载中
  464. errorInfo: "",
  465. options: [
  466. {
  467. value: "-1",
  468. label: "未关联",
  469. },
  470. {
  471. value: "10",
  472. label: "排队中",
  473. },
  474. {
  475. value: "20",
  476. label: "分析中",
  477. },
  478. {
  479. value: "30",
  480. label: "已分析",
  481. },
  482. ],
  483. addRules: {
  484. fieldCode: [
  485. { required: true, message: "请选择关联风场", trigger: "change" },
  486. ],
  487. },
  488. addRuleForm: {
  489. fieldCode: "",
  490. analysisName: "",
  491. sketch: "",
  492. },
  493. rules: {
  494. fieldName: { trigger: "blur" },
  495. },
  496. roleList: [],
  497. formInline: {
  498. fieldName: undefined,
  499. pageNum: 1,
  500. pageSize: 10,
  501. totalSize: 0,
  502. analysisName: undefined,
  503. analysisState: undefined,
  504. },
  505. tableData: [],
  506. rowInfo: {},
  507. title: "",
  508. viewerInstance: null, // PDF 文件 URL
  509. dialogReportVisible: false,
  510. pdfUrl: "",
  511. isPolling: false, // 轮询状态标识
  512. firstLoad: true, // 是否是第一次加载
  513. };
  514. },
  515. created() {
  516. window.addEventListener("message", this.handleMessage); //江
  517. },
  518. beforeDestroy() {
  519. this.stopPolling();
  520. // 销毁消息监听器
  521. window.removeEventListener("message", this.handleMessage); //江
  522. },
  523. methods: {
  524. // 创建分析时请求
  525. async addRuleFormSubmit() {
  526. this.$refs.addRuleForm.validate(async (valid) => {
  527. if (valid) {
  528. try {
  529. const res = await addAnalysisResult(this.addRuleForm);
  530. if (res.code === 200) {
  531. this.$message({
  532. type: "success",
  533. message: "创建成功",
  534. });
  535. this.addDialogVisible = false;
  536. this.loading = false;
  537. this.isPolling = false;
  538. await this.getTableList();
  539. this.$router.push({
  540. path: "/home/performance/editAssets",
  541. query: {
  542. batchCode: this.tableData[0].batchCode,
  543. analysisTypeCode: this.tableData[0].analysisTypeCode,
  544. fieldEngineCode: this.tableData[0].fieldCode,
  545. },
  546. });
  547. }
  548. } catch (err) {
  549. console.error(err);
  550. }
  551. }
  552. });
  553. },
  554. AddHandleCloses(done) {
  555. this.$confirm("确认关闭?")
  556. .then((_) => {
  557. this.addDialogVisible = false;
  558. done();
  559. })
  560. .catch((_) => {});
  561. },
  562. //获取风场列表
  563. async getQueryCodeNumList() {
  564. this.loading = true;
  565. try {
  566. const result = await queryCodeNum();
  567. this.fieldCodeList = result.data.fieldCodeList;
  568. this.loading = false;
  569. } catch (error) {
  570. console.error(error);
  571. this.loading = false;
  572. }
  573. },
  574. handleCloses(done) {
  575. this.$confirm("确认关闭?")
  576. .then((_) => {
  577. done();
  578. })
  579. .catch((_) => {});
  580. },
  581. //查看pdf 文件
  582. detailReportAssetss(row) {
  583. this.dialogReportVisible = true;
  584. this.pdfUrl = row.reportAddr;
  585. },
  586. //下载pdf 文件
  587. downLoadeAssetss(row) {
  588. downloadPDF(row.reportAddr, row.reportName);
  589. },
  590. async HandleOnOffAuto(row) {
  591. try {
  592. const form = new FormData();
  593. form.append("batchCode", row.batchCode);
  594. form.append("onOffCall", row.onOffCall === 0 ? 1 : 0);
  595. const res = await onOffAutoAnalysis(form);
  596. if (res.code === 200) {
  597. this.getTableList();
  598. this.$message({
  599. type: "success",
  600. message: `${row.onOffCall === 0 ? "开启" : "关闭"}成功`,
  601. });
  602. }
  603. } catch (err) {
  604. console.error(err);
  605. }
  606. },
  607. //插队接口
  608. async insertQueue(row) {
  609. this.$confirm(`确认插队?`, "提示", {
  610. confirmButtonText: "确定",
  611. cancelButtonText: "取消",
  612. type: "warning",
  613. })
  614. .then(async () => {
  615. const formData = new FormData();
  616. formData.append("batchCode", row.batchCode);
  617. formData.append("priority", 1);
  618. const result = await editPriority(formData);
  619. console.log(result, "插队结果");
  620. if (result.code === 200) {
  621. this.$message({
  622. type: "success",
  623. message: "插队成功",
  624. });
  625. await this.fetchData();
  626. }
  627. })
  628. .catch(() => {});
  629. },
  630. //分析
  631. handleAssetss(row) {
  632. this.$router.push({
  633. path: "/home/performance/editAssets",
  634. query: {
  635. batchCode: row.batchCode,
  636. analysisTypeCode: row.analysisTypeCode,
  637. fieldEngineCode: row.fieldCode,
  638. },
  639. });
  640. },
  641. //分析详情
  642. handleAssetssDetail(row, state) {
  643. const navigateToDetails = () => {
  644. this.$router.push({
  645. path: "/home/performance/overview",
  646. query: {
  647. batchCode: row.batchCode,
  648. // analysisTypeCode: row.analysisTypeCode,
  649. fieldCode: row.fieldCode,
  650. },
  651. });
  652. };
  653. if (state === "0") {
  654. // 分析状态为分析中
  655. this.$confirm(
  656. "当前查看的分析记录为历史分析结果,最新分析记录还未分析完成不展示!"
  657. )
  658. .then(() => {
  659. navigateToDetails();
  660. })
  661. .catch(() => {});
  662. } else {
  663. navigateToDetails();
  664. }
  665. },
  666. abnormalDialog(row, title) {
  667. this.dialogVisible = true;
  668. if (title === "异常详情") {
  669. this.errorInfo = row.errInfo;
  670. this.rowInfo = {};
  671. } else if (title === "异常描述") {
  672. this.errorInfo = "";
  673. this.rowInfo = { ...row };
  674. } else if (title === "上传报告") {
  675. this.errorInfo = "";
  676. this.rowInfo = {};
  677. this.rowInfo.batchCode = row.batchCode;
  678. }
  679. this.title = title;
  680. },
  681. handleConfirm() {
  682. this.dialogVisible = false;
  683. },
  684. // 页码变化时才触发查询
  685. handleCurrentChange(val) {
  686. this.formInline.pageNum = val;
  687. this.getTableList();
  688. },
  689. // 修改 getTableList 方法,避免重复请求
  690. async getTableList() {
  691. // 如果正在请求中,跳过此次调用
  692. console.log(this.loading, this.isPolling);
  693. if (this.loading || this.isPolling) return;
  694. this.loading = true;
  695. try {
  696. const params = { ...this.formInline, totalSize: undefined };
  697. // 传递条件参数
  698. if (this.formInline.analysisState !== undefined) {
  699. params.analysisState = this.formInline.analysisState;
  700. }
  701. if (this.formInline.errState !== undefined) {
  702. params.errState = this.formInline.errState;
  703. }
  704. const result = await analysisResultList(params);
  705. this.tableData = result.data.list;
  706. console.log(this.tableData, "result this.tableData");
  707. this.formInline.totalSize = result.data.totalSize;
  708. } catch (error) {
  709. this.$message({
  710. type: "error",
  711. message: "请检查是否连接网络",
  712. });
  713. } finally {
  714. this.loading = false;
  715. }
  716. },
  717. // 改进 handleMessage,避免频繁请求
  718. handleMessage(event) {
  719. // 确保消息来自当前域
  720. if (event.origin !== window.location.origin) {
  721. return;
  722. }
  723. const { fieldName, analysisState, errState } = event.data;
  724. // 更新表单字段
  725. if (fieldName !== undefined) {
  726. this.formInline.fieldName = fieldName;
  727. console.log(fieldName, "0");
  728. }
  729. if (analysisState !== undefined) {
  730. this.formInline.analysisState = analysisState;
  731. console.log(analysisState, "2");
  732. }
  733. if (errState !== undefined) {
  734. this.formInline.errState = errState;
  735. console.log(errState, "1");
  736. }
  737. // 如果当前没有请求中,才调用 getTableList
  738. // console.log(
  739. // this.loading,
  740. // fieldName,
  741. // analysisState,
  742. // "如果当前没有请求中,才调用"
  743. // );
  744. if (!this.loading) {
  745. this.getTableList();
  746. // this.startPolling();
  747. }
  748. },
  749. rowStyle() {
  750. return "text-align:center";
  751. },
  752. // 查询
  753. onSubmit() {
  754. this.fetchData();
  755. },
  756. // 重置
  757. reset(formName) {
  758. this.$refs[formName].resetFields();
  759. this.formInline.fieldName = "";
  760. this.formInline.analysisName = "";
  761. this.formInline.analysisState = "";
  762. this.formInline.errState = "";
  763. this.fetchData();
  764. },
  765. // fetchData 方法在轮询中调用
  766. async fetchData() {
  767. try {
  768. const result = await analysisResultList({
  769. ...this.formInline,
  770. totalSize: undefined,
  771. });
  772. this.tableData = result.data.list;
  773. this.formInline.totalSize = result.data.totalSize;
  774. } catch (error) {
  775. this.$message({
  776. type: "error",
  777. message: "请检查是否连接网络",
  778. });
  779. }
  780. },
  781. stopPolling() {
  782. if (this.intervalId) {
  783. clearInterval(this.intervalId);
  784. this.intervalId = null;
  785. }
  786. this.isPolling = false;
  787. },
  788. // 启动轮询时,避免重复请求
  789. startPolling() {
  790. this.startTime = new Date().getTime();
  791. this.isPolling = true;
  792. this.intervalId = setInterval(() => {
  793. const currentTime = new Date().getTime();
  794. if (currentTime - this.startTime >= this.maxPollingTime) {
  795. this.stopPolling();
  796. } else {
  797. // 轮询期间不重复请求,检查是否可以调用 fetchData
  798. if (!this.loading) {
  799. this.fetchData();
  800. }
  801. }
  802. }, 1000); // 每10秒检查一次
  803. },
  804. //创建分析
  805. Newanalyse() {
  806. this.addDialogVisible = true;
  807. this.getQueryCodeNumList();
  808. },
  809. examine() {
  810. this.$router.push({
  811. path: "/transition",
  812. });
  813. },
  814. },
  815. mounted() {
  816. this.getTableList();
  817. setTimeout(() => {
  818. this.startPolling();
  819. }, 10000);
  820. },
  821. };
  822. </script>
  823. <style lang="scss" scoped>
  824. @keyframes striped-flow {
  825. from {
  826. background-position: 0 100px;
  827. }
  828. to {
  829. background-position: 1.25em 1.25em;
  830. }
  831. }
  832. .general {
  833. display: flex;
  834. flex-wrap: wrap;
  835. .condition {
  836. width: 50%;
  837. display: flex;
  838. p {
  839. width: 100px;
  840. text-align: right;
  841. line-height: 40px;
  842. }
  843. span {
  844. line-height: 40px;
  845. padding-left: 20px;
  846. }
  847. .el-select {
  848. width: 100%;
  849. margin-bottom: 20px;
  850. }
  851. .el-input {
  852. margin-bottom: 20px;
  853. }
  854. }
  855. }
  856. .attachment {
  857. display: flex;
  858. padding-top: 10px;
  859. p {
  860. margin-right: 20px;
  861. color: #409eff;
  862. }
  863. }
  864. .add-ruleForm {
  865. .el-select {
  866. width: 100%;
  867. }
  868. }
  869. .addition {
  870. display: flex;
  871. justify-content: flex-end;
  872. margin-bottom: 10px;
  873. }
  874. .demo-ruleForm {
  875. .el-form-item {
  876. margin-bottom: 25px;
  877. }
  878. }
  879. ::v-deep .animated-progress .el-progress-bar__outer {
  880. height: 15px; /* Adjust height as needed */
  881. background-color: rgb(235, 238, 245);
  882. background-image: linear-gradient(
  883. 45deg,
  884. rgba(0, 0, 0, 0.1) 25%,
  885. transparent 25%,
  886. transparent 50%,
  887. rgba(0, 0, 0, 0.1) 50%,
  888. rgba(0, 0, 0, 0.1) 75%,
  889. transparent 75%,
  890. transparent
  891. );
  892. background-size: 1.25em 1.25em;
  893. animation: striped-flow 3s linear infinite;
  894. }
  895. .reportItemVal {
  896. display: flex;
  897. justify-content: space-between;
  898. align-items: center;
  899. .reportLeft {
  900. margin-right: 50px;
  901. }
  902. }
  903. ::v-deep .pdfDialog .el-dialog {
  904. height: 100vh;
  905. display: flex;
  906. flex-direction: column;
  907. margin: 0 auto !important;
  908. .el-dialog__body {
  909. // height: 100% !important;
  910. flex: 1;
  911. background: #fff;
  912. .pdf-container {
  913. display: flex;
  914. justify-content: center;
  915. align-items: center;
  916. height: 100% !important;
  917. }
  918. }
  919. }
  920. canvas {
  921. border: 1px solid #dcdfe6;
  922. }
  923. .right-align {
  924. white-space: nowrap;
  925. }
  926. </style>