From 7e34e5058f985ae6d25fc7e2f10320c2a470ca65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=90=8C=E6=B5=B7?= <14166000+zhangtonghai@user.noreply.gitee.com> Date: Thu, 5 Sep 2024 15:30:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/datarule/columns.tsx | 8 + src/views/system/user/UserPermissionModal.vue | 139 ++++++++++ src/views/system/user/api.ts | 24 +- src/views/system/user/columns.tsx | 252 +++++++++++++++++- src/views/system/user/dataruleIndex.vue | 82 ++++++ src/views/system/user/dataruleInfo.vue | 102 +++++++ src/views/system/user/index.vue | 28 +- 7 files changed, 616 insertions(+), 19 deletions(-) create mode 100644 src/views/system/user/UserPermissionModal.vue create mode 100644 src/views/system/user/dataruleIndex.vue create mode 100644 src/views/system/user/dataruleInfo.vue diff --git a/src/views/system/datarule/columns.tsx b/src/views/system/datarule/columns.tsx index 5b9ede7a..55d5ba46 100644 --- a/src/views/system/datarule/columns.tsx +++ b/src/views/system/datarule/columns.tsx @@ -102,6 +102,10 @@ export const formSchema: FormSchema[] = [ componentProps: ({ formModel }) => { return { options: columnViewData, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, onChange: async (e: ChangeEvent, a) => { console.log(e, a) @@ -188,6 +192,10 @@ export const formSchema: FormSchema[] = [ componentProps: ({ formModel }) => { return { options: ClientPermissionData, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, // xxxx props onChange: (e) => { console.log(e) diff --git a/src/views/system/user/UserPermissionModal.vue b/src/views/system/user/UserPermissionModal.vue new file mode 100644 index 00000000..aa3227df --- /dev/null +++ b/src/views/system/user/UserPermissionModal.vue @@ -0,0 +1,139 @@ + + + + diff --git a/src/views/system/user/api.ts b/src/views/system/user/api.ts index 1f2ed35b..2da3cb5e 100644 --- a/src/views/system/user/api.ts +++ b/src/views/system/user/api.ts @@ -3,7 +3,12 @@ import { DataResult, PageRequest } from '/@/api/model/baseModel' enum Api { list = '/mainApi/ClientBank/GetClientBankList', edit = '/mainApi/ClientBank/EditClientBank', - info = '/mainApi/ClientBank/GetClientBankInfo' + info = '/mainApi/ClientBank/GetClientBankInfo', + + GetClientUserPermissions = '/mainApi/User/GetClientUserPermissions', + GetDataRuleListByPermission = '/mainApi/User/GetDataRuleListByPermission' + + } // 客户银行信息 列表 (Auth) export function GetClientBankList(data) { @@ -33,3 +38,20 @@ export function GetClientBankInfo(params) { } +// 查询客户端 用户拥有的菜单权限 (Auth) +export function GetClientUserPermissions() { + return request({ + url: Api.GetClientUserPermissions, + method: 'get', + + }) +} + +// 根据权限模块获取数据范围列表 (Auth) +export function GetDataRuleListByPermission(params) { + return request({ + url: Api.GetDataRuleListByPermission, + method: 'get', + params + }) +} diff --git a/src/views/system/user/columns.tsx b/src/views/system/user/columns.tsx index 4d5e50e2..f8f3b401 100644 --- a/src/views/system/user/columns.tsx +++ b/src/views/system/user/columns.tsx @@ -1,4 +1,5 @@ -import { ref } from 'vue' +import { h, ref } from 'vue' +import ConditionFilter from '../datarule/Condition/index.vue' import { BasicColumn, FormSchema } from '/@/components/Table' import { getRoleList, @@ -7,6 +8,8 @@ import { GetFeeCurrencySelectList, getCountryList, } from '/@/api/common' +import { GetTablesByClient } from '/@/views/baseinfo/clientflowtemplate/api' +import { getTables, getColumns, getClientPermissionList } from '/@/api/system/role' import { Tag } from 'ant-design-vue' import { useOptionsStore } from '/@/store/modules/options' import { checkPermissions } from '/@/hooks/Permissions/index' @@ -18,6 +21,30 @@ const orgIds = ref([]) getOrgList().then((res) => { orgIds.value = res.data }) +const columnViewData = [] +const res: API.DataResult = await GetTablesByClient() +if (res.succeeded) { + res.data.forEach((item) => { + columnViewData.push({ + label: item.description, + value: item.name, + }) + }) +} +const ClientPermissionData = [] +let ClientPermissionList = [] +const res2: API.DataResult = await getClientPermissionList() +if (res2.succeeded) { + console.log(res2) + ClientPermissionList = res2.data + res2.data.forEach((item) => { + ClientPermissionData.push({ + label: item.permissionName, + value: item.id, + }) + }) +} +const fields = ref([]) export const columns: BasicColumn[] = [ { title: '用户编码', @@ -353,7 +380,7 @@ export const formSchema: FormSchema[] = [ valueField: 'id', filterOption: (input: string, option: any) => { return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 - } + }, } }, }, @@ -361,7 +388,7 @@ export const formSchema: FormSchema[] = [ field: 'userNumber', component: 'Input', label: '', - show: false + show: false, }, { field: 'divider-selects', @@ -369,8 +396,8 @@ export const formSchema: FormSchema[] = [ label: '附属信息', componentProps: {}, colProps: { - span: 24 - } + span: 24, + }, }, { field: 'orgIds', @@ -407,7 +434,7 @@ export const formSchema: FormSchema[] = [ field: 'defaultOrgName', label: '', component: 'Input', - show: false + show: false, }, { field: 'defaultOrgId', @@ -451,7 +478,7 @@ export const formSchema: FormSchema[] = [ field: 'deptName', label: '', component: 'Input', - show: false + show: false, }, { field: 'deptId', @@ -474,7 +501,7 @@ export const formSchema: FormSchema[] = [ if (!e && !obj) { formModel.deptName = null } - } + }, } }, dynamicDisabled: ({ values }) => { @@ -491,8 +518,8 @@ export const formSchema: FormSchema[] = [ componentProps: { mode: 'multiple', api: getRoleList, - resultField: 'data' - } + resultField: 'data', + }, }, { field: 'signatureUrl', @@ -502,7 +529,7 @@ export const formSchema: FormSchema[] = [ show: ({ values }) => { return !!values.id }, - colProps: { span: 24 } + colProps: { span: 24 }, }, ] @@ -623,3 +650,206 @@ export const BankFormSchema: FormSchema[] = [ colProps: { span: 24 }, }, ] +export const infoformSchema: FormSchema[] = [ + { + field: 'divider-selects', + component: 'Divider', + label: '基本信息', + colProps: { span: 24 }, + }, + { + label: '', + field: 'id', + component: 'Input', + defaultValue: '', + show: false, + }, + { + field: 'columnView', + label: '中文视图名', + component: 'Select', + required: true, + colProps: { span: 12 }, + componentProps: ({ formModel }) => { + return { + options: columnViewData, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + onChange: async (e: ChangeEvent, a) => { + console.log(e, a) + + const res: API.DataResult = await getColumns({ tableViewName: e }) + fields.value = [] + if (res.succeeded) { + console.log(res) + const Arr = [ + { + dbColumnName: '{loginRole}', + columnDescription: '当前登录用户的角色', + }, + { + dbColumnName: '{loginUser}', + columnDescription: '当前登录的用户', + }, + { + dbColumnName: '{loginOrg}', + columnDescription: '机构', + }, + ] + res.data = [...res.data, ...Arr] + res.data.forEach((item) => { + // if (item.name == tableViewName) { + fields.value.push({ + id: item.dbColumnName, + title: item.columnDescription, + name: 'Select', + value: null, + props: { + disabled: false, + multiple: false, + // placeholder: '请选择请假事由', + options: [], + }, + style: { + width: '100%', + }, + }) + // } + }) + if (a) { + formModel.field1 = { + groups: [], + conditions: [], + } + } + + console.log(fields.value, 'fields.value') + } + }, + } + }, + }, + { + label: '权限实体', + field: 'permissionEntity', + component: 'Input', + defaultValue: '', + show: false, + }, + { + label: '', + field: 'Space1', + component: 'Space', + defaultValue: '', + colProps: { + span: 12, + }, + }, + { + field: 'permissionId', + label: '资源标识', + component: 'Select', + colProps: { span: 12 }, + required: true, + show: false, + componentProps: ({ formModel }) => { + return { + options: ClientPermissionData, + showSearch: true, + filterOption: (input: string, option: any) => { + return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }, + // xxxx props + onChange: (e) => { + console.log(e) + ClientPermissionList.forEach((item) => { + if (item.id == e) { + console.log(item) + formModel.permissionEntity = item.permissionEntity + } + }) + }, + } + }, + }, + { + field: 'status', + label: '是否启用', + component: 'RadioButtonGroup', + defaultValue: 0, + colProps: { span: 12 }, + componentProps: { + options: [ + { label: '是', value: 0 }, + { label: '否', value: 1 }, + ], + }, + }, + { + field: 'orderNo', + label: '排序号', + component: 'InputNumber', + defaultValue: 0, + colProps: { span: 12 }, + }, + { + field: 'description', + label: '权限描述', + required: true, + component: 'InputTextArea', + colProps: { span: 12 }, + componentProps: { + rows: 4, + }, + }, + { + field: 'note', + label: '备注', + component: 'InputTextArea', + colProps: { span: 12 }, + componentProps: { + rows: 4, + }, + }, + { + field: 'divider-selects', + component: 'Divider', + label: '权限规则', + colProps: { span: 24 }, + ifShow: ({ values }) => { + return !!values.columnView + }, + }, + { + field: 'field1', + component: 'Input', + colProps: { + span: 24, + }, + defaultValue: { + groups: [], + conditions: [], + }, + ifShow: ({ values }) => { + return !!values.columnView + }, + // 通过函数渲染一个 Input + render: ({ model, field }) => { + return h(ConditionFilter, { + modelValue: model[field], + filterFields: fields.value, + // onChange: (e: ChangeEvent) => { + // console.log(e); + // model[field] = e.target.value; + // }, + }) + }, + // componentProps: { + // onChange: (e: ChangeEvent) => { + // console.log('change', e); + // }, + // }, + }, +] diff --git a/src/views/system/user/dataruleIndex.vue b/src/views/system/user/dataruleIndex.vue new file mode 100644 index 00000000..f181f62b --- /dev/null +++ b/src/views/system/user/dataruleIndex.vue @@ -0,0 +1,82 @@ + + + diff --git a/src/views/system/user/dataruleInfo.vue b/src/views/system/user/dataruleInfo.vue new file mode 100644 index 00000000..20fc3f64 --- /dev/null +++ b/src/views/system/user/dataruleInfo.vue @@ -0,0 +1,102 @@ + + diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index afef3a4f..451fef1d 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -24,6 +24,11 @@ tooltip: '编辑', onClick: handleEdit.bind(null, record), }, + { + icon: 'ant-design:trademark-circle-outlined', + tooltip: '授权', + onClick: handlePermission.bind(null, record), + }, { icon: 'ant-design:delete-outlined', tooltip: '删除', @@ -32,15 +37,16 @@ title: '是否要删除此条数据?', okText: '是', cancelText: '否', - confirm: handleDelete.bind(null, record) - } - } + confirm: handleDelete.bind(null, record), + }, + }, ]" /> + - +