luolei пре 4 година
родитељ
комит
de47445a52

+ 1 - 0
src/api/config.js

@@ -342,6 +342,7 @@ export default {
       'delTaskDetail':'/api/mrman/stdMissionDetail/clearMissionDetail',     //任务详情删除
       'autoTest':'/api/mrman/stdBehospitalInfo/analyze',  //自动化测试
       'saveDefaultModuleInfo': '/api/mrman/qc/qcModuleInfo/saveDefaultModuleInfo',  //模板列表首页
+      'ControModuleInfo': '/api/mrman/qc/qcType/ControModuleInfo',  //指控类型列表首页
       
   },
 	menuIconList: { //菜单对应图标

+ 3 - 0
src/api/qualityControl.js

@@ -126,4 +126,7 @@ export default {
   saveOrUpdateModuleInfo(param){
     return axios.post(urls.saveOrUpdateModuleInfo,param);
   },
+  ControModuleInfo(param){
+    return axios.post(urls.ControModuleInfo,param);
+  },
 }

+ 83 - 7
src/components/qualityControl/AddQcType.vue

@@ -21,6 +21,19 @@
                     <el-form-item label="质控类型:" prop="name">
                         <el-input type="text" placeholder="请输入质控类型" v-model="form.name"></el-input>
                     </el-form-item>
+                    
+                    <el-form-item label="默认标准类型:" class="formItem widthLarge">
+                      <el-switch
+                        v-model="form.defaultModule"
+                        :active-value="1"
+                        :inactive-value="0"
+                        active-color="#4BC4D7"
+                        inactive-color="#BBBBBB"
+                        @change="handleTemChange($event,form.defaultModule)"
+                      ></el-switch>
+                      <span class="showInfo">{{showInfo}}</span>
+                    </el-form-item>
+
                     <el-form-item label="质控条目:" prop="qcItem">
                         <el-collapse>
                             <el-collapse-item v-for="(item,i) in qcItemList" :title="i" :name="i">
@@ -77,7 +90,8 @@
           id:'',
           hospitalId:"",
           name:'',
-          qcTypeCasesEntryVOList:[]
+          qcTypeCasesEntryVOList:[],
+          defaultModule: 0
         },
         rules:{
           hospitalId:{ required: true, message: '请选择所属医院', trigger: ['blur', 'change']},
@@ -92,6 +106,7 @@
             }, trigger: 'blur'
           }],
         },
+        showInfo: '否',
         copy:null,
         saveDisable: false,  //保存按钮禁止点击
         qcItemList:{},
@@ -109,7 +124,8 @@
           id:isCopy?"":infoCopy.id,
           hospitalId:infoCopy.hospitalId,
           name:infoCopy.name,
-          qcTypeCasesEntryVOList:[]
+          qcTypeCasesEntryVOList:[],
+          defaultModule:+infoCopy.defaultModule
         };
         //this.getQcTypeItem({hospitalId:info.hospitalId});
       }else{
@@ -135,6 +151,7 @@
       }
     },
     methods:{
+      handleTemChange() {},
       changeHospital(val){
         localStorage.setItem("qcSelectHospital",val);
         this.getQcTypeItem({hospitalId:val});
@@ -148,7 +165,7 @@
         api.getQcTypeItem(param).then((res)=>{
           if(res.data.code==="0") {
             const data = res.data.data;
-            this.qcItemList = data;console.log(this.qcItemList)
+            this.qcItemList = data;
           }else{
             this.warning("获取缺陷条目失败");
           }
@@ -175,11 +192,39 @@
         this.$refs[form].validate((valid) => {
           if (valid) {
             if(this.form.id){//修改
-              const param = Object.assign({},this.form);
+              let param = Object.assign({},this.form);
               param.name=param.name.trim();
               this.saveDisable = true;  //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
               api.addQcType(param).then((res)=>{
-                if(res.data.code==0){
+                if (res.data.code === '-1') {
+                  // 默认标准类型存在,是否替换
+                  this.$alert('默认标准类型已存在,是否替换?', '提示', {
+                    confirmButtonText: '确定',
+                    type: 'warning'
+                  })
+                    .then(() => {
+                      param = { ...param, defineType: 1 };
+                      api.addQcType(param).then(res => {
+                        if (res.data.code == 0) {
+                          this.$message({
+                            message: '修改成功',
+                            type: 'success'
+                          });
+                          //返回带搜索条件的首页
+                          this.$router.push({
+                            name: 'QCTypeMang',
+                            params: Object.assign({}, this.$route.params, {currentPage: 1})
+                          });
+                        } else {
+                          this.$message({
+                            message: res.data.msg,
+                            type: 'warning'
+                          });
+                        }
+                      });
+                    })
+                    .catch(() => {});
+                } else if(res.data.code==0){
                   this.$message({
                     message:"修改成功",
                     type:'success'
@@ -198,11 +243,39 @@
                 this.saveDisable = false
               })
             }else{//添加
-              const params = Object.assign({},this.form);
+              let params = Object.assign({},this.form);
               params.name=params.name.trim();
               this.saveDisable = true;  //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
               api.addQcType(params).then((res)=>{
-                if(res.data.code==0){
+                if (res.data.code === '-1') {
+                  // 默认标准类型存在,是否替换
+                  this.$alert('默认标准类型已存在,是否替换?', '提示', {
+                    confirmButtonText: '确定',
+                    type: 'warning'
+                  })
+                    .then(() => {
+                      params = { ...params, defineType: 1 };
+                      api.addQcType(params).then(res => {
+                        if (res.data.code == 0) {
+                          this.$message({
+                            message: '修改成功',
+                            type: 'success'
+                          });
+                          //返回带搜索条件的首页
+                          this.$router.push({
+                            name: 'QCTypeMang',
+                            params: Object.assign({}, this.$route.params, {currentPage: 1})
+                          });
+                        } else {
+                          this.$message({
+                            message: res.data.msg,
+                            type: 'warning'
+                          });
+                        }
+                      });
+                    })
+                    .catch(() => {});
+                } else if(res.data.code==0){
                   this.$message({
                     message:"添加成功",
                     type:'success'
@@ -259,4 +332,7 @@
     .el-select.big-select{
         width: 360px;
     }
+    .showInfo {
+      margin-left: 16px;
+    }
 </style>

+ 48 - 0
src/components/qualityControl/QCTypeMang.vue

@@ -41,6 +41,18 @@
                         prop="name"
                         label="质控类型">
                 </el-table-column>
+                <el-table-column :resizable="false" prop="operate" label="默认标准模版">
+                  <template slot-scope="scope">
+                    <el-switch
+                      v-model="scope.row.defaultModule"
+                      :active-value="1"
+                      :inactive-value="0"
+                      active-color="#4BC4D7"
+                      inactive-color="#BBBBBB"
+                      @change="handleTemChange(scope.row)"
+                    ></el-switch>
+                  </template>
+                </el-table-column>
                 <el-table-column
                         label="操作" width="150">
                     <template slot-scope="scope">
@@ -107,6 +119,42 @@
       })
     },
     methods: {
+      // 默认标准模版切换
+      handleTemChange(row) {
+        // console.log(row, 'row');
+        let params = {
+          defaultModule: row.defaultModule,
+          defineType: 0,
+          hospitalId: row.hospitalId,
+          id: row.id,
+          modeId: row.modeId,
+          name: row.name
+        };
+
+        api.ControModuleInfo(params).then(res => {
+          // console.log(res.data);
+          if (res.data.code === '-1') {
+            // 互斥
+            this.$alert('默认标准类型已存在,是否替换?', '提示', {
+              confirmButtonText: '确定',
+              type: 'warning'
+            })
+              .then(() => {
+                params = { ...params, defineType: 1 };
+                api.ControModuleInfo(params).then(res => {
+                  // console.log(res,'互斥再次请求的接口返回');
+                  this.getDataList();
+                });
+              })
+              .catch(() => {
+                this.getDataList();
+              });
+          } else if (res.data.code === '0') {
+            // 不互斥
+            this.getDataList();
+          }
+        });      
+      },
       hisFormatter(item){
         const field = this.hisTypes.filter((it)=>it.val==item.hospitalId);
         return field[0]?field[0].name:'';

+ 1 - 1
src/components/qualityControl/QualityControlTemp.vue

@@ -173,7 +173,7 @@ export default {
             .then(() => {
               params = { ...params, defineType: 1 };
               api.saveDefaultModuleInfo(params).then(res => {
-                console.log(res,'互斥再次请求的接口返回');
+                // console.log(res,'互斥再次请求的接口返回');
                 this.getDataList();
               });
             })