feat: 初始化车辆收费、水电抄表页面
This commit is contained in:
61
apps/web-antd/src/api/property/carCharge/index.ts
Normal file
61
apps/web-antd/src/api/property/carCharge/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { CarChargeVO, CarChargeForm, CarChargeQuery } 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 carChargeList(params?: CarChargeQuery) {
|
||||
return requestClient.get<PageResult<CarChargeVO>>('/property/carCharge/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出费用-车辆收费列表
|
||||
* @param params
|
||||
* @returns 费用-车辆收费列表
|
||||
*/
|
||||
export function carChargeExport(params?: CarChargeQuery) {
|
||||
return commonExport('/property/carCharge/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询费用-车辆收费详情
|
||||
* @param id id
|
||||
* @returns 费用-车辆收费详情
|
||||
*/
|
||||
export function carChargeInfo(id: ID) {
|
||||
return requestClient.get<CarChargeVO>(`/property/carCharge/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增费用-车辆收费
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function carChargeAdd(data: CarChargeForm) {
|
||||
return requestClient.postWithMsg<void>('/property/carCharge', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新费用-车辆收费
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function carChargeUpdate(data: CarChargeForm) {
|
||||
return requestClient.putWithMsg<void>('/property/carCharge', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除费用-车辆收费
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function carChargeRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/carCharge/${id}`);
|
||||
}
|
169
apps/web-antd/src/api/property/carCharge/model.d.ts
vendored
Normal file
169
apps/web-antd/src/api/property/carCharge/model.d.ts
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface CarChargeVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
carNumber: string;
|
||||
|
||||
/**
|
||||
* 业主
|
||||
*/
|
||||
personId: string | number;
|
||||
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
floorId: string | number;
|
||||
|
||||
/**
|
||||
* 车位
|
||||
*/
|
||||
location: string;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
state: string;
|
||||
|
||||
/**
|
||||
* 收费项目
|
||||
*/
|
||||
costItemsId: string | number;
|
||||
|
||||
/**
|
||||
* 计费开始时间
|
||||
*/
|
||||
starTime: string;
|
||||
|
||||
/**
|
||||
* 计费结束时间
|
||||
*/
|
||||
endTime: string;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue: string;
|
||||
|
||||
}
|
||||
|
||||
export interface CarChargeForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
carNumber?: string;
|
||||
|
||||
/**
|
||||
* 业主
|
||||
*/
|
||||
personId?: string | number;
|
||||
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
floorId?: string | number;
|
||||
|
||||
/**
|
||||
* 车位
|
||||
*/
|
||||
location?: string;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
state?: string;
|
||||
|
||||
/**
|
||||
* 收费项目
|
||||
*/
|
||||
costItemsId?: string | number;
|
||||
|
||||
/**
|
||||
* 计费开始时间
|
||||
*/
|
||||
starTime?: string;
|
||||
|
||||
/**
|
||||
* 计费结束时间
|
||||
*/
|
||||
endTime?: string;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface CarChargeQuery extends PageQuery {
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
carNumber?: string;
|
||||
|
||||
/**
|
||||
* 业主
|
||||
*/
|
||||
personId?: string | number;
|
||||
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
floorId?: string | number;
|
||||
|
||||
/**
|
||||
* 车位
|
||||
*/
|
||||
location?: string;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
state?: string;
|
||||
|
||||
/**
|
||||
* 收费项目
|
||||
*/
|
||||
costItemsId?: string | number;
|
||||
|
||||
/**
|
||||
* 计费开始时间
|
||||
*/
|
||||
starTime?: string;
|
||||
|
||||
/**
|
||||
* 计费结束时间
|
||||
*/
|
||||
endTime?: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
61
apps/web-antd/src/api/property/costMeterWater/index.ts
Normal file
61
apps/web-antd/src/api/property/costMeterWater/index.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { CostMeterWaterVO, CostMeterWaterForm, CostMeterWaterQuery } 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 costMeterWaterList(params?: CostMeterWaterQuery) {
|
||||
return requestClient.get<PageResult<CostMeterWaterVO>>('/property/costMeterWater/list', { params });
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出费用-水电抄列表
|
||||
* @param params
|
||||
* @returns 费用-水电抄列表
|
||||
*/
|
||||
export function costMeterWaterExport(params?: CostMeterWaterQuery) {
|
||||
return commonExport('/property/costMeterWater/export', params ?? {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询费用-水电抄详情
|
||||
* @param id id
|
||||
* @returns 费用-水电抄详情
|
||||
*/
|
||||
export function costMeterWaterInfo(id: ID) {
|
||||
return requestClient.get<CostMeterWaterVO>(`/property/costMeterWater/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增费用-水电抄
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function costMeterWaterAdd(data: CostMeterWaterForm) {
|
||||
return requestClient.postWithMsg<void>('/property/costMeterWater', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新费用-水电抄
|
||||
* @param data
|
||||
* @returns void
|
||||
*/
|
||||
export function costMeterWaterUpdate(data: CostMeterWaterForm) {
|
||||
return requestClient.putWithMsg<void>('/property/costMeterWater', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除费用-水电抄
|
||||
* @param id id
|
||||
* @returns void
|
||||
*/
|
||||
export function costMeterWaterRemove(id: ID | IDS) {
|
||||
return requestClient.deleteWithMsg<void>(`/property/costMeterWater/${id}`);
|
||||
}
|
157
apps/web-antd/src/api/property/costMeterWater/model.d.ts
vendored
Normal file
157
apps/web-antd/src/api/property/costMeterWater/model.d.ts
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
||||
|
||||
export interface CostMeterWaterVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 费用类型id
|
||||
*/
|
||||
itemId: string | number;
|
||||
|
||||
/**
|
||||
* 抄表类型id
|
||||
*/
|
||||
meterTypeId: string | number;
|
||||
|
||||
/**
|
||||
* 对象名称
|
||||
*/
|
||||
objName: string;
|
||||
|
||||
/**
|
||||
* 本期度数
|
||||
*/
|
||||
curDegrees: string;
|
||||
|
||||
/**
|
||||
* 上期度数
|
||||
*/
|
||||
preDegrees: string;
|
||||
|
||||
/**
|
||||
* 上期读表时间
|
||||
|
||||
*/
|
||||
preReadingTime: string;
|
||||
|
||||
/**
|
||||
* 本期读表时间
|
||||
*/
|
||||
curReadingTime: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue: string;
|
||||
|
||||
}
|
||||
|
||||
export interface CostMeterWaterForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 费用类型id
|
||||
*/
|
||||
itemId?: string | number;
|
||||
|
||||
/**
|
||||
* 抄表类型id
|
||||
*/
|
||||
meterTypeId?: string | number;
|
||||
|
||||
/**
|
||||
* 对象名称
|
||||
*/
|
||||
objName?: string;
|
||||
|
||||
/**
|
||||
* 本期度数
|
||||
*/
|
||||
curDegrees?: string;
|
||||
|
||||
/**
|
||||
* 上期度数
|
||||
*/
|
||||
preDegrees?: string;
|
||||
|
||||
/**
|
||||
* 上期读表时间
|
||||
|
||||
*/
|
||||
preReadingTime?: string;
|
||||
|
||||
/**
|
||||
* 本期读表时间
|
||||
*/
|
||||
curReadingTime?: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface CostMeterWaterQuery extends PageQuery {
|
||||
/**
|
||||
* 费用类型id
|
||||
*/
|
||||
itemId?: string | number;
|
||||
|
||||
/**
|
||||
* 抄表类型id
|
||||
*/
|
||||
meterTypeId?: string | number;
|
||||
|
||||
/**
|
||||
* 对象名称
|
||||
*/
|
||||
objName?: string;
|
||||
|
||||
/**
|
||||
* 本期度数
|
||||
*/
|
||||
curDegrees?: string;
|
||||
|
||||
/**
|
||||
* 上期度数
|
||||
*/
|
||||
preDegrees?: string;
|
||||
|
||||
/**
|
||||
* 上期读表时间
|
||||
|
||||
*/
|
||||
preReadingTime?: string;
|
||||
|
||||
/**
|
||||
* 本期读表时间
|
||||
*/
|
||||
curReadingTime?: string;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
@@ -0,0 +1,91 @@
|
||||
<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 { carChargeAdd, carChargeInfo, carChargeUpdate } from '#/api/property/carCharge';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { addModalSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-2',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 140,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
schema: addModalSchema(),
|
||||
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 };
|
||||
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 carChargeAdd(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="创建收费">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</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 { carChargeAdd, carChargeInfo, carChargeUpdate } from '#/api/property/carCharge';
|
||||
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 carChargeInfo(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 ? carChargeUpdate(data) : carChargeAdd(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,89 @@
|
||||
<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 { carChargeAdd, carChargeInfo, carChargeUpdate } from '#/api/property/carCharge';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { payModalSchema } from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 1400,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
schema: payModalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[70%]',
|
||||
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 };
|
||||
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 carChargeAdd(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="缴费">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
@@ -0,0 +1,350 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { renderDict } from '#/utils/render';
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'carNumber',
|
||||
label: '车牌号',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'personId',
|
||||
label: '业主',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.WY_CSZT 便于维护
|
||||
options: getDictOptions('wy_cszt'),
|
||||
},
|
||||
fieldName: 'state',
|
||||
label: '状态',
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
slots: {
|
||||
default: ({ rowIndex }) => {
|
||||
return (rowIndex + 1).toString();
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '车牌号',
|
||||
field: 'carNumber',
|
||||
},
|
||||
{
|
||||
title: '车位',
|
||||
field: 'location',
|
||||
},
|
||||
{
|
||||
title: '业主',
|
||||
field: 'personId',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
field: 'state',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
// 可选从DictEnum中获取 DictEnum.WY_CSZT 便于维护
|
||||
return renderDict(row.state, 'wy_cszt');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '收费项目',
|
||||
field: 'costItemsId',
|
||||
},
|
||||
{
|
||||
title: '计费开始时间',
|
||||
field: 'starTime',
|
||||
},
|
||||
{
|
||||
title: '计费结束时间',
|
||||
field: 'endTime',
|
||||
},
|
||||
{
|
||||
title: '说明',
|
||||
field: 'remark',
|
||||
},
|
||||
{
|
||||
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: 'carNumber',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '业主',
|
||||
fieldName: 'personId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '楼层',
|
||||
fieldName: 'floorId',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '车位',
|
||||
fieldName: 'location',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
fieldName: 'state',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
// 可选从DictEnum中获取 DictEnum.WY_CSZT 便于维护
|
||||
options: getDictOptions('wy_cszt'),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '收费项目',
|
||||
fieldName: 'costItemsId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '计费开始时间',
|
||||
fieldName: 'starTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '计费结束时间',
|
||||
fieldName: 'endTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '说明',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '搜索值',
|
||||
fieldName: 'searchValue',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
//创建
|
||||
export const addModalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '车牌号',
|
||||
fieldName: 'carNumber',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
// {
|
||||
// label: '费用类型',//一个费用下有对各费用项目
|
||||
// fieldName: 'personId',
|
||||
// component: 'Input',
|
||||
// },
|
||||
{
|
||||
label: '收费项目',//一个费用收费项目对应一个费用类型
|
||||
fieldName: 'costItemsId',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '计费开始时间',
|
||||
fieldName: 'starTime',
|
||||
component: 'DatePicker',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '计费结束时间',
|
||||
fieldName: 'endTime',
|
||||
component: 'DatePicker',
|
||||
rules:'required',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '说明',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
//缴费
|
||||
export const payModalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '车牌号',
|
||||
fieldName: 'carNumber',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
// {
|
||||
// label: '费用类型',//一个费用下有对各费用项目
|
||||
// fieldName: 'personId',
|
||||
// component: 'Input',
|
||||
// },
|
||||
{
|
||||
label: '收费项目',//一个费用收费项目对应一个费用类型
|
||||
fieldName: 'costItemsId',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '计费开始时间',
|
||||
fieldName: 'starTime',
|
||||
component: 'DatePicker',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '计费结束时间',
|
||||
fieldName: 'endTime',
|
||||
component: 'DatePicker',
|
||||
rules:'required',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '说明',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '支付方式',
|
||||
fieldName: 'carNumber',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '缴费周期',
|
||||
fieldName: 'personId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '实收金额',
|
||||
fieldName: 'costItemsId',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '自定义周期',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
export const detailColumns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '序号',
|
||||
field: 'id',
|
||||
slots: {
|
||||
default: ({ rowIndex }) => {
|
||||
return (rowIndex + 1).toString();
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '费用项目',
|
||||
field: 'carNumber',
|
||||
},
|
||||
{
|
||||
title: '费用标识',
|
||||
field: 'location',
|
||||
},
|
||||
{
|
||||
title: '应收金额',
|
||||
field: 'personId',
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
field: 'state',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
// 可选从DictEnum中获取 DictEnum.WY_CSZT 便于维护
|
||||
return renderDict(row.state, 'wy_cszt');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '建帐时间',
|
||||
field: 'starTime',
|
||||
},
|
||||
{
|
||||
title: '应收时间',
|
||||
field: 'endTime',
|
||||
},
|
||||
{
|
||||
title: '说明',
|
||||
field: 'remark',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
@@ -0,0 +1,173 @@
|
||||
<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 {
|
||||
carChargeExport,
|
||||
carChargeList,
|
||||
carChargeRemove,
|
||||
} from '#/api/property/carCharge';
|
||||
import type { CarChargeForm } from '#/api/property/carCharge/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import carChargeDetailModal from './carCharge-detail-modal.vue';// 详情弹窗
|
||||
import carChargePayModal from './carCharge-pay-modal.vue';//缴费弹窗
|
||||
import carCharfeAddModal from './carCharge-add-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 carChargeList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-carCharge-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
// 详情弹窗
|
||||
const [CarChargeDetailModal, modalApi] = useVbenModal({
|
||||
connectedComponent: carChargeDetailModal,
|
||||
});
|
||||
// 创建费用弹窗
|
||||
const [CarCharfeAddModal, addModalApi] = useVbenModal({
|
||||
connectedComponent: carCharfeAddModal,
|
||||
});
|
||||
// 缴费弹窗
|
||||
const [CarChargePayModal, payModalApi] = useVbenModal({
|
||||
connectedComponent: carChargePayModal,
|
||||
});
|
||||
//打开创建费用弹窗
|
||||
function handleAdd() {
|
||||
addModalApi.setData({});
|
||||
addModalApi.open();
|
||||
}
|
||||
|
||||
//打开详情
|
||||
async function handleEdit(row: Required<CarChargeForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
//打开缴费
|
||||
async function handleSave(row: Required<CarChargeForm>) {
|
||||
payModalApi.setData({ id: row.id });
|
||||
payModalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<CarChargeForm>) {
|
||||
await carChargeRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="费用-车辆收费列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:carCharge:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
创建费用
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:carCharge:edit']"
|
||||
@click.stop="handleSave(row)"
|
||||
>
|
||||
缴费
|
||||
</ghost-button>
|
||||
<Popconfirm
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认删除?"
|
||||
@confirm="handleDelete(row)"
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['property:carCharge:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
<ghost-button
|
||||
v-access:code="['property:carCharge:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
详情
|
||||
</ghost-button>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<!-- 详情弹窗 -->
|
||||
<CarChargeDetailModal @reload="tableApi.query()" />
|
||||
<CarCharfeAddModal @reload="tableApi.query()" />
|
||||
<CarChargePayModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
@@ -16,14 +16,14 @@ import {
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
costItemSettingExport,
|
||||
costItemSettingList,
|
||||
costItemSettingRemove,
|
||||
} from '#/api/property/costItemSetting';
|
||||
import type { CostItemSettingForm } from '#/api/property/costItemSetting/model';
|
||||
carChargeExport,
|
||||
carChargeList,
|
||||
carChargeRemove,
|
||||
} from '#/api/property/carCharge';
|
||||
import type { CarChargeForm } from '#/api/property/carCharge/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import costItemSettingModal from './costItemSetting-modal.vue';
|
||||
import carChargeModal from './carCharge-modal.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
@@ -64,7 +64,7 @@ const gridOptions: VxeGridProps = {
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await costItemSettingList({
|
||||
return await carChargeList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
@@ -76,7 +76,7 @@ const gridOptions: VxeGridProps = {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-costItemSetting-index'
|
||||
id: 'property-carCharge-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
@@ -84,8 +84,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [CostItemSettingModal, modalApi] = useVbenModal({
|
||||
connectedComponent: costItemSettingModal,
|
||||
const [CarChargeModal, modalApi] = useVbenModal({
|
||||
connectedComponent: carChargeModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
@@ -93,32 +93,32 @@ function handleAdd() {
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<CostItemSettingForm>) {
|
||||
async function handleEdit(row: Required<CarChargeForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<CostItemSettingForm>) {
|
||||
await costItemSettingRemove(row.id);
|
||||
async function handleDelete(row: Required<CarChargeForm>) {
|
||||
await carChargeRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<CostItemSettingForm>) => row.id);
|
||||
const ids = rows.map((row: Required<CarChargeForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await costItemSettingRemove(ids);
|
||||
await carChargeRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(costItemSettingExport, '费用项设置数据', tableApi.formApi.form.values, {
|
||||
commonDownloadExcel(carChargeExport, '费用-车辆收费数据', tableApi.formApi.form.values, {
|
||||
fieldMappingTime: formOptions.fieldMappingTime,
|
||||
});
|
||||
}
|
||||
@@ -126,11 +126,11 @@ function handleDownloadExcel() {
|
||||
|
||||
<template>
|
||||
<Page :auto-content-height="true">
|
||||
<BasicTable table-title="费用项设置列表">
|
||||
<BasicTable table-title="费用-车辆收费列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
v-access:code="['property:costItemSetting:export']"
|
||||
v-access:code="['property:carCharge:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
@@ -139,13 +139,13 @@ function handleDownloadExcel() {
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:costItemSetting:remove']"
|
||||
v-access:code="['property:carCharge:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:costItemSetting:add']"
|
||||
v-access:code="['property:carCharge:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
@@ -155,7 +155,7 @@ function handleDownloadExcel() {
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:costItemSetting:edit']"
|
||||
v-access:code="['property:carCharge:edit']"
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ $t('pages.common.edit') }}
|
||||
@@ -168,7 +168,7 @@ function handleDownloadExcel() {
|
||||
>
|
||||
<ghost-button
|
||||
danger
|
||||
v-access:code="['property:costItemSetting:remove']"
|
||||
v-access:code="['property:carCharge:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
@@ -177,6 +177,6 @@ function handleDownloadExcel() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<CostItemSettingModal @reload="tableApi.query()" />
|
||||
<CarChargeModal @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 { costMeterWaterAdd, costMeterWaterInfo, costMeterWaterUpdate } from '#/api/property/costMeterWater';
|
||||
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 costMeterWaterInfo(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 ? costMeterWaterUpdate(data) : costMeterWaterAdd(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,183 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'itemId',
|
||||
label: '费用类型id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'meterTypeId',
|
||||
label: '抄表类型id',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'objName',
|
||||
label: '对象名称',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'curDegrees',
|
||||
label: '本期度数',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'preDegrees',
|
||||
label: '上期度数',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'preReadingTime',
|
||||
label: '上期读表时间',
|
||||
},
|
||||
{
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
fieldName: 'curReadingTime',
|
||||
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: '费用类型id',
|
||||
field: 'itemId',
|
||||
},
|
||||
{
|
||||
title: '抄表类型id',
|
||||
field: 'meterTypeId',
|
||||
},
|
||||
{
|
||||
title: '对象名称',
|
||||
field: 'objName',
|
||||
},
|
||||
{
|
||||
title: '本期度数',
|
||||
field: 'curDegrees',
|
||||
},
|
||||
{
|
||||
title: '上期度数',
|
||||
field: 'preDegrees',
|
||||
},
|
||||
{
|
||||
title: '上期读表时间',
|
||||
field: 'preReadingTime',
|
||||
},
|
||||
{
|
||||
title: '本期读表时间',
|
||||
field: 'curReadingTime',
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
},
|
||||
{
|
||||
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: '费用类型id',
|
||||
fieldName: 'itemId',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '抄表类型id',
|
||||
fieldName: 'meterTypeId',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '对象名称',
|
||||
fieldName: 'objName',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '本期度数',
|
||||
fieldName: 'curDegrees',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '上期度数',
|
||||
fieldName: 'preDegrees',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '上期读表时间',
|
||||
fieldName: 'preReadingTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '本期读表时间',
|
||||
fieldName: 'curReadingTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
fieldName: 'remark',
|
||||
component: 'Textarea',
|
||||
},
|
||||
{
|
||||
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 {
|
||||
costMeterWaterExport,
|
||||
costMeterWaterList,
|
||||
costMeterWaterRemove,
|
||||
} from '#/api/property/costMeterWater';
|
||||
import type { CostMeterWaterForm } from '#/api/property/costMeterWater/model';
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import costMeterWaterModal from './costMeterWater-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 costMeterWaterList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-costMeterWater-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [CostMeterWaterModal, modalApi] = useVbenModal({
|
||||
connectedComponent: costMeterWaterModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
modalApi.setData({});
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<CostMeterWaterForm>) {
|
||||
modalApi.setData({ id: row.id });
|
||||
modalApi.open();
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<CostMeterWaterForm>) {
|
||||
await costMeterWaterRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
const rows = tableApi.grid.getCheckboxRecords();
|
||||
const ids = rows.map((row: Required<CostMeterWaterForm>) => row.id);
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
okType: 'danger',
|
||||
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||
onOk: async () => {
|
||||
await costMeterWaterRemove(ids);
|
||||
await tableApi.query();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function handleDownloadExcel() {
|
||||
commonDownloadExcel(costMeterWaterExport, '费用-水电抄数据', 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:costMeterWater:export']"
|
||||
@click="handleDownloadExcel"
|
||||
>
|
||||
{{ $t('pages.common.export') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:costMeterWater:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:costMeterWater:add']"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
v-access:code="['property:costMeterWater: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:costMeterWater:remove']"
|
||||
@click.stop=""
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<CostMeterWaterModal @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
@@ -25,35 +25,34 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '设备名称',
|
||||
field: 'machineId',
|
||||
},
|
||||
{
|
||||
title: '设备编号',
|
||||
field: 'machineId',
|
||||
},
|
||||
// {
|
||||
// title: '设备名称',
|
||||
// field: 'machineId',
|
||||
// },
|
||||
// {
|
||||
// title: '设备编号',
|
||||
// field: 'machineId',
|
||||
// },
|
||||
{
|
||||
title: '位置编号',
|
||||
field: 'machineId',
|
||||
},
|
||||
{
|
||||
title: '计划名称',
|
||||
field: 'machineId',
|
||||
},
|
||||
{
|
||||
title: '计划保养人',
|
||||
field: 'machineId',
|
||||
},
|
||||
{
|
||||
title: '计划保养时间',
|
||||
field: 'machineId',
|
||||
},
|
||||
{
|
||||
title: '实际保养时间',
|
||||
field: 'machineId',
|
||||
},
|
||||
|
||||
// {
|
||||
// title: '计划名称',
|
||||
// field: 'machineId',
|
||||
// },
|
||||
// {
|
||||
// title: '计划保养人',
|
||||
// field: 'machineId',
|
||||
// },
|
||||
// {
|
||||
// title: '计划保养时间',
|
||||
// field: 'machineId',
|
||||
// },
|
||||
// {
|
||||
// title: '实际保养时间',
|
||||
// field: 'machineId',
|
||||
// },
|
||||
{
|
||||
title: '保养情况',
|
||||
field: 'sendFlag',
|
||||
|
Reference in New Issue
Block a user