新增数据,开始安全巡检模块
This commit is contained in:
@@ -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('编辑成功');
|
||||
|
||||
Reference in New Issue
Block a user