保存功能优化

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 = () => {
formModelConfig.value.formSave((data => {
// openConfig.value = false;
openConfig.value = false;
if (data['code'] == 200) {
getData()
} else {

View File

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

View File

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