物业之前,新工作台

This commit is contained in:
Zy
2026-04-16 21:03:35 +08:00
parent cf9a1f1585
commit 4184f1c55d
91 changed files with 1781 additions and 588 deletions

View File

@@ -14,7 +14,7 @@
</el-form-item>
<el-form-item label="楼栋类型" prop="buildingUse">
<el-select v-model="form.buildingUse" placeholder="选择楼栋类型">
<el-option v-for="(item, index) in housetypelist" :key="index" :label="item" :value="index"></el-option>
<el-option v-for="(item, index) in com_build_use" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="楼栋朝向" prop="buildToward">
@@ -45,13 +45,16 @@
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { getCommunitylistAPI } from '@/api/system/community';
import { addBuildingApi, editBuildingApi } from '@/api/system/house';
import { useRouter } from 'vue-router';
import { useHouseStore } from '@/store/modules/house';
const houseStore = useHouseStore();
const { currentVilageInfo } = storeToRefs(houseStore);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { com_build_use } = toRefs<any>(proxy?.useDict('com_build_use'));
const route = useRoute();
const router = useRouter();
const formRef = ref();
@@ -59,12 +62,11 @@ const form = ref({
buildingName: '',
buildToward: '',
buildTall: '',
buildingUse: 0,
buildingUse: '0',
buildStructure: '',
unitCount: null,
floorCount: null
});
const housetypelist = ['住宅', '办公', '商用', '公寓'];
const rules = ref({
buildingName: [{ required: true, message: '请输入楼栋名称', trigger: 'blur' }],
buildingUse: [{ required: true, message: '请选择楼栋类型', trigger: 'blur' }],
@@ -74,15 +76,12 @@ const rules = ref({
// 判断新增还是编辑
const buildingId = route.query.buildingId as string;
if (buildingId) {
console.log('edit');
getBuildingById();
} else {
console.log('add');
}
/** 编辑楼栋 */
function getBuildingById() {
console.log(houseStore.currentBuildingInfoList);
houseStore.currentBuildingInfoList.forEach((item) => {
if (item.id == buildingId) {
form.value.buildingName = item.buildingName;
@@ -98,9 +97,7 @@ function getBuildingById() {
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
console.log(form.value);
if (buildingId) {
console.log('修改');
editBuildingApi({
...form.value,
villageId: currentVilageInfo.value.villageId,
@@ -115,7 +112,6 @@ const submitForm = () => {
ElMessage.error('修改失败');
});
} else {
console.log(' 添加');
addBuildingApi({
...form.value,
villageId: currentVilageInfo.value.villageId