소스 검색

重置功能

morphone1995 4 년 전
부모
커밋
33120ce11d
1개의 변경된 파일71개의 추가작업 그리고 71개의 파일을 삭제
  1. 71 71
      src/components/testManager/knowledgeMapRule/KnowledgeMapRuleTest.vue

+ 71 - 71
src/components/testManager/knowledgeMapRule/KnowledgeMapRuleTest.vue

@@ -3,12 +3,7 @@
     <crumbs title="知识图谱规则测试" class="topBack">
       <el-form :inline="true" class="demo-form-inline">
         <el-form-item label class="selectMedicine" style="marginbottom: -1px">
-          <el-select
-            size="mini"
-            v-model="hospitalId"
-            placeholder="选择医院"
-            @change="handleChange"
-          >
+          <el-select size="mini" v-model="hospitalId" placeholder="选择医院" @change="handleChange">
             <el-option
               v-for="item in hospitalData"
               :label="item.name"
@@ -18,47 +13,20 @@
           </el-select>
         </el-form-item>
         <el-form-item style="marginbottom: 0px">
-          <el-button size="mini" @click="exportData"
-            >导出图谱中规则未涉及到的医院术语</el-button
-          >
+          <el-button size="mini" @click="exportData">导出图谱中规则未涉及到的医院术语</el-button>
         </el-form-item>
         <el-form-item style="marginbottom: 0px">
-          <el-button
-            size="mini"
-            @click="handleAllTest"
-            :disabled="!runningStatus"
-            >所有规则测试</el-button
-          >
+          <el-button size="mini" @click="handleAllTest" :disabled="!runningStatus">所有规则测试</el-button>
         </el-form-item>
       </el-form>
     </crumbs>
     <div style="margin: 60px 20px 0">
       <el-table :data="list" border>
-        <el-table-column
-          :resizable="false"
-          type="index"
-          :index="indexMethod"
-          label="编号"
-          width="80"
-        ></el-table-column>
-        <el-table-column
-          :resizable="false"
-          prop="caseName"
-          label="规则类型"
-          show-overflow-tooltip
-        ></el-table-column>
-        <el-table-column
-          :resizable="false"
-          prop="gmtModified"
-          label="测试时间"
-        ></el-table-column>
+        <el-table-column :resizable="false" type="index" :index="indexMethod" label="编号" width="80"></el-table-column>
+        <el-table-column :resizable="false" prop="caseName" label="规则类型" show-overflow-tooltip></el-table-column>
+        <el-table-column :resizable="false" prop="gmtModified" label="测试时间"></el-table-column>
 
-        <el-table-column
-          :resizable="false"
-          prop="ruleNum"
-          label="总条数"
-          show-overflow-tooltip
-        ></el-table-column>
+        <el-table-column :resizable="false" prop="ruleNum" label="总条数" show-overflow-tooltip></el-table-column>
         <el-table-column label="成功条数">
           <template slot-scope="scope">
             <el-button
@@ -66,8 +34,7 @@
               size="small"
               @click="goToFailedOrSuccessPage(scope.row, 'success')"
               :disabled="runningStatusArr[scope.$index] === 1"
-              >{{ scope.row.ruleSuccessNum }}</el-button
-            >
+            >{{ scope.row.ruleSuccessNum }}</el-button>
           </template>
         </el-table-column>
         <el-table-column label="失败条数">
@@ -77,8 +44,7 @@
               size="small"
               @click="goToFailedOrSuccessPage(scope.row, 'failed')"
               :disabled="runningStatusArr[scope.$index] === 1"
-              >{{ scope.row.ruleFailedNum }}</el-button
-            >
+            >{{ scope.row.ruleFailedNum }}</el-button>
           </template>
         </el-table-column>
         <el-table-column label="操作">
@@ -88,12 +54,20 @@
               size="small"
               @click="handleTest(scope.row, scope.$index)"
               :disabled="!runningStatus"
-              >{{
-                runningStatusArr[scope.$index] === 1
-                  ? '执行测试中...'
-                  : '执行测试'
-              }}</el-button
             >
+              {{
+              runningStatusArr[scope.$index] === 1
+              ? '执行测试中...'
+              : '执行测试'
+              }}
+            </el-button>
+            <span v-if="runningStatusArr[scope.$index] === 1">|</span>
+            <el-button
+              v-if="runningStatusArr[scope.$index] === 1"
+              type="text"
+              size="small"
+              @click="handleUpdateStatus(scope.row, scope.$index)"
+            >重置</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -112,15 +86,15 @@ export default {
       list: [],
       hospitalData: [],
       hospitalId: '', //选中医院
-      runningStatusArr: [0, 0, 0, 0, 0, 0, 0, 0, 0], //知识图谱规则 测试状态
+      runningStatusArr: [0, 0, 0, 0, 0, 0, 0, 0, 0] //知识图谱规则 测试状态
     };
   },
   computed: {
     runningStatus() {
-      return this.runningStatusArr.every((item) => {
+      return this.runningStatusArr.every(item => {
         return item === 0;
       });
-    },
+    }
   },
   created() {
     this._getHospitalInfoCDSS();
@@ -131,7 +105,7 @@ export default {
     clearInterval(this.timer);
   },
   beforeRouteEnter(to, from, next) {
-    next((vm) => {
+    next(vm => {
       Object.assign(vm, to.params);
       if (Object.keys(to.params).length === 0) return;
       vm.getDataList(to.params.hospitalId);
@@ -143,12 +117,38 @@ export default {
     _getRunningStatus() {
       const { hospitalId } = this;
       if (this.hospitalId === '') return;
-      api.getRunningStatusByHospitalId({ hospitalId }).then((res) => {
+      api.getRunningStatusByHospitalId({ hospitalId }).then(res => {
         if (res.data.code === '0' && res.data.data) {
           this.runningStatusArr = Object.values(res.data.data).slice(0, 9);
         }
       });
     },
+    // 重置状态
+    handleUpdateStatus(row, index) {
+      const { caseId } = row;
+      // console.log(index,'index');
+      let statusTempArr = [...this.runningStatusArr];
+      statusTempArr[index] = 0;
+      api
+        .updateRunningStatus({
+          hospitalId: this.hospitalId,
+          caseId,
+          status: 0
+        })
+        .then(res => {
+          if (res.data.code === '0' && res.data.data) {
+            this.$message({
+              message: '重置成功',
+              type: 'success'
+            });
+            this.getDataList(this.hospitalId); // 重新获取列表
+          } else {
+            this.$message.error(res.data.msg || '重置失败');
+            this.getDataList(this.hospitalId); // 重新获取列表
+          }
+          this.runningStatusArr = statusTempArr;
+        });
+    },
 
     indexMethod(index) {
       return index + 1;
@@ -165,7 +165,7 @@ export default {
       const { caseName, caseId } = row;
       let params = {
         caseId,
-        hospitalId: this.hospitalId,
+        hospitalId: this.hospitalId
       };
       let requestAjax;
       let billType; // 开单合理性规则类型  1  通用  2 输血
@@ -210,12 +210,12 @@ export default {
         requestAjax = 'otherRuleTest';
       }
 
-      api[requestAjax](params).then((res) => {
+      api[requestAjax](params).then(res => {
         if (res.data.code === '0' && res.data.data) {
           this.getDataList(this.hospitalId);
           this.$message({
             message: '测试成功',
-            type: 'success',
+            type: 'success'
           });
         } else {
           this.$message.error('测试失败');
@@ -229,18 +229,18 @@ export default {
       if (this.hospitalId === '') {
         this.$message({
           message: '请先选择医院',
-          type: 'warning',
+          type: 'warning'
         });
         return;
       }
       this.runningStatusArr = [1, 1, 1, 1, 1, 1, 1, 1, 1];
-      api.ruleAllTest({ hospitalId: this.hospitalId }).then((res) => {
+      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({
             message: '所有规则测试成功',
-            type: 'success',
+            type: 'success'
           });
         } else {
           this.$message.error('所有规则测试失败');
@@ -253,7 +253,7 @@ export default {
     goToFailedOrSuccessPage(row, type) {
       const page = this.handleGoPage(row.caseName);
       let hospital = this.hospitalData.find(
-        (item) => item.id === this.hospitalId
+        item => item.id === this.hospitalId
       );
       let hospitalName = hospital.name;
       this.$router.push({
@@ -262,8 +262,8 @@ export default {
           data: { ...row },
           type,
           hospitalId: this.hospitalId,
-          hospitalName,
-        },
+          hospitalName
+        }
       });
     },
     // 处理跳转到的页面
@@ -294,7 +294,7 @@ export default {
 
     // 获取医院信息
     _getHospitalInfoCDSS() {
-      api.getHospitalInfo().then((res) => {
+      api.getHospitalInfo().then(res => {
         if (res.data.code === '0') {
           this.hospitalData = res.data && res.data.data;
         }
@@ -311,16 +311,16 @@ export default {
     // 获取列表数据
     getDataList(id) {
       const params = {
-        hospitalId: id,
+        hospitalId: id
       };
       this.searched = true;
       const loading = this.$loading({
         lock: true,
         text: 'Loading',
         spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)',
+        background: 'rgba(0, 0, 0, 0.7)'
       });
-      api.getCaseResultList(params).then((res) => {
+      api.getCaseResultList(params).then(res => {
         loading.close();
         if (res.data.code === '0') {
           this.list = res.data && res.data.data;
@@ -332,17 +332,17 @@ export default {
       if (this.hospitalId === '') {
         this.$message({
           message: '请先选择医院',
-          type: 'warning',
+          type: 'warning'
         });
         return;
       }
       this.$alert('确定要导出规则未使用映射关系吗?', '', {
         confirmButtonText: '确定',
         title: '提示',
-        type: 'warning',
+        type: 'warning'
       })
         .then(() => {
-          api.exportRuleExcel({ hospitalId: this.hospitalId }).then((res) => {
+          api.exportRuleExcel({ hospitalId: this.hospitalId }).then(res => {
             if (res.status === 200) {
               this.$message({ message: '导出成功', type: 'success' });
               utils.downloadExportedData(res.data, '规则未使用映射关系.xls');
@@ -350,8 +350,8 @@ export default {
           });
         })
         .catch(() => {});
-    },
-  },
+    }
+  }
 };
 </script>