|
@ -11,7 +11,7 @@ |
|
|
<a-tabs> |
|
|
<a-tabs> |
|
|
<a-tab-pane key="1" tab="更新状态"> |
|
|
<a-tab-pane key="1" tab="更新状态"> |
|
|
<div style="width: 100%; padding: 24px"> |
|
|
<div style="width: 100%; padding: 24px"> |
|
|
<a-form ref="formRef" :model="infoObject"> |
|
|
<a-form ref="formRef" :model="infoObject" :rules="rules"> |
|
|
<a-form-item ref="state" label="当前状态" name="state"> |
|
|
<a-form-item ref="state" label="当前状态" name="state"> |
|
|
<a-select |
|
|
<a-select |
|
|
v-model:value="infoObject.state" |
|
|
v-model:value="infoObject.state" |
|
@ -67,31 +67,53 @@ |
|
|
const energyAlarm = ref({}); |
|
|
const energyAlarm = ref({}); |
|
|
const stateOptions = ref(); |
|
|
const stateOptions = ref(); |
|
|
const logList = ref([]); |
|
|
const logList = ref([]); |
|
|
|
|
|
const formRef = ref(); |
|
|
const config = ref({ |
|
|
const config = ref({ |
|
|
size: logList.value.length, |
|
|
size: logList.value.length, |
|
|
dataSource: logList.value, |
|
|
dataSource: logList.value, |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 表单校验 |
|
|
|
|
|
const rules = { |
|
|
|
|
|
remarks: [ |
|
|
|
|
|
{ |
|
|
|
|
|
required: true, |
|
|
|
|
|
message: '请输入备注', |
|
|
|
|
|
trigger: 'change', |
|
|
|
|
|
validator: (rules, remarks, cbfn) => { |
|
|
|
|
|
if (remarks && remarks.trim() !== '') { |
|
|
|
|
|
cbfn(); |
|
|
|
|
|
} else { |
|
|
|
|
|
cbfn('备注不能为空'); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
|
|
|
state: [{ required: true, message: '请选择当前状态', trigger: 'change' }], |
|
|
|
|
|
}; |
|
|
const handleClose = () => { |
|
|
const handleClose = () => { |
|
|
showEdit.value = true; |
|
|
showEdit.value = true; |
|
|
energyAlarm.value = {}; |
|
|
energyAlarm.value = {}; |
|
|
infoObject.value = {}; |
|
|
infoObject.value = {}; |
|
|
visible.value = false; |
|
|
visible.value = false; |
|
|
|
|
|
config.value.dataSource = []; |
|
|
}; |
|
|
}; |
|
|
const btnClick = () => { |
|
|
const btnClick = () => { |
|
|
delete infoObject.value.createTime; |
|
|
formRef.value.validate().then(() => { |
|
|
infoObject.value.alarmEnergyConsumptionLogId = energyAlarm.value.id; |
|
|
delete infoObject.value.createTime; |
|
|
if (energyAlarm.value.createWorkOrder === 0) { |
|
|
infoObject.value.alarmEnergyConsumptionLogId = energyAlarm.value.id; |
|
|
http.post(energyAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => { |
|
|
if (energyAlarm.value.createWorkOrder === 0) { |
|
|
if (res.msg === 'success') { |
|
|
http.post(energyAlarmApi.noCreatOrUpdateLog, infoObject.value).then((res) => { |
|
|
NsMessage.success('操作成功'); |
|
|
if (res.msg === 'success') { |
|
|
showEdit.value = true; |
|
|
NsMessage.success('操作成功'); |
|
|
energyAlarm.value = {}; |
|
|
showEdit.value = true; |
|
|
infoObject.value = {}; |
|
|
energyAlarm.value = {}; |
|
|
visible.value = false; |
|
|
infoObject.value = {}; |
|
|
emit('logAdd', null); |
|
|
visible.value = false; |
|
|
} |
|
|
emit('logAdd', null); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
//修改状态 |
|
|
//修改状态 |
|
|
const changeShowEdit = () => { |
|
|
const changeShowEdit = () => { |
|
@ -119,7 +141,6 @@ |
|
|
{ value: 5, label: '已关闭' }, |
|
|
{ value: 5, label: '已关闭' }, |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
console.log(data, 'data'); |
|
|
|
|
|
await http |
|
|
await http |
|
|
.post(energyAlarmApi.getSelectAlarmEnergyConsumptionLogStatusProcess, { |
|
|
.post(energyAlarmApi.getSelectAlarmEnergyConsumptionLogStatusProcess, { |
|
|
alarmEnergyConsumptionLogId: data.id, |
|
|
alarmEnergyConsumptionLogId: data.id, |
|
@ -149,6 +170,8 @@ |
|
|
infoObject, |
|
|
infoObject, |
|
|
changeShowEdit, |
|
|
changeShowEdit, |
|
|
showEdit, |
|
|
showEdit, |
|
|
|
|
|
rules, |
|
|
|
|
|
formRef, |
|
|
energyAlarm, |
|
|
energyAlarm, |
|
|
stateOptions, |
|
|
stateOptions, |
|
|
btnClick, |
|
|
btnClick, |
|
|