fix: 同步移动端审批抄送 (#1339)
Reviewed-on: daoyoucloud/tachybase#1339 Reviewed-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: wjh <wwwjh0710@163.com> Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
parent
49a8e2e534
commit
456df870a3
@ -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,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
@ -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}" })}}` },
|
||||
];
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
})
|
||||
|
@ -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: [
|
||||
{
|
||||
|
@ -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: {
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -361,5 +361,6 @@
|
||||
"Are you sure you want to resubmit it?": "是否确定重新发起?",
|
||||
"MyLaunch":"我的发起",
|
||||
"CarbonCopy":"抄送",
|
||||
"ApprovalCarbonCopy":"审批:抄送"
|
||||
"ApprovalCarbonCopy":"审批:抄送",
|
||||
"Approval Launch":"审批发起"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user