浏览代码

Merge branch 'bug0818' into test

1178232204@qq.com 2 年之前
父节点
当前提交
02bfb8d190
共有 1 个文件被更改,包括 59 次插入52 次删除
  1. 59 52
      src/components/testManager/staticKnowledgeMap/StaticKnowledgeMapTest.vue

+ 59 - 52
src/components/testManager/staticKnowledgeMap/StaticKnowledgeMapTest.vue

@@ -87,9 +87,10 @@
               @click="handleTest(scope.row, scope.$index)"
               >{{
                 runningStatusArr[scope.$index] === 1
-                  ? '执行测试中...'
-                  :implement?'执行测试'
-                  : '执行测试'
+                  ? "执行测试中..."
+                  : implement
+                  ? "执行测试"
+                  : "执行测试"
               }}</el-button
             >
             <span v-if="runningStatusArr[scope.$index] === 1"> | </span>
@@ -109,21 +110,21 @@
 </template>
 
 <script>
-import api from '@api/cdss.js';
-import config from '@api/config.js';
-import utils from '@api/utils.js';
+import api from "@api/cdss.js";
+import config from "@api/config.js";
+import utils from "@api/utils.js";
 export default {
-  name: 'KnowledgeMapRuleTest',
+  name: "KnowledgeMapRuleTest",
   data() {
     return {
       list: [],
       hospitalData: [],
-      hospitalId: '', //选中医院
-      type: '',
-      caseId: '',
+      hospitalId: "", //选中医院
+      type: "",
+      caseId: "",
       runningStatusArr: [0, 0, 0, 0, 0],
-      statusIndex: '',
-      implement: false
+      statusIndex: "",
+      implement: false,
     };
   },
   computed: {
@@ -153,20 +154,20 @@ export default {
     getRunningState() {
       api
         .getRunningState({ caseGroup: 2 })
-        .then(res => {
-          if (res.data.code == '0') {
-            this.implement = res.data.data
+        .then((res) => {
+          if (res.data.code == "0") {
+            this.implement = res.data.data;
           }
         })
-        .catch(error => {
+        .catch((error) => {
           console.log(error);
         });
     },
     _getRunningStatus() {
       const { hospitalId } = this;
-      if (this.hospitalId === '') return;
+      if (this.hospitalId === "") return;
       api.getRunningStatusByHospitalId({ hospitalId }).then((res) => {
-        if (res.data.code === '0' && res.data.data) {
+        if (res.data.code === "0" && res.data.data) {
           this.runningStatusArr = Object.values(res.data.data).slice(9, 14);
         }
       });
@@ -177,23 +178,27 @@ export default {
     // 获取医院信息
     _getHospitalInfoCDSS() {
       api.getHospitalInfo().then((res) => {
-        if (res.data.code === '0') {
+        if (res.data.code === "0") {
           this.hospitalData = res.data && res.data.data;
         }
       });
     },
     handleType(caseName) {
       switch (caseName) {
-        case '诊断':
+        case "诊断":
           return 1;
-        case '检验':
+        case "检验":
           return 2;
-        case '检查':
+        case "检查":
           return 3;
-        case '药品':
+        case "药品":
           return 4;
-        case '手术/操作':
+        case "手术/操作":
           return 5;
+        case "量表":
+          return 6;
+        case "护理":
+          return 7;
         default:
           return null;
       }
@@ -208,17 +213,17 @@ export default {
           status: 0,
         })
         .then((res) => {
-          if (res.data.code === '0' && res.data.data) {
+          if (res.data.code === "0" && res.data.data) {
             this.$message({
-              message: '重置成功',
-              type: 'success',
+              message: "重置成功",
+              type: "success",
             });
             this.getDataList(this.hospitalId); // 重新获取列表
-            this.getRunningState()
+            this.getRunningState();
           } else {
-            this.$message.error(res.data.msg || '重置失败');
+            this.$message.error(res.data.msg || "重置失败");
             this.getDataList(this.hospitalId); // 重新获取列表
-            this.getRunningState()
+            this.getRunningState();
           }
           this.runningStatusArr = [0, 0, 0, 0, 0];
         });
@@ -226,9 +231,11 @@ export default {
 
     // 执行测试
     handleTest(row, index) {
-      let inp = document.getElementById('upFile');
+      console.log(this.handleType(caseName), 1111);
+      let inp = document.getElementById("upFile");
       inp.click();
       const { caseName, caseId } = row;
+      console.log(row, 222);
       this.type = this.handleType(caseName); //术语类型(1:诊断、2:检验、3:检查、4:药品、5:手术/操作)
       this.caseId = caseId; //测试用例id
       this.statusIndex = index;
@@ -236,7 +243,7 @@ export default {
 
     // 导入数据
     uploadFile(e) {
-      if (this.statusIndex !== '') {
+      if (this.statusIndex !== "") {
         this.runningStatusArr = this.runningStatusArr.map((item, idx) => {
           if (idx === this.statusIndex) {
             return 1;
@@ -248,34 +255,34 @@ export default {
       let fileInfo = e.target.files[0];
       e.preventDefault();
       let formData = new FormData();
-      formData.append('file', fileInfo);
-      formData.append('hospitalId', this.hospitalId);
-      formData.append('type', this.type);
-      formData.append('caseId', this.caseId);
+      formData.append("file", fileInfo);
+      formData.append("hospitalId", this.hospitalId);
+      formData.append("type", this.type);
+      formData.append("caseId", this.caseId);
       const header = {
         headers: {
-          'Content-Type': 'multipart/form-data',
+          "Content-Type": "multipart/form-data",
         },
       };
       api.staticKnowledgeTest(formData, header).then((res) => {
-        if ((res.data.code === '00020007')) {
-          this.$message.error(res.data.msg || '数据存在异常');
+        if (res.data.code === "00020007") {
+          this.$message.error(res.data.msg || "数据存在异常");
           this.getDataList(this.hospitalId); // 重新获取列表
-        } else if (res.data.code === '0' && res.data.data) {
+        } else if (res.data.code === "0" && res.data.data) {
           this.$message({
-            message: '测试成功',
-            type: 'success',
+            message: "测试成功",
+            type: "success",
           });
           this.getDataList(this.hospitalId); // 重新获取列表
         } else {
-          this.$message.error(res.data.msg || '数据存在异常');
+          this.$message.error(res.data.msg || "数据存在异常");
           this.getDataList(this.hospitalId);
         }
         this.runningStatusArr = [0, 0, 0, 0, 0];
       });
       //解决上传相同文件不触发change
-      let inp = document.getElementById('upFile');
-      inp.value = '';
+      let inp = document.getElementById("upFile");
+      inp.value = "";
     },
 
     // 跳转至未映射到标准术语条数页面 / 缺少静态知识术语条数
@@ -285,7 +292,7 @@ export default {
       );
       let hospitalName = hospital.name;
       this.$router.push({
-        name: 'LessStaticOrNoMap',
+        name: "LessStaticOrNoMap",
         params: {
           data: { ...row },
           hospitalId: this.hospitalId,
@@ -297,7 +304,7 @@ export default {
 
     // 选中医院
     handleChange(val) {
-      if (val === '') return;
+      if (val === "") return;
       this.getDataList(val);
       this._getRunningStatus(); // 选中后立即请求状态
     },
@@ -310,13 +317,13 @@ export default {
       this.searched = true;
       const loading = this.$loading({
         lock: true,
-        text: 'Loading',
-        spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)',
+        text: "Loading",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.7)",
       });
       api.getStaticCaseResultList(params).then((res) => {
         loading.close();
-        if (res.data.code === '0') {
+        if (res.data.code === "0") {
           this.list = res.data && res.data.data;
         }
       });
@@ -326,7 +333,7 @@ export default {
 </script>
 
 <style lang="less" scored>
-@import '../../../less/admin.less';
+@import "../../../less/admin.less";
 #upFile {
   display: none !important;
 }