|
@@ -1,43 +1,26 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <!-- 新增角色 -->
|
|
|
|
|
- <a-modal class="commonModal add-roles" title="新增角色" v-model:visible="visible" @cancel="cancel" centered :maskClosable="false" :width="isPingAnOem() ? '800px' : '100%'">
|
|
|
|
|
- <template #footer>
|
|
|
|
|
- <a-button key="cancel" type="primary" :loading="loading" @click="cancel">取消</a-button>
|
|
|
|
|
- <a-button key="submit" type="primary" :loading="loading" @click="submit">新增</a-button>
|
|
|
|
|
- </template>
|
|
|
|
|
- <a-form class="inlineForm" ref="formRef" :model="formState" :rules="rules">
|
|
|
|
|
- <a-row :gutter="24">
|
|
|
|
|
- <a-col :span="24">
|
|
|
|
|
- <a-form-item label="角色名称">
|
|
|
|
|
- <a-input class="dialogInput" style="width: 200px" v-model:value="name" placeholder="请输入角色名称" />
|
|
|
|
|
- </a-form-item>
|
|
|
|
|
- </a-col>
|
|
|
|
|
- <a-col :span="24">
|
|
|
|
|
- <a-form-item label="权限功能" name></a-form-item>
|
|
|
|
|
- </a-col>
|
|
|
|
|
- <a-col :span="24">
|
|
|
|
|
- <a-tree checkable :tree-data="tableList" v-model:checkedKeys="checkedKeys" :replace-fields="replaceFields"> </a-tree>
|
|
|
|
|
- <!-- <div class="powerTable" v-else>
|
|
|
|
|
- <div class="powerRow" v-for="(item, i) in tableList" :key="i + '0'">
|
|
|
|
|
- <div class="powerLeft">
|
|
|
|
|
- <a-checkbox @change="firstChaneg(item)" v-model:checked="item.Menu.ishadrole">{{ item.Menu.resourcename }} </a-checkbox>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="powerRight">
|
|
|
|
|
- <div class="line" v-for="(sub, j) in item.SubMenu" :key="j + '1'">
|
|
|
|
|
- <div class="left">
|
|
|
|
|
- <a-checkbox v-model:checked="sub.Menu.ishadrole" @change="secondChange(item, sub)" :value="sub.Menu.resourcecode">{{ sub.Menu.resourcename }} </a-checkbox>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="right">
|
|
|
|
|
- <a-checkbox v-for="(subNext, l) in sub.SubMenu" :key="l + '3'" v-model:checked="subNext.Menu.ishadrole" @change="thirdChange(item, sub, subNext)" :value="subNext.Menu.resourcecode">{{ subNext.Menu.resourcename }} </a-checkbox>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div> -->
|
|
|
|
|
- </a-col>
|
|
|
|
|
- </a-row>
|
|
|
|
|
- </a-form>
|
|
|
|
|
- </a-modal>
|
|
|
|
|
|
|
+ <!-- 新增角色 -->
|
|
|
|
|
+ <a-modal class="commonModal add-roles" title="新增角色" v-model:visible="visible" @cancel="cancel" centered :maskClosable="false">
|
|
|
|
|
+ <template #footer>
|
|
|
|
|
+ <a-button key="cancel" type="primary" :loading="loading" @click="cancel">取消</a-button>
|
|
|
|
|
+ <a-button key="submit" type="primary" :loading="loading" @click="submit">新增</a-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <a-form class="inlineForm" ref="formRef" :model="formState" :rules="rules">
|
|
|
|
|
+ <a-row :gutter="24">
|
|
|
|
|
+ <a-col :span="24">
|
|
|
|
|
+ <a-form-item label="角色名称">
|
|
|
|
|
+ <a-input class="dialogInput" style="width: 200px" v-model:value="name" placeholder="请输入角色名称" />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ </a-col>
|
|
|
|
|
+ <a-col :span="24">
|
|
|
|
|
+ <a-form-item label="权限功能" name></a-form-item>
|
|
|
|
|
+ </a-col>
|
|
|
|
|
+ <a-col :span="24">
|
|
|
|
|
+ <a-tree checkable :tree-data="tableList" v-model:checkedKeys="checkedKeys" :replace-fields="replaceFields"> </a-tree>
|
|
|
|
|
+ </a-col>
|
|
|
|
|
+ </a-row>
|
|
|
|
|
+ </a-form>
|
|
|
|
|
+ </a-modal>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
<script lang="ts">
|
|
@@ -51,9 +34,8 @@ import { message } from 'ant-design-vue';
|
|
|
import { roleOperate } from '@/services/proto/accountinfo';
|
|
import { roleOperate } from '@/services/proto/accountinfo';
|
|
|
import { ManagerRoleOperateReq, MemberFuncMenu } from '@/services/proto/accountinfo/interface';
|
|
import { ManagerRoleOperateReq, MemberFuncMenu } from '@/services/proto/accountinfo/interface';
|
|
|
import { getUserId } from '@/services/bus/user';
|
|
import { getUserId } from '@/services/bus/user';
|
|
|
-import { getAoletype_string, getAreaUserId, getUserAccountType } from '@/services/bus/user';
|
|
|
|
|
|
|
+import { getAoletype_string, getAreaUserId } from '@/services/bus/user';
|
|
|
import { geLoginID_number } from '@/services/bus/login';
|
|
import { geLoginID_number } from '@/services/bus/login';
|
|
|
-import { isPingAnOem } from '@/common/config/projectName';
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
name: 'account_info_manager_btn_add',
|
|
name: 'account_info_manager_btn_add',
|
|
@@ -73,10 +55,8 @@ export default defineComponent({
|
|
|
const checkedKeys = ref<string[]>([]);
|
|
const checkedKeys = ref<string[]>([]);
|
|
|
watchEffect(() => {
|
|
watchEffect(() => {
|
|
|
if (visible.value) {
|
|
if (visible.value) {
|
|
|
- // 平安 权限层级超过 4 层了,原先设计最多支持3个层级,故得重新写
|
|
|
|
|
- // 菜单类型 1:管理端 2:交易端 3:终端(企业云平台) 4:仓单贸易 ps:新加的参数,为了兼容以前,不传则默认查3
|
|
|
|
|
- const menutype = isPingAnOem() ? 5 : 3;
|
|
|
|
|
- const param = { userid: getUserId(), roleid: getAoletype_string(), menutype };
|
|
|
|
|
|
|
+ // 菜单类型 1:管理端 2:交易端 3:终端(企业云平台) 4:仓单贸易 5:PCWEB(v6) ps:新加的参数,为了兼容以前,不传则默认查3
|
|
|
|
|
+ const param = { userid: getUserId(), roleid: getAoletype_string(), menutype: 5 };
|
|
|
|
|
|
|
|
queryResultLoadingAndInfo(QueryAccMgrRoleMenu, loading, param).then((res) => {
|
|
queryResultLoadingAndInfo(QueryAccMgrRoleMenu, loading, param).then((res) => {
|
|
|
const fn = (arr: any[]) => {
|
|
const fn = (arr: any[]) => {
|
|
@@ -98,42 +78,13 @@ export default defineComponent({
|
|
|
message.error('请输入角色名称');
|
|
message.error('请输入角色名称');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- let checkedCodes = [];
|
|
|
|
|
- if (isPingAnOem()) {
|
|
|
|
|
- checkedCodes = checkedKeys.value;
|
|
|
|
|
- } else {
|
|
|
|
|
- const result: string[] = [];
|
|
|
|
|
- // 处理已经勾选的数据
|
|
|
|
|
- tableList.value.forEach((first) => {
|
|
|
|
|
- if (first.Menu.ishadrole) {
|
|
|
|
|
- result.push(first.Menu.resourcecode);
|
|
|
|
|
- first.SubMenu.forEach((second) => {
|
|
|
|
|
- if (second.Menu.ishadrole) {
|
|
|
|
|
- result.push(second.Menu.resourcecode);
|
|
|
|
|
- second.SubMenu.forEach((third) => {
|
|
|
|
|
- if (third.Menu.ishadrole) {
|
|
|
|
|
- result.push(third.Menu.resourcecode);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- if (result.length === 0) {
|
|
|
|
|
- message.error('请至少选择一个权限');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- checkedCodes = result;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
const reqParam: ManagerRoleOperateReq = {
|
|
const reqParam: ManagerRoleOperateReq = {
|
|
|
autoid: getUserId(), // uint64 角色ID
|
|
autoid: getUserId(), // uint64 角色ID
|
|
|
operatetype: 1, // uint32 操作类型-1:新增 2:修改
|
|
operatetype: 1, // uint32 操作类型-1:新增 2:修改
|
|
|
areauserid: getAreaUserId(), // uint64 所属机构
|
|
areauserid: getAreaUserId(), // uint64 所属机构
|
|
|
modifierid: Number(geLoginID_number()), // uint64 修改人ID
|
|
modifierid: Number(geLoginID_number()), // uint64 修改人ID
|
|
|
rolename: name.value, // string 角色名称
|
|
rolename: name.value, // string 角色名称
|
|
|
- memberfuncmenus: checkedCodes.map((item) => {
|
|
|
|
|
|
|
+ memberfuncmenus: checkedKeys.value.map((item) => {
|
|
|
return {
|
|
return {
|
|
|
resourcecode: item,
|
|
resourcecode: item,
|
|
|
} as MemberFuncMenu;
|
|
} as MemberFuncMenu;
|
|
@@ -143,31 +94,6 @@ export default defineComponent({
|
|
|
cancel(true);
|
|
cancel(true);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- function firstChaneg(value: ErmcpRoleMenuEx) {
|
|
|
|
|
- if (value.Menu.ishadrole) {
|
|
|
|
|
- value.SubMenu.forEach((el) => {
|
|
|
|
|
- el.Menu.ishadrole = true;
|
|
|
|
|
- el.SubMenu.forEach((item) => (item.Menu.ishadrole = true));
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- value.SubMenu.forEach((el) => {
|
|
|
|
|
- el.Menu.ishadrole = false;
|
|
|
|
|
- el.SubMenu.forEach((item) => (item.Menu.ishadrole = false));
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- function secondChange(item: ErmcpRoleMenuEx, sub: ErmcpRoleMenuEx) {
|
|
|
|
|
- if (sub.Menu.ishadrole) {
|
|
|
|
|
- item.Menu.ishadrole = true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function thirdChange(item: ErmcpRoleMenuEx, sub: ErmcpRoleMenuEx, subNext: ErmcpRoleMenuEx) {
|
|
|
|
|
- if (subNext.Menu.ishadrole) {
|
|
|
|
|
- sub.Menu.ishadrole = true;
|
|
|
|
|
- item.Menu.ishadrole = true;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
formState,
|
|
formState,
|
|
@@ -177,12 +103,8 @@ export default defineComponent({
|
|
|
name,
|
|
name,
|
|
|
cancel,
|
|
cancel,
|
|
|
submit,
|
|
submit,
|
|
|
- secondChange,
|
|
|
|
|
- thirdChange,
|
|
|
|
|
loading,
|
|
loading,
|
|
|
tableList,
|
|
tableList,
|
|
|
- firstChaneg,
|
|
|
|
|
- isPingAnOem,
|
|
|
|
|
replaceFields,
|
|
replaceFields,
|
|
|
checkedKeys,
|
|
checkedKeys,
|
|
|
};
|
|
};
|