|
|
@@ -416,7 +416,7 @@ export default {
|
|
|
// 添加值班客服
|
|
|
addCustomer() {
|
|
|
this.formData.dutyCustomerDTOS.push({
|
|
|
- customerId: null,
|
|
|
+ dutyCustomerId: null,
|
|
|
dutyDateTimeList: [{
|
|
|
startTime: new Date().setHours(8, 30, 0),
|
|
|
endTime: new Date().setHours(18, 30, 0)
|
|
|
@@ -455,10 +455,10 @@ export default {
|
|
|
this.$message({type: 'info', message: '已取消操作'});
|
|
|
},
|
|
|
dutyConfigData() {
|
|
|
- this.formData.dutyCustomerDTOS.forEach(x => {
|
|
|
+ this.formData.dutyCustomerDTOS.map(x => {
|
|
|
x.dutyDateTimeList = x.dutyDateTimeList.map(item => ({
|
|
|
- startTime: dayjs(item.startTime).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- endTime: dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ startTime: item.startTime ? dayjs(item.startTime).format('YYYY-MM-DD HH:mm:ss') : null,
|
|
|
+ endTime: item.endTime ? dayjs(item.endTime).format('YYYY-MM-DD HH:mm:ss') : null,
|
|
|
}))
|
|
|
})
|
|
|
return {
|
|
|
@@ -469,7 +469,9 @@ export default {
|
|
|
// 确认操作
|
|
|
handleConfirm() {
|
|
|
// 数据校验
|
|
|
- if (!this.validateTime()) return;
|
|
|
+ if (!this.validateTime()) {
|
|
|
+ return
|
|
|
+ }
|
|
|
// 提交逻辑(示例)
|
|
|
this.$api.customerManage.dutyConfig(this.dutyConfigData())
|
|
|
.then((res) => {
|
|
|
@@ -488,23 +490,27 @@ export default {
|
|
|
|
|
|
// 时间有效性校验
|
|
|
validateTime() {
|
|
|
- this.formData.dutyCustomerDTOS.forEach(x => {
|
|
|
- x.dutyDateTimeList.forEach(item => {
|
|
|
- if (item.startTime === null) {
|
|
|
+ for (let dutyCustomerDTO of this.formData.dutyCustomerDTOS) {
|
|
|
+ console.log(dutyCustomerDTO);
|
|
|
+ if (dutyCustomerDTO.dutyCustomerId === null || dutyCustomerDTO.dutyCustomerId === '') {
|
|
|
+ this.$message.error('值班客服必填');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (let dutyCustomerDTOKey of dutyCustomerDTO.dutyDateTimeList) {
|
|
|
+ if (dutyCustomerDTOKey.startTime === null) {
|
|
|
this.$message.error('开始时间必填');
|
|
|
return false;
|
|
|
}
|
|
|
- if (item.endTime === null) {
|
|
|
+ if (dutyCustomerDTOKey.endTime === null) {
|
|
|
this.$message.error('结束时间必填');
|
|
|
return false;
|
|
|
}
|
|
|
- if (new Date(item.startTime) >= new Date(item.endTime)) {
|
|
|
+ if (new Date(dutyCustomerDTOKey.startTime) >= new Date(dutyCustomerDTOKey.endTime)) {
|
|
|
this.$message.error('结束时间必须晚于开始时间');
|
|
|
return false;
|
|
|
}
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
+ }
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
},
|