修复更新用餐时间配置页面bug

This commit is contained in:
czx 2020-12-31 14:55:13 +08:00
parent 6cb636ca40
commit f006cb9fba

View File

@ -14,9 +14,8 @@
<el-form-item label="早餐时间段">
<el-time-picker
is-range
ref="breakfastPick"
v-model="dinnerForm.breakfast"
value-format="HH:mm"
@change="changeBreakfast"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
@ -31,8 +30,6 @@
<el-time-picker
is-range
v-model="dinnerForm.lunch"
value-format="HH:mm"
@change="changeLunch"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
@ -47,8 +44,6 @@
<el-time-picker
is-range
v-model="dinnerForm.dinner"
value-format="HH:mm"
@change="changeDinner"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
@ -88,35 +83,18 @@ export default {
id: null,
},
dinnerForm: {
breakfast: [],
breakfast: [new Date('2016-9-10 8:41'), new Date(2016, 9, 10, 9, 40)],
lunch: [],
dinner: [],
id: 7,
},
};
},
created() {
this.getList();
},
methods: {
changeBreakfast(e) {
if (e != null) {
this.timeArr[0] = e[0];
this.timeArr[1] = e[1];
}
},
changeLunch(e) {
if (e != null) {
this.timeArr[2] = e[0];
this.timeArr[3] = e[1];
}
},
changeDinner(e) {
if (e != null) {
this.timeArr[4] = e[0];
this.timeArr[5] = e[1];
}
},
/** 查询饭堂参数列表 */
getList() {
this.loading = true;
@ -126,12 +104,9 @@ export default {
console.log("数据库获取--------", response.rows[6].configValue.split(','))
this.timeArr = response.rows[6].configValue.split(',')
this.dinnerForm.breakfast[0] = new Date(2016, 9, 1, this.timeArr[0].split(':')[0], this.timeArr[0].split(':')[1])
this.dinnerForm.breakfast[1] = new Date(2016, 9, 1, this.timeArr[1].split(':')[0], this.timeArr[1].split(':')[1])
this.dinnerForm.lunch[0] = new Date(2016, 9, 1, this.timeArr[2].split(':')[0], this.timeArr[2].split(':')[1])
this.dinnerForm.lunch[1] = new Date(2016, 9, 1, this.timeArr[3].split(':')[0], this.timeArr[3].split(':')[1])
this.dinnerForm.dinner[0] = new Date(2016, 9, 1, this.timeArr[4].split(':')[0], this.timeArr[4].split(':')[1])
this.dinnerForm.dinner[1] = new Date(2016, 9, 1, this.timeArr[5].split(':')[0], this.timeArr[5].split(':')[1])
this.dinnerForm.breakfast = [new Date(2016, 9, 1, this.timeArr[0].split(':')[0], this.timeArr[0].split(':')[1]), new Date(2016, 9, 1, this.timeArr[1].split(':')[0], this.timeArr[1].split(':')[1])];
this.dinnerForm.lunch = [new Date(2016, 9, 1, this.timeArr[2].split(':')[0], this.timeArr[2].split(':')[1]), new Date(2016, 9, 1, this.timeArr[3].split(':')[0], this.timeArr[3].split(':')[1])];
this.dinnerForm.dinner = [new Date(2016, 9, 1, this.timeArr[4].split(':')[0], this.timeArr[4].split(':')[1]), new Date(2016, 9, 1, this.timeArr[5].split(':')[0], this.timeArr[5].split(':')[1])];
});
},
//