From f693104d1e41b47d1a1e6597e03b8b096fd3f6e5 Mon Sep 17 00:00:00 2001 From: LHG <553198475@qq.com> Date: Wed, 16 Apr 2025 11:42:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=B9=E7=94=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/operateregion/RegionFeeCofFrom.vue | 380 ++++++------------ 1 file changed, 134 insertions(+), 246 deletions(-) diff --git a/ebike-operate/src/views/form/operateregion/RegionFeeCofFrom.vue b/ebike-operate/src/views/form/operateregion/RegionFeeCofFrom.vue index 31dbc82..2ef7f76 100644 --- a/ebike-operate/src/views/form/operateregion/RegionFeeCofFrom.vue +++ b/ebike-operate/src/views/form/operateregion/RegionFeeCofFrom.vue @@ -372,7 +372,7 @@ const isAdd = ref(true); const warmReminder = ref(""); const field = ref(""); -const form = ref({ +const formData = () => ({ costConfigId: "", regionId: "", chargingMode: "", @@ -394,6 +394,8 @@ const form = ref({ whetherOpenLongRent: "" }); +const form = ref(formData()); + // 表格列配置 const columns = ref([]) @@ -406,6 +408,129 @@ const changeFreeDurationMode = (data) => { } } +const timePeriodColumns = [ + { + title: '阶段', + key: 'phase', + width: 70, + align: 'center', + dataIndex: 'phase' + }, + { + title: '起始时间', + key: 'startupTime', + width: 130, + align: 'center', + dataIndex: 'startupTime', + type: 'time' + }, + { + title: '结束时间', + key: 'endTime', + width: 130, + align: 'center', + dataIndex: 'endTime', + type: 'time' + }, + { + title: '起步费用(元)', + key: 'startupCost', + width: 120, + align: 'center', + dataIndex: 'startupCost', + type: 'input' + }, + { + title: '起步时长(分)', + key: 'startupDuration', + width: 120, + align: 'center', + dataIndex: 'startupDuration', + type: 'input' + }, + { + title: '时长费用(元)', + key: 'durationCost', + width: 120, + align: 'center', + dataIndex: 'durationCost', + type: 'input' + }, + { + title: '时长(分)', + key: 'duration', + width: 100, + align: 'center', + dataIndex: 'duration', + type: 'input' + }, + { + title: '操作', + key: 'action', + width: 80, + align: 'center', + fixed: 'right', + } +] + +const weekColumns = [ + { + title: '名称', + key: 'configName', + width: 100, + align: 'center', + dataIndex: 'configName', + type: 'input' + }, + { + title: '周', + key: 'week', + width: 170, + align: 'center', + dataIndex: 'week', + type: 'select' + }, + { + title: '起步费用(元)', + key: 'startupCost', + width: 50, + align: 'center', + dataIndex: 'startupCost', + type: 'input' + }, + { + title: '起步时长(分)', + key: 'startupDuration', + width: 120, + align: 'center', + dataIndex: 'startupDuration', + type: 'input' + }, + { + title: '时长费用(元)', + key: 'durationCost', + width: 120, + align: 'center', + dataIndex: 'durationCost', + type: 'input' + }, + { + title: '时长(分)', + key: 'duration', + width: 100, + align: 'center', + dataIndex: 'duration', + type: 'input' + }, + { + title: '操作', + key: 'action', + width: 80, + align: 'center', + fixed: 'right', + } +] + const changeTimeDivisionCharging = (data) => { const value = data.target.value; if (value == "2") { @@ -416,70 +541,7 @@ const changeTimeDivisionCharging = (data) => { form.value.ebikeSysRcostsetWeekDtos = []; deteilShow.value = true; warmReminder.value = "温馨提示:当天结束的阶段为23:59:59,没有设置的话,默认配置为上面的字段。"; - columns.value = [ - { - title: '阶段', - key: 'phase', - width: 70, - align: 'center', - dataIndex: 'phase' - }, - { - title: '起始时间', - key: 'startupTime', - width: 130, - align: 'center', - dataIndex: 'startupTime', - type: 'time' - }, - { - title: '结束时间', - key: 'endTime', - width: 130, - align: 'center', - dataIndex: 'endTime', - type: 'time' - }, - { - title: '起步费用(元)', - key: 'startupCost', - width: 120, - align: 'center', - dataIndex: 'startupCost', - type: 'input' - }, - { - title: '起步时长(分)', - key: 'startupDuration', - width: 120, - align: 'center', - dataIndex: 'startupDuration', - type: 'input' - }, - { - title: '时长费用(元)', - key: 'durationCost', - width: 120, - align: 'center', - dataIndex: 'durationCost', - type: 'input' - }, - { - title: '时长(分)', - key: 'duration', - width: 100, - align: 'center', - dataIndex: 'duration', - type: 'input' - }, - { - title: '操作', - key: 'action', - width: 80, - align: 'center', - fixed: 'right', - } - ] + columns.value = timePeriodColumns; } else if (value == "3") { field.value = "ebikeSysRcostsetWeekDtos"; if (form.value['ebikeSysRcostsetWeekDtos'] == null) { @@ -488,63 +550,7 @@ const changeTimeDivisionCharging = (data) => { form.value.ebikeSysRcostsetTimePeriodDtos = []; deteilShow.value = true; warmReminder.value = "温馨提示:周的日期支持多选,比如可以选择周一、周二、周三为1种计费方式,没有选择的按默认选择方式来。"; - columns.value = [ - { - title: '名称', - key: 'configName', - width: 100, - align: 'center', - dataIndex: 'configName', - type: 'input' - }, - { - title: '周', - key: 'week', - width: 170, - align: 'center', - dataIndex: 'week', - type: 'select' - }, - { - title: '起步费用(元)', - key: 'startupCost', - width: 50, - align: 'center', - dataIndex: 'startupCost', - type: 'input' - }, - { - title: '起步时长(分)', - key: 'startupDuration', - width: 120, - align: 'center', - dataIndex: 'startupDuration', - type: 'input' - }, - { - title: '时长费用(元)', - key: 'durationCost', - width: 120, - align: 'center', - dataIndex: 'durationCost', - type: 'input' - }, - { - title: '时长(分)', - key: 'duration', - width: 100, - align: 'center', - dataIndex: 'duration', - type: 'input' - }, - { - title: '操作', - key: 'action', - width: 80, - align: 'center', - fixed: 'right', - } - ] + columns.value = weekColumns; } else { field.value = ""; deteilShow.value = false; @@ -557,6 +563,9 @@ const changeTimeDivisionCharging = (data) => { const openForm = (params = {}) => { deteilShow.value = false; + Object.assign(form.value, formData()); + formRef.value.resetFields(); + isAdd.value = true; if (params['regionId']) { form.value.regionId = params['regionId'] spinning.value = true; @@ -579,136 +588,15 @@ const openForm = (params = {}) => { field.value = "ebikeSysRcostsetTimePeriodDtos"; deteilShow.value = true; warmReminder.value = "温馨提示:当天结束的阶段为23:59:59,没有设置的话,默认配置为上面的字段。"; - columns.value = [ - { - title: '阶段', - key: 'phase', - width: 70, - align: 'center', - dataIndex: 'phase' - }, - { - title: '起始时间', - key: 'startupTime', - width: 130, - align: 'center', - dataIndex: 'startupTime', - type: 'time' - }, - { - title: '结束时间', - key: 'endTime', - width: 130, - align: 'center', - dataIndex: 'endTime', - type: 'time' - }, - { - title: '起步费用(元)', - key: 'startupCost', - width: 120, - align: 'center', - dataIndex: 'startupCost', - type: 'input' - }, - { - title: '起步时长(分)', - key: 'startupDuration', - width: 120, - align: 'center', - dataIndex: 'startupDuration', - type: 'input' - }, - { - title: '时长费用(元)', - key: 'durationCost', - width: 120, - align: 'center', - dataIndex: 'durationCost', - type: 'input' - }, - { - title: '时长(分)', - key: 'duration', - width: 100, - align: 'center', - dataIndex: 'duration', - type: 'input' - }, - { - title: '操作', - key: 'action', - width: 80, - align: 'center', - fixed: 'right', - } - ] + columns.value = timePeriodColumns; } else if (res.data.timeDivisionCharging == '3') { field.value = "ebikeSysRcostsetWeekDtos"; deteilShow.value = true; warmReminder.value = "温馨提示:周的日期支持多选,比如可以选择周一、周二、周三为1种计费方式,没有选择的按默认选择方式来。"; - columns.value = [ - { - title: '名称', - key: 'configName', - width: 100, - align: 'center', - dataIndex: 'configName', - type: 'input' - }, - { - title: '周', - key: 'week', - width: 170, - align: 'center', - dataIndex: 'week', - type: 'select' - }, - { - title: '起步费用(元)', - key: 'startupCost', - width: 120, - align: 'center', - dataIndex: 'startupCost', - type: 'input' - }, - { - title: '起步时长(分)', - key: 'startupDuration', - width: 120, - align: 'center', - dataIndex: 'startupDuration', - type: 'input' - }, - { - title: '时长费用(元)', - key: 'durationCost', - width: 120, - align: 'center', - dataIndex: 'durationCost', - type: 'input' - }, - { - title: '时长(分)', - key: 'duration', - width: 100, - align: 'center', - dataIndex: 'duration', - type: 'input' - }, - { - title: '操作', - key: 'action', - width: 80, - align: 'center', - fixed: 'right', - } - ] + columns.value = weekColumns; } else { field.value = ""; } - } else { - formRef.value.resetFields() } } else { message.error(res.message); @@ -763,6 +651,7 @@ const remove = (val, filed, array) => { const formSave = (callBack) => { formRef.value.validate().then(() => { + debugger; tipContent.value = "保存中..." spinning.value = true; let url = "regionFeeConfigAdds"; @@ -781,7 +670,6 @@ const formSave = (callBack) => { if (callBack) { res.data = param; callBack(res); - formRef.value.resetFields() } }) }).catch(error => {