소스 검색

测试状态代码提交

Morphone0429 4 년 전
부모
커밋
464d641439

+ 6 - 0
src/api/cdss.js

@@ -540,4 +540,10 @@ export default {
   staticKnowledgeTest(param) {
     return axios.post(urls.staticKnowledgeTest, param, { timeout: 30 * 60 * 1000 });
   },
+  getRunningStatus(param) {
+    return axios.post(urls.getRunningStatus, param);
+  },
+  getRunningStatusByHospitalId(param) {
+    return axios.post(urls.getRunningStatusByHospitalId, param);
+  },
 };

+ 2 - 0
src/api/config.js

@@ -515,6 +515,8 @@ export default {
     'getStaticCaseResultList': '/api/cdssman/test/staticKnowledge/getCaseResultList',   //静态知识测试总览列表
     'getStaticPage': '/api/cdssman/test/staticKnowledge/getPage',   //静态知识测试结果明细列表
     'staticKnowledgeTest': '/api/cdssman/test/staticKnowledge/staticKnowledgeTest',   //静态知识测试
+    'getRunningStatus': '/api/cdssman/test/running/getStatus',   //查看测试用例运行状态
+    'getRunningStatusByHospitalId': '/api/cdssman/test/running/getStatusByHospitalId',   //查拉面所有测试用例运行状态
 
   },
   menuIconList: { //菜单对应图标

+ 51 - 5
src/components/testManager/knowledgeMapRule/KnowledgeMapRuleTest.vue

@@ -23,7 +23,12 @@
           >
         </el-form-item>
         <el-form-item style="marginbottom: 0px">
-          <el-button size="mini" @click="handleAllTest">所有规则测试</el-button>
+          <el-button
+            size="mini"
+            @click="handleAllTest"
+            :disabled="!runningStatus"
+            >所有规则测试</el-button
+          >
         </el-form-item>
       </el-form>
     </crumbs>
@@ -76,8 +81,16 @@
         </el-table-column>
         <el-table-column label="操作">
           <template slot-scope="scope">
-            <el-button type="text" size="small" @click="handleTest(scope.row)"
-              >执行测试</el-button
+            <el-button
+              type="text"
+              size="small"
+              @click="handleTest(scope.row, scope.$index)"
+              :disabled="!runningStatus"
+              >{{
+                runningStatusArr[scope.$index] === 1
+                  ? '执行测试中...'
+                  : '执行测试'
+              }}</el-button
             >
           </template>
         </el-table-column>
@@ -97,11 +110,23 @@ export default {
       list: [],
       hospitalData: [],
       hospitalId: '', //选中医院
+      runningStatusArr: [0, 0, 0, 0, 0, 0, 0, 0, 0], //知识图谱规则 测试状态
     };
   },
+  computed: {
+    runningStatus() {
+      return this.runningStatusArr.every((item) => {
+        return item === 0;
+      });
+    },
+  },
   created() {
     this._getHospitalInfoCDSS();
-    // this.getDataList();
+    // this._getRunningStatus()   // 进入页面立即确认状态
+    this.timer = setInterval(this._getRunningStatus, 20 * 1000);
+  },
+  beforeDestroy() {
+    clearInterval(this.timer);
   },
   beforeRouteEnter(to, from, next) {
     next((vm) => {
@@ -112,11 +137,28 @@ export default {
     });
   },
   methods: {
+    _getRunningStatus() {
+      const { hospitalId } = this;
+      if (this.hospitalId === '') return;
+      api.getRunningStatusByHospitalId({ hospitalId }).then((res) => {
+        if (res.data.code === '0' && res.data.data) {
+          this.runningStatusArr = Object.values(res.data.data).slice(0, 9);
+        }
+      });
+    },
+
     indexMethod(index) {
       return index + 1;
     },
     // 执行测试
-    handleTest(row) {
+    handleTest(row, index) {
+      this.runningStatusArr = this.runningStatusArr.map((item, idx) => {
+        if (idx === index) {
+          return 1;
+        } else {
+          return 0;
+        }
+      });
       const { caseName, caseId } = row;
       let params = {
         caseId,
@@ -176,6 +218,7 @@ export default {
           this.$message.error('测试失败');
           this.getDataList(this.hospitalId);
         }
+        this.runningStatusArr = [0, 0, 0, 0, 0, 0, 0, 0, 0];
       });
     },
     // 所有规则测试
@@ -187,7 +230,9 @@ export default {
         });
         return;
       }
+      this.runningStatusArr = [1, 1, 1, 1, 1, 1, 1, 1, 1];
       api.ruleAllTest({ hospitalId: this.hospitalId }).then((res) => {
+        this.runningStatusArr = [0, 0, 0, 0, 0, 0, 0, 0, 0];
         if (res.data.code === '0' && res.data.data) {
           this.getDataList(this.hospitalId);
           this.$message({
@@ -257,6 +302,7 @@ export default {
     handleChange(val) {
       if (val === '') return;
       this.getDataList(val);
+      this._getRunningStatus(); // 选中后立即请求状态
     },
 
     // 获取列表数据

+ 45 - 3
src/components/testManager/staticKnowledgeMap/StaticKnowledgeMapTest.vue

@@ -78,8 +78,16 @@
               id="upFile"
               @change="uploadFile($event)"
             />
-            <el-button type="text" size="small" @click="handleTest(scope.row)"
-              >执行测试</el-button
+            <el-button
+              type="text"
+              size="small"
+              :disabled="!runningStatus"
+              @click="handleTest(scope.row, scope.$index)"
+              >{{
+                runningStatusArr[scope.$index] === 1
+                  ? '执行测试中...'
+                  : '执行测试'
+              }}</el-button
             >
           </template>
         </el-table-column>
@@ -101,10 +109,23 @@ export default {
       hospitalId: '', //选中医院
       type: '',
       caseId: '',
+      runningStatusArr: [0, 0, 0, 0, 0],
+      statusIndex: '',
     };
   },
+  computed: {
+    runningStatus() {
+      return this.runningStatusArr.every((item) => {
+        return item === 0;
+      });
+    },
+  },
   created() {
     this._getHospitalInfoCDSS();
+    this.timer = setInterval(this._getRunningStatus, 20 * 1000);
+  },
+  beforeDestroy() {
+    clearInterval(this.timer);
   },
   beforeRouteEnter(to, from, next) {
     next((vm) => {
@@ -114,6 +135,15 @@ export default {
     });
   },
   methods: {
+    _getRunningStatus() {
+      const { hospitalId } = this;
+      if (this.hospitalId === '') return;
+      api.getRunningStatusByHospitalId({ hospitalId }).then((res) => {
+        if (res.data.code === '0' && res.data.data) {
+          this.runningStatusArr = Object.values(res.data.data).slice(9, 14);
+        }
+      });
+    },
     indexMethod(index) {
       return index + 1;
     },
@@ -142,16 +172,26 @@ export default {
       }
     },
     // 执行测试
-    handleTest(row) {
+    handleTest(row, index) {
       let inp = document.getElementById('upFile');
       inp.click();
       const { caseName, caseId } = row;
       this.type = this.handleType(caseName); //术语类型(1:诊断、2:检验、3:检查、4:药品、5:手术/操作)
       this.caseId = caseId; //测试用例id
+      this.statusIndex = index;
     },
 
     // 导入数据
     uploadFile(e) {
+      if (this.statusIndex !== '') {
+        this.runningStatusArr = this.runningStatusArr.map((item, idx) => {
+          if (idx === this.statusIndex) {
+            return 1;
+          } else {
+            return 0;
+          }
+        });
+      }
       let fileInfo = e.target.files[0];
       e.preventDefault();
       let formData = new FormData();
@@ -192,6 +232,7 @@ export default {
             .then(() => {})
             .catch(() => {});
         }
+        this.runningStatusArr = [0, 0, 0, 0, 0];
       });
       //解决上传相同文件不触发change
       let inp = document.getElementById('upFile');
@@ -219,6 +260,7 @@ export default {
     handleChange(val) {
       if (val === '') return;
       this.getDataList(val);
+      this._getRunningStatus(); // 选中后立即请求状态
     },
 
     // 获取列表数据