diff --git a/src/api/system/roleapi/postrole.ts b/src/api/system/roleapi/postrole.ts index d4f2c85..821b760 100644 --- a/src/api/system/roleapi/postrole.ts +++ b/src/api/system/roleapi/postrole.ts @@ -180,3 +180,15 @@ export function savePickRoleMan(data?: any){ data:data }); } +/** +@ 作者: 秦东 +@ 时间: 2025-12-11 14:23:55 +@ 功能: +*/ +export function gainAppEmpowerPower(data?: any){ + return request({ + url: '/systemapi/grant/gainAppEmpowerPower', + method: 'post', + data:data + }); +} diff --git a/src/components/DesignForm/app/index.vue b/src/components/DesignForm/app/index.vue index 3b80580..9a09674 100644 --- a/src/components/DesignForm/app/index.vue +++ b/src/components/DesignForm/app/index.vue @@ -44,6 +44,8 @@ import { import { formatNumber } from "@/api/DesignForm/utils"; +import { formHasPower } from "@/directive/permission/button"; + //引入组件 import FormPageCont from "@/components/DesignForm/tableListPage/formPageCont.vue"; import TableFlow from "@/views/sysworkflow/lowcodepage/pageFlow/appTableFlow.vue"; @@ -69,7 +71,9 @@ const props = withDefaults( data: FormPageList; searchData?: attrButton[]; config?: FormPageConfig|any; + appKey?: string; formId?: string; + signCode?: string; beforeRequest?: (params: any, rout: any) => any; afterResponse?: (result: any) => any | string; beforeDelete?: (params: any, route: any) => any; @@ -83,7 +87,6 @@ const props = withDefaults( delKey?: string; // 删除标识 lookPageIsShow?: boolean; versionid?: string; - signCode?: string; pickAppMenu?: any; versiontitle?: string; viewPage?: viewPageType|any; @@ -106,9 +109,15 @@ const props = withDefaults( dict: () => { return {}; }, + appKey: () => { + return ""; + }, formId: () => { return ""; }, + signCode: () => { + return ""; + }, versionid: () => { return ""; }, @@ -1946,14 +1955,18 @@ const isObject = (obj) => { 操作按钮区域 - - {{ item.label }} - + + +
@@ -2200,6 +2213,7 @@ const isObject = (obj) => { type="info" size="small" class="fa fa-edit" + v-if="formHasPower(props.pickAppMenu.appkey,props.signCode,'bj',0)" /> { @cancel="cancelEvent(scope.row)" > diff --git a/src/components/DesignForm/tableListPage/index.vue b/src/components/DesignForm/tableListPage/index.vue index 6f8d2ae..e19cdc6 100644 --- a/src/components/DesignForm/tableListPage/index.vue +++ b/src/components/DesignForm/tableListPage/index.vue @@ -38,6 +38,7 @@ import { ElLoading, ElMessage, ElNotification } from "element-plus"; import { softDeletion, retractRunWorkFlow, recalSendMsg } from "@/api/taskapi/management"; import { echatsViews } from "@/api/DesignForm/types"; import { formatNumber } from "@/api/DesignForm/utils"; +import { formHasPower } from "@/directive/permission/button"; //引入组件 import FormPageCont from "@/components/DesignForm/tableListPage/formPageCont.vue"; import TableFlow from "@/views/sysworkflow/lowcodepage/pageFlow/tableFlow.vue"; @@ -55,7 +56,9 @@ const props = withDefaults( data: FormPageList; searchData?: attrButton[]; config: FormPageConfig; + appKey?: string; formId?: string; + signCode?: string; beforeRequest?: (params: any, rout: any) => any; afterResponse?: (result: any) => any | string; beforeDelete?: (params: any, route: any) => any; @@ -90,9 +93,15 @@ const props = withDefaults( dict: () => { return {}; }, + appKey: () => { + return ""; + }, formId: () => { return ""; }, + signCode: () => { + return ""; + }, versionid: () => { return ""; }, @@ -1796,15 +1805,18 @@ const isObject = (obj: any) => {
操作按钮区域 - - {{ item.label }} + > + +
@@ -2020,6 +2032,7 @@ const isObject = (obj: any) => { size="small" class="fa fa-mail-reply-all" color="rgb(250, 181.5, 181.5)" + /> @@ -2050,6 +2063,7 @@ const isObject = (obj: any) => { type="info" size="small" class="fa fa-edit" + v-if="formHasPower(props.appKey,props.signCode,'bj',0)" /> { @cancel="cancelEvent(scope.row)" > diff --git a/src/directive/index.ts b/src/directive/index.ts index 402558f..420f18d 100644 --- a/src/directive/index.ts +++ b/src/directive/index.ts @@ -1,11 +1,13 @@ import type { App } from 'vue'; import { hasPerm } from './permission'; -import { hasButton } from './permission/button'; +import { hasButton,hasApp,hasAppGroup } from './permission/button'; // 全局注册 directive export function setupDirective(app: App) { // 使 v-hasPerm 在所有组件中都可用 app.directive('hasPerm', hasPerm); app.directive('hasButton', hasButton); + app.directive('hasApp', hasApp); + app.directive('hasAppGroup', hasAppGroup); } diff --git a/src/directive/permission/button.ts b/src/directive/permission/button.ts index b44d998..5c80640 100644 --- a/src/directive/permission/button.ts +++ b/src/directive/permission/button.ts @@ -21,3 +21,131 @@ export const hasButton: Directive = { } } } + +/** + * app权限 + */ +export const hasApp: Directive = { + mounted(el: HTMLElement, binding: DirectiveBinding) { + const userStore = useUserStore(); + const { value } = binding; + // console.log("app权限",el,"-->",binding,"-->",value,"-->",userStore.myPower.appKeyAry,"-->",userStore.myPower); + // console.log("我的App--->",userStore.myPower) + if (value) { + const requiredPerms = value; // DOM绑定需要的app权限标识 + const hasPerm = userStore.myPower.appKeyAry.some((perm: any) => { + return requiredPerms.includes(perm); + }); + if (!hasPerm) { + el.parentNode?.removeChild(el); + } + } + } +} + +export const hasAppList = (signCode:string) => { + const userStore = useUserStore(); + return userStore.myPower.appKeyAry.some((perm: any) => { + return perm.includes(signCode); + }); +} +/** +@ 作者: 秦东 +@ 时间: 2025-12-11 16:30:08 +@ 功能: 自定义App分组指令授权 +*/ +export const hasAppGroup: Directive = { + mounted(el: HTMLElement, binding: DirectiveBinding) { + const userStore = useUserStore(); + const { value } = binding; + // console.log("app权限",el,"-->",binding,"-->",value,"-->",userStore.myPower.appKeyAry,"-->",userStore.myPower); + // console.log("我的App--->",userStore.myPower) + if (value) { + const requiredPerms = value; // DOM绑定需要的app权限标识 + const hasPerm = userStore.myPower.appGroupPower.some((perm: any) => { + return requiredPerms.includes(perm); + }); + if (!hasPerm) { + el.parentNode?.removeChild(el); + } + } + } +} + +/** +@ 作者: 秦东 +@ 时间: 2025-12-11 16:39:01 +@ 功能: 判断应用级权限 +*/ +export const appHasPower = (signCode:string,buttonKey:string) => { + const userStore = useUserStore(); + return userStore.myPower.appSystemPower.some((perm: any) => { + + // console.log("判断应用级权限--->",buttonKey) + if(perm.AppId == signCode){ + // console.log("判断应用级权限-1111-->",perm.AppId,buttonKey) + // console.log("判断应用级权限-222-->",perm.butPower && Array.isArray(perm.butPower)) + if(perm.butPower && Array.isArray(perm.butPower)){ + // console.log("判断应用级权限--->",perm.AppId,buttonKey) + return perm.butPower.includes(buttonKey) + } + } + }); +} + +/** +@ 作者: 秦东 +@ 时间: 2025-12-12 09:33:21 +@ 功能: 判断表单级权限 +*/ +export const formHasPower = (signCode:string,tormCode:string,buttonKey:string,classType:int) => { + const userStore = useUserStore(); + // console.log("判断表单级权限-1111-->",userStore.myPower.appSystemPower) + if(userStore.myPower.appSystemPower && Array.isArray(userStore.myPower.appSystemPower)){ + + return userStore.myPower.appSystemPower.some((perm: any) => { + if(perm.AppId == signCode){ + // console.log("判断表单级权限-1112-->",signCode) + // console.log("判断表单级权限-1113-->",tormCode) + // console.log("判断表单级权限-1114-->",perm.formPower) + // console.log("判断表单级权限-1115-->",buttonKey) + if(perm.formPower && Array.isArray(perm.formPower)){ + return perm.formPower.some((formPerm: any) => { + switch(classType){ + case 1: + return formPerm.AppId == tormCode && formPerm.tablePower.includes(buttonKey); + break; + case 2: + return formPerm.AppId == tormCode && formPerm.PagePower.includes(buttonKey); + break; + default: + return formPerm.AppId == tormCode && formPerm.listPower.includes(buttonKey); + break; + } + }); + } + + } + }); + } +} + +/** +@ 作者: 秦东 +@ 时间: 2025-12-12 13:42:40 +@ 功能: 判断自定义App菜单 +*/ +export const hasCustomAppMenu = (appKey:string,menuKey:string) => { + console.log("判断自定义App菜单--->",appKey,menuKey) + const userStore = useUserStore(); + if(userStore.myPower.appSystemPower && Array.isArray(userStore.myPower.appSystemPower)){ + return userStore.myPower.appSystemPower.some((perm: any) => { + if(perm.AppId == appKey){ + if(perm.formTrue && Array.isArray(perm.formTrue)){ + return perm.formTrue.includes(menuKey); + } + } + }); + } + return false; +} diff --git a/src/utils/workflow/const.ts b/src/utils/workflow/const.ts index 0ba376d..9f5d74e 100644 --- a/src/utils/workflow/const.ts +++ b/src/utils/workflow/const.ts @@ -406,10 +406,54 @@ export let appTableBut = [ @ 功能: 列表按钮 */ export let appListBut = [ - { label: '新增',value: 'xz',key:1}, - { label: '导入',value: 'dr',key:2}, - { label: '导出 ',value: 'dc',key:3}, + { label: '新增',value: 'newAdd',key:1}, + { label: '导入',value: 'import',key:2}, + { label: '导出 ',value: 'export',key:3}, { label: '删除',value: 'sc',key:4}, { label: '打印',value: 'dy',key:5}, - { label: '打印二维码',value: 'dyewm',key:6} + { label: '打印二维码',value: 'showQrCode',key:6}, + { label: '批量删除',value: 'del',key:7}, + { label: '编辑',value: 'bj',key:8}, +] +/** +@ 作者: 秦东 +@ 时间: 2025-05-15 08:06:57 +@ 功能: 自定义App详情按钮 +*/ +export let appDetailBut = [ + { label: '编辑App',value: 'bjapp',key:1}, + { label: '删除App',value: 'scapp',key:2}, + { label: '新增表单分组',value: 'xzfg',key:3}, + { label: '删除表单分组',value: 'scfg',key:4}, + { label: '移动表单分组',value: 'yzfg',key:5}, + { label: '新增表单',value: 'xz',key:6}, + { label: '编辑表单',value: 'bj',key:7}, + { label: '删除表单',value: 'sc',key:8}, + { label: '移动表单',value: 'yz',key:9}, + { label: '集成&自动化',value: 'jczdh',key:10}, + { label: '应用设置',value: 'yysz',key:11}, + { label: '应用发布',value: 'yyfb',key:12}, +] +/** +@ 作者: 秦东 +@ 时间: 2025-12-10 14:09:42 +@ 功能: 表单基础功能 +*/ +export let formBaseBut = [ + { label: '流程设计',value: 'lc',key:1}, + { label: '列表设计',value: 'lb',key:2}, + { label: '数据看板',value: 'sj',key:3}, + { label: '打印设计',value: 'dy',key:4}, + { label: '内容呈现设计',value: 'nc',key:5}, +] +/** +@ 作者: 秦东 +@ 时间: 2025-12-10 14:11:25 +@ 功能: 自定义App分组级权限 +*/ +export let appGroupBut = [ + { label: '新增分组',value: 'xz',key:1}, + { label: '删除分组',value: 'dl',key:2}, + { label: '编辑分组',value: 'bj',key:3}, + { label: '新增App',value: 'xzapp',key:4}, ] diff --git a/src/views/system/monitor/online/index.vue b/src/views/system/monitor/online/index.vue index 346c55c..fce951d 100644 --- a/src/views/system/monitor/online/index.vue +++ b/src/views/system/monitor/online/index.vue @@ -9,11 +9,12 @@ import type { TreeInstance } from 'element-plus' import type {RoleListTree,RoleFormInfo,orgAndPostisListTree} from '@/api/role/types' import { getOrgTreeList } from "@/api/hr/org/index"; import { appPowerUnit } from "@/api/system/roleapi/power"; -import type { getSystemPower,AppPowerTree,systemList } from "@/api/system/roleapi/types"; -import { gainAppList,gainAppTableListNew,getPowerPageUser,systemAppAuthorization } from "@/api/system/roleapi/postrole"; -import { appTableBut, appListBut } from "@/utils/workflow/const"; +import type { getSystemPower,AppPowerTree,systemList,custerAppInfo } from "@/api/system/roleapi/types"; +import { gainAppList,gainAppTableListNew,getPowerPageUser,systemAppAuthorization,gainAppEmpowerPower } from "@/api/system/roleapi/postrole"; +import { appTableBut, appListBut,appDetailBut,formBaseBut,appGroupBut } from "@/utils/workflow/const"; import { Search } from '@element-plus/icons-vue' + import SetRolePeople from '@/views/system/monitor/online/roleConfig/setRolePeople.vue' import AddRoleGroup from '@/views/system/monitor/online/roleConfig/addRoleGroup.vue' import EditRoleGroup from '@/views/system/monitor/online/roleConfig/editRoleGroup.vue' @@ -43,6 +44,8 @@ const activeAppId = ref(""); const appTableList = ref([]); const myAppTableLoad = ref(false) +const appSystemConfig = ref([]) +const appFormButConfig = ref([]) const props = { value: 'id', label: 'label', @@ -318,10 +321,13 @@ const getAppTableList = (number:boolean) => { console.log("获取对应App下边的表单---number---->",number,activeAppId.value) if(activeAppId.value){ systemPower.value.appId = activeAppId.value.toString() - gainAppTableListNew({id:activeAppId.value,appType:systemPower.value.appSystem,powerType:systemPower.value.powerType,roleId:systemPower.value.roleId}).then( + + gainAppEmpowerPower({id:activeAppId.value,appType:systemPower.value.appSystem,powerType:systemPower.value.powerType,roleId:systemPower.value.roleId}).then( (data: any) => { - // console.log("获取对应App下边的表单", data); - if (Array.isArray(data.data)) { + console.log("获取对应App下边的表单", data); + appSystemConfig.value = data.data.groupButPower; + appFormButConfig.value = data.data.formButPower + if (Array.isArray(data.data.list)) { if(number){ data.data.forEach((item:any)=>{ item.tableIsAll = true @@ -329,13 +335,38 @@ const getAppTableList = (number:boolean) => { item.listPower = [ "xz", "dr", "dc", "sc", "dy", "dyewm"] }) } - appTableList.value = data.data; + appTableList.value = data.data.list; + } else { appTableList.value = []; + } myAppTableLoad.value = false } ); + + // gainAppTableListNew({id:activeAppId.value,appType:systemPower.value.appSystem,powerType:systemPower.value.powerType,roleId:systemPower.value.roleId}).then( + // (data: any) => { + // console.log("获取对应App下边的表单", data); + // appSystemConfig.value = data.data.groupButPower; + // appFormButConfig.value = data.data.formButPower + // if (Array.isArray(data.data.list)) { + // if(number){ + // data.data.forEach((item:any)=>{ + // item.tableIsAll = true + // item.tablePower = [ "zc", "tj", "dy", "sc", "fz"] + // item.listPower = [ "xz", "dr", "dc", "sc", "dy", "dyewm"] + // }) + // } + // appTableList.value = data.data.list; + + // } else { + // appTableList.value = []; + + // } + // myAppTableLoad.value = false + // } + // ); }else{ myAppTableLoad.value = false } @@ -373,9 +404,10 @@ const pickAppList = (val: custerAppInfo) => { }; const pickAppTableList = (val: custerAppInfo) =>{ - console.log("选择应用-22222--111111->",val,appTableList.value) + console.log("选择应用-22222--111111->",val.isPick,val,appTableList.value) systemPower.value.isPick = !val.pickAll if(val.isPick){ + appTableList.value.forEach((item:any)=>{ // console.log("选择应用-22222--333333->",val.isPick) item.tableIsAll = !val.pickAll @@ -383,14 +415,26 @@ const pickAppTableList = (val: custerAppInfo) =>{ item.listIsAll = true item.tablePower = [ "zc", "tj", "dy", "sc", "fz"] item.listPower = [ "xz", "dr", "dc", "sc", "dy", "dyewm"] + item.tablePagePower = ['lc', 'lb', 'sj', 'dy', 'nc'] }else{ item.listIsAll = false item.tablePower = [] item.listPower = [] + item.tablePagePower = [] } }) - } - + }else{ + appFormButConfig.value = [] + } + if(!val.pickAll){ + console.log("选择应用-22222--333333->",val.pickAll) + appFormButConfig.value = ["bjapp","scapp","xzfg","scfg","yzfg","xz","bj","sc","yz","jczdh","yysz","yyfb"] + }else{ + console.log("选择应用-22222--44444->",val.pickAll) + appFormButConfig.value = [] + } + + console.log("选择应用-22222--5555555->",appFormButConfig.value) } //选择应用-22222--333333-> const pickOneAppTableList = (item: any) =>{ @@ -399,9 +443,11 @@ const pickOneAppTableList = (item: any) =>{ if(!item.listIsAll){ item.tablePower = [ "zc", "tj", "dy", "sc", "fz"] item.listPower = [ "xz", "dr", "dc", "sc", "dy", "dyewm"] + item.tablePagePower = ['lc', 'lb', 'sj', 'dy', 'nc'] }else{ item.tablePower = [] item.listPower = [] + item.tablePagePower = [] } } @@ -456,14 +502,19 @@ const savePowerUserSub = () => { const savePowerAppSub = () => { console.log("提交应用授权--app-1---->",systemPower.value) console.log("提交应用授权--app-2---->",appTableList.value) + console.log("提交应用授权--app-3---appSystemConfig->",appSystemConfig.value) + console.log("提交应用授权--app-3---appFormButConfig->",appFormButConfig.value) + let sendInfo = { - powerType: systemPower.value.powerType, + powerType: systemPower.value.powerType, appId: systemPower.value.appId, appSystem: systemPower.value.appSystem, roleId: systemPower.value.roleId, isPick: systemPower.value.isPick, sysstemPowerInfo: systemPowerTree.value, - CustomizeApp:appTableList.value + CustomizeApp:appTableList.value, + appSystemConfig:appSystemConfig.value, + appFormButConfig:appFormButConfig.value, } console.log("提交应用授权--app-3---->",sendInfo) systemAppAuthorization(sendInfo).then((data)=>{ @@ -759,8 +810,10 @@ onMounted(()=>{ + 应用分组 应用 - + 操作按钮 +
应用详情 确定授权 @@ -770,6 +823,18 @@ onMounted(()=>{ + + + + {{ city.label }} + + +
    @@ -779,29 +844,56 @@ onMounted(()=>{
+ + + + + {{ city.label }} + + - - - 页面 + + + 页面 + + + 页面权力 - + 表单权力 - + 列表权限 - + 数据权限 - + {{ item.name }} - + + + + {{ city.label }} + + + + { - + { - + {