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
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -29,7 +29,7 @@ export interface BuildingVO {
|
||||
/**
|
||||
* 建筑类型('1:住宅','2:商业','3:混合')
|
||||
*/
|
||||
buildType: number;
|
||||
buildType: string;
|
||||
|
||||
/**
|
||||
* 电梯数量
|
||||
|
@@ -19,7 +19,7 @@ export interface RoomVO {
|
||||
/**
|
||||
* 房间类型('住宅','商铺','办公室','设备间','公共区域')
|
||||
*/
|
||||
roomType: number;
|
||||
roomType: string;
|
||||
|
||||
/**
|
||||
* 建筑面积(平方米)
|
||||
@@ -49,7 +49,7 @@ export interface RoomVO {
|
||||
/**
|
||||
* 状态('空置','已售','已租','自用')
|
||||
*/
|
||||
status: number;
|
||||
status: string;
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import {computed, ref} from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep} from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { buildingAdd, buildingInfo, buildingUpdate } from '#/api/property/building';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import {buildingAdd, buildingInfo, buildingUpdate} from '#/api/property/building';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data';
|
||||
import {modalSchema} from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -34,7 +34,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -54,11 +54,12 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await buildingInfo(id);
|
||||
record.buildType = record.buildType.toString();
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -70,7 +71,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
const {valid} = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
@@ -95,7 +96,7 @@ async function handleClosed() {
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<BasicForm/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -105,12 +105,20 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '总层数',
|
||||
fieldName: 'floorCount',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:1,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '单元数',
|
||||
fieldName: 'unitCount',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:1,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '建筑类型',
|
||||
@@ -124,14 +132,17 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '电梯数量',
|
||||
fieldName: 'elevatorCount',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:0,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '竣工日期',
|
||||
fieldName: 'completionDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD',
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
},
|
||||
|
@@ -6,7 +6,7 @@ import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils';
|
||||
import { cloneDeep, handleNode, getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { Button, Table } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -43,7 +43,11 @@ const isAudit = ref(false);
|
||||
const isRefund = ref(false);
|
||||
const rowData = ref<any>({});
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : isReadonly.value ? '详情' : $t('pages.common.add');
|
||||
return isUpdate.value
|
||||
? $t('pages.common.edit')
|
||||
: isReadonly.value
|
||||
? '详情'
|
||||
: $t('pages.common.add');
|
||||
});
|
||||
|
||||
// 用来缓存 cleanList 的完整数据
|
||||
@@ -123,9 +127,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
// 查询服务地址树形结构
|
||||
setupCommunitySelect()
|
||||
setupCommunitySelect();
|
||||
modalApi.modalLoading(true);
|
||||
const { id, readonly,audit,refund,row } = modalApi.getData() as {
|
||||
const { id, readonly, audit, refund, row } = modalApi.getData() as {
|
||||
id?: string;
|
||||
readonly?: boolean;
|
||||
audit?: boolean;
|
||||
@@ -138,9 +142,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
isRefund.value = !!refund;
|
||||
rowData.value = row;
|
||||
//判断是否是编辑状态需要先判断是否是只读状态
|
||||
if(isReadonly.value){
|
||||
if (isReadonly.value) {
|
||||
isUpdate.value = false;
|
||||
}else{
|
||||
} else {
|
||||
isUpdate.value = !!id;
|
||||
}
|
||||
if ((isUpdate.value || isReadonly.value) && id) {
|
||||
@@ -149,9 +153,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (record.endTime) record.endTime = dayjs(record.endTime);
|
||||
editUnitId.value = record.unitId || '';
|
||||
detailTable.value = record.cleanList || [];
|
||||
for(const item of record.relationList){
|
||||
for(let i = 0; i < detailTable.value.length; i++){
|
||||
if(item.cleanId === detailTable.value[i].id){
|
||||
for (const item of record.relationList) {
|
||||
for (let i = 0; i < detailTable.value.length; i++) {
|
||||
if (item.cleanId === detailTable.value[i].id) {
|
||||
detailTable.value[i].area = item.areas;
|
||||
detailTable.value[i].sumPeices = item.sumPrice;
|
||||
}
|
||||
@@ -271,11 +275,11 @@ const detailColumns = [
|
||||
dataIndex: 'sumPeices',
|
||||
key: 'sumPeices',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right' as const,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
fixed: 'right' as const,
|
||||
},
|
||||
];
|
||||
|
||||
const [DetailTable, detailTableApi] = useVbenVxeGrid({
|
||||
@@ -298,7 +302,6 @@ function handleDetailReload(data: any) {
|
||||
// 编辑订单服务详情
|
||||
function handleEditDetailReload(data: any) {
|
||||
detailTable.value[data.index] = data;
|
||||
|
||||
}
|
||||
// 删除订单服务详情
|
||||
function handleDeleteDetail(record: any, index: number) {
|
||||
@@ -342,11 +345,15 @@ async function handleConfirm() {
|
||||
data.unit = unitObj ? unitObj.name : data.unit || '';
|
||||
data.name = cleanObj ? cleanObj.name : data.name || '';
|
||||
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
||||
data.sumPeices = Number(totalSumPeices.value)
|
||||
data.sumPeices = Number(totalSumPeices.value);
|
||||
data.cleanList = detailTable.value;
|
||||
if (data.starTime) data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
if (data.endTime) data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
isUpdate.value ? await clean_orderUpdate({...data,id:editCleanOrderId.value}) : await clean_orderAdd(data);
|
||||
if (data.starTime)
|
||||
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
if (data.endTime)
|
||||
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
isUpdate.value
|
||||
? await clean_orderUpdate({ ...data, id: editCleanOrderId.value })
|
||||
: await clean_orderAdd(data);
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
@@ -359,17 +366,17 @@ async function handleConfirm() {
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
detailTable.value = [];//清空详情表格
|
||||
detailTable.value = []; //清空详情表格
|
||||
resetInitialized();
|
||||
}
|
||||
// 获取服务地址
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(5);
|
||||
const areaList = await communityTree(4);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -399,58 +406,65 @@ async function setupCommunitySelect() {
|
||||
]);
|
||||
}
|
||||
async function handleAudit(params: any) {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if(rowData.value){
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if (rowData.value) {
|
||||
data.state = rowData.value.state;
|
||||
data.isUnbooking = rowData.value?.isUnbooking;
|
||||
}
|
||||
// 单位数据缓存
|
||||
if (unitListData.length === 0) {
|
||||
const res = await resident_unitList();
|
||||
unitListData = res.rows || [];
|
||||
}
|
||||
// 劳务数据缓存 cleanListData 已有
|
||||
// 查找label
|
||||
const unitObj = unitListData.find((item) => item.id === data.unitId);
|
||||
const cleanObj = cleanListData.find((item) => item.id === data.name);
|
||||
data.unit = unitObj ? unitObj.name : data.unit || '';
|
||||
data.name = cleanObj ? cleanObj.name : data.name || '';
|
||||
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
||||
data.sumPeices = Number(totalSumPeices.value)
|
||||
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
// data.sumPeices = parseInt(totalSumPeices.value, 10);
|
||||
// 组装 cleanIds
|
||||
// data.cleanIds = detailTable.value.map((item: any) => item.id);
|
||||
data.cleanList = detailTable.value;
|
||||
if(params.isRefund){
|
||||
data.isUnbooking = 1;
|
||||
} else if(params.isAudit){
|
||||
data.state = 1;
|
||||
}else{
|
||||
data.state = 2;
|
||||
}
|
||||
// 0:未审核 1:审核通过 2:审核不通过
|
||||
await clean_orderUpdate({...data,id:editCleanOrderId.value})
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
}
|
||||
// 单位数据缓存
|
||||
if (unitListData.length === 0) {
|
||||
const res = await resident_unitList();
|
||||
unitListData = res.rows || [];
|
||||
}
|
||||
// 劳务数据缓存 cleanListData 已有
|
||||
// 查找label
|
||||
const unitObj = unitListData.find((item) => item.id === data.unitId);
|
||||
const cleanObj = cleanListData.find((item) => item.id === data.name);
|
||||
data.unit = unitObj ? unitObj.name : data.unit || '';
|
||||
data.name = cleanObj ? cleanObj.name : data.name || '';
|
||||
data.unitId = unitObj ? unitObj.id : isUpdate.value ? editUnitId.value : '';
|
||||
data.sumPeices = Number(totalSumPeices.value);
|
||||
data.starTime = dayjs(data.starTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
// data.sumPeices = parseInt(totalSumPeices.value, 10);
|
||||
// 组装 cleanIds
|
||||
// data.cleanIds = detailTable.value.map((item: any) => item.id);
|
||||
data.cleanList = detailTable.value;
|
||||
if (params.isRefund) {
|
||||
data.isUnbooking = 1;
|
||||
} else if (params.isAudit) {
|
||||
data.state = 1;
|
||||
} else {
|
||||
data.state = 2;
|
||||
}
|
||||
// 0:未审核 1:审核通过 2:审核不通过
|
||||
await clean_orderUpdate({ ...data, id: editCleanOrderId.value });
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm>
|
||||
</BasicForm>
|
||||
<BasicForm> </BasicForm>
|
||||
<!-- 添加订单详情部分 -->
|
||||
<div class="mt-4">
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<h3 class="text-lg font-medium">{{ isUpdate ? '编辑保洁订单详情' : isReadonly ? '查看保洁订单详情' : '添加保洁订单详情' }} </h3>
|
||||
<h3 class="text-lg font-medium">
|
||||
{{
|
||||
isUpdate
|
||||
? '编辑保洁订单详情'
|
||||
: isReadonly
|
||||
? '查看保洁订单详情'
|
||||
: '添加保洁订单详情'
|
||||
}}
|
||||
</h3>
|
||||
<a-button v-if="!isReadonly" type="primary" @click="handleAddDetail">
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
@@ -468,10 +482,26 @@ async function handleAudit(params: any) {
|
||||
<template v-if="isReadonly">
|
||||
<Button @click="handleViewDetail(record)">查看</Button>
|
||||
</template>
|
||||
<template v-else >
|
||||
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleViewDetail(record)">查看</Button>
|
||||
<Button type="primary" size="small" style="margin-right: 5px;" @click="handleEditDetail(record, index)">编辑</Button>
|
||||
<Button danger size="small" @click="handleDeleteDetail(record, index)">
|
||||
<template v-else>
|
||||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
style="margin-right: 5px"
|
||||
@click="handleViewDetail(record)"
|
||||
>查看</Button
|
||||
>
|
||||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
style="margin-right: 5px"
|
||||
@click="handleEditDetail(record, index)"
|
||||
>编辑</Button
|
||||
>
|
||||
<Button
|
||||
danger
|
||||
size="small"
|
||||
@click="handleDeleteDetail(record, index)"
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</template>
|
||||
@@ -480,17 +510,26 @@ async function handleAudit(params: any) {
|
||||
</Table>
|
||||
<div>费用合计:{{ totalSumPeices }}元</div>
|
||||
</div>
|
||||
<CleanDetailModal @reload="handleDetailReload" @editReload="handleEditDetailReload"/>
|
||||
<CleanDetailModal
|
||||
@reload="handleDetailReload"
|
||||
@editReload="handleEditDetailReload"
|
||||
/>
|
||||
<template #footer v-if="isAudit">
|
||||
<a-button @click="modalApi.close()">取消</a-button>
|
||||
<a-button type="primary" @click="handleAudit({isAudit:true})">审核通过</a-button>
|
||||
<a-button danger @click="handleAudit({isAudit:false})">审核不通过</a-button>
|
||||
<a-button type="primary" @click="handleAudit({ isAudit: true })"
|
||||
>审核通过</a-button
|
||||
>
|
||||
<a-button danger @click="handleAudit({ isAudit: false })"
|
||||
>审核不通过</a-button
|
||||
>
|
||||
</template>
|
||||
<template #footer v-if="isRefund">
|
||||
<a-button @click="modalApi.close()">取消</a-button>
|
||||
<a-button type="primary" @click="handleAudit({isRefund:true})">退定</a-button>
|
||||
<a-button type="primary" @click="handleAudit({ isRefund: true })"
|
||||
>退定</a-button
|
||||
>
|
||||
</template>
|
||||
</BasicModal>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
@@ -23,7 +23,7 @@ import { onMounted, ref } from 'vue';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
const areaList = ref<any>(null);
|
||||
onMounted(async () => {
|
||||
areaList.value = await communityTree(5);
|
||||
areaList.value = await communityTree(4);
|
||||
});
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
|
@@ -3,15 +3,19 @@ import { computed, ref } from 'vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { costMeterWaterAdd, costMeterWaterInfo, costMeterWaterUpdate } from '#/api/property/costMeterWater';
|
||||
import {
|
||||
costMeterWaterAdd,
|
||||
costMeterWaterInfo,
|
||||
costMeterWaterUpdate,
|
||||
} from '#/api/property/costMeterWater';
|
||||
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 { costItemSettingList} from '#/api/property/costManagement/costItemSetting';
|
||||
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'
|
||||
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>([]);
|
||||
@@ -20,21 +24,21 @@ const isUpdate = ref(false);
|
||||
const title = computed(() => {
|
||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
||||
});
|
||||
const schema =[
|
||||
{
|
||||
label: '主键ID',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
const schema = [
|
||||
{
|
||||
label: '主键ID',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
label: '房间号',
|
||||
fieldName: 'roomId',
|
||||
component: 'TreeSelect',
|
||||
rules: 'required'
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '业主',
|
||||
@@ -43,13 +47,13 @@ const schema =[
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const res = await personList({pageSize:1000000000,pageNum:1});
|
||||
const res = await personList({ pageSize: 1000000000, pageNum: 1 });
|
||||
return res.rows.map((item: any) => ({
|
||||
label: item.userName,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '费用类型',
|
||||
@@ -58,21 +62,29 @@ const schema =[
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
options: getDictOptions('wy_cbfylx'),
|
||||
onChange: async (value:any) => {
|
||||
onChange: async (value: any) => {
|
||||
// 请求并更新下拉
|
||||
if (!value) {
|
||||
costItemsOptions.value = [];
|
||||
meterTypeOptions.value = [];
|
||||
isMeterType.value = false
|
||||
isMeterType.value = false;
|
||||
} else {
|
||||
isMeterType.value = true
|
||||
const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: value });
|
||||
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({
|
||||
isMeterType.value = true;
|
||||
const costItemsRes = await costItemSettingList({
|
||||
pageSize: 1000000000,
|
||||
pageNum: 1,
|
||||
costType: value,
|
||||
});
|
||||
costItemsOptions.value = (costItemsRes?.rows || []).map((item) => ({
|
||||
label: item.chargeItem,
|
||||
value: item.id,
|
||||
}));
|
||||
const meterTypeRes = await meterReadingTypeList({ pageSize: 1000000000, pageNum: 1, costType: value == '5' ? 0 : 1 });
|
||||
meterTypeOptions.value = (meterTypeRes?.rows || []).map(item => ({
|
||||
const meterTypeRes = await meterReadingTypeList({
|
||||
pageSize: 1000000000,
|
||||
pageNum: 1,
|
||||
costType: value == '5' ? 0 : 1,
|
||||
});
|
||||
meterTypeOptions.value = (meterTypeRes?.rows || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
@@ -100,8 +112,8 @@ const schema =[
|
||||
meterTypeId: '',
|
||||
});
|
||||
console.log(await formApi.getValues());
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '收费项目',
|
||||
@@ -111,7 +123,7 @@ const schema =[
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '抄表类型',
|
||||
@@ -121,7 +133,7 @@ const schema =[
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '上期止度',
|
||||
@@ -144,7 +156,7 @@ const schema =[
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
},
|
||||
disabled:true
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
label: '本期读表时间',
|
||||
@@ -161,7 +173,7 @@ const schema =[
|
||||
label: '说明',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
}
|
||||
},
|
||||
];
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
@@ -172,7 +184,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: schema,
|
||||
showDefaultActions: false,
|
||||
@@ -197,44 +209,51 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
isMeterType.value = true
|
||||
setupCommunitySelect()
|
||||
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);
|
||||
console.log(1, record);
|
||||
|
||||
const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: record.costType });
|
||||
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({
|
||||
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 => ({
|
||||
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: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
]);
|
||||
},
|
||||
]);
|
||||
await formApi.setValues(record);
|
||||
console.log(2,await formApi.getValues());
|
||||
|
||||
console.log(2, await formApi.getValues());
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
@@ -253,29 +272,31 @@ async function handleConfirm() {
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
console.log(data);
|
||||
|
||||
await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data));
|
||||
await (isUpdate.value
|
||||
? costMeterWaterUpdate(data)
|
||||
: costMeterWaterAdd(data));
|
||||
resetInitialized();
|
||||
//必须要手动清空,不然ref会保留值
|
||||
costItemsOptions.value = [];
|
||||
meterTypeOptions.value = [];
|
||||
isMeterType.value = false
|
||||
// 更新表单下拉
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
]);
|
||||
isMeterType.value = false;
|
||||
// 更新表单下拉
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
]);
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
@@ -287,37 +308,37 @@ async function handleConfirm() {
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
await formApi.setValues({})
|
||||
await formApi.setValues({});
|
||||
costItemsOptions.value = [];
|
||||
meterTypeOptions.value = [];
|
||||
isMeterType.value = false
|
||||
// 更新表单下拉
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
]);
|
||||
isMeterType.value = false;
|
||||
// 更新表单下拉
|
||||
formApi.updateSchema([
|
||||
{
|
||||
fieldName: 'itemId',
|
||||
componentProps: {
|
||||
options: costItemsOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'meterTypeId',
|
||||
componentProps: {
|
||||
options: meterTypeOptions.value,
|
||||
disabled: !isMeterType.value,
|
||||
},
|
||||
},
|
||||
]);
|
||||
resetInitialized();
|
||||
}
|
||||
// 获取服务地址
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(5);
|
||||
const areaList = await communityTree(4);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -342,17 +363,17 @@ async function setupCommunitySelect() {
|
||||
// 选中后显示在输入框的值
|
||||
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})
|
||||
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: 'roomId',
|
||||
},
|
||||
|
@@ -1,25 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, ref} from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep, handleNode} from '@vben/utils';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, handleNode } from '@vben/utils';
|
||||
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
houseChargeAdd,
|
||||
houseChargeInfo,
|
||||
houseChargeUpdate
|
||||
houseChargeUpdate,
|
||||
} from '#/api/property/costManagement/houseCharge';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import {modalSchema} from './data';
|
||||
import {communityTree} from "#/api/property/community";
|
||||
import {costItemSettingList} from "#/api/property/costManagement/costItemSetting";
|
||||
import type {CostItemSettingVO} from "#/api/property/costManagement/costItemSetting/model";
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {personList} from "#/api/property/resident/person";
|
||||
import {renderDictValue} from "#/utils/render";
|
||||
import { modalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import { costItemSettingList } from '#/api/property/costManagement/costItemSetting';
|
||||
import type { CostItemSettingVO } from '#/api/property/costManagement/costItemSetting/model';
|
||||
import { getDictOptions } from '#/utils/dict';
|
||||
import { personList } from '#/api/property/resident/person';
|
||||
import { renderDictValue } from '#/utils/render';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -38,14 +38,14 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -64,16 +64,16 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
await initRoomOptions()
|
||||
await queryCostItemOptions()
|
||||
await initCostTypeOptions()
|
||||
await queryPersonData()
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
await initRoomOptions();
|
||||
await queryCostItemOptions();
|
||||
await initCostTypeOptions();
|
||||
await queryPersonData();
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await houseChargeInfo(id);
|
||||
record.chargeTime = [record.startTime, record.endTime]
|
||||
record.chargeTime = [record.startTime, record.endTime];
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -85,15 +85,15 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const {valid} = await formApi.validate();
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if (data.chargeTime && data.chargeTime.length) {
|
||||
data.startTime = data.chargeTime[0]
|
||||
data.endTime = data.chargeTime[1]
|
||||
data.startTime = data.chargeTime[0];
|
||||
data.endTime = data.chargeTime[1];
|
||||
}
|
||||
await (isUpdate.value ? houseChargeUpdate(data) : houseChargeAdd(data));
|
||||
resetInitialized();
|
||||
@@ -115,10 +115,10 @@ async function handleClosed() {
|
||||
* 房间数据
|
||||
*/
|
||||
async function initRoomOptions() {
|
||||
const roomList = await communityTree(5);
|
||||
const roomList = await communityTree(4);
|
||||
const splitStr = '/';
|
||||
handleNode(roomList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -136,7 +136,7 @@ async function initRoomOptions() {
|
||||
showSearch: true,
|
||||
treeData: roomList,
|
||||
treeDefaultExpandAll: true,
|
||||
treeLine: {showLeafIcon: false},
|
||||
treeLine: { showLeafIcon: false },
|
||||
// 筛选的字段
|
||||
treeNodeFilterProp: 'label',
|
||||
// 选中后显示在输入框的值
|
||||
@@ -150,77 +150,93 @@ async function initRoomOptions() {
|
||||
/**
|
||||
* 查询费用项设置
|
||||
*/
|
||||
async function queryCostItemOptions(costType:string) {
|
||||
async function queryCostItemOptions(costType: string) {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
costType
|
||||
}
|
||||
const res = await costItemSettingList(params)
|
||||
costItemOptions.value = res.rows
|
||||
formApi.updateSchema([{
|
||||
componentProps: {
|
||||
options: costItemOptions.value,
|
||||
fieldNames: {label: 'chargeItem', value: 'id'},
|
||||
showSearch: true,
|
||||
optionFilterProp: 'chargeItem',
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
const costItem = costItemOptions.value.find(item => item.id == value)
|
||||
if(costItem){
|
||||
await formApi.setFieldValue('remark', `单价:${costItem.unitPrice} 附加费:${costItem.surcharge}`);
|
||||
costType,
|
||||
};
|
||||
const res = await costItemSettingList(params);
|
||||
costItemOptions.value = res.rows;
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: costItemOptions.value,
|
||||
fieldNames: { label: 'chargeItem', value: 'id' },
|
||||
showSearch: true,
|
||||
optionFilterProp: 'chargeItem',
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
const costItem = costItemOptions.value.find(
|
||||
(item) => item.id == value,
|
||||
);
|
||||
if (costItem) {
|
||||
await formApi.setFieldValue(
|
||||
'remark',
|
||||
`单价:${costItem.unitPrice} 附加费:${costItem.surcharge}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
fieldName: 'costItemsId',
|
||||
},
|
||||
fieldName: 'costItemsId'
|
||||
}])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化费用类型
|
||||
*/
|
||||
async function initCostTypeOptions(){
|
||||
formApi.updateSchema([{
|
||||
componentProps: {
|
||||
options: getDictOptions('pro_expense_type'),
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
await queryCostItemOptions(value)
|
||||
await formApi.setFieldValue('costItemsId', null)
|
||||
}
|
||||
}
|
||||
async function initCostTypeOptions() {
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: {
|
||||
options: getDictOptions('pro_expense_type'),
|
||||
onChange: async (value: string) => {
|
||||
if (value) {
|
||||
await queryCostItemOptions(value);
|
||||
await formApi.setFieldValue('costItemsId', null);
|
||||
}
|
||||
},
|
||||
},
|
||||
fieldName: 'costType',
|
||||
},
|
||||
fieldName: 'costType'
|
||||
}])
|
||||
]);
|
||||
}
|
||||
|
||||
async function queryPersonData() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
};
|
||||
const res = await personList(params);
|
||||
const options = res.rows.map((user) => ({
|
||||
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex')
|
||||
+ '-' + user.phone + '-' + user.unitName,
|
||||
label:
|
||||
user.userName +
|
||||
'-' +
|
||||
renderDictValue(user.gender, 'sys_user_sex') +
|
||||
'-' +
|
||||
user.phone +
|
||||
'-' +
|
||||
user.unitName,
|
||||
value: user.id,
|
||||
}));
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
}),
|
||||
fieldName: 'personId',
|
||||
}])
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch: true,
|
||||
optionFilterProp: 'label',
|
||||
optionLabelProp: 'label',
|
||||
}),
|
||||
fieldName: 'personId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm/>
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -54,7 +54,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
},
|
||||
{
|
||||
component: 'TreeSelect',
|
||||
fieldName: 'unitId',
|
||||
fieldName: 'buildingId',
|
||||
defaultValue: undefined,
|
||||
label: '社区建筑',
|
||||
rules: 'selectRequired',
|
||||
@@ -80,11 +80,19 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '房间数量',
|
||||
fieldName: 'roomCount',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:0,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '层高',
|
||||
fieldName: 'floorHeight',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
min:0,
|
||||
precision:0,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@@ -90,12 +90,12 @@ async function handleConfirm() {
|
||||
* 初始化城市
|
||||
*/
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(3);
|
||||
const areaList = await communityTree(2);//楼层关联建筑
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 3) {
|
||||
if (node.level != 2) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -120,7 +120,7 @@ async function setupCommunitySelect() {
|
||||
// 选中后显示在输入框的值
|
||||
treeNodeLabelProp: 'fullName',
|
||||
}),
|
||||
fieldName: 'unitId',
|
||||
fieldName: 'buildingId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
@@ -1,18 +1,14 @@
|
||||
<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 {
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
|
||||
import {
|
||||
@@ -138,8 +134,8 @@ function handleDownloadExcel() {
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:floor:remove']"
|
||||
type="primary"
|
||||
v-access:code="['property:floor:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
|
@@ -2,9 +2,13 @@
|
||||
import { computed, ref } from 'vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep,handleNode,getPopupContainer } from '@vben/utils';
|
||||
import { cloneDeep, handleNode, getPopupContainer } from '@vben/utils';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { orderMaintainAdd, orderMaintainInfo, orderMaintainUpdate } from '#/api/property/conservationManagement';
|
||||
import {
|
||||
orderMaintainAdd,
|
||||
orderMaintainInfo,
|
||||
orderMaintainUpdate,
|
||||
} from '#/api/property/conservationManagement';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import { modalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
@@ -21,7 +25,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
@@ -45,7 +49,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
setupCommunitySelect()
|
||||
setupCommunitySelect();
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
@@ -91,12 +95,12 @@ async function handleClosed() {
|
||||
|
||||
// 获取服务地址
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(5);
|
||||
const areaList = await communityTree(4);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -132,4 +136,3 @@ async function setupCommunitySelect() {
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -1,23 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui'
|
||||
import { $t } from '@vben/locales'
|
||||
import { cloneDeep, handleNode } from '@vben/utils'
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, handleNode } from '@vben/utils';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form'
|
||||
import { resident_unitAdd, resident_unitInfo, resident_unitUpdate } from '#/api/property/resident/unit'
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup'
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
resident_unitAdd,
|
||||
resident_unitInfo,
|
||||
resident_unitUpdate,
|
||||
} from '#/api/property/resident/unit';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import { modalSchema } from './data'
|
||||
import { communityTree } from "#/api/property/community"
|
||||
import { modalSchema } from './data';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>()
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const isUpdate = ref(false)
|
||||
const isUpdate = ref(false);
|
||||
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 [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
@@ -28,19 +32,19 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
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({
|
||||
// 在这里更改宽度
|
||||
@@ -51,57 +55,57 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true)
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string }
|
||||
isUpdate.value = !!id
|
||||
await initLocationOptions()
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
await initLocationOptions();
|
||||
if (isUpdate.value && id) {
|
||||
const record = await resident_unitInfo(id)
|
||||
await formApi.setValues(record)
|
||||
const record = await resident_unitInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized()
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false)
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true)
|
||||
const { valid } = await formApi.validate()
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues())
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
|
||||
data.authBegDate = data.authTime[0]
|
||||
data.authEndDate = data.authTime[1]
|
||||
data.authBegDate = data.authTime[0];
|
||||
data.authEndDate = data.authTime[1];
|
||||
|
||||
await (isUpdate.value ? resident_unitUpdate(data) : resident_unitAdd(data))
|
||||
resetInitialized()
|
||||
emit('reload')
|
||||
modalApi.close()
|
||||
await (isUpdate.value ? resident_unitUpdate(data) : resident_unitAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false)
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 入驻位置数据
|
||||
*/
|
||||
async function initLocationOptions() {
|
||||
const locationList = await communityTree(5)
|
||||
const splitStr = '/'
|
||||
const locationList = await communityTree(4);
|
||||
const splitStr = '/';
|
||||
handleNode(locationList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
node.disabled = true
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
})
|
||||
});
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
@@ -124,19 +128,17 @@ async function initLocationOptions() {
|
||||
}),
|
||||
fieldName: 'location',
|
||||
},
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm()
|
||||
resetInitialized()
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm>
|
||||
</BasicForm>
|
||||
<BasicForm> </BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -10,15 +10,6 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
fieldName: 'communityName',
|
||||
label: '社区',
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orientation',
|
||||
label: '朝向',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_direction_towards),
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
@@ -47,30 +38,22 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'area',
|
||||
},
|
||||
{
|
||||
title: '套内面积',
|
||||
title: '使用面积',
|
||||
field: 'insideInArea',
|
||||
},
|
||||
{
|
||||
title: '户型',
|
||||
field: 'layout',
|
||||
},
|
||||
{
|
||||
title: '朝向',
|
||||
field: 'orientationName',
|
||||
},
|
||||
{
|
||||
title: '是否可售',
|
||||
field: 'isForSale',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.isForSale, DictEnum.wy_sf);
|
||||
},
|
||||
},
|
||||
title: '是否重要',
|
||||
field: 'isMatter',
|
||||
slots:{
|
||||
default:({row})=>{
|
||||
return renderDict(row.isMatter,'wy_fjzydj')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
title: '状态',
|
||||
field: 'statusName',
|
||||
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
@@ -97,6 +80,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
defaultValue: undefined,
|
||||
label: '社区建筑',
|
||||
rules: 'selectRequired',
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
{
|
||||
label: '房间号',
|
||||
@@ -112,42 +96,34 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_room_type),
|
||||
},
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '建筑面积',
|
||||
fieldName: 'area',
|
||||
component: 'Input',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:0,
|
||||
},
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '套内面积',
|
||||
label: '使用面积',
|
||||
fieldName: 'insideInArea',
|
||||
component: 'InputNumber',
|
||||
componentProps:{
|
||||
min:0,
|
||||
}
|
||||
},
|
||||
rules:'required'
|
||||
},
|
||||
{
|
||||
label: '户型',
|
||||
fieldName: 'layout',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
label: '朝向',
|
||||
fieldName: 'orientation',
|
||||
label: '是否重要',
|
||||
fieldName: 'isMatter',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_direction_towards),
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '是否可售',
|
||||
fieldName: 'isForSale',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_sf),
|
||||
options: getDictOptions('wy_fjzydj'),
|
||||
},
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
@@ -157,5 +133,15 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
getPopupContainer,
|
||||
options: getDictOptions(DictEnum.wy_fjzt),
|
||||
},
|
||||
rules:'selectRequired'
|
||||
},
|
||||
{
|
||||
label: '房间图片',
|
||||
fieldName: 'imgUrl',
|
||||
component: 'ImageUpload',
|
||||
componentProps: {
|
||||
maxCount: 1, // 最大上传文件数 默认为1 为1会绑定为string而非string[]类型
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
];
|
||||
|
@@ -59,6 +59,8 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
await formApi.setValues({
|
||||
...record,
|
||||
isForSale: String(record.isForSale),
|
||||
status:String(record.status),
|
||||
roomType:String(record.roomType),
|
||||
});
|
||||
}
|
||||
await markInitialized();
|
||||
@@ -91,12 +93,12 @@ async function handleConfirm() {
|
||||
* 初始化城市
|
||||
*/
|
||||
async function setupCommunitySelect() {
|
||||
const areaList = await communityTree(4);
|
||||
const areaList = await communityTree(3);
|
||||
// 选中后显示在输入框的值 即父节点 / 子节点
|
||||
// addFullName(areaList, 'areaName', ' / ');
|
||||
const splitStr = '/';
|
||||
handleNode(areaList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 4) {
|
||||
if (node.level != 3) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
|
@@ -1,19 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import {computed, ref} from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import {useVbenModal} from '@vben/common-ui';
|
||||
import {$t} from '@vben/locales';
|
||||
import {cloneDeep, getPopupContainer, handleNode} from '@vben/utils';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
import { cloneDeep, getPopupContainer, handleNode } from '@vben/utils';
|
||||
|
||||
import {useVbenForm} from '#/adapter/form';
|
||||
import {meetAdd, meetInfo, meetUpdate} from '#/api/property/roomBooking/conferenceSettings';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
meetAdd,
|
||||
meetInfo,
|
||||
meetUpdate,
|
||||
} from '#/api/property/roomBooking/conferenceSettings';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
|
||||
import {modalSchema} from './data';
|
||||
import {TimeRangePicker} from 'ant-design-vue'
|
||||
import {renderDictValue} from "#/utils/render";
|
||||
import {personList} from "#/api/property/resident/person";
|
||||
import {communityTree} from "#/api/property/community";
|
||||
import { modalSchema } from './data';
|
||||
import { TimeRangePicker } from 'ant-design-vue';
|
||||
import { renderDictValue } from '#/utils/render';
|
||||
import { personList } from '#/api/property/resident/person';
|
||||
import { communityTree } from '#/api/property/community';
|
||||
import dayjs from 'dayjs';
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -31,14 +35,14 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
},
|
||||
schema: modalSchema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -58,20 +62,20 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
await formApi.setValues({
|
||||
expenseType:'1',
|
||||
isCheck:'0',
|
||||
})
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
expenseType: '1',
|
||||
isCheck: '0',
|
||||
});
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
await queryPerson()
|
||||
await initLocationOptions()
|
||||
await queryPerson();
|
||||
await initLocationOptions();
|
||||
if (isUpdate.value && id) {
|
||||
const record = await meetInfo(id);
|
||||
record.expenseType=record.expenseType.toString()
|
||||
record.isCheck=record.isCheck.toString()
|
||||
record.expenseType = record.expenseType.toString();
|
||||
record.isCheck = record.isCheck.toString();
|
||||
let hour = record.openHours.split('-');
|
||||
if(hour.length>1){
|
||||
record.openHours=[dayjs(hour[0],'HH:mm'),dayjs(hour[1],'HH:mm')]
|
||||
if (hour.length > 1) {
|
||||
record.openHours = [dayjs(hour[0], 'HH:mm'), dayjs(hour[1], 'HH:mm')];
|
||||
}
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
@@ -84,14 +88,17 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const {valid} = await formApi.validate();
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
if (data.openHours) {
|
||||
data.openHours = data.openHours[0]?.format("HH:mm") + '-' + data.openHours[1]?.format("HH:mm");
|
||||
data.openHours =
|
||||
data.openHours[0]?.format('HH:mm') +
|
||||
'-' +
|
||||
data.openHours[1]?.format('HH:mm');
|
||||
}
|
||||
await (isUpdate.value ? meetUpdate(data) : meetAdd(data));
|
||||
resetInitialized();
|
||||
@@ -113,20 +120,27 @@ async function queryPerson() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
};
|
||||
const res = await personList(params);
|
||||
const options = res.rows.map((user) => ({
|
||||
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex') + '-' + user.phone,
|
||||
label:
|
||||
user.userName +
|
||||
'-' +
|
||||
renderDictValue(user.gender, 'sys_user_sex') +
|
||||
'-' +
|
||||
user.phone,
|
||||
value: user.id,
|
||||
}));
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
filterOption: filterOption,
|
||||
showSearch:true,
|
||||
}),
|
||||
fieldName: 'principals',
|
||||
}])
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
filterOption: filterOption,
|
||||
showSearch: true,
|
||||
}),
|
||||
fieldName: 'principals',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
const filterOption = (input: string, option: any) => {
|
||||
@@ -137,10 +151,10 @@ const filterOption = (input: string, option: any) => {
|
||||
* 地址数据
|
||||
*/
|
||||
async function initLocationOptions() {
|
||||
const locationList = await communityTree(5);
|
||||
const locationList = await communityTree(4);
|
||||
const splitStr = '/';
|
||||
handleNode(locationList, 'label', splitStr, function (node: any) {
|
||||
if (node.level != 5) {
|
||||
if (node.level != 4) {
|
||||
node.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -159,7 +173,7 @@ async function initLocationOptions() {
|
||||
showSearch: true,
|
||||
treeData: locationList,
|
||||
treeDefaultExpandAll: true,
|
||||
treeLine: {showLeafIcon: false},
|
||||
treeLine: { showLeafIcon: false },
|
||||
// 筛选的字段
|
||||
treeNodeFilterProp: 'label',
|
||||
// 选中后显示在输入框的值
|
||||
@@ -180,4 +194,3 @@ async function initLocationOptions() {
|
||||
</BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
Reference in New Issue
Block a user