ZaiZai 11 сар өмнө
parent
commit
f7fc1834e6

+ 33 - 41
src/views/system/announcement.vue

@@ -397,28 +397,20 @@ export default {
         return
       }
       const ids = arr.flat().map(item => item.id).join(',');
-      const res = await remove(ids)
-      const {code, msg} = res.data || {}
-      if (code === 200) {
-        this.$message.success(msg || '操作成功');
+      remove(ids).then(({data}) => {
+        this.$message.success(data.msg || '操作成功');
         this.tableMultiple = []
         this.searchClick()
         this.getAwaitMsgApi()
-      } else {
-        this.$message.error(msg || '操作失败');
-      }
+      })
     },
     //取消发布
-    async handleCancel(row) {
-      const res = await cancelPush(row.id)
-      const {code, msg} = res.data || {}
-      if (code === 200) {
-        this.$message.success(msg || '操作成功');
+    handleCancel(row) {
+      cancelPush(row.id).then(({data}) => {
+        this.$message.success(data.msg || '操作成功');
         this.searchClick()
         this.getAwaitMsgApi()
-      } else {
-        this.$message.error(msg || '操作失败');
-      }
+      })
     },
     //待发布打开
     releasedShow() {
@@ -442,23 +434,23 @@ export default {
     async generalFormSubmit() {
       const isForm = await this.getFormValidate('generalFormRef')
       if (!isForm) return
-      let form = this.generalFormModel
+      let form = JSON.parse(JSON.stringify(this.generalFormModel))
       form.pushSystem = form.pushSystem.join(',')
       form.msgType = 2
-      let res
       if (form.id) {
-        res = await update(form)
-      } else {
-        res = await add(form)
-      }
-      const {code, msg} = res.data || {}
-      if (code===200) {
-        this.$message.success(msg || '操作成功');
-        this.generalCancel()
-        this.searchClick()
-        this.getAwaitMsgApi()
+        update(form).then(({data}) => {
+          this.$message.success(data.msg || '操作成功');
+          this.generalCancel()
+          this.searchClick()
+          this.getAwaitMsgApi()
+        })
       } else {
-        this.$message.error(msg || '操作失败');
+        add(form).then(({data}) => {
+          this.$message.success(data.msg || '操作成功');
+          this.generalCancel()
+          this.searchClick()
+          this.getAwaitMsgApi()
+        })
       }
     },
     //普通公告关闭
@@ -477,24 +469,24 @@ export default {
     async updateFormSubmit() {
       const isForm = await this.getFormValidate('updateFormRef')
       if (!isForm) return
-      let form = this.updateFormModel
+      let form = JSON.parse(JSON.stringify(this.updateFormModel))
       form.pushSystem = form.pushSystem.join(',')
       form.updateServerType = form.updateServerType.join(',')
       form.msgType = 1
-      let res
       if (form.id) {
-        res = await update(form)
-      } else {
-        res = await add(form)
-      }
-      const {code, msg} = res.data || {}
-      if (code===200) {
-        this.$message.success(msg || '操作成功');
-        this.systemUpdateCancel()
-        this.searchClick()
-        this.getAwaitMsgApi()
+        update(form).then(({data}) => {
+          this.$message.success(data.msg || '操作成功');
+          this.systemUpdateCancel()
+          this.searchClick()
+          this.getAwaitMsgApi()
+        })
       } else {
-        this.$message.error(msg || '操作失败');
+        add(form).then(({data}) => {
+          this.$message.success(data.msg || '操作成功');
+          this.systemUpdateCancel()
+          this.searchClick()
+          this.getAwaitMsgApi()
+        })
       }
     },
     //系统更新公告关闭