2025-06-19 14:26:08 +08:00
|
|
|
|
<script setup lang="ts">
|
2025-06-27 18:03:13 +08:00
|
|
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
|
import type { CleanVO } from '#/api/property/clean/model';
|
2025-07-01 14:39:49 +08:00
|
|
|
|
import { h } from 'vue';
|
2025-06-19 14:26:08 +08:00
|
|
|
|
import { computed, ref } from 'vue';
|
|
|
|
|
|
|
|
|
|
import { useVbenModal } from '@vben/common-ui';
|
|
|
|
|
import { $t } from '@vben/locales';
|
2025-07-30 14:57:42 +08:00
|
|
|
|
import { cloneDeep, handleNode, getPopupContainer } from '@vben/utils';
|
2025-06-19 14:26:08 +08:00
|
|
|
|
|
2025-06-27 18:03:13 +08:00
|
|
|
|
import { Button, Table } from 'ant-design-vue';
|
|
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
2025-06-19 14:26:08 +08:00
|
|
|
|
import { useVbenForm } from '#/adapter/form';
|
2025-06-26 18:02:43 +08:00
|
|
|
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
2025-06-27 18:03:13 +08:00
|
|
|
|
import { cleanList } from '#/api/property/clean';
|
|
|
|
|
import {
|
|
|
|
|
clean_orderAdd,
|
|
|
|
|
clean_orderInfo,
|
|
|
|
|
clean_orderUpdate,
|
|
|
|
|
} from '#/api/property/clean_order';
|
|
|
|
|
import { resident_unitList } from '#/api/property/resident/unit';
|
|
|
|
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
import cleanDetailModal from './clean-detail-modal.vue';
|
2025-08-05 17:07:10 +08:00
|
|
|
|
// import { modalSchema } from './data';
|
2025-06-30 17:42:56 +08:00
|
|
|
|
import { communityTree } from '#/api/property/community';
|
2025-08-05 17:07:10 +08:00
|
|
|
|
import { getDictOptions } from '#/utils/dict';
|
|
|
|
|
|
2025-06-27 18:03:13 +08:00
|
|
|
|
const emit = defineEmits<{ reload: [] }>();
|
|
|
|
|
|
|
|
|
|
// 计算合计费用
|
2025-06-26 18:02:43 +08:00
|
|
|
|
const totalSumPeices = computed(() => {
|
|
|
|
|
return detailTable.value
|
2025-06-27 18:03:13 +08:00
|
|
|
|
.reduce(
|
|
|
|
|
(total: number, item: any) => total + (Number(item.sumPeices) || 0),
|
|
|
|
|
0,
|
|
|
|
|
)
|
2025-06-26 18:02:43 +08:00
|
|
|
|
.toFixed(2);
|
|
|
|
|
});
|
2025-06-25 11:37:28 +08:00
|
|
|
|
|
2025-06-19 14:26:08 +08:00
|
|
|
|
const isUpdate = ref(false);
|
2025-06-27 18:03:13 +08:00
|
|
|
|
const isReadonly = ref(false);
|
2025-07-09 18:18:48 +08:00
|
|
|
|
const isAudit = ref(false);
|
|
|
|
|
const isRefund = ref(false);
|
2025-07-11 11:37:04 +08:00
|
|
|
|
const rowData = ref<any>({});
|
2025-06-19 14:26:08 +08:00
|
|
|
|
const title = computed(() => {
|
2025-07-30 14:57:42 +08:00
|
|
|
|
return isUpdate.value
|
|
|
|
|
? $t('pages.common.edit')
|
|
|
|
|
: isReadonly.value
|
|
|
|
|
? '详情'
|
|
|
|
|
: $t('pages.common.add');
|
2025-06-19 14:26:08 +08:00
|
|
|
|
});
|
|
|
|
|
|
2025-06-23 16:50:37 +08:00
|
|
|
|
// 用来缓存 cleanList 的完整数据
|
|
|
|
|
let cleanListData: CleanVO[] = [];
|
|
|
|
|
|
|
|
|
|
// 在文件顶部加缓存
|
|
|
|
|
let unitListData: { id: any; name: string }[] = [];
|
|
|
|
|
|
|
|
|
|
const editUnitId = ref('');
|
2025-07-01 14:39:49 +08:00
|
|
|
|
const editCleanOrderId = ref('');
|
|
|
|
|
const detailModal = ref(null);
|
2025-08-05 17:07:10 +08:00
|
|
|
|
const modalSchema = [
|
|
|
|
|
{
|
|
|
|
|
label: '主键id',
|
|
|
|
|
fieldName: 'id',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
dependencies: {
|
|
|
|
|
show: () => false,
|
|
|
|
|
triggerFields: [''],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '服务地址(房间号)',
|
|
|
|
|
component: 'TreeSelect',
|
|
|
|
|
defaultValue: undefined,
|
|
|
|
|
fieldName: 'location',
|
|
|
|
|
rules: 'required',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '开始时间',
|
|
|
|
|
fieldName: 'starTime',
|
|
|
|
|
component: 'DatePicker',
|
|
|
|
|
componentProps: {
|
|
|
|
|
showTime: true,
|
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
|
placeholder: '请选择开始时间',
|
|
|
|
|
},
|
|
|
|
|
rules: 'required',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '结束时间',
|
|
|
|
|
fieldName: 'endTime',
|
|
|
|
|
component: 'DatePicker',
|
|
|
|
|
componentProps: (values: any) => ({
|
|
|
|
|
showTime: true,
|
|
|
|
|
format: 'YYYY-MM-DD HH:mm:ss',
|
|
|
|
|
placeholder: !values.starTime
|
|
|
|
|
? '请先选择开始时间'
|
|
|
|
|
: `请选择结束时间(结束时间不能早于开始时间)`,
|
|
|
|
|
disabled: isReadonly.value || !values.starTime, // 没选开始时间时禁用
|
|
|
|
|
disabledDate: (current: any) => {
|
|
|
|
|
if (!values.starTime) return false;
|
|
|
|
|
// 只允许选择大于等于开始时间的日期
|
|
|
|
|
return current && current < dayjs(values.starTime).startOf('second');
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
rules: 'required',
|
|
|
|
|
dependencies: {
|
|
|
|
|
triggerFields: ['starTime'],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '申请人',
|
|
|
|
|
fieldName: 'persion',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
rules: 'required',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '联系电话',
|
|
|
|
|
fieldName: 'phone',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
rules: 'required',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '申请单位',
|
|
|
|
|
fieldName: 'unitId',
|
|
|
|
|
component: 'ApiSelect',
|
|
|
|
|
componentProps: {
|
|
|
|
|
api: resident_unitList,
|
|
|
|
|
resultField: 'rows',
|
|
|
|
|
labelField: 'name',
|
|
|
|
|
valueField: 'id',
|
|
|
|
|
placeholder: '请选择单位',
|
|
|
|
|
},
|
|
|
|
|
rules: 'required',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '支付状态',
|
|
|
|
|
fieldName: 'payState',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
componentProps: {
|
|
|
|
|
options: [
|
|
|
|
|
{
|
|
|
|
|
label: '待支付',
|
|
|
|
|
value: 0,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '已支付',
|
|
|
|
|
value: 1,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
rules: 'required',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '保洁类型',
|
|
|
|
|
fieldName: 'type',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
componentProps: {
|
|
|
|
|
options: getDictOptions('pro_cleaning_type'),
|
|
|
|
|
},
|
|
|
|
|
rules: 'selectRequired',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '评价',
|
|
|
|
|
fieldName: 'serviceEvalua',
|
|
|
|
|
component: 'Rate',
|
|
|
|
|
componentProps: {
|
|
|
|
|
allowHalf: false,
|
|
|
|
|
count: 5,
|
|
|
|
|
tooltips: ['1星', '2星', '3星', '4星', '5星'],
|
|
|
|
|
defaultValue: 0,
|
|
|
|
|
},
|
|
|
|
|
dependencies: {
|
|
|
|
|
show: () => (isReadonly.value ? true : false),
|
|
|
|
|
triggerFields: [''],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '评价文本',
|
|
|
|
|
fieldName: 'serviceEvaluaText',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
dependencies: {
|
|
|
|
|
show: () => (isReadonly.value ? true : false),
|
|
|
|
|
triggerFields: [''],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-08-07 11:16:44 +08:00
|
|
|
|
label: '评价图片',
|
2025-08-05 17:07:10 +08:00
|
|
|
|
fieldName: 'imgUrl',
|
|
|
|
|
component: 'Input',
|
|
|
|
|
dependencies: {
|
|
|
|
|
show: () => (isReadonly.value ? true : false),
|
|
|
|
|
triggerFields: [''],
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-08-07 11:16:44 +08:00
|
|
|
|
{
|
|
|
|
|
label: '签到方式',
|
|
|
|
|
fieldName: 'signType',
|
|
|
|
|
component: 'Select',
|
|
|
|
|
componentProps: {
|
2025-08-22 19:43:32 +08:00
|
|
|
|
options: getDictOptions('wy_bjqdfs'),
|
2025-08-07 11:16:44 +08:00
|
|
|
|
},
|
|
|
|
|
dependencies: {
|
|
|
|
|
show: () => (isReadonly.value ? true : false),
|
|
|
|
|
triggerFields: [''],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '签到图片',
|
|
|
|
|
fieldName: 'signImgUrl',
|
|
|
|
|
component: 'ImageUpload',
|
|
|
|
|
componentProps: {
|
2025-08-22 19:43:32 +08:00
|
|
|
|
helpMessage: false,
|
2025-08-07 11:16:44 +08:00
|
|
|
|
},
|
|
|
|
|
dependencies: {
|
2025-08-22 19:43:32 +08:00
|
|
|
|
show: (formValue) =>
|
|
|
|
|
isReadonly.value && formValue.signImgUrl ? true : false,
|
2025-08-07 11:16:44 +08:00
|
|
|
|
triggerFields: [''],
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-08-05 17:07:10 +08:00
|
|
|
|
];
|
2025-06-19 14:26:08 +08:00
|
|
|
|
const [BasicForm, formApi] = useVbenForm({
|
|
|
|
|
commonConfig: {
|
|
|
|
|
// 默认占满两列
|
2025-06-23 16:50:37 +08:00
|
|
|
|
formItemClass: 'col-span-1',
|
2025-06-19 14:26:08 +08:00
|
|
|
|
// 默认label宽度 px
|
2025-06-23 16:50:37 +08:00
|
|
|
|
labelWidth: 120,
|
2025-06-19 14:26:08 +08:00
|
|
|
|
// 通用配置项 会影响到所有表单项
|
2025-06-27 18:03:13 +08:00
|
|
|
|
componentProps: computed(() => ({
|
2025-06-19 14:26:08 +08:00
|
|
|
|
class: 'w-full',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
disabled: isReadonly.value,
|
|
|
|
|
})),
|
2025-06-19 14:26:08 +08:00
|
|
|
|
},
|
2025-06-23 16:50:37 +08:00
|
|
|
|
// 1. 使用正确的属性名 handleValuesChange
|
|
|
|
|
handleValuesChange: async (values, fieldsChanged) => {
|
|
|
|
|
// 2. fieldsChanged 是一个包含变化字段名的数组
|
|
|
|
|
if (fieldsChanged.includes('name')) {
|
|
|
|
|
// 如果缓存数据为空,先请求一次并缓存
|
|
|
|
|
if (cleanListData.length === 0) {
|
|
|
|
|
try {
|
|
|
|
|
const res = await cleanList(); // 查询所有
|
|
|
|
|
cleanListData = res.rows || [];
|
2025-06-27 18:03:13 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取劳务列表失败:', error);
|
2025-06-23 16:50:37 +08:00
|
|
|
|
cleanListData = []; // 出错时清空
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-06-27 18:03:13 +08:00
|
|
|
|
|
2025-06-23 16:50:37 +08:00
|
|
|
|
// 3. 从 values 中获取当前选中的 id
|
|
|
|
|
const selectedId = values.name;
|
2025-06-27 18:03:13 +08:00
|
|
|
|
const selectedItem = cleanListData.find((item) => item.id === selectedId);
|
|
|
|
|
|
2025-06-23 16:50:37 +08:00
|
|
|
|
if (selectedItem) {
|
|
|
|
|
// 4. 使用正确的 formApi.setValues 方法
|
|
|
|
|
await formApi.setValues({
|
2025-06-27 18:03:13 +08:00
|
|
|
|
prices: selectedItem.peices, // 服务单价
|
2025-06-23 16:50:37 +08:00
|
|
|
|
frequency: selectedItem.frequency, // 保洁频率
|
2025-06-27 18:03:13 +08:00
|
|
|
|
standard: selectedItem.standard, // 保洁内容
|
|
|
|
|
peices: selectedItem.peices, // 保洁标准
|
2025-06-23 16:50:37 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-08-05 17:07:10 +08:00
|
|
|
|
// schema: computed(() => {
|
|
|
|
|
// modalSchema(isReadonly.value);
|
|
|
|
|
// }),
|
|
|
|
|
schema: modalSchema,
|
2025-06-19 14:26:08 +08:00
|
|
|
|
showDefaultActions: false,
|
|
|
|
|
wrapperClass: 'grid-cols-2',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
|
|
|
|
{
|
|
|
|
|
initializedGetter: defaultFormValueGetter(formApi),
|
|
|
|
|
currentGetter: defaultFormValueGetter(formApi),
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const [BasicModal, modalApi] = useVbenModal({
|
|
|
|
|
// 在这里更改宽度
|
2025-06-23 16:50:37 +08:00
|
|
|
|
class: 'w-[70%]',
|
2025-06-19 14:26:08 +08:00
|
|
|
|
fullscreenButton: false,
|
|
|
|
|
onBeforeClose,
|
|
|
|
|
onClosed: handleClosed,
|
|
|
|
|
onConfirm: handleConfirm,
|
|
|
|
|
onOpenChange: async (isOpen) => {
|
|
|
|
|
if (!isOpen) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2025-08-05 17:07:10 +08:00
|
|
|
|
|
2025-07-01 14:39:49 +08:00
|
|
|
|
// 查询服务地址树形结构
|
2025-07-30 14:57:42 +08:00
|
|
|
|
setupCommunitySelect();
|
2025-06-19 14:26:08 +08:00
|
|
|
|
modalApi.modalLoading(true);
|
2025-07-30 14:57:42 +08:00
|
|
|
|
const { id, readonly, audit, refund, row } = modalApi.getData() as {
|
2025-07-01 14:39:49 +08:00
|
|
|
|
id?: string;
|
2025-06-27 18:03:13 +08:00
|
|
|
|
readonly?: boolean;
|
2025-07-09 18:18:48 +08:00
|
|
|
|
audit?: boolean;
|
|
|
|
|
refund?: boolean;
|
2025-07-11 11:37:04 +08:00
|
|
|
|
row?: any;
|
2025-06-27 18:03:13 +08:00
|
|
|
|
};
|
2025-07-01 14:39:49 +08:00
|
|
|
|
editCleanOrderId.value = id || '';
|
2025-06-27 18:03:13 +08:00
|
|
|
|
isReadonly.value = !!readonly;
|
2025-07-09 18:18:48 +08:00
|
|
|
|
isAudit.value = !!audit;
|
|
|
|
|
isRefund.value = !!refund;
|
2025-07-11 11:37:04 +08:00
|
|
|
|
rowData.value = row;
|
2025-07-01 14:39:49 +08:00
|
|
|
|
//判断是否是编辑状态需要先判断是否是只读状态
|
2025-07-30 14:57:42 +08:00
|
|
|
|
if (isReadonly.value) {
|
2025-07-01 14:39:49 +08:00
|
|
|
|
isUpdate.value = false;
|
2025-07-30 14:57:42 +08:00
|
|
|
|
} else {
|
2025-07-01 14:39:49 +08:00
|
|
|
|
isUpdate.value = !!id;
|
|
|
|
|
}
|
|
|
|
|
if ((isUpdate.value || isReadonly.value) && id) {
|
2025-06-27 18:03:13 +08:00
|
|
|
|
const record: any = await clean_orderInfo(id);
|
2025-08-22 19:43:32 +08:00
|
|
|
|
|
2025-06-23 16:50:37 +08:00
|
|
|
|
if (record.starTime) record.starTime = dayjs(record.starTime);
|
|
|
|
|
if (record.endTime) record.endTime = dayjs(record.endTime);
|
|
|
|
|
editUnitId.value = record.unitId || '';
|
2025-07-01 14:39:49 +08:00
|
|
|
|
detailTable.value = record.cleanList || [];
|
2025-07-30 14:57:42 +08:00
|
|
|
|
for (const item of record.relationList) {
|
|
|
|
|
for (let i = 0; i < detailTable.value.length; i++) {
|
|
|
|
|
if (item.cleanId === detailTable.value[i].id) {
|
2025-07-09 18:18:48 +08:00
|
|
|
|
detailTable.value[i].area = item.areas;
|
|
|
|
|
detailTable.value[i].sumPeices = item.sumPrice;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-06-19 14:26:08 +08:00
|
|
|
|
await formApi.setValues(record);
|
|
|
|
|
}
|
|
|
|
|
await markInitialized();
|
|
|
|
|
modalApi.modalLoading(false);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
// 添加订单详情表格配置
|
|
|
|
|
const detailGridOptions: VxeGridProps = {
|
|
|
|
|
height: '300px',
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
title: '序号',
|
|
|
|
|
field: 'index',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
slots: {
|
|
|
|
|
default: ({ rowIndex }) => {
|
|
|
|
|
return (rowIndex + 1).toString();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '劳务名称',
|
|
|
|
|
field: 'name',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '计量单位',
|
|
|
|
|
field: 'measure',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '计算方式',
|
|
|
|
|
field: 'method',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '申报单价含税(元)',
|
|
|
|
|
field: 'peices',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '保洁频率',
|
|
|
|
|
field: 'frequency',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '保洁标准',
|
|
|
|
|
field: 'standard',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '备注',
|
|
|
|
|
field: 'remark',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '状态',
|
|
|
|
|
field: 'stater',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
slots: {
|
2025-06-27 18:03:13 +08:00
|
|
|
|
default: ({ row }) => (row.stater === 1 ? '启用' : '禁用'),
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '保洁面积',
|
|
|
|
|
field: 'area',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '合计费用',
|
|
|
|
|
field: 'sumPeices',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: 'action',
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
slots: { default: 'action' },
|
|
|
|
|
title: '操作',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
width: 'auto',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
data: [],
|
|
|
|
|
};
|
|
|
|
|
const detailColumns = [
|
2025-06-30 17:42:56 +08:00
|
|
|
|
{ title: '序号', key: 'index' },
|
|
|
|
|
{ title: '劳务名称', dataIndex: 'name', key: 'name' },
|
|
|
|
|
{ title: '计量单位', dataIndex: 'measure', key: 'measure' },
|
|
|
|
|
{ title: '计算方式', dataIndex: 'method', key: 'method' },
|
2025-06-27 18:03:13 +08:00
|
|
|
|
{
|
|
|
|
|
title: '申报单价含税(元)',
|
|
|
|
|
dataIndex: 'peices',
|
|
|
|
|
key: 'peices',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '保洁频率',
|
|
|
|
|
dataIndex: 'frequency',
|
|
|
|
|
key: 'frequency',
|
|
|
|
|
},
|
2025-06-30 17:42:56 +08:00
|
|
|
|
{ title: '保洁标准', dataIndex: 'standard', key: 'standard' },
|
|
|
|
|
{ title: '备注', dataIndex: 'remark', key: 'remark' },
|
2025-06-26 18:02:43 +08:00
|
|
|
|
{
|
|
|
|
|
title: '状态',
|
|
|
|
|
dataIndex: 'stater',
|
|
|
|
|
key: 'stater',
|
2025-06-27 18:03:13 +08:00
|
|
|
|
customRender: ({ value }: { value: number }) =>
|
|
|
|
|
value === 1 ? '启用' : '禁用',
|
2025-06-26 18:02:43 +08:00
|
|
|
|
},
|
2025-06-30 17:42:56 +08:00
|
|
|
|
{ title: '保洁面积', dataIndex: 'area', key: 'area' },
|
2025-06-27 18:03:13 +08:00
|
|
|
|
{
|
|
|
|
|
title: '合计费用',
|
|
|
|
|
dataIndex: 'sumPeices',
|
|
|
|
|
key: 'sumPeices',
|
|
|
|
|
},
|
2025-07-30 14:57:42 +08:00
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
key: 'action',
|
|
|
|
|
fixed: 'right' as const,
|
|
|
|
|
},
|
2025-06-27 18:03:13 +08:00
|
|
|
|
];
|
2025-06-26 18:02:43 +08:00
|
|
|
|
|
|
|
|
|
const [DetailTable, detailTableApi] = useVbenVxeGrid({
|
|
|
|
|
gridOptions: detailGridOptions,
|
|
|
|
|
});
|
2025-06-27 18:03:13 +08:00
|
|
|
|
const detailTable = ref<any>([]);
|
2025-06-26 18:02:43 +08:00
|
|
|
|
|
|
|
|
|
const [CleanDetailModal, detailModalApi] = useVbenModal({
|
|
|
|
|
connectedComponent: cleanDetailModal,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function handleAddDetail() {
|
|
|
|
|
detailModalApi.setData({});
|
|
|
|
|
detailModalApi.open();
|
|
|
|
|
}
|
2025-07-01 14:39:49 +08:00
|
|
|
|
// 添加订单服务详情
|
2025-06-26 18:02:43 +08:00
|
|
|
|
function handleDetailReload(data: any) {
|
2025-06-27 18:03:13 +08:00
|
|
|
|
detailTable.value.push(data);
|
2025-06-26 18:02:43 +08:00
|
|
|
|
}
|
2025-07-01 14:39:49 +08:00
|
|
|
|
// 编辑订单服务详情
|
|
|
|
|
function handleEditDetailReload(data: any) {
|
|
|
|
|
detailTable.value[data.index] = data;
|
|
|
|
|
}
|
|
|
|
|
// 删除订单服务详情
|
2025-06-27 18:03:13 +08:00
|
|
|
|
function handleDeleteDetail(record: any, index: number) {
|
|
|
|
|
detailTable.value.splice(index, 1);
|
2025-06-26 18:02:43 +08:00
|
|
|
|
}
|
2025-07-01 17:48:47 +08:00
|
|
|
|
// 查看产品详情
|
2025-07-01 14:39:49 +08:00
|
|
|
|
function handleViewDetail(record: any) {
|
|
|
|
|
detailModalApi.setData({ ...record, readonly: true });
|
|
|
|
|
detailModalApi.open();
|
|
|
|
|
}
|
2025-07-01 17:48:47 +08:00
|
|
|
|
// 编辑产品详情
|
2025-07-01 14:39:49 +08:00
|
|
|
|
function handleEditDetail(record: any, index: number) {
|
|
|
|
|
detailModalApi.setData({ ...record, index, readonly: false });
|
|
|
|
|
detailModalApi.open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleConfirm() {
|
2025-06-27 18:03:13 +08:00
|
|
|
|
if (isReadonly.value) {
|
2025-07-01 14:39:49 +08:00
|
|
|
|
detailTable.value = [];
|
2025-06-27 18:03:13 +08:00
|
|
|
|
modalApi.close();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-06-19 14:26:08 +08:00
|
|
|
|
try {
|
|
|
|
|
modalApi.lock(true);
|
|
|
|
|
const { valid } = await formApi.validate();
|
|
|
|
|
if (!valid) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const data = cloneDeep(await formApi.getValues());
|
2025-07-15 16:12:11 +08:00
|
|
|
|
|
2025-06-23 16:50:37 +08:00
|
|
|
|
// 单位数据缓存
|
|
|
|
|
if (unitListData.length === 0) {
|
|
|
|
|
const res = await resident_unitList();
|
|
|
|
|
unitListData = res.rows || [];
|
|
|
|
|
}
|
|
|
|
|
// 劳务数据缓存 cleanListData 已有
|
|
|
|
|
// 查找label
|
2025-07-01 14:39:49 +08:00
|
|
|
|
const unitObj = unitListData.find((item) => item.id === data.unitId);
|
2025-06-27 18:03:13 +08:00
|
|
|
|
const cleanObj = cleanListData.find((item) => item.id === data.name);
|
|
|
|
|
data.unit = unitObj ? unitObj.name : data.unit || '';
|
|
|
|
|
data.name = cleanObj ? cleanObj.name : data.name || '';
|
|
|
|
|
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
2025-07-30 14:57:42 +08:00
|
|
|
|
data.sumPeices = Number(totalSumPeices.value);
|
2025-06-30 17:59:17 +08:00
|
|
|
|
data.cleanList = detailTable.value;
|
2025-07-30 14:57:42 +08:00
|
|
|
|
if (data.starTime)
|
|
|
|
|
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
if (data.endTime)
|
|
|
|
|
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
isUpdate.value
|
|
|
|
|
? await clean_orderUpdate({ ...data, id: editCleanOrderId.value })
|
|
|
|
|
: await clean_orderAdd(data);
|
2025-06-19 14:26:08 +08:00
|
|
|
|
resetInitialized();
|
|
|
|
|
emit('reload');
|
|
|
|
|
modalApi.close();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(error);
|
|
|
|
|
} finally {
|
|
|
|
|
modalApi.lock(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleClosed() {
|
|
|
|
|
await formApi.resetForm();
|
2025-07-30 14:57:42 +08:00
|
|
|
|
detailTable.value = []; //清空详情表格
|
2025-06-19 14:26:08 +08:00
|
|
|
|
resetInitialized();
|
|
|
|
|
}
|
2025-06-30 17:42:56 +08:00
|
|
|
|
// 获取服务地址
|
|
|
|
|
async function setupCommunitySelect() {
|
2025-07-30 14:57:42 +08:00
|
|
|
|
const areaList = await communityTree(4);
|
2025-08-05 17:07:10 +08:00
|
|
|
|
|
2025-06-30 17:42:56 +08:00
|
|
|
|
// 选中后显示在输入框的值 即父节点 / 子节点
|
|
|
|
|
// addFullName(areaList, 'areaName', ' / ');
|
|
|
|
|
const splitStr = '/';
|
|
|
|
|
handleNode(areaList, 'label', splitStr, function (node: any) {
|
2025-07-30 14:57:42 +08:00
|
|
|
|
if (node.level != 4) {
|
2025-07-02 09:48:21 +08:00
|
|
|
|
node.disabled = true;
|
|
|
|
|
}
|
2025-06-30 17:42:56 +08:00
|
|
|
|
});
|
|
|
|
|
formApi.updateSchema([
|
|
|
|
|
{
|
|
|
|
|
componentProps: () => ({
|
|
|
|
|
class: 'w-full',
|
|
|
|
|
fieldNames: {
|
|
|
|
|
key: 'id',
|
|
|
|
|
label: 'label',
|
|
|
|
|
value: 'code',
|
|
|
|
|
children: 'children',
|
|
|
|
|
},
|
|
|
|
|
getPopupContainer,
|
|
|
|
|
placeholder: '请选择服务地址',
|
|
|
|
|
showSearch: true,
|
|
|
|
|
treeData: areaList,
|
|
|
|
|
treeDefaultExpandAll: true,
|
|
|
|
|
treeLine: { showLeafIcon: false },
|
|
|
|
|
// 筛选的字段
|
|
|
|
|
treeNodeFilterProp: 'label',
|
|
|
|
|
// 选中后显示在输入框的值
|
|
|
|
|
treeNodeLabelProp: 'fullName',
|
|
|
|
|
}),
|
|
|
|
|
fieldName: 'location',
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
}
|
2025-07-09 18:18:48 +08:00
|
|
|
|
async function handleAudit(params: any) {
|
2025-07-30 14:57:42 +08:00
|
|
|
|
modalApi.lock(true);
|
|
|
|
|
const { valid } = await formApi.validate();
|
|
|
|
|
if (!valid) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const data = cloneDeep(await formApi.getValues());
|
|
|
|
|
if (rowData.value) {
|
2025-07-11 11:37:04 +08:00
|
|
|
|
data.state = rowData.value.state;
|
|
|
|
|
data.isUnbooking = rowData.value?.isUnbooking;
|
2025-07-30 14:57:42 +08:00
|
|
|
|
}
|
|
|
|
|
// 单位数据缓存
|
|
|
|
|
if (unitListData.length === 0) {
|
|
|
|
|
const res = await resident_unitList();
|
|
|
|
|
unitListData = res.rows || [];
|
|
|
|
|
}
|
|
|
|
|
// 劳务数据缓存 cleanListData 已有
|
|
|
|
|
// 查找label
|
|
|
|
|
const unitObj = unitListData.find((item) => item.id === data.unitId);
|
|
|
|
|
const cleanObj = cleanListData.find((item) => item.id === data.name);
|
|
|
|
|
data.unit = unitObj ? unitObj.name : data.unit || '';
|
|
|
|
|
data.name = cleanObj ? cleanObj.name : data.name || '';
|
|
|
|
|
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
|
|
|
|
data.sumPeices = Number(totalSumPeices.value);
|
|
|
|
|
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
// data.sumPeices = parseInt(totalSumPeices.value, 10);
|
|
|
|
|
// 组装 cleanIds
|
|
|
|
|
// data.cleanIds = detailTable.value.map((item: any) => item.id);
|
|
|
|
|
data.cleanList = detailTable.value;
|
|
|
|
|
if (params.isRefund) {
|
|
|
|
|
data.isUnbooking = 1;
|
|
|
|
|
} else if (params.isAudit) {
|
|
|
|
|
data.state = 1;
|
|
|
|
|
} else {
|
|
|
|
|
data.state = 2;
|
|
|
|
|
}
|
|
|
|
|
// 0:未审核 1:审核通过 2:审核不通过
|
|
|
|
|
await clean_orderUpdate({ ...data, id: editCleanOrderId.value });
|
|
|
|
|
resetInitialized();
|
|
|
|
|
emit('reload');
|
|
|
|
|
modalApi.close();
|
2025-07-09 18:18:48 +08:00
|
|
|
|
}
|
2025-06-19 14:26:08 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-06-27 18:03:13 +08:00
|
|
|
|
<BasicModal :title="title">
|
2025-07-30 14:57:42 +08:00
|
|
|
|
<BasicForm> </BasicForm>
|
2025-06-26 18:02:43 +08:00
|
|
|
|
<!-- 添加订单详情部分 -->
|
|
|
|
|
<div class="mt-4">
|
2025-06-27 18:03:13 +08:00
|
|
|
|
<div class="mb-2 flex items-center justify-between">
|
2025-07-30 14:57:42 +08:00
|
|
|
|
<h3 class="text-lg font-medium">
|
|
|
|
|
{{
|
|
|
|
|
isUpdate
|
|
|
|
|
? '编辑保洁订单详情'
|
|
|
|
|
: isReadonly
|
|
|
|
|
? '查看保洁订单详情'
|
|
|
|
|
: '添加保洁订单详情'
|
|
|
|
|
}}
|
|
|
|
|
</h3>
|
2025-07-01 14:39:49 +08:00
|
|
|
|
<a-button v-if="!isReadonly" type="primary" @click="handleAddDetail">
|
2025-06-26 18:02:43 +08:00
|
|
|
|
{{ $t('pages.common.add') }}
|
|
|
|
|
</a-button>
|
|
|
|
|
</div>
|
2025-06-27 18:03:13 +08:00
|
|
|
|
<Table
|
|
|
|
|
:data-source="detailTable"
|
|
|
|
|
:columns="detailColumns"
|
|
|
|
|
:pagination="false"
|
|
|
|
|
>
|
|
|
|
|
<template #bodyCell="{ column, index, record }">
|
|
|
|
|
<template v-if="column.key === 'index'">
|
|
|
|
|
{{ index + 1 }}
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else-if="column.key === 'action'">
|
2025-07-01 14:39:49 +08:00
|
|
|
|
<template v-if="isReadonly">
|
|
|
|
|
<Button @click="handleViewDetail(record)">查看</Button>
|
|
|
|
|
</template>
|
2025-07-30 14:57:42 +08:00
|
|
|
|
<template v-else>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
size="small"
|
|
|
|
|
style="margin-right: 5px"
|
|
|
|
|
@click="handleViewDetail(record)"
|
|
|
|
|
>查看</Button
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
size="small"
|
|
|
|
|
style="margin-right: 5px"
|
|
|
|
|
@click="handleEditDetail(record, index)"
|
|
|
|
|
>编辑</Button
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
danger
|
|
|
|
|
size="small"
|
|
|
|
|
@click="handleDeleteDetail(record, index)"
|
|
|
|
|
>
|
2025-07-01 14:39:49 +08:00
|
|
|
|
删除
|
|
|
|
|
</Button>
|
|
|
|
|
</template>
|
2025-06-27 18:03:13 +08:00
|
|
|
|
</template>
|
2025-06-26 18:02:43 +08:00
|
|
|
|
</template>
|
2025-06-27 18:03:13 +08:00
|
|
|
|
</Table>
|
|
|
|
|
<div>费用合计:{{ totalSumPeices }}元</div>
|
|
|
|
|
</div>
|
2025-07-30 14:57:42 +08:00
|
|
|
|
<CleanDetailModal
|
|
|
|
|
@reload="handleDetailReload"
|
|
|
|
|
@editReload="handleEditDetailReload"
|
|
|
|
|
/>
|
2025-07-09 18:18:48 +08:00
|
|
|
|
<template #footer v-if="isAudit">
|
|
|
|
|
<a-button @click="modalApi.close()">取消</a-button>
|
2025-07-30 14:57:42 +08:00
|
|
|
|
<a-button type="primary" @click="handleAudit({ isAudit: true })"
|
|
|
|
|
>审核通过</a-button
|
|
|
|
|
>
|
|
|
|
|
<a-button danger @click="handleAudit({ isAudit: false })"
|
|
|
|
|
>审核不通过</a-button
|
|
|
|
|
>
|
2025-07-09 18:18:48 +08:00
|
|
|
|
</template>
|
|
|
|
|
<template #footer v-if="isRefund">
|
|
|
|
|
<a-button @click="modalApi.close()">取消</a-button>
|
2025-07-30 14:57:42 +08:00
|
|
|
|
<a-button type="primary" @click="handleAudit({ isRefund: true })"
|
|
|
|
|
>退定</a-button
|
|
|
|
|
>
|
2025-07-09 18:18:48 +08:00
|
|
|
|
</template>
|
2025-07-30 14:57:42 +08:00
|
|
|
|
</BasicModal>
|
2025-06-19 14:26:08 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
<style scoped>
|
|
|
|
|
.mt-4 {
|
|
|
|
|
margin-top: 1rem;
|
|
|
|
|
}
|
2025-06-27 18:03:13 +08:00
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
.mb-2 {
|
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
}
|
2025-06-27 18:03:13 +08:00
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
.flex {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
2025-06-27 18:03:13 +08:00
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
.items-center {
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2025-06-27 18:03:13 +08:00
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
.justify-between {
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
2025-06-27 18:03:13 +08:00
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
.text-lg {
|
|
|
|
|
font-size: 1.125rem;
|
|
|
|
|
line-height: 1.75rem;
|
|
|
|
|
}
|
2025-06-27 18:03:13 +08:00
|
|
|
|
|
2025-06-26 18:02:43 +08:00
|
|
|
|
.font-medium {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
2025-06-30 17:42:56 +08:00
|
|
|
|
/* 使用 :deep() 穿透 scoped 样式,影响子组件 */
|
|
|
|
|
:deep(.ant-input[disabled]),
|
|
|
|
|
:deep(.ant-input-number-disabled .ant-input-number-input),
|
|
|
|
|
:deep(.ant-select-disabled .ant-select-selection-item),
|
|
|
|
|
:deep(.ant-picker-disabled .ant-picker-input > input) {
|
|
|
|
|
/* 设置一个更深的颜色 */
|
|
|
|
|
color: rgb(0 0 0 / 65%) !important;
|
|
|
|
|
|
|
|
|
|
/* 有些浏览器需要这个来覆盖默认颜色 */
|
|
|
|
|
-webkit-text-fill-color: rgb(0 0 0 / 65%) !important;
|
|
|
|
|
}
|
2025-06-26 18:02:43 +08:00
|
|
|
|
</style>
|