1
0

feat(web): 增加一些amis结构的工具函数

This commit is contained in:
2024-12-01 11:17:44 +08:00
parent 4dcc10f2f7
commit b072b83f80
6 changed files with 224 additions and 268 deletions

View File

@@ -11,6 +11,8 @@ import {
confirmationStateMapping,
crudCommonOptions,
mappingField,
operationField,
timeField,
userOnly
} from "../../components/constants.js";
@@ -38,63 +40,45 @@ export function resourceList() {
label: '描述',
name: 'description',
},
{
label: '确权状态',
width: 80,
align: 'center',
...mappingField('confirmationState', confirmationStateMapping)
},
{
label: '创建时间',
width: 150,
align: 'center',
type: 'tpl',
tpl: "${IF(createdTime, DATETOSTR(createdTime), '-')}"
},
{
label: '操作',
width: 100,
type: 'operation',
fixed: 'right',
className: 'nowrap',
buttons: [
{
type: 'action',
label: '详情',
level: 'link',
...resourceDetailDialog(),
},
{
type: 'dropdown-button',
level: 'link',
icon: 'fa fa-ellipsis-h',
hideCaret: true,
trigger: 'hover',
buttons: [
{
disabledOn: arrayOutCheck([confirmationState.none, confirmationState.draft], 'confirmationState'),
disabledTip: '审查或确权成功后无法编辑',
tooltipPlacement: 'top',
type: 'action',
label: '编辑',
level: 'link',
...resourceEditeDialog(),
},
{
disabledOn: arrayInCheck([confirmationState.checking], 'confirmationState'),
disabledTip: '审查中无法删除',
tooltipPlacement: 'bottom',
type: 'action',
label: "删除",
confirmTitle: '确认删除',
confirmText: '确认删除名称为「${name}」的数据资源吗?',
actionType: 'ajax',
api: apiGet('${base}/data_resource/remove/${id}')
},
]
},
]
},
mappingField('confirmationState', '确权状态', confirmationStateMapping),
timeField('createdTime', '创建时间'),
operationField('操作', undefined, [
{
type: 'action',
label: '详情',
level: 'link',
...resourceDetailDialog(),
},
{
type: 'dropdown-button',
level: 'link',
icon: 'fa fa-ellipsis-h',
hideCaret: true,
trigger: 'hover',
buttons: [
{
disabledOn: arrayOutCheck([confirmationState.none, confirmationState.draft], 'confirmationState'),
disabledTip: '审查或确权成功后无法编辑',
tooltipPlacement: 'top',
type: 'action',
label: '编辑',
level: 'link',
...resourceEditeDialog(),
},
{
disabledOn: arrayInCheck([confirmationState.checking], 'confirmationState'),
disabledTip: '审查中无法删除',
tooltipPlacement: 'bottom',
type: 'action',
label: "删除",
confirmTitle: '确认删除',
confirmText: '确认删除名称为「${name}」的数据资源吗?',
actionType: 'ajax',
api: apiGet('${base}/data_resource/remove/${id}')
},
]
},
]),
]
}
}