From 8c44d9704b55851514ad4a71eb7cd1cc9ecaed47 Mon Sep 17 00:00:00 2001
From: qiaochuLei <124648559+qiaochuLei@users.noreply.github.com>
Date: Thu, 9 Nov 2023 17:35:43 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20bug#19950=E3=80=8119904=E3=80=8119588?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* fix: 菜单详情按钮管理编码改变权限回流bug
* fix: 菜单bug
* fix: bug#19588
* fix: bug#19904
* fix: bug#19950
---
src/api/device/dashboard.ts | 2 +-
src/api/system/apiPage.ts | 7 ++-
.../device/DashBoard/components/Amap.vue | 6 +-
.../NoticeRule/components/Detail/index.vue | 3 +-
.../NoticeRule/components/Save/index.vue | 15 +++--
.../Platforms/Api/components/ChooseApi.vue | 63 +++++++++++--------
.../Platforms/Api/components/LeftTree.vue | 31 +++++++++
vite.config.ts | 1 +
8 files changed, 94 insertions(+), 34 deletions(-)
diff --git a/src/api/device/dashboard.ts b/src/api/device/dashboard.ts
index 34ee06e6..999b5b44 100644
--- a/src/api/device/dashboard.ts
+++ b/src/api/device/dashboard.ts
@@ -15,4 +15,4 @@ export const dashboard = (data?:any) => server.post('/dashboard/_multi',data);
/**
* 地图数据
*/
-export const getGo = (data?:any) => server.post('/geo/object/device/_search/geo.json')
\ No newline at end of file
+export const getGo = (data?:any) => server.post('/geo/object/device/_search/geo.json',data)
\ No newline at end of file
diff --git a/src/api/system/apiPage.ts b/src/api/system/apiPage.ts
index a827239c..0c19d2fa 100644
--- a/src/api/system/apiPage.ts
+++ b/src/api/system/apiPage.ts
@@ -32,4 +32,9 @@ export const delOperations_api = (data:object) => server.remove(`/application/op
* @param data
* @returns
*/
-export const updateOperations_api = (code:string,type:'_add'| '_delete', data: object) => server.post(`/application/${code}/grant/${type}`, data);
+// export const updateOperations_api = (code:string,type:'_add'| '_delete', data: object) => server.post(`/application/${code}/grant/${type}`, data);
+
+/**
+ * 赋权-选中/取消选中api
+ */
+export const updateOperations_api = (id:string,data:object) => server.post(`/application/${id}/grant`,data)
diff --git a/src/views/device/DashBoard/components/Amap.vue b/src/views/device/DashBoard/components/Amap.vue
index 7d331ac4..9311e1e1 100644
--- a/src/views/device/DashBoard/components/Amap.vue
+++ b/src/views/device/DashBoard/components/Amap.vue
@@ -37,7 +37,11 @@ import AmapComponent from '@/components/AMapComponent/index.vue';
import { getGo } from '@/api/device/dashboard';
let point = ref();
const getMapData = async () => {
- const res = await getGo({});
+ const res = await getGo({
+ filter:{
+ paging:false
+ }
+});
point.value = res.result?.features;
};
getMapData();
diff --git a/src/views/system/NoticeRule/components/Detail/index.vue b/src/views/system/NoticeRule/components/Detail/index.vue
index 13adfef9..2e228b06 100644
--- a/src/views/system/NoticeRule/components/Detail/index.vue
+++ b/src/views/system/NoticeRule/components/Detail/index.vue
@@ -31,7 +31,7 @@
{{ variables }}
-
+
用户权限
{{ obj.role }}
@@ -49,6 +49,7 @@ import ConfigApi from '@/api/notice/config';
import TemplateApi from '@/api/notice/template';
import { queryConfigVariables } from '@/api/system/noticeRule';
import { getRoleList_api } from '@/api/system/user';
+import { isNoCommunity } from "@/utils/utils";
const props = defineProps({
data: {
diff --git a/src/views/system/NoticeRule/components/Save/index.vue b/src/views/system/NoticeRule/components/Save/index.vue
index 4bd4bf86..0cf750f4 100644
--- a/src/views/system/NoticeRule/components/Save/index.vue
+++ b/src/views/system/NoticeRule/components/Save/index.vue
@@ -60,14 +60,14 @@
ref="variableRef"
/>
-
+
通过角色控制哪些用户可以订阅从【{{ name }}】接收到【{{ showName }}】通知
-
+
@@ -134,6 +134,7 @@ import { onlyMessage } from '@/utils/comm';
import Template from '@/api/notice/template';
import { variableMap } from '../../data';
import { cloneDeep } from 'lodash-es';
+import { isNoCommunity } from "@/utils/utils";
type GrantType = {
role: {
@@ -169,14 +170,20 @@ const props = defineProps({
},
});
-const stepList = [
+const stepList = isNoCommunity ? [
'选择通知方式',
'选择通知配置',
'选择通知模板',
'配置模板变量',
'配置用户权限',
'完成',
-];
+] : [
+ '选择通知方式',
+ '选择通知配置',
+ '选择通知模板',
+ '配置模板变量',
+ '完成',
+]
const current = ref
(0);
const variable = ref([]);
const formModel = reactive<{
diff --git a/src/views/system/Platforms/Api/components/ChooseApi.vue b/src/views/system/Platforms/Api/components/ChooseApi.vue
index 3a92d2cb..12fb384d 100644
--- a/src/views/system/Platforms/Api/components/ChooseApi.vue
+++ b/src/views/system/Platforms/Api/components/ChooseApi.vue
@@ -93,6 +93,7 @@ const rowSelection = {
// }
// },
onChange: (keys: string[], _data: any[]) => {
+ console.log(keys,'keys')
const _keys = _data.map(i => i.id)
// 当前节点表格数据id
const currenTableKeys = _tableData.value.map((m: any) => m.id);
@@ -113,17 +114,18 @@ const rowSelection = {
emits('update:selectedRowKeys', [...otherSelectedKeys, ..._keys]);
// 新增选中/取消选中的数据
- const changed = {};
- [...addKeys, ...removeKeys].forEach((key: string) => {
- changed[key] = _tableData.value.find((f: any) => f.id === key);
- });
- if (props.mode === 'appManger') {
- // 缓存当前表格和其他表格改变的数据
- emits('update:changedApis', {
- ...department.changedApis,
- ...changed,
- });
- }
+ // const changed = {};
+ // [...addKeys, ...removeKeys].forEach((key: string) => {
+ // changed[key] = _tableData.value.find((f: any) => f.id === key);
+ // });
+ // console.log(department.changedApis,'123')
+ // if (props.mode === 'appManger') {
+ // // 缓存当前表格和其他表格改变的数据
+ // emits('update:changedApis', {
+ // ...department.changedApis,
+ // ...changed,
+ // });
+ // }
},
selectedRowKeys: ref([]),
};
@@ -133,7 +135,6 @@ const save = async () => {
const removeKeys = props.sourceKeys.filter((key) => !keys.includes(key));
// 新选中的key
const addKeys = keys.filter((key) => !props.sourceKeys.includes(key));
-
if (props.mode === 'api') {
// 此时是api配置
// removeKeys.length &&
@@ -156,23 +157,33 @@ const save = async () => {
return
}
} else if (props.mode === 'appManger') {
- const removeItems = removeKeys.map((key) => ({
+ const items = props.selectedRowKeys.map((key)=>({
id: key,
- permissions: props.changedApis[key]?.security?props.changedApis[key]?.security:[],
- }));
- const addItems = addKeys.map((key) => ({
- id: key,
- permissions: props.changedApis[key]?.security?props.changedApis[key]?.security:[],
- }));
- Promise.all([
- updateOperations_api(code, '_delete', { operations: removeItems }),
- updateOperations_api(code, '_add', { operations: addItems }),
- ]).then((resps) => {
- if (resps[0].status === 200 && resps[1].status === 200) {
+ permissions: department.changedApis[key]?.security ? department.changedApis[key]?.security : []
+ }))
+ // const removeItems = removeKeys.map((key) => ({
+ // id: key,
+ // permissions: props.changedApis[key]?.security ? props.changedApis[key]?.security:[],
+ // }));
+ // const addItems = addKeys.map((key) => ({
+ // id: key,
+ // permissions: props.changedApis[key]?.security ? props.changedApis[key]?.security:[],
+ // }));
+ // Promise.all([
+ // updateOperations_api(code, '_delete', { operations: removeItems }),
+ // updateOperations_api(code, '_add', { operations: addItems }),
+ // ]).then((resps) => {
+ // if (resps[0].status === 200 && resps[1].status === 200) {
+ // onlyMessage('操作成功');
+ // emits('refresh');
+ // }
+ // });
+ updateOperations_api(code,{operations:items}).then((resp)=>{
+ if(resp.status === 200){
onlyMessage('操作成功');
- emits('refresh');
+ emits('refresh')
}
- });
+ })
}
};
diff --git a/src/views/system/Platforms/Api/components/LeftTree.vue b/src/views/system/Platforms/Api/components/LeftTree.vue
index cacbeb59..f822c15a 100644
--- a/src/views/system/Platforms/Api/components/LeftTree.vue
+++ b/src/views/system/Platforms/Api/components/LeftTree.vue
@@ -28,7 +28,9 @@ import {
getTreeTwo_api,
} from '@/api/system/apiPage';
import type { modeType, treeNodeTpye } from '../typing';
+import { useDepartmentStore } from '@/store/department';
+const department = useDepartmentStore();
const emits = defineEmits(['select']);
const props = defineProps<{
mode: modeType;
@@ -78,12 +80,41 @@ const getTreeData = () => {
}
treeData.value = tree;
+ const apis = {}
+ const table: any = dealTreeData(tree)
+ table.forEach((item:any)=>{
+ apis[item.id] = item
+ })
+ department.setChangedApis(apis);
})
.finally(() => {
spinning.value = false;
});
});
};
+const dealTreeData = (tree:Array) =>{
+ let table:any = []
+ tree.forEach((item)=>{
+ if(item?.children){
+ item?.children.forEach(i=>{
+ i?.apiList?.forEach((apiItem:any)=>{
+ const { method, url } = apiItem as any;
+ for (const key in method) {
+ if (Object.prototype.hasOwnProperty.call(method, key)) {
+ table.push({
+ ...method[key],
+ url,
+ method: key,
+ id: method[key].operationId,
+ });
+ }
+ }
+ })
+ })
+ }
+ })
+ return table
+}
const clickSelectItem: TreeProps['onSelect'] = (key: any[], node: any) => {
if (key[0] === 'home') return emits('select', node.node.dataRef, {});
diff --git a/vite.config.ts b/vite.config.ts
index aa56157b..80ead348 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -97,6 +97,7 @@ export default defineConfig(({ mode}) => {
// target: 'http://192.168.32.163:8844', //张季本地
// target: 'http://120.77.179.54:8844', // 120测试
target: 'http://192.168.33.46:8844', // 本地开发环境
+ // target: 'http://192.168.33.1:8845', // 社区版开发环境
// target: 'http://192.168.32.5:8848', // 刘本地
ws: 'ws://192.168.33.46:8844',
changeOrigin: true,