diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/collection/approvalCarbonCopy.collection.ts b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/collection/approvalCarbonCopy.collection.ts new file mode 100644 index 000000000..706bc900d --- /dev/null +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/collection/approvalCarbonCopy.collection.ts @@ -0,0 +1,185 @@ +import { approvalNoticeStatusOptions, ApprovalStatusEnums, COLLECTION_NAME_APPROVAL_CARBON_COPY } from '../constants'; +import { NAMESPACE, tval } from '../locale'; + +export const CollectionApprovalCarbonCopy = { + title: tval('ApprovalCarbonCopy'), + name: COLLECTION_NAME_APPROVAL_CARBON_COPY, + fields: [ + { + type: 'bigInt', + name: 'approvalId', + interface: 'number', + uiSchema: { + type: 'number', + title: 'ID', + 'x-component': 'InputNumber', + }, + }, + { + type: 'belongsTo', + name: 'createdBy', + target: 'users', + foreignKey: 'createdById', + interface: 'm2o', + uiSchema: { + type: 'number', + title: `{{t("Initiator", { ns: "${NAMESPACE}" })}}`, + 'x-component': 'RemoteSelect', + 'x-component-props': { + fieldNames: { + label: 'nickname', + value: 'id', + }, + service: { + resource: 'users', + }, + }, + }, + }, + { + type: 'bigInt', + name: 'id', + interface: 'number', + uiSchema: { + type: 'number', + title: 'ID', + 'x-component': 'InputNumber', + }, + }, + { + type: 'belongsTo', + name: 'user', + target: 'users', + foreignKey: 'userId', + interface: 'm2o', + uiSchema: { + type: 'number', + title: tval('The Notified Person'), + 'x-component': 'RemoteSelect', + 'x-component-props': { + fieldNames: { + label: 'nickname', + value: 'id', + }, + service: { resource: 'users' }, + }, + }, + }, + { + type: 'belongsTo', + name: 'node', + target: 'flow_nodes', + foreignKey: 'nodeId', + interface: 'm2o', + isAssociation: true, + uiSchema: { + type: 'number', + title: `{{t("Task node", { ns: "${NAMESPACE}" })}}`, + 'x-component': 'RemoteSelect', + 'x-component-props': { + fieldNames: { + label: 'title', + value: 'id', + }, + service: { + resource: 'flow_nodes', + }, + }, + }, + }, + { + type: 'belongsTo', + name: 'workflow', + target: 'workflows', + foreignKey: 'workflowId', + interface: 'm2o', + uiSchema: { + type: 'number', + title: '{{t("Workflow", { ns: "workflow" })}}', + 'x-component': 'RemoteSelect', + 'x-component-props': { + fieldNames: { + label: 'title', + value: 'id', + }, + service: { resource: 'workflows' }, + }, + }, + }, + { + type: 'integer', + name: 'status', + interface: 'select', + uiSchema: { + type: 'number', + title: '{{t("Status", { ns: "workflow" })}}', + 'x-component': 'Select', + enum: approvalNoticeStatusOptions, + }, + }, + { + type: 'text', + name: 'comment', + interface: 'markdown', + uiSchema: { + type: 'string', + 'x-component': 'Markdown', + title: `{{t("Comment", { ns: "${NAMESPACE}" })}}`, + }, + }, + { + name: 'createdAt', + type: 'date', + interface: 'createdAt', + uiSchema: { + type: 'datetime', + title: '{{t("Created at")}}', + 'x-component': 'DatePicker', + 'x-component-props': { + showTime: true, + }, + }, + }, + { + name: 'updatedAt', + type: 'date', + interface: 'updatedAt', + uiSchema: { + type: 'datetime', + title: '{{t("Updated at")}}', + 'x-component': 'DatePicker', + 'x-component-props': { + showTime: true, + }, + }, + }, + { + type: 'string', + name: 'summary', + interface: 'input', + uiSchema: { + type: 'string', + title: tval('Summary'), + 'x-component': 'ApprovalsSummary', + 'x-component-props': { + style: { + overflow: 'hidden', + textOverflow: 'ellipsis', + whiteSpace: 'nowrap', + }, + }, + }, + }, + { + type: 'integer', + name: 'status', + interface: 'select', + uiSchema: { + type: 'number', + title: '{{t("Status", { ns: "workflow" })}}', + 'x-component': 'Select', + enum: ApprovalStatusEnums, + }, + }, + ], +}; diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/constants.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/constants.tsx index 4d9e96044..c7daeb77a 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/constants.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/constants.tsx @@ -16,6 +16,10 @@ import { import { lang, NAMESPACE, tval } from './locale'; +export const NOTICE_INSTRUCTION_NAMESPACE = 'notice'; +export const COLLECTION_NOTICE_NAME = 'workflowNotice'; +export const COLLECTION_NAME_APPROVAL_CARBON_COPY = 'approvalCarbonCopy'; + /**显示状态 */ export const APPROVAL_STATUS = { /**已分配 */ @@ -242,3 +246,12 @@ export const ExecutionStatusOptions = [ description: 'General failed but should do another try.', }, ]; + +export const ApprovalNoticeStatusOptions = [ + { value: EXECUTION_STATUS.QUEUEING, label: 'Assigned', color: 'blue' }, + { value: EXECUTION_STATUS.STARTED, label: 'Pending', color: 'gold' }, + // { value: EXECUTION_STATUS.RETURNED, label: `{{t("Returned", { ns: "${NAMESPACE}" })}}`, color: 'purple' }, + { value: 2, label: 'Approved', color: 'green' }, + { value: EXECUTION_STATUS.REJECTED, label: 'Rejected', color: 'red' }, + // { value: EXECUTION_STATUS.WITHDRAWN, label: `{{t("Withdrawn", { ns: "${NAMESPACE}" })}}` }, +]; diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx index 2cffd5170..1382f059a 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/TabApprovalItem.tsx @@ -8,7 +8,13 @@ import { useAsyncEffect } from 'ahooks'; import { Empty, List, Space, Tag } from 'antd-mobile'; import { useNavigate } from 'react-router-dom'; -import { APPROVAL_STATUS, ApprovalPriorityType, approvalStatusOptions, ExecutionStatusOptions } from '../../constants'; +import { + APPROVAL_STATUS, + ApprovalPriorityType, + ApprovalStatusEnums, + approvalStatusOptions, + ExecutionStatusOptions, +} from '../../constants'; import { useTranslation } from '../../locale'; export const TabApprovalItem = observer((props) => { @@ -189,11 +195,14 @@ const changeUsersJobsService = (api, t, cm, compile, input, setData, params, fil export const changeWorkflowNoticeService = (api, t, cm, compile, input, setData, params, filter, user) => { api .request({ - url: 'workflowNotice:listCentralized', + url: 'approvalCarbonCopy:list', params: { pageSize: 9999, filter: { ...params, ...filter }, appends: [ + 'createdBy.id', + 'createdBy.nickname', + 'approval.status', 'user.id', 'user.nickname', 'node.id', @@ -228,13 +237,14 @@ export const changeWorkflowNoticeService = (api, t, cm, compile, input, setData, (Object.prototype.toString.call(value) === '[object Object]' ? resonValue?.['name'] : resonValue) || '', }; }); + const statusType = ApprovalStatusEnums.find((value) => value.value === item.approval?.status); const nickName = user.find((userItem) => userItem.id === item.snapshot?.createdById)?.nickname; return { ...item, title: `${nickName}的${categoryTitle}`, categoryTitle: categoryTitle, - statusTitle: null, - statusColor: null, + statusTitle: t(statusType.label), + statusColor: statusType.color, reason: summary, priorityTitle: priorityType.label, priorityColor: priorityType.color, diff --git a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/ViewTodosWorkflowNoticeContent.tsx b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/ViewTodosWorkflowNoticeContent.tsx index 0a7121c32..ee2732f31 100644 --- a/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/ViewTodosWorkflowNoticeContent.tsx +++ b/packages/plugins/@hera/plugin-approval-mobile/src/client/approval/todos/component/ViewTodosWorkflowNoticeContent.tsx @@ -23,6 +23,7 @@ import '../../style/style.css'; import { MobileProvider } from '@tachybase/plugin-mobile-client/client'; import { observer } from '@tachybase/schema'; +import { COLLECTION_NAME_APPROVAL_CARBON_COPY } from '../../constants'; import { ContextApprovalExecution } from '../../context/ApprovalExecution'; import { useWorkflowNoticeFormBlockProps } from '../hook/useFormBlockProps'; import { usePropsNoticeDetail } from '../hook/usePropsNoticeDetail'; @@ -40,10 +41,10 @@ export const ViewTodosWorkflowNoticeContent = observer((props) => { useEffect(() => { api .request({ - url: 'workflowNotice:get', + url: `${COLLECTION_NAME_APPROVAL_CARBON_COPY}:get`, params: { filterByTk: id, - appends: ['execution', 'node', 'job', 'workflow', 'workflow.nodes', 'execution.jobs', 'user'], + appends: ['node', 'job', 'workflow', 'workflow.nodes', 'execution', 'execution.jobs', 'user'], except: ['workflow.config', 'workflow.options', 'nodes.config'], sort: ['-createdAt'], }, @@ -58,7 +59,7 @@ export const ViewTodosWorkflowNoticeContent = observer((props) => { nodes, execution, }); - setSchemaId(node?.config.showNoticeDetail); + setSchemaId(node?.config.showCarbonCopyDetail); setNoticeData(data.data); return; }) diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/collections/workflows.collection.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/collections/workflows.collection.tsx index 1817b348c..e23ff5a7a 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/collections/workflows.collection.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/collections/workflows.collection.tsx @@ -1,7 +1,7 @@ import { NAMESPACE } from '../locale'; export const CollectionWorkflows = { - title: `{{t("Workflow", { ns: "${NAMESPACE}" })}}`, + title: `{{t("Approval Launch", { ns: "${NAMESPACE}" })}}`, name: 'workflows', fields: [ { diff --git a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/launch/Sm.ApprovalBlockLaunch.tsx b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/launch/Sm.ApprovalBlockLaunch.tsx index a54908b8d..c83a5e9f3 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/launch/Sm.ApprovalBlockLaunch.tsx +++ b/packages/plugins/@tachybase/plugin-workflow/src/client/features/approval/usage/approval-block/launch/Sm.ApprovalBlockLaunch.tsx @@ -35,12 +35,12 @@ export const SchemaApprovalBlockLaunch = { 'x-component-props': { icon: 'ReloadOutlined' }, 'x-align': 'right', }, - apply: { - type: 'void', - title: `{{t("Apply new", { ns: "${NAMESPACE}" })}}`, - 'x-component': 'ApplyButton', - 'x-align': 'right', - }, + // apply: { + // type: 'void', + // title: `{{t("Apply new", { ns: "${NAMESPACE}" })}}`, + // 'x-component': 'ApplyButton', + // 'x-align': 'right', + // }, }, }, table: { diff --git a/packages/plugins/@tachybase/plugin-workflow/src/locale/en-US.json b/packages/plugins/@tachybase/plugin-workflow/src/locale/en-US.json index f6d014bf8..dde37430d 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/locale/en-US.json +++ b/packages/plugins/@tachybase/plugin-workflow/src/locale/en-US.json @@ -280,5 +280,6 @@ "Are you sure you want to resubmit it?": "Are you sure you want to resubmit it?", "MyLaunch":"MyLaunch", "CarbonCopy":"CarbonCopy", - "ApprovalCarbonCopy":"Approval:CarbonCopy" + "ApprovalCarbonCopy":"Approval:CarbonCopy", + "Approval Launch":"Approval Launch" } diff --git a/packages/plugins/@tachybase/plugin-workflow/src/locale/zh-CN.json b/packages/plugins/@tachybase/plugin-workflow/src/locale/zh-CN.json index 419af179d..4fe79995d 100644 --- a/packages/plugins/@tachybase/plugin-workflow/src/locale/zh-CN.json +++ b/packages/plugins/@tachybase/plugin-workflow/src/locale/zh-CN.json @@ -361,5 +361,6 @@ "Are you sure you want to resubmit it?": "是否确定重新发起?", "MyLaunch":"我的发起", "CarbonCopy":"抄送", - "ApprovalCarbonCopy":"审批:抄送" + "ApprovalCarbonCopy":"审批:抄送", + "Approval Launch":"审批发起" }