保洁+入驻

This commit is contained in:
2025-06-19 14:26:08 +08:00
parent d980195302
commit 529263a443
23 changed files with 3066 additions and 6 deletions

View File

@@ -0,0 +1,61 @@
import type { CleanVO, CleanForm, CleanQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
* 查询保洁管理列表
* @param params
* @returns 保洁管理列表
*/
export function cleanList(params?: CleanQuery) {
return requestClient.get<PageResult<CleanVO>>('/property/clean/list', { params });
}
/**
* 导出保洁管理列表
* @param params
* @returns 保洁管理列表
*/
export function cleanExport(params?: CleanQuery) {
return commonExport('/property/clean/export', params ?? {});
}
/**
* 查询保洁管理详情
* @param id id
* @returns 保洁管理详情
*/
export function cleanInfo(id: ID) {
return requestClient.get<CleanVO>(`/property/clean/${id}`);
}
/**
* 新增保洁管理
* @param data
* @returns void
*/
export function cleanAdd(data: CleanForm) {
return requestClient.postWithMsg<void>('/property/clean', data);
}
/**
* 更新保洁管理
* @param data
* @returns void
*/
export function cleanUpdate(data: CleanForm) {
return requestClient.putWithMsg<void>('/property/clean', data);
}
/**
* 删除保洁管理
* @param id id
* @returns void
*/
export function cleanRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/clean/${id}`);
}

View File

@@ -0,0 +1,139 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface CleanVO {
/**
* 主键id
*/
id: string | number;
/**
* 劳务名称
*/
name: string;
/**
* 计量单位
*/
measure: string;
/**
* 计算方式
*/
method: string;
/**
* 单价
*/
peices: string;
/**
* 保洁频率
*/
frequency: string;
/**
* 保洁标准
*/
standard: string;
/**
* 备注
*/
remark: string;
/**
* 状态
*/
stater: number;
}
export interface CleanForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 劳务名称
*/
name?: string;
/**
* 计量单位
*/
measure?: string;
/**
* 计算方式
*/
method?: string;
/**
* 单价
*/
peices?: string;
/**
* 保洁频率
*/
frequency?: string;
/**
* 保洁标准
*/
standard?: string;
/**
* 备注
*/
remark?: string;
/**
* 状态
*/
stater?: number;
}
export interface CleanQuery extends PageQuery {
/**
* 劳务名称
*/
name?: string;
/**
* 计量单位
*/
measure?: string;
/**
* 计算方式
*/
method?: string;
/**
* 单价
*/
peices?: string;
/**
* 保洁频率
*/
frequency?: string;
/**
* 保洁标准
*/
standard?: string;
/**
* 状态
*/
stater?: number;
/**
* 日期范围参数
*/
params?: any;
}

View File

@@ -0,0 +1,61 @@
import type { Clean_orderVO, Clean_orderForm, Clean_orderQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
* 查询保洁订单列表
* @param params
* @returns 保洁订单列表
*/
export function clean_orderList(params?: Clean_orderQuery) {
return requestClient.get<PageResult<Clean_orderVO>>('/property/clean_order/list', { params });
}
/**
* 导出保洁订单列表
* @param params
* @returns 保洁订单列表
*/
export function clean_orderExport(params?: Clean_orderQuery) {
return commonExport('/property/clean_order/export', params ?? {});
}
/**
* 查询保洁订单详情
* @param id id
* @returns 保洁订单详情
*/
export function clean_orderInfo(id: ID) {
return requestClient.get<Clean_orderVO>(`/property/clean_order/${id}`);
}
/**
* 新增保洁订单
* @param data
* @returns void
*/
export function clean_orderAdd(data: Clean_orderForm) {
return requestClient.postWithMsg<void>('/property/clean_order', data);
}
/**
* 更新保洁订单
* @param data
* @returns void
*/
export function clean_orderUpdate(data: Clean_orderForm) {
return requestClient.putWithMsg<void>('/property/clean_order', data);
}
/**
* 删除保洁订单
* @param id id
* @returns void
*/
export function clean_orderRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/clean_order/${id}`);
}

View File

@@ -0,0 +1,219 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface Clean_orderVO {
/**
* 主键
*/
id: string | number;
/**
* 位置
*/
location: string;
/**
* 面积
*/
area: string;
/**
* 保洁id
*/
cleanId: string | number;
/**
* 名称
*/
name: string;
/**
* 单价
*/
prices: number;
/**
* 总价
*/
sumPeices: number;
/**
* 支付状态
*/
payState: number;
/**
* 开始时间
*/
starTime: string;
/**
* 结束时间
*/
endTime: string;
/**
* 单位id
*/
unitId: string | number;
/**
* 申请单位
*/
unit: string;
/**
* 联系人
*/
persion: string;
/**
* 联系电话
*/
phone: string;
}
export interface Clean_orderForm extends BaseEntity {
/**
* 主键
*/
id?: string | number;
/**
* 位置
*/
location?: string;
/**
* 面积
*/
area?: string;
/**
* 保洁id
*/
cleanId?: string | number;
/**
* 名称
*/
name?: string;
/**
* 单价
*/
prices?: number;
/**
* 总价
*/
sumPeices?: number;
/**
* 支付状态
*/
payState?: number;
/**
* 开始时间
*/
starTime?: string;
/**
* 结束时间
*/
endTime?: string;
/**
* 单位id
*/
unitId?: string | number;
/**
* 申请单位
*/
unit?: string;
/**
* 联系人
*/
persion?: string;
/**
* 联系电话
*/
phone?: string;
}
export interface Clean_orderQuery extends PageQuery {
/**
* 位置
*/
location?: string;
/**
* 面积
*/
area?: string;
/**
* 保洁id
*/
cleanId?: string | number;
/**
* 名称
*/
name?: string;
/**
* 单价
*/
prices?: number;
/**
* 总价
*/
sumPeices?: number;
/**
* 支付状态
*/
payState?: number;
/**
* 开始时间
*/
starTime?: string;
/**
* 结束时间
*/
endTime?: string;
/**
* 单位id
*/
unitId?: string | number;
/**
* 申请单位
*/
unit?: string;
/**
* 联系人
*/
persion?: string;
/**
* 联系电话
*/
phone?: string;
/**
* 日期范围参数
*/
params?: any;
}

View File

@@ -0,0 +1,61 @@
import type { PersonVO, PersonForm, PersonQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
* 查询入驻员工列表
* @param params
* @returns 入驻员工列表
*/
export function personList(params?: PersonQuery) {
return requestClient.get<PageResult<PersonVO>>('/property/person/list', { params });
}
/**
* 导出入驻员工列表
* @param params
* @returns 入驻员工列表
*/
export function personExport(params?: PersonQuery) {
return commonExport('/property/person/export', params ?? {});
}
/**
* 查询入驻员工详情
* @param id id
* @returns 入驻员工详情
*/
export function personInfo(id: ID) {
return requestClient.get<PersonVO>(`/property/person/${id}`);
}
/**
* 新增入驻员工
* @param data
* @returns void
*/
export function personAdd(data: PersonForm) {
return requestClient.postWithMsg<void>('/property/person', data);
}
/**
* 更新入驻员工
* @param data
* @returns void
*/
export function personUpdate(data: PersonForm) {
return requestClient.putWithMsg<void>('/property/person', data);
}
/**
* 删除入驻员工
* @param id id
* @returns void
*/
export function personRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/person/${id}`);
}

View File

@@ -0,0 +1,199 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface PersonVO {
/**
* 主键id
*/
id: string | number;
/**
* 用户id
*/
userId: string | number;
/**
* 用户名称
*/
userName: string;
/**
* 联系电话
*/
phone: string;
/**
* 性别
*/
gender: number;
/**
* 人脸图片
*/
img: string;
/**
* 所属单位id
*/
unitId: string | number;
/**
* 所属单位名称
*/
unitName: string;
/**
* 入驻位置
*/
locathon: string;
/**
* 入驻时间
*/
time: string;
/**
* 车牌号码
*/
carNumber: string;
/**
* 状态
*/
state: number;
/**
* 备注
*/
remark: string;
}
export interface PersonForm extends BaseEntity {
/**
* 主键id
*/
id?: string | number;
/**
* 用户id
*/
userId?: string | number;
/**
* 用户名称
*/
userName?: string;
/**
* 联系电话
*/
phone?: string;
/**
* 性别
*/
gender?: number;
/**
* 人脸图片
*/
img?: string;
/**
* 所属单位id
*/
unitId?: string | number;
/**
* 所属单位名称
*/
unitName?: string;
/**
* 入驻位置
*/
locathon?: string;
/**
* 入驻时间
*/
time?: string;
/**
* 车牌号码
*/
carNumber?: string;
/**
* 状态
*/
state?: number;
/**
* 备注
*/
remark?: string;
}
export interface PersonQuery extends PageQuery {
/**
* 用户id
*/
userId?: string | number;
/**
* 用户名称
*/
userName?: string;
/**
* 联系电话
*/
phone?: string;
/**
* 性别
*/
gender?: number;
/**
* 人脸图片
*/
img?: string;
/**
* 所属单位id
*/
unitId?: string | number;
/**
* 所属单位名称
*/
unitName?: string;
/**
* 入驻位置
*/
locathon?: string;
/**
* 入驻时间
*/
time?: string;
/**
* 车牌号码
*/
carNumber?: string;
/**
* 状态
*/
state?: number;
/**
* 日期范围参数
*/
params?: any;
}

View File

@@ -0,0 +1,61 @@
import type { Resident_unitVO, Resident_unitForm, Resident_unitQuery } from './model';
import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';
import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';
/**
* 查询入驻单位列表
* @param params
* @returns 入驻单位列表
*/
export function resident_unitList(params?: Resident_unitQuery) {
return requestClient.get<PageResult<Resident_unitVO>>('/property/resident_unit/list', { params });
}
/**
* 导出入驻单位列表
* @param params
* @returns 入驻单位列表
*/
export function resident_unitExport(params?: Resident_unitQuery) {
return commonExport('/property/resident_unit/export', params ?? {});
}
/**
* 查询入驻单位详情
* @param id id
* @returns 入驻单位详情
*/
export function resident_unitInfo(id: ID) {
return requestClient.get<Resident_unitVO>(`/property/resident_unit/${id}`);
}
/**
* 新增入驻单位
* @param data
* @returns void
*/
export function resident_unitAdd(data: Resident_unitForm) {
return requestClient.postWithMsg<void>('/property/resident_unit', data);
}
/**
* 更新入驻单位
* @param data
* @returns void
*/
export function resident_unitUpdate(data: Resident_unitForm) {
return requestClient.putWithMsg<void>('/property/resident_unit', data);
}
/**
* 删除入驻单位
* @param id id
* @returns void
*/
export function resident_unitRemove(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/resident_unit/${id}`);
}

View File

@@ -0,0 +1,169 @@
import type { PageQuery, BaseEntity } from '#/api/common';
export interface Resident_unitVO {
/**
* id
*/
id: string | number;
/**
* 入驻单位名称
*/
name: string;
/**
* 单位编号
*/
unitNumber: number;
/**
* 企业类型
*/
type: number;
/**
* 联系人
*/
contactPerson: string;
/**
* 联系电话
*/
phone: number;
/**
* 入驻位置
*/
location: string;
/**
* 入驻时间
*/
time: string;
/**
* 状态
*/
state: number;
/**
* 员工人数
*/
number: number;
/**
* 备注
*/
remark: string;
}
export interface Resident_unitForm extends BaseEntity {
/**
* id
*/
id?: string | number;
/**
* 入驻单位名称
*/
name?: string;
/**
* 单位编号
*/
unitNumber?: number;
/**
* 企业类型
*/
type?: number;
/**
* 联系人
*/
contactPerson?: string;
/**
* 联系电话
*/
phone?: number;
/**
* 入驻位置
*/
location?: string;
/**
* 入驻时间
*/
time?: string;
/**
* 状态
*/
state?: number;
/**
* 员工人数
*/
number?: number;
/**
* 备注
*/
remark?: string;
}
export interface Resident_unitQuery extends PageQuery {
/**
* 入驻单位名称
*/
name?: string;
/**
* 单位编号
*/
unitNumber?: number;
/**
* 企业类型
*/
type?: number;
/**
* 联系人
*/
contactPerson?: string;
/**
* 联系电话
*/
phone?: number;
/**
* 入驻位置
*/
location?: string;
/**
* 入驻时间
*/
time?: string;
/**
* 状态
*/
state?: number;
/**
* 员工人数
*/
number?: number;
/**
* 日期范围参数
*/
params?: any;
}

View File

@@ -11,6 +11,11 @@ export interface VisitorManagementVO {
*/
visitorName: string;
/**
* 所属公司
*/
visitorUnit: string;
/**
* 访客电话
*/
@@ -21,6 +26,21 @@ export interface VisitorManagementVO {
*/
visitingReason: string;
/**
* 被访人
*/
interviewedPerson: string;
/**
* 被访单位
*/
interviewedUnit: string;
/**
* 被访人联系方式
*/
interviewedPhone: string;
/**
* 拜访开始时间
*/
@@ -64,6 +84,11 @@ export interface VisitorManagementForm extends BaseEntity {
*/
visitorName?: string;
/**
* 所属公司
*/
visitorUnit?: string;
/**
* 访客电话
*/
@@ -74,6 +99,31 @@ export interface VisitorManagementForm extends BaseEntity {
*/
visitingReason?: string;
/**
* 被访人
*/
interviewedPerson?: string;
/**
* 被访单位
*/
interviewedUnit?: string;
/**
* 被访人联系方式
*/
interviewedPhone?: string;
/**
* 拜访开始时间
*/
visitingBeginTime?: string;
/**
* 拜访结束时间
*/
visitingEndTime?: string;
/**
* 预约车位0预约1不预约
*/
@@ -102,6 +152,11 @@ export interface VisitorManagementQuery extends PageQuery {
*/
visitorName?: string;
/**
* 所属公司
*/
visitorUnit?: string;
/**
* 访客电话
*/
@@ -112,6 +167,21 @@ export interface VisitorManagementQuery extends PageQuery {
*/
visitingReason?: string;
/**
* 被访人
*/
interviewedPerson?: string;
/**
* 被访单位
*/
interviewedUnit?: string;
/**
* 被访人联系方式
*/
interviewedPhone?: string;
/**
* 拜访开始时间
*/

View File

@@ -0,0 +1,101 @@
<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 { cleanAdd, cleanInfo, cleanUpdate } from '#/api/property/clean';
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',
}
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await cleanInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? cleanUpdate(data) : cleanAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@@ -0,0 +1,150 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'name',
label: '劳务名称',
},
{
component: 'Textarea',
fieldName: 'measure',
label: '计量单位',
},
{
component: 'Input',
fieldName: 'method',
label: '计算方式',
},
{
component: 'Input',
fieldName: 'peices',
label: '单价',
},
{
component: 'Input',
fieldName: 'frequency',
label: '保洁频率',
},
{
component: 'Input',
fieldName: 'standard',
label: '保洁标准',
},
{
component: 'Input',
fieldName: 'stater',
label: '状态',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '主键id',
field: 'id',
},
{
title: '劳务名称',
field: 'name',
},
{
title: '计量单位',
field: 'measure',
},
{
title: '计算方式',
field: 'method',
},
{
title: '单价',
field: 'peices',
},
{
title: '保洁频率',
field: 'frequency',
},
{
title: '保洁标准',
field: 'standard',
},
{
title: '备注',
field: 'remark',
},
{
title: '状态',
field: 'stater',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键id',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '劳务名称',
fieldName: 'name',
component: 'Input',
rules: 'required',
},
{
label: '计量单位',
fieldName: 'measure',
component: 'Textarea',
rules: 'required',
},
{
label: '计算方式',
fieldName: 'method',
component: 'Input',
rules: 'required',
},
{
label: '单价',
fieldName: 'peices',
component: 'Input',
rules: 'required',
},
{
label: '保洁频率',
fieldName: 'frequency',
component: 'Input',
rules: 'required',
},
{
label: '保洁标准',
fieldName: 'standard',
component: 'Input',
rules: 'required',
},
{
label: '备注',
fieldName: 'remark',
component: 'Input',
rules: 'required',
},
{
label: '状态',
fieldName: 'stater',
component: 'Input',
rules: 'required',
},
];

View File

@@ -0,0 +1,182 @@
<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 {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
cleanExport,
cleanList,
cleanRemove,
} from '#/api/property/clean';
import type { CleanForm } from '#/api/property/clean/model';
import { commonDownloadExcel } from '#/utils/file/download';
import cleanModal from './clean-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
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,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await cleanList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
// 表格全局唯一表示 保存列配置需要用到
id: 'property-clean-index'
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [CleanModal, modalApi] = useVbenModal({
connectedComponent: cleanModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<CleanForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<CleanForm>) {
await cleanRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<CleanForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await cleanRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(cleanExport, '保洁管理数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
});
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="保洁管理列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['property:clean:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:clean:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:clean:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:clean:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:clean:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<CleanModal @reload="tableApi.query()" />
</Page>
</template>

View File

@@ -0,0 +1,101 @@
<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 { clean_orderAdd, clean_orderInfo, clean_orderUpdate } from '#/api/property/clean_order';
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',
}
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await clean_orderInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? clean_orderUpdate(data) : clean_orderAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@@ -0,0 +1,248 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Textarea',
fieldName: 'location',
label: '位置',
},
{
component: 'Textarea',
fieldName: 'area',
label: '面积',
},
{
component: 'Input',
fieldName: 'cleanId',
label: '保洁id',
},
{
component: 'Textarea',
fieldName: 'name',
label: '名称',
},
{
component: 'Input',
fieldName: 'prices',
label: '单价',
},
{
component: 'Input',
fieldName: 'sumPeices',
label: '总价',
},
{
component: 'Input',
fieldName: 'payState',
label: '支付状态',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'starTime',
label: '开始时间',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'endTime',
label: '结束时间',
},
{
component: 'Input',
fieldName: 'unitId',
label: '单位id',
},
{
component: 'Textarea',
fieldName: 'unit',
label: '申请单位',
},
{
component: 'Textarea',
fieldName: 'persion',
label: '联系人',
},
{
component: 'Textarea',
fieldName: 'phone',
label: '联系电话',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '主键',
field: 'id',
},
{
title: '位置',
field: 'location',
},
{
title: '面积',
field: 'area',
},
{
title: '保洁id',
field: 'cleanId',
},
{
title: '名称',
field: 'name',
},
{
title: '单价',
field: 'prices',
},
{
title: '总价',
field: 'sumPeices',
},
{
title: '支付状态',
field: 'payState',
},
{
title: '开始时间',
field: 'starTime',
},
{
title: '结束时间',
field: 'endTime',
},
{
title: '单位id',
field: 'unitId',
},
{
title: '申请单位',
field: 'unit',
},
{
title: '联系人',
field: 'persion',
},
{
title: '联系电话',
field: 'phone',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '位置',
fieldName: 'location',
component: 'Textarea',
rules: 'required',
},
{
label: '面积',
fieldName: 'area',
component: 'Textarea',
},
{
label: '保洁id',
fieldName: 'cleanId',
component: 'Input',
rules: 'required',
},
{
label: '名称',
fieldName: 'name',
component: 'Textarea',
rules: 'required',
},
{
label: '单价',
fieldName: 'prices',
component: 'Input',
rules: 'required',
},
{
label: '总价',
fieldName: 'sumPeices',
component: 'Input',
},
{
label: '支付状态',
fieldName: 'payState',
component: 'Input',
rules: 'required',
},
{
label: '开始时间',
fieldName: 'starTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
},
{
label: '结束时间',
fieldName: 'endTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
},
{
label: '单位id',
fieldName: 'unitId',
component: 'Input',
rules: 'required',
},
{
label: '申请单位',
fieldName: 'unit',
component: 'Textarea',
rules: 'required',
},
{
label: '联系人',
fieldName: 'persion',
component: 'Textarea',
rules: 'required',
},
{
label: '联系电话',
fieldName: 'phone',
component: 'Textarea',
rules: 'required',
},
];

View File

@@ -0,0 +1,182 @@
<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 {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
clean_orderExport,
clean_orderList,
clean_orderRemove,
} from '#/api/property/clean_order';
import type { Clean_orderForm } from '#/api/property/clean_order/model';
import { commonDownloadExcel } from '#/utils/file/download';
import clean_orderModal from './clean_order-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
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,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await clean_orderList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
// 表格全局唯一表示 保存列配置需要用到
id: 'property-clean_order-index'
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [Clean_orderModal, modalApi] = useVbenModal({
connectedComponent: clean_orderModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<Clean_orderForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<Clean_orderForm>) {
await clean_orderRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<Clean_orderForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await clean_orderRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(clean_orderExport, '保洁订单数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
});
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="保洁订单列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['property:clean_order:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:clean_order:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:clean_order:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:clean_order:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:clean_order:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<Clean_orderModal @reload="tableApi.query()" />
</Page>
</template>

View File

@@ -0,0 +1,213 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'userId',
label: '用户id',
},
{
component: 'Input',
fieldName: 'userName',
label: '用户名称',
},
{
component: 'Input',
fieldName: 'phone',
label: '联系电话',
},
{
component: 'Input',
fieldName: 'gender',
label: '性别',
},
{
component: 'Input',
fieldName: 'img',
label: '人脸图片',
},
{
component: 'Input',
fieldName: 'unitId',
label: '所属单位id',
},
{
component: 'Input',
fieldName: 'unitName',
label: '所属单位名称',
},
{
component: 'Input',
fieldName: 'locathon',
label: '入驻位置',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
fieldName: 'time',
label: '入驻时间',
},
{
component: 'Textarea',
fieldName: 'carNumber',
label: '车牌号码',
},
{
component: 'Input',
fieldName: 'state',
label: '状态',
},
];
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '主键id',
field: 'id',
},
{
title: '用户id',
field: 'userId',
},
{
title: '用户名称',
field: 'userName',
},
{
title: '联系电话',
field: 'phone',
},
{
title: '性别',
field: 'gender',
},
{
title: '人脸图片',
field: 'img',
},
{
title: '所属单位id',
field: 'unitId',
},
{
title: '所属单位名称',
field: 'unitName',
},
{
title: '入驻位置',
field: 'locathon',
},
{
title: '入驻时间',
field: 'time',
},
{
title: '车牌号码',
field: 'carNumber',
},
{
title: '状态',
field: 'state',
},
{
title: '备注',
field: 'remark',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: '主键id',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '用户id',
fieldName: 'userId',
component: 'Input',
rules: 'required',
},
{
label: '用户名称',
fieldName: 'userName',
component: 'Input',
rules: 'required',
},
{
label: '联系电话',
fieldName: 'phone',
component: 'Input',
rules: 'required',
},
{
label: '性别',
fieldName: 'gender',
component: 'Input',
rules: 'required',
},
{
label: '人脸图片',
fieldName: 'img',
component: 'Input',
},
{
label: '所属单位id',
fieldName: 'unitId',
component: 'Input',
},
{
label: '所属单位名称',
fieldName: 'unitName',
component: 'Input',
},
{
label: '入驻位置',
fieldName: 'locathon',
component: 'Input',
},
{
label: '入驻时间',
fieldName: 'time',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '车牌号码',
fieldName: 'carNumber',
component: 'Textarea',
},
{
label: '状态',
fieldName: 'state',
component: 'Input',
rules: 'required',
},
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
},
];

View File

@@ -0,0 +1,182 @@
<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 {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
} from '#/adapter/vxe-table';
import {
personExport,
personList,
personRemove,
} from '#/api/property/person';
import type { PersonForm } from '#/api/property/person/model';
import { commonDownloadExcel } from '#/utils/file/download';
import personModal from './person-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
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,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await personList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
// 表格全局唯一表示 保存列配置需要用到
id: 'property-person-index'
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [PersonModal, modalApi] = useVbenModal({
connectedComponent: personModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(row: Required<PersonForm>) {
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: Required<PersonForm>) {
await personRemove(row.id);
await tableApi.query();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<PersonForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await personRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(personExport, '入驻员工数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
});
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="入驻员工列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['property:person:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:person:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:person:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:person:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:person:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<PersonModal @reload="tableApi.query()" />
</Page>
</template>

View File

@@ -0,0 +1,101 @@
<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 { personAdd, personInfo, personUpdate } from '#/api/property/person';
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',
}
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await personInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? personUpdate(data) : personAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@@ -0,0 +1,193 @@
import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Input',
fieldName: 'name',
label: '入驻单位名称',
},
{
component: 'Input',
fieldName: 'unitNumber',
label: '单位编号',
},
{
component: 'Select',
componentProps: {
},
fieldName: 'type',
label: '企业类型',
},
{
component: 'Input',
fieldName: 'contactPerson',
label: '联系人',
},
{
component: 'Input',
fieldName: 'phone',
label: '联系电话',
},
{
component: 'Textarea',
fieldName: 'location',
label: '入驻位置',
},
{
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
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 },
{
title: 'id',
field: 'id',
},
{
title: '入驻单位名称',
field: 'name',
},
{
title: '单位编号',
field: 'unitNumber',
},
{
title: '企业类型',
field: 'type',
},
{
title: '联系人',
field: 'contactPerson',
},
{
title: '联系电话',
field: 'phone',
},
{
title: '入驻位置',
field: 'location',
},
{
title: '入驻时间',
field: 'time',
},
{
title: '状态',
field: 'state',
},
{
title: '员工人数',
field: 'number',
},
{
title: '备注',
field: 'remark',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const modalSchema: FormSchemaGetter = () => [
{
label: 'id',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '入驻单位名称',
fieldName: 'name',
component: 'Input',
rules: 'required',
},
{
label: '单位编号',
fieldName: 'unitNumber',
component: 'Input',
rules: 'required',
},
{
label: '企业类型',
fieldName: 'type',
component: 'Input',
componentProps: {
},
rules: 'selectRequired',
},
{
label: '联系人',
fieldName: 'contactPerson',
component: 'Input',
rules: 'required',
},
{
label: '联系电话',
fieldName: 'phone',
component: 'Input',
rules: 'required',
},
{
label: '入驻位置',
fieldName: 'location',
component: 'Textarea',
rules: 'required',
},
{
label: '入驻时间',
fieldName: 'time',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
},
{
label: '状态',
fieldName: 'state',
component: 'Input',
rules: 'required',
},
{
label: '员工人数',
fieldName: 'number',
component: 'Input',
rules: 'required',
},
{
label: '备注',
fieldName: 'remark',
component: 'Textarea',
},
];

View File

@@ -0,0 +1,182 @@
<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 {
useVbenVxeGrid,
vxeCheckboxChecked,
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';
import { commonDownloadExcel } from '#/utils/file/download';
import resident_unitModal from './resident_unit-modal.vue';
import { columns, querySchema } from './data';
const formOptions: VbenFormProps = {
commonConfig: {
labelWidth: 80,
componentProps: {
allowClear: true,
},
},
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,
pagerConfig: {},
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
return await resident_unitList({
pageNum: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
rowConfig: {
keyField: 'id',
},
// 表格全局唯一表示 保存列配置需要用到
id: 'property-resident_unit-index'
};
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
const [Resident_unitModal, modalApi] = useVbenModal({
connectedComponent: resident_unitModal,
});
function handleAdd() {
modalApi.setData({});
modalApi.open();
}
async function handleEdit(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();
}
function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<Resident_unitForm>) => row.id);
Modal.confirm({
title: '提示',
okType: 'danger',
content: `确认删除选中的${ids.length}条记录吗?`,
onOk: async () => {
await resident_unitRemove(ids);
await tableApi.query();
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(resident_unitExport, '入驻单位数据', tableApi.formApi.form.values, {
fieldMappingTime: formOptions.fieldMappingTime,
});
}
</script>
<template>
<Page :auto-content-height="true">
<BasicTable table-title="入驻单位列表">
<template #toolbar-tools>
<Space>
<a-button
v-access:code="['property:resident_unit:export']"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:resident_unit:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>
<a-button
type="primary"
v-access:code="['property:resident_unit:add']"
@click="handleAdd"
>
{{ $t('pages.common.add') }}
</a-button>
</Space>
</template>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:resident_unit:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
:get-popup-container="getVxePopupContainer"
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:resident_unit:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable>
<Resident_unitModal @reload="tableApi.query()" />
</Page>
</template>

View File

@@ -0,0 +1,101 @@
<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 { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident_unit';
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',
}
},
schema: modalSchema(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record = await resident_unitInfo(id);
await formApi.setValues(record);
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? resident_unitUpdate(data) : resident_unitAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</BasicModal>
</template>

View File

@@ -1,6 +1,8 @@
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 = () => [
{
@@ -8,6 +10,11 @@ export const querySchema: FormSchemaGetter = () => [
fieldName: 'visitorName',
label: '访客姓名',
},
{
component: 'Input',
fieldName: 'visitorUnit',
label: '所属公司',
},
{
component: 'Input',
fieldName: 'visitorPhone',
@@ -18,6 +25,21 @@ export const querySchema: FormSchemaGetter = () => [
fieldName: 'visitingReason',
label: '拜访事由',
},
{
component: 'Input',
fieldName: 'interviewedPerson',
label: '被访人',
},
{
component: 'Input',
fieldName: 'interviewedUnit',
label: '被访单位',
},
{
component: 'Input',
fieldName: 'interviewedPhone',
label: '被访人联系方式',
},
{
component: 'DatePicker',
componentProps: {
@@ -56,6 +78,8 @@ export const querySchema: FormSchemaGetter = () => [
{
component: 'RadioGroup',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_APPOINTMENT_TATUS 便于维护
options: getDictOptions('wy_appointment_tatus'),
buttonStyle: 'solid',
optionType: 'button',
},
@@ -76,6 +100,10 @@ export const columns: VxeGridProps['columns'] = [
title: '访客姓名',
field: 'visitorName',
},
{
title: '所属公司',
field: 'visitorUnit',
},
{
title: '访客电话',
field: 'visitorPhone',
@@ -84,6 +112,18 @@ export const columns: VxeGridProps['columns'] = [
title: '拜访事由',
field: 'visitingReason',
},
{
title: '被访人',
field: 'interviewedPerson',
},
{
title: '被访单位',
field: 'interviewedUnit',
},
{
title: '被访人联系方式',
field: 'interviewedPhone',
},
{
title: '拜访开始时间',
field: 'visitingBeginTime',
@@ -107,6 +147,12 @@ export const columns: VxeGridProps['columns'] = [
{
title: '预约状态',
field: 'serveStatus',
slots: {
default: ({ row }) => {
// 可选从DictEnum中获取 DictEnum.WY_APPOINTMENT_TATUS 便于维护
return renderDict(row.serveStatus, 'wy_appointment_tatus');
},
},
},
{
field: 'action',
@@ -133,6 +179,12 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
rules: 'required',
},
{
label: '所属公司',
fieldName: 'visitorUnit',
component: 'Input',
rules: 'required',
},
{
label: '访客电话',
fieldName: 'visitorPhone',
@@ -145,6 +197,42 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
rules: 'required',
},
{
label: '被访人',
fieldName: 'interviewedPerson',
component: 'Input',
rules: 'required',
},
{
label: '被访单位',
fieldName: 'interviewedUnit',
component: 'Input',
},
{
label: '被访人联系方式',
fieldName: 'interviewedPhone',
component: 'Input',
},
{
label: '拜访开始时间',
fieldName: 'visitingBeginTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '拜访结束时间',
fieldName: 'visitingEndTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '预约车位',
fieldName: 'bookingParkingSpace',
@@ -167,6 +255,8 @@ export const modalSchema: FormSchemaGetter = () => [
fieldName: 'serveStatus',
component: 'RadioGroup',
componentProps: {
// 可选从DictEnum中获取 DictEnum.WY_APPOINTMENT_TATUS 便于维护
options: getDictOptions('wy_appointment_tatus'),
buttonStyle: 'solid',
optionType: 'button',
},

View File

@@ -195,12 +195,6 @@ function handleImport() {
<Page :auto-content-height="true">
<BasicTable table-title="代码生成列表">
<template #toolbar-tools>
<a
class="text-primary mr-2"
href="https://dapdap.top/other/template.html"
target="_blank"
>👉关于代码生成模板
</a>
<Space>
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"