|
|
@ -74,6 +74,22 @@ export default { |
|
|
|
key: "controlType", |
|
|
|
type: "RadioGroup", |
|
|
|
default: "manual", |
|
|
|
ons: { |
|
|
|
input: (value, data) => { |
|
|
|
const oldFormData = this.oldFormData; |
|
|
|
if (!oldFormData) return; |
|
|
|
|
|
|
|
switch (value) { |
|
|
|
case "manual": |
|
|
|
data.onWorkStatus = oldFormData.onWorkStatus; |
|
|
|
data.inWorkStatus = oldFormData.inWorkStatus; |
|
|
|
break; |
|
|
|
case "automatic": |
|
|
|
Array.isArray(oldFormData.displayTime) && (data.displayTime = [...oldFormData.displayTime]); |
|
|
|
break; |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
options: { |
|
|
|
type: 'circle', |
|
|
|
options: [ |
|
|
@ -174,32 +190,33 @@ export default { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
this.oldFormData = cloneDeep(formData); |
|
|
|
this.oldFormData = { ...formData }; |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
handleSubmit() { |
|
|
|
const result = cloneDeep(this.$refs.FormConfigRef?.formData); |
|
|
|
const result = {}, formData = this.$refs.FormConfigRef?.formData; |
|
|
|
|
|
|
|
let functionId = 51; |
|
|
|
|
|
|
|
result.mode = result.controlType === 'manual' ? "00" : "01"; |
|
|
|
result.mode = formData.controlType === 'manual' ? "00" : "01"; |
|
|
|
|
|
|
|
delete result.controlType; |
|
|
|
|
|
|
|
if (result.mode === '01') { |
|
|
|
if (!result.displayTime?.length) return Message.error(`时间不能为空!`); |
|
|
|
result.startDisplayTime = result.displayTime[0]; |
|
|
|
result.endDisplayTime = result.displayTime[1]; |
|
|
|
if (!formData.displayTime?.length) return Message.error(`时间不能为空!`); |
|
|
|
result.startDisplayTime = formData.displayTime[0]; |
|
|
|
result.endDisplayTime = formData.displayTime[1]; |
|
|
|
delete result.displayTime; |
|
|
|
} else { |
|
|
|
if (!result.onWorkStatus || !result.inWorkStatus) return Message.error(`工作状态不能为空!`) |
|
|
|
if (!formData.onWorkStatus || !formData.inWorkStatus) return Message.error(`工作状态不能为空!`); |
|
|
|
|
|
|
|
result.onWorkStatus = formData.onWorkStatus |
|
|
|
result.inWorkStatus = formData.inWorkStatus |
|
|
|
} |
|
|
|
|
|
|
|
this.submitting = true; |
|
|
|
|
|
|
|
console.log(result); |
|
|
|
|
|
|
|
// this.submitting = false; |
|
|
|
// return; |
|
|
|
|
|
|
@ -220,9 +237,7 @@ export default { |
|
|
|
}) |
|
|
|
.finally(() => { |
|
|
|
this.submitting = false; |
|
|
|
console.log(this.submitting) |
|
|
|
}) |
|
|
|
console.log(result) |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|