فهرست منبع

Merge branch 'schedule'

cfort 1 سال پیش
والد
کامیت
e7a3512290

+ 5 - 4
src/views/business/​scheduleManage/adjust.vue

@@ -33,11 +33,10 @@
 </template>
 
 <script>
-import { queryAdjustment, removeAdjustment, saveAdjustment } from '@/api/business/schedule'
+import { queryAdjustment, removeAdjustment, sendMessage, saveAdjustment } from '@/api/business/schedule'
 import { stateType } from '@/views/constants/schedule'
 import ActionUtils from '@/utils/action'
 import FixHeight from '@/mixins/height'
-import action from '@/business/platform/bpmn/form/action';
 
 export default {
     components: {
@@ -79,7 +78,7 @@ export default {
                 columns: [
                     { prop: 'createBy', label: '申请人', tags: userOption, width: 100 },
                     { prop: 'createTime', label: '申请时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
-                    { prop: 'executor', label: '审批人', tags: userOption, width: 100 },
+                    { prop: 'executor', label: '审批人', tags: userOption, dataType: 'stringArray', separator: ',', minWidth: 100 },
                     { prop: 'executeDate', label: '审批时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
                     { prop: 'reason', label: '调班原因', width: 150 },
                     { prop: 'status', label: '状态', tags: stateType, width: 100 },
@@ -243,6 +242,8 @@ export default {
                 await this.$common.request('update', sonUpdateParams) // 更新子表
                 ActionUtils.successMessage()
                 this.search()
+                // 告知审核人该单已取消
+                // sendMessage(data, data.createBy)
             }).catch((e) => { console.error(e) })
             /*
             saveAdjustment(data).then(() => {
@@ -262,7 +263,7 @@ export default {
             }).catch(() => {})
         },
         handleRowDblclick (row) {
-            this.handleEdit(row, 'detail')
+            // this.handleEdit(row, 'detail')
         }
     }
 }

+ 16 - 7
src/views/business/​scheduleManage/adjustVerify.vue

@@ -83,7 +83,7 @@ export default {
                 columns: [
                     { prop: 'createBy', label: '申请人', tags: userOption, width: 100 },
                     { prop: 'createTime', label: '申请时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
-                    { prop: 'executor', label: '审批人', tags: userOption, width: 100 },
+                    { prop: 'executor', label: '审批人', tags: userOption, dataType: 'stringArray', separator: ',', minWidth: 100 },
                     { prop: 'executeDate', label: '审批时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
                     { prop: 'reason', label: '调班原因', width: 150 },
                     { prop: 'status', label: '状态', tags: stateType, width: 100 },
@@ -177,12 +177,14 @@ export default {
 
             if (this.isRoleFilter()) { // 超级管理员和高权限角色不做审批人过滤
             } else {
-                /* 审批人过滤
+                // 审批人过滤
                 const { userId } = this.$store.getters || ''
                 if (userId) {
-                    paramjson['Q^executor_^S'] = userId
+                    parameters[0].parameters.push({
+                        'key': 'Q^executor_^SL',
+                        'value': userId
+                    })
                 }
-                */
             }
             const param = {
                 parameters: parameters,
@@ -269,8 +271,11 @@ export default {
         sendMsg (data) {
             switch (data.status) {
                 case '待审批':
-                    sendMessage(data, data.executor || '')
-                    break
+                { const executorList = data.executor.split(',')
+                    executorList.forEach(el => {
+                        sendMessage(data, el)
+                    })
+                    break }
                 case '已拒绝':
                 { // 已拒绝时视情况发送给审核人申请人(审核时拒绝消息对象需排除自己)
                     const parties = data.adjustmentDetailPoList.map(obj => obj.party)
@@ -387,6 +392,10 @@ export default {
             let uparr = []
             let sonuparr = []
             data.forEach((el) => {
+                if (el.status === '已通过' || el.status === '已拒绝') {
+                    // this.$message.warning('所选数据中有已通过/已拒绝的申请单,请取消选择!')
+                    return
+                }
                 el.status = key === 'massAgree' ? this.isNextStep(el) : '已拒绝'
                 uparr.push({
                     where: {
@@ -479,7 +488,7 @@ export default {
          *
          */
         handleRowDblclick (row) {
-            this.handleEdit(row, 'detail')
+            // this.handleEdit(row, 'detail')
         }
     }
 }

+ 25 - 11
src/views/business/​scheduleManage/components/adjust-edit.vue

@@ -90,6 +90,7 @@
                 </div>
                 <el-table
                     ref="adjustTable"
+                    :key="reScheduleValue"
                     :data="formData.adjustList"
                     border
                     stripe
@@ -164,6 +165,7 @@
                         </template>
                     </el-table-column>
                     <el-table-column
+                        v-if= "reScheduleValue!=='paiban'"
                         prop="party"
                         label="目标人员"
                         width="130"
@@ -188,6 +190,7 @@
                         </template>
                     </el-table-column>
                     <el-table-column
+                        v-if= "reScheduleValue!=='paiban'"
                         prop="afterDate"
                         label="目标日期"
                         width="150"
@@ -334,8 +337,9 @@ export default {
             }
         },
         reScheduleValue (newValue, oldValue) {
-        // 当reScheduleValue发生变化时,清空调班数组
-            this.formData.adjustList = []
+            if (oldValue !== '') { // 当reScheduleValue发生变化时,清空调班数组(初始化除外)
+                this.formData.adjustList = []
+            }
         }
     },
     async mounted () {
@@ -357,6 +361,7 @@ export default {
             // 初始化表单数据的方法
             const initializeFormData = (data) => {
                 const { scheduleId, reason, executor, executeDate, adjustmentDetailPoList } = data || {}
+                // this.reScheduleValue = 'paiban'
                 self.formData = {
                     scheduleId,
                     reason,
@@ -365,7 +370,7 @@ export default {
                         beforeAdjust: i.beforeAdjust ? i.beforeAdjust.split(',') : [],
                         afterAdjust: i.afterAdjust ? i.afterAdjust.split(',') : [],
                         beforeShiftList: self.handleDateInit(i.beforeDate, index, 'beforeShiftList', i.createBy, i.beforeAdjust),
-                        afterShiftList: self.handleDateInit(i.afterDate, index, 'afterShiftList', i.party, i.afterAdjust)
+                        afterShiftList: this.reScheduleValue === 'paiban' ? self.getPaiBanBanci(true, index, i.afterAdjust.split(',')) : self.handleDateInit(i.afterDate, index, 'afterShiftList', i.party, i.afterAdjust)
                     }))
                 }
                 console.log('formData', self.formData)
@@ -408,7 +413,8 @@ export default {
                     startDate: data.startDate,
                     scheduleShift: config.scheduleShift,
                     scheduleStaff: self.userList.filter(u => config.scheduleStaff.includes(u.userId) && u.userId !== this.userId),
-                    shiftList: data.staffScheduleDetailPoList
+                    shiftList: data.staffScheduleDetailPoList,
+                    executor: JSON.stringify(config.approver) || ''
                 }
                 self.scheduleOptions = self.scheduleList.map(s => ({
                     label: s.title,
@@ -437,7 +443,8 @@ export default {
                     endDate: schedule.endDate,
                     scheduleShift: config.scheduleShift,
                     scheduleStaff: self.userList.filter(u => config.scheduleStaff.includes(u.userId) && u.userId !== self.userId),
-                    shiftList: schedule.staffScheduleDetailPoList
+                    shiftList: schedule.staffScheduleDetailPoList,
+                    executor: JSON.stringify(config.approver) || ''
                 }
                 self.currentShift = self.scheduleInfo.shiftList.find(s => s.userId === self.userId) // 当前排班中我的排版表
                 if (!self.currentShift) {
@@ -693,9 +700,13 @@ export default {
                 this.handleDateChange(row.afterDate, index, 'afterShiftList')
             }
         },
-        getPaiBanBanci (visible, index) { // 排班变更方式,班次全部可选,目标人员和日期不可选
+        getPaiBanBanci (visible, index, afterAdjust) { // 排班变更方式,班次全部可选,目标人员和日期不可选
             if (this.reScheduleValue === 'paiban' && visible === true) {
                 this.formData.adjustList[index]['afterShiftList'] = this.scheduleInfo.scheduleShift
+                if (afterAdjust) {
+                    this.formData.adjustList[index]['afterAdjust'] = afterAdjust
+                    return this.formData.adjustList[index]['afterShiftList']
+                }
             } else {
                 return
             }
@@ -741,10 +752,10 @@ export default {
                     const beforeAdjust = i.beforeAdjust.map(item => `【${item}】`).join('')
                     const afterAdjust = i.afterAdjust.map(item => `【${item}】`).join('')
                     let desc = ''
-                    if (i.party) {
+                    if (i.party && i.party !== this.$store.getters.userId) {
                         desc = `${i.beforeDate}班次${beforeAdjust}与${partyName}${i.afterDate}班次${afterAdjust}调换`
                     } else {
-                        desc = `${i.beforeDate}班次${beforeAdjust}调换到${i.afterDate}`
+                        desc = `${i.beforeDate}班次${beforeAdjust}调换到${i.afterAdjust}`
                     }
                     result.push(desc)
                 })
@@ -767,8 +778,7 @@ export default {
                     if (this.rowValidate(this.formData.adjustList[this.formData.adjustList.length - 1], this.formData.adjustList.length)) {
                         return
                     }
-
-                    statusVal = adjustList.some(i => this.$utils.isNotEmpty(i.party)) ? '待审核' : '待审批'
+                    statusVal = adjustList.some((i) => { return this.$utils.isNotEmpty(i.party) && this.reScheduleValue !== 'paiban' }) ? '待审核' : '待审批'
                 }
                 // return
                 const submitData = {
@@ -779,6 +789,7 @@ export default {
                     diDian: second || first,
                     overview: getOverview(adjustList),
                     status: statusVal,
+                    executor: this.scheduleInfo.executor.replace(/\[|\]|\"/g, '').replace(/,/g, ',') || '',
                     adjustmentDetailPoList: adjustList.map(i => ({
                         recordId: i.recordId,
                         beforeDate: i.beforeDate,
@@ -798,7 +809,10 @@ export default {
                         sendMessage(submitData, el)
                     })
                 } else if (statusVal === '待审批') {
-                    sendMessage(submitData, submitData.executor || '')
+                    const executorList = submitData.executor.split(',')
+                    executorList.forEach(el => {
+                        sendMessage(submitData, el)
+                    })
                 }
             })
         },

+ 43 - 18
src/views/business/​scheduleManage/components/statistic.vue

@@ -68,8 +68,13 @@ export default {
                 itemStyle: {
                     color: colors[key]
                 },
-                barMaxWidth: '50px',
-                barMinWidth: '20px',
+                barMaxWidth: '90%',
+                barMinWidth: '80%',
+                stack: 'stack1',
+                emphasis: {
+                    focus: 'series'
+                }
+                /*
                 markLine: {
                     silent: true,
                     precision: 2,
@@ -79,7 +84,7 @@ export default {
                             type: 'average'
                         }
                     ]
-                }
+                }*/
                 // label: {
                 //     show: true,
                 //     position: 'top',
@@ -129,8 +134,13 @@ export default {
                 itemStyle: {
                     color: colors[key]
                 },
-                barMaxWidth: '50px',
-                barMinWidth: '20px',
+                barMaxWidth: '90%',
+                barMinWidth: '80%',
+                stack: 'stack1',
+                emphasis: {
+                    focus: 'series'
+                }
+                /*
                 markLine: {
                     silent: true,
                     precision: 2,
@@ -140,7 +150,7 @@ export default {
                             type: 'average'
                         }
                     ]
-                }
+                }*/
             }))
 
             const avg = mapValues(seriesData, values => mean(values).toFixed(2))
@@ -175,24 +185,39 @@ export default {
                     })
                 })
             })
-
             const series = [
                 {
                     name: '人数',
-                    type: 'bar',
-                    data: categories.map(name => seriesData[name]),
+                    type: 'pie',
+                    data: Object.keys(seriesData).map(name => ({
+                        name: name,
+                        value: seriesData[name]
+                    })),
                     itemStyle: {
-                        color: params => colors[categories[params.dataIndex]]
-                    },
-                    barMaxWidth: '50px',
-                    barMinWidth: '20px'
+                        color: params => colors[params.data.name]
+                    }
                 }
             ]
-
-            const shiftOption = JSON.parse(JSON.stringify(chartOption))
-            shiftOption.title.text = '班次人数统计'
-            shiftOption.legend.data = Object.keys(seriesData)
-            shiftOption.xAxis.data = categories
+            const option = {
+                title: chartOption.title,
+                tooltip: {
+                    trigger: 'item',
+                    formatter: '{b} : {c} ({d}%)'
+                },
+                textStyle: chartOption.textStyle,
+                legend: {
+                    orient: 'vertical',
+                    x: '80%',
+                    y: 'center',
+                    textStyle: {
+                        fontSize: 14
+                    },
+                    itemGap: 20,
+                    data: categories
+                }
+            }
+            option.title.text = '班次人数统计'
+            const shiftOption = option
             shiftOption.series = series
             shiftChart.setOption(shiftOption)
         }

+ 5 - 0
src/views/business/​scheduleManage/constants/options.js

@@ -25,6 +25,7 @@ const rowLimit = (params, max) => {
 const fontColor = '#333'
 
 export const chartOption = {
+    animation: true,
     title: {
         show: true,
         text: '',
@@ -51,6 +52,7 @@ export const chartOption = {
     },
     legend: {
         data: [],
+        itemGap: 30,
         bottom: 0
     },
     xAxis: {
@@ -127,6 +129,9 @@ export const chartOption = {
             }
         }
     }],
+    textStyle: {
+        fontSize: 14
+    },
     tooltip: {
         show: true,
         trigger: 'axis',

+ 31 - 13
src/views/business/​scheduleManage/edit.vue

@@ -548,7 +548,7 @@ export default {
             //     scheduleContent.style.paddingLeft = '0px'
             // }
         },
-        async loadData () {
+        loadData () {
             this.loading = true
             // 获取配置数据
             queryScheduleConfig({
@@ -567,7 +567,6 @@ export default {
                     this.loading = false
                     return
                 }
-
                 const response = await getStaffSchedule({ id: this.pageParams.id })
                 const { staffScheduleDetailPoList: records, title, endDate, startDate, type, overview, config, status } = response.data
                 const temp = config ? JSON.parse(config) : {}
@@ -598,10 +597,6 @@ export default {
                 this.responseData = { ...this.responseData, records, overview, temp }
                 console.log('scheduleData', this.scheduleData)
                 this.loading = false
-                this.userNameList = this.ordinateList.map(item => ({ // 存起user对应id和name
-                    userName: item.label,
-                    userId: item.value
-                }))
             }).catch(() => {
                 this.loading = false
             })
@@ -658,12 +653,15 @@ export default {
             const temp = overview ? JSON.parse(overview) : {}
             // 先创建以排班班次为键的空二维数组
             scheduleShift.forEach(shift => {
-                result[shift.alias] = Array.from({ length: temp.dateCount }, () => [])
+                result[shift.alias] = Array.from({ length: temp.dateCount || this.dateList.length }, () => [])
             })
             // 再次遍历用户列表,填充每个排班班次对应的用户信息
             userList.forEach(({ userId, userName }) => {
                 data[userId].forEach((day, dayIndex) => {
                     day.forEach(({ alias }) => {
+                        if (!result[alias][dayIndex]) {
+                            result[alias][dayIndex] = []
+                        }
                         result[alias][dayIndex].push({
                             userId,
                             userName
@@ -676,11 +674,11 @@ export default {
         /* 复原ScheduleData为人员排班数据格式(班次排班->人员排班)
         */
         reverseForScheduleData (data, userList, scheduleShift, overview) {
-            const result = []
+            const result = {}
             // 先创建以userId为键的空二维数组
             const temp = overview ? JSON.parse(overview) : {}
             userList.forEach(({ userId }) => {
-                result[userId] = Array.from({ length: temp.dateCount }, () => [])
+                result[userId] = Array.from({ length: temp.dateCount || this.dateList.length }, () => [])
             })
             const scheduleShiftMap = scheduleShift.reduce((acc, item) => {
                 acc[item.alias] = item
@@ -696,6 +694,9 @@ export default {
                     // 遍历当天该班次上的每个用户
                     users.forEach(({ userId }) => {
                         // 将当天该用户在该班次的信息添加到对应的用户数据中
+                        if (!result[userId][dayIndex]) {
+                            result[userId][dayIndex] = []
+                        }
                         result[userId][dayIndex].push(aliasData)
                     })
                 })
@@ -746,6 +747,12 @@ export default {
             return dates
         },
         changeView () {
+            if (this.userNameList.length < 1) {
+                this.userNameList = this.ordinateList.map(item => ({ // 存起user对应id和name
+                    userName: item.label,
+                    userId: item.value
+                }))
+            }
             // 关闭可能存在的弹出框(如果有的话),确保视图切换时界面整洁
             this.$refs.popover.showPopper = false
             this.handleClose()
@@ -849,6 +856,11 @@ export default {
                     this.updateScheduleData()
                 }
             }
+            if (this.activeStep === 2 && this.viewType === 'shifts') { // 班次排班需还原数据
+                if (val > 0) {
+                    this.changeView() // 切换为人员排班
+                }
+            }
             this.handleListener('addEventListener')
             this.activeStep += val
         },
@@ -1226,23 +1238,29 @@ export default {
                     }
                     // 如果有班次变化,将其与userId记录到结果中
                     if (changes.length > 0) {
-                        const userNameObj = this.userNameList.filter(item => item.userId === newItem.userId)
+                        const userNameObj = this.userList.filter(item => item.userId === newItem.userId)
                         const perOverView = userNameObj[0]?.userName + changes.join(',')
                         result.push(perOverView)
                     }
                 }
             })
-            return '排班管理员调整如下:' + result.join('。')
+            return result.join('。')
         },
         // 提交调班申请数据
         submitAdjust (submitData) {
-            const overView = this.getOverViews(this.responseData, submitData.staffScheduleDetailPoList)
+            let overView = ''
+            if (submitData.id) {
+                overView = this.getOverViews(this.responseData || null, submitData.staffScheduleDetailPoList)
+            }
+            if (overView === '') {
+                return
+            }
             const { first, second } = this.$store.getters.level || {}
             const adjustData = {
                 scheduleId: submitData.id,
                 reason: '排班管理员调整排班',
                 diDian: second || first,
-                overview: overView,
+                overview: '排班管理员调整:' + overView,
                 status: '已通过',
                 updateTime: Date.now(),
                 adjustmentDetailPoList: []

+ 1 - 1
src/views/system/homepage/components/banciDialog.vue

@@ -1,12 +1,12 @@
 <template>
     <div>
-        <el-button type="primary" @click="openDialog">查看班次详情</el-button>
         <el-dialog
             title="班次详情"
             :visible.sync="dialogVisible"
             width="30%"
             :close-on-click-modal="false"
             :close-on-press-escape="false"
+            :show-close="false"
         >
             <div class="containerDiv">
                 <div>

+ 2 - 0
src/views/system/homepage/index.vue

@@ -649,6 +649,7 @@ export default {
          */
         // 关闭指定弹框
         handleClose (state) {
+            debugger
             switch (state) {
                 case 'calendar':
                     this.calendarDialogVisible = false
@@ -662,6 +663,7 @@ export default {
         },
         // 打开指定弹框
         handleOpen (state, dateArr, events, clickId) {
+            debugger
             const status = ['急', '重', '轻', '缓']
             const eventTrees = []
             switch (state) {