From 615edb57b89192262cfae2609e0c1a1b0f8cbca2 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Fri, 20 Dec 2024 16:48:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E4=BC=98=E5=8C=96=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=A0=B7=E5=BC=8F=EF=BC=8C=E6=9B=B4=E7=8E=B0=E4=BB=A3?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gringotts-frontend/pages/index/main.js | 192 +++++++++-- gringotts-frontend/pages/index/tab-check.js | 255 +++++++------- gringotts-frontend/pages/index/tab-data.js | 177 +++++----- gringotts-frontend/pages/index/tab-market.js | 155 +++++---- .../pages/index/tab-permissions.js | 313 +++++++++--------- gringotts-frontend/pages/index/tab-user.js | 125 ++++--- gringotts-frontend/public/logo.svg | 8 + 7 files changed, 663 insertions(+), 562 deletions(-) create mode 100644 gringotts-frontend/public/logo.svg diff --git a/gringotts-frontend/pages/index/main.js b/gringotts-frontend/pages/index/main.js index 284a598..93055cc 100644 --- a/gringotts-frontend/pages/index/main.js +++ b/gringotts-frontend/pages/index/main.js @@ -1,14 +1,14 @@ import './style.css' -import {apiGet, useAmis} from '../../components/constants.js' -import {userChangePasswordDialog} from "../../components/user/dialog-user-change-password.js"; -import {tabUser} from "./tab-user.js"; -import {tabData} from "./tab-data.js"; -import {tabSettings} from "./tab-settings.js"; -import {tabCheck} from "./tab-check.js"; -import {tabPermissions} from "./tab-permissions.js"; -import {tabMarket} from "./tab-market.js"; +import {administratorOnly, apiGet, checkerOnly, useAmis, userOnly} from '../../components/constants.js' +import {userChangePasswordDialog} from '../../components/user/dialog-user-change-password.js' +import {tabUser} from './tab-user.js' +import {tabData} from './tab-data.js' +import {tabSettings} from './tab-settings.js' +import {tabCheck} from './tab-check.js' +import {tabPermissions} from './tab-permissions.js' +import {tabMarket} from './tab-market.js' -useAmis(information => { +useAmis((information) => { return { id: 'header-service', className: 'h-full', @@ -23,22 +23,105 @@ useAmis(information => { args: { url: '/pages/login/index.html', blank: false, - } - } - ] - } + }, + }, + ], + }, }, body: [ { + id: 'root-page', type: 'page', - title: information.title, - subTitle: '提供合法合规的数据要素可信供给工具', + title: { + type: 'flex', + justify: 'flex-start', + items: [ + { + type: 'avatar', + className: 'mr-2 bg-transparent', + src: '/logo.svg', + shape: 'square', + fit: 'contain', + }, + { + type: 'flex', + className: 'w-50', + direction: 'column', + items: [ + { + type: 'tpl', + className: 'font-bold text-white', + tpl: information.title, + }, + { + type: 'tpl', + className: 'font-bold text-xs text-gray-200', + tpl: '提供合法合规的数据要素可信供给工具', + }, + ] + } + ] + }, + // subTitle: '提供合法合规的数据要素可信供给工具', + headerClassName: 'bg-gray-800 text-white', + toolbarClassName: 'bg-gray-800', toolbar: [ + { + type: 'action', + label: '数据市场', + icon: 'fa fa-store', + level: 'link', + className: 'text-bold text-white', + onEvent: { + click: { + actions: [ + { + actionType: 'setValue', + componentId: 'root-page', + args: { + value: { + activePage: 'market', + } + } + } + ] + } + } + }, + { + type: 'action', + label: '我的资源', + icon: 'fa fa-database', + level: 'link', + className: 'text-bold text-white', + onEvent: { + click: { + actions: [ + { + actionType: 'setValue', + componentId: 'root-page', + args: { + value: { + activePage: 'tab', + } + } + } + ] + } + } + }, + { + type: 'divider', + direction: 'vertical', + color: '#4d4d4d', + }, { type: 'dropdown-button', label: '${username}', align: 'right', trigger: 'hover', + btnClassName: 'text-white', + level: 'link', buttons: [ { label: '修改密码', @@ -49,26 +132,69 @@ useAmis(information => { actionType: 'ajax', api: apiGet('${base}/user/logout'), reload: 'header-service', - } - ] - } + }, + ], + }, ], bodyClassName: 'p-0', - body: { - className: 'h-full border-0', - type: 'tabs', - tabsMode: 'vertical', - tabs: [ - // tabOverview(), - tabMarket(), - tabData(), - tabPermissions(), - tabCheck(), - tabUser(), - tabSettings(), - ] + data: { + activePage: 'market', + tabActiveKey: 'data' }, - } - ] + body: [ + { + visibleOn: "${activePage === 'market'}", + type: 'wrapper', + body: tabMarket(), + }, + { + visibleOn: "${activePage === 'tab'}", + className: 'h-full border-0', + type: 'tabs', + tabsMode: 'vertical', + activeKey: '${tabActiveKey}', + tabs: [ + // tabOverview(), + { + hash: 'data', + visibleOn: userOnly, + title: '数据资源', + icon: 'fa fa-database', + reload: true, + body: tabData() + }, + { + hash: 'permission', + visibleOn: userOnly, + title: '权属管理', + icon: 'fa fa-key', + reload: true, + body: tabPermissions(), + }, + { + hash: 'check', + visibleOn: checkerOnly, + title: '审核审查', + icon: 'fa fa-shield-halved', + reload: true, + body: tabCheck(), + }, + { + hash: 'user', + visibleOn: administratorOnly, + title: '用户管理', + icon: 'fa fa-user', + reload: true, + body: tabUser(), + }, + { + hash: 'settings', + ...tabSettings(), + } + ], + } + ], + }, + ], } }) diff --git a/gringotts-frontend/pages/index/tab-check.js b/gringotts-frontend/pages/index/tab-check.js index ee87fdf..eb9bcb3 100644 --- a/gringotts-frontend/pages/index/tab-check.js +++ b/gringotts-frontend/pages/index/tab-check.js @@ -1,6 +1,5 @@ import { apiGet, - checkerOnly, checkOverMapping, checkTypeMapping, crudCommonOptions, @@ -13,134 +12,128 @@ import {authenticationDetailDialog, confirmationDetailDialog} from "../../compon import {wareDetailDialog} from "../../components/ware/dialog-ware.js"; export function tabCheck() { - return { - visibleOn: checkerOnly, - title: '审核审查', - icon: 'fa fa-shield-halved', - reload: true, - body: [ - { - name: 'check_order_list', - type: 'crud', - api: apiGet('${base}/check_order/list'), - ...crudCommonOptions(), - headerToolbar: [ - 'reload', - ], - columns: [ - stringField('description', '描述'), - mappingField('type', '类型', checkTypeMapping), - mappingField('state', '状态', checkOverMapping), - timeField('createdTime', '创建时间'), - stringField('createdUsername', '创建人', 100), - timeField('modifiedTime', '最后修改时间'), - stringField('modifiedUsername', '最后操作人', 100), - operationField('操作', undefined, [ - { - visibleOn: `\${type === 'CONFIRMATION' && state === 'CHECKING'}`, - type: 'action', - label: '处理', - level: 'link', - ...confirmationDetailDialog( - 'parameters.confirmationId', - [ - { - type: 'action', - label: '同意', - actionType: 'ajax', - close: true, - api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'), - reload: 'check_order_list', - }, - { - type: 'action', - label: '拒绝', - actionType: 'ajax', - close: true, - api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'), - reload: 'check_order_list', - }, - ], - ), - }, - { - visibleOn: `\${type === 'CONFIRMATION' && state !== NORMAL}`, - type: 'action', - label: '查看', - level: 'link', - ...confirmationDetailDialog('parameters.confirmationId'), - }, - { - visibleOn: `\${type === 'AUTHENTICATION' && state === 'CHECKING'}`, - type: 'action', - label: '处理', - level: 'link', - ...authenticationDetailDialog( - 'parameters.authenticationId', - [ - { - type: 'action', - label: '同意', - actionType: 'ajax', - close: true, - api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'), - reload: 'check_order_list', - }, - { - type: 'action', - label: '拒绝', - actionType: 'ajax', - close: true, - api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'), - reload: 'check_order_list', - }, - ], - ), - }, - { - visibleOn: `\${type === 'AUTHENTICATION' && state !== NORMAL}`, - type: 'action', - label: '查看', - level: 'link', - ...authenticationDetailDialog('parameters.authenticationId'), - }, - { - visibleOn: `\${type === 'MARKET' && state === 'CHECKING'}`, - type: 'action', - label: '处理', - level: 'link', - ...wareDetailDialog( - 'parameters.wareId', - [ - { - type: 'action', - label: '同意', - actionType: 'ajax', - close: true, - api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'), - reload: 'check_order_list', - }, - { - type: 'action', - label: '拒绝', - actionType: 'ajax', - close: true, - api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'), - reload: 'check_order_list', - }, - ], - ), - }, - { - visibleOn: `\${type === 'MARKET' && state !== NORMAL}`, - type: 'action', - label: '查看', - level: 'link', - ...wareDetailDialog('parameters.wareId'), - }, - ]), - ], - }, - ], - } + return [ + { + name: 'check_order_list', + type: 'crud', + api: apiGet('${base}/check_order/list'), + ...crudCommonOptions(), + headerToolbar: [ + 'reload', + ], + columns: [ + stringField('description', '描述'), + mappingField('type', '类型', checkTypeMapping), + mappingField('state', '状态', checkOverMapping), + timeField('createdTime', '创建时间'), + stringField('createdUsername', '创建人', 100), + timeField('modifiedTime', '最后修改时间'), + stringField('modifiedUsername', '最后操作人', 100), + operationField('操作', undefined, [ + { + visibleOn: `\${type === 'CONFIRMATION' && state === 'CHECKING'}`, + type: 'action', + label: '处理', + level: 'link', + ...confirmationDetailDialog( + 'parameters.confirmationId', + [ + { + type: 'action', + label: '同意', + actionType: 'ajax', + close: true, + api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'), + reload: 'check_order_list', + }, + { + type: 'action', + label: '拒绝', + actionType: 'ajax', + close: true, + api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'), + reload: 'check_order_list', + }, + ], + ), + }, + { + visibleOn: `\${type === 'CONFIRMATION' && state !== NORMAL}`, + type: 'action', + label: '查看', + level: 'link', + ...confirmationDetailDialog('parameters.confirmationId'), + }, + { + visibleOn: `\${type === 'AUTHENTICATION' && state === 'CHECKING'}`, + type: 'action', + label: '处理', + level: 'link', + ...authenticationDetailDialog( + 'parameters.authenticationId', + [ + { + type: 'action', + label: '同意', + actionType: 'ajax', + close: true, + api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'), + reload: 'check_order_list', + }, + { + type: 'action', + label: '拒绝', + actionType: 'ajax', + close: true, + api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'), + reload: 'check_order_list', + }, + ], + ), + }, + { + visibleOn: `\${type === 'AUTHENTICATION' && state !== NORMAL}`, + type: 'action', + label: '查看', + level: 'link', + ...authenticationDetailDialog('parameters.authenticationId'), + }, + { + visibleOn: `\${type === 'MARKET' && state === 'CHECKING'}`, + type: 'action', + label: '处理', + level: 'link', + ...wareDetailDialog( + 'parameters.wareId', + [ + { + type: 'action', + label: '同意', + actionType: 'ajax', + close: true, + api: apiGet('${base}/check_order/operation/${checkOrderId}/APPLY'), + reload: 'check_order_list', + }, + { + type: 'action', + label: '拒绝', + actionType: 'ajax', + close: true, + api: apiGet('${base}/check_order/operation/${checkOrderId}/REJECT'), + reload: 'check_order_list', + }, + ], + ), + }, + { + visibleOn: `\${type === 'MARKET' && state !== NORMAL}`, + type: 'action', + label: '查看', + level: 'link', + ...wareDetailDialog('parameters.wareId'), + }, + ]), + ], + }, + ] } \ No newline at end of file diff --git a/gringotts-frontend/pages/index/tab-data.js b/gringotts-frontend/pages/index/tab-data.js index 3e6eaaa..e853e19 100644 --- a/gringotts-frontend/pages/index/tab-data.js +++ b/gringotts-frontend/pages/index/tab-data.js @@ -11,8 +11,7 @@ import { mappingField, operationField, permissionStateMapping, - timeField, - userOnly + timeField } from "../../components/constants.js"; import {wareAddDialog, wareDetailDialog, wareEditeDialog} from "../../components/ware/dialog-ware.js"; @@ -86,101 +85,95 @@ export function resourceList(showMode = false) { export function tabData() { return { - visibleOn: userOnly, - title: '数据资源', - icon: 'fa fa-database', - reload: true, - body: { - type: 'tabs', - tabs: [ - { - title: '资源定义', - tab: resourceList() - }, - { - title: '资源上架', - tab: { - type: 'crud', - api: apiGet('${base}/ware/list'), - ...crudCommonOptions(), - headerToolbar: [ - 'reload', + type: 'tabs', + tabs: [ + { + title: '资源定义', + tab: resourceList() + }, + { + title: '资源上架', + tab: { + type: 'crud', + api: apiGet('${base}/ware/list'), + ...crudCommonOptions(), + headerToolbar: [ + 'reload', + { + type: 'action', + label: '', + icon: 'fa fa-plus', + ...wareAddDialog() + }, + ], + columns: [ + { + name: 'name', + label: '名称', + width: 200, + }, + { + name: 'description', + label: '描述', + }, + mappingField('state', '状态', permissionStateMapping), + timeField('createdTime', '创建时间'), + operationField('操作', undefined, [ { type: 'action', - label: '', - icon: 'fa fa-plus', - ...wareAddDialog() - }, - ], - columns: [ - { - name: 'name', - label: '名称', - width: 200, + label: '查看', + level: 'link', + ...wareDetailDialog(), }, { - name: 'description', - label: '描述', + visibleOn: "${state === 'CHECKING'}", + type: 'action', + label: '撤销', + level: 'link', + confirmTitle: '确认撤销', + confirmText: '确认撤销名称为「${name}」的确权申请吗?', + actionType: 'ajax', + api: apiGet('${base}/ware/retract/${id}'), }, - mappingField('state', '状态', permissionStateMapping), - timeField('createdTime', '创建时间'), - operationField('操作', undefined, [ - { - type: 'action', - label: '查看', - level: 'link', - ...wareDetailDialog(), - }, - { - visibleOn: "${state === 'CHECKING'}", - type: 'action', - label: '撤销', - level: 'link', - confirmTitle: '确认撤销', - confirmText: '确认撤销名称为「${name}」的确权申请吗?', - actionType: 'ajax', - api: apiGet('${base}/ware/retract/${id}'), - }, - { - visibleOn: "${state === 'DRAFT' || state === 'REJECT'}", - type: 'action', - label: '提交', - level: 'link', - confirmTitle: '确认提交', - confirmText: '确认提交名称为「${name}」的确权申请吗?', - actionType: 'ajax', - api: apiGet('${base}/ware/submit/${id}'), - }, - { - type: 'dropdown-button', - level: 'link', - icon: 'fa fa-ellipsis-h', - hideCaret: true, - trigger: 'hover', - buttons: [ - { - disabledOn: "${state !== 'DRAFT'}", - type: 'action', - label: '编辑', - level: 'link', - ...wareEditeDialog(), - }, - { - disabledOn: "${state === 'CHECKING'}", - type: 'action', - label: "删除", - confirmTitle: '确认删除', - confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。', - actionType: 'ajax', - api: apiGet('${base}/ware/remove/${id}'), - }, - ] - }, - ]), - ] - } + { + visibleOn: "${state === 'DRAFT' || state === 'REJECT'}", + type: 'action', + label: '提交', + level: 'link', + confirmTitle: '确认提交', + confirmText: '确认提交名称为「${name}」的确权申请吗?', + actionType: 'ajax', + api: apiGet('${base}/ware/submit/${id}'), + }, + { + type: 'dropdown-button', + level: 'link', + icon: 'fa fa-ellipsis-h', + hideCaret: true, + trigger: 'hover', + buttons: [ + { + disabledOn: "${state !== 'DRAFT'}", + type: 'action', + label: '编辑', + level: 'link', + ...wareEditeDialog(), + }, + { + disabledOn: "${state === 'CHECKING'}", + type: 'action', + label: "删除", + confirmTitle: '确认删除', + confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。', + actionType: 'ajax', + api: apiGet('${base}/ware/remove/${id}'), + }, + ] + }, + ]), + ] } - ] - } + } + ] } } \ No newline at end of file diff --git a/gringotts-frontend/pages/index/tab-market.js b/gringotts-frontend/pages/index/tab-market.js index 6add9b9..9b47fae 100644 --- a/gringotts-frontend/pages/index/tab-market.js +++ b/gringotts-frontend/pages/index/tab-market.js @@ -3,88 +3,83 @@ import {authenticationAddDialog} from "../../components/permission/dialog-permis export function tabMarket() { return { - title: '数据市场', - icon: 'fa fa-store', - reload: true, - body: { - type: 'crud', - api: { - ...apiGet('${base}/ware/list_public'), - adaptor: (payload, response, api, context) => { - payload.data = payload.data.map(i => { - return { - ...i, - targetId: i.resourceId, - } - }) - return payload - } - }, - ...crudCommonOptions(), - headerToolbar: [ - 'reload', - ], - mode: 'cards', - columnsCount: 3, - card: { - header: { - title: '${name}', - subTitle: '${createdTime}', - avatar: '${icon}', - avatarClassName: 'pull-left thumb-md avatar b-3x m-r' - }, - body: '${TRUNCATE(description, 50)}', - actions: [ - { - type: 'action', - label: '查看', - actionType: 'dialog', - dialog: { - title: '数据产品详情', - size: 'md', - actions: [], - body: { - type: 'service', - api: apiGet(`\${base}/ware/detail/\${id}`), - body: [ - { - type: 'property', - title: '产品信息', - items: [ - { - label: '名称', - content: '${name}', - }, - { - label: '归属', - content: '${createdUsername}', - }, - { - label: '创建时间', - content: '${createdTime}', - }, - { - span: 3, - label: '描述', - content: '${description}', - }, - ] - }, - { - type: 'tpl', - tpl: '${content|raw}' - } - ] - } - } - }, - { - type: 'action', - label: '申请授权', - ...authenticationAddDialog(), + type: 'crud', + api: { + ...apiGet('${base}/ware/list_public'), + adaptor: (payload, response, api, context) => { + payload.data = payload.data.map(i => { + return { + ...i, + targetId: i.resourceId, } - ] + }) + return payload + } + }, + ...crudCommonOptions(), + headerToolbar: [ + 'reload', + ], + mode: 'cards', + columnsCount: 3, + card: { + header: { + title: '${name}', + subTitle: '${createdTime}', + avatar: '${icon}', + avatarClassName: 'pull-left thumb-md avatar b-3x m-r' }, + body: '${TRUNCATE(description, 50)}', + actions: [ + { + type: 'action', + label: '查看', + actionType: 'dialog', + dialog: { + title: '数据产品详情', + size: 'md', + actions: [], + body: { + type: 'service', + api: apiGet(`\${base}/ware/detail/\${id}`), + body: [ + { + type: 'property', + title: '产品信息', + items: [ + { + label: '名称', + content: '${name}', + }, + { + label: '归属', + content: '${createdUsername}', + }, + { + label: '创建时间', + content: '${createdTime}', + }, + { + span: 3, + label: '描述', + content: '${description}', + }, + ] + }, + { + type: 'tpl', + tpl: '${content|raw}' + } + ] + } + } + }, + { + type: 'action', + label: '申请授权', + ...authenticationAddDialog(), + } + ] } } } \ No newline at end of file diff --git a/gringotts-frontend/pages/index/tab-permissions.js b/gringotts-frontend/pages/index/tab-permissions.js index bb84eed..8856f72 100644 --- a/gringotts-frontend/pages/index/tab-permissions.js +++ b/gringotts-frontend/pages/index/tab-permissions.js @@ -12,7 +12,6 @@ import { stringField, stringWrapField, timeField, - userOnly, } from "../../components/constants.js"; import { authenticationAddDialog, @@ -25,172 +24,166 @@ import { export function tabPermissions() { return { - visibleOn: userOnly, - title: '权属管理', - icon: 'fa fa-key', - reload: true, - body: { - type: 'tabs', - tabs: [ - { - visibleOn: providerOnly, - title: '确权管理', - body: { - type: 'crud', - api: { - ...apiGet('${base}/confirmation/list') + type: 'tabs', + tabs: [ + { + visibleOn: providerOnly, + title: '确权管理', + body: { + type: 'crud', + api: { + ...apiGet('${base}/confirmation/list') + }, + ...crudCommonOptions(), + headerToolbar: [ + 'reload', + { + type: 'action', + label: '', + icon: 'fa fa-plus', + ...confirmationAddDialog() }, - ...crudCommonOptions(), - headerToolbar: [ - 'reload', + ], + columns: [ + stringField('name', '名称', 200), + stringWrapField('description', '描述'), + mappingField('state', '状态', permissionStateMapping), + timeField('createdTime', '创建时间'), + operationField('操作', undefined, [ { type: 'action', - label: '', - icon: 'fa fa-plus', - ...confirmationAddDialog() + label: '查看', + level: 'link', + ...confirmationDetailDialog(), }, - ], - columns: [ - stringField('name', '名称', 200), - stringWrapField('description', '描述'), - mappingField('state', '状态', permissionStateMapping), - timeField('createdTime', '创建时间'), - operationField('操作', undefined, [ - { - type: 'action', - label: '查看', - level: 'link', - ...confirmationDetailDialog(), - }, - { - visibleOn: "${state === 'CHECKING'}", - type: 'action', - label: '撤销', - level: 'link', - confirmTitle: '确认撤销', - confirmText: '确认撤销名称为「${name}」的确权申请吗?', - actionType: 'ajax', - api: apiGet('${base}/confirmation/retract/${id}'), - }, - { - visibleOn: "${state === 'DRAFT' || state === 'REJECT'}", - type: 'action', - label: '提交', - level: 'link', - confirmTitle: '确认提交', - confirmText: '确认提交名称为「${name}」的确权申请吗?', - actionType: 'ajax', - api: apiGet('${base}/confirmation/submit/${id}'), - }, - { - type: 'dropdown-button', - level: 'link', - icon: 'fa fa-ellipsis-h', - hideCaret: true, - trigger: 'hover', - buttons: [ - { - disabledOn: "${state !== 'DRAFT'}", - type: 'action', - label: '编辑', - level: 'link', - ...confirmationEditeDialog(), - }, - { - disabledOn: "${state === 'CHECKING'}", - type: 'action', - label: "删除", - confirmTitle: '确认删除', - confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。', - actionType: 'ajax', - api: apiGet('${base}/confirmation/remove/${id}'), - }, - ] - }, - ]), - ] - } - }, - { - visibleOn: customerOnly, - title: '授权管理', - body: { - type: 'crud', - api: { - ...apiGet('${base}/authentication/list') + { + visibleOn: "${state === 'CHECKING'}", + type: 'action', + label: '撤销', + level: 'link', + confirmTitle: '确认撤销', + confirmText: '确认撤销名称为「${name}」的确权申请吗?', + actionType: 'ajax', + api: apiGet('${base}/confirmation/retract/${id}'), + }, + { + visibleOn: "${state === 'DRAFT' || state === 'REJECT'}", + type: 'action', + label: '提交', + level: 'link', + confirmTitle: '确认提交', + confirmText: '确认提交名称为「${name}」的确权申请吗?', + actionType: 'ajax', + api: apiGet('${base}/confirmation/submit/${id}'), + }, + { + type: 'dropdown-button', + level: 'link', + icon: 'fa fa-ellipsis-h', + hideCaret: true, + trigger: 'hover', + buttons: [ + { + disabledOn: "${state !== 'DRAFT'}", + type: 'action', + label: '编辑', + level: 'link', + ...confirmationEditeDialog(), + }, + { + disabledOn: "${state === 'CHECKING'}", + type: 'action', + label: "删除", + confirmTitle: '确认删除', + confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。', + actionType: 'ajax', + api: apiGet('${base}/confirmation/remove/${id}'), + }, + ] + }, + ]), + ] + } + }, + { + visibleOn: customerOnly, + title: '授权管理', + body: { + type: 'crud', + api: { + ...apiGet('${base}/authentication/list') + }, + ...crudCommonOptions(), + headerToolbar: [ + 'reload', + { + type: 'action', + label: '', + icon: 'fa fa-plus', + ...authenticationAddDialog() }, - ...crudCommonOptions(), - headerToolbar: [ - 'reload', + ], + columns: [ + stringField('name', '名称', 200), + stringWrapField('description', '描述'), + mappingField('state', '状态', permissionStateMapping), + timeField('createdTime', '创建时间'), + operationField('操作', undefined, [ { type: 'action', - label: '', - icon: 'fa fa-plus', - ...authenticationAddDialog() + label: '查看', + level: 'link', + ...authenticationDetailDialog(), }, - ], - columns: [ - stringField('name', '名称', 200), - stringWrapField('description', '描述'), - mappingField('state', '状态', permissionStateMapping), - timeField('createdTime', '创建时间'), - operationField('操作', undefined, [ - { - type: 'action', - label: '查看', - level: 'link', - ...authenticationDetailDialog(), - }, - { - visibleOn: arrayInCheck([checkState.ownerChecking, checkState.checking], 'state'), - type: 'action', - label: '撤销', - level: 'link', - confirmTitle: '确认撤销', - confirmText: '确认撤销名称为「${name}」的授权申请吗?', - actionType: 'ajax', - api: apiGet('${base}/authentication/retract/${id}'), - }, - { - visibleOn: arrayInCheck([checkState.draft], 'state'), - type: 'action', - label: '提交', - level: 'link', - confirmTitle: '确认提交', - confirmText: '确认提交名称为「${name}」的授权申请吗?', - actionType: 'ajax', - api: apiGet('${base}/authentication/submit/${id}'), - }, - { - type: 'dropdown-button', - level: 'link', - icon: 'fa fa-ellipsis-h', - hideCaret: true, - trigger: 'hover', - buttons: [ - { - disabledOn: arrayOutCheck([checkState.draft], 'state'), - type: 'action', - label: '编辑', - level: 'link', - ...authenticationEditeDialog(), - }, - { - disabledOn: arrayInCheck([checkState.ownerChecking, checkState.checking], 'state'), - type: 'action', - label: "删除", - confirmTitle: '确认删除', - confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。', - actionType: 'ajax', - api: apiGet('${base}/authentication/remove/${id}'), - }, - ] - }, - ]), - ] - } - }, - ] - } + { + visibleOn: arrayInCheck([checkState.ownerChecking, checkState.checking], 'state'), + type: 'action', + label: '撤销', + level: 'link', + confirmTitle: '确认撤销', + confirmText: '确认撤销名称为「${name}」的授权申请吗?', + actionType: 'ajax', + api: apiGet('${base}/authentication/retract/${id}'), + }, + { + visibleOn: arrayInCheck([checkState.draft], 'state'), + type: 'action', + label: '提交', + level: 'link', + confirmTitle: '确认提交', + confirmText: '确认提交名称为「${name}」的授权申请吗?', + actionType: 'ajax', + api: apiGet('${base}/authentication/submit/${id}'), + }, + { + type: 'dropdown-button', + level: 'link', + icon: 'fa fa-ellipsis-h', + hideCaret: true, + trigger: 'hover', + buttons: [ + { + disabledOn: arrayOutCheck([checkState.draft], 'state'), + type: 'action', + label: '编辑', + level: 'link', + ...authenticationEditeDialog(), + }, + { + disabledOn: arrayInCheck([checkState.ownerChecking, checkState.checking], 'state'), + type: 'action', + label: "删除", + confirmTitle: '确认删除', + confirmText: '确认删除名称为「${name}」的确权申请吗?删除后对应的数据资源处于未确权状态。', + actionType: 'ajax', + api: apiGet('${base}/authentication/remove/${id}'), + }, + ] + }, + ]), + ] + } + }, + ] } } \ No newline at end of file diff --git a/gringotts-frontend/pages/index/tab-user.js b/gringotts-frontend/pages/index/tab-user.js index 7ec06ff..ef3df21 100644 --- a/gringotts-frontend/pages/index/tab-user.js +++ b/gringotts-frontend/pages/index/tab-user.js @@ -1,5 +1,4 @@ import { - administratorOnly, apiGet, copyField, crudCommonOptions, @@ -13,71 +12,65 @@ import {userCheckDialog, userDetailDialog} from "../../components/user/dialog-us import {userAdministratorRegisterDialog} from "../../components/user/dialog-user-register.js"; export function tabUser() { - return { - visibleOn: administratorOnly, - title: '用户管理', - icon: 'fa fa-user', - reload: true, - body: [ - { - type: 'crud', - api: apiGet('${base}/user_management/list'), - ...crudCommonOptions(), - headerToolbar: [ - 'reload', + return [ + { + type: 'crud', + api: apiGet('${base}/user_management/list'), + ...crudCommonOptions(), + headerToolbar: [ + 'reload', + { + type: 'action', + icon: 'fa fa-plus', + tooltip: '新增账号', + ...userAdministratorRegisterDialog(), + }, + ], + columns: [ + copyField( + 'username', + '邮箱', + undefined, + undefined, + userDetailDialog(), + ), + mappingField('role', '角色', userRoleMapping, 120), + mappingField('state', '账号状态', userStateMapping), + timeField('createdTime', '创建时间'), + timeField('lastLoginTime', '上次登陆时间'), + operationField('操作', undefined, [ { - type: 'action', - icon: 'fa fa-plus', - tooltip: '新增账号', - ...userAdministratorRegisterDialog(), + visibleOn: "${state === 'CHECKING'}", + label: '审核', + icon: 'fa fa-fingerprint', + level: 'primary', + size: 'xs', + ...userCheckDialog(), }, - ], - columns: [ - copyField( - 'username', - '邮箱', - undefined, - undefined, - userDetailDialog(), - ), - mappingField('role', '角色', userRoleMapping, 120), - mappingField('state', '账号状态', userStateMapping), - timeField('createdTime', '创建时间'), - timeField('lastLoginTime', '上次登陆时间'), - operationField('操作', undefined, [ - { - visibleOn: "${state === 'CHECKING'}", - label: '审核', - icon: 'fa fa-fingerprint', - level: 'primary', - size: 'xs', - ...userCheckDialog(), - }, - { - visibleOn: "${state === 'NORMAL' && role !== 'ADMINISTRATOR'}", - label: '禁用', - icon: 'fa fa-ban', - level: 'danger', - size: 'xs', - confirmText: '确认禁用账号${username}?', - confirmTitle: '禁用账号', - actionType: 'ajax', - api: apiGet('${base}/user_management/disable/${username}'), - }, - { - visibleOn: "${state === 'DISABLED' && role !== 'ADMINISTRATOR'}", - label: '启用', - icon: 'fa fa-check', - level: 'success', - size: 'xs', - confirmText: '确认启用账号${username}?', - confirmTitle: '启用账号', - actionType: 'ajax', - api: apiGet('${base}/user_management/enable/${username}'), - } - ]), - ] - } - ] - } + { + visibleOn: "${state === 'NORMAL' && role !== 'ADMINISTRATOR'}", + label: '禁用', + icon: 'fa fa-ban', + level: 'danger', + size: 'xs', + confirmText: '确认禁用账号${username}?', + confirmTitle: '禁用账号', + actionType: 'ajax', + api: apiGet('${base}/user_management/disable/${username}'), + }, + { + visibleOn: "${state === 'DISABLED' && role !== 'ADMINISTRATOR'}", + label: '启用', + icon: 'fa fa-check', + level: 'success', + size: 'xs', + confirmText: '确认启用账号${username}?', + confirmTitle: '启用账号', + actionType: 'ajax', + api: apiGet('${base}/user_management/enable/${username}'), + } + ]), + ] + } + ] } \ No newline at end of file diff --git a/gringotts-frontend/public/logo.svg b/gringotts-frontend/public/logo.svg new file mode 100644 index 0000000..c3ec89b --- /dev/null +++ b/gringotts-frontend/public/logo.svg @@ -0,0 +1,8 @@ + + China_Telecom_Logo-svg + + + \ No newline at end of file