新增数据,开始安全巡检模块

This commit is contained in:
Zy
2026-04-17 19:39:21 +08:00
parent 4184f1c55d
commit 9a95e2b7e3
74 changed files with 1942 additions and 403 deletions

View File

@@ -58,10 +58,10 @@ import PageHeader from '@/components/Pageheader/index.vue';
import { addDecoration, getDecoration, updateDecoration } from '@/api/system/Decoration';
import { useHouseStore } from '@/store/modules/house';
import { CascaderValue } from 'element-plus';
import { getHousePathById } from '@/utils/house';
const houseStore = useHouseStore();
const { treedata } = storeToRefs(houseStore);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const treedata = ref([]);
const route = useRoute();
const router = useRouter();
@@ -69,7 +69,6 @@ const formRef = ref();
const form = ref({
'id': null,
'houseId': null,
villageId: Number(localStorage.getItem('villageid')),
'applyName': '',
'decorationCompany': '',
'decorationContent': '',
@@ -83,21 +82,6 @@ const rules = {
};
const userid = ref();
// ! 投诉 ====================================================================================================
function init() {
getDecoration(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
});
}
if (route.query.id) {
userid.value = route.query.id;
init();
}
// 获取房屋
const userHousepath = ref([]);
function handleChange(val: (string | number)[]) {
@@ -107,11 +91,34 @@ function handleChange(val: (string | number)[]) {
form.value.houseId = null;
}
}
// ! 投诉 ====================================================================================================
function getTree() {
houseStore.getCurrentVilageTreeHouse().then((res) => {
treedata.value = res;
if (route.query.id) {
userid.value = route.query.id;
init();
}
});
}
getTree();
function init() {
getDecoration(userid.value).then((res) => {
form.value = {
...form.value,
...res.data
};
const arr = getHousePathById(treedata.value, form.value.houseId);
console.log(arr);
userHousepath.value = arr;
});
}
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.villageId = Number(localStorage.getItem('villageid'));
if (userid.value) {
updateDecoration(form.value).then(() => {
ElMessage.success('编辑成功');