Compare commits
2 Commits
60007098a4
...
65b9e5cb6a
Author | SHA1 | Date | |
---|---|---|---|
65b9e5cb6a | |||
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>([]);
|
||||
@ -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() {
|
||||
}
|
||||
// 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;
|
||||
/* 有些浏览器需要这个来覆盖默认颜色 */
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user