保存功能优化

This commit is contained in:
dzl 2025-04-29 17:42:46 +08:00
parent b6b8b8eb2f
commit 05704c9363
3 changed files with 15 additions and 9 deletions

View File

@ -461,7 +461,7 @@ const regionConfigInfo = (record) => {
*/ */
const handleOkConfgModal = () => { const handleOkConfgModal = () => {
formModelConfig.value.formSave((data => { formModelConfig.value.formSave((data => {
// openConfig.value = false; openConfig.value = false;
if (data['code'] == 200) { if (data['code'] == 200) {
getData() getData()
} else { } else {

View File

@ -95,7 +95,6 @@ const formSave = (onCallBack) => {
}).catch((e) => { }).catch((e) => {
return Promise.reject(e); return Promise.reject(e);
}); });
} }
}); });
// 使 Promise.all // 使 Promise.all
@ -106,13 +105,10 @@ const formSave = (onCallBack) => {
if (!isAdd.value) { if (!isAdd.value) {
url = "update" url = "update"
} }
isAdd.value = false;
callOperate("/ebikeSysRoperateset/" + url, params).then(res => { callOperate("/ebikeSysRoperateset/" + url, params).then(res => {
spinning.value = false; spinning.value = false;
if (res.code == 200) { if (res.code == 200) {
//
forms.map(form => {
form.value.resetFormValue()
})
if (onCallBack) { if (onCallBack) {
res.data = params; res.data = params;
onCallBack(res); onCallBack(res);

View File

@ -405,7 +405,7 @@ const field = ref("");
const saveFlag = ref(true); const saveFlag = ref(true);
const openTimeTip = ref(false) const openTimeTip = ref(false)
const openWeekTip = ref(false) const openWeekTip = ref(false)
const costConfigId = ref("");
const formData = () => ({ const formData = () => ({
costConfigId: "", costConfigId: "",
@ -413,7 +413,7 @@ const formData = () => ({
chargingMode: "", chargingMode: "",
freeDurationMode: "1", freeDurationMode: "1",
freeDuration: "免费时长(分钟)", freeDuration: "免费时长(分钟)",
timeDivisionCharging: "1", timeDivisionCharging: "",
ebikeSysRcostsetTimePeriodDtos: [], ebikeSysRcostsetTimePeriodDtos: [],
ebikeSysRcostsetWeekDtos: [], ebikeSysRcostsetWeekDtos: [],
startupCost: "", startupCost: "",
@ -598,7 +598,7 @@ const openForm = (params = {}) => {
+ params['regionId'], {}, "get").then(res => { + params['regionId'], {}, "get").then(res => {
spinning.value = false; spinning.value = false;
if (res.code == 200) { if (res.code == 200) {
if (res.data) { if (res.data.costConfigId) {
isAdd.value = false; isAdd.value = false;
form.value = res.data; form.value = res.data;
if (res.data.timeDivisionCharging == '2') { if (res.data.timeDivisionCharging == '2') {
@ -622,6 +622,12 @@ const openForm = (params = {}) => {
} else { } else {
field.value = ""; field.value = "";
} }
} else {
callOperate("/ebikesysrcostset/createSnowflakeId", {}, "get").then(res => {
if (res.code == 200) {
costConfigId.value = res.data;
}
})
} }
} else { } else {
message.error(res.message); message.error(res.message);
@ -746,7 +752,11 @@ const formSave = (callBack) => {
if (!isAdd.value) { if (!isAdd.value) {
url = "updateRegionFeeConfig" url = "updateRegionFeeConfig"
} }
isAdd.value = false;
const param = _.cloneDeep(form.value) const param = _.cloneDeep(form.value)
if (!param['costConfigId'] && costConfigId.value) {
param['costConfigId'] = costConfigId.value;
}
if (param['ebikeSysRcostsetTimePeriodDtos'] && param['ebikeSysRcostsetTimePeriodDtos'].length > 0) { if (param['ebikeSysRcostsetTimePeriodDtos'] && param['ebikeSysRcostsetTimePeriodDtos'].length > 0) {
param['ebikeSysRcostsetTimePeriodDtos'].forEach(item => { param['ebikeSysRcostsetTimePeriodDtos'].forEach(item => {
item['startupTime'] = item['startupTime'].format('HH:mm:ss'); item['startupTime'] = item['startupTime'].format('HH:mm:ss');