fix: bug#19950、19904、19588

* fix: 菜单详情按钮管理编码改变权限回流bug

* fix: 菜单bug

* fix: bug#19588

* fix: bug#19904

* fix: bug#19950
This commit is contained in:
qiaochuLei 2023-11-09 17:35:43 +08:00 committed by GitHub
parent 8d941fd875
commit 8c44d9704b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 94 additions and 34 deletions

View File

@ -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)

View File

@ -32,4 +32,9 @@ export const delOperations_api = (data:object) => server.remove(`/application/op
* @param data * @param data
* @returns * @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)

View File

@ -37,7 +37,11 @@ import AmapComponent from '@/components/AMapComponent/index.vue';
import { getGo } from '@/api/device/dashboard'; import { getGo } from '@/api/device/dashboard';
let point = ref(); let point = ref();
const getMapData = async () => { const getMapData = async () => {
const res = await getGo({}); const res = await getGo({
    filter:{
        paging:false
    }
});
point.value = res.result?.features; point.value = res.result?.features;
}; };
getMapData(); getMapData();

View File

@ -31,7 +31,7 @@
<j-ellipsis :lineClamp="2">{{ variables }}</j-ellipsis> <j-ellipsis :lineClamp="2">{{ variables }}</j-ellipsis>
</div> </div>
</div> </div>
<div class="item"> <div class="item" v-if="isNoCommunity" >
<div class="label">用户权限</div> <div class="label">用户权限</div>
<div class="value"> <div class="value">
<j-ellipsis :lineClamp="2">{{ obj.role }}</j-ellipsis> <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 TemplateApi from '@/api/notice/template';
import { queryConfigVariables } from '@/api/system/noticeRule'; import { queryConfigVariables } from '@/api/system/noticeRule';
import { getRoleList_api } from '@/api/system/user'; import { getRoleList_api } from '@/api/system/user';
import { isNoCommunity } from "@/utils/utils";
const props = defineProps({ const props = defineProps({
data: { data: {

View File

@ -60,14 +60,14 @@
ref="variableRef" ref="variableRef"
/> />
</template> </template>
<template v-if="current === 4"> <template v-if="current === 4 && isNoCommunity ">
<div class="alert"> <div class="alert">
<AIcon type="InfoCircleOutlined" /> <AIcon type="InfoCircleOutlined" />
通过角色控制哪些用户可以订阅从{{ name }}接收到{{ showName }}通知 通过角色控制哪些用户可以订阅从{{ name }}接收到{{ showName }}通知
</div> </div>
<Role type="add" v-model="formModel.grant.role.idList" /> <Role type="add" v-model="formModel.grant.role.idList" />
</template> </template>
<template v-if="current === 5"> <template v-if="current === 5 || current === 4 && !isNoCommunity">
<div> <div>
<div class="alert"> <div class="alert">
<AIcon type="InfoCircleOutlined" /> <AIcon type="InfoCircleOutlined" />
@ -134,6 +134,7 @@ import { onlyMessage } from '@/utils/comm';
import Template from '@/api/notice/template'; import Template from '@/api/notice/template';
import { variableMap } from '../../data'; import { variableMap } from '../../data';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import { isNoCommunity } from "@/utils/utils";
type GrantType = { type GrantType = {
role: { role: {
@ -169,14 +170,20 @@ const props = defineProps({
}, },
}); });
const stepList = [ const stepList = isNoCommunity ? [
'选择通知方式', '选择通知方式',
'选择通知配置', '选择通知配置',
'选择通知模板', '选择通知模板',
'配置模板变量', '配置模板变量',
'配置用户权限', '配置用户权限',
'完成', '完成',
]; ] : [
'选择通知方式',
'选择通知配置',
'选择通知模板',
'配置模板变量',
'完成',
]
const current = ref<number>(0); const current = ref<number>(0);
const variable = ref([]); const variable = ref([]);
const formModel = reactive<{ const formModel = reactive<{

View File

@ -93,6 +93,7 @@ const rowSelection = {
// } // }
// }, // },
onChange: (keys: string[], _data: any[]) => { onChange: (keys: string[], _data: any[]) => {
console.log(keys,'keys')
const _keys = _data.map(i => i.id) const _keys = _data.map(i => i.id)
// id // id
const currenTableKeys = _tableData.value.map((m: any) => m.id); const currenTableKeys = _tableData.value.map((m: any) => m.id);
@ -113,17 +114,18 @@ const rowSelection = {
emits('update:selectedRowKeys', [...otherSelectedKeys, ..._keys]); emits('update:selectedRowKeys', [...otherSelectedKeys, ..._keys]);
// / // /
const changed = {}; // const changed = {};
[...addKeys, ...removeKeys].forEach((key: string) => { // [...addKeys, ...removeKeys].forEach((key: string) => {
changed[key] = _tableData.value.find((f: any) => f.id === key); // changed[key] = _tableData.value.find((f: any) => f.id === key);
}); // });
if (props.mode === 'appManger') { // console.log(department.changedApis,'123')
// // if (props.mode === 'appManger') {
emits('update:changedApis', { // //
...department.changedApis, // emits('update:changedApis', {
...changed, // ...department.changedApis,
}); // ...changed,
} // });
// }
}, },
selectedRowKeys: ref<string[]>([]), selectedRowKeys: ref<string[]>([]),
}; };
@ -133,7 +135,6 @@ const save = async () => {
const removeKeys = props.sourceKeys.filter((key) => !keys.includes(key)); const removeKeys = props.sourceKeys.filter((key) => !keys.includes(key));
// key // key
const addKeys = keys.filter((key) => !props.sourceKeys.includes(key)); const addKeys = keys.filter((key) => !props.sourceKeys.includes(key));
if (props.mode === 'api') { if (props.mode === 'api') {
// api // api
// removeKeys.length && // removeKeys.length &&
@ -156,23 +157,33 @@ const save = async () => {
return return
} }
} else if (props.mode === 'appManger') { } else if (props.mode === 'appManger') {
const removeItems = removeKeys.map((key) => ({ const items = props.selectedRowKeys.map((key)=>({
id: key, id: key,
permissions: props.changedApis[key]?.security?props.changedApis[key]?.security:[], permissions: department.changedApis[key]?.security ? department.changedApis[key]?.security : []
})); }))
const addItems = addKeys.map((key) => ({ // const removeItems = removeKeys.map((key) => ({
id: key, // id: key,
permissions: props.changedApis[key]?.security?props.changedApis[key]?.security:[], // permissions: props.changedApis[key]?.security ? props.changedApis[key]?.security:[],
})); // }));
Promise.all([ // const addItems = addKeys.map((key) => ({
updateOperations_api(code, '_delete', { operations: removeItems }), // id: key,
updateOperations_api(code, '_add', { operations: addItems }), // permissions: props.changedApis[key]?.security ? props.changedApis[key]?.security:[],
]).then((resps) => { // }));
if (resps[0].status === 200 && resps[1].status === 200) { // 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('操作成功'); onlyMessage('操作成功');
emits('refresh'); emits('refresh')
} }
}); })
} }
}; };

View File

@ -28,7 +28,9 @@ import {
getTreeTwo_api, getTreeTwo_api,
} from '@/api/system/apiPage'; } from '@/api/system/apiPage';
import type { modeType, treeNodeTpye } from '../typing'; import type { modeType, treeNodeTpye } from '../typing';
import { useDepartmentStore } from '@/store/department';
const department = useDepartmentStore();
const emits = defineEmits(['select']); const emits = defineEmits(['select']);
const props = defineProps<{ const props = defineProps<{
mode: modeType; mode: modeType;
@ -78,12 +80,41 @@ const getTreeData = () => {
} }
treeData.value = tree; treeData.value = tree;
const apis = {}
const table: any = dealTreeData(tree)
table.forEach((item:any)=>{
apis[item.id] = item
})
department.setChangedApis(apis);
}) })
.finally(() => { .finally(() => {
spinning.value = false; 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) => { const clickSelectItem: TreeProps['onSelect'] = (key: any[], node: any) => {
if (key[0] === 'home') return emits('select', node.node.dataRef, {}); if (key[0] === 'home') return emits('select', node.node.dataRef, {});

View File

@ -97,6 +97,7 @@ export default defineConfig(({ mode}) => {
// target: 'http://192.168.32.163:8844', //张季本地 // target: 'http://192.168.32.163:8844', //张季本地
// target: 'http://120.77.179.54:8844', // 120测试 // target: 'http://120.77.179.54:8844', // 120测试
target: 'http://192.168.33.46:8844', // 本地开发环境 target: 'http://192.168.33.46:8844', // 本地开发环境
// target: 'http://192.168.33.1:8845', // 社区版开发环境
// target: 'http://192.168.32.5:8848', // 刘本地 // target: 'http://192.168.32.5:8848', // 刘本地
ws: 'ws://192.168.33.46:8844', ws: 'ws://192.168.33.46:8844',
changeOrigin: true, changeOrigin: true,