Browse Source

调班申请状态变更请求换通用接口

zhonghuizhen 1 năm trước cách đây
mục cha
commit
9740c6be37

+ 34 - 0
src/views/business/​scheduleManage/adjust.vue

@@ -212,10 +212,44 @@ export default {
          */
         async handleCancel (data) {
             data.status = '已取消'
+            // 改为通用接口
+            const tableName = 't_adjustment'
+            const updateParams = {
+                tableName,
+                updList: [
+                    {
+                        where: {
+                            id_: data.id
+                        },
+                        param: {
+                            status: data.status
+                        }
+                    }]
+            }
+            this.$common.request('update', updateParams).then(async () => {
+                const sonTableName = 't_adjustment_detail'
+                const sonUpdateParams = {
+                    tableName: sonTableName,
+                    updList: [
+                        {
+                            where: {
+                                parent_id_: data.id
+                            },
+                            param: {
+                                status_: data.status
+                            }
+                        }]
+                }
+                await this.$common.request('update', sonUpdateParams) // 更新子表
+                ActionUtils.successMessage()
+                this.search()
+            }).catch((e) => { console.error(e) })
+            /*
             saveAdjustment(data).then(() => {
                 ActionUtils.successMessage()
                 this.search()
             }).catch((e) => { console.error(e) })
+            */
         },
         /**
          * 处理删除

+ 57 - 4
src/views/business/​scheduleManage/adjustVerify.vue

@@ -326,7 +326,45 @@ export default {
         async handleAgree (key, data) {
             // console.log(data)
             data.status = (key === 'agree' ? this.isNextStep(data) : '已拒绝')
-            this.handleAccess(data)
+            // 改为通用接口
+            const tableName = 't_adjustment'
+            const updateParams = {
+                tableName,
+                updList: [
+                    {
+                        where: {
+                            id_: data.id
+                        },
+                        param: {
+                            status: data.status
+                        }
+                    }]
+            }
+            this.$common.request('update', updateParams).then(async () => {
+                const sonTableName = 't_adjustment_detail'
+                const sonUpdateParams = {
+                    tableName: sonTableName,
+                    updList: [
+                        {
+                            where: {
+                                parent_id_: data.id
+                            },
+                            param: {
+                                status_: data.status
+                            }
+                        }]
+                }
+                await this.$common.request('update', sonUpdateParams) // 更新调班子表
+                ActionUtils.successMessage()
+                if (data.status === '已通过') {
+                    // 获取排班子表数据
+                    const response = await getAdjustment({ id: data.id })
+                    this.handleAccess(response.data)
+                }
+                this.sendMsg(data) // 发送系统通知
+                this.search()
+            }).catch((e) => { console.error(e) })
+            /*
             saveAdjustment(data).then(() => {
                 ActionUtils.successMessage()
                 if (data.status === '已通过') {
@@ -334,7 +372,7 @@ export default {
                 }
                 this.sendMsg(data) // 发送系统通知
                 this.search()
-            }).catch((e) => { console.error(e) })
+            }).catch((e) => { console.error(e) })*/
         },
         /**
          * 批量处理同意/不同意
@@ -347,6 +385,7 @@ export default {
             }
             const tableName = 't_adjustment'
             let uparr = []
+            let sonuparr = []
             data.forEach((el) => {
                 el.status = key === 'massAgree' ? this.isNextStep(el) : '已拒绝'
                 uparr.push({
@@ -357,16 +396,30 @@ export default {
                         status: el.status
                     }
                 })
+                sonuparr.push({
+                    where: {
+                        parent_id_: el.id
+                    },
+                    param: {
+                        status_: el.status
+                    }
+                })
             })
             const updateParams = {
                 tableName,
                 updList: uparr
             }
-            this.$common.request('update', updateParams).then(() => {
+            this.$common.request('update', updateParams).then(async () => {
+                const sonTableName = 't_adjustment_detail'
+                const sonUpdateParams = {
+                    tableName: sonTableName,
+                    updList: sonuparr
+                }
+                await this.$common.request('update', sonUpdateParams) // 更新调班子表
                 ActionUtils.successMessage()
                 data.forEach(async (el) => { // 给每个申请单发通知
                     if (el.status === '已通过') {
-                        // 获取子表数据
+                        // 获取排班子表数据
                         const response = await getAdjustment({ id: el.id })
                         this.handleAccess(response.data)
                     }

+ 0 - 2
src/views/business/​scheduleManage/components/adjust-edit.vue

@@ -458,7 +458,6 @@ export default {
             filterBList.forEach((el) => {
                 const index = this.getDays(startDate, el.value)
                 if (dateList[index].value === el.value) {
-                    debugger
                     const arr1 = dateList[index].banci.split(',')
                     const arr2 = el.banci.split(',')
                     const result = arr2.some(item => arr1.includes(item))
@@ -794,7 +793,6 @@ export default {
             }
         },
         delFilterList (adjustList) { // 把删除的行从班次日期锁定删除
-            debugger
             const blockGrouped = this.getBlockResult(adjustList, 'adjustList') // 数据分组
             // 加入锁定数据
             for (const key in blockGrouped) {