commit
This commit is contained in:
+20
-3
@@ -654,6 +654,21 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
return []
|
||||
},
|
||||
normalizeAllowDay(allowDay) {
|
||||
// 兼容后端返回数组或 JSON 字符串,保持多选天数字段始终使用数组回显。
|
||||
if (Array.isArray(allowDay)) {
|
||||
return allowDay
|
||||
}
|
||||
if (typeof allowDay === 'string' && allowDay) {
|
||||
try {
|
||||
const parsed = JSON.parse(allowDay)
|
||||
return Array.isArray(parsed) ? parsed : []
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
return []
|
||||
},
|
||||
async doSearch() {
|
||||
this.formData.year = this.pageForm.year;
|
||||
await this.yearChange();
|
||||
@@ -723,6 +738,7 @@ layout("/layouts/platform.html"){
|
||||
const data = resp.data
|
||||
data.year = data.year.toString()
|
||||
data.weekCheckIn = this.normalizeWeekCheckIn(data.weekCheckIn)
|
||||
data.allowDay = this.normalizeAllowDay(data.allowDay)
|
||||
this.$set(this, 'formData', {...data})
|
||||
await this.selectTravelAgencyList()
|
||||
await this.getModifyBd(data.year)
|
||||
@@ -766,9 +782,10 @@ layout("/layouts/platform.html"){
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
this.formData.weekCheckIn = JSON.stringify(this.formData.weekCheckIn)
|
||||
this.formData.allowDay = JSON.stringify(this.formData.allowDay)
|
||||
const resp = await $.post(loc() + '/doSubmit', this.formData)
|
||||
const postData = {...this.formData}
|
||||
postData.weekCheckIn = JSON.stringify(this.normalizeWeekCheckIn(this.formData.weekCheckIn))
|
||||
postData.allowDay = JSON.stringify(this.normalizeAllowDay(this.formData.allowDay))
|
||||
const resp = await $.post(loc() + '/doSubmit', postData)
|
||||
loading.close()
|
||||
if (resp.code === 0) {
|
||||
this.$refs.guava.index()
|
||||
|
||||
Reference in New Issue
Block a user