|
|
@@ -402,6 +402,7 @@ export default {
|
|
|
activeStep: 1,
|
|
|
formData: {
|
|
|
title: '',
|
|
|
+ id: '',
|
|
|
dateRange: [],
|
|
|
config: '',
|
|
|
scheduleStaff: [],
|
|
|
@@ -586,7 +587,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
const response = await getStaffSchedule({ id: this.pageParams.id })
|
|
|
- const { staffScheduleDetailPoList: records, title, endDate, startDate, type, overview, config, status } = response.data
|
|
|
+ const { staffScheduleDetailPoList: records, title, endDate, startDate, type, overview, config, status, id } = response.data
|
|
|
const temp = config ? JSON.parse(config) : {}
|
|
|
this.responseData = response.data
|
|
|
console.log('responseData:', response.data)
|
|
|
@@ -594,6 +595,7 @@ export default {
|
|
|
this.formData = {
|
|
|
title,
|
|
|
status,
|
|
|
+ id,
|
|
|
config: temp.id,
|
|
|
dateRange: [startDate, endDate],
|
|
|
approver: temp.approver || [],
|
|
|
@@ -947,7 +949,7 @@ export default {
|
|
|
},
|
|
|
validateForm () {
|
|
|
const { scheduleRule, approver, status, ...rest } = this.formData
|
|
|
- const result = Object.keys(rest).some(k => this.$utils.isEmpty(rest[k]))
|
|
|
+ const result = Object.keys(rest).some(k => this.$utils.isEmpty(rest[k]) && k !== 'id')
|
|
|
return !result
|
|
|
},
|
|
|
// dealData (data) {
|
|
|
@@ -1022,7 +1024,7 @@ export default {
|
|
|
},
|
|
|
handleSave (type) {
|
|
|
const { staffScheduleDetailPoList, overview } = this.dealData(this.scheduleData) || {}
|
|
|
- const { dateRange, title, config, approver, scheduleType, status, scheduleShift, scheduleStaff, scheduleRule } = this.formData
|
|
|
+ const { dateRange, title, config, approver, scheduleType, status, scheduleShift, scheduleStaff, scheduleRule, id } = this.formData
|
|
|
const { first, second } = this.$store.getters.level || {}
|
|
|
const configData = {
|
|
|
id: config,
|
|
|
@@ -1032,8 +1034,8 @@ export default {
|
|
|
scheduleRule
|
|
|
}
|
|
|
const submitData = {
|
|
|
- id: this.pageParams.id,
|
|
|
- pk: this.pageParams.id,
|
|
|
+ id: this.pageParams.id || id,
|
|
|
+ pk: this.pageParams.id || id,
|
|
|
diDian: second || first,
|
|
|
title,
|
|
|
status: type ? '已发布' : '未发布',
|
|
|
@@ -1046,7 +1048,12 @@ export default {
|
|
|
}
|
|
|
console.log(submitData)
|
|
|
this.loading = true
|
|
|
- saveStaffSchedule(submitData).then(() => {
|
|
|
+ saveStaffSchedule(submitData).then(async (res) => {
|
|
|
+ if (res.variables.id) {
|
|
|
+ this.formData.id = res.variables.id
|
|
|
+ const response = await getStaffSchedule({ id: this.formData.id })
|
|
|
+ this.responseData = response.data
|
|
|
+ }
|
|
|
// 增加一条调班申请记录,用于查看排班管理员修改历史。
|
|
|
this.submitAdjust(submitData).then(() => {
|
|
|
if (type) { // 提交
|