综合管理

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

@@ -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;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
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',
},
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// 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 }">