1
0
Files
gringotts/gringotts-frontend/pages/index/tab-check.js

169 lines
4.9 KiB
JavaScript

import {
apiGet,
apiPost,
checkActionMapping,
checkOverMapping,
checkTypeMapping,
crudCommonOptions,
mappingField,
operationField,
paginationTemplate,
readOnlyDialogOptions,
stringField,
timeField,
} from "../../components/constants.js";
import {authenticationDetailDialog, confirmationDetailDialog} from "../../components/permission/dialog-permission.js";
import {wareDetailDialog} from "../../components/ware/dialog-ware.js";
function detailDialog() {
return {
actionType: 'dialog',
dialog: {
title: '详情',
size: 'md',
...readOnlyDialogOptions(),
body: [
{
type: 'amis',
name: 'parameters.snapshot',
},
{type: 'divider'},
{
type: 'crud',
api: apiGet('${base}/check_order/history/${instanceId}'),
...crudCommonOptions(),
headerToolbar: [
'reload',
],
columns: [
mappingField('action', '类型', checkActionMapping),
stringField('comment', '描述'),
timeField('createdTime', '操作时间'),
]
}
]
}
}
}
export function tabCheck() {
return [
{
name: 'check_order_list',
type: 'crud',
api: {
...apiPost('${base}/check_order/page'),
data: {
page: {
page: '${page|default:1}',
size: '${perPage|default:10}',
}
}
},
...crudCommonOptions(),
headerToolbar: [
'reload',
],
...paginationTemplate(10),
columns: [
stringField('description', '描述'),
mappingField('type', '类型', checkTypeMapping),
mappingField('state', '状态', checkOverMapping),
timeField('createdTime', '创建时间'),
stringField('createdUsername', '创建人', 100),
timeField('modifiedTime', '最后修改时间'),
stringField('modifiedUsername', '最后操作人', 100),
operationField('操作', undefined, [
{
visibleOn: "${state === 'COMPLETED'}",
type: 'action',
label: '查看',
level: 'link',
...detailDialog(),
},
{
visibleOn: "${type === 'CONFIRMATION' && state === 'RUNNING'}",
type: 'action',
label: '处理',
level: 'link',
...confirmationDetailDialog(
'parameters.confirmationId',
[
{
type: 'action',
label: '同意',
actionType: 'ajax',
close: true,
api: apiGet('${base}/check_order/approve/${instanceId}'),
reload: 'check_order_list',
},
{
type: 'action',
label: '拒绝',
actionType: 'ajax',
close: true,
api: apiGet('${base}/check_order/reject/${instanceId}'),
reload: 'check_order_list',
},
],
),
},
{
visibleOn: "${type === 'AUTHENTICATION' && state === 'RUNNING'}",
type: 'action',
label: '处理',
level: 'link',
...authenticationDetailDialog(
'parameters.authenticationId',
[
{
type: 'action',
label: '同意',
actionType: 'ajax',
close: true,
api: apiGet('${base}/check_order/approve/${instanceId}'),
reload: 'check_order_list',
},
{
type: 'action',
label: '拒绝',
actionType: 'ajax',
close: true,
api: apiGet('${base}/check_order/reject/${instanceId}'),
reload: 'check_order_list',
},
],
),
},
{
visibleOn: "${type === 'WARE' && state === 'RUNNING'}",
type: 'action',
label: '处理',
level: 'link',
...wareDetailDialog(
'parameters.wareId',
[
{
type: 'action',
label: '同意',
actionType: 'ajax',
close: true,
api: apiGet('${base}/check_order/approve/${instanceId}'),
reload: 'check_order_list',
},
{
type: 'action',
label: '拒绝',
actionType: 'ajax',
close: true,
api: apiGet('${base}/check_order/reject/${instanceId}'),
reload: 'check_order_list',
},
],
),
},
]),
],
},
]
}