feat: 完成车辆收费、水电抄表
This commit is contained in:
parent
5c78f808b0
commit
49cbf6ffe5
@ -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}`);
|
||||
}
|
@ -51,6 +51,8 @@ export interface CostMeterWaterVO {
|
||||
* 搜索值
|
||||
*/
|
||||
searchValue: string;
|
||||
costType:string;
|
||||
userId:string;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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>([]);
|
||||
@ -22,10 +22,34 @@ const title = computed(() => {
|
||||
});
|
||||
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: '费用类型',
|
||||
@ -35,11 +59,6 @@ const schema =[
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_cbfylx'),
|
||||
onChange: async (value:any) => {
|
||||
// 清空依赖字段
|
||||
await formApi.setValues({
|
||||
costItemsId: '',
|
||||
meterTypeId: '',
|
||||
});
|
||||
// 请求并更新下拉
|
||||
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() {
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
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;
|
||||
/* 有些浏览器需要这个来覆盖默认颜色 */
|
||||
|
Loading…
Reference in New Issue
Block a user