feat: approval, todo initiator (#1317)

Reviewed-on: daoyoucloud/tachybase#1317
Reviewed-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: bai.zixv <bai.zixv@foxmail.com>
Co-committed-by: bai.zixv <bai.zixv@foxmail.com>
This commit is contained in:
bai.zixv 2024-07-15 16:18:51 +08:00 committed by sealday
parent 41b8d00223
commit 3a1e3d92e6
5 changed files with 40 additions and 1 deletions

View File

@ -15,6 +15,27 @@ export const CollectionApprovalTodos = {
'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: 'belongsTo',
name: 'user',

View File

@ -53,6 +53,8 @@ const schemaItems = [
collection: 'approvalRecords',
params: {
appends: [
'createdBy.id',
'createdBy.nickname',
'user.id',
'user.nickname',
'node.id',

View File

@ -101,6 +101,20 @@ export const SchemaApprovalBlockTodos = {
},
},
},
createdBy: {
type: 'void',
title: `{{t("Initiator", { ns: "${NAMESPACE}" })}}`,
'x-decorator': 'TableV2.Column.Decorator',
'x-component': 'TableV2.Column',
'x-component-props': { width: 160 },
properties: {
createdBy: {
type: 'string',
'x-component': 'UserColumn',
'x-read-pretty': true,
},
},
},
user: {
type: 'void',
'x-decorator': 'TableV2.Column.Decorator',

View File

@ -131,7 +131,7 @@ export default class ApprovalInstruction extends Instruction {
'executions.id': processor.execution.id,
},
fields: ['id', 'status', 'data', 'summary', 'collectionName'],
appends: ['approvalExecutions'],
appends: ['approvalExecutions', 'createdBy'],
except: ['data'],
});
const approvalExecution = approval.approvalExecutions.find((item) => item.executionId === processor.execution.id);
@ -144,6 +144,7 @@ export default class ApprovalInstruction extends Instruction {
assignees.map((userId, index) => ({
approvalId: approval.id,
approvalExecutionId: approvalExecution.id,
createdById: approval.createdBy?.id,
userId,
jobId: job.id,
nodeId: node.id,

View File

@ -5,6 +5,7 @@ export default defineCollection({
namespace: 'workflow.approvalRecords',
dumpRules: 'required',
name: 'approvalRecords',
createdBy: true,
fields: [
{
type: 'string',