1、入驻管理

This commit is contained in:
dev_ljl 2025-06-19 16:55:06 +08:00
parent a2ca8c2d09
commit 87fe0eb78f
10 changed files with 62 additions and 114 deletions

View File

@ -1,26 +1,22 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import { import {
useVbenVxeGrid, useVbenVxeGrid,
vxeCheckboxChecked, vxeCheckboxChecked,
type VxeGridProps type VxeGridProps
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { import {
personExport, personExport,
personList, personList,
personRemove, personRemove,
} from '#/api/property/person'; } from '#/api/property/resident/person';
import type { PersonForm } from '#/api/property/person/model'; import type { PersonForm } from '#/api/property/resident/person/model';
import { commonDownloadExcel } from '#/utils/file/download'; import { commonDownloadExcel } from '#/utils/file/download';
import personModal from './person-modal.vue'; import personModal from './person-modal.vue';
@ -138,8 +134,8 @@ function handleDownloadExcel() {
<a-button <a-button
:disabled="!vxeCheckboxChecked(tableApi)" :disabled="!vxeCheckboxChecked(tableApi)"
danger danger
type="primary" type="primary"
v-access:code="['property:person:remove']" v-access:code="['property:person:remove']"
@click="handleMultiDelete"> @click="handleMultiDelete">
{{ $t('pages.common.delete') }} {{ $t('pages.common.delete') }}
</a-button> </a-button>

View File

@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils'; import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { personAdd, personInfo, personUpdate } from '#/api/property/person'; import { personAdd, personInfo, personUpdate } from '#/api/property/resident/person';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; import { modalSchema } from './data';

View File

@ -1,24 +1,14 @@
import type { FormSchemaGetter } from '#/adapter/form'; import type {FormSchemaGetter} from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import {renderDict} from "#/utils/render";
export const querySchema: FormSchemaGetter = () => [ export const querySchema: FormSchemaGetter = () => [
{ {
component: 'Input', component: 'Input',
fieldName: 'name', fieldName: 'name',
label: '入驻单位名称', label: '单位名称',
},
{
component: 'Input',
fieldName: 'unitNumber',
label: '单位编号',
},
{
component: 'Select',
componentProps: {
},
fieldName: 'type',
label: '企业类型',
}, },
{ {
component: 'Input', component: 'Input',
@ -26,55 +16,36 @@ export const querySchema: FormSchemaGetter = () => [
label: '联系人', label: '联系人',
}, },
{ {
component: 'Input', component: 'Select',
fieldName: 'phone',
label: '联系电话',
},
{
component: 'Textarea',
fieldName: 'location',
label: '入驻位置',
},
{
component: 'DatePicker',
componentProps: { componentProps: {
showTime: true, options: getDictOptions('wy_state'),
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, },
fieldName: 'time',
label: '入驻时间',
},
{
component: 'Input',
fieldName: 'state', fieldName: 'state',
label: '状态', label: '状态',
}, },
{
component: 'Input',
fieldName: 'number',
label: '员工人数',
},
]; ];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [ export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 }, {type: 'checkbox', width: 60},
{ {
title: 'id', title: '序号',
field: 'id', field: 'id',
}, slots: {
{ default: ({ rowIndex }) => {
title: '入驻单位名称', return rowIndex + 1;
field: 'name', },
},
}, },
{ {
title: '单位编号', title: '单位编号',
field: 'unitNumber', field: 'unitNumber',
}, },
{ {
title: '企业类型', title: '单位名称',
field: 'name',
},
{
title: '单位类型',
field: 'type', field: 'type',
}, },
{ {
@ -96,19 +67,28 @@ export const columns: VxeGridProps['columns'] = [
{ {
title: '状态', title: '状态',
field: 'state', field: 'state',
slots: {
default: ({ row }) => {
return renderDict(row.state, 'wy_state');
},
},
}, },
{ {
title: '员工人数', title: '员工',
field: 'number', field: 'number',
}, },
{ {
title: '备注', title: '备注',
field: 'remark', field: 'remark',
}, },
{
title: '创建时间',
field: 'createTime',
},
{ {
field: 'action', field: 'action',
fixed: 'right', fixed: 'right',
slots: { default: 'action' }, slots: {default: 'action'},
title: '操作', title: '操作',
width: 180, width: 180,
}, },
@ -125,24 +105,17 @@ export const modalSchema: FormSchemaGetter = () => [
}, },
}, },
{ {
label: '入驻单位名称', label: '单位名称',
fieldName: 'name', fieldName: 'name',
component: 'Input', component: 'Input',
rules: 'required', rules: 'required',
}, },
{ {
label: '单位编号', label: '单位类型',
fieldName: 'unitNumber',
component: 'Input',
rules: 'required',
},
{
label: '企业类型',
fieldName: 'type', fieldName: 'type',
component: 'Input', component: 'Input',
componentProps: { rules: 'required',
},
rules: 'selectRequired',
}, },
{ {
label: '联系人', label: '联系人',
@ -159,7 +132,7 @@ export const modalSchema: FormSchemaGetter = () => [
{ {
label: '入驻位置', label: '入驻位置',
fieldName: 'location', fieldName: 'location',
component: 'Textarea', component: 'Input',
rules: 'required', rules: 'required',
}, },
{ {
@ -173,21 +146,10 @@ export const modalSchema: FormSchemaGetter = () => [
}, },
rules: 'required', rules: 'required',
}, },
{
label: '状态',
fieldName: 'state',
component: 'Input',
rules: 'required',
},
{
label: '员工人数',
fieldName: 'number',
component: 'Input',
rules: 'required',
},
{ {
label: '备注', label: '备注',
fieldName: 'remark', fieldName: 'remark',
component: 'Textarea', component: 'Textarea',
formItemClass: 'col-span-2'
}, },
]; ];

View File

@ -1,29 +1,25 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils'; import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import { import {
useVbenVxeGrid, useVbenVxeGrid,
vxeCheckboxChecked, vxeCheckboxChecked,
type VxeGridProps type VxeGridProps
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { import {
resident_unitExport, resident_unitExport,
resident_unitList, resident_unitList,
resident_unitRemove, resident_unitRemove,
} from '#/api/property/resident_unit'; } from '#/api/property/resident/unit';
import type { Resident_unitForm } from '#/api/property/resident_unit/model'; import type { Resident_unitForm } from '#/api/property/resident/unit/model';
import { commonDownloadExcel } from '#/utils/file/download'; import { commonDownloadExcel } from '#/utils/file/download';
import resident_unitModal from './resident_unit-modal.vue'; import resident_unitModal from './unit-modal.vue';
import { columns, querySchema } from './data'; import { columns, querySchema } from './data';
const formOptions: VbenFormProps = { const formOptions: VbenFormProps = {
@ -35,15 +31,6 @@ const formOptions: VbenFormProps = {
}, },
schema: querySchema(), schema: querySchema(),
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', 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 = { const gridOptions: VxeGridProps = {
@ -76,7 +63,7 @@ const gridOptions: VxeGridProps = {
keyField: 'id', keyField: 'id',
}, },
// //
id: 'property-resident_unit-index' id: 'property-unit-index'
}; };
const [BasicTable, tableApi] = useVbenVxeGrid({ const [BasicTable, tableApi] = useVbenVxeGrid({
@ -97,7 +84,10 @@ async function handleEdit(row: Required<Resident_unitForm>) {
modalApi.setData({ id: row.id }); modalApi.setData({ id: row.id });
modalApi.open(); modalApi.open();
} }
async function handleInfo(row: Required<Resident_unitForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<Resident_unitForm>) { async function handleDelete(row: Required<Resident_unitForm>) {
await resident_unitRemove(row.id); await resident_unitRemove(row.id);
await tableApi.query(); await tableApi.query();
@ -130,7 +120,7 @@ function handleDownloadExcel() {
<template #toolbar-tools> <template #toolbar-tools>
<Space> <Space>
<a-button <a-button
v-access:code="['property:resident_unit:export']" v-access:code="['property:unit:export']"
@click="handleDownloadExcel" @click="handleDownloadExcel"
> >
{{ $t('pages.common.export') }} {{ $t('pages.common.export') }}
@ -138,14 +128,14 @@ function handleDownloadExcel() {
<a-button <a-button
:disabled="!vxeCheckboxChecked(tableApi)" :disabled="!vxeCheckboxChecked(tableApi)"
danger danger
type="primary" type="primary"
v-access:code="['property:resident_unit:remove']" v-access:code="['property:unit:remove']"
@click="handleMultiDelete"> @click="handleMultiDelete">
{{ $t('pages.common.delete') }} {{ $t('pages.common.delete') }}
</a-button> </a-button>
<a-button <a-button
type="primary" type="primary"
v-access:code="['property:resident_unit:add']" v-access:code="['property:unit:add']"
@click="handleAdd" @click="handleAdd"
> >
{{ $t('pages.common.add') }} {{ $t('pages.common.add') }}
@ -155,7 +145,7 @@ function handleDownloadExcel() {
<template #action="{ row }"> <template #action="{ row }">
<Space> <Space>
<ghost-button <ghost-button
v-access:code="['property:resident_unit:edit']" v-access:code="['property:unit:edit']"
@click.stop="handleEdit(row)" @click.stop="handleEdit(row)"
> >
{{ $t('pages.common.edit') }} {{ $t('pages.common.edit') }}
@ -168,7 +158,7 @@ function handleDownloadExcel() {
> >
<ghost-button <ghost-button
danger danger
v-access:code="['property:resident_unit:remove']" v-access:code="['property:unit:remove']"
@click.stop="" @click.stop=""
> >
{{ $t('pages.common.delete') }} {{ $t('pages.common.delete') }}

View File

@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils'; import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident_unit'; import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident/unit';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data'; import { modalSchema } from './data';
@ -21,7 +21,7 @@ const title = computed(() => {
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
// //
formItemClass: 'col-span-2', formItemClass: 'col-span-1',
// label px // label px
labelWidth: 80, labelWidth: 80,
// //
@ -43,7 +43,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
const [BasicModal, modalApi] = useVbenModal({ const [BasicModal, modalApi] = useVbenModal({
// //
class: 'w-[550px]', class: 'w-[70%]',
fullscreenButton: false, fullscreenButton: false,
onBeforeClose, onBeforeClose,
onClosed: handleClosed, onClosed: handleClosed,