5.1日 暂定 水电表管理
This commit is contained in:
@@ -5,39 +5,42 @@
|
||||
<div class="title">基本信息</div>
|
||||
<div class="addBuildingFormBody">
|
||||
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
|
||||
<el-form-item label="账单名称" prop="name">
|
||||
<el-input v-model.trim="form.name" placeholder="请输入账单名称" />
|
||||
<el-form-item label="账单名称" prop="billName">
|
||||
<el-input v-model.trim="form.billName" placeholder="请输入账单名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收费项目" prop="chargeItemId">
|
||||
<el-select v-model="form.chargeItemId">
|
||||
<el-select v-model="form.chargeItemId" @change="handleChange">
|
||||
<el-option v-for="(item, index) in chargeitemlist" :key="index" :value="item.id" :label="item.itemName"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="收费范围" prop="chargeScope">
|
||||
<el-radio-group v-model="form.chargeScope">
|
||||
<el-radio v-for="(item, index) in com_questionnaire_scope" :key="index" :value="item.value" :label="item.label"></el-radio>
|
||||
<el-radio v-for="(item, index) in com_bill_charge_scope_house" :key="index" :value="item.value" :label="item.label"></el-radio>
|
||||
</el-radio-group>
|
||||
<div @click="() => handleClearCheckout" v-if="form.chargeScope === '1'" class="ml-10px cursor-pointer color-red">清空</div>
|
||||
<div @click="handleClearCheckout" v-if="form.chargeScope === '1'" class="ml-10px cursor-pointer color-red">清空</div>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.chargeScope === '1'">
|
||||
<div class="residentBox">
|
||||
<ul class="checkoutSideUsesbox">
|
||||
<li v-for="(item, index) in checkoutUses" :key="index">
|
||||
<span>{{ item.name }}</span>
|
||||
<el-icon @click="delteUse(item.id)">
|
||||
<span>{{ item.buildingName }}/</span>
|
||||
<span>{{ item.unitNo }}单元/</span>
|
||||
<span>{{ item.floorNo }}楼/</span>
|
||||
<span>{{ item.houseNo }}室</span>
|
||||
<el-icon @click="delteUse(item.houseId)">
|
||||
<Delete></Delete>
|
||||
</el-icon>
|
||||
</li>
|
||||
<Holder returnvalue="*" ref="HolderRef" :isMultiple="true" :userid="checkoutUses" @change="handleSelect">
|
||||
<House returnvalue="*" ref="HolderRef" :isMultiple="true" :userid="form.houseIds.join(',')" @change="handleSelect">
|
||||
<template #default>
|
||||
<li @click="OpenUseTablesfun" class="add justify-center">
|
||||
<el-icon>
|
||||
<DocumentAdd></DocumentAdd>
|
||||
</el-icon>
|
||||
<span>添加业主</span>
|
||||
<span>添加房屋</span>
|
||||
</li>
|
||||
</template>
|
||||
</Holder>
|
||||
</House>
|
||||
</ul>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -74,16 +77,16 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import Holder from '@/components/Holder/index.vue';
|
||||
import House from '@/components/Holder/house.vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { listChargeItem } from '@/api/system/SdbChargeItem';
|
||||
import { getBill, updateBill, addBill } from '@/api/system/SdbBill';
|
||||
import { getBill, updateBill, addBill, BillHouse, listBillHouse } from '@/api/system/SdbBill';
|
||||
import type { DatePickerType } from 'element-plus';
|
||||
import { formatDate, formatDate2 } from '@/utils';
|
||||
import { Delete } from '@element-plus/icons-vue';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_questionnaire_scope } = toRefs<any>(proxy?.useDict('com_questionnaire_scope'));
|
||||
const { com_bill_charge_scope_house } = toRefs<any>(proxy?.useDict('com_bill_charge_scope_house'));
|
||||
const { com_bill_charge_period } = toRefs<any>(proxy?.useDict('com_bill_charge_period'));
|
||||
|
||||
type PickerConfig = {
|
||||
@@ -101,19 +104,18 @@ const route = useRoute();
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
'id': null,
|
||||
'name': '',
|
||||
'billName': '',
|
||||
'chargeItemId': '', // 收费项目
|
||||
'chargeScope': '0', // 业主范围
|
||||
'chargePeriod': '2', // 费用周期
|
||||
residents: '', // 部分业主
|
||||
houseIds: [], // 部分业主
|
||||
charegeTypeId: '', // typeid
|
||||
'startDate': '', // 开始
|
||||
'endDate': '', // 结束
|
||||
'remark': ''
|
||||
});
|
||||
// TODO 添加账单
|
||||
// TODO 账单详情
|
||||
const rules = ref({
|
||||
name: [{ required: true, message: '请输入 项目名称', trigger: 'blur' }],
|
||||
billName: [{ required: true, message: '请输入 项目名称', trigger: 'blur' }],
|
||||
chargeItemId: [{ required: true, message: '请选择 收费项目', trigger: 'blur' }],
|
||||
chargePeriod: [{ required: true, message: '请选择 费用周期', trigger: 'blur' }],
|
||||
startDate: [{ required: true, message: '请选择 起止日期', trigger: 'blur' }],
|
||||
@@ -126,13 +128,21 @@ const StartEndDate = ref([]);
|
||||
function handleDate(val: string[]) {
|
||||
form.value.startDate = formatDate2(val[0]);
|
||||
form.value.endDate = formatDate2(val[1]);
|
||||
console.log(formatDate2(val[0]), formatDate2(val[1]));
|
||||
}
|
||||
|
||||
// 收费类型
|
||||
const chargeitemlist = ref([]);
|
||||
function init() {
|
||||
|
||||
// 房屋列表
|
||||
const houselist = ref([]);
|
||||
async function init() {
|
||||
listChargeItem().then((res) => {
|
||||
chargeitemlist.value = res.rows;
|
||||
});
|
||||
|
||||
const res = await listBillHouse({ pageNum: 1, pageSize: 999999 });
|
||||
houselist.value = res.rows;
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getBill(userid.value).then((res) => {
|
||||
@@ -140,38 +150,65 @@ function init() {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
form.value.houseIds = res.data.houseIds || [];
|
||||
form.value.startDate = formatDate2(form.value.startDate);
|
||||
form.value.endDate = formatDate2(form.value.endDate);
|
||||
StartEndDate.value = [form.value.startDate, form.value.endDate];
|
||||
|
||||
checkoutUses.value = form.value.houseIds
|
||||
.map((item) => {
|
||||
if (item) {
|
||||
const find = houselist.value.find((it) => it.houseId === item);
|
||||
if (find) {
|
||||
return find;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
})
|
||||
.filter((item) => item !== null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
onMounted(() => {
|
||||
init();
|
||||
});
|
||||
|
||||
// 获取收费类型id
|
||||
function handleChange(val) {
|
||||
const find = chargeitemlist.value.find((item) => item.id === val);
|
||||
if (find) {
|
||||
form.value.charegeTypeId = find.typeId;
|
||||
}
|
||||
}
|
||||
// !== 业主 =============================================================================
|
||||
|
||||
// 打开
|
||||
const HolderRef = ref<InstanceType<typeof Holder>>();
|
||||
const HolderRef = ref<InstanceType<typeof House>>();
|
||||
function OpenUseTablesfun() {
|
||||
HolderRef.value.open();
|
||||
}
|
||||
// 多选
|
||||
const checkoutUses = ref([]);
|
||||
function handleSelect(val) {
|
||||
const checkoutUses = ref<BillHouse[]>([]);
|
||||
function handleSelect(val: BillHouse[]) {
|
||||
checkoutUses.value = val;
|
||||
form.value.residents = checkoutUses.value.join(',');
|
||||
form.value.houseIds = checkoutUses.value.map((item) => item.houseId);
|
||||
}
|
||||
// 删除
|
||||
|
||||
/** 删除房屋 */
|
||||
function delteUse(id: string | number) {
|
||||
checkoutUses.value = checkoutUses.value.filter((item) => item.id !== id);
|
||||
checkoutUses.value = checkoutUses.value.filter((item) => item.houseId !== id);
|
||||
}
|
||||
|
||||
/** 清空 */
|
||||
function handleClearCheckout() {
|
||||
checkoutUses.value = [];
|
||||
form.value.residents = '';
|
||||
form.value.houseIds = [];
|
||||
}
|
||||
// !== 业主 =============================================================================
|
||||
|
||||
// !== 提交 =============================================================================
|
||||
// 提交
|
||||
// TODO 收费项目提交
|
||||
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
@@ -219,7 +256,7 @@ const cancelForm = () => {
|
||||
}
|
||||
|
||||
.formBody {
|
||||
width: 650px;
|
||||
width: 950px;
|
||||
margin: 0 auto;
|
||||
|
||||
.residentBox {
|
||||
@@ -228,21 +265,31 @@ const cancelForm = () => {
|
||||
padding: 10px 5px;
|
||||
}
|
||||
.checkoutSideUsesbox {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 5px;
|
||||
// display: grid;
|
||||
// grid-template-columns: repeat(3, 1fr);
|
||||
// gap: 5px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 10px 5px;
|
||||
li {
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-width: 120px;
|
||||
|
||||
min-width: 240px;
|
||||
height: 35px;
|
||||
padding: 0 10px;
|
||||
line-height: 35px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
background-color: #f3f9ff;
|
||||
border: 1px solid #8fc0f1;
|
||||
|
||||
margin-bottom: 10px;
|
||||
|
||||
@media (max-width: 2000px) {
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -253,6 +300,7 @@ const cancelForm = () => {
|
||||
font-size: 8px;
|
||||
}
|
||||
.el-icon {
|
||||
margin-left: 20px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: red;
|
||||
|
||||
Reference in New Issue
Block a user