Browse Source

首页暂存增加删除功能

cfort 3 years ago
parent
commit
a0703ffc63
1 changed files with 29 additions and 1 deletions
  1. 29 1
      src/views/system/dashboard/components/new-home.vue

+ 29 - 1
src/views/system/dashboard/components/new-home.vue

@@ -42,10 +42,14 @@
                             <el-button class="btn" type="primary" @click="search">
                                 <i class="ibps-icon-search"></i>查询
                             </el-button>
+                            <el-button v-if="activeTab === 'save'" :key="Date.now() + Math.random()" class="btn" type="danger" @click="remove">
+                                <i class="ibps-icon-close"></i>删除
+                            </el-button>
                         </div>
                         <el-table
                             v-loading="loading"
                             :data="dataList"
+                            ref="dataTable"
                             style="color: #000"
                             align="center"
                             size="mini"
@@ -53,7 +57,9 @@
                             class="jbd-home-task"
                             @row-click="handleLinkClick"
                             :row-class-name="tableRowClassName"
+                            @selection-change="val => selection = val"
                         >
+                            <el-table-column v-if="activeTab === 'save'" :key="Date.now() + Math.random()" type="selection" width="55"></el-table-column>
                             <el-table-column
                                 prop="subject"
                                 label="事务名称"
@@ -208,7 +214,7 @@
     import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
     import ActionUtils from '@/utils/action'
     import IbpsTypeTree from '@/business/platform/cat/type/tree'
-    import { dateFormat } from '../../../../filters'
+    import { dateFormat } from '@/filters'
 
     const tabList = [
         {
@@ -310,6 +316,7 @@
                     subject: '',
                     createTime: ''
                 },
+                selection: [],
                 taskId: '', // 编辑dialog需要使用
                 waiJian: '', // 编辑dialog需要使用
                 instanceId: '',
@@ -470,11 +477,28 @@
                 this.paginate = {}
                 this.getData(this.activeTab)
             },
+            // 删除暂存数据
+            remove() {
+                if (!this.selection.length) {
+                    this.$message.warning('请选择暂存事务!')
+                    return
+                }
+                let idList = []
+                this.selection.forEach(i => idList.push(i.id))
+                ActionUtils.removeRecord(idList).then(ids => {
+                    removeDraft({ ids }).then(() => {
+                        ActionUtils.removeSuccessMessage()
+                        this.selection = []
+                        this.search()
+                    })
+                }).catch(() => { })
+            },
             // 切换tab
             changeTab() {
                 // 数据、筛选条件初始化
                 this.dataList = []
                 this.paginate = {}
+                this.selection = []
                 this.typeId = ''
                 this.defaultPagination.page = 1
                 this.getData(this.activeTab)
@@ -863,6 +887,10 @@
                     border-radius: 3px;
                     padding: 7px 15px;
                 }
+                .el-button--danger {
+                    background-color: #f56c6c;
+                    border-color: #f56c6c;
+                }
             }
         }
     }