综合管理

This commit is contained in:
FLL 2025-06-27 15:16:06 +08:00
parent ca24234e57
commit 01ddd1174a
20 changed files with 139 additions and 318 deletions

View File

@ -1,8 +1,6 @@
import type { BuildingVO, BuildingForm, BuildingQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

View File

@ -296,10 +296,10 @@ export interface BuildingQuery extends PageQuery {
*/
cqbh?: string;
/**
*
*/
params?: any;
/**
*
*/
params?: any;
}

View File

@ -1,8 +1,6 @@
import type { CommunityVO, CommunityForm, CommunityQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

View File

@ -217,6 +217,7 @@ export interface CommunityQuery extends PageQuery {
*/
params?: any;
}
export interface Community extends BaseEntity {
/**
*

View File

@ -1,8 +1,6 @@
import type { FloorVO, FloorForm, FloorQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

View File

@ -1,8 +1,6 @@
import type { RoomVO, RoomForm, RoomQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

View File

@ -14,7 +14,6 @@ const [BasicModal, modalApi] = useVbenModal({
});
const buildingDetail = shallowRef<null | Building>(null);
async function handleOpenChange(open: boolean) {
if (!open) {
return null;
@ -22,7 +21,6 @@ async function handleOpenChange(open: boolean) {
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id: number | string };
const response = await buildingInfo(id);
//
buildingDetail.value = response;
modalApi.modalLoading(false);
}
@ -31,15 +29,15 @@ async function handleOpenChange(open: boolean) {
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="建筑管理信息" class="w-[70%]">
<Descriptions v-if="buildingDetail" size="small" :column="2" bordered :labelStyle="{width:'100px'}">
<DescriptionsItem label="园区编码">
<DescriptionsItem label="小区/园区">
{{ buildingDetail.communityCode }}
</DescriptionsItem>
<DescriptionsItem label="建筑编码">
{{ buildingDetail.buildingCode }}
</DescriptionsItem>
<DescriptionsItem label="建筑名称">
{{ buildingDetail.buildingName }}
</DescriptionsItem>
<DescriptionsItem label="建筑编码">
{{ buildingDetail.buildingCode }}
</DescriptionsItem>
<DescriptionsItem label="省">
{{ buildingDetail.province }}
</DescriptionsItem>
@ -96,11 +94,6 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="组织编码">
{{ buildingDetail.orgCode }}
</DescriptionsItem>
<DescriptionsItem label="数据状态" v-if="buildingDetail.dataState!=null">
<component
:is="renderDict(buildingDetail.dataState,'wy_qylx')"
/>
</DescriptionsItem>
<DescriptionsItem label="修改时间">
{{ buildingDetail.modifyTime }}
</DescriptionsItem>

View File

@ -1,30 +1,24 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
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 { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
}
@ -42,7 +36,6 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
@ -53,16 +46,13 @@ const [BasicModal, modalApi] = useVbenModal({
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await buildingInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
@ -74,7 +64,6 @@ async function handleConfirm() {
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? buildingUpdate(data) : buildingAdd(data));
resetInitialized();

View File

@ -1,6 +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';
@ -8,46 +7,42 @@ export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'communityCode',
label: '园区编码',
},
{
component: 'Input',
fieldName: 'buildingCode',
label: '建筑编码',
label: '小区/园区',
},
{
component: 'Input',
fieldName: 'buildingName',
label: '建筑名称',
},
{
component: 'Input',
fieldName: 'buildingCode',
label: '建筑编码',
},
{
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_CQXZ 便于维护
options: getDictOptions('wy_cqxz'),
},
fieldName: 'cqxz',
label: '产权性质',
},
{
component: 'Input',
fieldName: 'dataState',
label: '数据状态',
}
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '园区编码',
field: 'communityCode',
width: 'auto'
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '建筑编码',
field: 'buildingCode',
title: '小区/园区',
field: 'communityCode',
width: 'auto'
},
{
@ -55,6 +50,11 @@ export const columns: VxeGridProps['columns'] = [
field: 'buildingName',
width: 'auto'
},
{
title: '建筑编码',
field: 'buildingCode',
width: 'auto'
},
{
title: '地址',
field: 'addr',
@ -66,7 +66,6 @@ export const columns: VxeGridProps['columns'] = [
width: 'auto',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_CQXZ 便于维护
return renderDict(row.cqxz, 'wy_cqxz');
},
},
@ -121,11 +120,6 @@ export const columns: VxeGridProps['columns'] = [
field: 'bzcg',
width: 'auto'
},
{
title: '数据状态',
field: 'dataState',
width: 'auto'
},
{
title: '修改时间',
field: 'modifyTime',
@ -151,17 +145,11 @@ export const modalSchema: FormSchemaGetter = () => [
},
},
{
label: '园区编码',
label: '小区/园区',
fieldName: 'communityCode',
component: 'Input',
rules: 'required',
},
{
label: '建筑编码',
fieldName: 'buildingCode',
component: 'Input',
rules: 'required',
},
{
label: '建筑名称',
fieldName: 'buildingName',
@ -169,8 +157,8 @@ export const modalSchema: FormSchemaGetter = () => [
rules: 'required',
},
{
label: '组织编码',
fieldName: 'orgCode',
label: '建筑编码',
fieldName: 'buildingCode',
component: 'Input',
rules: 'required',
},
@ -215,7 +203,6 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'cqxz',
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_CQXZ 便于维护
options: getDictOptions('wy_cqxz'),
},
rules: 'selectRequired',
@ -233,7 +220,7 @@ export const modalSchema: FormSchemaGetter = () => [
rules: 'required',
},
{
label: '地编号',
label: '地编号',
fieldName: 'tdbh',
component: 'Input',
rules: 'required',
@ -284,20 +271,5 @@ export const modalSchema: FormSchemaGetter = () => [
label: '排序字段',
fieldName: 'sort',
component: 'Input',
},
{
label: '数据状态',
fieldName: 'dataState',
component: 'Input',
},
{
label: '修改时间',
fieldName: 'modifyTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
}
];

View File

@ -2,13 +2,11 @@
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
buildingExport,
buildingList,
@ -16,12 +14,9 @@ import {
} from '#/api/property/building';
import type { BuildingForm } from '#/api/property/building/model';
import { commonDownloadExcel } from '#/utils/file/download';
import buildingModal from './building-modal.vue';
import buildingDetail from './building-detail.vue';
import { columns, querySchema } from './data';
import unitInfoModal from "#/views/property/resident/unit/unit-detail.vue";
import type {Resident_unitForm} from "#/api/property/resident/unit/model";
const formOptions: VbenFormProps = {
commonConfig: {
@ -32,28 +27,13 @@ const formOptions: VbenFormProps = {
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
//
highlight: true,
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
@ -72,7 +52,6 @@ const gridOptions: VxeGridProps = {
rowConfig: {
keyField: 'id',
},
//
id: 'property-building-index'
};
@ -84,13 +63,16 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
const [BuildingModal, modalApi] = useVbenModal({
connectedComponent: buildingModal,
});
const [buildingDetailModal, buildingDetailApi] = useVbenModal({
connectedComponent: buildingDetail,
});
async function handleInfo(row: Required<BuildingForm>) {
// buildingDetailApi.setData({ id: row.id });
buildingDetailApi.setData({ id: row.id });
buildingDetailApi.open();
}
function handleAdd() {
modalApi.setData({});
modalApi.open();
@ -153,12 +135,6 @@ function handleDownloadExcel() {
>
{{ $t('pages.common.add') }}
</a-button>
<a-button
type="primary"
@click="handleInfo"
>
{{ $t('pages.common.info') }}
</a-button>
</Space>
</template>
<template #action="{ row }">

View File

@ -22,7 +22,6 @@ async function handleOpenChange(open: boolean) {
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id: number | string };
const response = await communityInfo(id);
//
communityDetail.value = response;
modalApi.modalLoading(false);
}
@ -31,13 +30,13 @@ async function handleOpenChange(open: boolean) {
<template>
<BasicModal :footer="false" :fullscreen-button="false" title="小区管理信息" class="w-[70%]">
<Descriptions v-if="communityDetail" size="small" :column="2" bordered :labelStyle="{width:'100px'}">
<DescriptionsItem label="区名称">
<DescriptionsItem label="区名称">
{{ communityDetail.communityName }}
</DescriptionsItem>
<DescriptionsItem label="区编码">
<DescriptionsItem label="区编码">
{{ communityDetail.communityCode }}
</DescriptionsItem>
<DescriptionsItem label="区类型" v-if="communityDetail.communityType!=null">
<DescriptionsItem label="区类型" v-if="communityDetail.communityType!=null">
<component
:is="renderDict(communityDetail.communityType,'wy_sqlx')"
/>
@ -66,11 +65,6 @@ async function handleOpenChange(open: boolean) {
<DescriptionsItem label="组织编码">
{{ communityDetail.orgCode }}
</DescriptionsItem>
<DescriptionsItem label="数据状态" v-if="communityDetail.dataState!=null">
<component
:is="renderDict(communityDetail.dataState,'wy_cqxz')"
/>
</DescriptionsItem>
<DescriptionsItem label="修改时间">
{{ communityDetail.modifyTime }}
</DescriptionsItem>

View File

@ -1,30 +1,24 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { communityAdd, communityInfo, communityUpdate } from '#/api/property/community';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
}
@ -42,7 +36,6 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
@ -53,16 +46,13 @@ const [BasicModal, modalApi] = useVbenModal({
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await communityInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
@ -74,7 +64,6 @@ async function handleConfirm() {
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? communityUpdate(data) : communityAdd(data));
resetInitialized();

View File

@ -1,6 +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';
@ -8,51 +7,47 @@ export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'communityName',
label: '区名称',
label: '区名称',
},
{
component: 'Input',
fieldName: 'communityCode',
label: '区编码',
label: '区编码',
},
{
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_SQLX 便于维护
options: getDictOptions('wy_sqlx'),
},
fieldName: 'communityType',
label: '社区类型',
},
{
component: 'Input',
fieldName: 'dataState',
label: '数据状态',
label: '小区类型',
}
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '主键',
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '社区名称',
title: '区名称',
field: 'communityName',
},
{
title: '区编码',
title: '区编码',
field: 'communityCode',
},
{
title: '区类型',
title: '区类型',
field: 'communityType',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_SQLX 便于维护
return renderDict(row.communityType, 'wy_sqlx');
},
},
@ -85,10 +80,6 @@ export const columns: VxeGridProps['columns'] = [
title: '小图图片',
field: 'img',
},
{
title: '数据状态',
field: 'dataState',
},
{
title: '修改时间',
field: 'modifyTime',
@ -113,23 +104,22 @@ export const modalSchema: FormSchemaGetter = () => [
},
},
{
label: '区名称',
label: '区名称',
fieldName: 'communityName',
component: 'Input',
rules: 'required',
},
{
label: '区编码',
label: '区编码',
fieldName: 'communityCode',
component: 'Input',
rules: 'required',
},
{
label: '区类型',
label: '区类型',
fieldName: 'communityType',
component: 'Select',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_SQLX 便于维护
options: getDictOptions('wy_sqlx'),
},
rules: 'selectRequired',
@ -175,24 +165,6 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'img',
component: 'ImageUpload',
componentProps: {
// accept: 'image/*', // 可选拓展名或者mime类型 ,拼接
// maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
},
},
{
label: '数据状态',
fieldName: 'dataState',
component: 'Input',
rules: 'required',
},
{
label: '修改时间',
fieldName: 'modifyTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
}
];

View File

@ -2,13 +2,11 @@
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
communityExport,
communityList,
@ -16,7 +14,6 @@ import {
} from '#/api/property/community';
import type { CommunityForm } from '#/api/property/community/model';
import { commonDownloadExcel } from '#/utils/file/download';
import communityModal from './community-modal.vue';
import { columns, querySchema } from './data';
import communityDetail from "#/views/property/community/community-detail.vue";
@ -31,28 +28,13 @@ const formOptions: VbenFormProps = {
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
//
highlight: true,
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
@ -71,7 +53,6 @@ const gridOptions: VxeGridProps = {
rowConfig: {
keyField: 'id',
},
//
id: 'property-community-index'
};
@ -83,11 +64,13 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
const [CommunityModal, modalApi] = useVbenModal({
connectedComponent: communityModal,
});
const [communityDetailModal, communityDetailApi] = useVbenModal({
connectedComponent: communityDetail,
});
async function handleInfo(row: Required<BuildingForm>) {
// communityDetailApi.setData({ id: row.id });
async function handleInfo(row: Required<CommunityForm>) {
communityDetailApi.setData({ id: row.id });
communityDetailApi.open();
}
@ -153,12 +136,6 @@ function handleDownloadExcel() {
>
{{ $t('pages.common.add') }}
</a-button>
<a-button
type="primary"
@click="handleInfo"
>
{{ $t('pages.common.info') }}
</a-button>
</Space>
</template>
<template #action="{ row }">

View File

@ -1,12 +1,11 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'communityCode',
label: '社区编码',
label: '小区/园区',
},
{
component: 'Input',
@ -15,32 +14,34 @@ export const querySchema: FormSchemaGetter = () => [
},
{
component: 'Input',
fieldName: 'floorCode',
label: '楼层编码',
fieldName: 'floorName',
label: '楼层名称',
},
{
component: 'Input',
fieldName: 'floorName',
label: '楼层数名称',
fieldName: 'floorCode',
label: '楼层编码',
},
{
component: 'Input',
fieldName: 'orgCode',
label: '组织编码',
},
{
component: 'Input',
fieldName: 'dataState',
label: '数据状态',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '社区编码',
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '小区/园区',
field: 'communityCode',
},
{
@ -48,12 +49,12 @@ export const columns: VxeGridProps['columns'] = [
field: 'buildingCode',
},
{
title: '楼层编码',
field: 'floorCode',
title: '楼层名称',
field: 'floorName',
},
{
title: '楼层数名称',
field: 'floorName',
title: '楼层编码',
field: 'floorCode',
},
{
title: '组织编码',
@ -79,7 +80,7 @@ export const modalSchema: FormSchemaGetter = () => [
},
},
{
label: '社区编码',
label: '小区/园区',
fieldName: 'communityCode',
component: 'Input',
rules: 'required',
@ -91,17 +92,23 @@ export const modalSchema: FormSchemaGetter = () => [
rules: 'required',
},
{
label: '楼层编码',
fieldName: 'floorCode',
label: '单元名称',
fieldName: 'buildingCode',
component: 'Input',
rules: 'required',
},
{
label: '楼层名称',
label: '楼层名称',
fieldName: 'floorName',
component: 'Input',
rules: 'required',
},
{
label: '楼层编码',
fieldName: 'floorCode',
component: 'Input',
rules: 'required',
},
{
label: '组织编码',
fieldName: 'orgCode',

View File

@ -1,30 +1,24 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { floorAdd, floorInfo, floorUpdate } from '#/api/property/floor';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
}
@ -42,7 +36,6 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
@ -53,16 +46,13 @@ const [BasicModal, modalApi] = useVbenModal({
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await floorInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
@ -74,7 +64,6 @@ async function handleConfirm() {
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? floorUpdate(data) : floorAdd(data));
resetInitialized();

View File

@ -7,7 +7,6 @@ import {
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
floorExport,
floorList,
@ -15,7 +14,6 @@ import {
} from '#/api/property/floor';
import type { FloorForm } from '#/api/property/floor/model';
import { commonDownloadExcel } from '#/utils/file/download';
import floorModal from './floor-modal.vue';
import { columns, querySchema } from './data';
@ -28,28 +26,13 @@ const formOptions: VbenFormProps = {
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
//
highlight: true,
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
@ -68,7 +51,6 @@ const gridOptions: VxeGridProps = {
rowConfig: {
keyField: 'id',
},
//
id: 'property-floor-index'
};

View File

@ -1,13 +1,12 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
export const querySchema: FormSchemaGetter = () => [
{
component: 'Select',
fieldName: 'floorCode',
label: '所属区',
label: '所属区',
},
{
component: 'Select',
@ -26,13 +25,13 @@ export const querySchema: FormSchemaGetter = () => [
},
{
component: 'Input',
fieldName: 'roomCode',
label: '房间编码',
fieldName: 'roomNumber',
label: '房间',
},
{
component: 'Input',
fieldName: 'roomNumber',
label: '房间',
fieldName: 'roomCode',
label: '房间编码',
},
{
component: 'Select',
@ -52,12 +51,19 @@ export const querySchema: FormSchemaGetter = () => [
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '所属楼层ID',
title: '序号',
field: 'id',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '所属楼层',
field: 'floorCode',
},
{
@ -89,7 +95,7 @@ export const columns: VxeGridProps['columns'] = [
field: 'isForSale',
},
{
title: '状态',
title: '房间状态',
field: 'status',
},
{
@ -112,23 +118,41 @@ export const modalSchema: FormSchemaGetter = () => [
},
},
{
label: '所属楼层ID',
label: '所属社区',
fieldName: 'floorCode',
component: 'Input',
rules: 'required',
},
{
label: '所属建筑',
fieldName: 'floorCode',
component: 'Input',
rules: 'required',
},
{
label: '所属单元',
fieldName: 'floorCode',
component: 'Input',
rules: 'required',
},
{
label: '所属楼层',
fieldName: 'floorCode',
component: 'Input',
rules: 'required',
},
{
label: '房间号',
fieldName: 'roomNumber',
component: 'Input',
rules: 'required',
},
{
label: '房间编码',
fieldName: 'roomCode',
component: 'Input',
rules: 'required',
},
{
label: '房间号(如101,202)',
fieldName: 'roomNumber',
component: 'Input',
rules: 'required',
},
{
label: '房间类型',
fieldName: 'roomType',
@ -138,12 +162,12 @@ export const modalSchema: FormSchemaGetter = () => [
},
},
{
label: '面积(平方米)',
label: '面积()',
fieldName: 'area',
component: 'Input',
},
{
label: '户型(如2室1厅1卫)',
label: '户型',
fieldName: 'layout',
component: 'Input',
},
@ -158,7 +182,7 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '是否可售',
fieldName: 'isForSale',
component: 'Input',
component: 'Select',
},
{
label: '房间状态',

View File

@ -1,20 +1,12 @@
<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 {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
roomExport,
roomList,
@ -22,7 +14,6 @@ import {
} from '#/api/property/room';
import type { RoomForm } from '#/api/property/room/model';
import { commonDownloadExcel } from '#/utils/file/download';
import roomModal from './room-modal.vue';
import { columns, querySchema } from './data';
@ -35,28 +26,13 @@ const formOptions: VbenFormProps = {
},
schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
// RangePicker /
//
// fieldMappingTime: [
// [
// 'createTime',
// ['params[beginTime]', 'params[endTime]'],
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
// ],
// ],
};
const gridOptions: VxeGridProps = {
checkboxConfig: {
//
highlight: true,
//
reserve: true,
//
// trigger: 'row',
},
// 使i18ngetter
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
@ -75,7 +51,6 @@ const gridOptions: VxeGridProps = {
rowConfig: {
keyField: 'id',
},
//
id: 'property-room-index'
};

View File

@ -1,30 +1,24 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { roomAdd, roomInfo, roomUpdate } from '#/api/property/room';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
}
@ -42,7 +36,6 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
@ -53,16 +46,13 @@ const [BasicModal, modalApi] = useVbenModal({
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await roomInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
@ -74,7 +64,6 @@ async function handleConfirm() {
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? roomUpdate(data) : roomAdd(data));
resetInitialized();