parent
2d7af4bdac
commit
462f4e0760
@ -1,79 +1,40 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CompatibleSchemaInitializer, InitializerWithSwitch, useSchemaInitializerItem } from '@tachybase/client';
|
import { InitializerWithSwitch, SchemaInitializer, useSchemaInitializerItem } from '@tachybase/client';
|
||||||
|
|
||||||
import { JOB_STATUS } from '../../../../../constants';
|
|
||||||
import { APPROVAL_ACTION_STATUS } from '../../../constants';
|
import { APPROVAL_ACTION_STATUS } from '../../../constants';
|
||||||
import { NAMESPACE } from '../../../locale';
|
import { NAMESPACE } from '../../../locale';
|
||||||
|
|
||||||
/**
|
export const ApprovalAddActionButton = new SchemaInitializer({
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
// NOTE: 似乎没用, 但删除又报错, 先保留着
|
|
||||||
const addActionButton_deprecated = new CompatibleSchemaInitializer({
|
|
||||||
name: 'ApprovalAddActionButton',
|
name: 'ApprovalAddActionButton',
|
||||||
title: '{{t("Configure actions")}}',
|
title: '{{t("Configure actions")}}',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
name: 'jobStatusResolved',
|
name: 'approvalStatusResolved',
|
||||||
title: `{{t("Continue the process", { ns: "${NAMESPACE}" })}}`,
|
title: `{{t("Continue the process", { ns: "${NAMESPACE}" })}}`,
|
||||||
Component: ActionInitializer,
|
Component: ActionInitializer,
|
||||||
action: JOB_STATUS.RESOLVED,
|
statusApproval: APPROVAL_ACTION_STATUS.APPROVED,
|
||||||
actionProps: {
|
actionProps: {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'jobStatusRejected',
|
name: 'approvalStatusRejected',
|
||||||
title: `{{t("Terminate the process", { ns: "${NAMESPACE}" })}}`,
|
title: `{{t("Terminate the process", { ns: "${NAMESPACE}" })}}`,
|
||||||
Component: ActionInitializer,
|
Component: ActionInitializer,
|
||||||
action: JOB_STATUS.REJECTED,
|
statusApproval: APPROVAL_ACTION_STATUS.REJECTED,
|
||||||
actionProps: {
|
actionProps: {
|
||||||
danger: true,
|
danger: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'jobStatusPending',
|
name: 'approvalStatusPending',
|
||||||
title: `{{t("Save temporarily", { ns: "${NAMESPACE}" })}}`,
|
title: `{{t("Save temporarily", { ns: "${NAMESPACE}" })}}`,
|
||||||
Component: ActionInitializer,
|
Component: ActionInitializer,
|
||||||
action: JOB_STATUS.PENDING,
|
statusApproval: APPROVAL_ACTION_STATUS.PENDING,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ApprovalAddActionButton = new CompatibleSchemaInitializer(
|
|
||||||
{
|
|
||||||
name: 'ApprovalAddActionButton',
|
|
||||||
title: '{{t("Configure actions")}}',
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
name: 'approvalStatusResolved',
|
|
||||||
title: `{{t("Continue the process", { ns: "${NAMESPACE}" })}}`,
|
|
||||||
Component: ActionInitializer,
|
|
||||||
statusApproval: APPROVAL_ACTION_STATUS.APPROVED,
|
|
||||||
actionProps: {
|
|
||||||
type: 'primary',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'approvalStatusRejected',
|
|
||||||
title: `{{t("Terminate the process", { ns: "${NAMESPACE}" })}}`,
|
|
||||||
Component: ActionInitializer,
|
|
||||||
statusApproval: APPROVAL_ACTION_STATUS.REJECTED,
|
|
||||||
actionProps: {
|
|
||||||
danger: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'approvalStatusPending',
|
|
||||||
title: `{{t("Save temporarily", { ns: "${NAMESPACE}" })}}`,
|
|
||||||
Component: ActionInitializer,
|
|
||||||
statusApproval: APPROVAL_ACTION_STATUS.PENDING,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
addActionButton_deprecated,
|
|
||||||
);
|
|
||||||
|
|
||||||
function ActionInitializer() {
|
function ActionInitializer() {
|
||||||
const itemConfig = useSchemaInitializerItem();
|
const itemConfig = useSchemaInitializerItem();
|
||||||
const { statusApproval, actionProps, ...others } = itemConfig;
|
const { statusApproval, actionProps, ...others } = itemConfig;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { SchemaInitializerItemType } from '@tachybase/client';
|
import { SchemaInitializerItemType } from '@tachybase/client';
|
||||||
|
import { ISchema } from '@tachybase/schema';
|
||||||
import { Registry } from '@tachybase/utils/client';
|
import { Registry } from '@tachybase/utils/client';
|
||||||
|
|
||||||
import { JOB_STATUS } from '../../../../../constants';
|
import { JOB_STATUS } from '../../../../../constants';
|
||||||
|
@ -56,7 +56,7 @@ export const LauncherActionConfigReSubmit = () => {
|
|||||||
useAction: '{{ useActionResubmit }}',
|
useAction: '{{ useActionResubmit }}',
|
||||||
},
|
},
|
||||||
'x-designer': 'Action.Designer',
|
'x-designer': 'Action.Designer',
|
||||||
'x-action': `reSubmit`,
|
'x-action': `Resubmit`,
|
||||||
'x-action-settings': {
|
'x-action-settings': {
|
||||||
assignedValues: {},
|
assignedValues: {},
|
||||||
},
|
},
|
||||||
|
@ -26,7 +26,7 @@ export const LauncherActionConfigInitializer = new SchemaInitializer({
|
|||||||
action: APPROVAL_STATUS.DRAFT,
|
action: APPROVAL_STATUS.DRAFT,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'reSubmit',
|
name: 'Resubmit',
|
||||||
type: 'item',
|
type: 'item',
|
||||||
title: `{{t("resubmit", { ns: "${NAMESPACE}" })}}`,
|
title: `{{t("resubmit", { ns: "${NAMESPACE}" })}}`,
|
||||||
action: APPROVAL_STATUS.RESUBMIT,
|
action: APPROVAL_STATUS.RESUBMIT,
|
||||||
|
@ -66,7 +66,7 @@ export const ApprovalStatusEnums = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: APPROVAL_STATUS.RESUBMIT,
|
value: APPROVAL_STATUS.RESUBMIT,
|
||||||
label: `{{t("reSubmit", { ns: "${NAMESPACE}" })}}`,
|
label: `{{t("Resubmit", { ns: "${NAMESPACE}" })}}`,
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
editable: true,
|
editable: true,
|
||||||
},
|
},
|
||||||
|
@ -11,7 +11,8 @@ export function ProviderActionResubmit(props) {
|
|||||||
|
|
||||||
const isSameId = data.data.id === createdById;
|
const isSameId = data.data.id === createdById;
|
||||||
const isDraft = status === APPROVAL_STATUS.DRAFT;
|
const isDraft = status === APPROVAL_STATUS.DRAFT;
|
||||||
if (isSameId && !isResubmit && !isDraft) {
|
const isReturned = status === APPROVAL_STATUS.RETURNED;
|
||||||
|
if (isSameId && !isResubmit && !isDraft && !isReturned) {
|
||||||
return props.children;
|
return props.children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,6 +276,6 @@
|
|||||||
"\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" only support \"application/json\", and no need to specify",
|
"\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" only support \"application/json\", and no need to specify",
|
||||||
"concat": "concat",
|
"concat": "concat",
|
||||||
"ms": "ms",
|
"ms": "ms",
|
||||||
"reSubmit": "reSubmit",
|
"Resubmit": "Resubmit",
|
||||||
"Are you sure you want to resubmit it?": "Are you sure you want to resubmit it?"
|
"Are you sure you want to resubmit it?": "Are you sure you want to resubmit it?"
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,8 @@
|
|||||||
"Custom form": "自定义表单",
|
"Custom form": "自定义表单",
|
||||||
"Data of associated collection": "关联数据表数据",
|
"Data of associated collection": "关联数据表数据",
|
||||||
"Data of collection": "数据表数据",
|
"Data of collection": "数据表数据",
|
||||||
"Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.": "工作流中的节点将在同一个事务中运行。任何失败都会导致数据回滚,同时也会回滚相应的执行历史。", "Data record": "数据记录",
|
"Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.": "工作流中的节点将在同一个事务中运行。任何失败都会导致数据回滚,同时也会回滚相应的执行历史。",
|
||||||
|
"Data record": "数据记录",
|
||||||
"Data will be updated": "更新的数据",
|
"Data will be updated": "更新的数据",
|
||||||
"Date variables": "日期变量",
|
"Date variables": "日期变量",
|
||||||
"Days": "天",
|
"Days": "天",
|
||||||
@ -356,6 +357,6 @@
|
|||||||
"\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" 请求头仅支持 \"application/json\",无需填写",
|
"\"Content-Type\" only support \"application/json\", and no need to specify": "\"Content-Type\" 请求头仅支持 \"application/json\",无需填写",
|
||||||
"concat": "连接",
|
"concat": "连接",
|
||||||
"ms": "毫秒",
|
"ms": "毫秒",
|
||||||
"reSubmit": "需重新提交",
|
"Resubmit": "重新发起",
|
||||||
"Are you sure you want to resubmit it?": "确定生成一份新的草稿吗?"
|
"Are you sure you want to resubmit it?": "是否确定重新发起?"
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ const approvals = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// NOTE: 和 create 逻辑雷同, 但是 因为原本的 create 并非纯操作, 因此拷贝一份以便方便改动
|
// NOTE: 和 create 逻辑雷同, 但是 因为原本的 create 并非纯操作, 因此拷贝一份以便方便改动
|
||||||
async reSubmit(context, next) {
|
async resubmit(context, next) {
|
||||||
const { status, collectionName, data, workflowId, collectionAppends } = context.action.params.values ?? {};
|
const { status, collectionName, data, workflowId, collectionAppends } = context.action.params.values ?? {};
|
||||||
const [dataSourceName, cName] = parseCollectionName(collectionName);
|
const [dataSourceName, cName] = parseCollectionName(collectionName);
|
||||||
const dataSource = context.app.dataSourceManager.dataSources.get(dataSourceName);
|
const dataSource = context.app.dataSourceManager.dataSources.get(dataSourceName);
|
||||||
|
Loading…
Reference in New Issue
Block a user