2 Commits

Author SHA1 Message Date
fyy
65b9e5cb6a 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
2025-07-22 14:28:00 +08:00
fyy
49cbf6ffe5 feat: 完成车辆收费、水电抄表 2025-07-22 14:21:19 +08:00
4 changed files with 107 additions and 39 deletions

View File

@@ -62,5 +62,5 @@ export function costMeterWaterRemove(id: ID | IDS) {
// 根据业主id查询 // 根据业主id查询
export function ultimoWater(id: ID | IDS) { export function ultimoWater(id: ID | IDS) {
return requestClient.deleteWithMsg<void>(`/property/ultimoWater/${id}`); return requestClient.get<any>(`/property/meterWater/ultimoWater/${id}`);
} }

View File

@@ -51,6 +51,8 @@ export interface CostMeterWaterVO {
* 搜索值 * 搜索值
*/ */
searchValue: string; searchValue: string;
costType:string;
userId:string;
} }

View File

@@ -7,11 +7,11 @@ import { costMeterWaterAdd, costMeterWaterInfo, costMeterWaterUpdate } from '#/a
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'; import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils'; import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils';
import { communityTree } from '#/api/property/community'; import { communityTree } from '#/api/property/community';
import { watch } from 'vue';
import { costItemSettingList} from '#/api/property/costManagement/costItemSetting'; import { costItemSettingList} from '#/api/property/costManagement/costItemSetting';
import { meterReadingTypeList } from '#/api/property/costManagement/meterReadingType'; import { meterReadingTypeList } from '#/api/property/costManagement/meterReadingType';
import { getDictOptions } from '#/utils/dict'; import { getDictOptions } from '#/utils/dict';
import {ultimoWater} from '#/api/property/costMeterWater' import {ultimoWater} from '#/api/property/costMeterWater'
import {personList} from '#/api/property/resident/person'
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
const costItemsOptions = ref<any>([]); const costItemsOptions = ref<any>([]);
const meterTypeOptions = ref<any>([]); const meterTypeOptions = ref<any>([]);
@@ -21,11 +21,35 @@ const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
}); });
const schema =[ const schema =[
{ {
label: '抄表地址', label: '主键ID',
fieldName: 'location', fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '房间号',
fieldName: 'roomId',
component: 'TreeSelect', component: 'TreeSelect',
rules: 'required'
},
{
label: '业主',
fieldName: 'userId',
component: 'ApiSelect',
rules: 'required', rules: 'required',
componentProps: {
api: async () => {
const res = await personList({pageSize:1000000000,pageNum:1});
return res.rows.map((item: any) => ({
label: item.userName,
value: item.id,
}));
},
}
}, },
{ {
label: '费用类型', label: '费用类型',
@@ -34,12 +58,7 @@ const schema =[
rules: 'required', rules: 'required',
componentProps: { componentProps: {
options: getDictOptions('wy_cbfylx'), options: getDictOptions('wy_cbfylx'),
onChange: async (value:any) => { onChange: async (value:any) => {
// 清空依赖字段
await formApi.setValues({
costItemsId: '',
meterTypeId: '',
});
// 请求并更新下拉 // 请求并更新下拉
if (!value) { if (!value) {
costItemsOptions.value = []; costItemsOptions.value = [];
@@ -61,7 +80,7 @@ const schema =[
// 更新表单下拉 // 更新表单下拉
formApi.updateSchema([ formApi.updateSchema([
{ {
fieldName: 'costItemsId', fieldName: 'itemId',
componentProps: { componentProps: {
options: costItemsOptions.value, options: costItemsOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
@@ -75,12 +94,18 @@ const schema =[
}, },
}, },
]); ]);
// 清空依赖字段
await formApi.setValues({
itemId: '',
meterTypeId: '',
});
console.log(await formApi.getValues());
} }
} }
}, },
{ {
label: '收费项目', label: '收费项目',
fieldName: 'costItemsId', fieldName: 'itemId',
component: 'Select', component: 'Select',
rules: 'required', rules: 'required',
componentProps: { componentProps: {
@@ -99,10 +124,9 @@ const schema =[
} }
}, },
{ {
label: '上止度', label: '上止度',
fieldName: 'preDegrees', fieldName: 'preDegrees',
component: 'Input', component: 'Input',
rules: 'required',
disabled: true, disabled: true,
}, },
{ {
@@ -120,9 +144,7 @@ const schema =[
format: 'YYYY-MM-DD HH:mm:ss', format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss', valueFormat: 'YYYY-MM-DD HH:mm:ss',
}, },
rules: 'required',
disabled:true disabled:true
}, },
{ {
label: '本期读表时间', label: '本期读表时间',
@@ -175,16 +197,44 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) { if (!isOpen) {
return null; return null;
} }
isMeterType.value = false isMeterType.value = true
setupCommunitySelect() setupCommunitySelect()
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await costMeterWaterInfo(id); const record = await costMeterWaterInfo(id);
console.log(1,record);
const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: record.costType });
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({
label: item.chargeItem,
value: item.id,
}));
const meterTypeRes = await meterReadingTypeList({ pageSize: 1000000000, pageNum: 1, costType: record.costType == '5' ? 0 : 1 });
meterTypeOptions.value = (meterTypeRes?.rows || []).map(item => ({
label: item.name,
value: item.id,
}));
formApi.updateSchema([
{
fieldName: 'itemId',
componentProps: {
options: costItemsOptions.value,
disabled: !isMeterType.value,
},
},
{
fieldName: 'meterTypeId',
componentProps: {
options: meterTypeOptions.value,
disabled: !isMeterType.value,
},
},
]);
await formApi.setValues(record); await formApi.setValues(record);
console.log(2,await formApi.getValues());
} }
await markInitialized(); await markInitialized();
@@ -201,6 +251,8 @@ async function handleConfirm() {
} }
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次 // getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
console.log(data);
await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data)); await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data));
resetInitialized(); resetInitialized();
//必须要手动清空不然ref会保留值 //必须要手动清空不然ref会保留值
@@ -210,7 +262,7 @@ async function handleConfirm() {
// 更新表单下拉 // 更新表单下拉
formApi.updateSchema([ formApi.updateSchema([
{ {
fieldName: 'costItemsId', fieldName: 'itemId',
componentProps: { componentProps: {
options: costItemsOptions.value, options: costItemsOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
@@ -242,7 +294,7 @@ async function handleClosed() {
// 更新表单下拉 // 更新表单下拉
formApi.updateSchema([ formApi.updateSchema([
{ {
fieldName: 'costItemsId', fieldName: 'itemId',
componentProps: { componentProps: {
options: costItemsOptions.value, options: costItemsOptions.value,
disabled: !isMeterType.value, disabled: !isMeterType.value,
@@ -289,8 +341,20 @@ async function setupCommunitySelect() {
treeNodeFilterProp: 'label', treeNodeFilterProp: 'label',
// 选中后显示在输入框的值 // 选中后显示在输入框的值
treeNodeLabelProp: 'fullName', treeNodeLabelProp: 'fullName',
onChange: async (value: any) => {
if(!value){
await formApi.setValues({preDegrees:''})
await formApi.setValues({preReadingTime:''})
}else{
const data = await ultimoWater(value)
if(data){
await formApi.setValues({preDegrees:data.curDegrees})
await formApi.setValues({preReadingTime:data.curReadingTime})
}
}
},
}), }),
fieldName: 'location', fieldName: 'roomId',
}, },
]); ]);
} }
@@ -305,7 +369,9 @@ async function setupCommunitySelect() {
/* 使用 :deep() 穿透 scoped 样式,影响子组件 */ /* 使用 :deep() 穿透 scoped 样式,影响子组件 */
:deep(.ant-input[disabled]), :deep(.ant-input[disabled]),
:deep(.ant-input-number-disabled .ant-input-number-input), :deep(.ant-input-number-disabled .ant-input-number-input),
:deep(.ant-select-disabled .ant-select-selection-item) { :deep(.ant-select-disabled .ant-select-selection-item),
:deep(.ant-picker-input input[disabled]),
:deep(.ant-picker-disabled .ant-picker-input input) {
/* 设置一个更深的颜色,可以自己调整 */ /* 设置一个更深的颜色,可以自己调整 */
color: rgba(0, 0, 0, 0.65) !important; color: rgba(0, 0, 0, 0.65) !important;
/* 有些浏览器需要这个来覆盖默认颜色 */ /* 有些浏览器需要这个来覆盖默认颜色 */

View File

@@ -152,18 +152,18 @@ const handleAccountLogin = async () => {
</div> </div>
</div> </div>
</div> </div>
<div <!-- <div
:class="[isDark ? 'dark' : '']" :class="[isDark ? 'dark' : '']"
class="flex min-h-full flex-1 select-none overflow-x-hidden" class="flex min-h-full flex-1 select-none overflow-x-hidden"
style="display: none;" style="display: none;"
> > -->
<template v-if="toolbar"> <!--<template v-if="toolbar">
<slot name="toolbar"> <slot name="toolbar">
<Toolbar :toolbar-list="toolbarList" /> <Toolbar :toolbar-list="toolbarList" />
</slot> </slot>
</template> </template>-->
<!-- 左侧认证面板 --> <!-- 左侧认证面板 -->
<AuthenticationFormView <!--<AuthenticationFormView
v-if="authPanelLeft" v-if="authPanelLeft"
class="min-h-full w-2/5 flex-1" class="min-h-full w-2/5 flex-1"
transition-name="slide-left" transition-name="slide-left"
@@ -176,10 +176,10 @@ const handleAccountLogin = async () => {
/> />
</slot> </slot>
</template> </template>
</AuthenticationFormView> </AuthenticationFormView>-->
<!-- 头部 Logo 和应用名称 --> <!-- 头部 Logo 和应用名称 -->
<div <!--<div
v-if="logo || appName" v-if="logo || appName"
class="absolute left-0 top-0 z-10 flex flex-1" class="absolute left-0 top-0 z-10 flex flex-1"
@click="clickLogo" @click="clickLogo"
@@ -192,10 +192,10 @@ const handleAccountLogin = async () => {
{{ appName }} {{ appName }}
</p> </p>
</div> </div>
</div> </div>-->
<!-- 系统介绍 --> <!-- 系统介绍 -->
<div v-if="!authPanelCenter" class="relative hidden w-0 flex-1 lg:block"> <!--<div v-if="!authPanelCenter" class="relative hidden w-0 flex-1 lg:block">
<div <div
class="bg-background-deep absolute inset-0 h-full w-full dark:bg-[#070709]" class="bg-background-deep absolute inset-0 h-full w-full dark:bg-[#070709]"
> >
@@ -217,10 +217,10 @@ const handleAccountLogin = async () => {
</div> </div>
</div> </div>
</div> </div>
</div> </div>-->
<!-- 中心认证面板 --> <!-- 中心认证面板 -->
<div v-if="authPanelCenter" class="flex-center relative w-full"> <!--<div v-if="authPanelCenter" class="flex-center relative w-full">
<div class="login-background absolute left-0 top-0 size-full"></div> <div class="login-background absolute left-0 top-0 size-full"></div>
<AuthenticationFormView <AuthenticationFormView
class="md:bg-background shadow-primary/5 shadow-float w-full rounded-3xl pb-20 md:w-2/3 lg:w-1/2 xl:w-[36%]" class="md:bg-background shadow-primary/5 shadow-float w-full rounded-3xl pb-20 md:w-2/3 lg:w-1/2 xl:w-[36%]"
@@ -234,10 +234,10 @@ const handleAccountLogin = async () => {
</slot> </slot>
</template> </template>
</AuthenticationFormView> </AuthenticationFormView>
</div> </div>-->
<!-- 右侧认证面板 --> <!-- 右侧认证面板 -->
<AuthenticationFormView <!--<AuthenticationFormView
v-if="authPanelRight" v-if="authPanelRight"
class="min-h-full w-[34%] flex-1" class="min-h-full w-[34%] flex-1"
> >
@@ -249,8 +249,8 @@ const handleAccountLogin = async () => {
/> />
</slot> </slot>
</template> </template>
</AuthenticationFormView> </AuthenticationFormView>-->
</div> <!-- </div> -->
</template> </template>
<!-- <style scoped> <!-- <style scoped>