Procházet zdrojové kódy

修复详情查看班次显示编码的bug

zhonghuizhen před 1 rokem
rodič
revize
f09c21dac9

+ 3 - 1
src/views/business/​scheduleManage/adjust.vue

@@ -37,6 +37,7 @@ import { queryAdjustment, removeAdjustment, saveAdjustment } from '@/api/busines
 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: {
@@ -200,7 +201,8 @@ export default {
         async handleEdit (key, { id, scheduleId }) {
             this.params = {
                 id,
-                scheduleId
+                scheduleId,
+                action: key === 'detail' ? 'view' : 'edit'
             }
             this.readonly = key === 'detail'
             this.showAdjustEdit = true

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

@@ -257,7 +257,8 @@ export default {
         async handleEdit (key, { id, scheduleId }) {
             this.params = {
                 id,
-                scheduleId
+                scheduleId,
+                action: key === 'detail' ? 'view' : 'edit'
             }
             this.readonly = key === 'detail'
             this.showAdjustEdit = true

+ 32 - 22
src/views/business/​scheduleManage/components/adjust-edit.vue

@@ -212,6 +212,7 @@
 // import {  } from '@/views/constants/schedule'
 import { getAdjustment, saveAdjustment, queryStaffSchedule, getStaffSchedule, sendMessage } from '@/api/business/schedule'
 import { queryDataById } from '@/api/platform/data/dataTemplate'
+import { param } from 'jquery';
 
 export default {
     props: {
@@ -268,12 +269,13 @@ export default {
         }
     },
     computed: {
+        /*
         beforeShiftList () {
             return []
         },
         afterShiftList () {
             return []
-        }
+        }*/
     },
     watch: {
         visible: {
@@ -282,8 +284,8 @@ export default {
             }
         }
     },
-    mounted () {
-        this.loadData(this)
+    async mounted () {
+        await this.loadData(this)
     },
     methods: {
         // 获取数据
@@ -312,6 +314,7 @@ export default {
                         afterShiftList: self.handleDateInit(i.afterDate, index, 'afterShiftList', i.party, i.afterAdjust)
                     }))
                 }
+                console.log('formData', self.formData)
             }
             self.loading = true
             try {
@@ -396,14 +399,16 @@ export default {
                 if (self.formData.adjustList.length < 1) { // 编辑新增状态初始化
                     self.formData.adjustList = []
                 }
-                self.getBlockAdjustRequest(self).then(() => { // 获取被锁定的班次
-                    self.beforeDateList = self.initDateOptions(schedule.startDate, self.currentShift)
-                    const filterid = self.$store.getters.userId || ''
-                    if (self.beforeDateList.length > 0 && Object.keys(self.blockList).length > 0) {
-                        // 过滤当前自己被占用的日期和班次
-                        self.beforeDateList = self.filterBlockList(self.blockList, self.beforeDateList, filterid)
-                    }
-                })
+                if (this.params.action !== 'view') {
+                    self.getBlockAdjustRequest(self).then(() => { // 获取被锁定的班次
+                        self.beforeDateList = self.initDateOptions(schedule.startDate, self.currentShift)
+                        const filterid = self.$store.getters.userId || ''
+                        if (self.beforeDateList.length > 0 && Object.keys(self.blockList).length > 0) {
+                            // 过滤当前自己被占用的日期和班次
+                            self.beforeDateList = self.filterBlockList(self.blockList, self.beforeDateList, filterid)
+                        }
+                    })
+                }
             })
 
             // this.scheduleList.find(i => i.id === val)
@@ -530,17 +535,22 @@ export default {
                 this.formData.adjustList[index][shiftMap[type]] = Adjust ? Adjust.split(',') : []
             }
             const { scheduleShift } = this.scheduleInfo
-            // 获取所选日期对应数据
-            let selectObj = this.beforeDateList.filter(item => item.value === val) // 调班人自己的数据
-            if (type === 'afterShiftList') {
-                this.handlePartyChange(userid, this.formData.adjustList[index], index, 'init')
-                selectObj = this.afterDateList.filter(item => item.value === val) // 目标人员数据
+            if (this.params.action === 'view') { // 详情状态初始化beforeShiftList,afterShiftList,不用过滤数据
+                this.formData.adjustList[index][type] = scheduleShift
+                return this.formData.adjustList[index][type]
+            } else { // 编辑状态初始化beforeShiftList,afterShiftList
+                // 获取所选日期对应数据
+                let selectObj = this.beforeDateList.filter(item => item.value === val) // 调班人自己的数据
+                if (type === 'afterShiftList') {
+                    this.handlePartyChange(userid, this.formData.adjustList[index], index, 'init')
+                    selectObj = this.afterDateList.filter(item => item.value === val) // 目标人员数据
+                }
+                const shifts = selectObj[0]?.banci?.split(',') || []
+                const temp = scheduleShift.filter(i => shifts.includes(i.alias))
+                this.formData.adjustList[index].recordId = this.currentShift.id
+                this.formData.adjustList[index][type] = temp
+                return temp
             }
-            const shifts = selectObj[0]?.banci?.split(',') || []
-            const temp = scheduleShift.filter(i => shifts.includes(i.alias))
-            this.formData.adjustList[index].recordId = this.currentShift.id
-            this.formData.adjustList[index][type] = temp
-            return temp
         },
         handleDateChange (val, index, type) {
             console.log(val, index, type)
@@ -572,7 +582,7 @@ export default {
             this.afterDateList = this.initDateOptions(this.scheduleInfo.startDate, this.targetShift) // 转换目标人能选择的日期
             this.formData.adjustList[index]['afterDate'] = '' // 更换目标人时刷新目标日期
             const filterid = val || ''
-            if (this.afterDateList.length > 0 && Object.keys(this.blockList).length > 0) {
+            if (this.afterDateList.length > 0 && Object.keys(this.blockList).length > 0 && this.params.action !== 'view') {
                 // 过滤当前目标人被占用的日期和班次
                 this.afterDateList = this.filterBlockList(this.blockList, this.afterDateList, filterid)
             }

+ 1 - 0
src/views/business/​scheduleManage/edit.vue

@@ -667,6 +667,7 @@ export default {
         },
         changeView () {
             console.log('changeView')
+            debugger
         },
         handleShiftClick (event, { row, rIndex, column, cIndex }) {
             this.selectItem = []