zhangxc 5 лет назад
Родитель
Сommit
6da14f4777

+ 72 - 47
src/components/qualityControl/AddQualityControlTemp.vue

@@ -73,7 +73,7 @@ export default {
             form:{
                 tempName: "",
                 hospital:"",
-                module:"",
+                moduleName:"",
             },
             rules:{
                 tempName:{ required: true, message: '请输入模块名称', trigger: ['blur', 'change']},
@@ -86,58 +86,88 @@ export default {
             hospitalList:[],
             moduleList:[ ],
             moduleInfoList:[
-                {   
-                    searchName:"",
-                    activeIndex: -1,
-                    searchResult:[
-                        // {
-                        //     name: "4姓名"
-                        // },
-                        // {
-                        //     name: "5职业"
-                        // },
-                        // {
-                        //     name: "6年龄"
-                        // }
-                    ],
-                    selectFiled:[
+                // {   
+                //     searchName:"",
+                //     activeIndex: -1,
+                //     searchResult:[
+                //         // {
+                //         //     name: "4姓名"
+                //         // },
+                //         // {
+                //         //     name: "5职业"
+                //         // },
+                //         // {
+                //         //     name: "6年龄"
+                //         // }
+                //     ],
+                //     selectFiled:[
                         
-                    ]
-                }
+                //     ]
+                // }
             ]
         }
     },
     created(){
         this.getAllTypes();
-        // if(isEdit){
-        //     // this.id = 
-        // }
+        const { isEdit, data } = this.$route.params
+        console.log('data', data)
+        if(isEdit) {
+            this.isEdit = isEdit;
+            this.id = data.id
+            this.title ="模板维护-修改"
+            this.form.tempName = data.name
+            this.form.hospital = ''+data.hospitalId
+            this.form.moduleName = ''+data.modeId
+            const moduleDetail = data.moduleDetail
+            const keysList = Object.keys(moduleDetail)
+            for(let i = 0; i < keysList.length; i++){
+                let selectFiled = []
+                for(let j = 0; j < moduleDetail[keysList[i]].length; j++){
+                    const item =  moduleDetail[keysList[i]][j]
+                    selectFiled.push(item.questionDTO)
+                }
+                this.moduleInfoList.push({
+                searchName:"",
+                activeIndex: -1,
+                searchResult:[
+                ],
+                selectFiled:selectFiled
+            })
+                
+            }
+            
+        }
+       
     },
     methods:{
         getAllTypes(){
-        if(localStorage.getItem("qcModuleTypes")){
-            this.hospitalList = JSON.parse(localStorage.getItem("qcHospitalTypes"));
-            this.moduleList = JSON.parse(localStorage.getItem("qcModuleTypes"));
-            return ;
-        }
-        //获取枚举信息
-        api.getQcTypes().then((res)=>{
-            if(res.data.code==="0"){
-            const data = res.data.data;
-            localStorage.setItem("qcFieldTypes",JSON.stringify(data[11]));
-            localStorage.setItem("qcModuleTypes",JSON.stringify(data[12]));
-            localStorage.setItem("qcHospitalTypes",JSON.stringify(data[13]));
-            }else{
-            this.warning("获取枚举信息失败");
+            if(localStorage.getItem("qcModuleTypes")){
+                this.hospitalList = JSON.parse(localStorage.getItem("qcHospitalTypes"));
+                this.moduleList = JSON.parse(localStorage.getItem("qcModuleTypes"));
+                return new Promise(function(resolve, reject){
+                    resolve()
+                });
             }
-        });
+            //获取枚举信息
+            return api.getQcTypes().then((res)=>{
+                if(res.data.code==="0"){
+                    const data = res.data.data;
+                    localStorage.setItem("qcFieldTypes",JSON.stringify(data[11]));
+                    localStorage.setItem("qcModuleTypes",JSON.stringify(data[12]));
+                    localStorage.setItem("qcHospitalTypes",JSON.stringify(data[13]));
+                    this.hospitalList = JSON.parse(localStorage.getItem("qcHospitalTypes"));
+                    this.moduleList = JSON.parse(localStorage.getItem("qcModuleTypes"));
+                }else{
+                    this.warning("获取枚举信息失败");
+                }
+            });
         },
         addUnit(){
             if(!this.form.hospital){
                 this.warning("请先选择所属医院")
                 return
             }
-            if(!this.form.modeId){
+            if(!this.form.moduleName){
                 this.warning("请先选择模块")
                 return
             }
@@ -145,18 +175,9 @@ export default {
                         searchName:"",
                         activeIndex: -1,
                         searchResult:[
-                           
                         ],
                         selectFiled:[
-                            {
-                                name: "姓名1"
-                            },
-                            {
-                                name: "职业1"
-                            },
-                            {
-                                name: "年龄1"
-                            }
+                           
                         ]
                     })
         },
@@ -238,6 +259,10 @@ export default {
                             moduleDetail.push(item)
                        }
                         
+                    }
+                    if(moduleDetail.length === 0){
+                        this.warning('请添加模块内容')
+                        return
                     }
                      let param = {
                         name: tempName,

+ 47 - 19
src/components/qualityControl/QualityControlTemp.vue

@@ -5,9 +5,9 @@
                  <el-form-item label="模板名称:">
                     <el-input size="mini" v-model.trim="filter.modeName" placeholder="模板名称" clearable></el-input>
                 </el-form-item>
-                <el-form-item label="数据模块Id:">
-                     <el-select size="mini" v-model.trim="filter.hospitalName" @change="getValue"  placeholder="数据模块" clearable>
-                        <el-option v-for="item in hospitalList" :label="item.name" :value="item.val" :key="item.id" ></el-option>
+                <el-form-item label="数据模块:">
+                     <el-select size="mini" v-model.trim="filter.modeId" @change="getValue"  placeholder="数据模块" clearable>
+                        <el-option v-for="item in moduleList" :label="item.name" :value="item.val" :key="item.id" ></el-option>
                     </el-select>
                 </el-form-item>
                 <el-form-item label="所属医院:">
@@ -57,8 +57,8 @@
                         label="操作">
                     <template slot-scope="scope">
                         <el-button  @click="modifyIndeptTag(scope.row, 'modify')" type="text" size="small">修改</el-button>
-                        <span style="margin:0 3px;">|</span>
-                        <el-button @click="modifyIndeptTag(scope.row, 'copy')" class="text" type="text" size="small">复制</el-button>
+                        <!-- <span style="margin:0 3px;">|</span>
+                        <el-button @click="modifyIndeptTag(scope.row, 'copy')" class="text" type="text" size="small">复制</el-button> -->
                         <span style="margin:0 3px;">|</span>
                         <el-button @click="showDelDialog(scope.row)" class="delete" type="text" size="small">删除</el-button>
                     </template>
@@ -86,6 +86,7 @@
       return {
         list: [],
         hospitalList: [],
+        moduleList:[],
         searched: false,
         filter: {
           modeName: '', //模板名称
@@ -100,7 +101,9 @@
       }
     },
     created() {
-      this.getDataList()
+      this.getAllTypes().then(()=>{
+        this.getDataList()
+      })
     },
     watch: {
       'filter': {
@@ -118,6 +121,28 @@
       })
     },
     methods: {
+      getAllTypes(){
+          if(localStorage.getItem("qcModuleTypes")){
+              this.hospitalList = JSON.parse(localStorage.getItem("qcHospitalTypes"));
+              this.moduleList = JSON.parse(localStorage.getItem("qcModuleTypes"));
+              return new Promise(function(resolve, reject){
+                  resolve()
+              });
+          }
+          //获取枚举信息
+          return api.getQcTypes().then((res)=>{
+              if(res.data.code==="0"){
+                  const data = res.data.data;
+                  localStorage.setItem("qcFieldTypes",JSON.stringify(data[11]));
+                  localStorage.setItem("qcModuleTypes",JSON.stringify(data[12]));
+                  localStorage.setItem("qcHospitalTypes",JSON.stringify(data[13]));
+                  this.hospitalList = JSON.parse(localStorage.getItem("qcHospitalTypes"));
+                  this.moduleList = JSON.parse(localStorage.getItem("qcModuleTypes"));
+              }else{
+                  this.warning("获取枚举信息失败");
+              }
+          });
+      },
       handleSizeChange(val){
         this.pageSize = val;
         this.currentPage = utils.getCurrentPage(this.currentPage, this.total, this.pageSize);
@@ -135,11 +160,14 @@
             spinner: 'el-icon-loading',
             background: 'rgba(0, 0, 0, 0.7)'
         });
-        console.log('param',param)
         api.getQCTemplist(param).then((res) => {
           loading.close()
-          console.log('res.', res)
-          this.list = res.data.data.records;
+          let list = res.data.data.records
+          for(let i = 0; i < list.length; i++){
+            list[i].hospitalId = this.hospitalList.find(item => item.val == list[i].hospitalId).name
+            list[i].modeId  = this.moduleList.find(item => item.val == list[i].modeId).name
+          }
+          this.list = list;
           this.total = res.data.data.total;
           if(this.inCurrentPage!==undefined){
             this.currentPage=this.inCurrentPage;
@@ -163,7 +191,8 @@
         })
       },
       modifyIndeptTag(row, type) {
-        api.detailsTag({id:row.id}).then((res)=>{
+        api.getQCTempDetail({moduleId:row.id}).then((res)=>{
+          console.log('eeee',res)
           const {code,data,msg} = res.data;
           if(code=='0'){
             const item = Object.assign({},row,data);
@@ -172,9 +201,9 @@
               filter: this.filter
             } : {currentPage: this.currentPage};
             if(type == 'modify') {
-              this.$router.push({name: 'AddIndeptLabel', params: Object.assign(pam, {isEdit: true, data: item})});
+              this.$router.push({name: 'AddQualityControlTemp', params: Object.assign(pam, {isEdit: true, data: item})});
             } else if( type == 'copy') {
-              this.$router.push({name: 'AddIndeptLabel', params: Object.assign(pam, {isCopy: true, data: item})});
+              this.$router.push({name: 'AddQualityControlTemp', params: Object.assign(pam, {isCopy: true, data: item})});
             } else {
                 return
             }
@@ -198,10 +227,9 @@
       },
       clearFilter(){
         this.filter={
-          tagType: [], //标签类型
-          controlType: [],
-          tagAdscription: '', //标签归属
-          tagSysName: '', //标签系统名称
+          name: "",
+          modeId: "",
+          hospitalName: ""
         };
       },
       getFilterItems(isTurnPage) {
@@ -214,7 +242,8 @@
           name: modeName,
           current: this.inCurrentPage||this.currentPage,
           size: this.pageSize,
-          modeId: hospitalName,
+          modeId: modeId,
+          hospitalId: hospitalName
         };
         return param;
       },
@@ -243,10 +272,9 @@
       showDelDialog(row){
         const param = {
           "ids": row.id,
-          "type": row.type
         }
         this.showConfirmDialog('是否删除该标签?',()=>{
-          api.deleteTagGroup(param).then((res)=>{
+          api.delQCTemp(param).then((res)=>{
             if(res.data.code=='0'){
               if(!this.searched){
                 //未点确认时清空搜索条件