179 lines
5.2 KiB
JavaScript
179 lines
5.2 KiB
JavaScript
import {
|
|
resourceAddDialog,
|
|
resourceDetailDialog,
|
|
resourceEditeDialog
|
|
} from "../../components/resource/dialog-resource.js";
|
|
import {
|
|
apiGet,
|
|
arrayOutCheck,
|
|
checkState,
|
|
crudCommonOptions,
|
|
mappingField,
|
|
operationField,
|
|
permissionStateMapping,
|
|
timeField
|
|
} from "../../components/constants.js";
|
|
import {wareAddDialog, wareDetailDialog, wareEditeDialog} from "../../components/ware/dialog-ware.js";
|
|
|
|
export function resourceList(showMode = false) {
|
|
return {
|
|
type: 'crud',
|
|
api: apiGet('${base}/data_resource/list'),
|
|
...crudCommonOptions(),
|
|
headerToolbar: [
|
|
'reload',
|
|
{
|
|
type: 'action',
|
|
label: '',
|
|
icon: 'fa fa-plus',
|
|
...resourceAddDialog()
|
|
},
|
|
],
|
|
columns: [
|
|
{
|
|
label: '名称',
|
|
name: 'name',
|
|
width: 150,
|
|
},
|
|
{
|
|
label: '描述',
|
|
name: 'description',
|
|
},
|
|
mappingField('confirmationState', '确权状态', permissionStateMapping),
|
|
timeField('createdTime', '创建时间'),
|
|
operationField('操作', undefined, [
|
|
{
|
|
type: 'action',
|
|
label: '详情',
|
|
level: 'link',
|
|
...resourceDetailDialog(),
|
|
},
|
|
{
|
|
visibleOn: !showMode,
|
|
type: 'dropdown-button',
|
|
level: 'link',
|
|
icon: 'fa fa-ellipsis-h',
|
|
hideCaret: true,
|
|
trigger: 'hover',
|
|
buttons: [
|
|
{
|
|
disabledOn: arrayOutCheck([checkState.none, checkState.draft], 'confirmationState'),
|
|
disabledTip: '审查或确权成功后无法编辑',
|
|
tooltipPlacement: 'top',
|
|
type: 'action',
|
|
label: '编辑',
|
|
level: 'link',
|
|
...resourceEditeDialog(),
|
|
},
|
|
{
|
|
disabledOn: arrayOutCheck([checkState.none, checkState.draft], 'confirmationState'),
|
|
disabledTip: '审查或确权成功后无法删除',
|
|
tooltipPlacement: 'bottom',
|
|
type: 'action',
|
|
label: "删除",
|
|
confirmTitle: '确认删除',
|
|
confirmText: '确认删除名称为「${name}」的数据资源吗?',
|
|
actionType: 'ajax',
|
|
api: apiGet('${base}/data_resource/remove/${id}')
|
|
},
|
|
]
|
|
},
|
|
]),
|
|
]
|
|
}
|
|
}
|
|
|
|
export function tabData() {
|
|
return {
|
|
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: '查看',
|
|
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}'),
|
|
},
|
|
]
|
|
},
|
|
]),
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
} |