From a0f5599d9249022dfd22f516aa1ddc18a41367aa Mon Sep 17 00:00:00 2001 From: fyy <2717885210@qq.com> Date: Tue, 24 Jun 2025 16:43:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E7=BD=AE=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E4=BF=9D=E6=B4=81=E8=AE=A2=E5=8D=95=E5=8F=AF=E9=80=89=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clean/cleanOrders/clean-detail-modal.vue | 230 ++++++++++++++++++ .../clean/cleanOrders/clean-modal.vue | 182 +++++++++++++- .../views/property/clean/cleanOrders/data.ts | 44 ++-- 3 files changed, 427 insertions(+), 29 deletions(-) create mode 100644 apps/web-antd/src/views/property/clean/cleanOrders/clean-detail-modal.vue diff --git a/apps/web-antd/src/views/property/clean/cleanOrders/clean-detail-modal.vue b/apps/web-antd/src/views/property/clean/cleanOrders/clean-detail-modal.vue new file mode 100644 index 00000000..daffa3a2 --- /dev/null +++ b/apps/web-antd/src/views/property/clean/cleanOrders/clean-detail-modal.vue @@ -0,0 +1,230 @@ + + + + + + + + \ No newline at end of file diff --git a/apps/web-antd/src/views/property/clean/cleanOrders/clean-modal.vue b/apps/web-antd/src/views/property/clean/cleanOrders/clean-modal.vue index bdb449e4..cd029e35 100644 --- a/apps/web-antd/src/views/property/clean/cleanOrders/clean-modal.vue +++ b/apps/web-antd/src/views/property/clean/cleanOrders/clean-modal.vue @@ -12,11 +12,19 @@ import type { CleanVO } from '#/api/property/clean/model'; import { clean_orderAdd, clean_orderInfo, clean_orderUpdate } from '#/api/property/clean_order'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { resident_unitList } from '#/api/property/resident/unit'; - +import { useVbenVxeGrid } from '#/adapter/vxe-table'; +import type { VxeGridProps } from '#/adapter/vxe-table'; +import cleanDetailModal from './clean-detail-modal.vue'; +import { Table, Button } from 'ant-design-vue'; import { modalSchema } from './data'; -const emit = defineEmits<{ reload: [] }>(); +const totalSumPeices = computed(() => { + return detailTable.value + .reduce((total: number, item: any) => total + (Number(item.sumPeices) || 0), 0) + .toFixed(2); +}); +const emit = defineEmits<{ reload: [] }>(); const isUpdate = ref(false); const title = computed(() => { return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); @@ -99,8 +107,9 @@ const [BasicModal, modalApi] = useVbenModal({ const { id } = modalApi.getData() as { id?: number | string }; isUpdate.value = !!id; + if (isUpdate.value && id) { - const record = await clean_orderInfo(id); + const record:any = await clean_orderInfo(id); if (record.starTime) record.starTime = dayjs(record.starTime); if (record.endTime) record.endTime = dayjs(record.endTime); editUnitId.value = record.unitId || ''; @@ -112,6 +121,121 @@ const [BasicModal, modalApi] = useVbenModal({ }, }); +// 添加订单详情表格配置 +const detailGridOptions: VxeGridProps = { + height: '300px', + columns: [ + { type: 'checkbox', width: 60 }, + { + title: '序号', + field: 'index', + slots: { + default: ({ rowIndex }) => { + return (rowIndex + 1).toString(); + }, + }, + }, + { + title: '劳务名称', + field: 'name', + }, + { + title: '计量单位', + field: 'measure', + }, + { + title: '计算方式', + field: 'method', + }, + { + title: '申报单价含税(元)', + field: 'peices', + }, + { + title: '保洁频率', + field: 'frequency', + }, + { + title: '保洁标准', + field: 'standard', + }, + { + title: '备注', + field: 'remark', + }, + { + title: '状态', + field: 'stater', + slots: { + default: ({ row }) => row.stater === 1 ? '启用' : '禁用', + }, + }, + { + title: '保洁面积', + field: 'area', + }, + { + title: '合计费用', + field: 'sumPeices', + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + width: 120, + }, + ], + data: [], +}; +const detailColumns = [ + { title: '序号', key: 'index'}, + { title: '劳务名称', dataIndex: 'name', key: 'name' }, + { title: '计量单位', dataIndex: 'measure', key: 'measure' }, + { title: '计算方式', dataIndex: 'method', key: 'method' }, + { title: '申报单价含税(元)', dataIndex: 'peices', key: 'peices' }, + { title: '保洁频率', dataIndex: 'frequency', key: 'frequency' }, + { title: '保洁标准', dataIndex: 'standard', key: 'standard' }, + { title: '备注', dataIndex: 'remark', key: 'remark' }, + { + title: '状态', + dataIndex: 'stater', + key: 'stater', + customRender: ({ value }: { value: number }) => (value === 1 ? '启用' : '禁用') + }, + { title: '保洁面积', dataIndex: 'area', key: 'area' }, + { title: '合计费用', dataIndex: 'sumPeices', key: 'sumPeices' }, + { + title: '操作', + key: 'action', + fixed: 'right', + width: 120, + }, +] + +const [DetailTable, detailTableApi] = useVbenVxeGrid({ + gridOptions: detailGridOptions, +}); +const detailTable = ref([]) + +const [CleanDetailModal, detailModalApi] = useVbenModal({ + connectedComponent: cleanDetailModal, +}); + +function handleAddDetail() { + detailModalApi.setData({}); + detailModalApi.open(); +} + +function handleDetailReload(data: any) { + detailTable.value.push(data) +} + +function handleDeleteDetail(record: any,index: number) { + console.log(record,index); + detailTable.value.splice(index,1) +} + async function handleConfirm() { try { modalApi.lock(true); @@ -120,15 +244,13 @@ async function handleConfirm() { return; } const data = cloneDeep(await formApi.getValues()); -console.log(data); - + console.log(data); // 单位数据缓存 if (unitListData.length === 0) { const res = await resident_unitList(); unitListData = res.rows || []; } // 劳务数据缓存 cleanListData 已有 - // 查找label const unitObj = unitListData.find(item => item.id === data.unit); const cleanObj = cleanListData.find(item => item.id === data.name); @@ -160,8 +282,54 @@ async function handleClosed() { - + + + + + 添加保洁订单详情 + + {{ $t('pages.common.add') }} + + + + + + {{ index + 1 }} + + + 删除 + + + +费用合计:{{ totalSumPeices }}元 + + + + diff --git a/apps/web-antd/src/views/property/clean/cleanOrders/data.ts b/apps/web-antd/src/views/property/clean/cleanOrders/data.ts index 1e335c47..a8b89e44 100644 --- a/apps/web-antd/src/views/property/clean/cleanOrders/data.ts +++ b/apps/web-antd/src/views/property/clean/cleanOrders/data.ts @@ -131,28 +131,28 @@ export const modalSchema: FormSchemaGetter = () => [ component: 'Input', rules: 'required', }, - { - label: '劳务名称', - fieldName: 'name', - component: 'ApiSelect', - componentProps: { - api: cleanList, - resultField: 'rows', - labelField: 'name', - valueField: 'id', - }, - rules: 'required', - }, - { - label: '服务单价', - fieldName: 'prices', - component: 'Input', - rules: 'required', - componentProps: { - placeholder: '', - disabled: true, - }, - }, + // { + // label: '劳务名称', + // fieldName: 'name', + // component: 'ApiSelect', + // componentProps: { + // api: cleanList, + // resultField: 'rows', + // labelField: 'name', + // valueField: 'id', + // }, + // rules: 'required', + // }, + // { + // label: '服务单价', + // fieldName: 'prices', + // component: 'Input', + // rules: 'required', + // componentProps: { + // placeholder: '', + // disabled: true, + // }, + // }, // { // label: '保洁频率', // fieldName: 'frequency',