|
|
@@ -47,15 +47,12 @@
|
|
|
<el-table-column
|
|
|
prop="subject"
|
|
|
label="事务名称"
|
|
|
+ width="300"
|
|
|
show-overflow-tooltip
|
|
|
>
|
|
|
<template slot-scope="scope">{{ scope.row.subject | getWorkInfo('name') }}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="事务说明"
|
|
|
- width="200"
|
|
|
- show-overflow-tooltip
|
|
|
- >
|
|
|
+ <el-table-column label="事务说明" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">{{ scope.row.subject | getWorkInfo('desc') }}</template>
|
|
|
</el-table-column>
|
|
|
<template v-if="['wait'].includes(activeTab)">
|
|
|
@@ -157,6 +154,8 @@
|
|
|
import homeCalendar from './home-calendar'
|
|
|
import { pending, handledTask } from '@/api/platform/office/bpmReceived'
|
|
|
import { myDraft, removeDraft } from '@/api/platform/office/bpmInitiated'
|
|
|
+ import { queryOrgManager } from '@/api/platform/org/employee'
|
|
|
+ import { save } from '@/api/platform/message/innerMessage'
|
|
|
import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
|
|
|
import ActionUtils from '@/utils/action'
|
|
|
import { dateFormat } from '../../../../filters'
|
|
|
@@ -260,16 +259,14 @@
|
|
|
timer: null,
|
|
|
processName: '',
|
|
|
userList: [],
|
|
|
+ orgInfo: {},
|
|
|
activeTab: 'wait'
|
|
|
}
|
|
|
},
|
|
|
mounted: function () {
|
|
|
this.loadData()
|
|
|
- // 获取系统用户信息用于转换
|
|
|
- let sql = `select id_, name_ from ibps_party_employee where status_ = 'actived'`
|
|
|
- curdPost('sql', sql).then(res => {
|
|
|
- this.userList = res.variables && res.variables.data
|
|
|
- })
|
|
|
+ this.getUserList()
|
|
|
+ this.getOrgInfo()
|
|
|
if (this.timer) {
|
|
|
clearInterval(this.timer)
|
|
|
}
|
|
|
@@ -308,6 +305,37 @@
|
|
|
// 获取任务数据
|
|
|
this.getData(this.activeTab)
|
|
|
},
|
|
|
+ // 获取系统用户信息
|
|
|
+ getUserList() {
|
|
|
+ const { userList } = this.$store.getters
|
|
|
+ // store中有则无需请求
|
|
|
+ if (userList && userList.length) {
|
|
|
+ this.userList = userList
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let sql = 'select id_ as userId, name_ as userName, mobile_ as phone from ibps_party_employee'
|
|
|
+ curdPost('sql', sql).then(res => {
|
|
|
+ this.userList = res.variables && res.variables.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取用户部门信息
|
|
|
+ getOrgInfo() {
|
|
|
+ const { orgId } = this.$store.getters
|
|
|
+ if (!orgId) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let params = {
|
|
|
+ parameters: [{key: 'Q^MANAGER_ORG_ID_^S', value: orgId}]
|
|
|
+ }
|
|
|
+ queryOrgManager(params).then(res => {
|
|
|
+ this.orgInfo = {}
|
|
|
+ const data = res.data.dataResult
|
|
|
+ if (data && data.length) {
|
|
|
+ const { id, name, mobile, account, gender, groupID, orgName } = data[0]
|
|
|
+ this.orgInfo = { id, name, mobile, account, gender, groupID, orgName }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
tableRowClassName({ row, rowIndex }) {
|
|
|
if (rowIndex % 2 === 1) return 'warning-row'
|
|
|
return 'success-row'
|
|
|
@@ -333,6 +361,7 @@
|
|
|
this.dataList = dataResult
|
|
|
this.paginate = pageResult
|
|
|
})
|
|
|
+ this.urgeToManager()
|
|
|
} else {
|
|
|
this.dataList = dataResult
|
|
|
this.paginate = pageResult
|
|
|
@@ -445,6 +474,168 @@
|
|
|
const { testingList } = this.$store.getters
|
|
|
let res = testingList.find(item => item.processKey === v)
|
|
|
return res ? res.name : ''
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 主管提醒
|
|
|
+ * 数据处理,将所有待办数据根据是否过期处理为两个数组
|
|
|
+ * 过期判断依据:普通事务-创建时间到当前时间超过三天即为过期;计划事务【事务名称中含计划】-创建当月月末前七天
|
|
|
+ * 逻辑说明:过期数组中不存于在主管提醒表中的数据插入主管提醒表,并发送内部通知,主管提醒表删除不存在于未过期数组中的数据
|
|
|
+ */
|
|
|
+ urgeToManager() {
|
|
|
+ const { userId } = this.$store.getters
|
|
|
+ let params = {
|
|
|
+ parameters: [],
|
|
|
+ sorts: []
|
|
|
+ }
|
|
|
+ let sql = `select id_, shu_ju_id_ as taskId from t_zgrwtxb where position('${userId}' in chu_li_ren_)`
|
|
|
+ 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)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 处理数据
|
|
|
+ dealData(workList, noticeList) {
|
|
|
+ let result = {
|
|
|
+ expire: [],
|
|
|
+ unexpire: [],
|
|
|
+ all: []
|
|
|
+ }
|
|
|
+ let currentTime = Date.now()
|
|
|
+ // 筛选已过期数据
|
|
|
+ workList.forEach(item => {
|
|
|
+ // 截取流程名
|
|
|
+ item.workName = item.subject.includes('#') ? item.subject.split('#')[0] : item.subject.split('(')[0]
|
|
|
+ item.workType = item.workName.includes('计划') ? 'plan' : 'normal'
|
|
|
+ let isExpire = this.judgeExpire(item.createTime, currentTime, item.workType)
|
|
|
+ if (isExpire) {
|
|
|
+ result.expire.push(item)
|
|
|
+ } else {
|
|
|
+ result.unexpire.push(item)
|
|
|
+ }
|
|
|
+ result.all.push(item)
|
|
|
+ })
|
|
|
+ // 有过期数据才执行过期数据处理
|
|
|
+ if (result.expire.length) {
|
|
|
+ this.dealExpile(result.expire, noticeList)
|
|
|
+ }
|
|
|
+ // 主管提醒表中有数据才执行数据删除
|
|
|
+ if (noticeList && noticeList.length) {
|
|
|
+ this.dealUnexpile(result.all, noticeList)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 判断是否过期
|
|
|
+ judgeExpire(time, current, type) {
|
|
|
+ let D = new Date(time)
|
|
|
+ let a = new Date(time).getTime()
|
|
|
+ let b = new Date(current).getTime()
|
|
|
+ // 创建时间当月最后一天的时间戳
|
|
|
+ let c = new Date(D.getFullYear(), D.getMonth() + 1, 0).getTime()
|
|
|
+ if (type === 'plan') {
|
|
|
+ return b + (86400000 * 7) > c
|
|
|
+ } else {
|
|
|
+ return a + (86400000 * 3) > b
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 处理已过期数据
|
|
|
+ dealExpile(data, noticeList) {
|
|
|
+ const { userId } = this.$store.getters
|
|
|
+ let addList = []
|
|
|
+ let sendList = []
|
|
|
+ let msgContent = {
|
|
|
+ plan: '距离过期还剩七天,请及时处理!',
|
|
|
+ normal: '至今三天未处理,已超时,请及时处理!'
|
|
|
+ }
|
|
|
+ let msgTitle = {
|
|
|
+ plan: '计划事务即将到期提醒',
|
|
|
+ normal: '事务超时提醒'
|
|
|
+ }
|
|
|
+ data.forEach(item => {
|
|
|
+ let isExist = !!noticeList.find(i => i.taskId === item.taskId)
|
|
|
+ // 筛选出不存在于主管提醒表的过期数据
|
|
|
+ if (!isExist) {
|
|
|
+ // 无部门信息的用户无往主管表加数据
|
|
|
+ if (this.orgInfo.groupID) {
|
|
|
+ let obj = {
|
|
|
+ ren_wu_ming_cheng: item.subject,
|
|
|
+ code_: item.workName,
|
|
|
+ chu_li_ren_: this.getInfoByName(item.ownerName, 'id'),
|
|
|
+ chu_li_ren_dian_h: this.getInfoByName(item.ownerName, 'phone'),
|
|
|
+ bu_men_: this.orgInfo.orgName,
|
|
|
+ bu_men_id_: this.orgInfo.groupID,
|
|
|
+ zhu_guan_: this.orgInfo.id,
|
|
|
+ zhu_guan_dian_hua: this.orgInfo.mobile,
|
|
|
+ ren_wu_kai_shi_sh: item.createTime,
|
|
|
+ zhuang_tai_: `待${item.name}`,
|
|
|
+ shu_ju_id_: item.taskId,
|
|
|
+ type_: item.workType
|
|
|
+ }
|
|
|
+ addList.push(obj)
|
|
|
+ }
|
|
|
+ let msg = {
|
|
|
+ subject: msgTitle[item.workType],
|
|
|
+ content: `<p>事务【${item.workName}】${msgContent[item.workType]}<p>`,
|
|
|
+ receiverId: userId,
|
|
|
+ canreply: '0'
|
|
|
+ }
|
|
|
+ sendList.push(msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ let addParams = {
|
|
|
+ tableName: 't_zgrwtxb',
|
|
|
+ paramWhere: addList
|
|
|
+ }
|
|
|
+ if (addList.length) {
|
|
|
+ curdPost('add', JSON.stringify(addParams))
|
|
|
+ }
|
|
|
+ if (sendList.length) {
|
|
|
+ this.sendMsg(sendList)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除已办的提醒表数据
|
|
|
+ dealUnexpile(data, noticeList) {
|
|
|
+ // 清除存在于主管提醒表中【处理人含我】,但是不存在于待办中的数据
|
|
|
+ let deleteList = []
|
|
|
+ noticeList.forEach(item => {
|
|
|
+ let isExist = !!data.find(i => i.taskId === item.taskId)
|
|
|
+ if (!isExist) {
|
|
|
+ deleteList.push(item.id_)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (!deleteList.length) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let params = `{"tableName": "t_zgrwtxb","paramWhere":"{id_:'${deleteList.join(',')}'}"}`
|
|
|
+ curdPost('batchDelete', params).then(() => {}).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 发送站内消息
|
|
|
+ sendMsg(data) {
|
|
|
+ data.forEach(item => {
|
|
|
+ save(item).then(() => {}).catch(err => {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 通过名字获取id/电话
|
|
|
+ getInfoByName(names, type) {
|
|
|
+ let res = {
|
|
|
+ id: [],
|
|
|
+ phone: []
|
|
|
+ }
|
|
|
+ let temp = names.split(',')
|
|
|
+ temp.forEach(item => {
|
|
|
+ let t = this.userList.find(i => i.userName === item)
|
|
|
+ if (t) {
|
|
|
+ res.id.push(t.userId)
|
|
|
+ res.phone.push(t.phone)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return res[type].join(',')
|
|
|
}
|
|
|
}
|
|
|
}
|