区域管理,景区查询对接

This commit is contained in:
Double-_-Z 2025-07-17 23:00:47 +08:00
parent 55431028c2
commit 5abfccd598
2 changed files with 61 additions and 4 deletions

34
src/api/system/scenic.js Normal file
View File

@ -0,0 +1,34 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'aerocraftAdminApi/emScenic',
method: 'post',
data
})
}
export function del(id) {
return request({
url: `aerocraftAdminApi/emScenic/${id}`,
method: 'delete',
})
}
export function edit(data) {
return request({
url: 'aerocraftAdminApi/emScenic',
method: 'put',
data
})
}
export function list(params) {
return request({
url: 'aerocraftAdminApi/emScenic',
method: 'get',
params
})
}
export default { add, edit, del, list }

View File

@ -6,7 +6,7 @@
<span>区域架构</span>
</div>
<div class="al-tree" v-loading="lamLoading">
<div class="boxShadow" @click="active = list[0].id; crud.title = '区域'" />
<div class="boxShadow" @click="handleSourceClick" />
<el-tree default-expand-all :data="list" :indent="20" icon-class="#"
:props="{ children: 'sons', label: 'name' }" @node-click="handleNodeClick">
<template slot-scope="{node,data}">
@ -74,6 +74,7 @@
</template>
<script>
import crudArea from '@/api/system/area'
import crudScenic from '@/api/system/scenic'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
@ -130,7 +131,7 @@ export default {
},
//
handleNodeClick(data) {
console.log(data)
// console.log('data',data)
},
handleTool(node, data) {
const id = node.level === 4 ? data.parentId : data.id
@ -143,8 +144,27 @@ export default {
const type = node.level === 1
this.crud.title = type ? '区域' : '景区'
this.form.type = type ? 'area' : 'spot'
// console.log(this.parentArr, 'parentArr')
// this.getList(id)
this.getList(id,data)
},
handleSourceClick(){
this.active = this.list[0].id;
this.crud.title = '区域';
this.getList(this.list[0].id,{type:'source'})
},
//
getList(id,{type}){
if(type === 'area'){
this.crud.url = '/aerocraftAdminApi/emScenic'
this.crud.query.areaId = id;
this.crud.form.areaId = id;
this.crud.crudMethod = {...crudScenic};
this.crud.refresh();
}else if(type === 'source'){
this.crud.url = '/aerocraftAdminApi/emArea';
delete this.crud.query.areaId;
this.crud.crudMethod = {...crudArea};
this.crud.refresh();
}
},
[CRUD.HOOK.beforeRefresh](crud, form) {
crud.query.current = crud.page.page;
@ -152,6 +172,9 @@ export default {
[CRUD.HOOK.afterSubmit](crud, form) {
this.getTrees();
},
[CRUD.HOOK.afterDelete](crud, form) {
this.getTrees();
},
getTree() {
return new Promise(resolve => {
// tree().then(res => {