commit
This commit is contained in:
+22
-3
@@ -555,6 +555,7 @@ layout("/layouts/platform.html"){
|
||||
baseContactPerson: '',
|
||||
baseContactNumber: '',
|
||||
weekIn: 1,
|
||||
weekCheckIn: [],
|
||||
allowDay: [],
|
||||
maxSignCount: 0,
|
||||
travelAgencyPlace: '',
|
||||
@@ -638,6 +639,21 @@ layout("/layouts/platform.html"){
|
||||
this.formData.weekCheckIn = lot ? lot.weekCheckIn : []
|
||||
}*/
|
||||
},
|
||||
normalizeWeekCheckIn(weekCheckIn) {
|
||||
// 兼容后端返回数组或 JSON 字符串,避免 "[]" 被当成有值导致“不限”不回显。
|
||||
if (Array.isArray(weekCheckIn)) {
|
||||
return weekCheckIn
|
||||
}
|
||||
if (typeof weekCheckIn === 'string' && weekCheckIn) {
|
||||
try {
|
||||
const parsed = JSON.parse(weekCheckIn)
|
||||
return Array.isArray(parsed) ? parsed : []
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
return []
|
||||
},
|
||||
async doSearch() {
|
||||
this.formData.year = this.pageForm.year;
|
||||
await this.yearChange();
|
||||
@@ -692,7 +708,9 @@ layout("/layouts/platform.html"){
|
||||
if (this.$refs['form']) {
|
||||
this.$refs['form'].resetFields()
|
||||
}
|
||||
this.formData.id = null
|
||||
this.$set(this.formData, 'id', null)
|
||||
this.$set(this.formData, 'weekIn', 1)
|
||||
this.$set(this.formData, 'weekCheckIn', [])
|
||||
this.initLineContentEditor()
|
||||
})
|
||||
await this.getNumber()
|
||||
@@ -704,10 +722,11 @@ layout("/layouts/platform.html"){
|
||||
await this.$nextTick()
|
||||
const data = resp.data
|
||||
data.year = data.year.toString()
|
||||
this.formData = {...data}
|
||||
data.weekCheckIn = this.normalizeWeekCheckIn(data.weekCheckIn)
|
||||
this.$set(this, 'formData', {...data})
|
||||
await this.selectTravelAgencyList()
|
||||
await this.getModifyBd(data.year)
|
||||
this.formData.weekIn = this.formData.weekCheckIn && this.formData.weekCheckIn.length > 0 ? 2 : 1
|
||||
this.$set(this.formData, 'weekIn', this.formData.weekCheckIn.length > 0 ? 2 : 1)
|
||||
this.initLineContentEditor(data.content)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
|
||||
Reference in New Issue
Block a user