Przeglądaj źródła

通知,全部已读和部分已读功能开发

user5 2 lat temu
rodzic
commit
3a4d932b29

+ 15 - 0
src/api/flowable/NoticeService.js

@@ -24,4 +24,19 @@ export default class NoticeService {
       params: params
     })
   }
+
+  portionRead (ids) {
+    return request({
+      url: '/flowable/notice/portionRead',
+      method: 'post',
+      params: {ids: ids}
+    })
+  }
+
+  readAll () {
+    return request({
+      url: '/flowable/notice/readAll',
+      method: 'post'
+    })
+  }
 }

+ 45 - 2
src/views/modules/flowable/task/NoticePageList.vue

@@ -17,8 +17,8 @@
       <div class="top bg-white">
         <vxe-toolbar :refresh="{query: refreshList}" custom>
           <template #buttons>
-            <el-button type="primary" size="small" @click="add()">全部标记已读</el-button>
-            <el-button type="primary"  size="small" @click="del()">标记为已读</el-button>
+            <el-button type="primary" size="small" @click="readAll()">全部标记已读</el-button>
+            <el-button :disabled="$refs.todoTable && $refs.todoTable.getCheckboxRecords().length === 0" type="warning" size="small" @click="portionRead()">标记为已读</el-button>
           </template>
         </vxe-toolbar>
 
@@ -182,6 +182,49 @@
         const val = tab.$attrs.value
         this.searchForm.type = val
         this.refreshList()
+      },
+
+      // 全部已读
+      readAll () {
+        this.$confirm(`确定将全部信息标记为已读吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.noticeService.readAll().then(({data}) => {
+            this.loading = false
+            this.$message({
+              message: data,
+              type: 'success',
+              duration: 1500
+            })
+            this.refreshList()
+          })
+        })
+      },
+
+      // 部分已读
+      portionRead (id) {
+        let ids = id || this.$refs.todoTable.getCheckboxRecords().map(item => {
+          return item.id
+        }).join(',')
+        this.$confirm(`确定将选定信息标记为已读吗?`, '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.loading = true
+          this.noticeService.portionRead(ids).then(({data}) => {
+            this.loading = false
+            this.$message({
+              message: data,
+              type: 'success',
+              duration: 1500
+            })
+            this.refreshList()
+          })
+        })
       }
     }
   }

+ 9 - 3
src/views/modules/notify/MyNotifyList.vue

@@ -11,8 +11,14 @@
           </el-form-item>
       </el-form>
        <div class="bg-white top">
-      <vxe-toolbar :refresh="{query: refreshList}"  custom>
-      </vxe-toolbar>
+
+         <vxe-toolbar :refresh="{query: refreshList}" custom>
+           <template #buttons>
+             <el-button type="primary" size="small">全部标记已读</el-button>
+             <el-button type="primary"  size="small">标记为已读</el-button>
+           </template>
+         </vxe-toolbar>
+
      <div style="height: calc(100% - 80px);">
         <vxe-table
             border="inner"
@@ -34,7 +40,7 @@
             :data="dataList"
             :checkbox-config="{}">
             <vxe-column type="seq" width="60" title="序号"></vxe-column>
-<!--            <vxe-column type="checkbox"  width="40px"></vxe-column>-->
+            <vxe-column type="checkbox"  width="40px"></vxe-column>
             <vxe-column min-width="180px" title="标题" field="title" align="center">
               <template slot-scope="scope">
                  <el-link  type="primary" :underline="false" @click="view(scope.row.id)">{{scope.row.title}}</el-link>