Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,61 @@
|
|||||||
|
import type { CostItemSettingVO, CostItemSettingForm, CostItemSettingQuery } 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 costItemSettingList(params?: CostItemSettingQuery) {
|
||||||
|
return requestClient.get<PageResult<CostItemSettingVO>>('/property/costItemSetting/list', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出费用项设置列表
|
||||||
|
* @param params
|
||||||
|
* @returns 费用项设置列表
|
||||||
|
*/
|
||||||
|
export function costItemSettingExport(params?: CostItemSettingQuery) {
|
||||||
|
return commonExport('/property/costItemSetting/export', params ?? {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询费用项设置详情
|
||||||
|
* @param id id
|
||||||
|
* @returns 费用项设置详情
|
||||||
|
*/
|
||||||
|
export function costItemSettingInfo(id: ID) {
|
||||||
|
return requestClient.get<CostItemSettingVO>(`/property/costItemSetting/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增费用项设置
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function costItemSettingAdd(data: CostItemSettingForm) {
|
||||||
|
return requestClient.postWithMsg<void>('/property/costItemSetting', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新费用项设置
|
||||||
|
* @param data
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function costItemSettingUpdate(data: CostItemSettingForm) {
|
||||||
|
return requestClient.putWithMsg<void>('/property/costItemSetting', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除费用项设置
|
||||||
|
* @param id id
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
export function costItemSettingRemove(id: ID | IDS) {
|
||||||
|
return requestClient.deleteWithMsg<void>(`/property/costItemSetting/${id}`);
|
||||||
|
}
|
219
apps/web-antd/src/api/property/costManagement/costItemSetting/model.d.ts
vendored
Normal file
219
apps/web-antd/src/api/property/costManagement/costItemSetting/model.d.ts
vendored
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||||
|
|
||||||
|
export interface CostItemSettingVO {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
id: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用类型
|
||||||
|
*/
|
||||||
|
costType: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收费项目
|
||||||
|
*/
|
||||||
|
chargeItem: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用标识
|
||||||
|
*/
|
||||||
|
costMark: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付费类型
|
||||||
|
*/
|
||||||
|
paymentType: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缴费周期(月)
|
||||||
|
*/
|
||||||
|
chargeCycle: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否手机缴费
|
||||||
|
*/
|
||||||
|
isMobilePay: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进位方式
|
||||||
|
*/
|
||||||
|
roundingMode: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保留小数
|
||||||
|
*/
|
||||||
|
currencyDecimals: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用状态
|
||||||
|
*/
|
||||||
|
state: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算公式
|
||||||
|
*/
|
||||||
|
formula: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计费单价
|
||||||
|
*/
|
||||||
|
unitPrice: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附加费
|
||||||
|
*/
|
||||||
|
surcharge: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索值
|
||||||
|
*/
|
||||||
|
searchValue: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CostItemSettingForm extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
id?: string | number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用类型
|
||||||
|
*/
|
||||||
|
costType?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收费项目
|
||||||
|
*/
|
||||||
|
chargeItem?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用标识
|
||||||
|
*/
|
||||||
|
costMark?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付费类型
|
||||||
|
*/
|
||||||
|
paymentType?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缴费周期(月)
|
||||||
|
*/
|
||||||
|
chargeCycle?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否手机缴费
|
||||||
|
*/
|
||||||
|
isMobilePay?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进位方式
|
||||||
|
*/
|
||||||
|
roundingMode?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保留小数
|
||||||
|
*/
|
||||||
|
currencyDecimals?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用状态
|
||||||
|
*/
|
||||||
|
state?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算公式
|
||||||
|
*/
|
||||||
|
formula?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计费单价
|
||||||
|
*/
|
||||||
|
unitPrice?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附加费
|
||||||
|
*/
|
||||||
|
surcharge?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索值
|
||||||
|
*/
|
||||||
|
searchValue?: string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CostItemSettingQuery extends PageQuery {
|
||||||
|
/**
|
||||||
|
* 费用类型
|
||||||
|
*/
|
||||||
|
costType?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收费项目
|
||||||
|
*/
|
||||||
|
chargeItem?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 费用标识
|
||||||
|
*/
|
||||||
|
costMark?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付费类型
|
||||||
|
*/
|
||||||
|
paymentType?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缴费周期(月)
|
||||||
|
*/
|
||||||
|
chargeCycle?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否手机缴费
|
||||||
|
*/
|
||||||
|
isMobilePay?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进位方式
|
||||||
|
*/
|
||||||
|
roundingMode?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保留小数
|
||||||
|
*/
|
||||||
|
currencyDecimals?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用状态
|
||||||
|
*/
|
||||||
|
state?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算公式
|
||||||
|
*/
|
||||||
|
formula?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计费单价
|
||||||
|
*/
|
||||||
|
unitPrice?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附加费
|
||||||
|
*/
|
||||||
|
surcharge?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索值
|
||||||
|
*/
|
||||||
|
searchValue?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期范围参数
|
||||||
|
*/
|
||||||
|
params?: any;
|
||||||
|
}
|
@@ -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 { costItemSettingAdd, costItemSettingInfo, costItemSettingUpdate } from '#/api/property/costItemSetting';
|
||||||
|
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 costItemSettingInfo(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 ? costItemSettingUpdate(data) : costItemSettingAdd(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>
|
||||||
|
|
@@ -0,0 +1,241 @@
|
|||||||
|
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.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
options: getDictOptions('pro_expense_type'),
|
||||||
|
},
|
||||||
|
fieldName: 'costType',
|
||||||
|
label: '费用类型',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'chargeItem',
|
||||||
|
label: '收费项目',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'costMark',
|
||||||
|
label: '费用标识',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
fieldName: 'paymentType',
|
||||||
|
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形式 否则切换语言不会刷新
|
||||||
|
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
{
|
||||||
|
title: '主键',
|
||||||
|
field: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '费用类型',
|
||||||
|
field: 'costType',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }) => {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
return renderDict(row.costType, 'pro_expense_type');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '收费项目',
|
||||||
|
field: 'chargeItem',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '费用标识',
|
||||||
|
field: 'costMark',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '付费类型',
|
||||||
|
field: 'paymentType',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '缴费周期',
|
||||||
|
field: 'chargeCycle',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否手机缴费',
|
||||||
|
field: 'isMobilePay',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '进位方式',
|
||||||
|
field: 'roundingMode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '保留小数',
|
||||||
|
field: 'currencyDecimals',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '启用状态',
|
||||||
|
field: 'state',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计算公式',
|
||||||
|
field: 'formula',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '计费单价',
|
||||||
|
field: 'unitPrice',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '附加费',
|
||||||
|
field: 'surcharge',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '搜索值',
|
||||||
|
field: 'searchValue',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: 'costType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
// 可选从DictEnum中获取 DictEnum.PRO_EXPENSE_TYPE 便于维护
|
||||||
|
options: getDictOptions('pro_expense_type'),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '收费项目',
|
||||||
|
fieldName: 'chargeItem',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '费用标识',
|
||||||
|
fieldName: 'costMark',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '付费类型',
|
||||||
|
fieldName: 'paymentType',
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '缴费周期',
|
||||||
|
fieldName: 'chargeCycle',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '是否手机缴费',
|
||||||
|
fieldName: 'isMobilePay',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '进位方式',
|
||||||
|
fieldName: 'roundingMode',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '保留小数',
|
||||||
|
fieldName: 'currencyDecimals',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '启用状态',
|
||||||
|
fieldName: 'state',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '计算公式',
|
||||||
|
fieldName: 'formula',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '计费单价',
|
||||||
|
fieldName: 'unitPrice',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '附加费',
|
||||||
|
fieldName: 'surcharge',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '搜索值',
|
||||||
|
fieldName: 'searchValue',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
];
|
@@ -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 {
|
||||||
|
costItemSettingExport,
|
||||||
|
costItemSettingList,
|
||||||
|
costItemSettingRemove,
|
||||||
|
} from '#/api/property/costItemSetting';
|
||||||
|
import type { CostItemSettingForm } from '#/api/property/costItemSetting/model';
|
||||||
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
|
import costItemSettingModal from './costItemSetting-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 costItemSettingList({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
|
id: 'property-costItemSetting-index'
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [CostItemSettingModal, modalApi] = useVbenModal({
|
||||||
|
connectedComponent: costItemSettingModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
modalApi.setData({});
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleEdit(row: Required<CostItemSettingForm>) {
|
||||||
|
modalApi.setData({ id: row.id });
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleDelete(row: Required<CostItemSettingForm>) {
|
||||||
|
await costItemSettingRemove(row.id);
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMultiDelete() {
|
||||||
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<CostItemSettingForm>) => row.id);
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
okType: 'danger',
|
||||||
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||||
|
onOk: async () => {
|
||||||
|
await costItemSettingRemove(ids);
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(costItemSettingExport, '费用项设置数据', 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:costItemSetting:export']"
|
||||||
|
@click="handleDownloadExcel"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.export') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['property:costItemSetting:remove']"
|
||||||
|
@click="handleMultiDelete">
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</a-button>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['property:costItemSetting:add']"
|
||||||
|
@click="handleAdd"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.add') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['property:costItemSetting: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:costItemSetting:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<CostItemSettingModal @reload="tableApi.query()" />
|
||||||
|
</Page>
|
||||||
|
</template>
|
@@ -42,10 +42,6 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '位置对象',
|
|
||||||
field: 'locationObject',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: '备注',
|
title: '备注',
|
||||||
field: 'remark',
|
field: 'remark',
|
||||||
|
@@ -105,9 +105,11 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
isUpdate.value = !!id;
|
isUpdate.value = !!id;
|
||||||
if (isUpdate.value && id) {
|
if (isUpdate.value && id) {
|
||||||
const record = await deviceLocationInfo(id);
|
const record = await deviceLocationInfo(id);
|
||||||
|
await setupCommunitySelect(record.locationType);
|
||||||
record.locationType = record.locationType?.toString();
|
record.locationType = record.locationType?.toString();
|
||||||
await formApi.setValues(record);
|
await formApi.setValues(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
await markInitialized();
|
await markInitialized();
|
||||||
modalApi.modalLoading(false);
|
modalApi.modalLoading(false);
|
||||||
},
|
},
|
||||||
|
@@ -194,28 +194,10 @@ function handleDownloadExcel() {
|
|||||||
</div>
|
</div>
|
||||||
<!-- 详情展示 -->
|
<!-- 详情展示 -->
|
||||||
<a-card v-if="detailData" :title="detailData.machineTypeName">
|
<a-card v-if="detailData" :title="detailData.machineTypeName">
|
||||||
<a-descriptions
|
<p><b>类型名称:</b>{{ detailData.machineTypeName }}</p>
|
||||||
bordered
|
<p><b>类型编号:</b>{{ detailData.machineTypeCode }}</p>
|
||||||
:column="2"
|
<p><b>是否启用:</b>{{ detailData.isEnable == '1' ? '启用' : '禁用' }}</p>
|
||||||
size="middle"
|
<p><b>备注:</b>{{ detailData.remark || '-' }}</p>
|
||||||
title="设备类型详情"
|
|
||||||
class="mb-2"
|
|
||||||
>
|
|
||||||
<a-descriptions-item label="类型名称">
|
|
||||||
{{ detailData.machineTypeName }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item label="类型编号">
|
|
||||||
{{ detailData.machineTypeCode }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item label="是否启用">
|
|
||||||
<a-tag :color="detailData.isEnable == '1' ? 'green' : 'red'">
|
|
||||||
{{ detailData.isEnable == '1' ? '启用' : '禁用' }}
|
|
||||||
</a-tag>
|
|
||||||
</a-descriptions-item>
|
|
||||||
<a-descriptions-item label="备注">
|
|
||||||
{{ detailData.remark || '-' }}
|
|
||||||
</a-descriptions-item>
|
|
||||||
</a-descriptions>
|
|
||||||
</a-card>
|
</a-card>
|
||||||
<a-empty v-else description="暂无详情" />
|
<a-empty v-else description="暂无详情" />
|
||||||
<MachineTypeModal @reload="() => { reloadTree(); loadDetail(); }" />
|
<MachineTypeModal @reload="() => { reloadTree(); loadDetail(); }" />
|
||||||
|
Reference in New Issue
Block a user