Browse Source

首页逻辑调整

cfort 2 năm trước cách đây
mục cha
commit
fdd788ddbc

+ 50 - 15
src/views/system/dashboard/components/new-home.vue

@@ -32,10 +32,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"
@@ -43,7 +47,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="事务名称"
@@ -195,7 +201,7 @@
     import { save } from '@/api/platform/message/innerMessage'
     import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
     import ActionUtils from '@/utils/action'
-    import { dateFormat } from '../../../../filters'
+    import { dateFormat } from '@/filters'
 
     const tabList = [
         {
@@ -209,7 +215,7 @@
             label: '已办事宜',
             key: 'over',
             icon: 'el-icon-document-remove',
-            time: '办理',
+            time: '创建',
             field: 'updateTime'
         },
         {
@@ -297,6 +303,7 @@
                     subject: '',
                     createTime: ''
                 },
+                selection: [],
                 taskId: '', // 编辑dialog需要使用
                 waiJian: '', // 编辑dialog需要使用
                 instanceId: '',
@@ -329,11 +336,7 @@
             this.timer = setInterval(() => {
                 // this.getMessage()
                 this.getData(this.activeTab)
-<<<<<<< HEAD
             }, 30 * 1000)
-=======
-            }, 10 * 1000)
->>>>>>> 635b8f8d0851f08a4b8fe9b86700e24590f2e804
         },
         beforeDestroy() {
             clearInterval(this.timer)
@@ -372,7 +375,7 @@
                     this.userList = userList
                     return
                 }
-                let sql = 'select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee'
+                let sql = `select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee where status_ = 'actived'`
                 curdPost('sql', sql).then(res => {
                     this.userList = res.variables && res.variables.data
                 })
@@ -450,11 +453,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)
@@ -551,14 +571,24 @@
                     parameters: [],
                     sorts: []
                 }
-                let sql = `select id_, shi_wu_id_ as taskId from t_gqswbs where position('${userId}' in chu_li_ren_id_)`
-                Promise.all([pending(params), curdPost('sql', sql)]).then(([res1, res2]) => {
+                let sql = `select id_, shi_wu_id_ as taskId from t_gqswbs where position('${userId}' in chu_li_ren_id_) FOR UPDATE`
+                // Promise.all([pending(params), curdPost('sql', sql)]).then(([res1, res2]) => {
+                //     let workData = res1.data && res1.data.dataResult
+                //     let noticeData = res2.variables && res2.variables.data
+                //     if (!workData || !workData.length) {
+                //         return
+                //     }
+                //     this.dealData(workData, noticeData)
+                // })
+                pending(params).then(res1 => {
                     let workData = res1.data && res1.data.dataResult
-                    let noticeData = res2.variables && res2.variables.data
-                    if (!workData || !workData.length) {
-                        return
-                    }
-                    this.dealData(workData, noticeData)
+                    curdPost('sql', sql).then(res2 => {
+                        let noticeData = res2.variables && res2.variables.data
+                        if (!workData || !workData.length) {
+                            return
+                        }
+                        this.dealData(workData, noticeData)
+                    })
                 })
             },
             // 处理数据
@@ -582,6 +612,7 @@
                     }
                     result.all.push(item)
                 })
+                // console.log('处理后数据:', result)
                 // 有过期数据才执行过期数据处理
                 if (result.expire.length) {
                     this.dealExpile(result.expire, noticeList)
@@ -676,7 +707,7 @@
                     tableName: 't_gqswbs',
                     paramWhere: addList
                 }
-                console.log(addList, sendList)
+                // console.log('新增过期事务表数据:', addList, '发送消息数据', sendList)
                 if (addList.length) {
                     curdPost('add', JSON.stringify(addParams))
                 }
@@ -843,6 +874,10 @@
                     border-radius: 3px;
                     padding: 7px 15px;
                 }
+                .el-button--danger {
+                    background-color: #f56c6c;
+                    border-color: #f56c6c;
+                }
             }
         }
     }

+ 1 - 1
src/views/system/dashboard/page.vue

@@ -529,7 +529,7 @@
                 if (usersList.length) {
                     return
                 } else {
-                    let sql = 'select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee'
+                    let sql = `select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee where status_ = 'actived'`
                     curdPost('sql', sql).then(res => {
                         const { data } = res.variables
                         this.$store.dispatch('ibps/param/setUsersList', data)