根据角色获取菜单接口联调
Showing
5 changed files
with
43 additions
and
21 deletions
| ... | @@ -35,7 +35,7 @@ export const getSystemMenu = (params, isAdmin = false) => { | ... | @@ -35,7 +35,7 @@ export const getSystemMenu = (params, isAdmin = false) => { |
| 35 | }/product-menu-permission/tenant/get-product-menu?tenantGuid=${params.tenantGuid}&platformSystemGuid=455a0c2180aa4217b60e859032de0943` | 35 | }/product-menu-permission/tenant/get-product-menu?tenantGuid=${params.tenantGuid}&platformSystemGuid=455a0c2180aa4217b60e859032de0943` |
| 36 | : `${ | 36 | : `${ |
| 37 | import.meta.env.VITE_APP_AUTH_URL | 37 | import.meta.env.VITE_APP_AUTH_URL |
| 38 | }/product-menu-permission/staff/get-product-menu-template?platformSystemGuid=455a0c2180aa4217b60e859032de0943`, | 38 | }/product-menu-permission/staff/get-product-menu-template?platformSystemGuid=455a0c2180aa4217b60e859032de0943&funcPermissionTemplateGuid=${params.roleGuid}`, |
| 39 | method: "get", | 39 | method: "get", |
| 40 | }); | 40 | }); |
| 41 | }; | 41 | }; | ... | ... |
| ... | @@ -99,19 +99,20 @@ const useUserStore = defineStore( | ... | @@ -99,19 +99,20 @@ const useUserStore = defineStore( |
| 99 | let data = localStorage.getItem('userData'); | 99 | let data = localStorage.getItem('userData'); |
| 100 | let userData = data && JSON.parse(data); | 100 | let userData = data && JSON.parse(data); |
| 101 | return getSystemMenu( | 101 | return getSystemMenu( |
| 102 | { tenantGuid: localStorage.getItem('currentTenantGuid') }, | 102 | { tenantGuid: localStorage.getItem('currentTenantGuid'), |
| 103 | userData?.isAdmin == "Y" && | 103 | roleGuid: role == 'use' ? '33cc6290689249a28004b591a2daac25' : (role == 'provider' ? '0ad4985055fa4007aca9e2782ccd23d2' : '') |
| 104 | (!userData?.superTubeFlag || | 104 | }, false |
| 105 | userData?.superTubeFlag == "Y") | 105 | // role != 'operation' ? false : (userData?.isAdmin == "Y" && (!userData?.superTubeFlag || userData?.superTubeFlag == "Y")) |
| 106 | ).then((info: any) => { | 106 | ).then((info: any) => { |
| 107 | //解决页面调用流程接口传递staffGuid,为空的问题 | 107 | //解决页面调用流程接口传递staffGuid,为空的问题 |
| 108 | if (info.code == "00000") { | 108 | if (info.code == "00000") { |
| 109 | localStorage.setItem("userInfoData", JSON.stringify(info.data)); | 109 | localStorage.setItem("userInfoData", JSON.stringify(info.data)); |
| 110 | userInfoData.value = info.data; | 110 | userInfoData.value = info.data; |
| 111 | // window.location.href = location.origin + info.data[0].menuList[0].path | 111 | // window.location.href = location.origin + info.data[0].menuList[0].path |
| 112 | return true; | 112 | return info.data || []; |
| 113 | } else { | 113 | } else { |
| 114 | ElMessage.error(info.msg); | 114 | ElMessage.error(info.msg); |
| 115 | return false; | ||
| 115 | } | 116 | } |
| 116 | }); | 117 | }); |
| 117 | } | 118 | } | ... | ... |
| ... | @@ -22,7 +22,7 @@ const dialogVisible = computed(() => { | ... | @@ -22,7 +22,7 @@ const dialogVisible = computed(() => { |
| 22 | const loading = ref(false); | 22 | const loading = ref(false); |
| 23 | 23 | ||
| 24 | /** 记录用户选择的角色 */ | 24 | /** 记录用户选择的角色 */ |
| 25 | const selectRole = ref('use'); | 25 | const selectRole = ref('use'); //TODO,在专区需要默认值是平台运营方。 |
| 26 | 26 | ||
| 27 | onBeforeRouteLeave(() => { | 27 | onBeforeRouteLeave(() => { |
| 28 | }) | 28 | }) |
| ... | @@ -35,22 +35,39 @@ function goBack() { | ... | @@ -35,22 +35,39 @@ function goBack() { |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | const beforeLogin = () => { | 37 | const beforeLogin = () => { |
| 38 | loading.value = true; | ||
| 38 | if (userStore.getTokenPromise) { | 39 | if (userStore.getTokenPromise) { |
| 39 | userStore.getTokenPromise.then(() => { | 40 | userStore.getTokenPromise.then(() => { |
| 40 | userStore.getUserSystemMenuByRole(selectRole.value).then((res) => { | 41 | userStore.getUserSystemMenuByRole(selectRole.value).then((res) => { |
| 41 | if (res === true) { | 42 | loading.value = false; |
| 43 | if (res && res !== false) { | ||
| 44 | if (res?.length === 0) { | ||
| 45 | ElMessage.warning('该系统用户暂无可用的菜单,请先配置'); | ||
| 46 | return; | ||
| 47 | } | ||
| 48 | localStorage.setItem('userRole', selectRole.value); | ||
| 42 | userStore.isGetCurrUserInfo = false; | 49 | userStore.isGetCurrUserInfo = false; |
| 50 | router.push('/') | ||
| 43 | } | 51 | } |
| 44 | router.push('/') | ||
| 45 | }) | 52 | }) |
| 53 | }).catch(() => { | ||
| 54 | loading.value = false; | ||
| 46 | }); | 55 | }); |
| 47 | } else { | 56 | } else { |
| 48 | userStore.getUserSystemMenuByRole(selectRole.value).then((res) => { | 57 | userStore.getUserSystemMenuByRole(selectRole.value).then((res) => { |
| 49 | if (res === true) { | 58 | loading.value = false; |
| 59 | if (res && res !== false) { | ||
| 60 | if (res?.length === 0) { | ||
| 61 | ElMessage.warning('该系统用户暂无可用的菜单,请先配置'); | ||
| 62 | return; | ||
| 63 | } | ||
| 64 | localStorage.setItem('userRole', selectRole.value); | ||
| 50 | userStore.isGetCurrUserInfo = false; | 65 | userStore.isGetCurrUserInfo = false; |
| 66 | router.push('/') | ||
| 51 | } | 67 | } |
| 52 | router.push('/') | 68 | }).catch(() => { |
| 53 | }) | 69 | loading.value = false; |
| 70 | }); | ||
| 54 | } | 71 | } |
| 55 | } | 72 | } |
| 56 | 73 | ||
| ... | @@ -74,10 +91,11 @@ const beforeLogin = () => { | ... | @@ -74,10 +91,11 @@ const beforeLogin = () => { |
| 74 | <div class="img-provider"></div> | 91 | <div class="img-provider"></div> |
| 75 | <div class="title">数据提供方</div> | 92 | <div class="title">数据提供方</div> |
| 76 | </div> | 93 | </div> |
| 77 | <div class="per" :class="selectRole == 'operation' ? 'selected' : ''" @click="selectRole = 'operation'"> | 94 | <!-- 只有专区才有 --> |
| 95 | <!-- <div class="per" :class="selectRole == 'operation' ? 'selected' : ''" @click="selectRole = 'operation'"> | ||
| 78 | <div class="img-operation"></div> | 96 | <div class="img-operation"></div> |
| 79 | <div class="title">平台运营方</div> | 97 | <div class="title">平台运营方</div> |
| 80 | </div> | 98 | </div> --> |
| 81 | </div> | 99 | </div> |
| 82 | <div class="login-footer"> | 100 | <div class="login-footer"> |
| 83 | <el-button :loading="loading" ref="loginButton" type="primary" size="large" style="width: 100%;" | 101 | <el-button :loading="loading" ref="loginButton" type="primary" size="large" style="width: 100%;" | ... | ... |
| ... | @@ -220,14 +220,16 @@ const addExtend = () => { | ... | @@ -220,14 +220,16 @@ const addExtend = () => { |
| 220 | 220 | ||
| 221 | /** ----------------- 数据产品表格相关信息 ----------------------------- */ | 221 | /** ----------------- 数据产品表格相关信息 ----------------------------- */ |
| 222 | const productTableRef = ref(); | 222 | const productTableRef = ref(); |
| 223 | const productData: any = ref([]); | 223 | const productData: any = ref([{ dataProductId: '' }]); |
| 224 | 224 | ||
| 225 | const productList: any = ref([]); | 225 | const productList: any = ref([]); |
| 226 | 226 | ||
| 227 | /** 基本信息的入参定义表格配置 */ | 227 | /** 基本信息的入参定义表格配置 */ |
| 228 | const productTableInfo = ref({ | 228 | const productTableInfo = ref({ |
| 229 | id: "input-product-table", | 229 | id: "input-product-table", |
| 230 | height: '214px', | 230 | height: '75px', |
| 231 | minHeight: '60px', | ||
| 232 | minPanelHeight: '60px', | ||
| 231 | fields: [ | 233 | fields: [ |
| 232 | { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, | 234 | { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" }, |
| 233 | { label: "数据产品", field: "dataProductId", width: 180, required: true, columClass: 'edit-colum', type: 'edit' }, | 235 | { label: "数据产品", field: "dataProductId", width: 180, required: true, columClass: 'edit-colum', type: 'edit' }, |
| ... | @@ -795,11 +797,10 @@ onActivated(() => { | ... | @@ -795,11 +797,10 @@ onActivated(() => { |
| 795 | </ContentWrap> | 797 | </ContentWrap> |
| 796 | <ContentWrap id="product-info" title="合约标的" expandSwicth style="margin-top: 15px" :isExpand="expandInfo" | 798 | <ContentWrap id="product-info" title="合约标的" expandSwicth style="margin-top: 15px" :isExpand="expandInfo" |
| 797 | @expand="(v) => (expandInfo = v)" description=""> | 799 | @expand="(v) => (expandInfo = v)" description=""> |
| 798 | <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" | 800 | <Table ref="productTableRef" :tableInfo="productTableInfo" @table-select-change="hanldeTableSelectChange" /> |
| 799 | @table-select-change="hanldeTableSelectChange" /> | 801 | <!-- <div class="row-add-btn"> |
| 800 | <div class="row-add-btn"> | ||
| 801 | <el-button link @click="addProduct" :icon="CirclePlus" v-preReClick>添加产品</el-button> | 802 | <el-button link @click="addProduct" :icon="CirclePlus" v-preReClick>添加产品</el-button> |
| 802 | </div> | 803 | </div> --> |
| 803 | </ContentWrap> | 804 | </ContentWrap> |
| 804 | <ContentWrap id="policy-info" title="合约策略" expandSwicth style="margin-top: 15px" :isExpand="expandPolicy" | 805 | <ContentWrap id="policy-info" title="合约策略" expandSwicth style="margin-top: 15px" :isExpand="expandPolicy" |
| 805 | @expand="(v) => (expandPolicy = v)" description=""> | 806 | @expand="(v) => (expandPolicy = v)" description=""> | ... | ... |
| ... | @@ -2,7 +2,9 @@ | ... | @@ -2,7 +2,9 @@ |
| 2 | 2 | ||
| 3 | const router = useRouter(); | 3 | const router = useRouter(); |
| 4 | 4 | ||
| 5 | const dataRole = ref('operation'); | 5 | const dataRole = computed(() => { |
| 6 | return localStorage.getItem('userRole'); | ||
| 7 | }); | ||
| 6 | 8 | ||
| 7 | const click = (command) => { | 9 | const click = (command) => { |
| 8 | let url = '' | 10 | let url = '' | ... | ... |
-
Please register or sign in to post a comment