1
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
15683799673
2025-06-28 02:41:09 +08:00
parent 81a89bb4dc
commit acd63bc96e
23 changed files with 670 additions and 1046 deletions

View File

@@ -1,68 +1,22 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
import {communityList} from "#/api/property/community";
import {buildingList} from "#/api/property/building";
export const querySchema: FormSchemaGetter = () => [
{
component: 'ApiSelect',
fieldName: 'communityCode',
label: '所属区域',
componentProps: (formModel, formActionType) => ({
api: getCommunityList,
resultField: 'data',
labelField: 'label',
valueField: 'value',
immediate: true,
debounceTime: 500,
allowClear: true,
placeholder: '请选择区域',
onChange: () => {
// 清空建筑字段
formModel.buildingCode = undefined;
// 更新表单值
formActionType.setFieldValue('buildingCode', undefined);
},
}),
},
{
component: 'ApiSelect',
fieldName: 'buildingCode',
label: '所属建筑',
componentProps:{
api: getBuildingList,
resultField: 'data',
labelField: 'label',
valueField: 'value',
immediate: true,
debounceTime: 500,
allowClear: true,
placeholder: '请选择建筑',
},
},
{
component: 'Input',
fieldName: 'unitCode',
label: '单元编码',
},
{
component: 'Input',
fieldName: 'unitName',
label: '单元名称',
fieldName: 'communityName',
label: '社区',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '建筑名称',
field: 'buildingCode',
},
{
title: '单元编码',
field: 'unitCode',
field: 'buildingId',
},
{
title: '单元名称',
@@ -100,46 +54,8 @@ export const modalSchema: FormSchemaGetter = () => [
},
},
{
component: 'ApiSelect',
fieldName: 'communityCode',
label: '所属区域',
componentProps: (formModel, formActionType) => ({
api: getCommunityList,
resultField: 'data',
labelField: 'label',
valueField: 'value',
immediate: true,
debounceTime: 500,
allowClear: true,
placeholder: '请选择区域',
onChange: () => {
// 清空建筑字段
formModel.buildingCode = undefined;
// 更新表单值
formActionType.setFieldValue('buildingCode', undefined);
},
}),
rules: 'required',
},
{
component: 'ApiSelect',
fieldName: 'buildingCode',
label: '所属建筑',
componentProps: {
api: getBuildingList,
resultField: 'data',
labelField: 'label',
valueField: 'value',
immediate: true,
debounceTime: 500,
allowClear: true,
placeholder: '请选择建筑',
},
rules: 'required',
},
{
label: '单元编码',
fieldName: 'unitCode',
label: '建筑名称',
fieldName: 'buildingId',
component: 'Input',
rules: 'required',
},
@@ -152,69 +68,16 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '单元层数',
fieldName: 'floorCount',
component: 'InputNumber',
rules: 'required',
componentProps:{
defaultValue:0,
precision:0,
min:0
}
component: 'Input',
},
{
label: '单元户数',
fieldName: 'householdCount',
component: 'InputNumber',
rules: 'required',
componentProps:{
defaultValue:0,
precision:0,
min:0
}
component: 'Input',
},
{
label: '楼梯数量',
fieldName: 'stairCount',
component: 'InputNumber',
rules: 'required',
componentProps:{
defaultValue:0,
precision:0,
min:0
}
component: 'Input',
},
];
//获取区域数据
async function getCommunityList(): Promise<{ value: number; label: string }[]> {
const queryParam = {
pageNum: 1000,
pageSize: 1,
};
const res = await communityList(queryParam);
const data: { value: number; label: string }[] = [];
res.rows.forEach((r: any) => {
data.push({
value: r.communityName,
label: r.id,
});
});
return data;
}
//获取建筑数据
export async function getBuildingList(): Promise<{ value: number; label: string }[]> {
const queryParam = {
pageNum: 1000,
pageSize: 1,
};
const res = await buildingList(queryParam);
const data: { value: number; label: string }[] = [];
res.rows.forEach((r: any) => {
data.push({
value: r.buildingName,
label: r.id,
});
});
return data;
}

View File

@@ -1,14 +1,18 @@
<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 {
@@ -31,6 +35,15 @@ 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 = {
@@ -42,6 +55,8 @@ const gridOptions: VxeGridProps = {
// 点击行选中
// trigger: 'row',
},
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// columns: columns(),
columns,
height: 'auto',
keepSource: true,
@@ -123,8 +138,8 @@ function handleDownloadExcel() {
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:unit:remove']"
type="primary"
v-access:code="['property:unit:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>