Explorar o código

预警信息添加删除

guhongwei %!s(int64=3) %!d(string=hai) anos
pai
achega
ffba505673

+ 8 - 1
src/views/patent/admin/message/parts/list-4.vue

@@ -13,6 +13,9 @@
             预警信息:<span>{{ item.content }}</span>
           </van-col>
         </van-col>
+        <van-col span="24" class="btn">
+          <van-button size="small" type="danger" @click="toDel(item)">删除信息</van-button>
+        </van-col>
       </van-col>
     </van-col>
   </div>
@@ -30,7 +33,11 @@ export default {
     return {};
   },
   created() {},
-  methods: {},
+  methods: {
+    toDel(data) {
+      this.$emit('toDel', data);
+    },
+  },
   computed: {
     ...mapState(['user']),
   },

+ 10 - 2
src/views/patent/admin/message/warning.vue

@@ -2,7 +2,7 @@
   <div id="read">
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
       <template v-slot:info>
-        <list-4 :list="list"></list-4>
+        <list-4 :list="list" @toDel="toDel"></list-4>
       </template>
     </admin-frame>
   </div>
@@ -31,7 +31,7 @@ export default {
     this.search();
   },
   methods: {
-    ...patentearly(['query']),
+    ...patentearly(['query', 'delete']),
     async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
       info.searchName = searchName;
       let res = await this.query({ skip, limit, ...info });
@@ -40,6 +40,14 @@ export default {
         this.$set(this, `total`, res.total);
       }
     },
+    // 删除信息
+    async toDel(data) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '删除信息成功' });
+        this.search();
+      }
+    },
     // 返回
     back() {
       this.$router.push({ path: '/patent/index' });

+ 10 - 2
src/views/patent/mech/patent/early/index.vue

@@ -2,7 +2,7 @@
   <div id="index">
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
       <template v-slot:info>
-        <list-4 :list="list"></list-4>
+        <list-4 :list="list" @toDel="toDel"></list-4>
       </template>
     </admin-frame>
   </div>
@@ -31,7 +31,7 @@ export default {
     this.search();
   },
   methods: {
-    ...patentearly(['queryByOrg']),
+    ...patentearly(['queryByOrg', 'delete']),
     async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
       info.searchName = searchName;
       info.code = this.user.code;
@@ -41,6 +41,14 @@ export default {
         this.$set(this, `total`, res.total);
       }
     },
+    // 删除信息
+    async toDel(data) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '删除信息成功' });
+        this.search();
+      }
+    },
     // 返回
     back() {
       this.$router.push({ path: '/patent/index' });

+ 8 - 1
src/views/patent/mech/patent/parts/list-4.vue

@@ -13,6 +13,9 @@
             预警信息:<span>{{ item.content }}</span>
           </van-col>
         </van-col>
+        <van-col span="24" class="btn">
+          <van-button size="small" type="danger" @click="toDel(item)">删除信息</van-button>
+        </van-col>
       </van-col>
     </van-col>
   </div>
@@ -30,7 +33,11 @@ export default {
     return {};
   },
   created() {},
-  methods: {},
+  methods: {
+    toDel(data) {
+      this.$emit('toDel', data);
+    },
+  },
   computed: {
     ...mapState(['user']),
   },

+ 6 - 2
src/views/patent/user/message/parts/list-1.vue

@@ -13,8 +13,9 @@
             是否已读:<span>{{ item.is_read ? '已读' : '未读' }}</span>
           </van-col>
         </van-col>
-        <van-col span="24" class="btn" v-if="item.is_read == false">
-          <van-button size="small" type="info" @click="update(item)">消息已读</van-button>
+        <van-col span="24" class="btn">
+          <van-button size="small" type="info" v-if="item.is_read == false" @click="update(item)">消息已读</van-button>
+          <van-button size="small" type="danger" @click="toDel(item)">删除信息</van-button>
         </van-col>
       </van-col>
     </van-col>
@@ -38,6 +39,9 @@ export default {
     update(data) {
       this.$emit('update', data);
     },
+    toDel(data) {
+      this.$emit('toDel', data);
+    },
     getDate(val) {
       let newDate = moment(val.createdAt).format('YYYY-MM-DD HH:mm:ss');
       if (newDate) return newDate;

+ 10 - 2
src/views/patent/user/message/read.vue

@@ -2,7 +2,7 @@
   <div id="index">
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
       <template v-slot:info>
-        <list-1 :list="oneList"></list-1>
+        <list-1 :list="oneList" @toDel="toDel"></list-1>
       </template>
     </admin-frame>
   </div>
@@ -32,7 +32,7 @@ export default {
     this.search();
   },
   methods: {
-    ...patentexamine(['query', 'update']),
+    ...patentexamine(['query', 'update', 'delete']),
     async search({ skip = 0, limit = this.limit, ...info } = {}) {
       info.to = this.user.id;
       info.is_read = true;
@@ -42,6 +42,14 @@ export default {
         this.$set(this, `total`, res.total);
       }
     },
+    // 删除信息
+    async toDel(data) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '删除信息成功' });
+        this.search();
+      }
+    },
     // 返回
     back() {
       this.$router.push({ path: '/patent/index' });

+ 10 - 2
src/views/patent/user/message/unRead.vue

@@ -2,7 +2,7 @@
   <div id="unRead">
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
       <template v-slot:info>
-        <list-1 :list="oneList" @update="oneUpdate"></list-1>
+        <list-1 :list="oneList" @update="oneUpdate" @toDel="toDel"></list-1>
       </template>
     </admin-frame>
   </div>
@@ -32,7 +32,7 @@ export default {
     this.search();
   },
   methods: {
-    ...patentexamine(['query', 'update']),
+    ...patentexamine(['query', 'update', 'delete']),
     async search({ skip = 0, limit = this.limit, ...info } = {}) {
       info.to = this.user.id;
       info.is_read = false;
@@ -50,6 +50,14 @@ export default {
         this.search();
       }
     },
+    // 删除信息
+    async toDel(data) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '删除信息成功' });
+        this.search();
+      }
+    },
     // 返回
     back() {
       this.$router.push({ path: '/patent/index' });

+ 10 - 2
src/views/patent/user/patent/early/index.vue

@@ -2,7 +2,7 @@
   <div id="index">
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @back="back" :rightArrow="false" :useNav="false">
       <template v-slot:info>
-        <list-4 :list="list"></list-4>
+        <list-4 :list="list" @toDel="toDel"></list-4>
       </template>
     </admin-frame>
   </div>
@@ -31,7 +31,7 @@ export default {
     this.search();
   },
   methods: {
-    ...patentearly(['query']),
+    ...patentearly(['query', 'delete']),
     async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
       info.searchName = searchName;
       info.user_id = this.user.id;
@@ -41,6 +41,14 @@ export default {
         this.$set(this, `total`, res.total);
       }
     },
+    // 删除信息
+    async toDel(data) {
+      let res = await this.delete(data.id);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '删除信息成功' });
+        this.search();
+      }
+    },
     // 返回
     back() {
       this.$router.push({ path: '/patent/index' });

+ 8 - 1
src/views/patent/user/patent/early/parts/list-4.vue

@@ -13,6 +13,9 @@
             预警信息:<span>{{ item.content }}</span>
           </van-col>
         </van-col>
+        <van-col span="24" class="btn">
+          <van-button size="small" type="danger" @click="toDel(item)">删除信息</van-button>
+        </van-col>
       </van-col>
     </van-col>
   </div>
@@ -30,7 +33,11 @@ export default {
     return {};
   },
   created() {},
-  methods: {},
+  methods: {
+    toDel(data) {
+      this.$emit('toDel', data);
+    },
+  },
   computed: {
     ...mapState(['user']),
   },