feat(web): 统一页面显示和权限
This commit is contained in:
@@ -187,3 +187,19 @@ export function apiGet(url) {
|
|||||||
export function apiPost(url) {
|
export function apiPost(url) {
|
||||||
return api('post', url)
|
return api('post', url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function roleCheck(roles) {
|
||||||
|
return `\${ARRAYINCLUDES(['${roles.join("','")}'], role)}`
|
||||||
|
}
|
||||||
|
|
||||||
|
export const role = {
|
||||||
|
administrator: 'ADMINISTRATOR',
|
||||||
|
checker: 'CHECKER',
|
||||||
|
provider: 'PROVIDER',
|
||||||
|
customer: 'CUSTOMER',
|
||||||
|
}
|
||||||
|
|
||||||
|
export const administratorOnly = roleCheck([role.administrator])
|
||||||
|
export const checkerOnly = roleCheck([role.administrator, role.checker])
|
||||||
|
export const userOnly = roleCheck([role.administrator, role.provider, role.customer])
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import {apiGet, useAmis} from '../../components/constants.js'
|
import {apiGet, useAmis} from '../../components/constants.js'
|
||||||
import {userChangePasswordDialog} from "../../components/user/dialog-user-change-password.js";
|
import {userChangePasswordDialog} from "../../components/user/dialog-user-change-password.js";
|
||||||
import {tabUser} from "./tab-user.js";
|
import {tabUser} from "./tab-user.js";
|
||||||
import {tabMarket} from "./tab-market.js";
|
|
||||||
import {tabData} from "./tab-data.js";
|
import {tabData} from "./tab-data.js";
|
||||||
import {tabSettings} from "./tab-settings.js";
|
import {tabSettings} from "./tab-settings.js";
|
||||||
|
import {tabCheck} from "./tab-check.js";
|
||||||
|
|
||||||
useAmis(information => {
|
useAmis(information => {
|
||||||
return {
|
return {
|
||||||
@@ -56,9 +56,10 @@ useAmis(information => {
|
|||||||
type: 'tabs',
|
type: 'tabs',
|
||||||
tabsMode: 'vertical',
|
tabsMode: 'vertical',
|
||||||
tabs: [
|
tabs: [
|
||||||
tabData(),
|
|
||||||
// tabOverview(),
|
// tabOverview(),
|
||||||
tabMarket(),
|
// tabMarket(),
|
||||||
|
tabData(),
|
||||||
|
tabCheck(),
|
||||||
tabUser(),
|
tabUser(),
|
||||||
tabSettings(),
|
tabSettings(),
|
||||||
]
|
]
|
||||||
|
|||||||
12
gringotts-frontend/pages/index/tab-check.js
Normal file
12
gringotts-frontend/pages/index/tab-check.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import {checkerOnly} from "../../components/constants.js";
|
||||||
|
|
||||||
|
export function tabCheck() {
|
||||||
|
return {
|
||||||
|
visibleOn: checkerOnly,
|
||||||
|
title: '审核审查',
|
||||||
|
icon: 'fa fa-shield-halved',
|
||||||
|
body: [
|
||||||
|
'hello world'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,10 +3,11 @@ import {
|
|||||||
resourceDetailDialog,
|
resourceDetailDialog,
|
||||||
resourceEditeDialog
|
resourceEditeDialog
|
||||||
} from "../../components/resource/dialog-resource.js";
|
} from "../../components/resource/dialog-resource.js";
|
||||||
import {apiGet, apiPost, crudCommonOptions} from "../../components/constants.js";
|
import {apiGet, apiPost, crudCommonOptions, userOnly} from "../../components/constants.js";
|
||||||
|
|
||||||
export function tabData() {
|
export function tabData() {
|
||||||
return {
|
return {
|
||||||
|
visibleOn: userOnly,
|
||||||
title: '数据资源',
|
title: '数据资源',
|
||||||
icon: 'fa fa-database',
|
icon: 'fa fa-database',
|
||||||
body: [
|
body: [
|
||||||
@@ -20,7 +21,7 @@ export function tabData() {
|
|||||||
'reload',
|
'reload',
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '新增数据资源',
|
label: '',
|
||||||
icon: 'fa fa-plus',
|
icon: 'fa fa-plus',
|
||||||
...resourceAddDialog()
|
...resourceAddDialog()
|
||||||
},
|
},
|
||||||
@@ -52,18 +53,21 @@ export function tabData() {
|
|||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '查看',
|
label: '查看',
|
||||||
|
icon: 'fa fa-eye',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
...resourceDetailDialog(),
|
...resourceDetailDialog(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
|
icon: 'fa fa-pen-fancy',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
...resourceEditeDialog(),
|
...resourceEditeDialog(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'action',
|
type: 'action',
|
||||||
label: '删除',
|
label: '删除',
|
||||||
|
icon: 'fa fa-remove',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
className: 'text-danger',
|
className: 'text-danger',
|
||||||
confirmTitle: '确认删除',
|
confirmTitle: '确认删除',
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
import {administratorOnly} from "../../components/constants.js";
|
||||||
|
|
||||||
export function tabSettings() {
|
export function tabSettings() {
|
||||||
return {
|
return {
|
||||||
visibleOn: '${role === "ADMINISTRATOR"}',
|
visibleOn: administratorOnly,
|
||||||
title: '系统管理',
|
title: '系统管理',
|
||||||
icon: 'fa fa-gear',
|
icon: 'fa fa-gear',
|
||||||
body: [
|
body: [
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
administratorOnly,
|
||||||
apiGet,
|
apiGet,
|
||||||
copyField,
|
copyField,
|
||||||
crudCommonOptions,
|
crudCommonOptions,
|
||||||
@@ -11,7 +12,7 @@ import {userAdministratorRegisterDialog} from "../../components/user/dialog-user
|
|||||||
|
|
||||||
export function tabUser() {
|
export function tabUser() {
|
||||||
return {
|
return {
|
||||||
visibleOn: '${role === "ADMINISTRATOR"}',
|
visibleOn: administratorOnly,
|
||||||
title: '用户管理',
|
title: '用户管理',
|
||||||
icon: 'fa fa-user',
|
icon: 'fa fa-user',
|
||||||
body: [
|
body: [
|
||||||
|
|||||||
Reference in New Issue
Block a user