设备管理
This commit is contained in:
@@ -12,7 +12,7 @@ import { requestClient } from '#/api/request';
|
|||||||
* @returns 费用项设置列表
|
* @returns 费用项设置列表
|
||||||
*/
|
*/
|
||||||
export function costItemSettingList(params?: CostItemSettingQuery) {
|
export function costItemSettingList(params?: CostItemSettingQuery) {
|
||||||
return requestClient.get<PageResult<CostItemSettingVO>>('/property/costItemSetting/list', { params });
|
return requestClient.get<PageResult<CostItemSettingVO>>('/property/costItems/list', { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +21,7 @@ export function costItemSettingList(params?: CostItemSettingQuery) {
|
|||||||
* @returns 费用项设置列表
|
* @returns 费用项设置列表
|
||||||
*/
|
*/
|
||||||
export function costItemSettingExport(params?: CostItemSettingQuery) {
|
export function costItemSettingExport(params?: CostItemSettingQuery) {
|
||||||
return commonExport('/property/costItemSetting/export', params ?? {});
|
return commonExport('/property/costItems/export', params ?? {});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@ export function costItemSettingExport(params?: CostItemSettingQuery) {
|
|||||||
* @returns 费用项设置详情
|
* @returns 费用项设置详情
|
||||||
*/
|
*/
|
||||||
export function costItemSettingInfo(id: ID) {
|
export function costItemSettingInfo(id: ID) {
|
||||||
return requestClient.get<CostItemSettingVO>(`/property/costItemSetting/${id}`);
|
return requestClient.get<CostItemSettingVO>(`/property/costItems/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ export function costItemSettingInfo(id: ID) {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
export function costItemSettingAdd(data: CostItemSettingForm) {
|
export function costItemSettingAdd(data: CostItemSettingForm) {
|
||||||
return requestClient.postWithMsg<void>('/property/costItemSetting', data);
|
return requestClient.postWithMsg<void>('/property/costItems', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +48,7 @@ export function costItemSettingAdd(data: CostItemSettingForm) {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
export function costItemSettingUpdate(data: CostItemSettingForm) {
|
export function costItemSettingUpdate(data: CostItemSettingForm) {
|
||||||
return requestClient.putWithMsg<void>('/property/costItemSetting', data);
|
return requestClient.putWithMsg<void>('/property/costItems', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,5 +57,5 @@ export function costItemSettingUpdate(data: CostItemSettingForm) {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
export function costItemSettingRemove(id: ID | IDS) {
|
export function costItemSettingRemove(id: ID | IDS) {
|
||||||
return requestClient.deleteWithMsg<void>(`/property/costItemSetting/${id}`);
|
return requestClient.deleteWithMsg<void>(`/property/costItems/${id}`);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,61 @@
|
|||||||
|
import type { MeterReadingTypeVO, MeterReadingTypeForm, MeterReadingTypeQuery } 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 meterReadingTypeList(params?: MeterReadingTypeQuery) {
|
||||||
|
return requestClient.get<PageResult<MeterReadingTypeVO>>('/property/meterReadingType/list', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出抄表类型列表
|
||||||
|
* @param params
|
||||||
|
* @returns 抄表类型列表
|
||||||
|
*/
|
||||||
|
export function meterReadingTypeExport(params?: MeterReadingTypeQuery) {
|
||||||
|
return commonExport('/property/meterReadingType/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询抄表类型详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 抄表类型详情
|
||||||
|
*/
|
||||||
|
export function meterReadingTypeInfo(id: ID) {
|
||||||
|
return requestClient.get<MeterReadingTypeVO>(`/property/meterReadingType/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增抄表类型
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function meterReadingTypeAdd(data: MeterReadingTypeForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/property/meterReadingType', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新抄表类型
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function meterReadingTypeUpdate(data: MeterReadingTypeForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/property/meterReadingType', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除抄表类型
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function meterReadingTypeRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/property/meterReadingType/${id}`);
|
||||||
|
}
|
79
apps/web-antd/src/api/property/costManagement/meterReadingType/model.d.ts
vendored
Normal file
79
apps/web-antd/src/api/property/costManagement/meterReadingType/model.d.ts
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface MeterReadingTypeVO {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄表类型
|
||||||
|
*/
|
||||||
|
meterType: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索值
|
||||||
|
*/
|
||||||
|
searchValue: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MeterReadingTypeForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 抄表类型
|
||||||
|
*/
|
||||||
|
meterType?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
name?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 说明
|
||||||
|
*/
|
||||||
|
remark?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索值
|
||||||
|
*/
|
||||||
|
searchValue?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MeterReadingTypeQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 抄表类型
|
||||||
|
*/
|
||||||
|
meterType?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
name?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索值
|
||||||
|
*/
|
||||||
|
searchValue?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
@@ -6,7 +6,7 @@ import { $t } from '@vben/locales';
|
|||||||
import { cloneDeep } from '@vben/utils';
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { costItemSettingAdd, costItemSettingInfo, costItemSettingUpdate } from '#/api/property/costItemSetting';
|
import { costItemSettingAdd, costItemSettingInfo, costItemSettingUpdate } from '#/api/property/costManagement/costItemSetting';
|
||||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
import { modalSchema } from './data';
|
import { modalSchema } from './data';
|
||||||
@@ -21,9 +21,9 @@ const title = computed(() => {
|
|||||||
const [BasicForm, formApi] = useVbenForm({
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
// 默认占满两列
|
// 默认占满两列
|
||||||
formItemClass: 'col-span-2',
|
formItemClass: 'col-span-1',
|
||||||
// 默认label宽度 px
|
// 默认label宽度 px
|
||||||
labelWidth: 80,
|
labelWidth: 100,
|
||||||
// 通用配置项 会影响到所有表单项
|
// 通用配置项 会影响到所有表单项
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
@@ -43,7 +43,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
|||||||
|
|
||||||
const [BasicModal, modalApi] = useVbenModal({
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
// 在这里更改宽度
|
// 在这里更改宽度
|
||||||
class: 'w-[550px]',
|
class: 'w-[60%]',
|
||||||
fullscreenButton: false,
|
fullscreenButton: false,
|
||||||
onBeforeClose,
|
onBeforeClose,
|
||||||
onClosed: handleClosed,
|
onClosed: handleClosed,
|
||||||
|
@@ -5,77 +5,27 @@ import { getDictOptions } from '#/utils/dict';
|
|||||||
import { renderDict } from '#/utils/render';
|
import { renderDict } from '#/utils/render';
|
||||||
|
|
||||||
export const querySchema: FormSchemaGetter = () => [
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
{
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
|
||||||
options: getDictOptions('pro_expense_type'),
|
|
||||||
},
|
|
||||||
fieldName: 'costType',
|
|
||||||
label: '费用类型',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
fieldName: 'chargeItem',
|
fieldName: 'chargeItem',
|
||||||
label: '收费项目',
|
label: '费用编号',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Select',
|
||||||
fieldName: 'costMark',
|
fieldName: 'costMark',
|
||||||
|
componentProps: {
|
||||||
|
options: getDictOptions('pro_cost_identification'),
|
||||||
|
},
|
||||||
label: '费用标识',
|
label: '费用标识',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
options: getDictOptions('pro_payment_type'),
|
||||||
},
|
},
|
||||||
fieldName: 'paymentType',
|
fieldName: 'paymentType',
|
||||||
label: '付费类型',
|
label: '付费类型',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'chargeCycle',
|
|
||||||
label: '缴费周期',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'isMobilePay',
|
|
||||||
label: '是否手机缴费',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'roundingMode',
|
|
||||||
label: '进位方式',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'currencyDecimals',
|
|
||||||
label: '保留小数',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'state',
|
|
||||||
label: '启用状态',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'formula',
|
|
||||||
label: '计算公式',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'unitPrice',
|
|
||||||
label: '计费单价',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'surcharge',
|
|
||||||
label: '附加费',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'Input',
|
|
||||||
fieldName: 'searchValue',
|
|
||||||
label: '搜索值',
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
@@ -83,8 +33,8 @@ export const querySchema: FormSchemaGetter = () => [
|
|||||||
export const columns: VxeGridProps['columns'] = [
|
export const columns: VxeGridProps['columns'] = [
|
||||||
{ type: 'checkbox', width: 60 },
|
{ type: 'checkbox', width: 60 },
|
||||||
{
|
{
|
||||||
title: '主键',
|
title: '费用编号',
|
||||||
field: 'id',
|
field: 'chargeItem',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '费用类型',
|
title: '费用类型',
|
||||||
@@ -103,31 +53,27 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
{
|
{
|
||||||
title: '费用标识',
|
title: '费用标识',
|
||||||
field: 'costMark',
|
field: 'costMark',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
return renderDict(row.costType, 'pro_cost_identification');
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '付费类型',
|
title: '付费类型',
|
||||||
field: 'paymentType',
|
field: 'paymentType',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
return renderDict(row.costType, 'pro_payment_type');
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '缴费周期',
|
title: '费用周期(月)',
|
||||||
field: 'chargeCycle',
|
field: 'chargeCycle',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '是否手机缴费',
|
|
||||||
field: 'isMobilePay',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '进位方式',
|
|
||||||
field: 'roundingMode',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '保留小数',
|
|
||||||
field: 'currencyDecimals',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '启用状态',
|
|
||||||
field: 'state',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '计算公式',
|
title: '计算公式',
|
||||||
field: 'formula',
|
field: 'formula',
|
||||||
@@ -137,13 +83,9 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
field: 'unitPrice',
|
field: 'unitPrice',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '附加费',
|
title: '附加费用',
|
||||||
field: 'surcharge',
|
field: 'surcharge',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '搜索值',
|
|
||||||
field: 'searchValue',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'action',
|
field: 'action',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
@@ -182,7 +124,11 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
{
|
{
|
||||||
label: '费用标识',
|
label: '费用标识',
|
||||||
fieldName: 'costMark',
|
fieldName: 'costMark',
|
||||||
component: 'Input',
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
options: getDictOptions('pro_cost_identification'),
|
||||||
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -190,28 +136,44 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
fieldName: 'paymentType',
|
fieldName: 'paymentType',
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
options: getDictOptions('pro_payment_type'),
|
||||||
},
|
},
|
||||||
rules: 'selectRequired',
|
rules: 'selectRequired',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '缴费周期',
|
label: '费用周期(月)',
|
||||||
fieldName: 'chargeCycle',
|
fieldName: 'chargeCycle',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '是否手机缴费',
|
label: '手机缴费',
|
||||||
fieldName: 'isMobilePay',
|
fieldName: 'isMobilePay',
|
||||||
component: 'Input',
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
options: getDictOptions('pro_mobile_payment'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '进位方式',
|
label: '进位方式',
|
||||||
fieldName: 'roundingMode',
|
fieldName: 'roundingMode',
|
||||||
component: 'Input',
|
componentProps: {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
options: getDictOptions('pro_carry_method'),
|
||||||
|
},
|
||||||
|
component: 'Select',
|
||||||
|
rules: 'selectRequired',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '保留小数',
|
label: '保留小数',
|
||||||
fieldName: 'currencyDecimals',
|
fieldName: 'currencyDecimals',
|
||||||
component: 'Input',
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
options: getDictOptions('pro_keep_decimals'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '启用状态',
|
label: '启用状态',
|
||||||
@@ -221,7 +183,13 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
{
|
{
|
||||||
label: '计算公式',
|
label: '计算公式',
|
||||||
fieldName: 'formula',
|
fieldName: 'formula',
|
||||||
component: 'Input',
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
options: getDictOptions('pro_calculation_formula'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
formItemClass:'col-span-2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '计费单价',
|
label: '计费单价',
|
||||||
@@ -233,9 +201,4 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
fieldName: 'surcharge',
|
fieldName: 'surcharge',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: '搜索值',
|
|
||||||
fieldName: 'searchValue',
|
|
||||||
component: 'Input',
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
@@ -1,27 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Recordable } from '@vben/types';
|
|
||||||
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||||
import { getVxePopupContainer } from '@vben/utils';
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useVbenVxeGrid,
|
useVbenVxeGrid,
|
||||||
vxeCheckboxChecked,
|
vxeCheckboxChecked,
|
||||||
type VxeGridProps
|
type VxeGridProps
|
||||||
} from '#/adapter/vxe-table';
|
} from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
costItemSettingExport,
|
|
||||||
costItemSettingList,
|
costItemSettingList,
|
||||||
costItemSettingRemove,
|
costItemSettingRemove,
|
||||||
} from '#/api/property/costItemSetting';
|
} from '#/api/property/costManagement/costItemSetting';
|
||||||
import type { CostItemSettingForm } from '#/api/property/costItemSetting/model';
|
import type { CostItemSettingForm } from '#/api/property/costManagement/costItemSetting/model';
|
||||||
import { commonDownloadExcel } from '#/utils/file/download';
|
|
||||||
|
|
||||||
import costItemSettingModal from './costItemSetting-modal.vue';
|
import costItemSettingModal from './costItemSetting-modal.vue';
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
@@ -35,15 +28,6 @@ const formOptions: VbenFormProps = {
|
|||||||
},
|
},
|
||||||
schema: querySchema(),
|
schema: querySchema(),
|
||||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||||
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
|
||||||
// 不需要直接删除
|
|
||||||
// fieldMappingTime: [
|
|
||||||
// [
|
|
||||||
// 'createTime',
|
|
||||||
// ['params[beginTime]', 'params[endTime]'],
|
|
||||||
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
|
||||||
// ],
|
|
||||||
// ],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const gridOptions: VxeGridProps = {
|
const gridOptions: VxeGridProps = {
|
||||||
@@ -116,12 +100,6 @@ function handleMultiDelete() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDownloadExcel() {
|
|
||||||
commonDownloadExcel(costItemSettingExport, '费用项设置数据', tableApi.formApi.form.values, {
|
|
||||||
fieldMappingTime: formOptions.fieldMappingTime,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -129,17 +107,11 @@ function handleDownloadExcel() {
|
|||||||
<BasicTable table-title="费用项设置列表">
|
<BasicTable table-title="费用项设置列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<Space>
|
<Space>
|
||||||
<a-button
|
|
||||||
v-access:code="['property:costItemSetting:export']"
|
|
||||||
@click="handleDownloadExcel"
|
|
||||||
>
|
|
||||||
{{ $t('pages.common.export') }}
|
|
||||||
</a-button>
|
|
||||||
<a-button
|
<a-button
|
||||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
danger
|
danger
|
||||||
type="primary"
|
type="primary"
|
||||||
v-access:code="['property:costItemSetting:remove']"
|
v-access:code="['property:costItemSetting:remove']"
|
||||||
@click="handleMultiDelete">
|
@click="handleMultiDelete">
|
||||||
{{ $t('pages.common.delete') }}
|
{{ $t('pages.common.delete') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@@ -0,0 +1,90 @@
|
|||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { getDictOptions } from '#/utils/dict';
|
||||||
|
import { renderDict } from '#/utils/render';
|
||||||
|
|
||||||
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.METER_READING_TYPE 便于维护
|
||||||
|
options: getDictOptions('meter_reading_type'),
|
||||||
|
},
|
||||||
|
fieldName: 'meterType',
|
||||||
|
label: '抄表类型',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'name',
|
||||||
|
label: '名称',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
{
|
||||||
|
title: '抄表类型',
|
||||||
|
field: 'meterType',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.METER_READING_TYPE 便于维护
|
||||||
|
return renderDict(row.meterType, 'meter_reading_type');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '名称',
|
||||||
|
field: 'name',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '说明',
|
||||||
|
field: 'remark',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
field: 'createTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: 'meterType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.METER_READING_TYPE 便于维护
|
||||||
|
options: getDictOptions('meter_reading_type'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '名称',
|
||||||
|
fieldName: 'name',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '说明',
|
||||||
|
fieldName: 'remark',
|
||||||
|
component: 'Textarea',
|
||||||
|
},
|
||||||
|
];
|
@@ -0,0 +1,150 @@
|
|||||||
|
<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 {
|
||||||
|
meterReadingTypeList,
|
||||||
|
meterReadingTypeRemove,
|
||||||
|
} from '#/api/property/costManagement/meterReadingType';
|
||||||
|
import type { MeterReadingTypeForm } from '#/api/property/costManagement/meterReadingType/model';
|
||||||
|
import meterReadingTypeModal from './meterReadingType-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',
|
||||||
|
};
|
||||||
|
|
||||||
|
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 meterReadingTypeList({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: 'property-meterReadingType-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [MeterReadingTypeModal, modalApi] = useVbenModal({
|
||||||
|
connectedComponent: meterReadingTypeModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
modalApi.setData({});
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEdit(row: Required<MeterReadingTypeForm>) {
|
||||||
|
modalApi.setData({ id: row.id });
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(row: Required<MeterReadingTypeForm>) {
|
||||||
|
await meterReadingTypeRemove(row.id);
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMultiDelete() {
|
||||||
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<MeterReadingTypeForm>) => row.id);
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
okType: 'danger',
|
||||||
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||||
|
onOk: async () => {
|
||||||
|
await meterReadingTypeRemove(ids);
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Page :auto-content-height="true">
|
||||||
|
<BasicTable table-title="抄表类型列表">
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<a-button
|
||||||
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['property:meterReadingType:remove']"
|
||||||
|
@click="handleMultiDelete">
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['property:meterReadingType:add']"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.add') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['property:meterReadingType: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:meterReadingType:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<MeterReadingTypeModal @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 { meterReadingTypeAdd, meterReadingTypeInfo, meterReadingTypeUpdate } from '#/api/property/costManagement/meterReadingType';
|
||||||
|
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 meterReadingTypeInfo(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 ? meterReadingTypeUpdate(data) : meterReadingTypeAdd(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>
|
||||||
|
|
Reference in New Issue
Block a user