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 index a7121979..8ff8247e 100644 --- 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 @@ -77,7 +77,6 @@ const detailSchema = [ valueField: 'id', mode: 'multiple', onChange: async (value: any, option: any) => { - console.log(value, option); let totalArea: any = 0; totalArea = option.reduce((sum: any, item: any) => { // 假设每个选项有一个area字段,根据实际情况调整 @@ -87,11 +86,17 @@ const detailSchema = [ area: totalArea, // 房间总面积 // 其他需要自动填充的字段 }); + const formValues = await formApi.getValues(); + if (formValues.peices && totalArea) { + await formApi.setValues({ + sumPeices: Number((formValues.peices * totalArea).toFixed(2)), + }); + } }, }, }, { - label: '房间面积', + label: '房间面积(㎡)', fieldName: 'area', component: 'Input', componentProps: { @@ -204,20 +209,25 @@ const [BasicModal, modalApi] = useVbenModal({ } modalApi.modalLoading(true); const data = modalApi.getData(); - console.log(data); currentUnitId.value = modalApi.getData().unitId; detailIndex.value = modalApi.getData().index; - if (!data || Object.keys(data).length === 0) { - //modalApi.getData()为空时表示添加 - isAdd.value = true; + if (data.update) { + //有index表示编辑 + isUpdate.value = true; + data.roomId = data.roomId + .split(',') + .filter((id: string) => id.trim() !== ''); } else if (data.readonly) { isView.value = true; + data.roomId = data.roomId + .split(',') + .filter((id: string) => id.trim() !== ''); + data.area = data.sumPeices / data.peices; } else { - //表示编辑 - isUpdate.value = true; + isAdd.value = true; } // TODO: 获取详情数据 - await formApi.setValues(modalApi.getData()); + await formApi.setValues(data); await markInitialized(); modalApi.modalLoading(false); }, @@ -237,6 +247,7 @@ async function handleConfirm() { data.name = selectedService.name; data.id = selectedService.id; } + data.roomId = data.roomId.join(','); if (isUpdate.value) { data.index = detailIndex.value; emit('editReload', data); 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 9e7a4726..d9e63b5e 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 @@ -402,11 +402,11 @@ const detailGridOptions: VxeGridProps = { default: ({ row }) => (row.stater === 1 ? '启用' : '禁用'), }, }, - { - title: '保洁面积', - field: 'area', - width: 'auto', - }, + // { + // title: '保洁面积', + // field: 'area', + // width: 'auto', + // }, { title: '合计费用', field: 'sumPeices', @@ -446,7 +446,7 @@ const detailColumns = [ customRender: ({ value }: { value: number }) => value === 1 ? '启用' : '禁用', }, - { title: '保洁面积', dataIndex: 'area', key: 'area' }, + // { title: '保洁面积', dataIndex: 'area', key: 'area' }, { title: '合计费用', dataIndex: 'sumPeices', @@ -469,7 +469,6 @@ const [CleanDetailModal, detailModalApi] = useVbenModal({ }); function handleAddDetail() { - console.log(currentUnitId); detailModalApi.setData({ unitId: currentUnitId.value }); detailModalApi.open(); } @@ -487,7 +486,12 @@ function handleDeleteDetail(record: any, index: number) { } // 查看产品详情 function handleViewDetail(record: any) { - detailModalApi.setData({ ...record, readonly: true, unitId: currentUnitId }); + detailModalApi.setData({ + ...record, + readonly: true, + unitId: currentUnitId.value, + area: record.su, + }); detailModalApi.open(); } // 编辑产品详情 @@ -495,8 +499,8 @@ function handleEditDetail(record: any, index: number) { detailModalApi.setData({ ...record, index, - readonly: false, - unitId: currentUnitId, + update: true, + unitId: currentUnitId.value, }); detailModalApi.open(); }