浏览代码

独立、组合填写单复制

zhouna 6 年之前
父节点
当前提交
4017246d0e

+ 5 - 4
src/components/preTreat/AddCombinQuestion.vue

@@ -11,6 +11,7 @@
                 @changeType="changeType"
                 @validatePass="validatePass"
                 qaType="2"
+                :isEdit="$route.params.isEdit"
                 :editData="editData"
                 ref="submitForm"
         ></PubIndeptQa>
@@ -50,10 +51,10 @@
       }
     },
     beforeMount:function(){
-      const {isEdit,data} = this.$route.params;
-      if(isEdit){
-        this.txt = '组合填写单维护-修改组合填写单';
-        this.editData = data;console.log(data)
+      const {isEdit,isCopy,data} = this.$route.params;
+      if(isEdit||isCopy){
+        this.txt = isCopy?'组合填写单维护-复制组合填写单':'组合填写单维护-修改组合填写单';
+        this.editData = data;
       }
     },
     methods: {

+ 3 - 3
src/components/preTreat/AddSimpleQuestion.vue

@@ -56,9 +56,9 @@
       }
     },
     beforeMount:function(){
-      const {isEdit,data} = this.$route.params;
-      if(isEdit){
-        this.txt = '独立填写单维护-修改独立填写单';
+      const {isEdit,isCopy,data} = this.$route.params;
+      if(isEdit||isCopy){
+        this.txt = isCopy?'独立填写单维护-复制独立填写单':'独立填写单维护-修改独立填写单';
         this.editData = data;
       }
     },

+ 5 - 3
src/components/preTreat/CombinQuestion.vue

@@ -65,10 +65,12 @@
                         :resizable = "false"
                         prop="operate"
                         label="操作"
-                        width="120">
+                        width="140">
                     <template slot-scope="scope">
                         <el-button  @click="modifyIndeptTag(scope.row)" type="text" size="small">修改</el-button>
                         <span style="margin:0 3px;">|</span>
+                        <el-button  @click="modifyIndeptTag(scope.row,true)" 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>
                 </el-table-column>
@@ -169,14 +171,14 @@
         this.$router.push({name:'AddCombinQuestion',
           params:pam});
       },
-      modifyIndeptTag(row) {
+      modifyIndeptTag(row,isCopy) {
         api.questionDetail({id:row.id}).then((res)=>{
           const {code,data,msg} = res.data;
           if(code=='0'){
             const infos = Object.assign({},row,data);
             const pam = this.searched?{currentPage:this.currentPage,
               filter:this.filter}:{currentPage:this.currentPage};
-            this.$router.push({name:'AddCombinQuestion',params:Object.assign(pam,{isEdit:true,data:infos})});
+            this.$router.push({name:'AddCombinQuestion',params:Object.assign(pam,{[isCopy?'isCopy':'isEdit']:true,data:infos})});
           }else{
             this.$message({
               message: msg,

+ 2 - 2
src/components/preTreat/PubIndeptQa.vue

@@ -53,7 +53,7 @@
             >
                 <el-select
                         v-model="form.region12"
-                        :disabled="!form.region1||!!editData.id"
+                        :disabled="!form.region1||isEdit"
                         @change="sendData"
                 >
                     <el-option
@@ -207,7 +207,7 @@
 // 补充内容(val:52):单选(val:1)、多选(val:2)、多列填写(val:3)、输入框(val:6)、数字输入框(val:7)、文本域(val:5)
 
   export default {
-    props:['editData','qaType'],      //qaType:独立1/组合2填写单
+    props:['editData','qaType','isEdit'],      //qaType:独立1/组合2填写单
     data() {
       var validatePass1 = (rule, value, callback) => {
         this.validateSystomName(value,callback,1)

+ 19 - 1
src/components/preTreat/SimpleQuestion.vue

@@ -65,10 +65,12 @@
                         :resizable = "false"
                         prop="operate"
                         label="操作"
-                        width="120">
+                        width="140">
                     <template slot-scope="scope">
                         <el-button  @click="modifyIndeptTag(scope.row)" type="text" size="small">修改</el-button>
                         <span style="margin:0 3px;">|</span>
+                        <el-button  @click="copyIndeptTag(scope.row)" 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>
                 </el-table-column>
@@ -170,6 +172,22 @@
         this.$router.push({name:'AddSimpleQuestion',
                             params:pam})
       },
+      copyIndeptTag(row){
+        api.questionDetail({id:row.id}).then((res)=>{
+          const {code,data,msg} = res.data;
+          if(code=='0'){
+            const item = Object.assign({},row,data);
+            const pam = this.searched?{currentPage:this.currentPage,
+              filter:this.filter}:{currentPage:this.currentPage};
+            this.$router.push({name:'AddSimpleQuestion',params:Object.assign(pam,{isCopy:true,data:item})});
+          }else{
+            this.$message({
+              message: msg,
+              type: 'warning'
+            });
+          }
+        });
+      },
       modifyIndeptTag(row) {
         api.questionDetail({id:row.id}).then((res)=>{
           const {code,data,msg} = res.data;