1
0

style(web): 优化代码缩进

This commit is contained in:
2024-12-18 11:20:35 +08:00
parent 80a24513ab
commit cedb108049
88 changed files with 4494 additions and 4494 deletions

View File

@@ -1,91 +1,91 @@
export 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')
let struct = amisObject(information)
if (information.debug) {
console.log(struct)
document.title = information.title
let amis = amisRequire('amis/embed')
let struct = amisObject(information)
if (information.debug) {
console.log(struct)
}
amis.embed(
'#app',
struct,
{
data: {
debug: information.debug,
base: information.baseUrl,
},
},
{
theme: 'antd',
enableAMISDebug: information.debug,
}
amis.embed(
'#app',
struct,
{
data: {
debug: information.debug,
base: information.baseUrl,
},
},
{
theme: 'antd',
enableAMISDebug: information.debug,
}
)
)
}
export function crudCommonOptions() {
return {
affixHeader: false,
stopAutoRefreshWhenModalIsOpen: true,
resizable: false,
syncLocation: false,
silentPolling: true,
}
return {
affixHeader: false,
stopAutoRefreshWhenModalIsOpen: true,
resizable: false,
syncLocation: false,
silentPolling: true,
}
}
export function readOnlyDialogOptions() {
return {
actions: [],
showCloseButton: false,
closeOnEsc: true,
closeOnOutside: true,
disabled: true,
}
return {
actions: [],
showCloseButton: false,
closeOnEsc: true,
closeOnOutside: true,
disabled: true,
}
}
export function horizontalFormOptions() {
return {
mode: 'horizontal',
canAccessSuperData: false,
horizontal: {
left: 3,
},
}
return {
mode: 'horizontal',
canAccessSuperData: false,
horizontal: {
left: 3,
},
}
}
export function paginationCommonOptions(perPage = true, maxButtons = 5) {
let option = {
type: 'pagination',
layout: [
'pager'
],
maxButtons: maxButtons,
showPageInput: false,
perPageAvailable: [10, 15, 20, 50, 100, 200],
}
if (perPage) {
option.layout.push('perPage')
}
return option
let option = {
type: 'pagination',
layout: [
'pager'
],
maxButtons: maxButtons,
showPageInput: false,
perPageAvailable: [10, 15, 20, 50, 100, 200],
}
if (perPage) {
option.layout.push('perPage')
}
return option
}
export function paginationTemplate(perPage = 20, maxButtons = 5) {
return {
perPage: perPage,
headerToolbar: [
"reload",
paginationCommonOptions(true, maxButtons),
],
footerToolbar: [
"statistics",
paginationCommonOptions(true, maxButtons),
],
}
return {
perPage: perPage,
headerToolbar: [
"reload",
paginationCommonOptions(true, maxButtons),
],
footerToolbar: [
"statistics",
paginationCommonOptions(true, maxButtons),
],
}
}
export const size5MB = 5242880
@@ -94,16 +94,16 @@ export const size500MB = 524288000
export const size1GB = 1073741824
export function inputFileFormItemCommonOptions(accept = '*', maxSize = size5MB) {
return {
useChunk: true,
accept: accept,
maxSize: maxSize,
autoUpload: false,
drag: true,
startChunkApi: apiPost('${base}/upload/start'),
chunkApi: apiPost('${base}/upload/slice'),
finishChunkApi: apiPost('${base}/upload/finish'),
}
return {
useChunk: true,
accept: accept,
maxSize: maxSize,
autoUpload: false,
drag: true,
startChunkApi: apiPost('${base}/upload/start'),
chunkApi: apiPost('${base}/upload/slice'),
finishChunkApi: apiPost('${base}/upload/finish'),
}
}
/**
@@ -114,41 +114,41 @@ export function inputFileFormItemCommonOptions(accept = '*', maxSize = size5MB)
* @param {{}} extra
*/
export function copyField(field, label, tips = '复制', ignoreLength = 0, extra = undefined) {
let tpl = ignoreLength === 0 ? `\${${field}}` : `\${TRUNCATE(${field}, ${ignoreLength})}`
let content = extra
? {
type: 'action',
level: 'link',
label: `\${${field}}`,
className: 'text-current underline',
size: 'xs',
...extra,
}
: {
type: 'tpl',
className: 'mr-1',
tpl: tpl,
}
return {
name: field,
label: label,
type: 'wrapper',
size: 'none',
className: 'nowrap',
body: [
content,
{
type: 'action',
level: 'link',
label: '',
icon: 'fa fa-copy',
size: 'xs',
actionType: 'copy',
content: `\$${field}`,
tooltip: `${tips}`,
},
]
let tpl = ignoreLength === 0 ? `\${${field}}` : `\${TRUNCATE(${field}, ${ignoreLength})}`
let content = extra
? {
type: 'action',
level: 'link',
label: `\${${field}}`,
className: 'text-current underline',
size: 'xs',
...extra,
}
: {
type: 'tpl',
className: 'mr-1',
tpl: tpl,
}
return {
name: field,
label: label,
type: 'wrapper',
size: 'none',
className: 'nowrap',
body: [
content,
{
type: 'action',
level: 'link',
label: '',
icon: 'fa fa-copy',
size: 'xs',
actionType: 'copy',
content: `\$${field}`,
tooltip: `${tips}`,
},
]
}
}
/**
@@ -157,14 +157,14 @@ export function copyField(field, label, tips = '复制', ignoreLength = 0, extra
* @param {Array} buttons
*/
export function operationField(label, width = 100, buttons = []) {
return {
label: label,
width: width,
type: 'operation',
fixed: 'right',
className: 'nowrap',
buttons: buttons,
}
return {
label: label,
width: width,
type: 'operation',
fixed: 'right',
className: 'nowrap',
buttons: buttons,
}
}
/**
@@ -173,17 +173,17 @@ export function operationField(label, width = 100, buttons = []) {
* @param {number} width
*/
export function timeField(field, label, width = 150) {
return {
label: label,
width: width,
align: 'center',
type: 'tpl',
tpl: `\${IF(${field}, DATETOSTR(${field}), '-')}`
}
return {
label: label,
width: width,
align: 'center',
type: 'tpl',
tpl: `\${IF(${field}, DATETOSTR(${field}), '-')}`
}
}
export function stringWrapField(field, label, width = undefined) {
return stringField(field, label, width, true)
return stringField(field, label, width, true)
}
/**
@@ -193,17 +193,17 @@ export function stringWrapField(field, label, width = undefined) {
* @param {boolean} wrap
*/
export function stringField(field, label, width = undefined, wrap = false) {
let data = {
name: field,
label: label,
}
if (width) {
data['width'] = width
}
if (!wrap) {
data['className'] = 'nowrap'
}
return data
let data = {
name: field,
label: label,
}
if (width) {
data['width'] = width
}
if (!wrap) {
data['className'] = 'nowrap'
}
return data
}
/**
@@ -213,107 +213,107 @@ export function stringField(field, label, width = undefined, wrap = false) {
* @param {number} width
*/
export function mappingField(field, label, mapping, width = 80) {
let mapData = {
'*': `<span class='label bg-gray-300'>\${${field}}</span>`,
}
mapping.forEach(item => {
mapData[item['value']] = `<span class='label ${item['color']}'>${item['label']}</span>`
})
return {
label: label,
type: 'mapping',
width: width,
value: `\${${field}}`,
align: 'center',
map: mapData,
}
let mapData = {
'*': `<span class='label bg-gray-300'>\${${field}}</span>`,
}
mapping.forEach(item => {
mapData[item['value']] = `<span class='label ${item['color']}'>${item['label']}</span>`
})
return {
label: label,
type: 'mapping',
width: width,
value: `\${${field}}`,
align: 'center',
map: mapData,
}
}
function mappingItem(label, value, color = 'bg-info') {
return {
label: label,
value: value,
color: color,
}
return {
label: label,
value: value,
color: color,
}
}
export const userRoleMapping = [
mappingItem('数据提供方', 'PROVIDER', 'bg-blue-500'),
mappingItem('数据使用方', 'CUSTOMER', 'bg-purple-500'),
mappingItem('审核监管方', 'CHECKER', 'bg-cyan-500'),
mappingItem('系统管理员', 'ADMINISTRATOR', 'bg-green-500'),
mappingItem('数据提供方', 'PROVIDER', 'bg-blue-500'),
mappingItem('数据使用方', 'CUSTOMER', 'bg-purple-500'),
mappingItem('审核监管方', 'CHECKER', 'bg-cyan-500'),
mappingItem('系统管理员', 'ADMINISTRATOR', 'bg-green-500'),
]
export const userStateMapping = [
mappingItem('审查中', 'CHECKING', 'bg-warning'),
mappingItem('正常', 'NORMAL', 'bg-success'),
mappingItem('禁用', 'DISABLED', 'bg-danger'),
mappingItem('审查中', 'CHECKING', 'bg-warning'),
mappingItem('正常', 'NORMAL', 'bg-success'),
mappingItem('禁用', 'DISABLED', 'bg-danger'),
]
export const permissionStateMapping = [
mappingItem('未确权', 'NONE'),
mappingItem('草稿', 'DRAFT', 'bg-primary'),
mappingItem('审查中', 'CHECKING', 'bg-warning'),
mappingItem('用户审查中', 'OWNER_CHECKING', 'bg-warning'),
mappingItem('通过', 'NORMAL', 'bg-success'),
mappingItem('驳回', 'REJECT', 'bg-danger'),
mappingItem('未确权', 'NONE'),
mappingItem('草稿', 'DRAFT', 'bg-primary'),
mappingItem('审查中', 'CHECKING', 'bg-warning'),
mappingItem('用户审查中', 'OWNER_CHECKING', 'bg-warning'),
mappingItem('通过', 'NORMAL', 'bg-success'),
mappingItem('驳回', 'REJECT', 'bg-danger'),
]
export const checkTypeMapping = [
mappingItem('确权审查', 'CONFIRMATION', 'bg-blue-500'),
mappingItem('授权审查', 'AUTHENTICATION', 'bg-purple-500'),
mappingItem('上架审查', 'MARKET', 'bg-green-500'),
mappingItem('确权审查', 'CONFIRMATION', 'bg-blue-500'),
mappingItem('授权审查', 'AUTHENTICATION', 'bg-purple-500'),
mappingItem('上架审查', 'MARKET', 'bg-green-500'),
]
export const checkOverMapping = [
mappingItem('进行中', 'CHECKING', 'bg-warning'),
mappingItem('已撤销', 'RETRACT', 'bg-primary'),
mappingItem('已办结', 'OVER', 'bg-success'),
mappingItem('进行中', 'CHECKING', 'bg-warning'),
mappingItem('已撤销', 'RETRACT', 'bg-primary'),
mappingItem('已办结', 'OVER', 'bg-success'),
]
function api(method, url) {
return {
method: method,
url: url,
headers: {
token: '${token|default:undefined}',
}
return {
method: method,
url: url,
headers: {
token: '${token|default:undefined}',
}
}
}
export function apiGet(url) {
return api('get', url)
return api('get', url)
}
export function apiPost(url) {
return api('post', url)
return api('post', url)
}
export function arrayInCheck(array, field) {
return `\${ARRAYINCLUDES(['${array.join("','")}'], ${field})}`
return `\${ARRAYINCLUDES(['${array.join("','")}'], ${field})}`
}
export function arrayOutCheck(array, field) {
return `\${!ARRAYINCLUDES(['${array.join("','")}'], ${field})}`
return `\${!ARRAYINCLUDES(['${array.join("','")}'], ${field})}`
}
export const checkState = {
none: 'NONE',
draft: 'DRAFT',
checking: 'CHECKING',
ownerChecking: 'OWNER_CHECKING',
normal: 'NORMAL',
none: 'NONE',
draft: 'DRAFT',
checking: 'CHECKING',
ownerChecking: 'OWNER_CHECKING',
normal: 'NORMAL',
}
export function roleCheck(roles) {
return `\${ARRAYINCLUDES(['${roles.join("','")}'], role)}`
return `\${ARRAYINCLUDES(['${roles.join("','")}'], role)}`
}
export const role = {
administrator: 'ADMINISTRATOR',
checker: 'CHECKER',
provider: 'PROVIDER',
customer: 'CUSTOMER',
administrator: 'ADMINISTRATOR',
checker: 'CHECKER',
provider: 'PROVIDER',
customer: 'CUSTOMER',
}
export const administratorOnly = roleCheck([role.administrator])
@@ -324,98 +324,98 @@ export const customerOnly = roleCheck([role.administrator, role.customer])
export const formInputClearable = {
clearable: true,
clearValueOnEmpty: true,
clearable: true,
clearValueOnEmpty: true,
}
const formInputFileStaticColumns = [
{
name: 'filename',
label: '文件名',
},
{
type: 'operation',
label: '操作',
width: 140,
buttons: [
{
type: 'action',
label: '预览',
level: 'link',
icon: 'fas fa-eye'
},
{
type: 'action',
label: '下载',
level: 'link',
icon: 'fa fa-download',
actionType: 'ajax',
api: {
...apiGet('${base}/upload/download/${id}'),
responseType: 'blob',
}
}
]
}
{
name: 'filename',
label: '文件名',
},
{
type: 'operation',
label: '操作',
width: 140,
buttons: [
{
type: 'action',
label: '预览',
level: 'link',
icon: 'fas fa-eye'
},
{
type: 'action',
label: '下载',
level: 'link',
icon: 'fa fa-download',
actionType: 'ajax',
api: {
...apiGet('${base}/upload/download/${id}'),
responseType: 'blob',
}
}
]
}
]
export function formInputSingleFileStatic(field, label) {
return {
visibleOn: '${detail}',
type: 'control',
label: label,
required: true,
body: {
type: 'table',
source: `\${${field}|asArray}`,
columns: formInputFileStaticColumns,
}
return {
visibleOn: '${detail}',
type: 'control',
label: label,
required: true,
body: {
type: 'table',
source: `\${${field}|asArray}`,
columns: formInputFileStaticColumns,
}
}
}
export function formInputMultiFileStatic(field, label) {
return {
visibleOn: '${detail}',
type: 'input-table',
label: label,
name: field,
required: true,
resizable: false,
columns: formInputFileStaticColumns,
}
return {
visibleOn: '${detail}',
type: 'input-table',
label: label,
name: field,
required: true,
resizable: false,
columns: formInputFileStaticColumns,
}
}
export function formCreatedUserAndModifiedUser() {
return [
return [
{
type: 'group',
body: [
{
type: 'group',
body: [
{
type: 'input-text',
name: 'createdUsername',
label: '创建人',
},
{
type: 'input-datetime',
name: 'createdTime',
label: '创建时间',
},
]
type: 'input-text',
name: 'createdUsername',
label: '创建人',
},
{
type: 'group',
body: [
{
type: 'input-text',
name: 'modifiedUsername',
label: '最后修改人',
},
{
type: 'input-datetime',
name: 'modifiedTime',
label: '最后修改时间',
},
]
type: 'input-datetime',
name: 'createdTime',
label: '创建时间',
},
]
]
},
{
type: 'group',
body: [
{
type: 'input-text',
name: 'modifiedUsername',
label: '最后修改人',
},
{
type: 'input-datetime',
name: 'modifiedTime',
label: '最后修改时间',
},
]
},
]
}

View File

@@ -1,14 +1,14 @@
import './dialog-permission.css'
import {
apiGet,
apiPost,
formCreatedUserAndModifiedUser,
formInputClearable,
formInputMultiFileStatic,
horizontalFormOptions,
information,
inputFileFormItemCommonOptions,
size100MB
apiGet,
apiPost,
formCreatedUserAndModifiedUser,
formInputClearable,
formInputMultiFileStatic,
horizontalFormOptions,
information,
inputFileFormItemCommonOptions,
size100MB
} from "../constants.js";
import {resourceList} from "../../pages/index/tab-data.js";
import {resourceDetailDialog} from "../resource/dialog-resource.js";
@@ -17,192 +17,192 @@ const CONFIRMATION_TYPE = 'confirmation'
const AUTHENTICATION_TYPE = 'authentication'
const CONFIRMATION = {
type: 'confirmation',
pickerApi: apiGet('${base}/data_resource/list_no_confirmation')
type: 'confirmation',
pickerApi: apiGet('${base}/data_resource/list_no_confirmation')
}
const AUTHENTICATION = {
type: 'authentication',
pickerApi: apiGet('${base}/data_resource/list_no_authentication')
type: 'authentication',
pickerApi: apiGet('${base}/data_resource/list_no_authentication')
}
function detailForm(pickerApi = apiGet('${base}/data_resource/list'), showCreatedUserAndModifiedUser = false) {
return {
debug: information.debug,
id: 'permission_form',
type: 'form',
...horizontalFormOptions(),
horizontal: {
left: 2,
return {
debug: information.debug,
id: 'permission_form',
type: 'form',
...horizontalFormOptions(),
horizontal: {
left: 2,
},
body: [
{
type: 'hidden',
name: 'id',
},
{
type: 'picker',
name: 'targetId',
label: '数据资源',
required: true,
multiple: false,
size: 'md',
valueField: 'id',
labelField: 'name',
source: pickerApi,
pickerSchema: {
...resourceList(),
},
body: [
{
type: 'hidden',
name: 'id',
},
{
type: 'picker',
name: 'targetId',
label: '数据资源',
required: true,
multiple: false,
size: 'md',
valueField: 'id',
labelField: 'name',
source: pickerApi,
pickerSchema: {
...resourceList(),
},
staticSchema: {
type: 'tpl',
tpl: "<span class='text-primary' style='cursor: pointer'>${targetName}</span>",
onEvent: {
click: {
actions: [
{
actionType: 'dialog',
...resourceDetailDialog('targetId'),
}
]
}
}
staticSchema: {
type: 'tpl',
tpl: "<span class='text-primary' style='cursor: pointer'>${targetName}</span>",
onEvent: {
click: {
actions: [
{
actionType: 'dialog',
...resourceDetailDialog('targetId'),
}
},
{
type: 'textarea',
placeholder: '请输入确权说明',
label: '确权说明',
name: 'description',
...formInputClearable,
},
formInputMultiFileStatic('evidenceFiles', '相关材料'),
{
visibleOn: '${!detail}',
type: 'input-file',
label: '相关材料',
name: 'evidenceFiles',
multiple: true,
required: true,
joinValues: false,
...inputFileFormItemCommonOptions(undefined, size100MB),
},
{
visibleOn: `\${${AUTHENTICATION_TYPE}}`,
type: 'input-datetime-range',
name: 'activeTime',
extraName: 'expiredTime',
label: '授权时间',
required: true,
format: 'YYYY-MM-DD HH:mm:ss',
shortcuts: [
'7dayslater',
'14dayslater',
'30dayslater',
'180dayslater',
'365dayslater',
]
},
...(showCreatedUserAndModifiedUser ? formCreatedUserAndModifiedUser() : [])
]
}
}
}
},
{
type: 'textarea',
placeholder: '请输入确权说明',
label: '确权说明',
name: 'description',
...formInputClearable,
},
formInputMultiFileStatic('evidenceFiles', '相关材料'),
{
visibleOn: '${!detail}',
type: 'input-file',
label: '相关材料',
name: 'evidenceFiles',
multiple: true,
required: true,
joinValues: false,
...inputFileFormItemCommonOptions(undefined, size100MB),
},
{
visibleOn: `\${${AUTHENTICATION_TYPE}}`,
type: 'input-datetime-range',
name: 'activeTime',
extraName: 'expiredTime',
label: '授权时间',
required: true,
format: 'YYYY-MM-DD HH:mm:ss',
shortcuts: [
'7dayslater',
'14dayslater',
'30dayslater',
'180dayslater',
'365dayslater',
]
}
},
...(showCreatedUserAndModifiedUser ? formCreatedUserAndModifiedUser() : [])
]
}
}
export function confirmationAddDialog() {
return permissionAddDialog(CONFIRMATION)
return permissionAddDialog(CONFIRMATION)
}
export function authenticationAddDialog() {
return permissionAddDialog(AUTHENTICATION)
return permissionAddDialog(AUTHENTICATION)
}
function permissionAddDialog(config) {
let data = {add: true}
data[config.type] = true
return {
actionType: 'dialog',
dialog: {
title: '新增确权申请',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(config.pickerApi),
api: apiPost(`\${base}/${config.type}/save`),
data: data,
}
let data = {add: true}
data[config.type] = true
return {
actionType: 'dialog',
dialog: {
title: '新增确权申请',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(config.pickerApi),
api: apiPost(`\${base}/${config.type}/save`),
data: data,
}
}
}
}
export function confirmationDetailDialog(field = 'id', actions = []) {
return permissionDetailDialog(CONFIRMATION, field, actions)
return permissionDetailDialog(CONFIRMATION, field, actions)
}
export function authenticationDetailDialog(field = 'id', actions = []) {
return permissionDetailDialog(AUTHENTICATION, field, actions)
return permissionDetailDialog(AUTHENTICATION, field, actions)
}
function permissionDetailDialog(config, field = 'id', actions = []) {
let data = {detail: true}
data[config.type] = true
return {
actionType: 'dialog',
dialog: {
title: '确权申请详情',
size: 'md',
actions: actions,
body: {
...detailForm(config.pickerApi, true),
initApi: apiGet(`\${base}/${config.type}/detail/\${${field}}`),
static: true,
data: data,
}
}
let data = {detail: true}
data[config.type] = true
return {
actionType: 'dialog',
dialog: {
title: '确权申请详情',
size: 'md',
actions: actions,
body: {
...detailForm(config.pickerApi, true),
initApi: apiGet(`\${base}/${config.type}/detail/\${${field}}`),
static: true,
data: data,
}
}
}
}
export function confirmationEditeDialog(field = 'id') {
return permissionEditeDialog(CONFIRMATION, field)
return permissionEditeDialog(CONFIRMATION, field)
}
export function authenticationEditeDialog(field = 'id') {
return permissionEditeDialog(AUTHENTICATION, field)
return permissionEditeDialog(AUTHENTICATION, field)
}
function permissionEditeDialog(config, field = 'id') {
let data = {edit: true}
data[config.type] = true
return {
actionType: 'dialog',
dialog: {
title: '确权申请详情',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(config.pickerApi),
api: apiPost(`\${base}/${config.type}/save`),
initApi: apiGet(`\${base}/${config.type}/detail/\${${field}}`),
data: data,
},
let data = {edit: true}
data[config.type] = true
return {
actionType: 'dialog',
dialog: {
title: '确权申请详情',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(config.pickerApi),
api: apiPost(`\${base}/${config.type}/save`),
initApi: apiGet(`\${base}/${config.type}/detail/\${${field}}`),
data: data,
},
}
}
}

View File

@@ -1,378 +1,378 @@
import './dialog-resource.css'
import {
apiGet,
apiPost,
formCreatedUserAndModifiedUser,
formInputClearable,
formInputSingleFileStatic,
horizontalFormOptions,
inputFileFormItemCommonOptions,
size1GB,
size500MB
apiGet,
apiPost,
formCreatedUserAndModifiedUser,
formInputClearable,
formInputSingleFileStatic,
horizontalFormOptions,
inputFileFormItemCommonOptions,
size1GB,
size500MB
} from "../constants.js";
function detailForm(showCreatedUserAndModifiedUser = false) {
return {
type: 'form',
...horizontalFormOptions(),
horizontal: {
left: 2,
},
return {
type: 'form',
...horizontalFormOptions(),
horizontal: {
left: 2,
},
body: [
{
type: 'hidden',
name: 'id',
},
{
type: 'input-text',
name: 'name',
label: '资源名称',
maxLength: 10,
showCounter: true,
required: true,
...formInputClearable,
},
{
type: 'textarea',
name: 'description',
label: '资源描述',
...formInputClearable,
showCounter: true,
trimContents: true,
minRows: 2,
maxRows: 2,
},
{
type: 'fieldSet',
title: '资源类型定义',
body: [
{
type: 'hidden',
name: 'id',
},
{
{
name: 'resourceType',
type: 'select',
label: '资源类型',
selectFirst: true,
required: true,
options: [
{label: 'API', value: 'API'},
{label: '文件', value: 'FILE'},
{label: '数据库', value: 'DATABASE'},
{label: 'HDFS', value: 'HDFS'},
{label: 'FTP', value: 'FTP'},
]
},
{
visibleOn: "${resourceType === 'API'}",
type: 'fieldSet',
body: [
{
type: 'input-text',
name: 'name',
label: '资源名称',
maxLength: 10,
showCounter: true,
label: 'API地址',
name: 'apiUrl',
required: true,
...formInputClearable,
},
{
type: 'textarea',
name: 'description',
label: '资源描述',
},
{
type: 'input-text',
label: '用户名',
name: 'apiUsername',
...formInputClearable,
showCounter: true,
trimContents: true,
minRows: 2,
maxRows: 2,
},
{
type: 'fieldSet',
title: '资源类型定义',
body: [
{
name: 'resourceType',
type: 'select',
label: '资源类型',
selectFirst: true,
required: true,
options: [
{label: 'API', value: 'API'},
{label: '文件', value: 'FILE'},
{label: '数据库', value: 'DATABASE'},
{label: 'HDFS', value: 'HDFS'},
{label: 'FTP', value: 'FTP'},
]
},
{
visibleOn: "${resourceType === 'API'}",
type: 'fieldSet',
body: [
{
type: 'input-text',
label: 'API地址',
name: 'apiUrl',
required: true,
...formInputClearable,
},
{
type: 'input-text',
label: '用户名',
name: 'apiUsername',
...formInputClearable,
},
{
type: 'input-password',
label: '密码',
name: 'apiPassword',
...formInputClearable,
},
]
},
{
visibleOn: "${resourceType === 'FILE'}",
type: 'fieldSet',
body: [
formInputSingleFileStatic('file', '数据文件'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: '数据文件',
description: '只适合小于1GB的资源文件使用大文件请使用其他资源类型',
name: 'file',
multiple: false,
required: true,
joinValues: false,
...inputFileFormItemCommonOptions('.zip', size1GB),
},
]
},
{
visibleOn: "${resourceType === 'DATABASE'}",
type: 'fieldSet',
body: [
{
type: 'select',
label: '数据库类型',
name: 'databaseType',
required: true,
options: [
{label: 'MySQL', value: 'MYSQL'},
{label: 'Oracle', value: 'ORACLE'},
{label: 'PostgreSQL', value: 'POSTGRESQL'},
]
},
{
type: 'input-text',
label: 'JDBC',
name: 'databaseJdbc',
required: true,
...formInputClearable,
},
{
type: 'input-text',
label: '用户名',
name: 'databaseUsername',
...formInputClearable,
},
{
type: 'input-password',
label: '密码',
name: 'databasePassword',
...formInputClearable,
},
]
},
{
visibleOn: "${resourceType === 'HDFS'}",
type: 'fieldSet',
body: [
formInputSingleFileStatic('coreSiteFile', 'core-site.xml'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: 'core-site.xml',
name: 'coreSiteFile',
multiple: false,
required: true,
joinValues: false,
...inputFileFormItemCommonOptions('.xml'),
},
formInputSingleFileStatic('hdfsSiteFile', 'hdfs-site.xml'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: 'hdfs-site.xml',
name: 'hdfsSiteFile',
multiple: false,
required: true,
joinValues: false,
...inputFileFormItemCommonOptions('.xml'),
},
]
},
{
visibleOn: "${resourceType === 'FTP'}",
type: 'fieldSet',
body: [
{
type: 'input-text',
label: 'FTP地址',
name: 'ftpUrl',
required: true,
...formInputClearable,
},
{
type: 'input-text',
label: 'FTP账号',
name: 'ftpUsername',
...formInputClearable,
},
{
type: 'input-password',
label: 'FTP密码',
name: 'ftpPassword',
...formInputClearable,
},
{
type: 'input-text',
label: '相对路径',
name: 'ftpPath',
description: '若为空,则使用用户根目录',
...formInputClearable,
},
{
type: 'input-text',
label: '文件筛选',
name: 'ftpRegexFilter',
description: '正则表达式,用于匹配文件的路径,只有符合筛选条件的文件才会被采集;若为空则默认采集全部文件',
...formInputClearable,
},
]
},
},
{
type: 'input-password',
label: '密码',
name: 'apiPassword',
...formInputClearable,
},
]
},
{
visibleOn: "${resourceType === 'FILE'}",
type: 'fieldSet',
body: [
formInputSingleFileStatic('file', '数据文件'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: '数据文件',
description: '只适合小于1GB的资源文件使用大文件请使用其他资源类型',
name: 'file',
multiple: false,
required: true,
joinValues: false,
...inputFileFormItemCommonOptions('.zip', size1GB),
},
]
},
{
visibleOn: "${resourceType === 'DATABASE'}",
type: 'fieldSet',
body: [
{
type: 'select',
label: '数据库类型',
name: 'databaseType',
required: true,
options: [
{label: 'MySQL', value: 'MYSQL'},
{label: 'Oracle', value: 'ORACLE'},
{label: 'PostgreSQL', value: 'POSTGRESQL'},
]
},
{
type: 'fieldSet',
title: '资源格式定义',
className: 'mt-5',
body: [
{
name: 'formatType',
type: 'select',
label: '资源格式',
selectFirst: true,
required: true,
options: [
{label: '无', value: 'NONE'},
{label: 'Line', value: 'LINE'},
{label: 'JSON', value: 'JSON'},
{label: 'JSON Line', value: 'JSON_LINE'},
{label: 'CSV', value: 'CSV'},
]
},
{
visibleOn: "${formatType === 'JSON' && !detail}",
type: 'json-schema-editor',
name: 'jsonSchema',
label: 'JSON格式',
description: '使用JSON Schema格式',
required: true,
enableAdvancedSetting: true,
mini: true,
},
{
visibleOn: "${formatType === 'JSON' && detail}",
type: 'editor',
name: 'jsonSchemaText',
label: 'JSON格式',
language: 'json',
},
{
visibleOn: "${formatType === 'JSON_LINE' && !detail}",
type: 'json-schema-editor',
name: 'jsonLineSchema',
label: 'JSON格式',
description: 'JSON Line类型请定义单行JSON数据格式使用JSON Schema格式',
required: true,
enableAdvancedSetting: true,
mini: true,
},
{
visibleOn: "${formatType === 'JSON_LINE' && detail}",
type: 'editor',
name: 'jsonLineSchemaText',
label: 'JSON格式',
language: 'json',
},
{
visibleOn: "${formatType === 'CSV' && !detail}",
type: 'json-schema-editor',
name: 'csvSchema',
label: 'CSV格式',
description: '请定义单行数据中各个字段的格式使用JSON Schema格式',
required: true,
enableAdvancedSetting: true,
mini: true,
disabledTypes: [
'object',
'array',
'null',
]
},
{
visibleOn: "${formatType === 'CSV' && detail}",
type: 'editor',
name: 'csvSchemaText',
label: 'JSON格式',
language: 'json',
},
formInputSingleFileStatic('exampleFile', '资源示例'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: '资源示例',
name: 'exampleFile',
description: '可以上传用于作为格式示范的样例数据',
multiple: false,
joinValues: false,
...inputFileFormItemCommonOptions(undefined, size500MB),
},
]
},
...(showCreatedUserAndModifiedUser ? formCreatedUserAndModifiedUser() : [])
},
{
type: 'input-text',
label: 'JDBC',
name: 'databaseJdbc',
required: true,
...formInputClearable,
},
{
type: 'input-text',
label: '用户名',
name: 'databaseUsername',
...formInputClearable,
},
{
type: 'input-password',
label: '密码',
name: 'databasePassword',
...formInputClearable,
},
]
},
{
visibleOn: "${resourceType === 'HDFS'}",
type: 'fieldSet',
body: [
formInputSingleFileStatic('coreSiteFile', 'core-site.xml'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: 'core-site.xml',
name: 'coreSiteFile',
multiple: false,
required: true,
joinValues: false,
...inputFileFormItemCommonOptions('.xml'),
},
formInputSingleFileStatic('hdfsSiteFile', 'hdfs-site.xml'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: 'hdfs-site.xml',
name: 'hdfsSiteFile',
multiple: false,
required: true,
joinValues: false,
...inputFileFormItemCommonOptions('.xml'),
},
]
},
{
visibleOn: "${resourceType === 'FTP'}",
type: 'fieldSet',
body: [
{
type: 'input-text',
label: 'FTP地址',
name: 'ftpUrl',
required: true,
...formInputClearable,
},
{
type: 'input-text',
label: 'FTP账号',
name: 'ftpUsername',
...formInputClearable,
},
{
type: 'input-password',
label: 'FTP密码',
name: 'ftpPassword',
...formInputClearable,
},
{
type: 'input-text',
label: '相对路径',
name: 'ftpPath',
description: '若为空,则使用用户根目录',
...formInputClearable,
},
{
type: 'input-text',
label: '文件筛选',
name: 'ftpRegexFilter',
description: '正则表达式,用于匹配文件的路径,只有符合筛选条件的文件才会被采集;若为空则默认采集全部文件',
...formInputClearable,
},
]
},
]
}
},
{
type: 'fieldSet',
title: '资源格式定义',
className: 'mt-5',
body: [
{
name: 'formatType',
type: 'select',
label: '资源格式',
selectFirst: true,
required: true,
options: [
{label: '无', value: 'NONE'},
{label: 'Line', value: 'LINE'},
{label: 'JSON', value: 'JSON'},
{label: 'JSON Line', value: 'JSON_LINE'},
{label: 'CSV', value: 'CSV'},
]
},
{
visibleOn: "${formatType === 'JSON' && !detail}",
type: 'json-schema-editor',
name: 'jsonSchema',
label: 'JSON格式',
description: '使用JSON Schema格式',
required: true,
enableAdvancedSetting: true,
mini: true,
},
{
visibleOn: "${formatType === 'JSON' && detail}",
type: 'editor',
name: 'jsonSchemaText',
label: 'JSON格式',
language: 'json',
},
{
visibleOn: "${formatType === 'JSON_LINE' && !detail}",
type: 'json-schema-editor',
name: 'jsonLineSchema',
label: 'JSON格式',
description: 'JSON Line类型请定义单行JSON数据格式使用JSON Schema格式',
required: true,
enableAdvancedSetting: true,
mini: true,
},
{
visibleOn: "${formatType === 'JSON_LINE' && detail}",
type: 'editor',
name: 'jsonLineSchemaText',
label: 'JSON格式',
language: 'json',
},
{
visibleOn: "${formatType === 'CSV' && !detail}",
type: 'json-schema-editor',
name: 'csvSchema',
label: 'CSV格式',
description: '请定义单行数据中各个字段的格式使用JSON Schema格式',
required: true,
enableAdvancedSetting: true,
mini: true,
disabledTypes: [
'object',
'array',
'null',
]
},
{
visibleOn: "${formatType === 'CSV' && detail}",
type: 'editor',
name: 'csvSchemaText',
label: 'JSON格式',
language: 'json',
},
formInputSingleFileStatic('exampleFile', '资源示例'),
{
visibleOn: "${!detail}",
type: 'input-file',
label: '资源示例',
name: 'exampleFile',
description: '可以上传用于作为格式示范的样例数据',
multiple: false,
joinValues: false,
...inputFileFormItemCommonOptions(undefined, size500MB),
},
]
},
...(showCreatedUserAndModifiedUser ? formCreatedUserAndModifiedUser() : [])
]
}
}
export function resourceAddDialog() {
return {
actionType: 'dialog',
dialog: {
title: '新增数据资源',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(),
api: apiPost('${base}/data_resource/save'),
data: {
add: true,
}
}
return {
actionType: 'dialog',
dialog: {
title: '新增数据资源',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(),
api: apiPost('${base}/data_resource/save'),
data: {
add: true,
}
}
}
}
}
export function resourceDetailDialog(field = 'id') {
return {
actionType: 'dialog',
dialog: {
title: '账号详情',
actions: [],
size: 'md',
body: {
...detailForm(true),
static: true,
initApi: apiGet(`\${base}/data_resource/detail/\${${field}}`),
data: {
detail: true,
}
},
return {
actionType: 'dialog',
dialog: {
title: '账号详情',
actions: [],
size: 'md',
body: {
...detailForm(true),
static: true,
initApi: apiGet(`\${base}/data_resource/detail/\${${field}}`),
data: {
detail: true,
}
},
}
}
}
export function resourceEditeDialog() {
return {
actionType: 'dialog',
dialog: {
title: '账号详情',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(),
api: apiPost('${base}/data_resource/save'),
initApi: apiGet('${base}/data_resource/detail/${id}'),
data: {
edit: true,
}
},
return {
actionType: 'dialog',
dialog: {
title: '账号详情',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(),
api: apiPost('${base}/data_resource/save'),
initApi: apiGet('${base}/data_resource/detail/${id}'),
data: {
edit: true,
}
},
}
}
}

View File

@@ -1,38 +1,38 @@
import {horizontalFormOptions, apiPost} from '../constants.js'
import {apiPost, horizontalFormOptions} from '../constants.js'
import {confirmPasswordFormItem, passwordFormItem} from "./dialog-user-item.js";
export function userChangePasswordDialog() {
return {
actionType: 'dialog',
dialog: {
title: '修改密码',
actions: [
{
type: 'reset',
label: '清空',
},
{
type: 'submit',
label: '修改',
level: 'primary',
}
],
body: {
type: 'form',
api: apiPost('${base}/user_management/change_password'),
...horizontalFormOptions(),
body: [
{
type: 'input-password',
name: 'oldPassword',
label: '旧密码',
placeholder: '请输入旧密码',
required: true,
},
passwordFormItem('newPassword', '新密码'),
confirmPasswordFormItem('confirmNewPassword', 'newPassword', '新密码'),
]
}
return {
actionType: 'dialog',
dialog: {
title: '修改密码',
actions: [
{
type: 'reset',
label: '清空',
},
{
type: 'submit',
label: '修改',
level: 'primary',
}
],
body: {
type: 'form',
api: apiPost('${base}/user_management/change_password'),
...horizontalFormOptions(),
body: [
{
type: 'input-password',
name: 'oldPassword',
label: '旧密码',
placeholder: '请输入旧密码',
required: true,
},
passwordFormItem('newPassword', '新密码'),
confirmPasswordFormItem('confirmNewPassword', 'newPassword', '新密码'),
]
}
}
}
}

View File

@@ -1,106 +1,106 @@
import {
apiGet,
formCreatedUserAndModifiedUser,
horizontalFormOptions,
mappingField,
userRoleMapping,
userStateMapping
apiGet,
formCreatedUserAndModifiedUser,
horizontalFormOptions,
mappingField,
userRoleMapping,
userStateMapping
} from "../constants.js";
const dialogBody = [
{
type: 'input-email',
name: 'username',
label: '邮箱',
},
{
type: 'group',
body: [
{
type: 'control',
label: '角色',
body: mappingField('role', '角色', userRoleMapping, 120),
},
{
type: 'control',
label: '账号状态',
body: mappingField('state', '账号状态', userStateMapping),
}
]
},
...formCreatedUserAndModifiedUser(),
{
type: 'group',
body: [
{
type: 'input-text',
name: 'checkedUsername',
label: '审核人',
},
{
type: 'input-datetime',
name: 'checkedTime',
label: '审核时间',
},
]
},
{
type: 'input-email',
name: 'username',
label: '邮箱',
},
{
type: 'group',
body: [
{
type: 'control',
label: '角色',
body: mappingField('role', '角色', userRoleMapping, 120),
},
{
type: 'control',
label: '账号状态',
body: mappingField('state', '账号状态', userStateMapping),
}
]
},
...formCreatedUserAndModifiedUser(),
{
type: 'group',
body: [
{
type: 'input-text',
name: 'checkedUsername',
label: '审核人',
},
{
type: 'input-datetime',
name: 'checkedTime',
label: '审核时间',
},
]
},
]
export function userDetailDialog() {
return {
actionType: 'dialog',
dialog: {
title: '账号详情',
actions: [],
size: 'md',
body: {
type: 'form',
initApi: apiGet('${base}/user_management/detail/${username}'),
...horizontalFormOptions(),
horizontal: {
left: 2,
},
static: true,
body: [
...dialogBody,
{
type: 'input-datetime',
name: 'lastLoginTime',
label: '上次登陆时间',
},
],
}
}
return {
actionType: 'dialog',
dialog: {
title: '账号详情',
actions: [],
size: 'md',
body: {
type: 'form',
initApi: apiGet('${base}/user_management/detail/${username}'),
...horizontalFormOptions(),
horizontal: {
left: 2,
},
static: true,
body: [
...dialogBody,
{
type: 'input-datetime',
name: 'lastLoginTime',
label: '上次登陆时间',
},
],
}
}
}
}
export function userCheckDialog() {
return {
actionType: 'dialog',
dialog: {
title: '账号审核',
actions: [
{
type: 'action',
label: '同意',
level: 'primary',
actionType: 'submit',
confirmTitle: '审核通过',
confirmText: '确认通过账号为${username}通过审核吗?审核通过后将无法撤销。',
},
],
size: 'md',
body: {
type: 'form',
api: apiGet('${base}/user_management/check/${username}'),
initApi: apiGet('${base}/user_management/detail/${username}'),
...horizontalFormOptions(),
horizontal: {
left: 2,
},
static: true,
body: dialogBody,
}
}
return {
actionType: 'dialog',
dialog: {
title: '账号审核',
actions: [
{
type: 'action',
label: '同意',
level: 'primary',
actionType: 'submit',
confirmTitle: '审核通过',
confirmText: '确认通过账号为${username}通过审核吗?审核通过后将无法撤销。',
},
],
size: 'md',
body: {
type: 'form',
api: apiGet('${base}/user_management/check/${username}'),
initApi: apiGet('${base}/user_management/detail/${username}'),
...horizontalFormOptions(),
horizontal: {
left: 2,
},
static: true,
body: dialogBody,
}
}
}
}

View File

@@ -1,49 +1,49 @@
export function emailFormItem(name) {
return {
type: 'input-email',
name: name,
label: '邮箱',
placeholder: '请输入邮箱',
required: true,
clearable: true,
clearValueOnEmpty: true,
validateApi: '${base}/user/exists_username/${username}',
}
return {
type: 'input-email',
name: name,
label: '邮箱',
placeholder: '请输入邮箱',
required: true,
clearable: true,
clearValueOnEmpty: true,
validateApi: '${base}/user/exists_username/${username}',
}
}
export function passwordFormItem(name, label = '密码') {
return {
type: 'input-password',
name: name,
label: label,
placeholder: `请输入${label}`,
required: true,
clearable: true,
clearValueOnEmpty: true,
validations: {
matchRegexp:
/^(?=.*\d)(?!.*(\d)\1{2})(?!.*(012|123|234|345|456|567|678|789|987|876|765|654|543|432|321|210))(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).{8,16}$/,
},
validationErrors: {
matchRegexp:
`${label}至少包含字母、数字、特殊字符8-16位并且不能连续出现3个大小连续或相同的数字`,
},
}
return {
type: 'input-password',
name: name,
label: label,
placeholder: `请输入${label}`,
required: true,
clearable: true,
clearValueOnEmpty: true,
validations: {
matchRegexp:
/^(?=.*\d)(?!.*(\d)\1{2})(?!.*(012|123|234|345|456|567|678|789|987|876|765|654|543|432|321|210))(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).{8,16}$/,
},
validationErrors: {
matchRegexp:
`${label}至少包含字母、数字、特殊字符8-16位并且不能连续出现3个大小连续或相同的数字`,
},
}
}
export function confirmPasswordFormItem(name, target, label = '密码') {
return {
type: 'input-password',
name: name,
label: `确认${label}`,
placeholder: `请再次输入${label}`,
required: true,
clearable: true,
validations: {
equalsField: target,
},
validationErrors: {
equalsField: `两次输入${label}不一致`,
},
}
return {
type: 'input-password',
name: name,
label: `确认${label}`,
placeholder: `请再次输入${label}`,
required: true,
clearable: true,
validations: {
equalsField: target,
},
validationErrors: {
equalsField: `两次输入${label}不一致`,
},
}
}

View File

@@ -32,9 +32,9 @@ export function userRegisterDialog() {
required: true,
selectFirst: true,
options: [
{ label: '数据提供方', value: 'PROVIDER' },
{ label: '数据使用方', value: 'CUSTOMER' },
{ label: '审查监管方', value: 'CHECKER' },
{label: '数据提供方', value: 'PROVIDER'},
{label: '数据使用方', value: 'CUSTOMER'},
{label: '审查监管方', value: 'CHECKER'},
],
},
],
@@ -76,9 +76,9 @@ export function userAdministratorRegisterDialog() {
inline: false,
columnsCount: 2,
options: [
{ label: '数据提供方', value: 'PROVIDER' },
{ label: '数据使用方', value: 'CUSTOMER' },
{ label: '审查监管方', value: 'CHECKER' },
{label: '数据提供方', value: 'PROVIDER'},
{label: '数据使用方', value: 'CUSTOMER'},
{label: '审查监管方', value: 'CHECKER'},
],
},
],

View File

@@ -4,188 +4,188 @@ import {resourceList} from '../../pages/index/tab-data.js'
import {resourceDetailDialog} from '../resource/dialog-resource.js'
function detailForm() {
return {
id: 'ware-form',
debug: information.debug,
type: 'form',
...horizontalFormOptions(),
horizontal: {
left: 2,
return {
id: 'ware-form',
debug: information.debug,
type: 'form',
...horizontalFormOptions(),
horizontal: {
left: 2,
},
body: [
{
type: 'hidden',
name: 'id',
},
{
visibleOn: '${!detail}',
type: 'input-image',
name: 'icon',
label: '图标',
required: true,
receiver: apiPost("${base}/upload"),
onEvent: {
success: {
actions: [
{
actionType: 'setValue',
componentId: 'ware-form',
args: {
value: {
iconId: '${event.data.result.id}'
}
}
}
]
}
}
},
{
visibleOn: '${detail}',
type: 'control',
name: 'icon',
label: '图标',
required: true,
body: {
type: 'image',
src: '${icon}',
innerClassName: 'no-border',
}
},
{
type: 'picker',
name: 'resourceId',
label: '数据资源',
required: true,
multiple: false,
size: 'md',
valueField: 'id',
labelField: 'name',
source: apiGet('${base}/data_resource/list_no_ware'),
pickerSchema: {
...resourceList(),
},
body: [
{
type: 'hidden',
name: 'id',
},
{
visibleOn: '${!detail}',
type: 'input-image',
name: 'icon',
label: '图标',
required: true,
receiver: apiPost("${base}/upload"),
onEvent: {
success: {
actions: [
{
actionType: 'setValue',
componentId: 'ware-form',
args: {
value: {
iconId: '${event.data.result.id}'
}
}
}
]
}
}
},
{
visibleOn: '${detail}',
type: 'control',
name: 'icon',
label: '图标',
required: true,
body: {
type: 'image',
src: '${icon}',
innerClassName: 'no-border',
}
},
{
type: 'picker',
name: 'resourceId',
label: '数据资源',
required: true,
multiple: false,
size: 'md',
valueField: 'id',
labelField: 'name',
source: apiGet('${base}/data_resource/list_no_ware'),
pickerSchema: {
...resourceList(),
},
staticSchema: {
type: 'tpl',
tpl: "<span class='text-primary' style='cursor: pointer'>${resourceName}</span>",
onEvent: {
click: {
actions: [
{
actionType: 'dialog',
...resourceDetailDialog('resourceId'),
}
]
}
}
}
},
{
type: 'input-text',
name: 'name',
label: '商品名称',
maxLength: 10,
showCounter: true,
required: true,
...formInputClearable,
},
{
type: 'textarea',
name: 'description',
label: '商品简介',
required: true,
...formInputClearable,
showCounter: true,
trimContents: true,
minRows: 2,
maxRows: 2,
},
{
type: 'input-rich-text',
name: 'content',
label: '商品详情',
required: true,
receiver: apiPost("${base}/upload"),
options: {
min_height: 300,
staticSchema: {
type: 'tpl',
tpl: "<span class='text-primary' style='cursor: pointer'>${resourceName}</span>",
onEvent: {
click: {
actions: [
{
actionType: 'dialog',
...resourceDetailDialog('resourceId'),
}
]
}
]
}
}
}
},
{
type: 'input-text',
name: 'name',
label: '商品名称',
maxLength: 10,
showCounter: true,
required: true,
...formInputClearable,
},
{
type: 'textarea',
name: 'description',
label: '商品简介',
required: true,
...formInputClearable,
showCounter: true,
trimContents: true,
minRows: 2,
maxRows: 2,
},
{
type: 'input-rich-text',
name: 'content',
label: '商品详情',
required: true,
receiver: apiPost("${base}/upload"),
options: {
min_height: 300,
}
}
]
}
}
export function wareAddDialog() {
return {
actionType: 'dialog',
dialog: {
title: '上架数据产品',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(),
api: apiPost(`\${base}/ware/save`),
data: {
add: true,
}
}
return {
actionType: 'dialog',
dialog: {
title: '上架数据产品',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(),
api: apiPost(`\${base}/ware/save`),
data: {
add: true,
}
}
}
}
}
export function wareDetailDialog(field = 'id', actions = []) {
return {
actionType: 'dialog',
dialog: {
title: '数据产品详情',
size: 'md',
actions: actions,
body: {
...detailForm(),
initApi: apiGet(`\${base}/ware/detail/\${${field}}`),
static: true,
data: {
detail: true,
}
}
return {
actionType: 'dialog',
dialog: {
title: '数据产品详情',
size: 'md',
actions: actions,
body: {
...detailForm(),
initApi: apiGet(`\${base}/ware/detail/\${${field}}`),
static: true,
data: {
detail: true,
}
}
}
}
}
export function wareEditeDialog() {
return {
actionType: 'dialog',
dialog: {
title: '数据产品详情',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(),
api: apiPost(`\${base}/ware/save`),
initApi: apiGet(`\${base}/ware/detail/\${id}`),
data: {
edit: true
}
},
return {
actionType: 'dialog',
dialog: {
title: '数据产品详情',
size: 'md',
actions: [
{
type: 'reset',
label: '重置',
},
{
type: 'submit',
label: '确定',
level: 'primary',
}
],
body: {
...detailForm(),
api: apiPost(`\${base}/ware/save`),
initApi: apiGet(`\${base}/ware/detail/\${id}`),
data: {
edit: true
}
},
}
}
}