Răsfoiți Sursa

首页新增主管催办逻辑,消息bug修复

cfort 3 ani în urmă
părinte
comite
efc9528b78

+ 1 - 1
src/business/platform/form/formbuilder/right-aside/editors/editor-field-custom-dialog.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="panel panel-default">
-    <div class="panel-heading">参数设2置</div>
+    <div class="panel-heading">参数设置</div>
     <div class="panel-body">
       <el-form-item label-width="110px">
         <template slot="label">对话框类型<help-tip prop="customDialogType" /></template>

+ 15 - 2
src/layout/header-aside/components/header-message/index.vue

@@ -14,15 +14,17 @@
         </el-tooltip>
         <el-popover
             v-else
+            v-model="popShow"
             placement="bottom-end"
             width="350"
-            trigger="click"
+            trigger="manual"
             popper-class="header-message-popper"
         >
             <el-button
                 slot="reference"
                 class="ibps-ml-0 ibps-mr btn-text can-hover"
                 type="text"
+                @click="openPop"
             >
                 <el-badge :max="9999" :value="messageCount">
                     <ibps-icon name="bell-o" size="16" />
@@ -64,6 +66,7 @@
         <!-- 消息明细 -->
         <inner-detail-dialog
             :id="editId"
+            :subId="subId"
             :visible="dialogFormVisible"
             :title="$t('layout.header-aside.header-message.details')"
             inside
@@ -85,12 +88,14 @@
         data() {
             return {
                 editId: '',
+                subId: '',
                 dialogFormVisible: false,
                 isControl: true,
                 messageList: [],
                 messageCount: 0,
                 infoMessage: '',
-                countNumber: 0
+                countNumber: 0,
+                popShow: false
             }
         },
         computed: {
@@ -188,11 +193,19 @@
                 this.$notify.closeAll()
             },
             handelInteriorClick(message) {
+                this.subId = message.subId
                 this.editId = message.id
                 this.dialogFormVisible = true
             },
+            openPop() {
+                this.popShow = !this.popShow
+                if (this.popShow) {
+                    this.loadData()
+                }
+            },
             clickMore() {
                 // 更多消息
+                this.popShow = !this.popShow
                 this.$router.push('/message')
             },
             closeDialog(visible) {

+ 1 - 0
src/store/getters.js

@@ -3,6 +3,7 @@ export default {
   userId: state => state.ibps.user.info && state.ibps.user.info.user ? state.ibps.user.info.user.id : '', // 用户ID
   name: state => state.ibps.user.info && state.ibps.user.info.employee ? state.ibps.user.info.employee.name : '', // 姓名
   status: state => state.ibps.user.info && state.ibps.user.info.employee ? state.ibps.user.info.employee.status : '', // 用户状态
+  orgId: state => state.ibps.user.info && state.ibps.user.info.org ? state.ibps.user.info.org.id : '', // 用户部门ID
   isSuper: state => state.ibps.user.info && state.ibps.user.info.user ? state.ibps.user.info.user.isSuper === 'Y' : false, // 是否超级管理员
   account: state => state.ibps.user.info && state.ibps.user.info.user ? state.ibps.user.info.user.account : '', // 用户名
   regOpen: state => state.ibps.user.regOpen, // 注册状态

+ 135 - 115
src/views/platform/message/inner/detail/dialog.vue

@@ -1,123 +1,143 @@
-
 <template>
-  <el-dialog
-    :title="title"
-    :visible.sync="dialogVisible"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    :class="[inside?'inside-dialog':'inner-dialog']"
-    append-to-body
-    top="5vh"
-    width="65%"
-    @open="getFormData"
-    @close="closeDialog"
-  >
-    <inner-message
-      :id="id"
-      ref="innerMessage"
-      :inside="inside"
-      :readonly="readonly"
-      @callback="handleCallback"
-    />
-    <div slot="footer" class="el-dialog--center">
-      <ibps-toolbar
-        :actions="toolbars"
-        @action-event="handleActionEvent"
-      />
-    </div>
-  </el-dialog>
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        :class="[inside ? 'inside-dialog' : 'inner-dialog']"
+        append-to-body
+        top="10vh"
+        width="65%"
+        @open="getFormData"
+        @close="closeDialog"
+    >
+        <inner-message
+            :id="id"
+            ref="innerMessage"
+            :inside="inside"
+            :readonly="readonly"
+            @callback="handleCallback"
+        />
+        <div slot="footer" class="el-dialog--center">
+            <ibps-toolbar
+                :actions="toolbars"
+                @action-event="handleActionEvent"
+            />
+        </div>
+    </el-dialog>
 </template>
 <script>
-import InnerMessage from './index'
-export default {
-  components: {
-    InnerMessage
-  },
-  props: {
-    inside: {
-      type: Boolean,
-      default: false
-    },
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    readonly: {
-      type: Boolean,
-      default: false
-    },
-    id: String,
-    title: String
-  },
-  data() {
-    return {
-      dialogVisible: this.visible,
-      dialogLoading: false,
-      toolbars: [
-        { key: 'cancel', label: '关闭' }
-      ]
+    import InnerMessage from './index'
+    export default {
+        components: { InnerMessage },
+        props: {
+            inside: {
+                type: Boolean,
+                default: false
+            },
+            visible: {
+                type: Boolean,
+                default: false
+            },
+            readonly: {
+                type: Boolean,
+                default: false
+            },
+            id: String,
+            // 子表ID
+            subId: String,
+            title: String
+        },
+        data() {
+            const btn1 = [
+                { key: 'confirm', label: '确认' },
+                { key: 'cancel', label: '关闭' }
+            ]
+            const btn2 = [
+                { key: 'cancel', label: '关闭' }
+            ]
+            const toolbars = this.subId ? btn1 : btn2
+            return {
+                dialogVisible: this.visible,
+                dialogLoading: false,
+                toolbars
+            }
+        },
+        watch: {
+            visible: {
+                handler: function (val, oldVal) {
+                    this.dialogVisible = this.visible
+                },
+                immediate: true
+            }
+        },
+        methods: {
+            handleActionEvent({ key }) {
+                switch (key) {
+                    case 'cancel':
+                        this.closeDialog()
+                        break
+                    case 'confirm':
+                        this.confirmMsg()
+                        break
+                    default:
+                        break
+                }
+            },
+            // 关闭当前窗口
+            closeDialog() {
+                this.$emit('close', false)
+            },
+            // 获取表单数据
+            getFormData() {
+                this.$nextTick(() => {
+                    this.$refs.innerMessage.getFormData()
+                    this.handleCallback(true)
+                })
+            },
+            // 消息确认,受控文件用
+            confirmMsg() {
+                // TODO
+                this.$confirm('是否已查阅受控文件?一经确认即代表xxxxxx', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning',
+                    showClose: false,
+                    closeOnClickModal: false
+                }).then(() => {
+                    // TODO 受控文件逻辑处理
+                    console.log('暂无')
+                    this.closeDialog()
+                }).catch(() => { })
+            },
+            handleCallback(res) {
+                this.$emit('callback', res)
+            }
+        }
     }
-  },
-  watch: {
-    visible: {
-      handler: function(val, oldVal) {
-        this.dialogVisible = this.visible
-      },
-      immediate: true
-    }
-  },
-  methods: {
-    handleActionEvent({ key }) {
-      switch (key) {
-        case 'cancel':
-          this.closeDialog()
-          break
-        default:
-          break
-      }
-    },
-    // 回复
-    // 关闭当前窗口
-    closeDialog() {
-      this.$emit('close', false)
-    },
-    /**
-     * 获取表单数据
-     */
-    getFormData() {
-      this.$nextTick(() => {
-        this.$refs.innerMessage.getFormData()
-        this.handleCallback(true)
-      })
-    },
-    handleCallback(res) {
-      this.$emit('callback', res)
-    }
-  }
-}
 </script>
 <style lang="scss">
-.inner-dialog{
-  .el-dialog__body{
-    padding: 20px 20px;
-    height: calc(80vh - 110px) !important;
-  }
-  .list{
-  .el-form-item__content{
-    margin-left: 0px!important;
-      .el-table--border{
-        height: 300px !important;
-      }
+    .inner-dialog {
+        .el-dialog__body {
+            padding: 20px 20px;
+            height: calc(40vh) !important;
+        }
+        .list {
+            .el-form-item__content {
+                margin-left: 0px !important;
+                .el-table--border {
+                    height: 300px !important;
+                }
+            }
+        }
+        .ibps-container-crud__header {
+            display: none;
+        }
+    }
+    .inside-dialog {
+        .el-dialog__body {
+            padding: 20px 20px;
+            height: calc(50vh - 110px) !important;
+        }
     }
-  }
-  .ibps-container-crud__header{
-    display: none;
-  }
-}
-.inside-dialog{
-  .el-dialog__body{
-    padding: 20px 20px;
-    height: calc(50vh - 110px) !important;
-  }
-}
 </style>

+ 2 - 2
src/views/platform/message/inner/detail/index.vue

@@ -60,7 +60,7 @@
         </el-form-item>
         
       </el-col>
-      <el-col v-if="!inside" :span="24">
+      <!-- <el-col v-if="!inside" :span="24">
         <el-form-item class="list">
           <el-tabs v-model="activeName" class="detail" @tab-click="handleClick">
             <el-tab-pane label="已回复信息列表" name="replied" style="height:300px;">
@@ -71,7 +71,7 @@
             </el-tab-pane>
           </el-tabs>
         </el-form-item>
-      </el-col>
+      </el-col> -->
     </el-row>
   </el-form>
 </template>

+ 1 - 1
src/views/platform/message/inner/send.vue

@@ -71,7 +71,7 @@ export default {
         receiver: '',
         groupId: '',
         groupName: '',
-        canreply: '1',
+        canreply: '0',
         fileMsg: '',
         content: '',
         id: '',

+ 201 - 10
src/views/system/dashboard/components/new-home.vue

@@ -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(',')
             }
         }
     }

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

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