物业之前,新工作台
This commit is contained in:
@@ -66,10 +66,9 @@
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getBuildinglistAPI, getBuildinglists, getBuildingOnly, getHouselistAPI } from '@/api/system/house';
|
||||
import { getCommunitylistAPI } from '@/api/system/community';
|
||||
import { addStoreroom, getStoreroom } from '@/api/system/storeroom';
|
||||
import { addStoreroom, getStoreroom, updateStoreroom } from '@/api/system/storeroom';
|
||||
import { StoreroomVO } from '@/api/system/storeroom/types';
|
||||
import { N } from 'vue-router/dist/index-DFCq6eJK.js';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const formRef = ref();
|
||||
@@ -94,12 +93,10 @@ const rules = ref({
|
||||
const storeRoomid = ref(null);
|
||||
const units = ref([]);
|
||||
const Buildinglists = ref([]);
|
||||
const currentVilage = ref(null);
|
||||
|
||||
// 获取储藏室信息
|
||||
function getStoreRoominfo(id: string) {
|
||||
getStoreroom(id).then((res) => {
|
||||
console.log(res);
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
@@ -110,7 +107,6 @@ function getStoreRoominfo(id: string) {
|
||||
function init() {
|
||||
getBuildinglists().then((res) => {
|
||||
Buildinglists.value = res.rows;
|
||||
console.log(res.rows);
|
||||
});
|
||||
}
|
||||
init();
|
||||
@@ -121,7 +117,6 @@ if (route.query.id) {
|
||||
// 根据楼栋id获取单元
|
||||
function handleChangeBuild(val: string) {
|
||||
getBuildingOnly(val).then((res) => {
|
||||
console.log(res);
|
||||
units.value = Array.from({ length: res.data.unitCount }).map((_, index) => {
|
||||
return {
|
||||
no: index + 1,
|
||||
@@ -134,21 +129,24 @@ const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
...form.value
|
||||
...form.value,
|
||||
villageId: Number(localStorage.getItem('villageid'))
|
||||
};
|
||||
if (storeRoomid.value !== null) {
|
||||
console.log('修改');
|
||||
updateStoreroom(data).then(() => {
|
||||
ElMessage.success('修改成功');
|
||||
cancelForm();
|
||||
});
|
||||
} else {
|
||||
console.log('新增');
|
||||
addStoreroom(data).then((res) => {
|
||||
console.log(res);
|
||||
addStoreroom(data).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
cancelForm();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
const cancelForm = () => {
|
||||
console.log('取消');
|
||||
router.push({
|
||||
path: '/house/storeroom'
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user