综合管理
This commit is contained in:
@@ -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',
|
||||
|
@@ -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;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
await (isUpdate.value ? floorUpdate(data) : floorAdd(data));
|
||||
resetInitialized();
|
||||
|
@@ -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',
|
||||
},
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// columns: columns(),
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
@@ -68,7 +51,6 @@ const gridOptions: VxeGridProps = {
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-floor-index'
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user