Przeglądaj źródła

考勤-修复控制台报错、查询失效

zhonghuizhen 1 rok temu
rodzic
commit
6a9692ee5b

+ 39 - 11
src/views/business/​scheduleManage/adjust.vue

@@ -141,23 +141,51 @@ export default {
          * 获取格式化参数
          */
         getSearchFormData () {
-            const paramjson = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
+            const parameters = [{
+                relation: 'AND',
+                parameters: [
+                    {
+                        'key': 'Q^reason_^NE',
+                        'value': '排班修改',
+                        'param': 'status1'
+                    }
+                ]
+            }]
+            // 加入搜索栏参数
+            const searchParam = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
+            if (Object.keys(searchParam).length) { // 查询条件不为空,则加入parameters
+                const reasonArr = Object.keys(searchParam).filter(key => key.includes('reason'))
+                const notreasonArr = Object.keys(searchParam).filter(key => key.includes('reason') === false)
+                if (reasonArr.length > 0) { // 加入状态查询
+                    parameters[0].parameters.push({
+                        'key': reasonArr[0],
+                        'value': searchParam[reasonArr[0]],
+                        'param': 'reason2'
+                    })
+                }
+                if (notreasonArr.length > 0) { // 加入其他查询
+                    notreasonArr.forEach((el) => {
+                        parameters[0].parameters.push({
+                            'key': el,
+                            'value': searchParam[el]
+                        })
+                    })
+                }
+            }
+            const { first, second } = this.$store.getters.level || {}
+            parameters[0].parameters.push({ 'key': 'Q^di_dian_^S', 'value': (second || first) })
             if (this.isRoleFilter()) { // 超级管理员和高权限角色不做申请人过滤
             } else {
                 const { userId } = this.$store.getters || ''
                 if (userId) {
-                    paramjson['Q^create_By_^S'] = userId
+                    parameters[0].parameters.push({ 'key': 'Q^create_By_^S', 'value': userId })
                 }
             }
-            const { first, second } = this.$store.getters.level || {}
-            paramjson['Q^di_dian_^S'] = (second || first)
-            paramjson['Q^reason_^NE'] = '排班修改'
-            return ActionUtils.formatParams(
-                // this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
-                paramjson,
-                this.pagination,
-                this.sorts
-            )
+            const param = {
+                parameters: parameters,
+                ...ActionUtils.formatParams(null, this.pagination, this.sorts)
+            }
+            return param
         },
         /**
          * 处理审核人数据

+ 1 - 1
src/views/business/​scheduleManage/adjustVerify.vue

@@ -221,7 +221,7 @@ export default {
             }
             const { first, second } = this.$store.getters.level || {}
             parameters[0].parameters.push({ 'key': 'Q^di_dian_^S', 'value': (second || first) })
-            parameters[0].parameters.push({ 'key': 'Q^reason_^NE', 'value': '排班修改' })
+            parameters[0].parameters.push({ 'key': 'Q^reason_^NE', 'value': '排班修改', 'param': 'reason1' })
             const param = {
                 parameters: parameters,
                 ...ActionUtils.formatParams(null, this.pagination, this.sorts)

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

@@ -174,7 +174,7 @@
                                 multiple
                                 filterable
                                 clearable
-                                multiple-limit="3"
+                                :multiple-limit=3
                                 :placeholder=" readonly ? '' : '请选择调班班次'"
                                 @change="vaildBanci($event, scope.row, 'before')"
                             >
@@ -265,7 +265,7 @@
                                 multiple
                                 clearable
                                 filterable
-                                multiple-limit="3"
+                                :multiple-limit=3
                                 :placeholder=" readonly ? '' : '请选择目标班次'"
                                 @change="vaildBanci($event, scope.row, 'after')"
                             >
@@ -580,7 +580,10 @@ export default {
                     return true
                 } else if (duplicateElements.length === 0 && type === 'after') {
                     const targetData1 = this.afterDateList.filter(obj => obj.value === row.beforeDate) // 目标人在调班日期的班次
-                    const targetBanCiNum1 = targetData1[0].banci.split(',').length // 目标人在调班日期的班次数量
+                    let targetBanCiNum1 = 0 // 目标人在调班日期的班次数量
+                    if (targetData1.length > 0) {
+                        targetBanCiNum1 = targetData1[0].banci.split(',').length// 目标人在调班日期的班次数量
+                    }
                     // 判断班次不能大于3个
                     if ((targetBanCiNum1 + row.beforeAdjust.length - row.afterAdjust.length) > 3) {
                         const name = this.userList.filter(obj => obj.userId === row.party)[0].userName
@@ -589,7 +592,10 @@ export default {
                         return true
                     }
                     const targetData2 = this.beforeDateList.filter(obj => obj.value === row.afterDate) // 调班人在目标日期的班次
-                    const targetBanCiNum2 = targetData2[0].banci.split(',').length // 调班人在目标日期的班次数量
+                    let targetBanCiNum2 = 0
+                    if (targetData2.length > 0) {
+                        targetBanCiNum2 = targetData2[0].banci.split(',').length // 调班人在目标日期的班次数量
+                    }
                     // 判断班次不能大于3个
                     if ((targetBanCiNum2 + row.afterAdjust.length - row.beforeAdjust.length) > 3) {
                         const name = this.userList.filter(obj => obj.userId === this.$store.getters.userId)[0].userName
@@ -603,7 +609,7 @@ export default {
                 const partyElements = []// 目标人员重复班次数组
                 const partyBeforeData = this.afterDateList.find(obj => obj.value === row.beforeDate)
                 row.beforeAdjust.some(element => {
-                    if (partyBeforeData.banci.includes(element)) {
+                    if (partyBeforeData && partyBeforeData.banci.includes(element)) {
                         partyElements.push(element)
                     }
                     return false
@@ -619,7 +625,10 @@ export default {
                     return true
                 } else if (duplicateElements.length === 0 && type === 'before') {
                     const targetData1 = this.afterDateList.filter(obj => obj.value === row.beforeDate) // 目标人在调班日期的班次
-                    const targetBanCiNum1 = targetData1[0].banci.split(',').length // 目标人在调班日期的班次数量
+                    let targetBanCiNum1 = 0 // 目标人在调班日期的班次数量
+                    if (targetData1.length > 0) {
+                        targetBanCiNum1 = targetData1[0].banci.split(',').length// 目标人在调班日期的班次数量
+                    }
                     // 判断班次不能大于3个
                     if ((targetBanCiNum1 + row.beforeAdjust.length - row.afterAdjust.length) > 3) {
                         const name = this.userList.filter(obj => obj.userId === row.party)[0].userName
@@ -628,7 +637,10 @@ export default {
                         return true
                     }
                     const targetData2 = this.beforeDateList.filter(obj => obj.value === row.afterDate) // 调班人在目标日期的班次
-                    const targetBanCiNum2 = targetData2[0].banci.split(',').length // 调班人在目标日期的班次数量
+                    let targetBanCiNum2 = 0
+                    if (targetData2.length > 0) {
+                        targetBanCiNum2 = targetData2[0].banci.split(',').length // 调班人在目标日期的班次数量
+                    }
                     // 判断班次不能大于3个
                     if ((targetBanCiNum2 + row.afterAdjust.length - row.beforeAdjust.length) > 3) {
                         const name = this.userList.filter(obj => obj.userId === this.$store.getters.userId)[0].userName
@@ -666,6 +678,9 @@ export default {
             }
         },
         initDateOptions (startDateStr, obj) { // 初始化日期下拉数据
+            if (!obj) {
+                return
+            }
             const result = []
             const startDate = new Date(startDateStr)
             // 筛选出以'd'开头且后面跟数字的键组成数组
@@ -869,6 +884,9 @@ export default {
             this.formData.adjustList[index][type] = temp
         },
         handlePartyChange (val, row, index, type) {
+            if (!val) {
+                return
+            }
             this.targetShift = this.scheduleInfo.shiftList.find(i => i.userId === val) // 获取目标人班次
             this.afterDateList = this.initDateOptions(this.scheduleInfo.startDate, this.targetShift) // 转换目标人能选择的日期
             this.formData.adjustList[index]['afterDate'] = '' // 更换目标人时刷新目标日期