1
0

feat(web): 增加权属管理界面

This commit is contained in:
2024-11-26 14:02:15 +08:00
parent e76236be62
commit 851fc02ce5
7 changed files with 144 additions and 48 deletions

View File

@@ -1,26 +1,26 @@
const information = {
debug: false,
// baseUrl: '',
baseUrl: 'http://127.0.0.1:20080',
title: '可信供给中心',
debug: false,
// baseUrl: '',
baseUrl: 'http://127.0.0.1:20080',
title: '可信供给中心',
}
export function useAmis(amisObject) {
document.title = information.title
let amis = amisRequire('amis/embed')
amis.embed(
'#app',
amisObject(information),
{
data: {
base: information.baseUrl,
},
},
{
theme: 'antd',
enableAMISDebug: information.debug,
}
)
document.title = information.title
let amis = amisRequire('amis/embed')
amis.embed(
'#app',
amisObject(information),
{
data: {
base: information.baseUrl,
},
},
{
theme: 'antd',
enableAMISDebug: information.debug,
}
)
}
export function crudCommonOptions() {
@@ -202,4 +202,11 @@ export const role = {
export const administratorOnly = roleCheck([role.administrator])
export const checkerOnly = roleCheck([role.administrator, role.checker])
export const userOnly = roleCheck([role.administrator, role.provider, role.customer])
export const providerOnly = roleCheck([role.administrator, role.provider])
export const customerOnly = roleCheck([role.administrator, role.customer])
export const formInputClearable = {
clearable: true,
clearValueOnEmpty: true,
}

View File

@@ -0,0 +1,3 @@
textarea {
resize: none !important;
}

View File

@@ -0,0 +1,48 @@
import './dialog-permission.css'
import {horizontalFormOptions} from "../constants.js";
function detailForm() {
return {
id: 'resource_data_form',
type: 'form',
...horizontalFormOptions(),
horizontal: {
left: 2,
},
body: [
{
type: 'hidden',
name: 'id',
},
]
}
}
export function permissionAddDialog() {
return {
actionType: 'dialog',
dialog: {
title: '新增确权申请',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
debug: true,
...detailForm(),
// api: apiPost('${base}/data_resource/save'),
data: {
add: true,
},
}
}
}
}

View File

@@ -2,17 +2,13 @@ import './dialog-resource.css'
import {
apiGet,
apiPost,
formInputClearable,
horizontalFormOptions,
inputFileFormItemCommonOptions,
size1GB,
size500MB
} from "../constants.js";
const clearable = {
clearable: true,
clearValueOnEmpty: true,
}
function inputFileFormItemUpdateFieldOptions(target) {
let value = {}
value[target] = '${event.data.value}'
@@ -51,13 +47,13 @@ function detailForm() {
name: 'name',
label: '资源名称',
required: true,
...clearable,
...formInputClearable,
},
{
type: 'textarea',
name: 'description',
label: '资源描述',
...clearable,
...formInputClearable,
showCounter: true,
trimContents: true,
minRows: 2,
@@ -90,19 +86,19 @@ function detailForm() {
label: 'API地址',
name: 'apiUrl',
required: true,
...clearable,
...formInputClearable,
},
{
type: 'input-text',
label: '用户名',
name: 'apiUsername',
...clearable,
...formInputClearable,
},
{
type: 'input-password',
label: '密码',
name: 'apiPassword',
...clearable,
...formInputClearable,
},
]
},
@@ -149,19 +145,19 @@ function detailForm() {
label: 'JDBC',
name: 'databaseJdbc',
required: true,
...clearable,
...formInputClearable,
},
{
type: 'input-text',
label: '用户名',
name: 'databaseUsername',
...clearable,
...formInputClearable,
},
{
type: 'input-password',
label: '密码',
name: 'databasePassword',
...clearable,
...formInputClearable,
},
]
},
@@ -210,33 +206,33 @@ function detailForm() {
label: 'FTP地址',
name: 'ftpUrl',
required: true,
...clearable,
...formInputClearable,
},
{
type: 'input-text',
label: 'FTP账号',
name: 'ftpUsername',
...clearable,
...formInputClearable,
},
{
type: 'input-password',
label: 'FTP密码',
name: 'ftpPassword',
...clearable,
...formInputClearable,
},
{
type: 'input-text',
label: '相对路径',
name: 'ftpPath',
description: '若为空,则使用用户根目录',
...clearable,
...formInputClearable,
},
{
type: 'input-text',
label: '文件筛选',
name: 'ftpRegexFilter',
description: '正则表达式,用于匹配文件的路径,只有符合筛选条件的文件才会被采集;若为空则默认采集全部文件',
...clearable,
...formInputClearable,
},
]
},

View File

@@ -4,6 +4,7 @@ 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";
useAmis(information => {
return {
@@ -58,6 +59,7 @@ useAmis(information => {
tabs: [
// tabOverview(),
// tabMarket(),
tabPermissions(),
tabData(),
tabCheck(),
tabUser(),

View File

@@ -45,7 +45,7 @@ export function tabData() {
},
{
label: '操作',
width: 200,
width: 100,
type: 'operation',
fixed: 'right',
className: 'nowrap',
@@ -53,27 +53,36 @@ export function tabData() {
{
type: 'action',
label: '查看',
icon: 'fa fa-eye',
level: 'link',
...resourceDetailDialog(),
},
{
type: 'action',
label: '编辑',
icon: 'fa fa-pen-fancy',
level: 'link',
...resourceEditeDialog(),
},
{
type: 'action',
label: '删除',
icon: 'fa fa-remove',
type: 'dropdown-button',
level: 'link',
className: 'text-danger',
confirmTitle: '确认删除',
confirmText: '确认删除名称为「${name}」的数据资源吗?',
actionType: 'ajax',
api: apiGet('${base}/data_resource/remove/${id}')
icon: 'fa fa-ellipsis-h',
hideCaret: true,
trigger: 'hover',
buttons: [
{
type: 'action',
label: '申请确权',
level: 'link',
},
{
type: 'action',
label: '删除',
confirmTitle: '确认删除',
confirmText: '确认删除名称为「${name}」的数据资源吗?',
actionType: 'ajax',
api: apiGet('${base}/data_resource/remove/${id}')
},
]
},
]
},

View File

@@ -0,0 +1,31 @@
import {providerOnly, userOnly} from "../../components/constants.js";
import {permissionAddDialog} from "../../components/permission/dialog-permission.js";
export function tabPermissions() {
return {
visibleOn: userOnly,
title: '权属管理',
icon: 'fa fa-user-shield',
body: {
type: 'tabs',
tabs: [
{
visibleOn: providerOnly,
title: '确权管理',
body: [
{
type: 'action',
label: '',
icon: 'fa fa-plus',
...permissionAddDialog()
},
]
},
{
title: '授权管理',
body: []
}
]
}
}
}