diff --git a/web/public/config/columnList.js b/web/public/config/columnList.js
index 1af2d2b..d2a4ec6 100644
--- a/web/public/config/columnList.js
+++ b/web/public/config/columnList.js
@@ -113,6 +113,46 @@ export const columnList = [
}
]
},
+ {
+ page: 'permission',
+ columns: [
+ {
+ title: '权限ID',
+ dataIndex: 'permission_id',
+ key: 'permission_id',
+ ellipsis: true,
+ // filterable: true,
+ fixed: 'left'
+ },
+ {
+ title: '权限名称',
+ dataIndex: 'name',
+ key: 'name'
+ // filterable: true
+ },
+ {
+ title: '权限描述',
+ dataIndex: 'describe',
+ key: 'describe',
+ ellipsis: true
+ // filterable: true
+ },
+
+ {
+ title: '是否启用',
+ dataIndex: 'is_open',
+ key: 'is_open',
+ scopedSlots: { customRender: 'is_open' }
+ }
+
+ // {
+ // title: '操作',
+ // dataIndex: 'operate',
+ // key: 'operate',
+ // scopedSlots: { customRender: 'action' }
+ // }
+ ]
+ },
{
page: 'station',
columns: [
@@ -139,16 +179,12 @@ export const columnList = [
{
title: '场站经度',
dataIndex: 'lon',
- width: 50,
key: 'lon'
- // filterable: true
},
{
title: '场站纬度',
dataIndex: 'lat',
- width: 50,
key: 'lat'
- // filterable: true
},
{
title: '储能容量',
@@ -164,10 +200,9 @@ export const columnList = [
// filterable: true
},
{
- title: '场站类别',
+ title: '储能容量',
dataIndex: 'capacity',
- key: 'capacity',
- scopedSlots: { customRender: 'capacity' }
+ key: 'capacity'
},
{
title: '场站状态',
@@ -188,6 +223,50 @@ export const columnList = [
scopedSlots: { customRender: 'policy_id' }
},
+ {
+ title: '操作',
+ dataIndex: 'operate',
+ key: 'operate',
+ scopedSlots: { customRender: 'action' }
+ }
+ ]
+ },
+ {
+ page: 'serviceApi',
+ columns: [
+ {
+ title: '接口ID',
+ dataIndex: 'api_id',
+ key: 'api_id',
+ ellipsis: true,
+ // filterable: true,
+ fixed: 'left'
+ },
+ {
+ title: '接口名称',
+ dataIndex: 'name',
+ key: 'name'
+ // filterable: true
+ },
+ {
+ title: '接口描述',
+ dataIndex: 'describe',
+ key: 'describe'
+ // filterable: true
+ },
+ {
+ title: '接口参数',
+ dataIndex: 'params',
+ key: 'params'
+ },
+
+ {
+ title: '是否启用',
+ dataIndex: 'is_open',
+ key: 'is_open',
+ scopedSlots: { customRender: 'is_open' }
+ },
+
{
title: '操作',
dataIndex: 'operate',
@@ -277,8 +356,54 @@ export const roleOptions = [
value: '',
key: 'permission',
type: 'slot',
- slotName: 'permission',
- className: 'item-l'
+ slotName: 'treetable',
+ className: 'item-l',
+ tableData: [],
+ selectTableData: [],
+ columns: [
+ {
+ title: '名称',
+ dataIndex: 'name',
+ key: 'name',
+ ellipsis: true,
+ filterable: true,
+ fixed: 'left'
+ },
+ {
+ title: '页面路径',
+ dataIndex: 'route',
+ key: 'route'
+ // filterable: true
+ },
+ {
+ title: '是否允许新增操作',
+ dataIndex: 'is_add',
+ key: 'is_add',
+ align: 'center',
+ scopedSlots: { customRender: 'is_add' }
+ },
+ {
+ title: '是否允许删除操作',
+ dataIndex: 'is_del',
+ key: 'is_del',
+ align: 'center',
+ scopedSlots: { customRender: 'is_del' }
+ },
+ {
+ title: '是否允许编辑操作',
+ dataIndex: 'is_edit',
+ key: 'is_edit',
+ align: 'center',
+ scopedSlots: { customRender: 'is_edit' }
+ },
+ {
+ title: '是否允许查看操作',
+ dataIndex: 'is_view',
+ key: 'is_view',
+ align: 'center',
+ scopedSlots: { customRender: 'isQuery' }
+ }
+ ]
},
{
// 0:禁用; 1:启用
@@ -417,6 +542,51 @@ export const stationOptions = [
ruleForm: {}
}
]
+export const serviceApiOptions = [
+ {
+ title: '基础信息',
+ icon: 'icon-xinxi',
+ list: [
+ {
+ label: '接口名称',
+ value: '',
+ key: 'name',
+ type: 'input'
+ },
+ {
+ label: '接口参数',
+ value: '',
+ key: 'params',
+ type: 'input'
+ },
+ {
+ label: '接口描述',
+ value: '',
+ key: 'describe',
+ type: 'textarea'
+ },
+
+ {
+ label: '是否启用',
+ value: '',
+ key: 'is_open',
+ type: 'switch',
+ className: 'item-l',
+ list: [
+ {
+ label: '禁用',
+ value: '0'
+ },
+ {
+ label: '启用',
+ value: '1'
+ }
+ ]
+ }
+ ],
+ ruleForm: {}
+ }
+]
export const userFormRules = {
account: [
@@ -452,3 +622,12 @@ export const stationFormRules = {
}
]
}
+export const serviceApiFormRules = {
+ name: [
+ {
+ trigger: 'blur',
+ required: true,
+ message: '请输入接口名称'
+ }
+ ]
+}
diff --git a/web/src/components/ComTable.vue b/web/src/components/ComTable.vue
index 2e68ecd..286a1f5 100644
--- a/web/src/components/ComTable.vue
+++ b/web/src/components/ComTable.vue
@@ -108,7 +108,7 @@ const props = defineProps({
default: () => {
return {
count: 1,
- pageSize: 10,
+ pageSize: 5,
page: 1
}
}
@@ -410,30 +410,8 @@ defineExpose({ ...toRefs(data), loading, mountedScroll, scroll: data.scroll })
background-color: transparent !important;
}
-:deep(
- .ant-table-wrapper
- .ant-table.ant-table-bordered
- > .ant-table-container
- > .ant-table-body
- > table
- > tbody
- > tr
- > .ant-table-cell-fix-right-first::after
- ) {
- // border-inline-end: 1px solid var(--theme-bg) !important;
-}
-:deep(
- .ant-table-wrapper
- .ant-table.ant-table-bordered
- > .ant-table-container
- > .ant-table-header
- > table
- > thead
- > tr
- > .ant-table-cell-fix-right-first::after
- ) {
- // border-inline-end: 1px solid var(--theme-bg) !important;
-}
+
+
:deep(.ant-table-wrapper .ant-table-thead th.ant-table-column-has-sorters:hover) {
background: var(--table-select) !important;
diff --git a/web/src/components/EditCom.vue b/web/src/components/EditCom.vue
index de72d0f..777ad56 100644
--- a/web/src/components/EditCom.vue
+++ b/web/src/components/EditCom.vue
@@ -27,31 +27,28 @@
-
- {{
- record.isQuery ? '启用' : '禁用'
- }}
+
+
-
- {{
- record.isEdit ? '启用' : '禁用'
- }}
+
+
-
- {{
- record.isControl ? '启用' : '禁用'
- }}
+
+
+
+
+
@@ -66,10 +63,15 @@
+
diff --git a/web/src/main.js b/web/src/main.js
index b5a94a2..58f1436 100644
--- a/web/src/main.js
+++ b/web/src/main.js
@@ -15,11 +15,13 @@ import { message } from 'ant-design-vue'
import VueTianditu from 'vue-tianditu'
import SearchBox from '@/components/SearchBox.vue'
import ComTable from '@/components/ComTable.vue'
+import TreeTable from '@/components/TreeTable.vue'
const app = createApp(App)
app.component('SearchBox', SearchBox)
app.component('ComTable', ComTable)
+app.component('TreeTable', TreeTable)
app.config.globalProperties.$echarts = echarts // 挂载到全局属性
app.config.globalProperties.$setWidth = setWidth // 挂载到全局属性
diff --git a/web/src/router/index.js b/web/src/router/index.js
index b6da209..680b2cc 100644
--- a/web/src/router/index.js
+++ b/web/src/router/index.js
@@ -60,7 +60,9 @@ export const routes = [
{
name: 'permission',
path: 'permission',
- title: '权限管理'
+ title: '权限管理',
+ component: () =>
+ import(/* webpackChunkName: "system" */ '@/views/system/permission.vue')
},
{
name: 'station',
@@ -71,7 +73,8 @@ export const routes = [
{
name: 'service',
path: 'service',
- title: '服务管理'
+ title: '服务管理',
+ component: () => import(/* webpackChunkName: "system" */ '@/views/system/service.vue')
},
{
path: 'policy',
diff --git a/web/src/utils/btnList.js b/web/src/utils/btnList.js
index b79a84d..0e79e0e 100644
--- a/web/src/utils/btnList.js
+++ b/web/src/utils/btnList.js
@@ -14,8 +14,8 @@ const btnList = [
// isQuery: true;
// }
function getBtns(arr) {
- const permissions =
- JSON.parse(localStorage.getItem('user')).userExtend.role.permissionList[0] || {}
+ // const permissions =
+ // JSON.parse(localStorage.getItem('user')) || {}
const btns = []
btnList.forEach((item) => {
if (arr.includes(item.label)) {
diff --git a/web/src/utils/column.js b/web/src/utils/column.js
index de36cb7..c53d08c 100644
--- a/web/src/utils/column.js
+++ b/web/src/utils/column.js
@@ -6,7 +6,7 @@ const colWidth = [
},
{
label: '名称',
- width: 200,
+ width: 150,
align: 'left',
sorter: (a, b) => {
return a.name.localeCompare(b.name)
@@ -70,7 +70,7 @@ const colWidth = [
label: '操作',
align: 'center',
width: 200,
- fixed: 'right',
+ // fixed: 'right',
resizable: false
}
]
diff --git a/web/src/utils/gcj02ToWgs84.js b/web/src/utils/gcj02ToWgs84.js
index f97fb5b..9edc3b5 100644
--- a/web/src/utils/gcj02ToWgs84.js
+++ b/web/src/utils/gcj02ToWgs84.js
@@ -1,80 +1,80 @@
-// /**
-// * 判断是否在中国境外
-// */
-// function outOfChina(lng, lat) {
-// return !(lng >= 72.004 && lng <= 137.8347 && lat >= 0.8293 && lat <= 55.8271)
-// }
+/**
+ * 判断是否在中国境外
+ */
+function outOfChina(lng, lat) {
+ return !(lng >= 72.004 && lng <= 137.8347 && lat >= 0.8293 && lat <= 55.8271)
+}
-// /**
-// * 辅助函数:纬度转换
-// */
-// function _transformLat(x, y) {
-// let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
-// ret += ((20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0) / 3.0
-// ret += ((20.0 * Math.sin(y * Math.PI) + 40.0 * Math.sin((y / 3.0) * Math.PI)) * 2.0) / 3.0
-// ret +=
-// ((160.0 * Math.sin((y / 12.0) * Math.PI) + 320 * Math.sin((y * Math.PI) / 30.0)) * 2.0) / 3.0
-// return ret
-// }
+/**
+ * 辅助函数:纬度转换
+ */
+function _transformLat(x, y) {
+ let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
+ ret += ((20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0) / 3.0
+ ret += ((20.0 * Math.sin(y * Math.PI) + 40.0 * Math.sin((y / 3.0) * Math.PI)) * 2.0) / 3.0
+ ret +=
+ ((160.0 * Math.sin((y / 12.0) * Math.PI) + 320 * Math.sin((y * Math.PI) / 30.0)) * 2.0) / 3.0
+ return ret
+}
-// /**
-// * 辅助函数:经度转换
-// */
-// function _transformLng(x, y) {
-// let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
-// ret += ((20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0) / 3.0
-// ret += ((20.0 * Math.sin(x * Math.PI) + 40.0 * Math.sin((x / 3.0) * Math.PI)) * 2.0) / 3.0
-// ret +=
-// ((150.0 * Math.sin((x / 12.0) * Math.PI) + 300.0 * Math.sin((x / 30.0) * Math.PI)) * 2.0) / 3.0
-// return ret
-// }
+/**
+ * 辅助函数:经度转换
+ */
+function _transformLng(x, y) {
+ let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
+ ret += ((20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0) / 3.0
+ ret += ((20.0 * Math.sin(x * Math.PI) + 40.0 * Math.sin((x / 3.0) * Math.PI)) * 2.0) / 3.0
+ ret +=
+ ((150.0 * Math.sin((x / 12.0) * Math.PI) + 300.0 * Math.sin((x / 30.0) * Math.PI)) * 2.0) / 3.0
+ return ret
+}
-// /**
-// * GCJ-02 (高德/腾讯坐标系) 转 WGS-84 (GPS原始坐标系)
-// * @param {number} lng GCJ-02经度
-// * @param {number} lat GCJ-02纬度
-// * @returns {number[]} [WGS-84经度, WGS-84纬度]
-// */
-// export function gcj02ToWgs84(lng, lat) {
-// // 判断是否在中国境内(简化版,实际需更完整判断)
-// if (outOfChina(lng, lat)) {
-// return [lng, lat] // 境外坐标不转换
-// }
+/**
+ * GCJ-02 (高德/腾讯坐标系) 转 WGS-84 (GPS原始坐标系)
+ * @param {number} lng GCJ-02经度
+ * @param {number} lat GCJ-02纬度
+ * @returns {number[]} [WGS-84经度, WGS-84纬度]
+ */
+export function gcj02ToWgs84(lng, lat) {
+ // 判断是否在中国境内(简化版,实际需更完整判断)
+ if (outOfChina(lng, lat)) {
+ return [lng, lat] // 境外坐标不转换
+ }
-// let dlat = _transformLat(lng - 105.0, lat - 35.0)
-// let dlng = _transformLng(lng - 105.0, lat - 35.0)
+ let dlat = _transformLat(lng - 105.0, lat - 35.0)
+ let dlng = _transformLng(lng - 105.0, lat - 35.0)
-// const radlat = (lat / 180.0) * Math.PI
-// let magic = Math.sin(radlat)
-// magic = 1 - 0.00669342162296594323 * magic * magic
-// const sqrtmagic = Math.sqrt(magic)
+ const radlat = (lat / 180.0) * Math.PI
+ let magic = Math.sin(radlat)
+ magic = 1 - 0.00669342162296594323 * magic * magic
+ const sqrtmagic = Math.sqrt(magic)
-// dlat =
-// (dlat * 180.0) / (((6378245.0 * (1 - 0.00669342162296594323)) / (magic * sqrtmagic)) * Math.PI)
-// dlng = (dlng * 180.0) / ((6378245.0 / sqrtmagic) * Math.cos(radlat) * Math.PI)
+ dlat =
+ (dlat * 180.0) / (((6378245.0 * (1 - 0.00669342162296594323)) / (magic * sqrtmagic)) * Math.PI)
+ dlng = (dlng * 180.0) / ((6378245.0 / sqrtmagic) * Math.cos(radlat) * Math.PI)
-// // 初始转换结果(粗略值)
-// let wgsLat = lat - dlat
-// let wgsLng = lng - dlng
+ // 初始转换结果(粗略值)
+ let wgsLat = lat - dlat
+ let wgsLng = lng - dlng
-// return [wgsLng, wgsLat]
-// }
+ return [wgsLng, wgsLat]
+}
-// /**
-// * WGS-84 转 GCJ-02(用于迭代优化)
-// */
-// function wgs84ToGcj02(lng, lat) {
-// if (outOfChina(lng, lat)) {
-// return [lng, lat]
-// }
-// let dlat = _transformLat(lng - 105.0, lat - 35.0)
-// let dlng = _transformLng(lng - 105.0, lat - 35.0)
-// const radlat = (lat / 180.0) * Math.PI
-// let magic = Math.sin(radlat)
-// magic = 1 - 0.00669342162296594323 * magic * magic
-// const sqrtmagic = Math.sqrt(magic)
-// dlat =
-// (dlat * 180.0) / (((6378245.0 * (1 - 0.00669342162296594323)) / (magic * sqrtmagic)) * Math.PI)
-// dlng = (dlng * 180.0) / ((6378245.0 / sqrtmagic) * Math.cos(radlat) * Math.PI)
-// return [lng + dlng, lat + dlat]
-// }
+/**
+ * WGS-84 转 GCJ-02(用于迭代优化)
+ */
+function wgs84ToGcj02(lng, lat) {
+ if (outOfChina(lng, lat)) {
+ return [lng, lat]
+ }
+ let dlat = _transformLat(lng - 105.0, lat - 35.0)
+ let dlng = _transformLng(lng - 105.0, lat - 35.0)
+ const radlat = (lat / 180.0) * Math.PI
+ let magic = Math.sin(radlat)
+ magic = 1 - 0.00669342162296594323 * magic * magic
+ const sqrtmagic = Math.sqrt(magic)
+ dlat =
+ (dlat * 180.0) / (((6378245.0 * (1 - 0.00669342162296594323)) / (magic * sqrtmagic)) * Math.PI)
+ dlng = (dlng * 180.0) / ((6378245.0 / sqrtmagic) * Math.cos(radlat) * Math.PI)
+ return [lng + dlng, lat + dlat]
+}
diff --git a/web/src/utils/loadTMap.js b/web/src/utils/loadTMap.js
new file mode 100644
index 0000000..7737021
--- /dev/null
+++ b/web/src/utils/loadTMap.js
@@ -0,0 +1,11 @@
+// utils/loadTMap.js
+export async function loadTMap(tk) {
+ if (window.T) return // 如果已加载,直接返回
+ return new Promise((resolve, reject) => {
+ const script = document.createElement('script')
+ script.src = `https://api.tianditu.gov.cn/api?v=4.0&tk=${tk}`
+ script.onload = () => resolve(window.T)
+ script.onerror = (err) => reject(err)
+ document.head.appendChild(script)
+ })
+}
diff --git a/web/src/views/LoginView.vue b/web/src/views/LoginView.vue
index ad171d3..a65bfbc 100644
--- a/web/src/views/LoginView.vue
+++ b/web/src/views/LoginView.vue
@@ -75,13 +75,17 @@ export default {
const values = await this.$refs.ruleForm.validateFields()
const res = await getReq('/login',this.form )
this.loading = false
+
console.log(res);
- // if (res.code === 200) {
- this.$message.success('登录成功')
- localStorage.setItem('token', res.token)
- this.$router.push('/')
- // } else {
+ if (res.errcode === 0) {
+ this.$message.success('登录成功')
+ localStorage.setItem('token', res.token)
+ localStorage.setItem('user',JSON.stringify( res.permission) )
+ this.$router.push('/')
+
+ }
+ // else {
// this.$message.error(res.message || '登录失败')
// }
} catch (error) {
diff --git a/web/src/views/MainView.vue b/web/src/views/MainView.vue
index 0e0e3d1..6660e1d 100644
--- a/web/src/views/MainView.vue
+++ b/web/src/views/MainView.vue
@@ -15,9 +15,8 @@
-
+
-