修改页面重置不生效问题

This commit is contained in:
GGJ
2024-12-02 14:27:29 +08:00
parent 7b4ef4bd92
commit 7d3eefc1ce
2 changed files with 37 additions and 21 deletions

View File

@@ -213,12 +213,12 @@ const treeData = ref()
const loadData = () => { const loadData = () => {
initDetpStataionTree({ orgId: dictData.state.area[0].id }).then(res => { initDetpStataionTree({ orgId: dictData.state.area[0].id }).then(res => {
treeList.value = res.data treeList.value = res.data
initDetpStataionTree({ orgId: '02d1b4e1680413eb72f3fa63d46c496c' }).then(res => { // initDetpStataionTree({ orgId: '02d1b4e1680413eb72f3fa63d46c496c' }).then(res => {
treeListCgy.value = res.data // treeListCgy.value = res.data
setTimeout(() => { setTimeout(() => {
changeArea() changeArea()
}, 10) }, 10)
}) // })
}) })
} }
@@ -242,7 +242,7 @@ const submitFn = async (flag: boolean) => {
} }
addForm.saveOrCheckflag = '1' addForm.saveOrCheckflag = '1'
await addSurveyPlan(addForm).then(res => { await addSurveyPlan(addForm).then(res => {
cancelFn() cancelFn()
ElMessage.success('保存成功!') ElMessage.success('保存成功!')
emit('onsubmit') emit('onsubmit')
@@ -263,7 +263,7 @@ const submitFn = async (flag: boolean) => {
emit('onsubmit') emit('onsubmit')
}) })
} else { } else {
await updateSurveyPlan(addForm).then(res => { await updateSurveyPlan(addForm).then(res => {
cancelFn() cancelFn()
ElMessage.success('重新发起成功!') ElMessage.success('重新发起成功!')
emit('onsubmit') emit('onsubmit')
@@ -283,14 +283,30 @@ const changeArea = () => {
treeList.value.forEach((item: any) => { treeList.value.forEach((item: any) => {
if (item.id == form.value.deptId) { if (item.id == form.value.deptId) {
list.push(item) list.push(item)
if (item.id != treeListCgy.value[0].id && item.name != '冀北电力有限公司' && item.name != '超高压') {
list.push(...treeListCgy.value)
}
} else { } else {
list.push(item.children.filter((v: any) => v.id == form.value.deptId)[0]) if (item.children.filter((v: any) => v.id == form.value.deptId).length == 0) {
if (form.value.deptId != treeListCgy.value[0].id) { item.children.forEach((v: any) => {
list.push(...treeListCgy.value) list.push(v.children.filter((K: any) => K.id == form.value.deptId)[0])
})
// list.push(item.children.filter((v: any) => {
// return (v.children.filter((k: any) => {
// if( k.id == form.value.deptId){
// return k
// }
// }))
// }))
console.log("🚀 ~ list.push ~ list:", list)
} else {
list.push(item.children.filter((v: any) => v.id == form.value.deptId)[0])
} }
// if (form.value.deptId != treeListCgy.value[0].id) {
// list.push(...treeListCgy.value)
// }
} }
}) })
treeData.value = list treeData.value = list

View File

@@ -2,12 +2,12 @@
<template> <template>
<div class='default-main'> <div class='default-main'>
<TableHeader> <TableHeader>
<template v-slot:select> <template #select>
<el-form-item label='关键词'> <el-form-item label='关键词'>
<el-input <el-input
v-model='tableStore.table.params.searchValue' v-model='tableStore.table.params.searchValue'
clearable clearable
placeholder='关键词模糊查询' placeholder='输入用户名、行业'
/> />
</el-form-item> </el-form-item>
<el-form-item label='区域'> <el-form-item label='区域'>
@@ -161,11 +161,11 @@ const tableStore = new TableStore({
if (tableStore.table.params.addr) { if (tableStore.table.params.addr) {
tableStore.table.params.addrStrOption = tableStore.table.params.addr.map(tempArray => tempArray.join('/')) tableStore.table.params.addrStrOption = tableStore.table.params.addr.map(tempArray => tempArray.join('/'))
} }
for (let key in tableStore.table.params) { // for (let key in tableStore.table.params) {
if (tableStore.table.params[key] === '') { // if (tableStore.table.params[key] === '') {
delete tableStore.table.params[key] // delete tableStore.table.params[key]
} // }
} // }
} }
}) })