Browse Source

字段映射添加复制功能

zhouna 5 years ago
parent
commit
d1ea7e9aad

+ 11 - 6
src/components/qualityControl/BaseFieldList.vue

@@ -80,7 +80,9 @@
                 <el-table-column
                         label="操作" width="100">
                     <template slot-scope="scope">
-                        <el-button type="text" size="small" @click="toEditField(scope.row)">修改</el-button>
+                        <el-button type="text" size="small" @click="toEditField(scope.row, 'modify')">修改</el-button>
+                        <span style="margin:0 3px;">|</span>
+                        <el-button type="text" size="small" @click="toEditField(scope.row, 'copy')">复制</el-button>
                         <span style="margin:0 3px;">|</span>
                         <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row.id)">删除</el-button>
                     </template>
@@ -152,7 +154,7 @@
           }
         });
       },
-      toEditField(row){
+      toEditField(row,type){
         api.getFieldDetail({id:row.id}).then((res)=>{
           const {code,data,msg} = res.data;
           if(code=='0'){
@@ -161,10 +163,13 @@
               currentPage: this.currentPage,
               filter: this.filter
             } : {currentPage: this.currentPage};
-              this.$router.push({
-                name: 'FieldMatch', 
-                params: {info:data}
-              });
+            if(type == 'modify') {
+              this.$router.push({name: 'FieldMatch', params: Object.assign(pam, {isEdit: true, info: item})});
+            } else if( type == 'copy') {
+              this.$router.push({name: 'FieldMatch', params: Object.assign(pam, {isCopy: true, info: item})});
+            } else {
+              return
+            }
           }else{
             this.$message({
               message: msg,

+ 8 - 6
src/components/qualityControl/FieldMatch.vue

@@ -110,9 +110,11 @@
     },
     created(){
       this.getAllTypes();
-      let info = this.$route.params.info;
+      let {isCopy,info} = this.$route.params;
+      this.copy=isCopy;
       if(info){
         const infoCopy =  Object.assign({},info);
+        isCopy?infoCopy.id="":"";
         // infoCopy.casesEntryIds?this.casesEIds = infoCopy.casesEntryIds.split(","):'';
         let tmpArr = [],tmpArr1 = []
         for(let i = 0;i < infoCopy.quesCasesEntryDTOList.length;i++){
@@ -127,7 +129,7 @@
         }
         infoCopy.quesCasesEntryDTOList?this.casesEIds = tmpArr:'';
         infoCopy.quesCasesEntryVOList = [...tmpArr1];
-        this.title='字段映射维护-修改字段映射';
+        this.title=isCopy?"字段映射维护-复制字段映射":'字段映射维护-修改字段映射';
         this.form = infoCopy;
         this.getQcFlawList(tmpArr1);
       }/*else{
@@ -246,11 +248,11 @@
               this.warning("取值字段【】含有非法字符")
               return;
             }
-          
-            if(this.id){//修改
-              const param = Object.assign({},this.form,{id:this.id});
+
+            if(this.form.id){//修改
+              const param = Object.assign({},this.form);
               this.saveDisable = true;  //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
-              api.addFieldMatch(param).then((res)=>{
+              api.addFieldMatch({questionWrapper:param}).then((res)=>{
                 if(res.data.code==0){
                   this.$message({
                     message:"修改成功",