物业之前,新工作台
This commit is contained in:
@@ -125,7 +125,7 @@ const route = useRoute();
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
id: null,
|
||||
villageId: '', // 所属小区id
|
||||
villageId: Number(localStorage.getItem('villageid')), // 所属小区id
|
||||
areaId: null, // 区域id
|
||||
parkingId: '', // 车位id
|
||||
chargeItem: '0', // 临时停车
|
||||
@@ -177,31 +177,25 @@ const rules = ref({
|
||||
});
|
||||
const userid = ref(null);
|
||||
|
||||
// 小区
|
||||
const currentviliage = ref();
|
||||
// 区域
|
||||
const CarArealist = ref([]);
|
||||
// 车位
|
||||
const Parkinglist = ref([]);
|
||||
function init() {
|
||||
getCommunitylistAPI().then((res) => {
|
||||
currentviliage.value = res.rows.find((item) => item.choiceStatus === 0);
|
||||
listArea().then((res) => {
|
||||
CarArealist.value = res.rows;
|
||||
});
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
form.value.id = userid.value;
|
||||
getParkingCost(userid.value).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
checkDate.value = [form.value.startTime, form.value.endTime];
|
||||
});
|
||||
}
|
||||
form.value.villageId = currentviliage.value.villageId;
|
||||
listArea().then((res) => {
|
||||
CarArealist.value = res.rows;
|
||||
});
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
form.value.id = userid.value;
|
||||
getParkingCost(userid.value).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
checkDate.value = [form.value.startTime, form.value.endTime];
|
||||
});
|
||||
}
|
||||
}
|
||||
init();
|
||||
|
||||
@@ -221,15 +215,14 @@ function handleArea(val: string) {
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
form.value.villageId = Number(localStorage.getItem('villageid'));
|
||||
if (userid.value) {
|
||||
updateParkingCost(form.value).then((res) => {
|
||||
console.log(res);
|
||||
ElMessage.success('编辑成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
addParkingCost(form.value).then((res) => {
|
||||
console.log(res);
|
||||
ElMessage.success('添加成功');
|
||||
|
||||
cancelForm();
|
||||
|
||||
Reference in New Issue
Block a user