From 69afb41df526da180aa3727367583608eb9055ca Mon Sep 17 00:00:00 2001 From: kkfluous Date: Mon, 16 Mar 2026 01:22:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(energy):=20=E5=AE=9E=E7=8E=B0=E5=8A=A0?= =?UTF-8?q?=E6=B0=A2=E7=AB=99=E9=85=8D=E7=BD=AE=E5=92=8C=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- .../src/views/energy/station-config/data.ts | 147 +++++++++++++++ .../src/views/energy/station-config/index.vue | 133 +++++++++++++ .../station-config/modules/form-modal.vue | 95 ++++++++++ .../src/views/energy/station-price/data.ts | 178 ++++++++++++++++++ .../src/views/energy/station-price/index.vue | 155 +++++++++++++++ .../station-price/modules/form-modal.vue | 85 +++++++++ 6 files changed, 793 insertions(+) create mode 100644 apps/web-antd/src/views/energy/station-config/data.ts create mode 100644 apps/web-antd/src/views/energy/station-config/index.vue create mode 100644 apps/web-antd/src/views/energy/station-config/modules/form-modal.vue create mode 100644 apps/web-antd/src/views/energy/station-price/data.ts create mode 100644 apps/web-antd/src/views/energy/station-price/index.vue create mode 100644 apps/web-antd/src/views/energy/station-price/modules/form-modal.vue diff --git a/apps/web-antd/src/views/energy/station-config/data.ts b/apps/web-antd/src/views/energy/station-config/data.ts new file mode 100644 index 0000000..33e8f20 --- /dev/null +++ b/apps/web-antd/src/views/energy/station-config/data.ts @@ -0,0 +1,147 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { EnergyStationConfigApi } from '#/api/energy/station-config'; + +import { useActionColumn } from '#/utils/table'; + +export const DEDUCT_MODE_OPTIONS = [ + { label: '审核即扣款', value: true }, + { label: '出账单后扣款', value: false }, +]; + +export const AUTO_MATCH_OPTIONS = [ + { label: '开启', value: true }, + { label: '关闭', value: false }, +]; + +export const COOPERATION_TYPE_OPTIONS = [ + { label: '预充值', value: 1 }, + { label: '月结算', value: 2 }, +]; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'stationId', + label: '加氢站', + component: 'InputNumber', + componentProps: { + placeholder: '请输入加氢站ID', + style: { width: '100%' }, + }, + rules: 'required', + }, + { + fieldName: 'cooperationType', + label: '合作模式', + component: 'RadioGroup', + componentProps: { + options: COOPERATION_TYPE_OPTIONS, + buttonStyle: 'solid', + optionType: 'button', + }, + rules: 'required', + }, + { + fieldName: 'autoDeduct', + label: '扣款模式', + component: 'RadioGroup', + componentProps: { + options: DEDUCT_MODE_OPTIONS, + buttonStyle: 'solid', + optionType: 'button', + }, + rules: 'required', + }, + { + fieldName: 'autoMatch', + label: '自动匹配', + component: 'Select', + componentProps: { + options: AUTO_MATCH_OPTIONS, + placeholder: '请选择是否开启自动匹配', + }, + rules: 'required', + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + rows: 3, + }, + }, + ]; +} + +/** 搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'stationName', + label: '站点名称', + component: 'Input', + componentProps: { + placeholder: '请输入站点名称', + allowClear: true, + }, + }, + { + fieldName: 'autoDeduct', + label: '扣款模式', + component: 'Select', + componentProps: { + options: DEDUCT_MODE_OPTIONS, + placeholder: '请选择扣款模式', + allowClear: true, + }, + }, + ]; +} + +/** 表格列配置 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'stationName', + title: '站点名称', + minWidth: 150, + fixed: 'left', + }, + { + field: 'cooperationType', + title: '合作模式', + minWidth: 120, + slots: { default: 'cooperationType' }, + }, + { + field: 'autoDeduct', + title: '扣款模式', + minWidth: 130, + slots: { default: 'autoDeduct' }, + }, + { + field: 'autoMatch', + title: '自动匹配', + minWidth: 100, + slots: { default: 'autoMatch' }, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + useActionColumn(1), + ]; +} diff --git a/apps/web-antd/src/views/energy/station-config/index.vue b/apps/web-antd/src/views/energy/station-config/index.vue new file mode 100644 index 0000000..50a940c --- /dev/null +++ b/apps/web-antd/src/views/energy/station-config/index.vue @@ -0,0 +1,133 @@ + + + diff --git a/apps/web-antd/src/views/energy/station-config/modules/form-modal.vue b/apps/web-antd/src/views/energy/station-config/modules/form-modal.vue new file mode 100644 index 0000000..0b7657b --- /dev/null +++ b/apps/web-antd/src/views/energy/station-config/modules/form-modal.vue @@ -0,0 +1,95 @@ + + + diff --git a/apps/web-antd/src/views/energy/station-price/data.ts b/apps/web-antd/src/views/energy/station-price/data.ts new file mode 100644 index 0000000..8339933 --- /dev/null +++ b/apps/web-antd/src/views/energy/station-price/data.ts @@ -0,0 +1,178 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { EnergyStationPriceApi } from '#/api/energy/station-price'; + +import { useActionColumn } from '#/utils/table'; + +export const PRICE_STATUS_OPTIONS = [ + { label: '生效中', value: 1, color: 'green' }, + { label: '已过期', value: 0, color: 'default' }, +]; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'stationId', + label: '加氢站', + component: 'InputNumber', + componentProps: { + placeholder: '请输入加氢站ID', + style: { width: '100%' }, + }, + rules: 'required', + }, + { + fieldName: 'customerId', + label: '客户', + component: 'InputNumber', + componentProps: { + placeholder: '请输入客户ID', + style: { width: '100%' }, + }, + rules: 'required', + }, + { + fieldName: 'costPrice', + label: '成本价(元/KG)', + component: 'InputNumber', + componentProps: { + placeholder: '请输入成本价', + min: 0, + precision: 2, + style: { width: '100%' }, + }, + rules: 'required', + }, + { + fieldName: 'customerPrice', + label: '客户价(元/KG)', + component: 'InputNumber', + componentProps: { + placeholder: '请输入客户价', + min: 0, + precision: 2, + style: { width: '100%' }, + }, + rules: 'required', + }, + { + fieldName: 'effectiveDate', + label: '生效日期', + component: 'DatePicker', + componentProps: { + placeholder: '请选择生效日期', + format: 'YYYY-MM-DD', + valueFormat: 'YYYY-MM-DD', + }, + rules: 'required', + }, + { + fieldName: 'expiryDate', + label: '过期日期', + component: 'DatePicker', + componentProps: { + placeholder: '请选择过期日期(可选)', + format: 'YYYY-MM-DD', + valueFormat: 'YYYY-MM-DD', + }, + }, + ]; +} + +/** 搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'stationName', + label: '站点名称', + component: 'Input', + componentProps: { + placeholder: '请输入站点名称', + allowClear: true, + }, + }, + { + fieldName: 'customerName', + label: '客户名称', + component: 'Input', + componentProps: { + placeholder: '请输入客户名称', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + options: PRICE_STATUS_OPTIONS, + placeholder: '请选择状态', + allowClear: true, + }, + }, + ]; +} + +/** 表格列配置 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'stationName', + title: '站点名称', + minWidth: 150, + }, + { + field: 'customerName', + title: '客户名称', + minWidth: 150, + }, + { + field: 'costPrice', + title: '成本价', + minWidth: 100, + align: 'right', + slots: { default: 'costPrice' }, + }, + { + field: 'customerPrice', + title: '客户价', + minWidth: 100, + align: 'right', + slots: { default: 'customerPrice' }, + }, + { + field: 'effectiveDate', + title: '生效日期', + minWidth: 120, + formatter: 'formatDate', + }, + { + field: 'expiryDate', + title: '过期日期', + minWidth: 120, + slots: { default: 'expiryDate' }, + }, + { + field: 'status', + title: '状态', + minWidth: 100, + slots: { default: 'status' }, + }, + { + field: 'createTime', + title: '创建时间', + minWidth: 180, + formatter: 'formatDateTime', + }, + useActionColumn(2), + ]; +} diff --git a/apps/web-antd/src/views/energy/station-price/index.vue b/apps/web-antd/src/views/energy/station-price/index.vue new file mode 100644 index 0000000..08bc977 --- /dev/null +++ b/apps/web-antd/src/views/energy/station-price/index.vue @@ -0,0 +1,155 @@ + + + diff --git a/apps/web-antd/src/views/energy/station-price/modules/form-modal.vue b/apps/web-antd/src/views/energy/station-price/modules/form-modal.vue new file mode 100644 index 0000000..961ba1c --- /dev/null +++ b/apps/web-antd/src/views/energy/station-price/modules/form-modal.vue @@ -0,0 +1,85 @@ + + +