This commit is contained in:
lxj
2025-08-03 15:31:56 +08:00
38 changed files with 1103 additions and 655 deletions

View File

@@ -29,7 +29,7 @@ export interface BuildingVO {
/** /**
* 建筑类型('1住宅','2商业','3:混合') * 建筑类型('1住宅','2商业','3:混合')
*/ */
buildType: number; buildType: string;
/** /**
* 电梯数量 * 电梯数量

View File

@@ -1,4 +1,4 @@
import type { PageQuery, BaseEntity } from '#/api/common'; import type {PageQuery, BaseEntity} from '#/api/common';
export interface WorkOrdersVO { export interface WorkOrdersVO {
/** /**
@@ -71,8 +71,40 @@ export interface WorkOrdersVO {
*/ */
isTimeOut: number; isTimeOut: number;
workOrdersRecordVoList: HandleRecords[];
typeName: string;
initiatorPeople: string;
handlerText: string;
/**
* 评价图片
*/
imgUrl: string;
/**
* 评价内容
*/
serviceEvaluaText: string;
/**
* 创建时间
*/
createTime: string;
/**
* 备注
*/
remark: string;
} }
export interface HandleRecords {
status: string;
createTime: string;
handlerName: string;
initiatorPeople: string;
}
export interface WorkOrdersForm extends BaseEntity { export interface WorkOrdersForm extends BaseEntity {
/** /**
* id * id
@@ -213,7 +245,7 @@ export interface WorkOrdersQuery extends PageQuery {
isTimeOut?: number; isTimeOut?: number;
/** /**
* 日期范围参数 * 日期范围参数
*/ */
params?: any; params?: any;
} }

View File

@@ -19,7 +19,7 @@ export interface RoomVO {
/** /**
* 房间类型('住宅','商铺','办公室','设备间','公共区域') * 房间类型('住宅','商铺','办公室','设备间','公共区域')
*/ */
roomType: number; roomType: string;
/** /**
* 建筑面积(平方米) * 建筑面积(平方米)
@@ -49,7 +49,7 @@ export interface RoomVO {
/** /**
* 状态('空置','已售','已租','自用' * 状态('空置','已售','已租','自用'
*/ */
status: number; status: string;
} }

View File

@@ -40,6 +40,10 @@ export interface AttachVO {
* 创建时间 * 创建时间
*/ */
createTime: string; createTime: string;
quantity: number;
meetAttachId: string;
} }
export interface AttachForm extends BaseEntity { export interface AttachForm extends BaseEntity {

View File

@@ -213,7 +213,7 @@ async function showHoliday() {
<span>{{ '第' + (index + 1) + '天' }}</span> <span>{{ '第' + (index + 1) + '天' }}</span>
</template> </template>
<template v-if="column.dataIndex === 'shiftId'"> <template v-if="column.dataIndex === 'shiftId'">
{{record.shiftId}} {{record.shiftValue}}
</template> </template>
</template> </template>
</Table> </Table>

View File

@@ -111,7 +111,6 @@ const [BasicModal, modalApi] = useVbenModal({
settingData.cycleData=record.scheduleCycleList settingData.cycleData=record.scheduleCycleList
settingData.cycleData.forEach(item => { settingData.cycleData.forEach(item => {
if(item.shiftId){ if(item.shiftId){
item.scheduleId=item.shiftId
const shift = record.attendanceList.find(i => item.shiftId == i.id); const shift = record.attendanceList.find(i => item.shiftId == i.id);
let str = '' let str = ''
if (shift.isRest) { if (shift.isRest) {
@@ -135,7 +134,7 @@ const [BasicModal, modalApi] = useVbenModal({
shiftId: null, shiftId: null,
}) })
}) })
settingData.cycleData = [{scheduleId: ''}, {scheduleId: ''}]; settingData.cycleData = [{shiftId: ''}, {shiftId: ''}];
} }
await markInitialized(); await markInitialized();
modalApi.modalLoading(false); modalApi.modalLoading(false);
@@ -154,7 +153,7 @@ async function handleConfirm() {
if (data.attendanceType == 1) { if (data.attendanceType == 1) {
let hasError = true; let hasError = true;
settingData.cycleData.some((item, index) => { settingData.cycleData.some((item, index) => {
if (!item.scheduleId) { if (!item.shiftId) {
hasError = false hasError = false
message.warning('请选择周期天数对应班次。'); message.warning('请选择周期天数对应班次。');
return; return;
@@ -252,7 +251,7 @@ function handleShiftList(list: any[]) {
function addCycleHandle() { function addCycleHandle() {
if (settingData.cycleData.length < 31) { if (settingData.cycleData.length < 31) {
settingData.cycleData.push({ settingData.cycleData.push({
scheduleId: '', shiftId: '',
}) })
} else { } else {
message.warning('周期天数最多31天。'); message.warning('周期天数最多31天。');
@@ -492,7 +491,7 @@ function getUnCheckInData(val: any) {
<Select <Select
ref="select" ref="select"
style="width: 100%" style="width: 100%"
v-model:value="record.scheduleId" v-model:value="record.shiftId"
placeholder="请选择班次" placeholder="请选择班次"
> >
<SelectOption v-for="item in shiftList" :value="item.id"> <SelectOption v-for="item in shiftList" :value="item.id">

View File

@@ -1,15 +1,15 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue'; import {computed, ref} from 'vue';
import { useVbenModal } from '@vben/common-ui'; import {useVbenModal} from '@vben/common-ui';
import { $t } from '@vben/locales'; import {$t} from '@vben/locales';
import { cloneDeep } from '@vben/utils'; import {cloneDeep} from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import {useVbenForm} from '#/adapter/form';
import { buildingAdd, buildingInfo, buildingUpdate } from '#/api/property/building'; import {buildingAdd, buildingInfo, buildingUpdate} from '#/api/property/building';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import { modalSchema } from './data'; import {modalSchema} from './data';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
@@ -34,7 +34,7 @@ const [BasicForm, formApi] = useVbenForm({
wrapperClass: 'grid-cols-2', wrapperClass: 'grid-cols-2',
}); });
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff( const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
{ {
initializedGetter: defaultFormValueGetter(formApi), initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi), currentGetter: defaultFormValueGetter(formApi),
@@ -54,11 +54,12 @@ const [BasicModal, modalApi] = useVbenModal({
} }
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string }; const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await buildingInfo(id); const record = await buildingInfo(id);
record.buildType = record.buildType.toString();
await formApi.setValues(record); await formApi.setValues(record);
} }
await markInitialized(); await markInitialized();
@@ -70,7 +71,7 @@ const [BasicModal, modalApi] = useVbenModal({
async function handleConfirm() { async function handleConfirm() {
try { try {
modalApi.lock(true); modalApi.lock(true);
const { valid } = await formApi.validate(); const {valid} = await formApi.validate();
if (!valid) { if (!valid) {
return; return;
} }
@@ -95,7 +96,7 @@ async function handleClosed() {
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm /> <BasicForm/>
</BasicModal> </BasicModal>
</template> </template>

View File

@@ -105,12 +105,20 @@ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '总层数', label: '总层数',
fieldName: 'floorCount', fieldName: 'floorCount',
component: 'Input', component: 'InputNumber',
componentProps: {
min:1,
precision:0,
},
}, },
{ {
label: '单元数', label: '单元数',
fieldName: 'unitCount', fieldName: 'unitCount',
component: 'Input', component: 'InputNumber',
componentProps: {
min:1,
precision:0,
},
}, },
{ {
label: '建筑类型', label: '建筑类型',
@@ -124,14 +132,17 @@ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '电梯数量', label: '电梯数量',
fieldName: 'elevatorCount', fieldName: 'elevatorCount',
component: 'Input', component: 'InputNumber',
componentProps: {
min:0,
precision:0,
},
}, },
{ {
label: '竣工日期', label: '竣工日期',
fieldName: 'completionDate', fieldName: 'completionDate',
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
showTime: true,
format: 'YYYY-MM-DD', format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD', valueFormat: 'YYYY-MM-DD',
}, },

View File

@@ -41,9 +41,19 @@ export const columns: VxeGridProps['columns'] = [
title: '地址', title: '地址',
field: 'location', field: 'location',
}, },
// {
// title: '计划完成时间',
// field: 'planCompleTime',
// },
{ {
title: '计划完成时间', title: '创建时间',
field: 'planCompleTime', field: 'createTime',
width: 100,
},
{
title: '备注',
field: 'remark',
width: 100,
}, },
{ {
field: 'action', field: 'action',

View File

@@ -58,8 +58,14 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="具体位置"> <DescriptionsItem label="具体位置">
{{ orderDetail.location }} {{ orderDetail.location }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="计划完成时间"> <DescriptionsItem label="创建时间">
{{ orderDetail.planCompleTime }} {{ orderDetail.createTime }}
</DescriptionsItem>
<!-- <DescriptionsItem label="计划完成时间">-->
<!-- {{ orderDetail.planCompleTime }}-->
<!-- </DescriptionsItem>-->
<DescriptionsItem label="备注">
{{ orderDetail.remark }}
</DescriptionsItem> </DescriptionsItem>
</Descriptions> </Descriptions>
<Divider orientation="left" orientation-margin="0px"> <Divider orientation="left" orientation-margin="0px">

View File

@@ -53,11 +53,11 @@ export const columns: VxeGridProps['columns'] = [
field: 'location', field: 'location',
width: 100, width: 100,
}, },
{ // {
title: '计划完成时间', // title: '计划完成时间',
field: 'planCompleTime', // field: 'planCompleTime',
width: 100, // width: 100,
}, // },
{ {
title: '完成时间', title: '完成时间',
field: 'compleTime', field: 'compleTime',
@@ -87,6 +87,16 @@ export const columns: VxeGridProps['columns'] = [
}, },
}, },
}, },
{
title: '创建时间',
field: 'createTime',
width: 100,
},
{
title: '备注',
field: 'remark',
width: 100,
},
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',

View File

@@ -64,12 +64,15 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="具体位置" :span="2"> <DescriptionsItem label="具体位置" :span="2">
{{ orderDetail.location }} {{ orderDetail.location }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="计划完成时间"> <!-- <DescriptionsItem label="计划完成时间">-->
{{ orderDetail.planCompleTime }} <!-- {{ orderDetail.planCompleTime }}-->
</DescriptionsItem> <!-- </DescriptionsItem>-->
<DescriptionsItem label="完成时间"> <DescriptionsItem label="完成时间">
{{ orderDetail.compleTime }} {{ orderDetail.compleTime }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="创建时间">
{{ orderDetail.createTime }}
</DescriptionsItem>
<DescriptionsItem label="服务评价"> <DescriptionsItem label="服务评价">
<Rate :value="orderDetail.serviceEvalua" disabled/> <Rate :value="orderDetail.serviceEvalua" disabled/>
</DescriptionsItem> </DescriptionsItem>
@@ -78,6 +81,9 @@ async function handleOpenChange(open: boolean) {
:is="orderDetail.isTimeOut ? renderDict(orderDetail.isTimeOut,'wy_sf') : ''" :is="orderDetail.isTimeOut ? renderDict(orderDetail.isTimeOut,'wy_sf') : ''"
/> />
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="备注">
{{ orderDetail.remark }}
</DescriptionsItem>
</Descriptions> </Descriptions>
<Divider orientation="left" orientation-margin="0px"> <Divider orientation="left" orientation-margin="0px">
处理记录 处理记录

View File

@@ -64,10 +64,20 @@ export const columns: VxeGridProps['columns'] = [
width: 100, width: 100,
}, },
{ {
title: '计划完成时间', title: '处理权重',
field: 'planCompleTime', field: 'processingWeight',
slots: {
default: ({row}) => {
return renderDict(row.processingWeight, 'pro_processing_weight');
},
},
width: 100, width: 100,
}, },
// {
// title: '计划完成时间',
// field: 'planCompleTime',
// width: 100,
// },
{ {
title: '完成时间', title: '完成时间',
field: 'compleTime', field: 'compleTime',
@@ -85,7 +95,6 @@ export const columns: VxeGridProps['columns'] = [
}); });
}, },
}, },
}, },
{ {
title: '是否超时', title: '是否超时',
@@ -94,10 +103,19 @@ export const columns: VxeGridProps['columns'] = [
slots: { slots: {
default: ({row}) => { default: ({row}) => {
return row.isTimeOut ? renderDict(row.isTimeOut, 'wy_sf') : ''; return row.isTimeOut ? renderDict(row.isTimeOut, 'wy_sf') : '';
}, },
}, },
}, },
{
title: '创建时间',
field: 'createTime',
width: 100,
},
{
title: '备注',
field: 'remark',
width: 100,
},
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
@@ -173,18 +191,18 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input', component: 'Input',
rules: 'selectRequired', rules: 'selectRequired',
}, },
{ // {
label: '计划完成时间', // label: '计划完成时间',
fieldName: 'planCompleTime', // fieldName: 'planCompleTime',
component: 'DatePicker', // component: 'DatePicker',
componentProps: { // componentProps: {
showTime: true, // showTime: true,
format: 'YYYY-MM-DD HH:mm:ss', // format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss', // valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, // },
labelWidth: 110, // labelWidth: 110,
rules: 'selectRequired', // rules: 'selectRequired',
}, // },
// { // {
// label: '完成时间', // label: '完成时间',
// fieldName: 'compleTime', // fieldName: 'compleTime',
@@ -196,12 +214,12 @@ export const modalSchema: FormSchemaGetter = () => [
// }, // },
// rules: 'selectRequired', // rules: 'selectRequired',
// }, // },
// { {
// label: '评价', label: '备注',
// fieldName: 'serviceEvalua', fieldName: 'remarkremark',
// component: 'Rate', component: 'Textarea',
// rules: 'required', rules: 'required',
// }, },
// { // {
// label: '是否超时', // label: '是否超时',
// fieldName: 'isTimeOut', // fieldName: 'isTimeOut',

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import {computed, ref, shallowRef} from 'vue'; import { ref, shallowRef} from 'vue';
import {useVbenModal} from '@vben/common-ui'; import {useVbenModal} from '@vben/common-ui';
import {Descriptions, DescriptionsItem, Timeline, TimelineItem, Rate,Divider} from 'ant-design-vue'; import {Descriptions, DescriptionsItem, Timeline, TimelineItem, Rate,Divider} from 'ant-design-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@@ -7,7 +7,7 @@ import duration from 'dayjs/plugin/duration';
import relativeTime from 'dayjs/plugin/relativeTime'; import relativeTime from 'dayjs/plugin/relativeTime';
import {renderDict} from "#/utils/render"; import {renderDict} from "#/utils/render";
import {workOrdersInfo} from "#/api/property/businessManagement/workOrders"; import {workOrdersInfo} from "#/api/property/businessManagement/workOrders";
import type {WorkOrdersVO} from "#/api/property/businessManagement/workOrders/model"; import type {HandleRecords, WorkOrdersVO} from "#/api/property/businessManagement/workOrders/model";
dayjs.extend(duration); dayjs.extend(duration);
dayjs.extend(relativeTime); dayjs.extend(relativeTime);
@@ -20,7 +20,7 @@ const [BasicModal, modalApi] = useVbenModal({
}); });
const orderDetail = shallowRef<null | WorkOrdersVO>(null); const orderDetail = shallowRef<null | WorkOrdersVO>(null);
const handleRecords=ref<any[]>([]) const handleRecords=ref<HandleRecords[]>([])
async function handleOpenChange(open: boolean) { async function handleOpenChange(open: boolean) {
if (!open) { if (!open) {
return null; return null;
@@ -64,19 +64,32 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="具体位置" :span="2"> <DescriptionsItem label="具体位置" :span="2">
{{ orderDetail.location }} {{ orderDetail.location }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="计划完成时间"> <!-- <DescriptionsItem label="计划完成时间">-->
{{ orderDetail.planCompleTime }} <!-- {{ orderDetail.planCompleTime }}-->
<!-- </DescriptionsItem>-->
<DescriptionsItem label="创建时间">
{{ orderDetail.createTime }}
</DescriptionsItem>
<DescriptionsItem label="备注">
{{ orderDetail.remark }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="完成时间"> <DescriptionsItem label="完成时间">
{{ orderDetail.compleTime }} {{ orderDetail.compleTime }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="服务评价"> <DescriptionsItem label="是否超时" v-if="orderDetail.isTimeOut!=null">
<component
:is="renderDict(orderDetail.isTimeOut,'wy_sf')"
/>
</DescriptionsItem>
<DescriptionsItem label="服务评价" v-if="orderDetail.serviceEvalua!=null">
<Rate :value="orderDetail.serviceEvalua" disabled/> <Rate :value="orderDetail.serviceEvalua" disabled/>
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="是否超时"> <DescriptionsItem label="评价内容" v-if="orderDetail.serviceEvaluaText" :span="2">
<component {{ orderDetail.serviceEvaluaText }}
:is="orderDetail.isTimeOut ? renderDict(orderDetail.isTimeOut,'wy_sf') : ''" </DescriptionsItem>
/> <DescriptionsItem label="评价图片" v-if="orderDetail.imgUrl" :span="2">
{{ orderDetail.imgUrl }}
</DescriptionsItem> </DescriptionsItem>
</Descriptions> </Descriptions>
<Divider orientation="left" orientation-margin="0px"> <Divider orientation="left" orientation-margin="0px">

View File

@@ -6,7 +6,7 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils'; import { cloneDeep, handleNode, getPopupContainer } from '@vben/utils';
import { Button, Table } from 'ant-design-vue'; import { Button, Table } from 'ant-design-vue';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
@@ -43,7 +43,11 @@ const isAudit = ref(false);
const isRefund = ref(false); const isRefund = ref(false);
const rowData = ref<any>({}); const rowData = ref<any>({});
const title = computed(() => { const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : isReadonly.value ? '详情' : $t('pages.common.add'); return isUpdate.value
? $t('pages.common.edit')
: isReadonly.value
? '详情'
: $t('pages.common.add');
}); });
// 用来缓存 cleanList 的完整数据 // 用来缓存 cleanList 的完整数据
@@ -123,9 +127,9 @@ const [BasicModal, modalApi] = useVbenModal({
return null; return null;
} }
// 查询服务地址树形结构 // 查询服务地址树形结构
setupCommunitySelect() setupCommunitySelect();
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id, readonly,audit,refund,row } = modalApi.getData() as { const { id, readonly, audit, refund, row } = modalApi.getData() as {
id?: string; id?: string;
readonly?: boolean; readonly?: boolean;
audit?: boolean; audit?: boolean;
@@ -138,9 +142,9 @@ const [BasicModal, modalApi] = useVbenModal({
isRefund.value = !!refund; isRefund.value = !!refund;
rowData.value = row; rowData.value = row;
//判断是否是编辑状态需要先判断是否是只读状态 //判断是否是编辑状态需要先判断是否是只读状态
if(isReadonly.value){ if (isReadonly.value) {
isUpdate.value = false; isUpdate.value = false;
}else{ } else {
isUpdate.value = !!id; isUpdate.value = !!id;
} }
if ((isUpdate.value || isReadonly.value) && id) { if ((isUpdate.value || isReadonly.value) && id) {
@@ -149,9 +153,9 @@ const [BasicModal, modalApi] = useVbenModal({
if (record.endTime) record.endTime = dayjs(record.endTime); if (record.endTime) record.endTime = dayjs(record.endTime);
editUnitId.value = record.unitId || ''; editUnitId.value = record.unitId || '';
detailTable.value = record.cleanList || []; detailTable.value = record.cleanList || [];
for(const item of record.relationList){ for (const item of record.relationList) {
for(let i = 0; i < detailTable.value.length; i++){ for (let i = 0; i < detailTable.value.length; i++) {
if(item.cleanId === detailTable.value[i].id){ if (item.cleanId === detailTable.value[i].id) {
detailTable.value[i].area = item.areas; detailTable.value[i].area = item.areas;
detailTable.value[i].sumPeices = item.sumPrice; detailTable.value[i].sumPeices = item.sumPrice;
} }
@@ -271,11 +275,11 @@ const detailColumns = [
dataIndex: 'sumPeices', dataIndex: 'sumPeices',
key: 'sumPeices', key: 'sumPeices',
}, },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
fixed: 'right' as const, fixed: 'right' as const,
}, },
]; ];
const [DetailTable, detailTableApi] = useVbenVxeGrid({ const [DetailTable, detailTableApi] = useVbenVxeGrid({
@@ -298,7 +302,6 @@ function handleDetailReload(data: any) {
// 编辑订单服务详情 // 编辑订单服务详情
function handleEditDetailReload(data: any) { function handleEditDetailReload(data: any) {
detailTable.value[data.index] = data; detailTable.value[data.index] = data;
} }
// 删除订单服务详情 // 删除订单服务详情
function handleDeleteDetail(record: any, index: number) { function handleDeleteDetail(record: any, index: number) {
@@ -342,11 +345,15 @@ async function handleConfirm() {
data.unit = unitObj ? unitObj.name : data.unit || ''; data.unit = unitObj ? unitObj.name : data.unit || '';
data.name = cleanObj ? cleanObj.name : data.name || ''; data.name = cleanObj ? cleanObj.name : data.name || '';
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : ''; data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
data.sumPeices = Number(totalSumPeices.value) data.sumPeices = Number(totalSumPeices.value);
data.cleanList = detailTable.value; data.cleanList = detailTable.value;
if (data.starTime) data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss'); if (data.starTime)
if (data.endTime) data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss'); data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
isUpdate.value ? await clean_orderUpdate({...data,id:editCleanOrderId.value}) : await clean_orderAdd(data); 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);
resetInitialized(); resetInitialized();
emit('reload'); emit('reload');
modalApi.close(); modalApi.close();
@@ -359,17 +366,17 @@ async function handleConfirm() {
async function handleClosed() { async function handleClosed() {
await formApi.resetForm(); await formApi.resetForm();
detailTable.value = [];//清空详情表格 detailTable.value = []; //清空详情表格
resetInitialized(); resetInitialized();
} }
// 获取服务地址 // 获取服务地址
async function setupCommunitySelect() { async function setupCommunitySelect() {
const areaList = await communityTree(5); const areaList = await communityTree(4);
// 选中后显示在输入框的值 即父节点 / 子节点 // 选中后显示在输入框的值 即父节点 / 子节点
// addFullName(areaList, 'areaName', ' / '); // addFullName(areaList, 'areaName', ' / ');
const splitStr = '/'; const splitStr = '/';
handleNode(areaList, 'label', splitStr, function (node: any) { handleNode(areaList, 'label', splitStr, function (node: any) {
if (node.level != 5) { if (node.level != 4) {
node.disabled = true; node.disabled = true;
} }
}); });
@@ -399,58 +406,65 @@ async function setupCommunitySelect() {
]); ]);
} }
async function handleAudit(params: any) { async function handleAudit(params: any) {
modalApi.lock(true); modalApi.lock(true);
const { valid } = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) { if (!valid) {
return; return;
} }
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
if(rowData.value){ if (rowData.value) {
data.state = rowData.value.state; data.state = rowData.value.state;
data.isUnbooking = rowData.value?.isUnbooking; data.isUnbooking = rowData.value?.isUnbooking;
} }
// 单位数据缓存 // 单位数据缓存
if (unitListData.length === 0) { if (unitListData.length === 0) {
const res = await resident_unitList(); const res = await resident_unitList();
unitListData = res.rows || []; unitListData = res.rows || [];
} }
// 劳务数据缓存 cleanListData 已有 // 劳务数据缓存 cleanListData 已有
// 查找label // 查找label
const unitObj = unitListData.find((item) => item.id === data.unitId); const unitObj = unitListData.find((item) => item.id === data.unitId);
const cleanObj = cleanListData.find((item) => item.id === data.name); const cleanObj = cleanListData.find((item) => item.id === data.name);
data.unit = unitObj ? unitObj.name : data.unit || ''; data.unit = unitObj ? unitObj.name : data.unit || '';
data.name = cleanObj ? cleanObj.name : data.name || ''; data.name = cleanObj ? cleanObj.name : data.name || '';
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : ''; data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
data.sumPeices = Number(totalSumPeices.value) data.sumPeices = Number(totalSumPeices.value);
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss'); 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.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
// data.sumPeices = parseInt(totalSumPeices.value, 10); // data.sumPeices = parseInt(totalSumPeices.value, 10);
// 组装 cleanIds // 组装 cleanIds
// data.cleanIds = detailTable.value.map((item: any) => item.id); // data.cleanIds = detailTable.value.map((item: any) => item.id);
data.cleanList = detailTable.value; data.cleanList = detailTable.value;
if(params.isRefund){ if (params.isRefund) {
data.isUnbooking = 1; data.isUnbooking = 1;
} else if(params.isAudit){ } else if (params.isAudit) {
data.state = 1; data.state = 1;
}else{ } else {
data.state = 2; data.state = 2;
} }
// 0未审核 1审核通过 2审核不通过 // 0未审核 1审核通过 2审核不通过
await clean_orderUpdate({...data,id:editCleanOrderId.value}) await clean_orderUpdate({ ...data, id: editCleanOrderId.value });
resetInitialized(); resetInitialized();
emit('reload'); emit('reload');
modalApi.close(); modalApi.close();
} }
</script> </script>
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm> <BasicForm> </BasicForm>
</BasicForm>
<!-- 添加订单详情部分 --> <!-- 添加订单详情部分 -->
<div class="mt-4"> <div class="mt-4">
<div class="mb-2 flex items-center justify-between"> <div class="mb-2 flex items-center justify-between">
<h3 class="text-lg font-medium">{{ isUpdate ? '编辑保洁订单详情' : isReadonly ? '查看保洁订单详情' : '添加保洁订单详情' }} </h3> <h3 class="text-lg font-medium">
{{
isUpdate
? '编辑保洁订单详情'
: isReadonly
? '查看保洁订单详情'
: '添加保洁订单详情'
}}
</h3>
<a-button v-if="!isReadonly" type="primary" @click="handleAddDetail"> <a-button v-if="!isReadonly" type="primary" @click="handleAddDetail">
{{ $t('pages.common.add') }} {{ $t('pages.common.add') }}
</a-button> </a-button>
@@ -468,10 +482,26 @@ async function handleAudit(params: any) {
<template v-if="isReadonly"> <template v-if="isReadonly">
<Button @click="handleViewDetail(record)">查看</Button> <Button @click="handleViewDetail(record)">查看</Button>
</template> </template>
<template v-else > <template v-else>
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleViewDetail(record)">查看</Button> <Button
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleEditDetail(record, index)">编辑</Button> type="primary"
<Button danger size="small" @click="handleDeleteDetail(record, index)"> 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)"
>
删除 删除
</Button> </Button>
</template> </template>
@@ -480,17 +510,26 @@ async function handleAudit(params: any) {
</Table> </Table>
<div>费用合计{{ totalSumPeices }}</div> <div>费用合计{{ totalSumPeices }}</div>
</div> </div>
<CleanDetailModal @reload="handleDetailReload" @editReload="handleEditDetailReload"/> <CleanDetailModal
@reload="handleDetailReload"
@editReload="handleEditDetailReload"
/>
<template #footer v-if="isAudit"> <template #footer v-if="isAudit">
<a-button @click="modalApi.close()">取消</a-button> <a-button @click="modalApi.close()">取消</a-button>
<a-button type="primary" @click="handleAudit({isAudit:true})">审核通过</a-button> <a-button type="primary" @click="handleAudit({ isAudit: true })"
<a-button danger @click="handleAudit({isAudit:false})">审核通过</a-button> >审核通过</a-button
>
<a-button danger @click="handleAudit({ isAudit: false })"
>审核不通过</a-button
>
</template> </template>
<template #footer v-if="isRefund"> <template #footer v-if="isRefund">
<a-button @click="modalApi.close()">取消</a-button> <a-button @click="modalApi.close()">取消</a-button>
<a-button type="primary" @click="handleAudit({isRefund:true})">退定</a-button> <a-button type="primary" @click="handleAudit({ isRefund: true })"
>退定</a-button
>
</template> </template>
</BasicModal> </BasicModal>
</template> </template>
<style scoped> <style scoped>

View File

@@ -5,6 +5,10 @@ import { resident_unitList } from '#/api/property/resident/unit';
import { useCleanStore } from '#/store'; import { useCleanStore } from '#/store';
import type { FormSchema } from '../../../../../../../packages/@core/ui-kit/form-ui/src/types'; import type { FormSchema } from '../../../../../../../packages/@core/ui-kit/form-ui/src/types';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import {h} from "vue";
import {Rate} from "ant-design-vue";
import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
const cleanStore = useCleanStore(); const cleanStore = useCleanStore();
export const querySchema: (areaList: any[]) => FormSchema[] = (areaList) => [ export const querySchema: (areaList: any[]) => FormSchema[] = (areaList) => [
@@ -111,7 +115,30 @@ export const columns: VxeGridProps['columns'] = [
field: 'phone', field: 'phone',
width: '250', width: '250',
}, },
{ {
title: '保洁类型',
field: 'type',
width: 180,
slots: {
default: ({row}) => {
return renderDict(row.type, 'pro_cleaning_type');
},
},
},
{
title: '评价',
field: 'serviceEvalua',
width: 180,
slots: {
default: ({row}) => {
return h(Rate, {
value: row.serviceEvalua || 0,
disabled: true,
});
},
},
},
{
title: '订单状态', title: '订单状态',
field: 'state', field: 'state',
width: 'auto', width: 'auto',
@@ -222,4 +249,25 @@ export const modalSchema: (isReadonly: boolean) => FormSchema[] = (isReadonly) =
}, },
rules: 'required', 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
},
rules: 'required',
},
]; ];

View File

@@ -23,7 +23,7 @@ import { onMounted, ref } from 'vue';
import { communityTree } from '#/api/property/community'; import { communityTree } from '#/api/property/community';
const areaList = ref<any>(null); const areaList = ref<any>(null);
onMounted(async () => { onMounted(async () => {
areaList.value = await communityTree(5); areaList.value = await communityTree(4);
}); });
const formOptions: VbenFormProps = { const formOptions: VbenFormProps = {
commonConfig: { commonConfig: {

View File

@@ -3,15 +3,19 @@ import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { costMeterWaterAdd, costMeterWaterInfo, costMeterWaterUpdate } from '#/api/property/costMeterWater'; import {
costMeterWaterAdd,
costMeterWaterInfo,
costMeterWaterUpdate,
} from '#/api/property/costMeterWater';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils'; import { cloneDeep, handleNode, getPopupContainer } from '@vben/utils';
import { communityTree } from '#/api/property/community'; import { communityTree } from '#/api/property/community';
import { costItemSettingList} from '#/api/property/costManagement/costItemSetting'; import { costItemSettingList } from '#/api/property/costManagement/costItemSetting';
import { meterReadingTypeList } from '#/api/property/costManagement/meterReadingType'; import { meterReadingTypeList } from '#/api/property/costManagement/meterReadingType';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import {ultimoWater} from '#/api/property/costMeterWater' import { ultimoWater } from '#/api/property/costMeterWater';
import {personList} from '#/api/property/resident/person' import { personList } from '#/api/property/resident/person';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
const costItemsOptions = ref<any>([]); const costItemsOptions = ref<any>([]);
const meterTypeOptions = ref<any>([]); const meterTypeOptions = ref<any>([]);
@@ -20,21 +24,21 @@ const isUpdate = ref(false);
const title = computed(() => { const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
}); });
const schema =[ const schema = [
{ {
label: '主键ID', label: '主键ID',
fieldName: 'id', fieldName: 'id',
component: 'Input', component: 'Input',
dependencies: { dependencies: {
show: () => false, show: () => false,
triggerFields: [''], triggerFields: [''],
}, },
}, },
{ {
label: '房间号', label: '房间号',
fieldName: 'roomId', fieldName: 'roomId',
component: 'TreeSelect', component: 'TreeSelect',
rules: 'required' rules: 'required',
}, },
{ {
label: '业主', label: '业主',
@@ -43,13 +47,13 @@ const schema =[
rules: 'required', rules: 'required',
componentProps: { componentProps: {
api: async () => { api: async () => {
const res = await personList({pageSize:1000000000,pageNum:1}); const res = await personList({ pageSize: 1000000000, pageNum: 1 });
return res.rows.map((item: any) => ({ return res.rows.map((item: any) => ({
label: item.userName, label: item.userName,
value: item.id, value: item.id,
})); }));
}, },
} },
}, },
{ {
label: '费用类型', label: '费用类型',
@@ -58,21 +62,29 @@ const schema =[
rules: 'required', rules: 'required',
componentProps: { componentProps: {
options: getDictOptions('wy_cbfylx'), options: getDictOptions('wy_cbfylx'),
onChange: async (value:any) => { onChange: async (value: any) => {
// 请求并更新下拉 // 请求并更新下拉
if (!value) { if (!value) {
costItemsOptions.value = []; costItemsOptions.value = [];
meterTypeOptions.value = []; meterTypeOptions.value = [];
isMeterType.value = false isMeterType.value = false;
} else { } else {
isMeterType.value = true isMeterType.value = true;
const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: value }); const costItemsRes = await costItemSettingList({
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({ pageSize: 1000000000,
pageNum: 1,
costType: value,
});
costItemsOptions.value = (costItemsRes?.rows || []).map((item) => ({
label: item.chargeItem, label: item.chargeItem,
value: item.id, value: item.id,
})); }));
const meterTypeRes = await meterReadingTypeList({ pageSize: 1000000000, pageNum: 1, costType: value == '5' ? 0 : 1 }); const meterTypeRes = await meterReadingTypeList({
meterTypeOptions.value = (meterTypeRes?.rows || []).map(item => ({ pageSize: 1000000000,
pageNum: 1,
costType: value == '5' ? 0 : 1,
});
meterTypeOptions.value = (meterTypeRes?.rows || []).map((item) => ({
label: item.name, label: item.name,
value: item.id, value: item.id,
})); }));
@@ -100,8 +112,8 @@ const schema =[
meterTypeId: '', meterTypeId: '',
}); });
console.log(await formApi.getValues()); console.log(await formApi.getValues());
} },
} },
}, },
{ {
label: '收费项目', label: '收费项目',
@@ -111,7 +123,7 @@ const schema =[
componentProps: { componentProps: {
options: costItemsOptions.value, options: costItemsOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
} },
}, },
{ {
label: '抄表类型', label: '抄表类型',
@@ -121,7 +133,7 @@ const schema =[
componentProps: { componentProps: {
options: meterTypeOptions.value, options: meterTypeOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
} },
}, },
{ {
label: '上期止度', label: '上期止度',
@@ -144,7 +156,7 @@ const schema =[
format: 'YYYY-MM-DD HH:mm:ss', format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, },
disabled:true disabled: true,
}, },
{ {
label: '本期读表时间', label: '本期读表时间',
@@ -161,7 +173,7 @@ const schema =[
label: '说明', label: '说明',
fieldName: 'remark', fieldName: 'remark',
component: 'Input', component: 'Input',
} },
]; ];
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
@@ -172,7 +184,7 @@ const [BasicForm, formApi] = useVbenForm({
// 通用配置项 会影响到所有表单项 // 通用配置项 会影响到所有表单项
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
} },
}, },
schema: schema, schema: schema,
showDefaultActions: false, showDefaultActions: false,
@@ -197,44 +209,51 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) { if (!isOpen) {
return null; return null;
} }
isMeterType.value = true isMeterType.value = true;
setupCommunitySelect() setupCommunitySelect();
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await costMeterWaterInfo(id); const record = await costMeterWaterInfo(id);
console.log(1,record); console.log(1, record);
const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: record.costType }); const costItemsRes = await costItemSettingList({
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({ pageSize: 1000000000,
pageNum: 1,
costType: record.costType,
});
costItemsOptions.value = (costItemsRes?.rows || []).map((item) => ({
label: item.chargeItem, label: item.chargeItem,
value: item.id, value: item.id,
})); }));
const meterTypeRes = await meterReadingTypeList({ pageSize: 1000000000, pageNum: 1, costType: record.costType == '5' ? 0 : 1 }); const meterTypeRes = await meterReadingTypeList({
meterTypeOptions.value = (meterTypeRes?.rows || []).map(item => ({ pageSize: 1000000000,
pageNum: 1,
costType: record.costType == '5' ? 0 : 1,
});
meterTypeOptions.value = (meterTypeRes?.rows || []).map((item) => ({
label: item.name, label: item.name,
value: item.id, value: item.id,
})); }));
formApi.updateSchema([ formApi.updateSchema([
{ {
fieldName: 'itemId', fieldName: 'itemId',
componentProps: { componentProps: {
options: costItemsOptions.value, options: costItemsOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
},
}, },
{ },
fieldName: 'meterTypeId', {
componentProps: { fieldName: 'meterTypeId',
options: meterTypeOptions.value, componentProps: {
disabled: !isMeterType.value, options: meterTypeOptions.value,
}, disabled: !isMeterType.value,
}, },
]); },
]);
await formApi.setValues(record); await formApi.setValues(record);
console.log(2,await formApi.getValues()); console.log(2, await formApi.getValues());
} }
await markInitialized(); await markInitialized();
@@ -253,29 +272,31 @@ async function handleConfirm() {
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
console.log(data); console.log(data);
await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data)); await (isUpdate.value
? costMeterWaterUpdate(data)
: costMeterWaterAdd(data));
resetInitialized(); resetInitialized();
//必须要手动清空不然ref会保留值 //必须要手动清空不然ref会保留值
costItemsOptions.value = []; costItemsOptions.value = [];
meterTypeOptions.value = []; meterTypeOptions.value = [];
isMeterType.value = false isMeterType.value = false;
// 更新表单下拉 // 更新表单下拉
formApi.updateSchema([ formApi.updateSchema([
{ {
fieldName: 'itemId', fieldName: 'itemId',
componentProps: { componentProps: {
options: costItemsOptions.value, options: costItemsOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
}, },
}, },
{ {
fieldName: 'meterTypeId', fieldName: 'meterTypeId',
componentProps: { componentProps: {
options: meterTypeOptions.value, options: meterTypeOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
}, },
}, },
]); ]);
emit('reload'); emit('reload');
modalApi.close(); modalApi.close();
} catch (error) { } catch (error) {
@@ -287,37 +308,37 @@ async function handleConfirm() {
async function handleClosed() { async function handleClosed() {
await formApi.resetForm(); await formApi.resetForm();
await formApi.setValues({}) await formApi.setValues({});
costItemsOptions.value = []; costItemsOptions.value = [];
meterTypeOptions.value = []; meterTypeOptions.value = [];
isMeterType.value = false isMeterType.value = false;
// 更新表单下拉 // 更新表单下拉
formApi.updateSchema([ formApi.updateSchema([
{ {
fieldName: 'itemId', fieldName: 'itemId',
componentProps: { componentProps: {
options: costItemsOptions.value, options: costItemsOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
}, },
}, },
{ {
fieldName: 'meterTypeId', fieldName: 'meterTypeId',
componentProps: { componentProps: {
options: meterTypeOptions.value, options: meterTypeOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
}, },
}, },
]); ]);
resetInitialized(); resetInitialized();
} }
// 获取服务地址 // 获取服务地址
async function setupCommunitySelect() { async function setupCommunitySelect() {
const areaList = await communityTree(5); const areaList = await communityTree(4);
// 选中后显示在输入框的值 即父节点 / 子节点 // 选中后显示在输入框的值 即父节点 / 子节点
// addFullName(areaList, 'areaName', ' / '); // addFullName(areaList, 'areaName', ' / ');
const splitStr = '/'; const splitStr = '/';
handleNode(areaList, 'label', splitStr, function (node: any) { handleNode(areaList, 'label', splitStr, function (node: any) {
if (node.level != 5) { if (node.level != 4) {
node.disabled = true; node.disabled = true;
} }
}); });
@@ -342,17 +363,17 @@ async function setupCommunitySelect() {
// 选中后显示在输入框的值 // 选中后显示在输入框的值
treeNodeLabelProp: 'fullName', treeNodeLabelProp: 'fullName',
onChange: async (value: any) => { onChange: async (value: any) => {
if(!value){ if (!value) {
await formApi.setValues({preDegrees:''}) await formApi.setValues({ preDegrees: '' });
await formApi.setValues({preReadingTime:''}) await formApi.setValues({ preReadingTime: '' });
}else{ } else {
const data = await ultimoWater(value) const data = await ultimoWater(value);
if(data){ if (data) {
await formApi.setValues({preDegrees:data.curDegrees}) await formApi.setValues({ preDegrees: data.curDegrees });
await formApi.setValues({preReadingTime:data.curReadingTime}) await formApi.setValues({ preReadingTime: data.curReadingTime });
}
} }
} },
},
}), }),
fieldName: 'roomId', fieldName: 'roomId',
}, },

View File

@@ -1,25 +1,25 @@
<script setup lang="ts"> <script setup lang="ts">
import {computed, ref} from 'vue'; import { computed, ref } from 'vue';
import {useVbenModal} from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import {$t} from '@vben/locales'; import { $t } from '@vben/locales';
import {cloneDeep, handleNode} from '@vben/utils'; import { cloneDeep, handleNode } from '@vben/utils';
import {useVbenForm} from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { import {
houseChargeAdd, houseChargeAdd,
houseChargeInfo, houseChargeInfo,
houseChargeUpdate houseChargeUpdate,
} from '#/api/property/costManagement/houseCharge'; } from '#/api/property/costManagement/houseCharge';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import {modalSchema} from './data'; import { modalSchema } from './data';
import {communityTree} from "#/api/property/community"; import { communityTree } from '#/api/property/community';
import {costItemSettingList} from "#/api/property/costManagement/costItemSetting"; import { costItemSettingList } from '#/api/property/costManagement/costItemSetting';
import type {CostItemSettingVO} from "#/api/property/costManagement/costItemSetting/model"; import type { CostItemSettingVO } from '#/api/property/costManagement/costItemSetting/model';
import {getDictOptions} from "#/utils/dict"; import { getDictOptions } from '#/utils/dict';
import {personList} from "#/api/property/resident/person"; import { personList } from '#/api/property/resident/person';
import {renderDictValue} from "#/utils/render"; import { renderDictValue } from '#/utils/render';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
@@ -38,14 +38,14 @@ const [BasicForm, formApi] = useVbenForm({
// 通用配置项 会影响到所有表单项 // 通用配置项 会影响到所有表单项
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
} },
}, },
schema: modalSchema(), schema: modalSchema(),
showDefaultActions: false, showDefaultActions: false,
wrapperClass: 'grid-cols-2', wrapperClass: 'grid-cols-2',
}); });
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff( const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{ {
initializedGetter: defaultFormValueGetter(formApi), initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi), currentGetter: defaultFormValueGetter(formApi),
@@ -64,16 +64,16 @@ const [BasicModal, modalApi] = useVbenModal({
return null; return null;
} }
modalApi.modalLoading(true); modalApi.modalLoading(true);
await initRoomOptions() await initRoomOptions();
await queryCostItemOptions() await queryCostItemOptions();
await initCostTypeOptions() await initCostTypeOptions();
await queryPersonData() await queryPersonData();
const {id} = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await houseChargeInfo(id); const record = await houseChargeInfo(id);
record.chargeTime = [record.startTime, record.endTime] record.chargeTime = [record.startTime, record.endTime];
await formApi.setValues(record); await formApi.setValues(record);
} }
await markInitialized(); await markInitialized();
@@ -85,15 +85,15 @@ const [BasicModal, modalApi] = useVbenModal({
async function handleConfirm() { async function handleConfirm() {
try { try {
modalApi.lock(true); modalApi.lock(true);
const {valid} = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) { if (!valid) {
return; return;
} }
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次 // getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
if (data.chargeTime && data.chargeTime.length) { if (data.chargeTime && data.chargeTime.length) {
data.startTime = data.chargeTime[0] data.startTime = data.chargeTime[0];
data.endTime = data.chargeTime[1] data.endTime = data.chargeTime[1];
} }
await (isUpdate.value ? houseChargeUpdate(data) : houseChargeAdd(data)); await (isUpdate.value ? houseChargeUpdate(data) : houseChargeAdd(data));
resetInitialized(); resetInitialized();
@@ -115,10 +115,10 @@ async function handleClosed() {
* 房间数据 * 房间数据
*/ */
async function initRoomOptions() { async function initRoomOptions() {
const roomList = await communityTree(5); const roomList = await communityTree(4);
const splitStr = '/'; const splitStr = '/';
handleNode(roomList, 'label', splitStr, function (node: any) { handleNode(roomList, 'label', splitStr, function (node: any) {
if (node.level != 5) { if (node.level != 4) {
node.disabled = true; node.disabled = true;
} }
}); });
@@ -136,7 +136,7 @@ async function initRoomOptions() {
showSearch: true, showSearch: true,
treeData: roomList, treeData: roomList,
treeDefaultExpandAll: true, treeDefaultExpandAll: true,
treeLine: {showLeafIcon: false}, treeLine: { showLeafIcon: false },
// 筛选的字段 // 筛选的字段
treeNodeFilterProp: 'label', treeNodeFilterProp: 'label',
// 选中后显示在输入框的值 // 选中后显示在输入框的值
@@ -150,77 +150,93 @@ async function initRoomOptions() {
/** /**
* 查询费用项设置 * 查询费用项设置
*/ */
async function queryCostItemOptions(costType:string) { async function queryCostItemOptions(costType: string) {
let params = { let params = {
pageSize: 1000, pageSize: 1000,
pageNum: 1, pageNum: 1,
costType costType,
} };
const res = await costItemSettingList(params) const res = await costItemSettingList(params);
costItemOptions.value = res.rows costItemOptions.value = res.rows;
formApi.updateSchema([{ formApi.updateSchema([
componentProps: { {
options: costItemOptions.value, componentProps: {
fieldNames: {label: 'chargeItem', value: 'id'}, options: costItemOptions.value,
showSearch: true, fieldNames: { label: 'chargeItem', value: 'id' },
optionFilterProp: 'chargeItem', showSearch: true,
onChange: async (value: string) => { optionFilterProp: 'chargeItem',
if (value) { onChange: async (value: string) => {
const costItem = costItemOptions.value.find(item => item.id == value) if (value) {
if(costItem){ const costItem = costItemOptions.value.find(
await formApi.setFieldValue('remark', `单价:${costItem.unitPrice} 附加费:${costItem.surcharge}`); (item) => item.id == value,
);
if (costItem) {
await formApi.setFieldValue(
'remark',
`单价:${costItem.unitPrice} 附加费:${costItem.surcharge}`,
);
}
} }
} },
} },
fieldName: 'costItemsId',
}, },
fieldName: 'costItemsId' ]);
}])
} }
/** /**
* 初始化费用类型 * 初始化费用类型
*/ */
async function initCostTypeOptions(){ async function initCostTypeOptions() {
formApi.updateSchema([{ formApi.updateSchema([
componentProps: { {
options: getDictOptions('pro_expense_type'), componentProps: {
onChange: async (value: string) => { options: getDictOptions('pro_expense_type'),
if (value) { onChange: async (value: string) => {
await queryCostItemOptions(value) if (value) {
await formApi.setFieldValue('costItemsId', null) await queryCostItemOptions(value);
} await formApi.setFieldValue('costItemsId', null);
} }
},
},
fieldName: 'costType',
}, },
fieldName: 'costType' ]);
}])
} }
async function queryPersonData() { async function queryPersonData() {
let params = { let params = {
pageSize: 1000, pageSize: 1000,
pageNum: 1, pageNum: 1,
} };
const res = await personList(params); const res = await personList(params);
const options = res.rows.map((user) => ({ const options = res.rows.map((user) => ({
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex') label:
+ '-' + user.phone + '-' + user.unitName, user.userName +
'-' +
renderDictValue(user.gender, 'sys_user_sex') +
'-' +
user.phone +
'-' +
user.unitName,
value: user.id, value: user.id,
})); }));
formApi.updateSchema([{ formApi.updateSchema([
componentProps: () => ({ {
options: options, componentProps: () => ({
showSearch: true, options: options,
optionFilterProp: 'label', showSearch: true,
optionLabelProp: 'label', optionFilterProp: 'label',
}), optionLabelProp: 'label',
fieldName: 'personId', }),
}]) fieldName: 'personId',
},
]);
} }
</script> </script>
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm/> <BasicForm />
</BasicModal> </BasicModal>
</template> </template>

View File

@@ -54,7 +54,7 @@ export const modalSchema: FormSchemaGetter = () => [
}, },
{ {
component: 'TreeSelect', component: 'TreeSelect',
fieldName: 'unitId', fieldName: 'buildingId',
defaultValue: undefined, defaultValue: undefined,
label: '社区建筑', label: '社区建筑',
rules: 'selectRequired', rules: 'selectRequired',
@@ -80,11 +80,19 @@ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '房间数量', label: '房间数量',
fieldName: 'roomCount', fieldName: 'roomCount',
component: 'Input', component: 'InputNumber',
componentProps: {
min:0,
precision:0,
},
}, },
{ {
label: '层高', label: '层高',
fieldName: 'floorHeight', fieldName: 'floorHeight',
component: 'Input', component: 'InputNumber',
componentProps: {
min:0,
precision:0,
},
}, },
]; ];

View File

@@ -90,12 +90,12 @@ async function handleConfirm() {
* 初始化城市 * 初始化城市
*/ */
async function setupCommunitySelect() { async function setupCommunitySelect() {
const areaList = await communityTree(3); const areaList = await communityTree(2);//楼层关联建筑
// 选中后显示在输入框的值 即父节点 / 子节点 // 选中后显示在输入框的值 即父节点 / 子节点
// addFullName(areaList, 'areaName', ' / '); // addFullName(areaList, 'areaName', ' / ');
const splitStr = '/'; const splitStr = '/';
handleNode(areaList, 'label', splitStr, function (node: any) { handleNode(areaList, 'label', splitStr, function (node: any) {
if (node.level != 3) { if (node.level != 2) {
node.disabled = true; node.disabled = true;
} }
}); });
@@ -120,7 +120,7 @@ async function setupCommunitySelect() {
// 选中后显示在输入框的值 // 选中后显示在输入框的值
treeNodeLabelProp: 'fullName', treeNodeLabelProp: 'fullName',
}), }),
fieldName: 'unitId', fieldName: 'buildingId',
}, },
]); ]);
} }

View File

@@ -1,18 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import { import {
useVbenVxeGrid, useVbenVxeGrid,
vxeCheckboxChecked, vxeCheckboxChecked,
type VxeGridProps type VxeGridProps
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { import {
@@ -138,8 +134,8 @@ function handleDownloadExcel() {
<a-button <a-button
:disabled="!vxeCheckboxChecked(tableApi)" :disabled="!vxeCheckboxChecked(tableApi)"
danger danger
type="primary" type="primary"
v-access:code="['property:floor:remove']" v-access:code="['property:floor:remove']"
@click="handleMultiDelete"> @click="handleMultiDelete">
{{ $t('pages.common.delete') }} {{ $t('pages.common.delete') }}
</a-button> </a-button>

View File

@@ -2,9 +2,13 @@
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils'; import { cloneDeep, handleNode, getPopupContainer } from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { orderMaintainAdd, orderMaintainInfo, orderMaintainUpdate } from '#/api/property/conservationManagement'; import {
orderMaintainAdd,
orderMaintainInfo,
orderMaintainUpdate,
} from '#/api/property/conservationManagement';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; import { modalSchema } from './data';
import { communityTree } from '#/api/property/community'; import { communityTree } from '#/api/property/community';
@@ -21,7 +25,7 @@ const [BasicForm, formApi] = useVbenForm({
labelWidth: 80, labelWidth: 80,
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
} },
}, },
schema: modalSchema(), schema: modalSchema(),
showDefaultActions: false, showDefaultActions: false,
@@ -45,7 +49,7 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) { if (!isOpen) {
return null; return null;
} }
setupCommunitySelect() setupCommunitySelect();
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
@@ -91,12 +95,12 @@ async function handleClosed() {
// 获取服务地址 // 获取服务地址
async function setupCommunitySelect() { async function setupCommunitySelect() {
const areaList = await communityTree(5); const areaList = await communityTree(4);
// 选中后显示在输入框的值 即父节点 / 子节点 // 选中后显示在输入框的值 即父节点 / 子节点
// addFullName(areaList, 'areaName', ' / '); // addFullName(areaList, 'areaName', ' / ');
const splitStr = '/'; const splitStr = '/';
handleNode(areaList, 'label', splitStr, function (node: any) { handleNode(areaList, 'label', splitStr, function (node: any) {
if (node.level != 5) { if (node.level != 4) {
node.disabled = true; node.disabled = true;
} }
}); });
@@ -132,4 +136,3 @@ async function setupCommunitySelect() {
<BasicForm /> <BasicForm />
</BasicModal> </BasicModal>
</template> </template>

View File

@@ -1,12 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { Button, Table } from 'ant-design-vue'; import { Button, message, Table } from 'ant-design-vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils'; import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { rentalPlanAdd, rentalPlanInfo, rentalPlanUpdate } from '#/api/property/rentalPlan'; import {
rentalPlanAdd,
rentalPlanInfo,
rentalPlanUpdate,
} from '#/api/property/rentalPlan';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; import { modalSchema } from './data';
@@ -19,9 +23,13 @@ const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false); const isUpdate = ref(false);
const isReadonly = ref(false); const isReadonly = ref(false);
const title = computed(() => { const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : isReadonly.value ? '详情' : $t('pages.common.add'); return isUpdate.value
? $t('pages.common.edit')
: isReadonly.value
? '详情'
: $t('pages.common.add');
}); });
const editId = ref<string | number | undefined>('') const editId = ref<string | number | undefined>('');
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
// 默认占满两列 // 默认占满两列
@@ -58,12 +66,15 @@ const [BasicModal, modalApi] = useVbenModal({
return null; return null;
} }
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id, readonly } = modalApi.getData() as { id?: number | string, readonly?: boolean; }; const { id, readonly } = modalApi.getData() as {
id?: number | string;
readonly?: boolean;
};
editId.value = id || ''; editId.value = id || '';
isReadonly.value = !!readonly; isReadonly.value = !!readonly;
if(isReadonly.value){ if (isReadonly.value) {
isUpdate.value = false; isUpdate.value = false;
}else{ } else {
isUpdate.value = !!id; isUpdate.value = !!id;
} }
// 查看与编辑时需要获取详情 // 查看与编辑时需要获取详情
@@ -71,7 +82,11 @@ const [BasicModal, modalApi] = useVbenModal({
const record = await rentalPlanInfo(id); const record = await rentalPlanInfo(id);
// 后端返回绿植产品包列表结构处理 // 后端返回绿植产品包列表结构处理
// detailTable.value = record.productList.map((item:any) => {...item.product,item.productNum,}); // detailTable.value = record.productList.map((item:any) => {...item.product,item.productNum,});
detailTable.value = record.productList.map((item: any) => ({ ...item.product, productNum: item.productNum,productId: item.productId })); detailTable.value = record.productList.map((item: any) => ({
...item.product,
productNum: item.productNum,
productId: item.productId,
}));
await formApi.setValues(record); await formApi.setValues(record);
} }
@@ -93,7 +108,13 @@ async function handleConfirm() {
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
// data.productIds = detailTable.value.map((item:any) => item.productId); // data.productIds = detailTable.value.map((item:any) => item.productId);
data.productList = detailTable.value; data.productList = detailTable.value;
await (isUpdate.value ? rentalPlanUpdate({...data,id:editId.value}) : rentalPlanAdd(data)); if (data.productList.length == 0) {
message.error('请添加植物组合包产品');
return;
}
await (isUpdate.value
? rentalPlanUpdate({ ...data, id: editId.value })
: rentalPlanAdd(data));
resetInitialized(); resetInitialized();
emit('reload'); emit('reload');
modalApi.close(); modalApi.close();
@@ -146,18 +167,19 @@ const detailColumns = [
]; ];
function handleAddDetail() { function handleAddDetail() {
// 传递已选产品id列表 // 传递已选产品id列表
const selectedIds = detailTable.value.map((item: any) => item.productId || item.plantName); const selectedIds = detailTable.value.map(
detailModalApi.setData({ selectedIds,add:true }); (item: any) => item.productId || item.plantName,
);
detailModalApi.setData({ selectedIds, add: true });
detailModalApi.open(); detailModalApi.open();
} }
//添加植物组合包产品 //添加植物组合包产品
function handleDetailReload (data: any) { function handleDetailReload(data: any) {
detailTable.value.push(data); detailTable.value.push(data);
} }
// 编辑植物组合包产品 // 编辑植物组合包产品
function handleEditDetailReload (data: any) { function handleEditDetailReload(data: any) {
detailTable.value[data.index] = data; detailTable.value[data.index] = data;
} }
// 删除植物组合包产品 // 删除植物组合包产品
function handleDeleteDetail(record: any, index: number) { function handleDeleteDetail(record: any, index: number) {
@@ -171,14 +193,16 @@ function handleViewDetail(record: any) {
// 编辑产品详情 // 编辑产品详情
function handleEditDetail(record: any, index: number) { function handleEditDetail(record: any, index: number) {
// 编辑时排除当前项id // 编辑时排除当前项id
const selectedIds = detailTable.value.filter((_: any, i: number) => i !== index).map((item: any) => item.productId || item.plantName); const selectedIds = detailTable.value
detailModalApi.setData({ ...record, index, selectedIds,edit:true }); .filter((_: any, i: number) => i !== index)
.map((item: any) => item.productId || item.plantName);
detailModalApi.setData({ ...record, index, selectedIds, edit: true });
detailModalApi.open(); detailModalApi.open();
} }
//分类字典 //分类字典
function getPlantTypeLabel(value: string | number) { function getPlantTypeLabel(value: string | number) {
const opts = getDictOptions('pro_product_classification'); const opts = getDictOptions('pro_product_classification');
const found = opts.find(opt => opt.value == value); const found = opts.find((opt) => opt.value == value);
return found ? found.label : value; return found ? found.label : value;
} }
</script> </script>
@@ -186,10 +210,18 @@ function getPlantTypeLabel(value: string | number) {
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm /> <BasicForm />
<!-- 添加产品部分 --> <!-- 添加产品部分 -->
<div class="mt-4"> <div class="mt-4">
<div class="mb-2 flex items-center justify-between"> <div class="mb-2 flex items-center justify-between">
<h3 class="text-lg font-medium">{{ isUpdate ? '编辑植物组合包产品' : isReadonly ? '查看植物组合包产品' : '添加植物组合包产品' }} </h3> <h3 class="text-lg font-medium">
{{
isUpdate
? '编辑植物组合包产品'
: isReadonly
? '查看植物组合包产品'
: '添加植物组合包产品'
}}
</h3>
<a-button v-if="!isReadonly" type="primary" @click="handleAddDetail"> <a-button v-if="!isReadonly" type="primary" @click="handleAddDetail">
{{ $t('pages.common.add') }} {{ $t('pages.common.add') }}
</a-button> </a-button>
@@ -204,16 +236,38 @@ function getPlantTypeLabel(value: string | number) {
{{ index + 1 }} {{ index + 1 }}
</template> </template>
<template v-else-if="column.key === 'plantType'"> <template v-else-if="column.key === 'plantType'">
<div>{{getPlantTypeLabel(record.plantType)}}</div> <div>{{ getPlantTypeLabel(record.plantType) }}</div>
</template> </template>
<template v-else-if="column.key === 'action'"> <template v-else-if="column.key === 'action'">
<template v-if="isReadonly"> <template v-if="isReadonly">
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleViewDetail(record)">查看</Button> <Button
type="primary"
size="small"
style="margin-right: 5px"
@click="handleViewDetail(record)"
>查看</Button
>
</template> </template>
<template v-else > <template v-else>
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleViewDetail(record)">查看</Button> <Button
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleEditDetail(record, index)">编辑</Button> type="primary"
<Button danger size="small" @click="handleDeleteDetail(record, index)"> 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)"
>
删除 删除
</Button> </Button>
</template> </template>
@@ -222,7 +276,10 @@ function getPlantTypeLabel(value: string | number) {
</Table> </Table>
<!-- <div>费用合计{{ totalSumPeices }}</div> --> <!-- <div>费用合计{{ totalSumPeices }}</div> -->
</div> </div>
<ProductDetailModal @reload="handleDetailReload" @editReload="handleEditDetailReload"/> <ProductDetailModal
@reload="handleDetailReload"
@editReload="handleEditDetailReload"
/>
</BasicModal> </BasicModal>
</template> </template>

View File

@@ -1,23 +1,27 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref } from 'vue' import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui' import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales' import { $t } from '@vben/locales';
import { cloneDeep, handleNode } from '@vben/utils' import { cloneDeep, handleNode } from '@vben/utils';
import { useVbenForm } from '#/adapter/form' import { useVbenForm } from '#/adapter/form';
import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident/unit' import {
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup' resident_unitAdd,
resident_unitInfo,
resident_unitUpdate,
} from '#/api/property/resident/unit';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data' import { modalSchema } from './data';
import { communityTree } from "#/api/property/community" import { communityTree } from '#/api/property/community';
const emit = defineEmits<{ reload: [] }>() const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false) const isUpdate = ref(false);
const title = computed(() => { const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add') return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
}) });
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
@@ -28,19 +32,19 @@ const [BasicForm, formApi] = useVbenForm({
// 通用配置项 会影响到所有表单项 // 通用配置项 会影响到所有表单项
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
} },
}, },
schema: modalSchema(), schema: modalSchema(),
showDefaultActions: false, showDefaultActions: false,
wrapperClass: 'grid-cols-2', wrapperClass: 'grid-cols-2',
}) });
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff( const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{ {
initializedGetter: defaultFormValueGetter(formApi), initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi), currentGetter: defaultFormValueGetter(formApi),
}, },
) );
const [BasicModal, modalApi] = useVbenModal({ const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度 // 在这里更改宽度
@@ -51,57 +55,57 @@ const [BasicModal, modalApi] = useVbenModal({
onConfirm: handleConfirm, onConfirm: handleConfirm,
onOpenChange: async (isOpen) => { onOpenChange: async (isOpen) => {
if (!isOpen) { if (!isOpen) {
return null return null;
} }
modalApi.modalLoading(true) modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string } const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id isUpdate.value = !!id;
await initLocationOptions() await initLocationOptions();
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await resident_unitInfo(id) const record = await resident_unitInfo(id);
await formApi.setValues(record) await formApi.setValues(record);
} }
await markInitialized() await markInitialized();
modalApi.modalLoading(false) modalApi.modalLoading(false);
}, },
}) });
async function handleConfirm() { async function handleConfirm() {
try { try {
modalApi.lock(true) modalApi.lock(true);
const { valid } = await formApi.validate() const { valid } = await formApi.validate();
if (!valid) { if (!valid) {
return return;
} }
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次 // getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues()) const data = cloneDeep(await formApi.getValues());
data.authBegDate = data.authTime[0] data.authBegDate = data.authTime[0];
data.authEndDate = data.authTime[1] data.authEndDate = data.authTime[1];
await (isUpdate.value ? resident_unitUpdate(data) : resident_unitAdd(data)) await (isUpdate.value ? resident_unitUpdate(data) : resident_unitAdd(data));
resetInitialized() resetInitialized();
emit('reload') emit('reload');
modalApi.close() modalApi.close();
} catch (error) { } catch (error) {
console.error(error) console.error(error);
} finally { } finally {
modalApi.lock(false) modalApi.lock(false);
} }
} }
/** /**
* 入驻位置数据 * 入驻位置数据
*/ */
async function initLocationOptions() { async function initLocationOptions() {
const locationList = await communityTree(5) const locationList = await communityTree(4);
const splitStr = '/' const splitStr = '/';
handleNode(locationList, 'label', splitStr, function (node: any) { handleNode(locationList, 'label', splitStr, function (node: any) {
if (node.level != 5) { if (node.level != 4) {
node.disabled = true node.disabled = true;
} }
}) });
formApi.updateSchema([ formApi.updateSchema([
{ {
componentProps: () => ({ componentProps: () => ({
@@ -124,19 +128,17 @@ async function initLocationOptions() {
}), }),
fieldName: 'location', fieldName: 'location',
}, },
]) ]);
} }
async function handleClosed() { async function handleClosed() {
await formApi.resetForm() await formApi.resetForm();
resetInitialized() resetInitialized();
} }
</script> </script>
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<BasicForm> <BasicForm> </BasicForm>
</BasicForm>
</BasicModal> </BasicModal>
</template> </template>

View File

@@ -10,15 +10,6 @@ export const querySchema: FormSchemaGetter = () => [
fieldName: 'communityName', fieldName: 'communityName',
label: '社区', label: '社区',
}, },
{
component: 'Input',
fieldName: 'orientation',
label: '朝向',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_direction_towards),
},
},
{ {
component: 'Select', component: 'Select',
componentProps: { componentProps: {
@@ -47,30 +38,22 @@ export const columns: VxeGridProps['columns'] = [
field: 'area', field: 'area',
}, },
{ {
title: '套内面积', title: '使用面积',
field: 'insideInArea', field: 'insideInArea',
}, },
{ {
title: '户型', title: '是否重要',
field: 'layout', field: 'isMatter',
}, slots:{
{ default:({row})=>{
title: '朝向', return renderDict(row.isMatter,'wy_fjzydj')
field: 'orientationName', }
}, }
{
title: '是否可售',
field: 'isForSale',
slots: {
default: ({ row }) => {
return renderDict(row.isForSale, DictEnum.wy_sf);
},
},
}, },
{ {
title: '状态', title: '状态',
field: 'statusName', field: 'statusName',
}, },
{ {
field: 'action', field: 'action',
@@ -97,6 +80,7 @@ export const modalSchema: FormSchemaGetter = () => [
defaultValue: undefined, defaultValue: undefined,
label: '社区建筑', label: '社区建筑',
rules: 'selectRequired', rules: 'selectRequired',
formItemClass: 'col-span-2',
}, },
{ {
label: '房间号', label: '房间号',
@@ -112,42 +96,34 @@ export const modalSchema: FormSchemaGetter = () => [
getPopupContainer, getPopupContainer,
options: getDictOptions(DictEnum.wy_room_type), options: getDictOptions(DictEnum.wy_room_type),
}, },
rules:'selectRequired'
}, },
{ {
label: '建筑面积', label: '建筑面积',
fieldName: 'area', fieldName: 'area',
component: 'Input', component: 'InputNumber',
componentProps:{
min:0,
},
rules:'required'
}, },
{ {
label: '套内面积', label: '使用面积',
fieldName: 'insideInArea', fieldName: 'insideInArea',
component: 'InputNumber', component: 'InputNumber',
componentProps:{ componentProps:{
min:0, min:0,
} },
rules:'required'
}, },
{ {
label: '户型', label: '是否重要',
fieldName: 'layout', fieldName: 'isMatter',
component: 'Input',
},
{
label: '朝向',
fieldName: 'orientation',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
getPopupContainer, options: getDictOptions('wy_fjzydj'),
options: getDictOptions(DictEnum.wy_direction_towards),
},
},
{
label: '是否可售',
fieldName: 'isForSale',
component: 'Select',
componentProps: {
getPopupContainer,
options: getDictOptions(DictEnum.wy_sf),
}, },
rules:'selectRequired'
}, },
{ {
label: '状态', label: '状态',
@@ -157,5 +133,15 @@ export const modalSchema: FormSchemaGetter = () => [
getPopupContainer, getPopupContainer,
options: getDictOptions(DictEnum.wy_fjzt), options: getDictOptions(DictEnum.wy_fjzt),
}, },
rules:'selectRequired'
},
{
label: '房间图片',
fieldName: 'imgUrl',
component: 'ImageUpload',
componentProps: {
maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
},
formItemClass: 'col-span-2',
}, },
]; ];

View File

@@ -59,6 +59,8 @@ const [BasicModal, modalApi] = useVbenModal({
await formApi.setValues({ await formApi.setValues({
...record, ...record,
isForSale: String(record.isForSale), isForSale: String(record.isForSale),
status:String(record.status),
roomType:String(record.roomType),
}); });
} }
await markInitialized(); await markInitialized();
@@ -91,12 +93,12 @@ async function handleConfirm() {
* 初始化城市 * 初始化城市
*/ */
async function setupCommunitySelect() { async function setupCommunitySelect() {
const areaList = await communityTree(4); const areaList = await communityTree(3);
// 选中后显示在输入框的值 即父节点 / 子节点 // 选中后显示在输入框的值 即父节点 / 子节点
// addFullName(areaList, 'areaName', ' / '); // addFullName(areaList, 'areaName', ' / ');
const splitStr = '/'; const splitStr = '/';
handleNode(areaList, 'label', splitStr, function (node: any) { handleNode(areaList, 'label', splitStr, function (node: any) {
if (node.level != 4) { if (node.level != 3) {
node.disabled = true; node.disabled = true;
} }
}); });

View File

@@ -118,7 +118,6 @@ async function queryAddServices() {
unit: item.unit, unit: item.unit,
quantity: 0 quantity: 0
})) }))
console.log(res,addServiceList.value);
} }
async function queryPersonData() { async function queryPersonData() {
@@ -201,7 +200,7 @@ async function changeProjectNum() {
<Table :dataSource="addServiceList" v-bind="slotProps" :columns="addServiceColumns" <Table :dataSource="addServiceList" v-bind="slotProps" :columns="addServiceColumns"
:pagination="false" :pagination="false"
size="small" :show-header="false" bordered> size="small" :show-header="false" bordered>
<template #bodyCell="{ column, record, index }"> <template #bodyCell="{ column, record }">
<template v-if="column.field === 'price'"> <template v-if="column.field === 'price'">
{{ record.price + '/' + renderDictValue(record.unit, 'pro_product_unit') }} {{ record.price + '/' + renderDictValue(record.unit, 'pro_product_unit') }}
</template> </template>

View File

@@ -6,21 +6,40 @@
layout="inline" layout="inline"
class="form-box" class="form-box"
> >
<a-form-item label="会议室类型">
<Select
v-model:value="formState.meetingRoomType"
class="room-select"
placeholder="请选择会议室类型"
style="width: 180px;"
>
<SelectOption
v-for="item in getDictOptions('meeting_room_type')"
:key="item.value"
:value="item.value"
>
{{ item.label }}
</SelectOption>
</Select>
</a-form-item>
<a-form-item label="会议日期"> <a-form-item label="会议日期">
<DatePicker v-model:value="formState.appointmentTime" style="width: 200px;"/> <DatePicker v-model:value="formState.appointmentTime" style="width: 180px;"/>
</a-form-item> </a-form-item>
<a-form-item label="会议时段"> <a-form-item label="会议时段">
<TimeRangePicker style="width: 200px;" format="HH:mm" <TimeRangePicker style="width: 200px;" format="HH:mm"
v-model:value="formState.openHours"></TimeRangePicker> v-model:value="formState.openHours"></TimeRangePicker>
</a-form-item> </a-form-item>
<a-form-item label="参会人数" style="width: 400px;"> <a-form-item label="参会人数">
<InputNumber style="width: 200px;" placeholder="请输入参会人数" <InputNumber style="width: 150px;" placeholder="请输入参会人数"
v-model:value="formState.personNumber"/> v-model:value="formState.personNumber"/>
</a-form-item> </a-form-item>
<a-form-item class="form-button"> <a-form-item >
<a-button @click="handleClean">重置</a-button> <a-button @click="handleClean">重置</a-button>
</a-form-item>
<a-form-item>
<a-button type="primary" class="primary-button" <a-button type="primary" class="primary-button"
:disabled="!formState.appointmentTime||!(formState.openHours&&formState.openHours.length)||!formState.personNumber" :disabled="!formState.meetingRoomType||!formState.appointmentTime
||!(formState.openHours&&formState.openHours.length)||!formState.personNumber"
@click="handleSearch">搜索</a-button> @click="handleSearch">搜索</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
@@ -57,24 +76,27 @@ import {
InputNumber, InputNumber,
Empty, Empty,
Alert, Alert,
DatePicker DatePicker, Select,SelectOption
} from 'ant-design-vue'; } from 'ant-design-vue';
import conferenceAddServicesModal from '../conferenceReservations/conferenceReservations-modal.vue'; import conferenceAddServicesModal from '../conferenceReservations/conferenceReservations-modal.vue';
import {notlist} from "#/api/property/roomBooking/conferenceSettings"; import {notlist} from "#/api/property/roomBooking/conferenceSettings";
import type {MeetVO} from "#/api/property/roomBooking/conferenceSettings/model"; import type {MeetVO} from "#/api/property/roomBooking/conferenceSettings/model";
import {renderDictValue} from "#/utils/render"; import {renderDictValue} from "#/utils/render";
import type { Dayjs } from 'dayjs'; import type { Dayjs } from 'dayjs';
import {getDictOptions} from "#/utils/dict";
interface FormState { interface FormState {
openHours?: any[]; openHours?: any[];
personNumber?: number|undefined; personNumber?: number|undefined;
appointmentTime?:Dayjs|undefined appointmentTime?:Dayjs|undefined;
meetingRoomType:string|undefined;
} }
const formState = reactive<FormState>({ const formState = reactive<FormState>({
openHours: [], openHours: [],
personNumber: undefined, personNumber: undefined,
appointmentTime:undefined appointmentTime:undefined,
meetingRoomType:undefined,
}); });
const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE; const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE;
@@ -94,15 +116,16 @@ async function handleSearch() {
const handleClean = () => { const handleClean = () => {
formState.openHours = []; formState.openHours = [];
formState.personNumber = null; formState.personNumber = undefined;
formState.appointmentTime = undefined; formState.appointmentTime = undefined;
formState.meetingRoomType = undefined;
} }
const [modal, modalApi] = useVbenModal({ const [modal, modalApi] = useVbenModal({
connectedComponent: conferenceAddServicesModal, connectedComponent: conferenceAddServicesModal,
}); });
function handleAdd(id:string) { function handleAdd(id:string|number) {
modalApi.setData({id}); modalApi.setData({id});
modalApi.open(); modalApi.open();
} }
@@ -110,18 +133,7 @@ function handleAdd(id:string) {
<style lang="scss"> <style lang="scss">
.form-box { .form-box {
width: 100%; margin: 10px 0 0 5px;
padding: 10px 30px 0 30px;
position: relative;
.form-button {
position: absolute;
right: 30px;
.primary-button {
margin-left: 15px;
}
}
} }
.card-box { .card-box {

View File

@@ -39,6 +39,11 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="会议室名称"> <DescriptionsItem label="会议室名称">
{{ conferenceSettingsDetail.name }} {{ conferenceSettingsDetail.name }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="会议室类型">
<component
:is="renderDict(conferenceSettingsDetail.meetingRoomType,'meeting_room_type')"
/>
</DescriptionsItem>
<DescriptionsItem label="可容纳人数"> <DescriptionsItem label="可容纳人数">
{{ conferenceSettingsDetail.personNumber }} {{ conferenceSettingsDetail.personNumber }}
</DescriptionsItem> </DescriptionsItem>

View File

@@ -1,19 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import {computed, ref} from 'vue'; import { computed, ref } from 'vue';
import {useVbenModal} from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import {$t} from '@vben/locales'; import { $t } from '@vben/locales';
import {cloneDeep, getPopupContainer, handleNode} from '@vben/utils'; import { cloneDeep, getPopupContainer, handleNode } from '@vben/utils';
import {useVbenForm} from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import {meetAdd, meetInfo, meetUpdate} from '#/api/property/roomBooking/conferenceSettings'; import {
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup'; meetAdd,
meetInfo,
meetUpdate,
} from '#/api/property/roomBooking/conferenceSettings';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import {modalSchema} from './data'; import { modalSchema } from './data';
import {TimeRangePicker} from 'ant-design-vue' import { TimeRangePicker } from 'ant-design-vue';
import {renderDictValue} from "#/utils/render"; import { renderDictValue } from '#/utils/render';
import {personList} from "#/api/property/resident/person"; import { personList } from '#/api/property/resident/person';
import {communityTree} from "#/api/property/community"; import { communityTree } from '#/api/property/community';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
@@ -31,14 +35,14 @@ const [BasicForm, formApi] = useVbenForm({
// 通用配置项 会影响到所有表单项 // 通用配置项 会影响到所有表单项
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
} },
}, },
schema: modalSchema(), schema: modalSchema(),
showDefaultActions: false, showDefaultActions: false,
wrapperClass: 'grid-cols-2', wrapperClass: 'grid-cols-2',
}); });
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff( const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{ {
initializedGetter: defaultFormValueGetter(formApi), initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi), currentGetter: defaultFormValueGetter(formApi),
@@ -58,20 +62,20 @@ const [BasicModal, modalApi] = useVbenModal({
} }
modalApi.modalLoading(true); modalApi.modalLoading(true);
await formApi.setValues({ await formApi.setValues({
expenseType:'1', expenseType: '1',
isCheck:'0', isCheck: '0',
}) });
const {id} = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
await queryPerson() await queryPerson();
await initLocationOptions() await initLocationOptions();
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await meetInfo(id); const record = await meetInfo(id);
record.expenseType=record.expenseType.toString() record.expenseType = record.expenseType.toString();
record.isCheck=record.isCheck.toString() record.isCheck = record.isCheck.toString();
let hour = record.openHours.split('-'); let hour = record.openHours.split('-');
if(hour.length>1){ if (hour.length > 1) {
record.openHours=[dayjs(hour[0],'HH:mm'),dayjs(hour[1],'HH:mm')] record.openHours = [dayjs(hour[0], 'HH:mm'), dayjs(hour[1], 'HH:mm')];
} }
await formApi.setValues(record); await formApi.setValues(record);
} }
@@ -84,14 +88,17 @@ const [BasicModal, modalApi] = useVbenModal({
async function handleConfirm() { async function handleConfirm() {
try { try {
modalApi.lock(true); modalApi.lock(true);
const {valid} = await formApi.validate(); const { valid } = await formApi.validate();
if (!valid) { if (!valid) {
return; return;
} }
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次 // getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
if (data.openHours) { if (data.openHours) {
data.openHours = data.openHours[0]?.format("HH:mm") + '-' + data.openHours[1]?.format("HH:mm"); data.openHours =
data.openHours[0]?.format('HH:mm') +
'-' +
data.openHours[1]?.format('HH:mm');
} }
await (isUpdate.value ? meetUpdate(data) : meetAdd(data)); await (isUpdate.value ? meetUpdate(data) : meetAdd(data));
resetInitialized(); resetInitialized();
@@ -113,20 +120,27 @@ async function queryPerson() {
let params = { let params = {
pageSize: 1000, pageSize: 1000,
pageNum: 1, pageNum: 1,
} };
const res = await personList(params); const res = await personList(params);
const options = res.rows.map((user) => ({ const options = res.rows.map((user) => ({
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex') + '-' + user.phone, label:
user.userName +
'-' +
renderDictValue(user.gender, 'sys_user_sex') +
'-' +
user.phone,
value: user.id, value: user.id,
})); }));
formApi.updateSchema([{ formApi.updateSchema([
componentProps: () => ({ {
options: options, componentProps: () => ({
filterOption: filterOption, options: options,
showSearch:true, filterOption: filterOption,
}), showSearch: true,
fieldName: 'principals', }),
}]) fieldName: 'principals',
},
]);
} }
const filterOption = (input: string, option: any) => { const filterOption = (input: string, option: any) => {
@@ -137,10 +151,10 @@ const filterOption = (input: string, option: any) => {
* 地址数据 * 地址数据
*/ */
async function initLocationOptions() { async function initLocationOptions() {
const locationList = await communityTree(5); const locationList = await communityTree(4);
const splitStr = '/'; const splitStr = '/';
handleNode(locationList, 'label', splitStr, function (node: any) { handleNode(locationList, 'label', splitStr, function (node: any) {
if (node.level != 5) { if (node.level != 4) {
node.disabled = true; node.disabled = true;
} }
}); });
@@ -159,7 +173,7 @@ async function initLocationOptions() {
showSearch: true, showSearch: true,
treeData: locationList, treeData: locationList,
treeDefaultExpandAll: true, treeDefaultExpandAll: true,
treeLine: {showLeafIcon: false}, treeLine: { showLeafIcon: false },
// 筛选的字段 // 筛选的字段
treeNodeFilterProp: 'label', treeNodeFilterProp: 'label',
// 选中后显示在输入框的值 // 选中后显示在输入框的值
@@ -180,4 +194,3 @@ async function initLocationOptions() {
</BasicForm> </BasicForm>
</BasicModal> </BasicModal>
</template> </template>

View File

@@ -37,6 +37,16 @@ export const columns: VxeGridProps['columns'] = [
field: 'name', field: 'name',
minWidth:100, minWidth:100,
}, },
{
title: '会议室类型',
field: 'meetingRoomType',
slots: {
default: ({row}) => {
return renderDict(row.meetingRoomType, 'meeting_room_type');
},
},
minWidth:100,
},
// { // {
// title: '会议室地址', // title: '会议室地址',
// field: 'locationName', // field: 'locationName',
@@ -99,7 +109,15 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'name', fieldName: 'name',
component: 'Input', component: 'Input',
rules: 'required', rules: 'required',
formItemClass: 'col-span-1', },
{
label: '会议室类型',
fieldName: 'meetingRoomType',
component: 'Select',
componentProps: {
options: getDictOptions('meeting_room_type'),
},
rules: 'selectRequired',
}, },
{ {
label: '可容纳人数', label: '可容纳人数',

View File

@@ -1,7 +1,5 @@
import type { FormSchemaGetter } from '#/adapter/form'; import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
@@ -19,14 +17,14 @@ export const querySchema: FormSchemaGetter = () => [
fieldName: 'interviewedUnit', fieldName: 'interviewedUnit',
label: '邀约单位', label: '邀约单位',
}, },
{ // {
component: 'Select', // component: 'Select',
componentProps: { // componentProps: {
options: getDictOptions('wy_appointment_tatus'), // options: getDictOptions('wy_appointment_tatus'),
}, // },
fieldName: 'serveStatus', // fieldName: 'serveStatus',
label: '预约状态', // label: '预约状态',
}, // },
]; ];
export const columns: VxeGridProps['columns'] = [ export const columns: VxeGridProps['columns'] = [
@@ -64,7 +62,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'interviewedUnit', field: 'interviewedUnit',
}, },
{ {
title: '拜访事由', title: '事由',
field: 'visitingReason', field: 'visitingReason',
}, },
{ {
@@ -78,24 +76,24 @@ export const columns: VxeGridProps['columns'] = [
}, },
}, },
}, },
{ // {
title: '是否预约车位', // title: '是否预约车位',
field: 'bookingParkingSpace', // field: 'bookingParkingSpace',
slots: { // slots: {
default: ({ row }) => { // default: ({ row }) => {
return renderDict(row.bookingParkingSpace, 'wy_parking_spot'); // return renderDict(row.bookingParkingSpace, 'wy_parking_spot');
}, // },
}, // },
}, // },
{ // {
title: '预约状态', // title: '预约状态',
field: 'serveStatus', // field: 'serveStatus',
slots: { // slots: {
default: ({ row }) => { // default: ({ row }) => {
return renderDict(row.serveStatus, 'wy_appointment_tatus'); // return renderDict(row.serveStatus, 'wy_appointment_tatus');
}, // },
}, // },
}, // },
{ {
title: '提交时间', title: '提交时间',
field: 'createTime', field: 'createTime',
@@ -150,7 +148,7 @@ export const modalSchema: FormSchemaGetter = () => [
rules: 'required', rules: 'required',
}, },
{ {
label: '拜访事由', label: '事由',
fieldName: 'visitingReason', fieldName: 'visitingReason',
component: 'Input', component: 'Input',
rules: 'required', rules: 'required',
@@ -169,29 +167,29 @@ export const modalSchema: FormSchemaGetter = () => [
}, },
rules: 'required', rules: 'required',
}, },
{ // {
label: '预约车位', // label: '预约车位',
fieldName: 'bookingParkingSpace', // fieldName: 'bookingParkingSpace',
component: 'RadioGroup', // component: 'RadioGroup',
componentProps: { // componentProps: {
options: [ // options: [
{ label: '否', value: '1' }, // { label: '否', value: '1' },
{ label: '是', value: '0' }, // { label: '是', value: '0' },
], // ],
}, // },
rules: 'required', // rules: 'required',
}, // },
{ // {
label: '车牌号', // label: '车牌号',
fieldName: 'licensePlate', // fieldName: 'licensePlate',
component: 'Input', // component: 'Input',
rules: 'required', // rules: 'required',
dependencies: { // dependencies: {
// 类型不为按钮时显示 // // 类型不为按钮时显示
show: (values) => values.bookingParkingSpace === '0', // show: (values) => values.bookingParkingSpace === '0',
triggerFields: ['bookingParkingSpace'], // triggerFields: ['bookingParkingSpace'],
}, // },
}, // },
// { // {
// label: '人脸图片', // label: '人脸图片',
// fieldName: 'facePictures', // fieldName: 'facePictures',

View File

@@ -53,25 +53,25 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="被访单位"> <DescriptionsItem label="被访单位">
{{ visitorInvitationDetail.interviewedUnit }} {{ visitorInvitationDetail.interviewedUnit }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="拜访事由"> <DescriptionsItem label="事由">
{{ visitorInvitationDetail.visitingReason }} {{ visitorInvitationDetail.visitingReason }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="拜访时间"> <DescriptionsItem label="拜访时间">
{{ visitorInvitationDetail.visitingBeginTime+' - '+visitorInvitationDetail.visitingBeginTime }} {{ visitorInvitationDetail.visitingBeginTime+' - '+visitorInvitationDetail.visitingBeginTime }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="是否预约车位" v-if="visitorInvitationDetail.bookingParkingSpace!=null"> <!-- <DescriptionsItem label="是否预约车位" v-if="visitorInvitationDetail.bookingParkingSpace!=null">-->
<component <!-- <component-->
:is="renderDict(visitorInvitationDetail.bookingParkingSpace,'wy_parking_spot')" <!-- :is="renderDict(visitorInvitationDetail.bookingParkingSpace,'wy_parking_spot')"-->
/> <!-- />-->
</DescriptionsItem> <!-- </DescriptionsItem>-->
<DescriptionsItem label="车牌号"> <DescriptionsItem label="车牌号">
{{ visitorInvitationDetail.licensePlate }} {{ visitorInvitationDetail.licensePlate }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="预约状态" v-if="visitorInvitationDetail.serveStatus!=null"> <!-- <DescriptionsItem label="预约状态" v-if="visitorInvitationDetail.serveStatus!=null">-->
<component <!-- <component-->
:is="renderDict(visitorInvitationDetail.serveStatus,'wy_appointment_tatus')" <!-- :is="renderDict(visitorInvitationDetail.serveStatus,'wy_appointment_tatus')"-->
/> <!-- />-->
</DescriptionsItem> <!-- </DescriptionsItem>-->
<DescriptionsItem label="提交时间"> <DescriptionsItem label="提交时间">
{{ visitorInvitationDetail.createTime }} {{ visitorInvitationDetail.createTime }}
</DescriptionsItem> </DescriptionsItem>

View File

@@ -1,7 +1,5 @@
import type { FormSchemaGetter } from '#/adapter/form'; import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { getDictOptions } from '#/utils/dict';
import { renderDict } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
@@ -19,14 +17,14 @@ export const querySchema: FormSchemaGetter = () => [
fieldName: 'interviewedUnit', fieldName: 'interviewedUnit',
label: '被访单位', label: '被访单位',
}, },
{ // {
component: 'Select', // component: 'Select',
componentProps: { // componentProps: {
options: getDictOptions('wy_appointment_tatus'), // options: getDictOptions('wy_appointment_tatus'),
}, // },
fieldName: 'serveStatus', // fieldName: 'serveStatus',
label: '预约状态', // label: '预约状态',
}, // },
// { // {
// component: 'RangePicker', // component: 'RangePicker',
// componentProps: { // componentProps: {
@@ -87,7 +85,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'interviewedUnit', field: 'interviewedUnit',
}, },
{ {
title: '拜访事由', title: '事由',
field: 'visitingReason', field: 'visitingReason',
}, },
{ {
@@ -101,24 +99,24 @@ export const columns: VxeGridProps['columns'] = [
}, },
}, },
}, },
{ // {
title: '是否预约车位', // title: '是否预约车位',
field: 'bookingParkingSpace', // field: 'bookingParkingSpace',
slots: { // slots: {
default: ({ row }) => { // default: ({ row }) => {
return renderDict(row.bookingParkingSpace, 'wy_parking_spot'); // return renderDict(row.bookingParkingSpace, 'wy_parking_spot');
}, // },
}, // },
}, // },
{ // {
title: '预约状态', // title: '预约状态',
field: 'serveStatus', // field: 'serveStatus',
slots: { // slots: {
default: ({ row }) => { // default: ({ row }) => {
return renderDict(row.serveStatus, 'wy_appointment_tatus'); // return renderDict(row.serveStatus, 'wy_appointment_tatus');
}, // },
}, // },
}, // },
{ {
title: '提交时间', title: '提交时间',
field: 'updateTime', field: 'updateTime',
@@ -131,3 +129,27 @@ export const columns: VxeGridProps['columns'] = [
width: 180, width: 180,
}, },
]; ];
export const modalSchema: FormSchemaGetter = () => [
{
label: 'id',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '预约状态',
fieldName: 'serveStatus',
component: 'RadioGroup',
componentProps: {
options: [
{ label: '通过', value: 1 },
{ label: '不通过', value: 2 },
],
},
rules: 'required',
}
];

View File

@@ -12,7 +12,11 @@ import {
} from '#/api/property/visitorManagement'; } from '#/api/property/visitorManagement';
import type { VisitorManagementForm } from '#/api/property/visitorManagement/model'; import type { VisitorManagementForm } from '#/api/property/visitorManagement/model';
import visitorTodoDetail from './visitorTodo-detail.vue'; import visitorTodoDetail from './visitorTodo-detail.vue';
import visitorTodoModal from './visitorTodo-modal.vue';
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';
import VisitorInvitationModal
from "#/views/property/visitorManagement/visitorInvitation/visitorInvitation-modal.vue";
import type {AttachForm} from "#/api/property/roomBooking/conferenceAddServices/model";
const formOptions: VbenFormProps = { const formOptions: VbenFormProps = {
commonConfig: { commonConfig: {
@@ -68,12 +72,14 @@ async function handleInfo(row: Required<VisitorManagementForm>) {
visitorTodoApi.open(); visitorTodoApi.open();
} }
async function handleDelete(row: Required<VisitorManagementForm>) { const [VisitorTodoModal, modalApi] = useVbenModal({
row.serveStatus=1 connectedComponent: visitorTodoModal,
await visitorManagementUpdate(row); });
await tableApi.query();
}
async function handleEdit(row: Required<VisitorManagementForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
</script> </script>
<template> <template>
@@ -86,22 +92,16 @@ async function handleDelete(row: Required<VisitorManagementForm>) {
> >
{{ $t('pages.common.info') }} {{ $t('pages.common.info') }}
</ghost-button> </ghost-button>
<Popconfirm <ghost-button
:get-popup-container="getVxePopupContainer" @click.stop="handleEdit(row)"
placement="left" v-if="row.serveStatus === 0"
title="确认审核状态?"
@confirm="handleDelete(row)"
v-if="row.serveStatus === '0'"
> >
<ghost-button {{ '审核' }}
@click.stop="" </ghost-button>
>
{{ '审核' }}
</ghost-button>
</Popconfirm>
</Space> </Space>
</template> </template>
</BasicTable> </BasicTable>
<VisitorTodoModal @reload="tableApi.query()" />
<visitorTodoDetailModal/> <visitorTodoDetailModal/>
</Page> </Page>
</template> </template>

View File

@@ -53,25 +53,25 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="被访单位"> <DescriptionsItem label="被访单位">
{{ visitorTodoDetail.interviewedUnit }} {{ visitorTodoDetail.interviewedUnit }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="拜访事由"> <DescriptionsItem label="事由">
{{ visitorTodoDetail.visitingReason }} {{ visitorTodoDetail.visitingReason }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="拜访时间"> <DescriptionsItem label="拜访时间">
{{ visitorTodoDetail.visitingBeginTime+' - '+visitorTodoDetail.visitingBeginTime }} {{ visitorTodoDetail.visitingBeginTime+' - '+visitorTodoDetail.visitingBeginTime }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="是否预约车位" v-if="visitorTodoDetail.bookingParkingSpace!=null"> <!-- <DescriptionsItem label="是否预约车位" v-if="visitorTodoDetail.bookingParkingSpace!=null">-->
<component <!-- <component-->
:is="renderDict(visitorTodoDetail.bookingParkingSpace,'wy_parking_spot')" <!-- :is="renderDict(visitorTodoDetail.bookingParkingSpace,'wy_parking_spot')"-->
/> <!-- />-->
</DescriptionsItem> <!-- </DescriptionsItem>-->
<DescriptionsItem label="车牌号"> <DescriptionsItem label="车牌号">
{{ visitorTodoDetail.licensePlate }} {{ visitorTodoDetail.licensePlate }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="预约状态" v-if="visitorTodoDetail.serveStatus!=null"> <!-- <DescriptionsItem label="预约状态" v-if="visitorTodoDetail.serveStatus!=null">-->
<component <!-- <component-->
:is="renderDict(visitorTodoDetail.serveStatus,'wy_appointment_tatus')" <!-- :is="renderDict(visitorTodoDetail.serveStatus,'wy_appointment_tatus')"-->
/> <!-- />-->
</DescriptionsItem> <!-- </DescriptionsItem>-->
<DescriptionsItem label="提交时间"> <DescriptionsItem label="提交时间">
{{ visitorTodoDetail.createTime }} {{ visitorTodoDetail.createTime }}
</DescriptionsItem> </DescriptionsItem>

View File

@@ -0,0 +1,93 @@
<script setup lang="ts">
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { visitorManagementInfo, visitorManagementUpdate } from '#/api/property/visitorManagement';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
// 默认占满两列
formItemClass: 'col-span-2',
// 默认label宽度 px
labelWidth: 80,
// 通用配置项 会影响到所有表单项
componentProps: {
class: 'w-full',
}
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const record = ref({})
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
if (id) {
record.value = await visitorManagementInfo(id);
await formApi.setValues(record.value);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
const data = cloneDeep(await formApi.getValues());
record.value.serveStatus = data.serveStatus
await visitorManagementUpdate(record.value)
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal title="审核">
<BasicForm />
</BasicModal>
</template>