xjc преди 4 години
родител
ревизия
feee0d2e5a
променени са 4 файла, в които са добавени 73 реда и са изтрити 45 реда
  1. 43 26
      src/views/message/InnerSurvey.vue
  2. 1 0
      src/views/message/Notice.vue
  3. 27 18
      src/views/message/OutSurvey.vue
  4. 2 1
      src/views/message/templateList.vue

+ 43 - 26
src/views/message/InnerSurvey.vue

@@ -145,14 +145,18 @@ a {
             <span v-if="scope.row.receiver_ids"
               >共统计:
               <a target="_blank" @click="analyseData('total', scope.row.id)"
-                ><span>{{ scope.row.receiver_ids?scope.row.receiver_ids.length:0 }}</span></a
+                ><span>{{
+                  scope.row.receiver_ids ? scope.row.receiver_ids.length : 0
+                }}</span></a
               >人<br />
             </span>
             已填报:<a
               :href="scope.row.fileurl"
               target="_blank"
               @click="analyseData('finish', scope.row.id)"
-              ><span>{{ scope.row.finish_ids?scope.row.finish_ids.length:0 }}</span></a
+              ><span>{{
+                scope.row.finish_ids ? scope.row.finish_ids.length : 0
+              }}</span></a
             >人<br />
             <span v-if="scope.row.receiver_ids">
               未填报:<a
@@ -191,7 +195,8 @@ a {
               class="del"
               @click="del(scope.row.id)"
               type="text"
-              >删除</el-button>
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -349,7 +354,8 @@ a {
               type="primary"
               @click="saveResult"
               style="width: 100%"
-              >提交</el-button
+              :disabled="form2.status==0"
+              >{{this.form2.status==1?"提交":"该问卷已禁用"}}</el-button
             >
           </el-form-item>
         </el-form>
@@ -570,9 +576,19 @@ export default {
   },
   methods: {
     switchStatus(row) {
-      this.$api.editMessageStatus({id:row.id}).then((res)=>{
-        row.status = res.data.data
-      })
+      if (row.status == 1) {
+        this.$confirm("确定禁用吗?", "提示", {
+          type: "warning",
+        }).then(() => {
+          this.$api.editMessageStatus({ id: row.id }).then((res) => {
+            row.status = res.data.data;
+          });
+        });
+      }else{
+        this.$api.editMessageStatus({ id: row.id }).then((res) => {
+          row.status = res.data.data;
+        });
+      }
     },
     showQrcode(row) {
       this.dialogTitle4 = "生成二维码";
@@ -616,7 +632,7 @@ export default {
       this.dialogVisible3 = true;
     },
     analyseData(type, message_id) {
-      this.form1 = {}
+      this.form1 = {};
       let parm = this.form1;
       parm.type = type;
       parm.message_id = message_id;
@@ -641,24 +657,25 @@ export default {
       let _this = this;
       this.title = row.name;
       this.message_id = row.id;
-      this.widgetList = []
-      this.form2 = {}
+      this.widgetList = [];
+      this.form2 = {};
+      this.form2.status = row.status
       this.$api.getMessageInfo({ id: row.id }).then((res) => {
         if (res.data.code == 0) {
           this.widgetList = res.data.data.widget;
           this.widgetList.forEach((i) => {
             if (i.type == "checkbox") {
               //   _this.form2[i.label] = [] ;
-              if(i.result){
+              if (i.result) {
                 _this.$set(_this.form2, i.label, i.result);
-              }else{
+              } else {
                 _this.$set(_this.form2, i.label, []);
               }
-            }else{
+            } else {
               _this.$set(_this.form2, i.label, i.result);
             }
           });
-          console.log(this.form2);  
+          console.log(this.form2);
           //   debugger
           this.dialogVisible1 = true;
         }
@@ -686,9 +703,9 @@ export default {
       this.getData();
     },
     search1() {
-      let parm = this.form1
-      let type = this.cur_post_type
-      let message_id = this.cur_message_id
+      let parm = this.form1;
+      let type = this.cur_post_type;
+      let message_id = this.cur_message_id;
       parm.type = type;
       parm.message_id = message_id;
       this.dialogTitle2 = "统计结果";
@@ -744,15 +761,15 @@ export default {
       });
     },
     edit(row) {
-      this.$api.getMessageInfo({id:row.id}).then((res)=>{
-          this.form1 = res.data.data;
-          let receiver_ids = this.form1.receiver_id;
-          if (typeof receiver_ids == "string") {
-            receiver_ids = JSON.parse(receiver_ids);
-          }
-          this.form1.receiver_id = receiver_ids;
-          this.dialogVisible = true;
-      })
+      this.$api.getMessageInfo({ id: row.id }).then((res) => {
+        this.form1 = res.data.data;
+        let receiver_ids = this.form1.receiver_id;
+        if (typeof receiver_ids == "string") {
+          receiver_ids = JSON.parse(receiver_ids);
+        }
+        this.form1.receiver_id = receiver_ids;
+        this.dialogVisible = true;
+      });
     },
     saveResult() {
       let result = JSON.stringify(this.form2);

+ 1 - 0
src/views/message/Notice.vue

@@ -200,6 +200,7 @@ a {
             :options="options"
             :props="props"
             @change="handleChange"
+            filterable
             clearable
           >
             <template slot-scope="{ node, data }">

+ 27 - 18
src/views/message/OutSurvey.vue

@@ -135,9 +135,7 @@ a {
             <a @click="showSurvey(scope.row)" target="_blank"
               ><span>查看问卷</span></a
             >
-            <a
-              v-if="scope.row.template_qrcode"
-              @click="showQrcode(scope.row)"
+            <a v-if="scope.row.template_qrcode" @click="showQrcode(scope.row)"
               ><span> | 生成二维码</span></a
             >
           </template>
@@ -181,7 +179,8 @@ a {
               class="del"
               @click="del(scope.row.id)"
               type="text"
-              >删除</el-button>
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -464,7 +463,7 @@ export default {
       list: [{ name: "2333" }],
       loading: false,
       input: "",
-      dialogVisible:false,
+      dialogVisible: false,
       dialogVisible1: false,
       dialogVisible2: false,
       dialogVisible3: false,
@@ -547,9 +546,19 @@ export default {
   // computed() {},
   methods: {
     switchStatus(row) {
-      this.$api.editMessageStatus({id:row.id}).then((res)=>{
-        row.status = res.data.data
-      })
+      if (row.status == 1) {
+        this.$confirm("确定禁用吗?", "提示", {
+          type: "warning",
+        }).then(() => {
+          this.$api.editMessageStatus({ id: row.id }).then((res) => {
+            row.status = res.data.data;
+          });
+        });
+      }else{
+        this.$api.editMessageStatus({ id: row.id }).then((res) => {
+          row.status = res.data.data;
+        });
+      }
     },
     showQrcode(row) {
       this.dialogTitle4 = "生成二维码";
@@ -593,7 +602,7 @@ export default {
       this.dialogVisible3 = true;
     },
     analyseData(type, message_id) {
-      this.form1 = {}
+      this.form1 = {};
       let parm = this.form1;
       parm.type = type;
       parm.message_id = message_id;
@@ -619,8 +628,8 @@ export default {
       let _this = this;
       this.title = row.name;
       this.message_id = row.id;
-      this.widgetList = []
-      this.form2 = {}
+      this.widgetList = [];
+      this.form2 = {};
       this.$api.getMessageInfo({ id: row.id }).then((res) => {
         if (res.data.code == 0) {
           this.widgetList = res.data.data.widget;
@@ -659,8 +668,8 @@ export default {
     },
     search1() {
       let parm = this.form1;
-      let type = this.cur_post_type
-      let message_id = this.cur_message_id
+      let type = this.cur_post_type;
+      let message_id = this.cur_message_id;
       parm.type = type;
       parm.message_id = message_id;
       this.dialogTitle2 = "统计结果";
@@ -717,10 +726,10 @@ export default {
       });
     },
     edit(row) {
-      this.$api.getMessageInfo({id:row.id}).then((res)=>{
-          this.form1 = res.data.data;
-          this.dialogVisible = true;
-      })
+      this.$api.getMessageInfo({ id: row.id }).then((res) => {
+        this.form1 = res.data.data;
+        this.dialogVisible = true;
+      });
     },
     saveResult() {
       let result = JSON.stringify(this.form2);
@@ -739,7 +748,7 @@ export default {
             this.$message.error(res.data.message);
           }
           this.dialogVisible1 = false;
-          this.getData()
+          this.getData();
         });
     },
     save() {

+ 2 - 1
src/views/message/templateList.vue

@@ -152,7 +152,7 @@ export default {
       //   edit:0,
       allTemplate: [],
       form: { name: "", page: 1, page_size: 20 },
-      form1: {},
+      form1: {name:""},
       total: 1,
       list: [{ name: "2333" }],
       loading: false,
@@ -177,6 +177,7 @@ export default {
         return x.id == val;
       });
       this.form1.name = selVal[0].name;
+      // this.form1.name = "111"
     },
     addTtitle() {
       this.$refs["form1"].validate((valid) => {