feat: 合并代码
This commit is contained in:
commit
8c457ddae4
@ -1,26 +1,22 @@
|
||||
<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 {
|
||||
personExport,
|
||||
personList,
|
||||
personRemove,
|
||||
} from '#/api/property/person';
|
||||
import type { PersonForm } from '#/api/property/person/model';
|
||||
} from '#/api/property/resident/person';
|
||||
import type { PersonForm } from '#/api/property/resident/person/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import personModal from './person-modal.vue';
|
||||
@ -138,8 +134,8 @@ function handleDownloadExcel() {
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:person:remove']"
|
||||
type="primary"
|
||||
v-access:code="['property:person:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
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 { modalSchema } from './data';
|
@ -1,24 +1,14 @@
|
||||
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";
|
||||
import {renderDict} from "#/utils/render";
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
label: '入驻单位名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'unitNumber',
|
||||
label: '单位编号',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
fieldName: 'type',
|
||||
label: '企业类型',
|
||||
label: '单位名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
@ -26,55 +16,36 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
label: '联系人',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'phone',
|
||||
label: '联系电话',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
fieldName: 'location',
|
||||
label: '入驻位置',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
options: getDictOptions('wy_state'),
|
||||
},
|
||||
fieldName: 'time',
|
||||
label: '入驻时间',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'state',
|
||||
label: '状态',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'number',
|
||||
label: '员工人数',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{type: 'checkbox', width: 60},
|
||||
{
|
||||
title: 'id',
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '入驻单位名称',
|
||||
field: 'name',
|
||||
slots: {
|
||||
default: ({ rowIndex }) => {
|
||||
return rowIndex + 1;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '单位编号',
|
||||
field: 'unitNumber',
|
||||
},
|
||||
{
|
||||
title: '企业类型',
|
||||
title: '单位名称',
|
||||
field: 'name',
|
||||
},
|
||||
{
|
||||
title: '单位类型',
|
||||
field: 'type',
|
||||
},
|
||||
{
|
||||
@ -96,19 +67,28 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '状态',
|
||||
field: 'state',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.state, 'wy_state');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '员工人数',
|
||||
title: '员工数量',
|
||||
field: 'number',
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
field: 'createTime',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
slots: {default: 'action'},
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
@ -125,24 +105,17 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '入驻单位名称',
|
||||
label: '单位名称',
|
||||
fieldName: 'name',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
|
||||
},
|
||||
{
|
||||
label: '单位编号',
|
||||
fieldName: 'unitNumber',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '企业类型',
|
||||
label: '单位类型',
|
||||
fieldName: 'type',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '联系人',
|
||||
@ -159,7 +132,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '入驻位置',
|
||||
fieldName: 'location',
|
||||
component: 'Textarea',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
@ -173,21 +146,10 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
fieldName: 'state',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '员工人数',
|
||||
fieldName: 'number',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
fieldName: 'remark',
|
||||
component: 'Textarea',
|
||||
formItemClass: 'col-span-2'
|
||||
},
|
||||
];
|
@ -1,29 +1,25 @@
|
||||
<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 {
|
||||
resident_unitExport,
|
||||
resident_unitList,
|
||||
resident_unitRemove,
|
||||
} from '#/api/property/resident_unit';
|
||||
import type { Resident_unitForm } from '#/api/property/resident_unit/model';
|
||||
} from '#/api/property/resident/unit';
|
||||
import type { Resident_unitForm } from '#/api/property/resident/unit/model';
|
||||
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';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
@ -35,15 +31,6 @@ 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 = {
|
||||
@ -76,7 +63,7 @@ const gridOptions: VxeGridProps = {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-resident_unit-index'
|
||||
id: 'property-unit-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
@ -97,7 +84,10 @@ async function handleEdit(row: Required<Resident_unitForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleInfo(row: Required<Resident_unitForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
async function handleDelete(row: Required<Resident_unitForm>) {
|
||||
await resident_unitRemove(row.id);
|
||||
await tableApi.query();
|
||||
@ -130,7 +120,7 @@ function handleDownloadExcel() {
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
v-access:code="['property:resident_unit:export']"
|
||||
v-access:code="['property:unit:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
@ -138,14 +128,14 @@ function handleDownloadExcel() {
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:resident_unit:remove']"
|
||||
type="primary"
|
||||
v-access:code="['property:unit:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:resident_unit:add']"
|
||||
v-access:code="['property:unit:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
@ -155,7 +145,7 @@ function handleDownloadExcel() {
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:resident_unit:edit']"
|
||||
v-access:code="['property:unit:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
@ -168,7 +158,7 @@ function handleDownloadExcel() {
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['property:resident_unit:remove']"
|
||||
v-access:code="['property:unit:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
|
||||
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 { modalSchema } from './data';
|
||||
@ -21,7 +21,7 @@ const title = computed(() => {
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-2',
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 80,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
@ -43,7 +43,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[550px]',
|
||||
class: 'w-[70%]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
Loading…
Reference in New Issue
Block a user