1、单元
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7m16s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7m16s
2、房间
This commit is contained in:
parent
e06f8861cc
commit
6f2e0be983
61
apps/web-antd/src/api/property/rentalOrder/index.ts
Normal file
61
apps/web-antd/src/api/property/rentalOrder/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import type { RentalOrderVO, RentalOrderForm, RentalOrderQuery } 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 rentalOrderList(params?: RentalOrderQuery) {
|
||||
return requestClient.get<PageResult<RentalOrderVO>>('/property/rentalOrder/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出绿植租赁-订单管理列表
|
||||
* @param params
|
||||
* @returns 绿植租赁-订单管理列表
|
||||
*/
|
||||
export function rentalOrderExport(params?: RentalOrderQuery) {
|
||||
return commonExport('/property/rentalOrder/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绿植租赁-订单管理详情
|
||||
* @param id id
|
||||
* @returns 绿植租赁-订单管理详情
|
||||
*/
|
||||
export function rentalOrderInfo(id: ID) {
|
||||
return requestClient.get<RentalOrderVO>(`/property/rentalOrder/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增绿植租赁-订单管理
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function rentalOrderAdd(data: RentalOrderForm) {
|
||||
return requestClient.postWithMsg<void>('/property/rentalOrder', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新绿植租赁-订单管理
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function rentalOrderUpdate(data: RentalOrderForm) {
|
||||
return requestClient.putWithMsg<void>('/property/rentalOrder', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除绿植租赁-订单管理
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function rentalOrderRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/rentalOrder/${id}`);
|
||||
}
|
249
apps/web-antd/src/api/property/rentalOrder/model.d.ts
vendored
Normal file
249
apps/web-antd/src/api/property/rentalOrder/model.d.ts
vendored
Normal file
@ -0,0 +1,249 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface RentalOrderVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
orderNo: string;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
customerName: string;
|
||||
|
||||
/**
|
||||
* 客户类型
|
||||
*/
|
||||
customerType: number;
|
||||
|
||||
/**
|
||||
* 租赁周期
|
||||
*/
|
||||
rentalPeriod: number;
|
||||
|
||||
/**
|
||||
* 租赁开始时间
|
||||
*/
|
||||
startTime: string;
|
||||
|
||||
/**
|
||||
* 租赁结束时间
|
||||
*/
|
||||
endTime: string;
|
||||
|
||||
/**
|
||||
* 应付总额
|
||||
*/
|
||||
totalAmount: number;
|
||||
|
||||
/**
|
||||
* 租赁方式
|
||||
*/
|
||||
rentalType: number;
|
||||
|
||||
/**
|
||||
* 租赁方案id
|
||||
*/
|
||||
planId: string | number;
|
||||
|
||||
/**
|
||||
* 绿植产品id
|
||||
*/
|
||||
productId: string | number;
|
||||
|
||||
/**
|
||||
* 租赁产品数量
|
||||
*/
|
||||
productNum: number;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
paymentStatus: number;
|
||||
|
||||
/**
|
||||
* 是否续租
|
||||
*/
|
||||
isRelet: number;
|
||||
|
||||
/**
|
||||
* 合同状态
|
||||
*/
|
||||
contractStatus: number;
|
||||
|
||||
/**
|
||||
* 签署时间
|
||||
*/
|
||||
signTime: string;
|
||||
|
||||
}
|
||||
|
||||
export interface RentalOrderForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
orderNo?: string;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
customerName?: string;
|
||||
|
||||
/**
|
||||
* 客户类型
|
||||
*/
|
||||
customerType?: number;
|
||||
|
||||
/**
|
||||
* 租赁周期
|
||||
*/
|
||||
rentalPeriod?: number;
|
||||
|
||||
/**
|
||||
* 租赁开始时间
|
||||
*/
|
||||
startTime?: string;
|
||||
|
||||
/**
|
||||
* 租赁结束时间
|
||||
*/
|
||||
endTime?: string;
|
||||
|
||||
/**
|
||||
* 应付总额
|
||||
*/
|
||||
totalAmount?: number;
|
||||
|
||||
/**
|
||||
* 租赁方式
|
||||
*/
|
||||
rentalType?: number;
|
||||
|
||||
/**
|
||||
* 租赁方案id
|
||||
*/
|
||||
planId?: string | number;
|
||||
|
||||
/**
|
||||
* 绿植产品id
|
||||
*/
|
||||
productId?: string | number;
|
||||
|
||||
/**
|
||||
* 租赁产品数量
|
||||
*/
|
||||
productNum?: number;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
paymentStatus?: number;
|
||||
|
||||
/**
|
||||
* 是否续租
|
||||
*/
|
||||
isRelet?: number;
|
||||
|
||||
/**
|
||||
* 合同状态
|
||||
*/
|
||||
contractStatus?: number;
|
||||
|
||||
/**
|
||||
* 签署时间
|
||||
*/
|
||||
signTime?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface RentalOrderQuery extends PageQuery {
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
orderNo?: string;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
customerName?: string;
|
||||
|
||||
/**
|
||||
* 客户类型
|
||||
*/
|
||||
customerType?: number;
|
||||
|
||||
/**
|
||||
* 租赁周期
|
||||
*/
|
||||
rentalPeriod?: number;
|
||||
|
||||
/**
|
||||
* 租赁开始时间
|
||||
*/
|
||||
startTime?: string;
|
||||
|
||||
/**
|
||||
* 租赁结束时间
|
||||
*/
|
||||
endTime?: string;
|
||||
|
||||
/**
|
||||
* 应付总额
|
||||
*/
|
||||
totalAmount?: number;
|
||||
|
||||
/**
|
||||
* 租赁方式
|
||||
*/
|
||||
rentalType?: number;
|
||||
|
||||
/**
|
||||
* 租赁方案id
|
||||
*/
|
||||
planId?: string | number;
|
||||
|
||||
/**
|
||||
* 绿植产品id
|
||||
*/
|
||||
productId?: string | number;
|
||||
|
||||
/**
|
||||
* 租赁产品数量
|
||||
*/
|
||||
productNum?: number;
|
||||
|
||||
/**
|
||||
* 支付状态
|
||||
*/
|
||||
paymentStatus?: number;
|
||||
|
||||
/**
|
||||
* 是否续租
|
||||
*/
|
||||
isRelet?: number;
|
||||
|
||||
/**
|
||||
* 合同状态
|
||||
*/
|
||||
contractStatus?: number;
|
||||
|
||||
/**
|
||||
* 签署时间
|
||||
*/
|
||||
signTime?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
61
apps/web-antd/src/api/property/room/index.ts
Normal file
61
apps/web-antd/src/api/property/room/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import type { RoomVO, RoomForm, RoomQuery } 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 roomList(params?: RoomQuery) {
|
||||
return requestClient.get<PageResult<RoomVO>>('/property/room/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出房间信息列表
|
||||
* @param params
|
||||
* @returns 房间信息列表
|
||||
*/
|
||||
export function roomExport(params?: RoomQuery) {
|
||||
return commonExport('/property/room/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询房间信息详情
|
||||
* @param id id
|
||||
* @returns 房间信息详情
|
||||
*/
|
||||
export function roomInfo(id: ID) {
|
||||
return requestClient.get<RoomVO>(`/property/room/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增房间信息
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function roomAdd(data: RoomForm) {
|
||||
return requestClient.postWithMsg<void>('/property/room', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新房间信息
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function roomUpdate(data: RoomForm) {
|
||||
return requestClient.putWithMsg<void>('/property/room', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除房间信息
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function roomRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/room/${id}`);
|
||||
}
|
159
apps/web-antd/src/api/property/room/model.d.ts
vendored
Normal file
159
apps/web-antd/src/api/property/room/model.d.ts
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface RoomVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 所属楼层ID
|
||||
*/
|
||||
floorCode: string;
|
||||
|
||||
/**
|
||||
* 房间编码
|
||||
*/
|
||||
roomCode: string;
|
||||
|
||||
/**
|
||||
* 房间号(如101,202)
|
||||
*/
|
||||
roomNumber: string;
|
||||
|
||||
/**
|
||||
* 房间类型('住宅','商铺','办公室','设备间','公共区域')
|
||||
*/
|
||||
roomType: number;
|
||||
|
||||
/**
|
||||
* 面积(平方米)
|
||||
*/
|
||||
area: number;
|
||||
|
||||
/**
|
||||
* 户型(如2室1厅1卫)
|
||||
*/
|
||||
layout: string;
|
||||
|
||||
/**
|
||||
* 朝向('东','南','西','北','东南','东北','西南','西北')
|
||||
*/
|
||||
orientation: number;
|
||||
|
||||
/**
|
||||
* 是否可售
|
||||
*/
|
||||
isForSale: number;
|
||||
|
||||
/**
|
||||
* 状态('空置','已售','已租','自用')
|
||||
*/
|
||||
status: number;
|
||||
|
||||
}
|
||||
|
||||
export interface RoomForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 所属楼层ID
|
||||
*/
|
||||
floorCode?: string;
|
||||
|
||||
/**
|
||||
* 房间编码
|
||||
*/
|
||||
roomCode?: string;
|
||||
|
||||
/**
|
||||
* 房间号(如101,202)
|
||||
*/
|
||||
roomNumber?: string;
|
||||
|
||||
/**
|
||||
* 房间类型('住宅','商铺','办公室','设备间','公共区域')
|
||||
*/
|
||||
roomType?: number;
|
||||
|
||||
/**
|
||||
* 面积(平方米)
|
||||
*/
|
||||
area?: number;
|
||||
|
||||
/**
|
||||
* 户型(如2室1厅1卫)
|
||||
*/
|
||||
layout?: string;
|
||||
|
||||
/**
|
||||
* 朝向('东','南','西','北','东南','东北','西南','西北')
|
||||
*/
|
||||
orientation?: number;
|
||||
|
||||
/**
|
||||
* 是否可售
|
||||
*/
|
||||
isForSale?: number;
|
||||
|
||||
/**
|
||||
* 状态('空置','已售','已租','自用')
|
||||
*/
|
||||
status?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface RoomQuery extends PageQuery {
|
||||
/**
|
||||
* 所属楼层ID
|
||||
*/
|
||||
floorCode?: string;
|
||||
|
||||
/**
|
||||
* 房间编码
|
||||
*/
|
||||
roomCode?: string;
|
||||
|
||||
/**
|
||||
* 房间号(如101,202)
|
||||
*/
|
||||
roomNumber?: string;
|
||||
|
||||
/**
|
||||
* 房间类型('住宅','商铺','办公室','设备间','公共区域')
|
||||
*/
|
||||
roomType?: number;
|
||||
|
||||
/**
|
||||
* 面积(平方米)
|
||||
*/
|
||||
area?: number;
|
||||
|
||||
/**
|
||||
* 户型(如2室1厅1卫)
|
||||
*/
|
||||
layout?: string;
|
||||
|
||||
/**
|
||||
* 朝向('东','南','西','北','东南','东北','西南','西北')
|
||||
*/
|
||||
orientation?: number;
|
||||
|
||||
/**
|
||||
* 是否可售
|
||||
*/
|
||||
isForSale?: number;
|
||||
|
||||
/**
|
||||
* 状态('空置','已售','已租','自用')
|
||||
*/
|
||||
status?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
61
apps/web-antd/src/api/property/unit/index.ts
Normal file
61
apps/web-antd/src/api/property/unit/index.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import type { UnitVO, UnitForm, 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 unitList(params?: UnitQuery) {
|
||||
return requestClient.get<PageResult<UnitVO>>('/property/unit/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出单元列表
|
||||
* @param params
|
||||
* @returns 单元列表
|
||||
*/
|
||||
export function unitExport(params?: UnitQuery) {
|
||||
return commonExport('/property/unit/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询单元详情
|
||||
* @param id id
|
||||
* @returns 单元详情
|
||||
*/
|
||||
export function unitInfo(id: ID) {
|
||||
return requestClient.get<UnitVO>(`/property/unit/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增单元
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function unitAdd(data: UnitForm) {
|
||||
return requestClient.postWithMsg<void>('/property/unit', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新单元
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function unitUpdate(data: UnitForm) {
|
||||
return requestClient.putWithMsg<void>('/property/unit', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单元
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function unitRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/unit/${id}`);
|
||||
}
|
114
apps/web-antd/src/api/property/unit/model.d.ts
vendored
Normal file
114
apps/web-antd/src/api/property/unit/model.d.ts
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface UnitVO {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
buildingCode: string;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
unitCode: string;
|
||||
|
||||
/**
|
||||
* 单元名称
|
||||
*/
|
||||
unitName: string;
|
||||
|
||||
/**
|
||||
* 单元层数
|
||||
*/
|
||||
floorCount: number;
|
||||
|
||||
/**
|
||||
* 单元户数
|
||||
*/
|
||||
householdCount: number;
|
||||
|
||||
/**
|
||||
* 楼梯数量
|
||||
*/
|
||||
stairCount: number;
|
||||
|
||||
}
|
||||
|
||||
export interface UnitForm extends BaseEntity {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
buildingCode?: string;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
unitCode?: string;
|
||||
|
||||
/**
|
||||
* 单元名称
|
||||
*/
|
||||
unitName?: string;
|
||||
|
||||
/**
|
||||
* 单元层数
|
||||
*/
|
||||
floorCount?: number;
|
||||
|
||||
/**
|
||||
* 单元户数
|
||||
*/
|
||||
householdCount?: number;
|
||||
|
||||
/**
|
||||
* 楼梯数量
|
||||
*/
|
||||
stairCount?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface UnitQuery extends PageQuery {
|
||||
/**
|
||||
* 建筑名称
|
||||
*/
|
||||
buildingCode?: string;
|
||||
|
||||
/**
|
||||
* 单元编码
|
||||
*/
|
||||
unitCode?: string;
|
||||
|
||||
/**
|
||||
* 单元名称
|
||||
*/
|
||||
unitName?: string;
|
||||
|
||||
/**
|
||||
* 单元层数
|
||||
*/
|
||||
floorCount?: number;
|
||||
|
||||
/**
|
||||
* 单元户数
|
||||
*/
|
||||
householdCount?: number;
|
||||
|
||||
/**
|
||||
* 楼梯数量
|
||||
*/
|
||||
stairCount?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@ -0,0 +1,241 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orderNo',
|
||||
label: '订单编号',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'customerName',
|
||||
label: '客户名称',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
fieldName: 'customerType',
|
||||
label: '客户类型',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options:getDictOptions('wy_zlfs')
|
||||
},
|
||||
fieldName: 'rentalType',
|
||||
label: '租赁方式',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options:getDictOptions('pro_charging_status')
|
||||
},
|
||||
fieldName: 'paymentStatus',
|
||||
label: '支付状态',
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '订单号',
|
||||
field: 'id',
|
||||
},
|
||||
{
|
||||
title: '订单号',
|
||||
field: 'orderNo',
|
||||
},
|
||||
{
|
||||
title: '客户名称',
|
||||
field: 'customerName',
|
||||
},
|
||||
{
|
||||
title: '客户类型',
|
||||
field: 'customerType',
|
||||
},
|
||||
{
|
||||
title: '租赁周期',
|
||||
field: 'rentalPeriod',
|
||||
},
|
||||
{
|
||||
title: '租赁开始时间',
|
||||
field: 'startTime',
|
||||
},
|
||||
{
|
||||
title: '租赁结束时间',
|
||||
field: 'endTime',
|
||||
},
|
||||
{
|
||||
title: '应付总额',
|
||||
field: 'totalAmount',
|
||||
},
|
||||
{
|
||||
title: '租赁方式',
|
||||
field: 'rentalType',
|
||||
},
|
||||
{
|
||||
title: '租赁方案id',
|
||||
field: 'planId',
|
||||
},
|
||||
{
|
||||
title: '绿植产品id',
|
||||
field: 'productId',
|
||||
},
|
||||
{
|
||||
title: '租赁产品数量',
|
||||
field: 'productNum',
|
||||
},
|
||||
{
|
||||
title: '支付状态',
|
||||
field: 'paymentStatus',
|
||||
},
|
||||
{
|
||||
title: '是否续租',
|
||||
field: 'isRelet',
|
||||
},
|
||||
{
|
||||
title: '合同状态',
|
||||
field: 'contractStatus',
|
||||
},
|
||||
{
|
||||
title: '签署时间',
|
||||
field: 'signTime',
|
||||
},
|
||||
{
|
||||
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: 'orderNo',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '客户名称',
|
||||
fieldName: 'customerName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '客户类型',
|
||||
fieldName: 'customerType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '租赁周期',
|
||||
fieldName: 'rentalPeriod',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '租赁开始时间',
|
||||
fieldName: 'startTime',
|
||||
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: '应付总额',
|
||||
fieldName: 'totalAmount',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '租赁方式',
|
||||
fieldName: 'rentalType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '租赁方案id',
|
||||
fieldName: 'planId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '绿植产品id',
|
||||
fieldName: 'productId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '租赁产品数量',
|
||||
fieldName: 'productNum',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '支付状态',
|
||||
fieldName: 'paymentStatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
label: '是否续租',
|
||||
fieldName: 'isRelet',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
buttonStyle: 'solid',
|
||||
optionType: 'button',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '合同状态',
|
||||
fieldName: 'contractStatus',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '签署时间',
|
||||
fieldName: 'signTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
];
|
@ -1,5 +1,178 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
rentalOrderExport,
|
||||
rentalOrderList,
|
||||
rentalOrderRemove,
|
||||
} from '#/api/property/rentalOrder';
|
||||
import type { RentalOrderForm } from '#/api/property/rentalOrder/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import rentalOrderModal from './rentalOrder-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 rentalOrderList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-rentalOrder-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [RentalOrderModal, modalApi] = useVbenModal({
|
||||
connectedComponent: rentalOrderModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<RentalOrderForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<RentalOrderForm>) {
|
||||
await rentalOrderRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<RentalOrderForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await rentalOrderRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(rentalOrderExport, '绿植租赁-订单管理数据', tableApi.formApi.form.values, {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
订单管理
|
||||
</div>
|
||||
</template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="绿植租赁-订单管理列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
v-access:code="['property:rentalOrder:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:rentalOrder:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:rentalOrder:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:rentalOrder: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:rentalOrder:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<RentalOrderModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
||||
|
@ -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 { rentalOrderAdd, rentalOrderInfo, rentalOrderUpdate } from '#/api/property/rentalOrder';
|
||||
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 rentalOrderInfo(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 ? rentalOrderUpdate(data) : rentalOrderAdd(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>
|
||||
|
171
apps/web-antd/src/views/property/room/data.ts
Normal file
171
apps/web-antd/src/views/property/room/data.ts
Normal file
@ -0,0 +1,171 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Select',
|
||||
fieldName: 'floorCode',
|
||||
label: '所属小区',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
fieldName: 'floorCode1',
|
||||
label: '所属建筑',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
fieldName: 'floorCode2',
|
||||
label: '所属单元',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
fieldName: 'floorCode3',
|
||||
label: '所属楼层',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'roomCode',
|
||||
label: '房间编码',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'roomNumber',
|
||||
label: '房间号',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('room_type'),
|
||||
},
|
||||
fieldName: 'roomType',
|
||||
label: '房间类型',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_fjzt'),
|
||||
},
|
||||
fieldName: 'status',
|
||||
label: '房间状态',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '所属楼层ID',
|
||||
field: 'floorCode',
|
||||
},
|
||||
{
|
||||
title: '房间编码',
|
||||
field: 'roomCode',
|
||||
},
|
||||
{
|
||||
title: '房间号',
|
||||
field: 'roomNumber',
|
||||
},
|
||||
{
|
||||
title: '房间类型',
|
||||
field: 'roomType',
|
||||
},
|
||||
{
|
||||
title: '面积(㎡)',
|
||||
field: 'area',
|
||||
},
|
||||
{
|
||||
title: '户型',
|
||||
field: 'layout',
|
||||
},
|
||||
{
|
||||
title: '朝向',
|
||||
field: 'orientation',
|
||||
},
|
||||
{
|
||||
title: '是否可售',
|
||||
field: 'isForSale',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
field: 'status',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '所属楼层ID',
|
||||
fieldName: 'floorCode',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '房间编码',
|
||||
fieldName: 'roomCode',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '房间号(如101,202)',
|
||||
fieldName: 'roomNumber',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '房间类型',
|
||||
fieldName: 'roomType',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('room_type'),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '面积(平方米)',
|
||||
fieldName: 'area',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '户型(如2室1厅1卫)',
|
||||
fieldName: 'layout',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '朝向',
|
||||
fieldName: 'orientation',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('direction_towards'),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '是否可售',
|
||||
fieldName: 'isForSale',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '房间状态',
|
||||
fieldName: 'status',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_fjzt'),
|
||||
},
|
||||
},
|
||||
];
|
182
apps/web-antd/src/views/property/room/index.vue
Normal file
182
apps/web-antd/src/views/property/room/index.vue
Normal 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 {
|
||||
roomExport,
|
||||
roomList,
|
||||
roomRemove,
|
||||
} from '#/api/property/room';
|
||||
import type { RoomForm } from '#/api/property/room/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import roomModal from './room-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 roomList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-room-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [RoomModal, modalApi] = useVbenModal({
|
||||
connectedComponent: roomModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<RoomForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<RoomForm>) {
|
||||
await roomRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<RoomForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await roomRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(roomExport, '房间信息数据', 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:room:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:room:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:room:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:room: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:room:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<RoomModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
101
apps/web-antd/src/views/property/room/room-modal.vue
Normal file
101
apps/web-antd/src/views/property/room/room-modal.vue
Normal 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 { roomAdd, roomInfo, roomUpdate } from '#/api/property/room';
|
||||
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 roomInfo(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 ? roomUpdate(data) : roomAdd(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>
|
||||
|
118
apps/web-antd/src/views/property/unit/data.ts
Normal file
118
apps/web-antd/src/views/property/unit/data.ts
Normal file
@ -0,0 +1,118 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'buildingCode',
|
||||
label: '建筑名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'unitCode',
|
||||
label: '单元编码',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'unitName',
|
||||
label: '单元名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'floorCount',
|
||||
label: '单元层数',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'householdCount',
|
||||
label: '单元户数',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'stairCount',
|
||||
label: '楼梯数量',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '建筑名称',
|
||||
field: 'buildingCode',
|
||||
},
|
||||
{
|
||||
title: '单元编码',
|
||||
field: 'unitCode',
|
||||
},
|
||||
{
|
||||
title: '单元名称',
|
||||
field: 'unitName',
|
||||
},
|
||||
{
|
||||
title: '单元层数',
|
||||
field: 'floorCount',
|
||||
},
|
||||
{
|
||||
title: '单元户数',
|
||||
field: 'householdCount',
|
||||
},
|
||||
{
|
||||
title: '楼梯数量',
|
||||
field: 'stairCount',
|
||||
},
|
||||
{
|
||||
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: 'buildingCode',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '单元编码',
|
||||
fieldName: 'unitCode',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '单元名称',
|
||||
fieldName: 'unitName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '单元层数',
|
||||
fieldName: 'floorCount',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '单元户数',
|
||||
fieldName: 'householdCount',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '楼梯数量',
|
||||
fieldName: 'stairCount',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
182
apps/web-antd/src/views/property/unit/index.vue
Normal file
182
apps/web-antd/src/views/property/unit/index.vue
Normal 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 {
|
||||
unitExport,
|
||||
unitList,
|
||||
unitRemove,
|
||||
} from '#/api/property/unit';
|
||||
import type { UnitForm } from '#/api/property/unit/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import unitModal from './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 unitList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-unit-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [UnitModal, modalApi] = useVbenModal({
|
||||
connectedComponent: unitModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<UnitForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<UnitForm>) {
|
||||
await unitRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<UnitForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await unitRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(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:unit:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:unit:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:unit:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property: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:unit:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<UnitModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
101
apps/web-antd/src/views/property/unit/unit-modal.vue
Normal file
101
apps/web-antd/src/views/property/unit/unit-modal.vue
Normal 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 { unitAdd, unitInfo, unitUpdate } from '#/api/property/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 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 ? unitUpdate(data) : 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>
|
||||
|
Loading…
Reference in New Issue
Block a user