fix: bug#19950、19904、19588
* fix: 菜单详情按钮管理编码改变权限回流bug * fix: 菜单bug * fix: bug#19588 * fix: bug#19904 * fix: bug#19950
This commit is contained in:
parent
8d941fd875
commit
8c44d9704b
|
@ -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')
|
||||
export const getGo = (data?:any) => server.post('/geo/object/device/_search/geo.json',data)
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<j-ellipsis :lineClamp="2">{{ variables }}</j-ellipsis>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="item" v-if="isNoCommunity" >
|
||||
<div class="label">用户权限</div>
|
||||
<div class="value">
|
||||
<j-ellipsis :lineClamp="2">{{ obj.role }}</j-ellipsis>
|
||||
|
@ -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: {
|
||||
|
|
|
@ -60,14 +60,14 @@
|
|||
ref="variableRef"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="current === 4">
|
||||
<template v-if="current === 4 && isNoCommunity ">
|
||||
<div class="alert">
|
||||
<AIcon type="InfoCircleOutlined" />
|
||||
通过角色控制哪些用户可以订阅从【{{ name }}】接收到【{{ showName }}】通知
|
||||
</div>
|
||||
<Role type="add" v-model="formModel.grant.role.idList" />
|
||||
</template>
|
||||
<template v-if="current === 5">
|
||||
<template v-if="current === 5 || current === 4 && !isNoCommunity">
|
||||
<div>
|
||||
<div class="alert">
|
||||
<AIcon type="InfoCircleOutlined" />
|
||||
|
@ -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<number>(0);
|
||||
const variable = ref([]);
|
||||
const formModel = reactive<{
|
||||
|
|
|
@ -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<string[]>([]),
|
||||
};
|
||||
|
@ -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')
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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<any>) =>{
|
||||
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, {});
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue