新增数据,开始安全巡检模块
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('编辑成功');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<div class="flex flex-col h-full p-2">
|
||||
<Pageheader title="装修管理"></Pageheader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-card class="flex-1" shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@@ -146,7 +146,6 @@ const data = reactive<PageData<DecorationForm, DecorationQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
villageId: Number(localStorage.getItem('villageid')),
|
||||
pageSize: 10,
|
||||
houseId: undefined,
|
||||
applyName: undefined,
|
||||
@@ -260,3 +259,9 @@ onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-table {
|
||||
height: calc(100% - 80px);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user