Compare commits

...

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查询
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;
costType:string;
userId:string;
}

View File

@ -7,11 +7,11 @@ import { costMeterWaterAdd, costMeterWaterInfo, costMeterWaterUpdate } from '#/a
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils';
import { communityTree } from '#/api/property/community';
import { watch } from 'vue';
import { costItemSettingList} from '#/api/property/costManagement/costItemSetting';
import { meterReadingTypeList } from '#/api/property/costManagement/meterReadingType';
import { getDictOptions } from '#/utils/dict';
import {ultimoWater} from '#/api/property/costMeterWater'
import {personList} from '#/api/property/resident/person'
const emit = defineEmits<{ reload: [] }>();
const costItemsOptions = ref<any>([]);
const meterTypeOptions = ref<any>([]);
@ -21,11 +21,35 @@ const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
const schema =[
{
label: '抄表地址',
fieldName: 'location',
{
label: '主键ID',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '房间号',
fieldName: 'roomId',
component: 'TreeSelect',
rules: 'required'
},
{
label: '业主',
fieldName: 'userId',
component: 'ApiSelect',
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: '费用类型',
@ -34,12 +58,7 @@ const schema =[
rules: 'required',
componentProps: {
options: getDictOptions('wy_cbfylx'),
onChange: async (value:any) => {
//
await formApi.setValues({
costItemsId: '',
meterTypeId: '',
});
onChange: async (value:any) => {
//
if (!value) {
costItemsOptions.value = [];
@ -61,7 +80,7 @@ const schema =[
//
formApi.updateSchema([
{
fieldName: 'costItemsId',
fieldName: 'itemId',
componentProps: {
options: costItemsOptions.value,
disabled: !isMeterType.value,
@ -75,12 +94,18 @@ const schema =[
},
},
]);
//
await formApi.setValues({
itemId: '',
meterTypeId: '',
});
console.log(await formApi.getValues());
}
}
},
{
label: '收费项目',
fieldName: 'costItemsId',
fieldName: 'itemId',
component: 'Select',
rules: 'required',
componentProps: {
@ -99,10 +124,9 @@ const schema =[
}
},
{
label: '上止度',
label: '上止度',
fieldName: 'preDegrees',
component: 'Input',
rules: 'required',
disabled: true,
},
{
@ -120,9 +144,7 @@ const schema =[
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
rules: 'required',
disabled:true
},
{
label: '本期读表时间',
@ -175,16 +197,44 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) {
return null;
}
isMeterType.value = false
isMeterType.value = true
setupCommunitySelect()
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && 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);
console.log(2,await formApi.getValues());
}
await markInitialized();
@ -201,6 +251,8 @@ async function handleConfirm() {
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
console.log(data);
await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data));
resetInitialized();
//ref
@ -210,7 +262,7 @@ async function handleConfirm() {
//
formApi.updateSchema([
{
fieldName: 'costItemsId',
fieldName: 'itemId',
componentProps: {
options: costItemsOptions.value,
disabled: !isMeterType.value,
@ -242,7 +294,7 @@ async function handleClosed() {
//
formApi.updateSchema([
{
fieldName: 'costItemsId',
fieldName: 'itemId',
componentProps: {
options: costItemsOptions.value,
disabled: !isMeterType.value,
@ -289,8 +341,20 @@ async function setupCommunitySelect() {
treeNodeFilterProp: 'label',
//
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(.ant-input[disabled]),
: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;
/* 有些浏览器需要这个来覆盖默认颜色 */

View File

@ -152,18 +152,18 @@ const handleAccountLogin = async () => {
</div>
</div>
</div>
<div
<!-- <div
:class="[isDark ? 'dark' : '']"
class="flex min-h-full flex-1 select-none overflow-x-hidden"
style="display: none;"
>
<template v-if="toolbar">
> -->
<!--<template v-if="toolbar">
<slot name="toolbar">
<Toolbar :toolbar-list="toolbarList" />
</slot>
</template>
</template>-->
<!-- 左侧认证面板 -->
<AuthenticationFormView
<!--<AuthenticationFormView
v-if="authPanelLeft"
class="min-h-full w-2/5 flex-1"
transition-name="slide-left"
@ -176,10 +176,10 @@ const handleAccountLogin = async () => {
/>
</slot>
</template>
</AuthenticationFormView>
</AuthenticationFormView>-->
<!-- 头部 Logo 和应用名称 -->
<div
<!--<div
v-if="logo || appName"
class="absolute left-0 top-0 z-10 flex flex-1"
@click="clickLogo"
@ -192,10 +192,10 @@ const handleAccountLogin = async () => {
{{ appName }}
</p>
</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
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 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>
<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%]"
@ -234,10 +234,10 @@ const handleAccountLogin = async () => {
</slot>
</template>
</AuthenticationFormView>
</div>
</div>-->
<!-- 右侧认证面板 -->
<AuthenticationFormView
<!--<AuthenticationFormView
v-if="authPanelRight"
class="min-h-full w-[34%] flex-1"
>
@ -249,8 +249,8 @@ const handleAccountLogin = async () => {
/>
</slot>
</template>
</AuthenticationFormView>
</div>
</AuthenticationFormView>-->
<!-- </div> -->
</template>
<!-- <style scoped>