From ee37e8b2651cdd05dfedc4382f70eed8575d036c Mon Sep 17 00:00:00 2001 From: zhoumengru Date: Fri, 5 Sep 2025 16:41:50 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(system):=20=E4=BC=98=E5=8C=96=E7=94=B5?= =?UTF-8?q?=E4=BB=B7=E7=AD=96=E7=95=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加删除策略功能 - 修复编辑策略时表单数据绑定问题 - 优化策略列表展示逻辑 - 调整策略表单验证方式 - 修改策略列表分页配置 --- web/.eslintrc.js | 1 + web/src/components/ComTable.vue | 2 +- web/src/components/system/policyForm.vue | 344 ++++++++++++++++------- web/src/views/system/policy.vue | 84 ++++-- 4 files changed, 300 insertions(+), 131 deletions(-) diff --git a/web/.eslintrc.js b/web/.eslintrc.js index ca360bb..631fc67 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -15,6 +15,7 @@ module.exports = { }, plugins: ['react', '@typescript-eslint', 'prettier'], // 添加 prettier 插件 rules: { + camelcase: 'off', 'vue/require-explicit-emits': 'off', // 关闭 emits 声明检查 'vue/v-on-event-hyphenation': 'off', 'prettier/prettier': 'off', diff --git a/web/src/components/ComTable.vue b/web/src/components/ComTable.vue index cc316ef..9b1ff53 100644 --- a/web/src/components/ComTable.vue +++ b/web/src/components/ComTable.vue @@ -152,7 +152,7 @@ const data = reactive({ newPageOption: {}, newTableOpt: {}, - pageSizeOptions: ['15', '20', '30', '40', '50', '100'], + pageSizeOptions: ['10', '20', '30', '40', '50', '100'], mountedScroll }) const loading = ref(false) diff --git a/web/src/components/system/policyForm.vue b/web/src/components/system/policyForm.vue index fd40b22..e548deb 100644 --- a/web/src/components/system/policyForm.vue +++ b/web/src/components/system/policyForm.vue @@ -6,7 +6,7 @@ {{ item.label @@ -69,39 +69,44 @@ - @@ -66,8 +75,8 @@ export default { return { formModal: false, btnOptionList: [ - { label: '新增', icon: 'icon-tianjia', type: 'add' }, - { label: '删除', icon: 'icon-tianjia', type: 'del' } + { label: '新增', icon: 'icon-tianjia', type: 'add' } + // { label: '删除', icon: 'icon-tianjia', type: 'del' } ], columns: [ { @@ -125,15 +134,17 @@ export default { } ], tableData: [], - tableOption: {}, + tableOption: { + select:false + }, pageOption: { - page: 0, + page: 1, pageSize: 10, - total: 0 + count: 0 }, tableH: '', formState: {}, - formStatus:'add',//表单状态辑状态 add:新增 edit:编辑 + formStatus: 'add' //表单状态辑状态 add:新增 edit:编辑 } }, mounted() { @@ -148,13 +159,12 @@ export default { }) console.log(res) this.tableData = res.data - this.total = res.count + this.pageOption.count = res.count } catch (error) { console.log(error) } }, getPolicyType(type) { - return policyTypes.find((item) => item.value == type)?.label || '' }, @@ -162,7 +172,8 @@ export default { console.log(data) }, operateForm(type, record = {}) { - + console.log(type, record) + this.formStatus = type switch (type) { case 'add': @@ -173,16 +184,45 @@ export default { this.formModal = true this.formState = record break - + case 'del': + this.handleDelete(record) + break + case 'edit': + this.formModal = true + this.formState = record + break default: break } }, - closeModal(){ + async handleDelete(record) { + try { + const res = await getReq('/deletePolicy', { + policy_id: record['policy_id'] + }) + if (res.errcode == 0) { + this.$message.success('删除成功') + this.getTableList() + } + } catch (error) { + this.$message.success(error) + } + }, + closeModal(flag = false) { this.formModal = false + if (flag) { + this.pageOption.page = 1 + this.getTableList() + } }, handlePagesizeChange(data) { - console.log(data) + if (data.pageSize !== this.pageOption.pageSize) { + this.pageOption.page = 1 + } else { + this.pageOption.page = data.page + } + this.pageOption.pageSize = data.pageSize + this.getTableList() } } } From 7a50130d1260f7fa7dce53c7f42cb9358bb92035 Mon Sep 17 00:00:00 2001 From: ym1026 <1539963735@qq.com> Date: Tue, 9 Sep 2025 09:33:14 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=9C=BA=E7=AB=99+=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91=EF=BC=8C?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=9D=83=E9=99=90=E5=AE=8C=E5=96=84=EF=BC=8C?= =?UTF-8?q?=E6=80=BB=E8=A7=88=E5=BC=B9=E7=AA=97=E6=8E=A5=E5=8F=A3=E8=81=94?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/public/config/columnList.js | 197 ++++++- web/src/components/ComTable.vue | 28 +- web/src/components/EditCom.vue | 99 +++- web/src/components/Home/Map.vue | 171 +++++- web/src/components/Home/Modal.vue | 37 +- web/src/components/Home/Modal/EnvInfo.vue | 53 +- .../components/Home/Modal/OperationalInfo.vue | 47 +- web/src/components/TreeTable.vue | 528 ++++++++++++++++++ web/src/main.js | 2 + web/src/router/index.js | 7 +- web/src/utils/btnList.js | 4 +- web/src/utils/column.js | 4 +- web/src/utils/gcj02ToWgs84.js | 142 ++--- web/src/utils/loadTMap.js | 11 + web/src/views/LoginView.vue | 14 +- web/src/views/MainView.vue | 59 +- web/src/views/system/permission.vue | 222 ++++++++ web/src/views/system/role.vue | 63 ++- web/src/views/system/service.vue | 252 +++++++++ web/src/views/system/station.vue | 45 +- 20 files changed, 1741 insertions(+), 244 deletions(-) create mode 100644 web/src/components/TreeTable.vue create mode 100644 web/src/utils/loadTMap.js create mode 100644 web/src/views/system/permission.vue create mode 100644 web/src/views/system/service.vue 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 @@