同步
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<el-input v-model.trim="form.billName" placeholder="请输入账单名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="收费项目" prop="chargeItemId">
|
||||
<el-select v-model="form.chargeItemId" @change="handleChange">
|
||||
<el-select v-model="form.chargeItemId" @change="(val: string) => handleChange(val, true)">
|
||||
<el-option
|
||||
:disabled="item.status === '1'"
|
||||
v-for="(item, index) in chargeitemlist"
|
||||
@@ -21,20 +21,23 @@
|
||||
</el-form-item>
|
||||
<!-- 水费,电费, 收费范围为 房屋 -->
|
||||
<el-form-item label="收费范围" prop="chargeScope" v-if="typeNamelist.includes(typeName)">
|
||||
<div class="flex flex-row flex-items-end">
|
||||
<el-radio-group v-model="form.chargeScope">
|
||||
<div class="flex flex-col flex-items-end">
|
||||
<el-radio
|
||||
style="margin-right: 0"
|
||||
v-for="(item, index) in com_bill_charge_scope_house"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
></el-radio>
|
||||
<div>
|
||||
<div class="flex flex-row flex-items-end">
|
||||
<el-radio-group v-model="form.chargeScope">
|
||||
<div class="flex flex-col flex-items-end">
|
||||
<el-radio
|
||||
:disabled="!form.chargeItemId"
|
||||
style="margin-right: 0"
|
||||
v-for="(item, index) in com_bill_charge_scope_house"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
></el-radio>
|
||||
</div>
|
||||
</el-radio-group>
|
||||
<div style="height: 32px">
|
||||
<el-button @click="OpenUseTablesfun('house')" link type="primary" v-if="form.chargeScope === '1'" class="ml-10px">请选择</el-button>
|
||||
</div>
|
||||
</el-radio-group>
|
||||
<div style="height: 32px">
|
||||
<el-button @click="OpenUseTablesfun('house')" link type="primary" v-if="form.chargeScope === '1'" class="ml-10px">请选择</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -45,6 +48,7 @@
|
||||
<div class="flex flex-col flex-items-end">
|
||||
<el-radio
|
||||
style="margin-right: 0"
|
||||
:disabled="!form.chargeItemId"
|
||||
v-for="(item, index) in com_questionnaire_scope"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
@@ -65,7 +69,11 @@
|
||||
</el-form-item>
|
||||
<!-- 业主选择 -->
|
||||
<el-form-item v-if="form.chargeScope === '1' && !typeNamelist.includes(typeName)">
|
||||
<div class="residentBox">
|
||||
<!-- 业主选择 车位费用 -->
|
||||
<div class="residentBox" v-if="typeName === HandleTypeId.Resident.Parking">
|
||||
<CarUser returnvalue="parkingId" ref="ParkinguserRef" :isMultiple="true" @change="handleCheckPaking"></CarUser>
|
||||
</div>
|
||||
<div class="residentBox" v-else>
|
||||
<UserHolder returnvalue="residentId" ref="userRef" :isMultiple="true" @change="handleCheckUser"></UserHolder>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@@ -74,18 +82,32 @@
|
||||
<el-option v-for="(item, index) in com_bill_charge_period" :key="index" :value="item.value" :label="item.label"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="起止日期" prop="price">
|
||||
<el-form-item label="起止日期" prop="startDate">
|
||||
<el-date-picker
|
||||
v-model="StartEndDate"
|
||||
unlink-panels
|
||||
@update:model-value="handleDate"
|
||||
:value-format="datepicker[form.chargePeriod].format"
|
||||
:format="datepicker[form.chargePeriod].format"
|
||||
:type="datepicker[form.chargePeriod].type"
|
||||
@clear="handleClear"
|
||||
:value-format="datepicker[2].format"
|
||||
:format="datepicker[2].format"
|
||||
:type="datepicker[2].type"
|
||||
range-separator="到"
|
||||
start-placeholder="开始"
|
||||
end-placeholder="结束"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="结束日期" prop="price">
|
||||
<el-date-picker
|
||||
v-model="StartEndDate"
|
||||
@update:model-value="handleDate"
|
||||
:value-format="datepicker[2].format"
|
||||
:format="datepicker[2].format"
|
||||
:type="datepicker[2].type"
|
||||
range-separator="到"
|
||||
start-placeholder="开始"
|
||||
end-placeholder="结束"
|
||||
/>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" :rows="5" v-model.trim="form.remark" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
@@ -102,14 +124,16 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
import House from '@/components/Holder/house.vue';
|
||||
import UserHolder from '@/components/Holder/user.vue';
|
||||
import CarUser from '@/components/Holder/CarUser.vue';
|
||||
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { listChargeItem } from '@/api/system/SdbChargeItem';
|
||||
import { getBill, updateBill, addBill, BillHouse, listBillHouse, queryResidentList_holder } from '@/api/system/SdbBill';
|
||||
import type { DatePickerType } from 'element-plus';
|
||||
import { 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'));
|
||||
@@ -137,7 +161,8 @@ const form = ref({
|
||||
'chargePeriod': '2', // 费用周期
|
||||
houseIds: [], // 部分房屋
|
||||
residentIds: [], // 部分业主
|
||||
charegeTypeId: '', // typeid
|
||||
parkingIds: [],
|
||||
chargeTypeId: '', // typeid
|
||||
'startDate': '', // 开始
|
||||
'endDate': '', // 结束
|
||||
'remark': ''
|
||||
@@ -154,10 +179,18 @@ const userid = ref(null);
|
||||
// 开始结束日期
|
||||
const StartEndDate = ref([]);
|
||||
function handleDate(val: string[]) {
|
||||
form.value.startDate = formatDate2(val[0]);
|
||||
form.value.endDate = formatDate2(val[1]);
|
||||
if (val === null || val.length === 0) {
|
||||
form.value.startDate = '';
|
||||
form.value.endDate = '';
|
||||
} else {
|
||||
form.value.startDate = val[0] + ' 00:00:00';
|
||||
form.value.endDate = val[1] + ' 23:59:59';
|
||||
}
|
||||
}
|
||||
function handleClear() {
|
||||
form.value.startDate = '';
|
||||
form.value.endDate = '';
|
||||
}
|
||||
|
||||
// 收费类型
|
||||
const chargeitemlist = ref([]);
|
||||
|
||||
@@ -166,62 +199,74 @@ const chargeitemlist = ref([]);
|
||||
// // 住户列表
|
||||
// const userlist = ref([]);
|
||||
async function init() {
|
||||
listChargeItem().then((res) => {
|
||||
listChargeItem({}).then((res) => {
|
||||
chargeitemlist.value = res.rows;
|
||||
|
||||
// const res = await listBillHouse({ pageNum: 1, pageSize: 999999 });
|
||||
// houselist.value = res.rows;
|
||||
// const res2 = await queryResidentList_holder({ pageNum: 1, pageSize: 999999 });
|
||||
// userlist.value = res2.rows;
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getBill(userid.value).then((res) => {
|
||||
if (!res.data) return;
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
// TODO 没有住户参数
|
||||
form.value.houseIds = res.data.houseIds || [];
|
||||
form.value.residentIds = res.data.residentIds || [];
|
||||
form.value.parkingIds = res.data.parkingIds || [];
|
||||
form.value.startDate = formatDate2(form.value.startDate);
|
||||
form.value.endDate = formatDate2(form.value.endDate);
|
||||
StartEndDate.value = [form.value.startDate, form.value.endDate];
|
||||
// TODO houseid 有默认值, 需要处理
|
||||
// TODO residentids 添加,
|
||||
checkoutHouses.value = [];
|
||||
checkoutUser.value = [];
|
||||
checkoutParking.value = [];
|
||||
checkoutHouses.value = form.value.houseIds.filter((item) => item);
|
||||
checkoutUser.value = form.value.residentIds.filter((item) => item);
|
||||
checkoutParking.value = form.value.parkingIds.filter((item) => item);
|
||||
handleChange(form.value.chargeItemId);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// const res = await listBillHouse({ pageNum: 1, pageSize: 999999 });
|
||||
// houselist.value = res.rows;
|
||||
// const res2 = await queryResidentList_holder({ pageNum: 1, pageSize: 999999 });
|
||||
// userlist.value = res2.rows;
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
getBill(userid.value).then((res) => {
|
||||
if (!res.data) return;
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
// TODO 没有住户参数
|
||||
form.value.houseIds = res.data.houseIds || [];
|
||||
form.value.residentIds = res.data.residentIds || [];
|
||||
form.value.startDate = formatDate2(form.value.startDate);
|
||||
form.value.endDate = formatDate2(form.value.endDate);
|
||||
StartEndDate.value = [form.value.startDate, form.value.endDate];
|
||||
// TODO houseid 有默认值, 需要处理
|
||||
// TODO residentids 添加,
|
||||
checkoutHouses.value = form.value.houseIds.filter((item) => item);
|
||||
handleChange(form.value.chargeItemId);
|
||||
});
|
||||
}
|
||||
}
|
||||
init();
|
||||
|
||||
const typeNamelist = ref(['2049026484272791553', '2049026503017136129']);
|
||||
const HandleTypeId = {
|
||||
/** 显示房屋 */
|
||||
'House': {
|
||||
/** 水费 */
|
||||
'Water': '2049026484272791553',
|
||||
/** 电费 */
|
||||
'Electricity': '2049026503017136129'
|
||||
},
|
||||
/** 显示业主 */
|
||||
'Resident': {
|
||||
/** 车位费 */
|
||||
'Parking': '2049026574236418050'
|
||||
}
|
||||
};
|
||||
// 符合类型: 显示房屋,选择房屋
|
||||
const typeNamelist = ref([HandleTypeId.House.Water, HandleTypeId.House.Electricity]);
|
||||
const typeName = ref('');
|
||||
// 获取收费类型id
|
||||
function handleChange(val: string) {
|
||||
function handleChange(val: string, callback: boolean = false) {
|
||||
const find = chargeitemlist.value.find((item) => item.id === val);
|
||||
if (find) {
|
||||
form.value.charegeTypeId = find.typeId;
|
||||
form.value.chargeTypeId = find.typeId;
|
||||
typeName.value = find.typeId;
|
||||
handleClearCheckout();
|
||||
if (callback) {
|
||||
handleClearCheckout();
|
||||
}
|
||||
}
|
||||
}
|
||||
// !== 业主 =============================================================================
|
||||
|
||||
// 打开
|
||||
const HolderRef = ref<InstanceType<typeof House>>();
|
||||
const userRef = ref<InstanceType<typeof UserHolder>>();
|
||||
function OpenUseTablesfun(val: string) {
|
||||
console.log(val);
|
||||
if (val === 'house') {
|
||||
HolderRef.value.open(checkoutHouses.value);
|
||||
} else if (val === 'user') {
|
||||
userRef.value.open(checkoutUser.value);
|
||||
}
|
||||
}
|
||||
// 多选
|
||||
const checkoutHouses = ref<string[]>([]);
|
||||
function handleSelect(val: string[]) {
|
||||
@@ -233,9 +278,15 @@ const checkoutUser = ref([]);
|
||||
/** 添加 业主 */
|
||||
function handleCheckUser(val: string[]) {
|
||||
checkoutUser.value = val;
|
||||
console.log(val);
|
||||
form.value.residentIds = val;
|
||||
}
|
||||
const checkoutParking = ref([]);
|
||||
/** 添加 车位业主 */
|
||||
function handleCheckPaking(val: string[]) {
|
||||
checkoutParking.value = val;
|
||||
console.log(val);
|
||||
form.value.parkingIds = val;
|
||||
}
|
||||
|
||||
/** 清空 */
|
||||
function handleClearCheckout() {
|
||||
@@ -244,10 +295,27 @@ function handleClearCheckout() {
|
||||
form.value.residentIds = [];
|
||||
form.value.houseIds = [];
|
||||
}
|
||||
|
||||
// 打开
|
||||
const HolderRef = ref<InstanceType<typeof House>>();
|
||||
const userRef = ref<InstanceType<typeof UserHolder>>();
|
||||
const ParkinguserRef = ref<InstanceType<typeof CarUser>>();
|
||||
function OpenUseTablesfun(val: string) {
|
||||
if (val === 'house') {
|
||||
HolderRef.value.open(checkoutHouses.value);
|
||||
} else if (val === 'user') {
|
||||
if (typeName.value === HandleTypeId.Resident.Parking) {
|
||||
ParkinguserRef.value.open(checkoutParking.value);
|
||||
} else {
|
||||
userRef.value.open(checkoutUser.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
// !== 业主 =============================================================================
|
||||
|
||||
// !== 提交 =============================================================================
|
||||
const submitForm = () => {
|
||||
console.log(form.value);
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (userid.value) {
|
||||
|
||||
Reference in New Issue
Block a user