File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ import request from '@/config/axios'
2
+
3
+ // 获得地区树
4
+ export const getAreaTree = async ( ) => {
5
+ return await request . get ( { url : '/system/area/tree' } )
6
+ }
7
+
8
+ // 获得 IP 对应的地区名
9
+ export const getDeptApi = async ( ip : string ) => {
10
+ return await request . get ( { url : '/system/area/get-by-ip?ip=' + ip } )
11
+ }
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <ContentWrap >
3
+ <div style =" width : 100% ; height : 500px " >
4
+ <el-auto-resizer >
5
+ <template #default =" { height , width } " >
6
+ <el-table-v2
7
+ :columns =" columns"
8
+ :data =" tableData"
9
+ :width =" width"
10
+ :height =" height"
11
+ fixed
12
+ expand-column-key =" id"
13
+ />
14
+ </template >
15
+ </el-auto-resizer >
16
+ </div >
17
+ </ContentWrap >
18
+ </template >
19
+ <script setup lang="tsx">
20
+ import { Column , ElTableV2 } from ' element-plus'
21
+ import * as AreaApi from ' @/api/system/area'
22
+
23
+ const columns: Column [] = [
24
+ {
25
+ key: ' id' ,
26
+ dataKey: ' id' , // 需要渲染当前列的数据字段,如{id:9527,name:'Mike'},则填id
27
+ title: ' 编号' , // 显示在单元格表头的文本
28
+ width: 200 , // 当前列的宽度,必须设置
29
+ fixed: true // 是否固定列
30
+ },
31
+ {
32
+ key: ' name' ,
33
+ dataKey: ' name' ,
34
+ title: ' 地名' ,
35
+ width: 200
36
+ }
37
+ ]
38
+
39
+ const tableData = ref ([])
40
+
41
+ const getList = async () => {
42
+ tableData .value = await AreaApi .getAreaTree ()
43
+ }
44
+
45
+ getList ()
46
+ </script >
You can’t perform that action at this time.
0 commit comments