Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
This commit is contained in:
@@ -29,7 +29,7 @@ export interface BuildingVO {
|
||||
/**
|
||||
* 建筑类型('1:住宅','2:商业','3:混合')
|
||||
*/
|
||||
buildType: number;
|
||||
buildType: string;
|
||||
|
||||
/**
|
||||
* 电梯数量
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
import type {PageQuery, BaseEntity} from '#/api/common';
|
||||
|
||||
export interface WorkOrdersVO {
|
||||
/**
|
||||
@@ -71,8 +71,40 @@ export interface WorkOrdersVO {
|
||||
*/
|
||||
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 {
|
||||
/**
|
||||
* id
|
||||
@@ -213,7 +245,7 @@ export interface WorkOrdersQuery extends PageQuery {
|
||||
isTimeOut?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ export interface RoomVO {
|
||||
/**
|
||||
* 房间类型('住宅','商铺','办公室','设备间','公共区域')
|
||||
*/
|
||||
roomType: number;
|
||||
roomType: string;
|
||||
|
||||
/**
|
||||
* 建筑面积(平方米)
|
||||
@@ -49,7 +49,7 @@ export interface RoomVO {
|
||||
/**
|
||||
* 状态('空置','已售','已租','自用')
|
||||
*/
|
||||
status: number;
|
||||
status: string;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -40,6 +40,10 @@ export interface AttachVO {
|
||||
* 创建时间
|
||||
*/
|
||||
createTime: string;
|
||||
|
||||
quantity: number;
|
||||
|
||||
meetAttachId: string;
|
||||
}
|
||||
|
||||
export interface AttachForm extends BaseEntity {
|
||||
|
@@ -213,7 +213,7 @@ async function showHoliday() {
|
||||
<span>{{ '第' + (index + 1) + '天' }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'shiftId'">
|
||||
{{record.shiftId}}
|
||||
{{record.shiftValue}}
|
||||
</template>
|
||||
</template>
|
||||
</Table>
|
||||
|
@@ -111,7 +111,6 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
settingData.cycleData=record.scheduleCycleList
|
||||
settingData.cycleData.forEach(item => {
|
||||
if(item.shiftId){
|
||||
item.scheduleId=item.shiftId
|
||||
const shift = record.attendanceList.find(i => item.shiftId == i.id);
|
||||
let str = ''
|
||||
if (shift.isRest) {
|
||||
@@ -135,7 +134,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
shiftId: null,
|
||||
})
|
||||
})
|
||||
settingData.cycleData = [{scheduleId: ''}, {scheduleId: ''}];
|
||||
settingData.cycleData = [{shiftId: ''}, {shiftId: ''}];
|
||||
}
|
||||
await markInitialized();
|
||||
modalApi.modalLoading(false);
|
||||
@@ -154,7 +153,7 @@ async function handleConfirm() {
|
||||
if (data.attendanceType == 1) {
|
||||
let hasError = true;
|
||||
settingData.cycleData.some((item, index) => {
|
||||
if (!item.scheduleId) {
|
||||
if (!item.shiftId) {
|
||||
hasError = false
|
||||
message.warning('请选择周期天数对应班次。');
|
||||
return;
|
||||
@@ -252,7 +251,7 @@ function handleShiftList(list: any[]) {
|
||||
function addCycleHandle() {
|
||||
if (settingData.cycleData.length < 31) {
|
||||
settingData.cycleData.push({
|
||||
scheduleId: '',
|
||||
shiftId: '',
|
||||
})
|
||||
} else {
|
||||
message.warning('周期天数最多31天。');
|
||||
@@ -492,7 +491,7 @@ function getUnCheckInData(val: any) {
|
||||
<Select
|
||||
ref="select"
|
||||
style="width: 100%"
|
||||
v-model:value="record.scheduleId"
|
||||
v-model:value="record.shiftId"
|
||||
placeholder="请选择班次"
|
||||
>
|
||||
<SelectOption v-for="item in shiftList" :value="item.id">
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import {computed, ref} from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep} from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { buildingAdd, buildingInfo, buildingUpdate } from '#/api/property/building';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import {buildingAdd, buildingInfo, buildingUpdate} from '#/api/property/building';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import {modalSchema} from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -34,7 +34,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -54,11 +54,12 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await buildingInfo(id);
|
||||
record.buildType = record.buildType.toString();
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -70,7 +71,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
const {valid} = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
@@ -95,7 +96,7 @@ async function handleClosed() {
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<BasicForm/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -105,12 +105,20 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '总层数',
|
||||
fieldName: 'floorCount',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:1,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '单元数',
|
||||
fieldName: 'unitCount',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:1,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '建筑类型',
|
||||
@@ -124,14 +132,17 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '电梯数量',
|
||||
fieldName: 'elevatorCount',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:0,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '竣工日期',
|
||||
fieldName: 'completionDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
},
|
||||
|
@@ -41,9 +41,19 @@ export const columns: VxeGridProps['columns'] = [
|
||||
title: '地址',
|
||||
field: 'location',
|
||||
},
|
||||
// {
|
||||
// title: '计划完成时间',
|
||||
// field: 'planCompleTime',
|
||||
// },
|
||||
{
|
||||
title: '计划完成时间',
|
||||
field: 'planCompleTime',
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
|
@@ -58,8 +58,14 @@ async function handleOpenChange(open: boolean) {
|
||||
<DescriptionsItem label="具体位置">
|
||||
{{ orderDetail.location }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="计划完成时间">
|
||||
{{ orderDetail.planCompleTime }}
|
||||
<DescriptionsItem label="创建时间">
|
||||
{{ orderDetail.createTime }}
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="计划完成时间">-->
|
||||
<!-- {{ orderDetail.planCompleTime }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="备注">
|
||||
{{ orderDetail.remark }}
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
<Divider orientation="left" orientation-margin="0px">
|
||||
|
@@ -53,11 +53,11 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'location',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '计划完成时间',
|
||||
field: 'planCompleTime',
|
||||
width: 100,
|
||||
},
|
||||
// {
|
||||
// title: '计划完成时间',
|
||||
// field: 'planCompleTime',
|
||||
// width: 100,
|
||||
// },
|
||||
{
|
||||
title: '完成时间',
|
||||
field: 'compleTime',
|
||||
@@ -87,6 +87,16 @@ export const columns: VxeGridProps['columns'] = [
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
|
@@ -64,12 +64,15 @@ async function handleOpenChange(open: boolean) {
|
||||
<DescriptionsItem label="具体位置" :span="2">
|
||||
{{ orderDetail.location }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="计划完成时间">
|
||||
{{ orderDetail.planCompleTime }}
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="计划完成时间">-->
|
||||
<!-- {{ orderDetail.planCompleTime }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="完成时间">
|
||||
{{ orderDetail.compleTime }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="创建时间">
|
||||
{{ orderDetail.createTime }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="服务评价">
|
||||
<Rate :value="orderDetail.serviceEvalua" disabled/>
|
||||
</DescriptionsItem>
|
||||
@@ -78,6 +81,9 @@ async function handleOpenChange(open: boolean) {
|
||||
:is="orderDetail.isTimeOut ? renderDict(orderDetail.isTimeOut,'wy_sf') : ''"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="备注">
|
||||
{{ orderDetail.remark }}
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
<Divider orientation="left" orientation-margin="0px">
|
||||
处理记录
|
||||
|
@@ -64,10 +64,20 @@ export const columns: VxeGridProps['columns'] = [
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '计划完成时间',
|
||||
field: 'planCompleTime',
|
||||
title: '处理权重',
|
||||
field: 'processingWeight',
|
||||
slots: {
|
||||
default: ({row}) => {
|
||||
return renderDict(row.processingWeight, 'pro_processing_weight');
|
||||
},
|
||||
},
|
||||
width: 100,
|
||||
},
|
||||
// {
|
||||
// title: '计划完成时间',
|
||||
// field: 'planCompleTime',
|
||||
// width: 100,
|
||||
// },
|
||||
{
|
||||
title: '完成时间',
|
||||
field: 'compleTime',
|
||||
@@ -85,7 +95,6 @@ export const columns: VxeGridProps['columns'] = [
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
title: '是否超时',
|
||||
@@ -94,10 +103,19 @@ export const columns: VxeGridProps['columns'] = [
|
||||
slots: {
|
||||
default: ({row}) => {
|
||||
return row.isTimeOut ? renderDict(row.isTimeOut, 'wy_sf') : '';
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
@@ -173,18 +191,18 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'Input',
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '计划完成时间',
|
||||
fieldName: 'planCompleTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
labelWidth: 110,
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
// {
|
||||
// label: '计划完成时间',
|
||||
// fieldName: 'planCompleTime',
|
||||
// component: 'DatePicker',
|
||||
// componentProps: {
|
||||
// showTime: true,
|
||||
// format: 'YYYY-MM-DD HH:mm:ss',
|
||||
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
// },
|
||||
// labelWidth: 110,
|
||||
// rules: 'selectRequired',
|
||||
// },
|
||||
// {
|
||||
// label: '完成时间',
|
||||
// fieldName: 'compleTime',
|
||||
@@ -196,12 +214,12 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
// },
|
||||
// rules: 'selectRequired',
|
||||
// },
|
||||
// {
|
||||
// label: '评价',
|
||||
// fieldName: 'serviceEvalua',
|
||||
// component: 'Rate',
|
||||
// rules: 'required',
|
||||
// },
|
||||
{
|
||||
label: '备注',
|
||||
fieldName: 'remarkremark',
|
||||
component: 'Textarea',
|
||||
rules: 'required',
|
||||
},
|
||||
// {
|
||||
// label: '是否超时',
|
||||
// fieldName: 'isTimeOut',
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, ref, shallowRef} from 'vue';
|
||||
import { ref, shallowRef} from 'vue';
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {Descriptions, DescriptionsItem, Timeline, TimelineItem, Rate,Divider} from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -7,7 +7,7 @@ import duration from 'dayjs/plugin/duration';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import {renderDict} from "#/utils/render";
|
||||
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(relativeTime);
|
||||
@@ -20,7 +20,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
const orderDetail = shallowRef<null | WorkOrdersVO>(null);
|
||||
const handleRecords=ref<any[]>([])
|
||||
const handleRecords=ref<HandleRecords[]>([])
|
||||
async function handleOpenChange(open: boolean) {
|
||||
if (!open) {
|
||||
return null;
|
||||
@@ -64,19 +64,32 @@ async function handleOpenChange(open: boolean) {
|
||||
<DescriptionsItem label="具体位置" :span="2">
|
||||
{{ orderDetail.location }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="计划完成时间">
|
||||
{{ orderDetail.planCompleTime }}
|
||||
<!-- <DescriptionsItem label="计划完成时间">-->
|
||||
<!-- {{ orderDetail.planCompleTime }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
|
||||
<DescriptionsItem label="创建时间">
|
||||
{{ orderDetail.createTime }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="备注">
|
||||
{{ orderDetail.remark }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="完成时间">
|
||||
{{ orderDetail.compleTime }}
|
||||
</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/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="是否超时">
|
||||
<component
|
||||
:is="orderDetail.isTimeOut ? renderDict(orderDetail.isTimeOut,'wy_sf') : ''"
|
||||
/>
|
||||
<DescriptionsItem label="评价内容" v-if="orderDetail.serviceEvaluaText" :span="2">
|
||||
{{ orderDetail.serviceEvaluaText }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="评价图片" v-if="orderDetail.imgUrl" :span="2">
|
||||
{{ orderDetail.imgUrl }}
|
||||
</DescriptionsItem>
|
||||
</Descriptions>
|
||||
<Divider orientation="left" orientation-margin="0px">
|
||||
|
@@ -6,7 +6,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
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 dayjs from 'dayjs';
|
||||
@@ -43,7 +43,11 @@ const isAudit = ref(false);
|
||||
const isRefund = ref(false);
|
||||
const rowData = ref<any>({});
|
||||
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 的完整数据
|
||||
@@ -123,9 +127,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
// 查询服务地址树形结构
|
||||
setupCommunitySelect()
|
||||
setupCommunitySelect();
|
||||
modalApi.modalLoading(true);
|
||||
const { id, readonly,audit,refund,row } = modalApi.getData() as {
|
||||
const { id, readonly, audit, refund, row } = modalApi.getData() as {
|
||||
id?: string;
|
||||
readonly?: boolean;
|
||||
audit?: boolean;
|
||||
@@ -138,9 +142,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
isRefund.value = !!refund;
|
||||
rowData.value = row;
|
||||
//判断是否是编辑状态需要先判断是否是只读状态
|
||||
if(isReadonly.value){
|
||||
if (isReadonly.value) {
|
||||
isUpdate.value = false;
|
||||
}else{
|
||||
} else {
|
||||
isUpdate.value = !!id;
|
||||
}
|
||||
if ((isUpdate.value || isReadonly.value) && id) {
|
||||
@@ -149,9 +153,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (record.endTime) record.endTime = dayjs(record.endTime);
|
||||
editUnitId.value = record.unitId || '';
|
||||
detailTable.value = record.cleanList || [];
|
||||
for(const item of record.relationList){
|
||||
for(let i = 0; i < detailTable.value.length; i++){
|
||||
if(item.cleanId === detailTable.value[i].id){
|
||||
for (const item of record.relationList) {
|
||||
for (let i = 0; i < detailTable.value.length; i++) {
|
||||
if (item.cleanId === detailTable.value[i].id) {
|
||||
detailTable.value[i].area = item.areas;
|
||||
detailTable.value[i].sumPeices = item.sumPrice;
|
||||
}
|
||||
@@ -271,11 +275,11 @@ const detailColumns = [
|
||||
dataIndex: 'sumPeices',
|
||||
key: 'sumPeices',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right' as const,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right' as const,
|
||||
},
|
||||
];
|
||||
|
||||
const [DetailTable, detailTableApi] = useVbenVxeGrid({
|
||||
@@ -298,7 +302,6 @@ function handleDetailReload(data: any) {
|
||||
// 编辑订单服务详情
|
||||
function handleEditDetailReload(data: any) {
|
||||
detailTable.value[data.index] = data;
|
||||
|
||||
}
|
||||
// 删除订单服务详情
|
||||
function handleDeleteDetail(record: any, index: number) {
|
||||
@@ -342,11 +345,15 @@ async function handleConfirm() {
|
||||
data.unit = unitObj ? unitObj.name : data.unit || '';
|
||||
data.name = cleanObj ? cleanObj.name : data.name || '';
|
||||
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
||||
data.sumPeices = Number(totalSumPeices.value)
|
||||
data.sumPeices = Number(totalSumPeices.value);
|
||||
data.cleanList = detailTable.value;
|
||||
if (data.starTime) data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
if (data.endTime) data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
isUpdate.value ? await clean_orderUpdate({...data,id:editCleanOrderId.value}) : await clean_orderAdd(data);
|
||||
if (data.starTime)
|
||||
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
if (data.endTime)
|
||||
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
isUpdate.value
|
||||
? await clean_orderUpdate({ ...data, id: editCleanOrderId.value })
|
||||
: await clean_orderAdd(data);
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
@@ -359,17 +366,17 @@ async function handleConfirm() {
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
detailTable.value = [];//清空详情表格
|
||||
detailTable.value = []; //清空详情表格
|
||||
resetInitialized();
|
||||
}
|
||||
// 获取服务地址
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(5);
|
||||
const areaList = await communityTree(4);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -399,58 +406,65 @@ async function setupCommunitySelect() {
|
||||
]);
|
||||
}
|
||||
async function handleAudit(params: any) {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if(rowData.value){
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if (rowData.value) {
|
||||
data.state = rowData.value.state;
|
||||
data.isUnbooking = rowData.value?.isUnbooking;
|
||||
}
|
||||
// 单位数据缓存
|
||||
if (unitListData.length === 0) {
|
||||
const res = await resident_unitList();
|
||||
unitListData = res.rows || [];
|
||||
}
|
||||
// 劳务数据缓存 cleanListData 已有
|
||||
// 查找label
|
||||
const unitObj = unitListData.find((item) => item.id === data.unitId);
|
||||
const cleanObj = cleanListData.find((item) => item.id === data.name);
|
||||
data.unit = unitObj ? unitObj.name : data.unit || '';
|
||||
data.name = cleanObj ? cleanObj.name : data.name || '';
|
||||
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
||||
data.sumPeices = Number(totalSumPeices.value)
|
||||
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
// data.sumPeices = parseInt(totalSumPeices.value, 10);
|
||||
// 组装 cleanIds
|
||||
// data.cleanIds = detailTable.value.map((item: any) => item.id);
|
||||
data.cleanList = detailTable.value;
|
||||
if(params.isRefund){
|
||||
data.isUnbooking = 1;
|
||||
} else if(params.isAudit){
|
||||
data.state = 1;
|
||||
}else{
|
||||
data.state = 2;
|
||||
}
|
||||
// 0:未审核 1:审核通过 2:审核不通过
|
||||
await clean_orderUpdate({...data,id:editCleanOrderId.value})
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
}
|
||||
// 单位数据缓存
|
||||
if (unitListData.length === 0) {
|
||||
const res = await resident_unitList();
|
||||
unitListData = res.rows || [];
|
||||
}
|
||||
// 劳务数据缓存 cleanListData 已有
|
||||
// 查找label
|
||||
const unitObj = unitListData.find((item) => item.id === data.unitId);
|
||||
const cleanObj = cleanListData.find((item) => item.id === data.name);
|
||||
data.unit = unitObj ? unitObj.name : data.unit || '';
|
||||
data.name = cleanObj ? cleanObj.name : data.name || '';
|
||||
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
||||
data.sumPeices = Number(totalSumPeices.value);
|
||||
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
// data.sumPeices = parseInt(totalSumPeices.value, 10);
|
||||
// 组装 cleanIds
|
||||
// data.cleanIds = detailTable.value.map((item: any) => item.id);
|
||||
data.cleanList = detailTable.value;
|
||||
if (params.isRefund) {
|
||||
data.isUnbooking = 1;
|
||||
} else if (params.isAudit) {
|
||||
data.state = 1;
|
||||
} else {
|
||||
data.state = 2;
|
||||
}
|
||||
// 0:未审核 1:审核通过 2:审核不通过
|
||||
await clean_orderUpdate({ ...data, id: editCleanOrderId.value });
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm>
|
||||
</BasicForm>
|
||||
<BasicForm> </BasicForm>
|
||||
<!-- 添加订单详情部分 -->
|
||||
<div class="mt-4">
|
||||
<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">
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
@@ -468,10 +482,26 @@ async function handleAudit(params: any) {
|
||||
<template v-if="isReadonly">
|
||||
<Button @click="handleViewDetail(record)">查看</Button>
|
||||
</template>
|
||||
<template v-else >
|
||||
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleViewDetail(record)">查看</Button>
|
||||
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleEditDetail(record, index)">编辑</Button>
|
||||
<Button danger size="small" @click="handleDeleteDetail(record, index)">
|
||||
<template v-else>
|
||||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
style="margin-right: 5px"
|
||||
@click="handleViewDetail(record)"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
style="margin-right: 5px"
|
||||
@click="handleEditDetail(record, index)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
@click="handleDeleteDetail(record, index)"
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</template>
|
||||
@@ -480,17 +510,26 @@ async function handleAudit(params: any) {
|
||||
</Table>
|
||||
<div>费用合计:{{ totalSumPeices }}元</div>
|
||||
</div>
|
||||
<CleanDetailModal @reload="handleDetailReload" @editReload="handleEditDetailReload"/>
|
||||
<CleanDetailModal
|
||||
@reload="handleDetailReload"
|
||||
@editReload="handleEditDetailReload"
|
||||
/>
|
||||
<template #footer v-if="isAudit">
|
||||
<a-button @click="modalApi.close()">取消</a-button>
|
||||
<a-button type="primary" @click="handleAudit({isAudit:true})">审核通过</a-button>
|
||||
<a-button danger @click="handleAudit({isAudit:false})">审核不通过</a-button>
|
||||
<a-button type="primary" @click="handleAudit({ isAudit: true })"
|
||||
>审核通过</a-button
|
||||
>
|
||||
<a-button danger @click="handleAudit({ isAudit: false })"
|
||||
>审核不通过</a-button
|
||||
>
|
||||
</template>
|
||||
<template #footer v-if="isRefund">
|
||||
<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>
|
||||
</BasicModal>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
@@ -5,6 +5,10 @@ import { resident_unitList } from '#/api/property/resident/unit';
|
||||
import { useCleanStore } from '#/store';
|
||||
import type { FormSchema } from '../../../../../../../packages/@core/ui-kit/form-ui/src/types';
|
||||
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();
|
||||
|
||||
export const querySchema: (areaList: any[]) => FormSchema[] = (areaList) => [
|
||||
@@ -111,7 +115,30 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'phone',
|
||||
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: '订单状态',
|
||||
field: 'state',
|
||||
width: 'auto',
|
||||
@@ -222,4 +249,25 @@ export const modalSchema: (isReadonly: boolean) => FormSchema[] = (isReadonly) =
|
||||
},
|
||||
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',
|
||||
},
|
||||
];
|
||||
|
@@ -23,7 +23,7 @@ import { onMounted, ref } from 'vue';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
const areaList = ref<any>(null);
|
||||
onMounted(async () => {
|
||||
areaList.value = await communityTree(5);
|
||||
areaList.value = await communityTree(4);
|
||||
});
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
|
@@ -3,15 +3,19 @@ import { computed, ref } from 'vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
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 { cloneDeep,handleNode,getPopupContainer } from '@vben/utils';
|
||||
import { cloneDeep, handleNode, getPopupContainer } from '@vben/utils';
|
||||
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 { getDictOptions } from '#/utils/dict';
|
||||
import {ultimoWater} from '#/api/property/costMeterWater'
|
||||
import {personList} from '#/api/property/resident/person'
|
||||
import { ultimoWater } from '#/api/property/costMeterWater';
|
||||
import { personList } from '#/api/property/resident/person';
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
const costItemsOptions = ref<any>([]);
|
||||
const meterTypeOptions = ref<any>([]);
|
||||
@@ -20,21 +24,21 @@ const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
const schema =[
|
||||
{
|
||||
label: '主键ID',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
const schema = [
|
||||
{
|
||||
label: '主键ID',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
label: '房间号',
|
||||
fieldName: 'roomId',
|
||||
component: 'TreeSelect',
|
||||
rules: 'required'
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '业主',
|
||||
@@ -43,13 +47,13 @@ const schema =[
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await personList({pageSize:1000000000,pageNum:1});
|
||||
const res = await personList({ pageSize: 1000000000, pageNum: 1 });
|
||||
return res.rows.map((item: any) => ({
|
||||
label: item.userName,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '费用类型',
|
||||
@@ -58,21 +62,29 @@ const schema =[
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_cbfylx'),
|
||||
onChange: async (value:any) => {
|
||||
onChange: async (value: any) => {
|
||||
// 请求并更新下拉
|
||||
if (!value) {
|
||||
costItemsOptions.value = [];
|
||||
meterTypeOptions.value = [];
|
||||
isMeterType.value = false
|
||||
isMeterType.value = false;
|
||||
} else {
|
||||
isMeterType.value = true
|
||||
const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: value });
|
||||
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({
|
||||
isMeterType.value = true;
|
||||
const costItemsRes = await costItemSettingList({
|
||||
pageSize: 1000000000,
|
||||
pageNum: 1,
|
||||
costType: value,
|
||||
});
|
||||
costItemsOptions.value = (costItemsRes?.rows || []).map((item) => ({
|
||||
label: item.chargeItem,
|
||||
value: item.id,
|
||||
}));
|
||||
const meterTypeRes = await meterReadingTypeList({ pageSize: 1000000000, pageNum: 1, costType: value == '5' ? 0 : 1 });
|
||||
meterTypeOptions.value = (meterTypeRes?.rows || []).map(item => ({
|
||||
const meterTypeRes = await meterReadingTypeList({
|
||||
pageSize: 1000000000,
|
||||
pageNum: 1,
|
||||
costType: value == '5' ? 0 : 1,
|
||||
});
|
||||
meterTypeOptions.value = (meterTypeRes?.rows || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
@@ -100,8 +112,8 @@ const schema =[
|
||||
meterTypeId: '',
|
||||
});
|
||||
console.log(await formApi.getValues());
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '收费项目',
|
||||
@@ -111,7 +123,7 @@ const schema =[
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '抄表类型',
|
||||
@@ -121,7 +133,7 @@ const schema =[
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '上期止度',
|
||||
@@ -144,7 +156,7 @@ const schema =[
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
disabled:true
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
label: '本期读表时间',
|
||||
@@ -161,7 +173,7 @@ const schema =[
|
||||
label: '说明',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
}
|
||||
},
|
||||
];
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
@@ -172,7 +184,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: schema,
|
||||
showDefaultActions: false,
|
||||
@@ -197,44 +209,51 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
isMeterType.value = true
|
||||
setupCommunitySelect()
|
||||
isMeterType.value = true;
|
||||
setupCommunitySelect();
|
||||
modalApi.modalLoading(true);
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
if (isUpdate.value && 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 });
|
||||
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({
|
||||
const costItemsRes = await costItemSettingList({
|
||||
pageSize: 1000000000,
|
||||
pageNum: 1,
|
||||
costType: record.costType,
|
||||
});
|
||||
costItemsOptions.value = (costItemsRes?.rows || []).map((item) => ({
|
||||
label: item.chargeItem,
|
||||
value: item.id,
|
||||
}));
|
||||
const meterTypeRes = await meterReadingTypeList({ pageSize: 1000000000, pageNum: 1, costType: record.costType == '5' ? 0 : 1 });
|
||||
meterTypeOptions.value = (meterTypeRes?.rows || []).map(item => ({
|
||||
const meterTypeRes = await meterReadingTypeList({
|
||||
pageSize: 1000000000,
|
||||
pageNum: 1,
|
||||
costType: record.costType == '5' ? 0 : 1,
|
||||
});
|
||||
meterTypeOptions.value = (meterTypeRes?.rows || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
]);
|
||||
},
|
||||
]);
|
||||
await formApi.setValues(record);
|
||||
console.log(2,await formApi.getValues());
|
||||
|
||||
console.log(2, await formApi.getValues());
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
@@ -253,29 +272,31 @@ async function handleConfirm() {
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
console.log(data);
|
||||
|
||||
await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data));
|
||||
await (isUpdate.value
|
||||
? costMeterWaterUpdate(data)
|
||||
: costMeterWaterAdd(data));
|
||||
resetInitialized();
|
||||
//必须要手动清空,不然ref会保留值
|
||||
costItemsOptions.value = [];
|
||||
meterTypeOptions.value = [];
|
||||
isMeterType.value = false
|
||||
// 更新表单下拉
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
]);
|
||||
isMeterType.value = false;
|
||||
// 更新表单下拉
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
]);
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
@@ -287,37 +308,37 @@ async function handleConfirm() {
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
await formApi.setValues({})
|
||||
await formApi.setValues({});
|
||||
costItemsOptions.value = [];
|
||||
meterTypeOptions.value = [];
|
||||
isMeterType.value = false
|
||||
// 更新表单下拉
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
]);
|
||||
isMeterType.value = false;
|
||||
// 更新表单下拉
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
]);
|
||||
resetInitialized();
|
||||
}
|
||||
// 获取服务地址
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(5);
|
||||
const areaList = await communityTree(4);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -342,17 +363,17 @@ async function setupCommunitySelect() {
|
||||
// 选中后显示在输入框的值
|
||||
treeNodeLabelProp: 'fullName',
|
||||
onChange: async (value: any) => {
|
||||
if(!value){
|
||||
await formApi.setValues({preDegrees:''})
|
||||
await formApi.setValues({preReadingTime:''})
|
||||
}else{
|
||||
const data = await ultimoWater(value)
|
||||
if(data){
|
||||
await formApi.setValues({preDegrees:data.curDegrees})
|
||||
await formApi.setValues({preReadingTime:data.curReadingTime})
|
||||
if (!value) {
|
||||
await formApi.setValues({ preDegrees: '' });
|
||||
await formApi.setValues({ preReadingTime: '' });
|
||||
} else {
|
||||
const data = await ultimoWater(value);
|
||||
if (data) {
|
||||
await formApi.setValues({ preDegrees: data.curDegrees });
|
||||
await formApi.setValues({ preReadingTime: data.curReadingTime });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}),
|
||||
fieldName: 'roomId',
|
||||
},
|
||||
|
@@ -1,25 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, ref} from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep, handleNode} from '@vben/utils';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, handleNode } from '@vben/utils';
|
||||
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
houseChargeAdd,
|
||||
houseChargeInfo,
|
||||
houseChargeUpdate
|
||||
houseChargeUpdate,
|
||||
} from '#/api/property/costManagement/houseCharge';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import {modalSchema} from './data';
|
||||
import {communityTree} from "#/api/property/community";
|
||||
import {costItemSettingList} from "#/api/property/costManagement/costItemSetting";
|
||||
import type {CostItemSettingVO} from "#/api/property/costManagement/costItemSetting/model";
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {personList} from "#/api/property/resident/person";
|
||||
import {renderDictValue} from "#/utils/render";
|
||||
import { modalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import { costItemSettingList } from '#/api/property/costManagement/costItemSetting';
|
||||
import type { CostItemSettingVO } from '#/api/property/costManagement/costItemSetting/model';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { personList } from '#/api/property/resident/person';
|
||||
import { renderDictValue } from '#/utils/render';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -38,14 +38,14 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -64,16 +64,16 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
await initRoomOptions()
|
||||
await queryCostItemOptions()
|
||||
await initCostTypeOptions()
|
||||
await queryPersonData()
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
await initRoomOptions();
|
||||
await queryCostItemOptions();
|
||||
await initCostTypeOptions();
|
||||
await queryPersonData();
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await houseChargeInfo(id);
|
||||
record.chargeTime = [record.startTime, record.endTime]
|
||||
record.chargeTime = [record.startTime, record.endTime];
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -85,15 +85,15 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const {valid} = await formApi.validate();
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if (data.chargeTime && data.chargeTime.length) {
|
||||
data.startTime = data.chargeTime[0]
|
||||
data.endTime = data.chargeTime[1]
|
||||
data.startTime = data.chargeTime[0];
|
||||
data.endTime = data.chargeTime[1];
|
||||
}
|
||||
await (isUpdate.value ? houseChargeUpdate(data) : houseChargeAdd(data));
|
||||
resetInitialized();
|
||||
@@ -115,10 +115,10 @@ async function handleClosed() {
|
||||
* 房间数据
|
||||
*/
|
||||
async function initRoomOptions() {
|
||||
const roomList = await communityTree(5);
|
||||
const roomList = await communityTree(4);
|
||||
const splitStr = '/';
|
||||
handleNode(roomList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -136,7 +136,7 @@ async function initRoomOptions() {
|
||||
showSearch: true,
|
||||
treeData: roomList,
|
||||
treeDefaultExpandAll: true,
|
||||
treeLine: {showLeafIcon: false},
|
||||
treeLine: { showLeafIcon: false },
|
||||
// 筛选的字段
|
||||
treeNodeFilterProp: 'label',
|
||||
// 选中后显示在输入框的值
|
||||
@@ -150,77 +150,93 @@ async function initRoomOptions() {
|
||||
/**
|
||||
* 查询费用项设置
|
||||
*/
|
||||
async function queryCostItemOptions(costType:string) {
|
||||
async function queryCostItemOptions(costType: string) {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
costType
|
||||
}
|
||||
const res = await costItemSettingList(params)
|
||||
costItemOptions.value = res.rows
|
||||
formApi.updateSchema([{
|
||||
componentProps: {
|
||||
options: costItemOptions.value,
|
||||
fieldNames: {label: 'chargeItem', value: 'id'},
|
||||
showSearch: true,
|
||||
optionFilterProp: 'chargeItem',
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
const costItem = costItemOptions.value.find(item => item.id == value)
|
||||
if(costItem){
|
||||
await formApi.setFieldValue('remark', `单价:${costItem.unitPrice} 附加费:${costItem.surcharge}`);
|
||||
costType,
|
||||
};
|
||||
const res = await costItemSettingList(params);
|
||||
costItemOptions.value = res.rows;
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: costItemOptions.value,
|
||||
fieldNames: { label: 'chargeItem', value: 'id' },
|
||||
showSearch: true,
|
||||
optionFilterProp: 'chargeItem',
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
const costItem = costItemOptions.value.find(
|
||||
(item) => item.id == value,
|
||||
);
|
||||
if (costItem) {
|
||||
await formApi.setFieldValue(
|
||||
'remark',
|
||||
`单价:${costItem.unitPrice} 附加费:${costItem.surcharge}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
fieldName: 'costItemsId',
|
||||
},
|
||||
fieldName: 'costItemsId'
|
||||
}])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化费用类型
|
||||
*/
|
||||
async function initCostTypeOptions(){
|
||||
formApi.updateSchema([{
|
||||
componentProps: {
|
||||
options: getDictOptions('pro_expense_type'),
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
await queryCostItemOptions(value)
|
||||
await formApi.setFieldValue('costItemsId', null)
|
||||
}
|
||||
}
|
||||
async function initCostTypeOptions() {
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: getDictOptions('pro_expense_type'),
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
await queryCostItemOptions(value);
|
||||
await formApi.setFieldValue('costItemsId', null);
|
||||
}
|
||||
},
|
||||
},
|
||||
fieldName: 'costType',
|
||||
},
|
||||
fieldName: 'costType'
|
||||
}])
|
||||
]);
|
||||
}
|
||||
|
||||
async function queryPersonData() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
};
|
||||
const res = await personList(params);
|
||||
const options = res.rows.map((user) => ({
|
||||
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex')
|
||||
+ '-' + user.phone + '-' + user.unitName,
|
||||
label:
|
||||
user.userName +
|
||||
'-' +
|
||||
renderDictValue(user.gender, 'sys_user_sex') +
|
||||
'-' +
|
||||
user.phone +
|
||||
'-' +
|
||||
user.unitName,
|
||||
value: user.id,
|
||||
}));
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
}),
|
||||
fieldName: 'personId',
|
||||
}])
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
}),
|
||||
fieldName: 'personId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm/>
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -54,7 +54,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'TreeSelect',
|
||||
fieldName: 'unitId',
|
||||
fieldName: 'buildingId',
|
||||
defaultValue: undefined,
|
||||
label: '社区建筑',
|
||||
rules: 'selectRequired',
|
||||
@@ -80,11 +80,19 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '房间数量',
|
||||
fieldName: 'roomCount',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:0,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '层高',
|
||||
fieldName: 'floorHeight',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:0,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@@ -90,12 +90,12 @@ async function handleConfirm() {
|
||||
* 初始化城市
|
||||
*/
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(3);
|
||||
const areaList = await communityTree(2);//楼层关联建筑
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 3) {
|
||||
if (node.level != 2) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -120,7 +120,7 @@ async function setupCommunitySelect() {
|
||||
// 选中后显示在输入框的值
|
||||
treeNodeLabelProp: 'fullName',
|
||||
}),
|
||||
fieldName: 'unitId',
|
||||
fieldName: 'buildingId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
@@ -1,18 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import {
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
@@ -138,8 +134,8 @@ function handleDownloadExcel() {
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:floor:remove']"
|
||||
type="primary"
|
||||
v-access:code="['property:floor:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
|
@@ -2,9 +2,13 @@
|
||||
import { computed, ref } from 'vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
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 { orderMaintainAdd, orderMaintainInfo, orderMaintainUpdate } from '#/api/property/conservationManagement';
|
||||
import {
|
||||
orderMaintainAdd,
|
||||
orderMaintainInfo,
|
||||
orderMaintainUpdate,
|
||||
} from '#/api/property/conservationManagement';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import { modalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
@@ -21,7 +25,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
@@ -45,7 +49,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
setupCommunitySelect()
|
||||
setupCommunitySelect();
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
@@ -91,12 +95,12 @@ async function handleClosed() {
|
||||
|
||||
// 获取服务地址
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(5);
|
||||
const areaList = await communityTree(4);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -132,4 +136,3 @@ async function setupCommunitySelect() {
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -1,12 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
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 { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
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 { modalSchema } from './data';
|
||||
@@ -19,9 +23,13 @@ const emit = defineEmits<{ reload: [] }>();
|
||||
const isUpdate = ref(false);
|
||||
const isReadonly = ref(false);
|
||||
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({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
@@ -58,12 +66,15 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
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 || '';
|
||||
isReadonly.value = !!readonly;
|
||||
if(isReadonly.value){
|
||||
if (isReadonly.value) {
|
||||
isUpdate.value = false;
|
||||
}else{
|
||||
} else {
|
||||
isUpdate.value = !!id;
|
||||
}
|
||||
// 查看与编辑时需要获取详情
|
||||
@@ -71,7 +82,11 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
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, 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);
|
||||
}
|
||||
@@ -93,7 +108,13 @@ async function handleConfirm() {
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
// data.productIds = detailTable.value.map((item:any) => item.productId);
|
||||
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();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
@@ -146,18 +167,19 @@ const detailColumns = [
|
||||
];
|
||||
function handleAddDetail() {
|
||||
// 传递已选产品id列表
|
||||
const selectedIds = detailTable.value.map((item: any) => item.productId || item.plantName);
|
||||
detailModalApi.setData({ selectedIds,add:true });
|
||||
const selectedIds = detailTable.value.map(
|
||||
(item: any) => item.productId || item.plantName,
|
||||
);
|
||||
detailModalApi.setData({ selectedIds, add: true });
|
||||
detailModalApi.open();
|
||||
}
|
||||
//添加植物组合包产品
|
||||
function handleDetailReload (data: any) {
|
||||
function handleDetailReload(data: any) {
|
||||
detailTable.value.push(data);
|
||||
}
|
||||
// 编辑植物组合包产品
|
||||
function handleEditDetailReload (data: any) {
|
||||
function handleEditDetailReload(data: any) {
|
||||
detailTable.value[data.index] = data;
|
||||
|
||||
}
|
||||
// 删除植物组合包产品
|
||||
function handleDeleteDetail(record: any, index: number) {
|
||||
@@ -171,14 +193,16 @@ function handleViewDetail(record: any) {
|
||||
// 编辑产品详情
|
||||
function handleEditDetail(record: any, index: number) {
|
||||
// 编辑时,排除当前项id
|
||||
const selectedIds = detailTable.value.filter((_: any, i: number) => i !== index).map((item: any) => item.productId || item.plantName);
|
||||
detailModalApi.setData({ ...record, index, selectedIds,edit:true });
|
||||
const selectedIds = detailTable.value
|
||||
.filter((_: any, i: number) => i !== index)
|
||||
.map((item: any) => item.productId || item.plantName);
|
||||
detailModalApi.setData({ ...record, index, selectedIds, edit: true });
|
||||
detailModalApi.open();
|
||||
}
|
||||
//分类字典
|
||||
function getPlantTypeLabel(value: string | number) {
|
||||
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;
|
||||
}
|
||||
</script>
|
||||
@@ -186,10 +210,18 @@ function getPlantTypeLabel(value: string | number) {
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<!-- 添加产品部分、 -->
|
||||
<!-- 添加产品部分、 -->
|
||||
<div class="mt-4">
|
||||
<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">
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
@@ -204,16 +236,38 @@ function getPlantTypeLabel(value: string | number) {
|
||||
{{ index + 1 }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'plantType'">
|
||||
<div>{{getPlantTypeLabel(record.plantType)}}</div>
|
||||
<div>{{ getPlantTypeLabel(record.plantType) }}</div>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
<template v-if="isReadonly">
|
||||
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleViewDetail(record)">查看</Button>
|
||||
<template v-if="isReadonly">
|
||||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
style="margin-right: 5px"
|
||||
@click="handleViewDetail(record)"
|
||||
>查看</Button
|
||||
>
|
||||
</template>
|
||||
<template v-else >
|
||||
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleViewDetail(record)">查看</Button>
|
||||
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleEditDetail(record, index)">编辑</Button>
|
||||
<Button danger size="small" @click="handleDeleteDetail(record, index)">
|
||||
<template v-else>
|
||||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
style="margin-right: 5px"
|
||||
@click="handleViewDetail(record)"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
style="margin-right: 5px"
|
||||
@click="handleEditDetail(record, index)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
@click="handleDeleteDetail(record, index)"
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</template>
|
||||
@@ -222,7 +276,10 @@ function getPlantTypeLabel(value: string | number) {
|
||||
</Table>
|
||||
<!-- <div>费用合计:{{ totalSumPeices }}元</div> -->
|
||||
</div>
|
||||
<ProductDetailModal @reload="handleDetailReload" @editReload="handleEditDetailReload"/>
|
||||
<ProductDetailModal
|
||||
@reload="handleDetailReload"
|
||||
@editReload="handleEditDetailReload"
|
||||
/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -1,23 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui'
|
||||
import { $t } from '@vben/locales'
|
||||
import { cloneDeep, handleNode } from '@vben/utils'
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, handleNode } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form'
|
||||
import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident/unit'
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
resident_unitAdd,
|
||||
resident_unitInfo,
|
||||
resident_unitUpdate,
|
||||
} from '#/api/property/resident/unit';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data'
|
||||
import { communityTree } from "#/api/property/community"
|
||||
import { modalSchema } from './data';
|
||||
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(() => {
|
||||
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({
|
||||
commonConfig: {
|
||||
@@ -28,19 +32,19 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
})
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
@@ -51,57 +55,57 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true)
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string }
|
||||
isUpdate.value = !!id
|
||||
await initLocationOptions()
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
await initLocationOptions();
|
||||
if (isUpdate.value && id) {
|
||||
const record = await resident_unitInfo(id)
|
||||
await formApi.setValues(record)
|
||||
const record = await resident_unitInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized()
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false)
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true)
|
||||
const { valid } = await formApi.validate()
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues())
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
|
||||
data.authBegDate = data.authTime[0]
|
||||
data.authEndDate = data.authTime[1]
|
||||
data.authBegDate = data.authTime[0];
|
||||
data.authEndDate = data.authTime[1];
|
||||
|
||||
await (isUpdate.value ? resident_unitUpdate(data) : resident_unitAdd(data))
|
||||
resetInitialized()
|
||||
emit('reload')
|
||||
modalApi.close()
|
||||
await (isUpdate.value ? resident_unitUpdate(data) : resident_unitAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false)
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 入驻位置数据
|
||||
*/
|
||||
async function initLocationOptions() {
|
||||
const locationList = await communityTree(5)
|
||||
const splitStr = '/'
|
||||
const locationList = await communityTree(4);
|
||||
const splitStr = '/';
|
||||
handleNode(locationList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
node.disabled = true
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
@@ -124,19 +128,17 @@ async function initLocationOptions() {
|
||||
}),
|
||||
fieldName: 'location',
|
||||
},
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm()
|
||||
resetInitialized()
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm>
|
||||
</BasicForm>
|
||||
<BasicForm> </BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -10,15 +10,6 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
fieldName: 'communityName',
|
||||
label: '社区',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orientation',
|
||||
label: '朝向',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_direction_towards),
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
@@ -47,30 +38,22 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'area',
|
||||
},
|
||||
{
|
||||
title: '套内面积',
|
||||
title: '使用面积',
|
||||
field: 'insideInArea',
|
||||
},
|
||||
{
|
||||
title: '户型',
|
||||
field: 'layout',
|
||||
},
|
||||
{
|
||||
title: '朝向',
|
||||
field: 'orientationName',
|
||||
},
|
||||
{
|
||||
title: '是否可售',
|
||||
field: 'isForSale',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.isForSale, DictEnum.wy_sf);
|
||||
},
|
||||
},
|
||||
title: '是否重要',
|
||||
field: 'isMatter',
|
||||
slots:{
|
||||
default:({row})=>{
|
||||
return renderDict(row.isMatter,'wy_fjzydj')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
title: '状态',
|
||||
field: 'statusName',
|
||||
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
@@ -97,6 +80,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
defaultValue: undefined,
|
||||
label: '社区建筑',
|
||||
rules: 'selectRequired',
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
{
|
||||
label: '房间号',
|
||||
@@ -112,42 +96,34 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_room_type),
|
||||
},
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '建筑面积',
|
||||
fieldName: 'area',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:0,
|
||||
},
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '套内面积',
|
||||
label: '使用面积',
|
||||
fieldName: 'insideInArea',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:0,
|
||||
}
|
||||
},
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '户型',
|
||||
fieldName: 'layout',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '朝向',
|
||||
fieldName: 'orientation',
|
||||
label: '是否重要',
|
||||
fieldName: 'isMatter',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_direction_towards),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '是否可售',
|
||||
fieldName: 'isForSale',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_sf),
|
||||
options: getDictOptions('wy_fjzydj'),
|
||||
},
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
@@ -157,5 +133,15 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_fjzt),
|
||||
},
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '房间图片',
|
||||
fieldName: 'imgUrl',
|
||||
component: 'ImageUpload',
|
||||
componentProps: {
|
||||
maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
];
|
||||
|
@@ -59,6 +59,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
await formApi.setValues({
|
||||
...record,
|
||||
isForSale: String(record.isForSale),
|
||||
status:String(record.status),
|
||||
roomType:String(record.roomType),
|
||||
});
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -91,12 +93,12 @@ async function handleConfirm() {
|
||||
* 初始化城市
|
||||
*/
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(4);
|
||||
const areaList = await communityTree(3);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 4) {
|
||||
if (node.level != 3) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
|
@@ -118,7 +118,6 @@ async function queryAddServices() {
|
||||
unit: item.unit,
|
||||
quantity: 0
|
||||
}))
|
||||
console.log(res,addServiceList.value);
|
||||
}
|
||||
|
||||
async function queryPersonData() {
|
||||
@@ -201,7 +200,7 @@ async function changeProjectNum() {
|
||||
<Table :dataSource="addServiceList" v-bind="slotProps" :columns="addServiceColumns"
|
||||
:pagination="false"
|
||||
size="small" :show-header="false" bordered>
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.field === 'price'">
|
||||
{{ record.price + '元/' + renderDictValue(record.unit, 'pro_product_unit') }}
|
||||
</template>
|
||||
|
@@ -6,21 +6,40 @@
|
||||
layout="inline"
|
||||
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="会议日期">
|
||||
<DatePicker v-model:value="formState.appointmentTime" style="width: 200px;"/>
|
||||
<DatePicker v-model:value="formState.appointmentTime" style="width: 180px;"/>
|
||||
</a-form-item>
|
||||
<a-form-item label="会议时段">
|
||||
<TimeRangePicker style="width: 200px;" format="HH:mm"
|
||||
v-model:value="formState.openHours"></TimeRangePicker>
|
||||
</a-form-item>
|
||||
<a-form-item label="参会人数" style="width: 400px;">
|
||||
<InputNumber style="width: 200px;" placeholder="请输入参会人数"
|
||||
<a-form-item label="参会人数">
|
||||
<InputNumber style="width: 150px;" placeholder="请输入参会人数"
|
||||
v-model:value="formState.personNumber"/>
|
||||
</a-form-item>
|
||||
<a-form-item class="form-button">
|
||||
<a-form-item >
|
||||
<a-button @click="handleClean">重置</a-button>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<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>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
@@ -57,24 +76,27 @@ import {
|
||||
InputNumber,
|
||||
Empty,
|
||||
Alert,
|
||||
DatePicker
|
||||
DatePicker, Select,SelectOption
|
||||
} from 'ant-design-vue';
|
||||
import conferenceAddServicesModal from '../conferenceReservations/conferenceReservations-modal.vue';
|
||||
import {notlist} from "#/api/property/roomBooking/conferenceSettings";
|
||||
import type {MeetVO} from "#/api/property/roomBooking/conferenceSettings/model";
|
||||
import {renderDictValue} from "#/utils/render";
|
||||
import type { Dayjs } from 'dayjs';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
interface FormState {
|
||||
openHours?: any[];
|
||||
personNumber?: number|undefined;
|
||||
appointmentTime?:Dayjs|undefined
|
||||
appointmentTime?:Dayjs|undefined;
|
||||
meetingRoomType:string|undefined;
|
||||
}
|
||||
|
||||
const formState = reactive<FormState>({
|
||||
openHours: [],
|
||||
personNumber: undefined,
|
||||
appointmentTime:undefined
|
||||
appointmentTime:undefined,
|
||||
meetingRoomType:undefined,
|
||||
});
|
||||
const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE;
|
||||
|
||||
@@ -94,15 +116,16 @@ async function handleSearch() {
|
||||
|
||||
const handleClean = () => {
|
||||
formState.openHours = [];
|
||||
formState.personNumber = null;
|
||||
formState.personNumber = undefined;
|
||||
formState.appointmentTime = undefined;
|
||||
formState.meetingRoomType = undefined;
|
||||
}
|
||||
|
||||
const [modal, modalApi] = useVbenModal({
|
||||
connectedComponent: conferenceAddServicesModal,
|
||||
});
|
||||
|
||||
function handleAdd(id:string) {
|
||||
function handleAdd(id:string|number) {
|
||||
modalApi.setData({id});
|
||||
modalApi.open();
|
||||
}
|
||||
@@ -110,18 +133,7 @@ function handleAdd(id:string) {
|
||||
|
||||
<style lang="scss">
|
||||
.form-box {
|
||||
width: 100%;
|
||||
padding: 10px 30px 0 30px;
|
||||
position: relative;
|
||||
|
||||
.form-button {
|
||||
position: absolute;
|
||||
right: 30px;
|
||||
|
||||
.primary-button {
|
||||
margin-left: 15px;
|
||||
}
|
||||
}
|
||||
margin: 10px 0 0 5px;
|
||||
}
|
||||
|
||||
.card-box {
|
||||
|
@@ -39,6 +39,11 @@ async function handleOpenChange(open: boolean) {
|
||||
<DescriptionsItem label="会议室名称">
|
||||
{{ conferenceSettingsDetail.name }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="会议室类型">
|
||||
<component
|
||||
:is="renderDict(conferenceSettingsDetail.meetingRoomType,'meeting_room_type')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="可容纳人数">
|
||||
{{ conferenceSettingsDetail.personNumber }}
|
||||
</DescriptionsItem>
|
||||
|
@@ -1,19 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, ref} from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep, getPopupContainer, handleNode} from '@vben/utils';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, getPopupContainer, handleNode } from '@vben/utils';
|
||||
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import {meetAdd, meetInfo, meetUpdate} from '#/api/property/roomBooking/conferenceSettings';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
meetAdd,
|
||||
meetInfo,
|
||||
meetUpdate,
|
||||
} from '#/api/property/roomBooking/conferenceSettings';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import {modalSchema} from './data';
|
||||
import {TimeRangePicker} from 'ant-design-vue'
|
||||
import {renderDictValue} from "#/utils/render";
|
||||
import {personList} from "#/api/property/resident/person";
|
||||
import {communityTree} from "#/api/property/community";
|
||||
import { modalSchema } from './data';
|
||||
import { TimeRangePicker } from 'ant-design-vue';
|
||||
import { renderDictValue } from '#/utils/render';
|
||||
import { personList } from '#/api/property/resident/person';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import dayjs from 'dayjs';
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -31,14 +35,14 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -58,20 +62,20 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
await formApi.setValues({
|
||||
expenseType:'1',
|
||||
isCheck:'0',
|
||||
})
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
expenseType: '1',
|
||||
isCheck: '0',
|
||||
});
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
await queryPerson()
|
||||
await initLocationOptions()
|
||||
await queryPerson();
|
||||
await initLocationOptions();
|
||||
if (isUpdate.value && id) {
|
||||
const record = await meetInfo(id);
|
||||
record.expenseType=record.expenseType.toString()
|
||||
record.isCheck=record.isCheck.toString()
|
||||
record.expenseType = record.expenseType.toString();
|
||||
record.isCheck = record.isCheck.toString();
|
||||
let hour = record.openHours.split('-');
|
||||
if(hour.length>1){
|
||||
record.openHours=[dayjs(hour[0],'HH:mm'),dayjs(hour[1],'HH:mm')]
|
||||
if (hour.length > 1) {
|
||||
record.openHours = [dayjs(hour[0], 'HH:mm'), dayjs(hour[1], 'HH:mm')];
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
@@ -84,14 +88,17 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const {valid} = await formApi.validate();
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
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));
|
||||
resetInitialized();
|
||||
@@ -113,20 +120,27 @@ async function queryPerson() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
};
|
||||
const res = await personList(params);
|
||||
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,
|
||||
}));
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
filterOption: filterOption,
|
||||
showSearch:true,
|
||||
}),
|
||||
fieldName: 'principals',
|
||||
}])
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
filterOption: filterOption,
|
||||
showSearch: true,
|
||||
}),
|
||||
fieldName: 'principals',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
const filterOption = (input: string, option: any) => {
|
||||
@@ -137,10 +151,10 @@ const filterOption = (input: string, option: any) => {
|
||||
* 地址数据
|
||||
*/
|
||||
async function initLocationOptions() {
|
||||
const locationList = await communityTree(5);
|
||||
const locationList = await communityTree(4);
|
||||
const splitStr = '/';
|
||||
handleNode(locationList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -159,7 +173,7 @@ async function initLocationOptions() {
|
||||
showSearch: true,
|
||||
treeData: locationList,
|
||||
treeDefaultExpandAll: true,
|
||||
treeLine: {showLeafIcon: false},
|
||||
treeLine: { showLeafIcon: false },
|
||||
// 筛选的字段
|
||||
treeNodeFilterProp: 'label',
|
||||
// 选中后显示在输入框的值
|
||||
@@ -180,4 +194,3 @@ async function initLocationOptions() {
|
||||
</BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -37,6 +37,16 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'name',
|
||||
minWidth:100,
|
||||
},
|
||||
{
|
||||
title: '会议室类型',
|
||||
field: 'meetingRoomType',
|
||||
slots: {
|
||||
default: ({row}) => {
|
||||
return renderDict(row.meetingRoomType, 'meeting_room_type');
|
||||
},
|
||||
},
|
||||
minWidth:100,
|
||||
},
|
||||
// {
|
||||
// title: '会议室地址',
|
||||
// field: 'locationName',
|
||||
@@ -99,7 +109,15 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
fieldName: 'name',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
formItemClass: 'col-span-1',
|
||||
},
|
||||
{
|
||||
label: '会议室类型',
|
||||
fieldName: 'meetingRoomType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('meeting_room_type'),
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '可容纳人数',
|
||||
|
@@ -1,7 +1,5 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { renderDict } from '#/utils/render';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -19,14 +17,14 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
fieldName: 'interviewedUnit',
|
||||
label: '邀约单位',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_appointment_tatus'),
|
||||
},
|
||||
fieldName: 'serveStatus',
|
||||
label: '预约状态',
|
||||
},
|
||||
// {
|
||||
// component: 'Select',
|
||||
// componentProps: {
|
||||
// options: getDictOptions('wy_appointment_tatus'),
|
||||
// },
|
||||
// fieldName: 'serveStatus',
|
||||
// label: '预约状态',
|
||||
// },
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
@@ -64,7 +62,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'interviewedUnit',
|
||||
},
|
||||
{
|
||||
title: '拜访事由',
|
||||
title: '事由',
|
||||
field: 'visitingReason',
|
||||
},
|
||||
{
|
||||
@@ -78,24 +76,24 @@ export const columns: VxeGridProps['columns'] = [
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '是否预约车位',
|
||||
field: 'bookingParkingSpace',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.bookingParkingSpace, 'wy_parking_spot');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '预约状态',
|
||||
field: 'serveStatus',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.serveStatus, 'wy_appointment_tatus');
|
||||
},
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '是否预约车位',
|
||||
// field: 'bookingParkingSpace',
|
||||
// slots: {
|
||||
// default: ({ row }) => {
|
||||
// return renderDict(row.bookingParkingSpace, 'wy_parking_spot');
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '预约状态',
|
||||
// field: 'serveStatus',
|
||||
// slots: {
|
||||
// default: ({ row }) => {
|
||||
// return renderDict(row.serveStatus, 'wy_appointment_tatus');
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '提交时间',
|
||||
field: 'createTime',
|
||||
@@ -150,7 +148,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '拜访事由',
|
||||
label: '事由',
|
||||
fieldName: 'visitingReason',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
@@ -169,29 +167,29 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '预约车位',
|
||||
fieldName: 'bookingParkingSpace',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '否', value: '1' },
|
||||
{ label: '是', value: '0' },
|
||||
],
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '车牌号',
|
||||
fieldName: 'licensePlate',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
// 类型不为按钮时显示
|
||||
show: (values) => values.bookingParkingSpace === '0',
|
||||
triggerFields: ['bookingParkingSpace'],
|
||||
},
|
||||
},
|
||||
// {
|
||||
// label: '预约车位',
|
||||
// fieldName: 'bookingParkingSpace',
|
||||
// component: 'RadioGroup',
|
||||
// componentProps: {
|
||||
// options: [
|
||||
// { label: '否', value: '1' },
|
||||
// { label: '是', value: '0' },
|
||||
// ],
|
||||
// },
|
||||
// rules: 'required',
|
||||
// },
|
||||
// {
|
||||
// label: '车牌号',
|
||||
// fieldName: 'licensePlate',
|
||||
// component: 'Input',
|
||||
// rules: 'required',
|
||||
// dependencies: {
|
||||
// // 类型不为按钮时显示
|
||||
// show: (values) => values.bookingParkingSpace === '0',
|
||||
// triggerFields: ['bookingParkingSpace'],
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// label: '人脸图片',
|
||||
// fieldName: 'facePictures',
|
||||
|
@@ -53,25 +53,25 @@ async function handleOpenChange(open: boolean) {
|
||||
<DescriptionsItem label="被访单位">
|
||||
{{ visitorInvitationDetail.interviewedUnit }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="拜访事由">
|
||||
<DescriptionsItem label="事由">
|
||||
{{ visitorInvitationDetail.visitingReason }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="拜访时间">
|
||||
{{ visitorInvitationDetail.visitingBeginTime+' - '+visitorInvitationDetail.visitingBeginTime }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="是否预约车位" v-if="visitorInvitationDetail.bookingParkingSpace!=null">
|
||||
<component
|
||||
:is="renderDict(visitorInvitationDetail.bookingParkingSpace,'wy_parking_spot')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="是否预约车位" v-if="visitorInvitationDetail.bookingParkingSpace!=null">-->
|
||||
<!-- <component-->
|
||||
<!-- :is="renderDict(visitorInvitationDetail.bookingParkingSpace,'wy_parking_spot')"-->
|
||||
<!-- />-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="车牌号">
|
||||
{{ visitorInvitationDetail.licensePlate }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="预约状态" v-if="visitorInvitationDetail.serveStatus!=null">
|
||||
<component
|
||||
:is="renderDict(visitorInvitationDetail.serveStatus,'wy_appointment_tatus')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="预约状态" v-if="visitorInvitationDetail.serveStatus!=null">-->
|
||||
<!-- <component-->
|
||||
<!-- :is="renderDict(visitorInvitationDetail.serveStatus,'wy_appointment_tatus')"-->
|
||||
<!-- />-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="提交时间">
|
||||
{{ visitorInvitationDetail.createTime }}
|
||||
</DescriptionsItem>
|
||||
|
@@ -1,7 +1,5 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { renderDict } from '#/utils/render';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -19,14 +17,14 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
fieldName: 'interviewedUnit',
|
||||
label: '被访单位',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_appointment_tatus'),
|
||||
},
|
||||
fieldName: 'serveStatus',
|
||||
label: '预约状态',
|
||||
},
|
||||
// {
|
||||
// component: 'Select',
|
||||
// componentProps: {
|
||||
// options: getDictOptions('wy_appointment_tatus'),
|
||||
// },
|
||||
// fieldName: 'serveStatus',
|
||||
// label: '预约状态',
|
||||
// },
|
||||
// {
|
||||
// component: 'RangePicker',
|
||||
// componentProps: {
|
||||
@@ -87,7 +85,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'interviewedUnit',
|
||||
},
|
||||
{
|
||||
title: '拜访事由',
|
||||
title: '事由',
|
||||
field: 'visitingReason',
|
||||
},
|
||||
{
|
||||
@@ -101,24 +99,24 @@ export const columns: VxeGridProps['columns'] = [
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '是否预约车位',
|
||||
field: 'bookingParkingSpace',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.bookingParkingSpace, 'wy_parking_spot');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '预约状态',
|
||||
field: 'serveStatus',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.serveStatus, 'wy_appointment_tatus');
|
||||
},
|
||||
},
|
||||
},
|
||||
// {
|
||||
// title: '是否预约车位',
|
||||
// field: 'bookingParkingSpace',
|
||||
// slots: {
|
||||
// default: ({ row }) => {
|
||||
// return renderDict(row.bookingParkingSpace, 'wy_parking_spot');
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// title: '预约状态',
|
||||
// field: 'serveStatus',
|
||||
// slots: {
|
||||
// default: ({ row }) => {
|
||||
// return renderDict(row.serveStatus, 'wy_appointment_tatus');
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '提交时间',
|
||||
field: 'updateTime',
|
||||
@@ -131,3 +129,27 @@ export const columns: VxeGridProps['columns'] = [
|
||||
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',
|
||||
}
|
||||
];
|
||||
|
@@ -12,7 +12,11 @@ import {
|
||||
} from '#/api/property/visitorManagement';
|
||||
import type { VisitorManagementForm } from '#/api/property/visitorManagement/model';
|
||||
import visitorTodoDetail from './visitorTodo-detail.vue';
|
||||
import visitorTodoModal from './visitorTodo-modal.vue';
|
||||
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 = {
|
||||
commonConfig: {
|
||||
@@ -68,12 +72,14 @@ async function handleInfo(row: Required<VisitorManagementForm>) {
|
||||
visitorTodoApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<VisitorManagementForm>) {
|
||||
row.serveStatus=1
|
||||
await visitorManagementUpdate(row);
|
||||
await tableApi.query();
|
||||
}
|
||||
const [VisitorTodoModal, modalApi] = useVbenModal({
|
||||
connectedComponent: visitorTodoModal,
|
||||
});
|
||||
|
||||
async function handleEdit(row: Required<VisitorManagementForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -86,22 +92,16 @@ async function handleDelete(row: Required<VisitorManagementForm>) {
|
||||
>
|
||||
{{ $t('pages.common.info') }}
|
||||
</ghost-button>
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认审核状态?"
|
||||
@confirm="handleDelete(row)"
|
||||
v-if="row.serveStatus === '0'"
|
||||
<ghost-button
|
||||
@click.stop="handleEdit(row)"
|
||||
v-if="row.serveStatus === 0"
|
||||
>
|
||||
<ghost-button
|
||||
@click.stop=""
|
||||
>
|
||||
{{ '审核' }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
{{ '审核' }}
|
||||
</ghost-button>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<VisitorTodoModal @reload="tableApi.query()" />
|
||||
<visitorTodoDetailModal/>
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -53,25 +53,25 @@ async function handleOpenChange(open: boolean) {
|
||||
<DescriptionsItem label="被访单位">
|
||||
{{ visitorTodoDetail.interviewedUnit }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="拜访事由">
|
||||
<DescriptionsItem label="事由">
|
||||
{{ visitorTodoDetail.visitingReason }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="拜访时间">
|
||||
{{ visitorTodoDetail.visitingBeginTime+' - '+visitorTodoDetail.visitingBeginTime }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="是否预约车位" v-if="visitorTodoDetail.bookingParkingSpace!=null">
|
||||
<component
|
||||
:is="renderDict(visitorTodoDetail.bookingParkingSpace,'wy_parking_spot')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="是否预约车位" v-if="visitorTodoDetail.bookingParkingSpace!=null">-->
|
||||
<!-- <component-->
|
||||
<!-- :is="renderDict(visitorTodoDetail.bookingParkingSpace,'wy_parking_spot')"-->
|
||||
<!-- />-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="车牌号">
|
||||
{{ visitorTodoDetail.licensePlate }}
|
||||
</DescriptionsItem>
|
||||
<DescriptionsItem label="预约状态" v-if="visitorTodoDetail.serveStatus!=null">
|
||||
<component
|
||||
:is="renderDict(visitorTodoDetail.serveStatus,'wy_appointment_tatus')"
|
||||
/>
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="预约状态" v-if="visitorTodoDetail.serveStatus!=null">-->
|
||||
<!-- <component-->
|
||||
<!-- :is="renderDict(visitorTodoDetail.serveStatus,'wy_appointment_tatus')"-->
|
||||
<!-- />-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="提交时间">
|
||||
{{ visitorTodoDetail.createTime }}
|
||||
</DescriptionsItem>
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user