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:
parent
41b8d00223
commit
3a1e3d92e6
@ -15,6 +15,27 @@ export const CollectionApprovalTodos = {
|
|||||||
'x-component': 'InputNumber',
|
'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',
|
type: 'belongsTo',
|
||||||
name: 'user',
|
name: 'user',
|
||||||
|
@ -53,6 +53,8 @@ const schemaItems = [
|
|||||||
collection: 'approvalRecords',
|
collection: 'approvalRecords',
|
||||||
params: {
|
params: {
|
||||||
appends: [
|
appends: [
|
||||||
|
'createdBy.id',
|
||||||
|
'createdBy.nickname',
|
||||||
'user.id',
|
'user.id',
|
||||||
'user.nickname',
|
'user.nickname',
|
||||||
'node.id',
|
'node.id',
|
||||||
|
@ -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: {
|
user: {
|
||||||
type: 'void',
|
type: 'void',
|
||||||
'x-decorator': 'TableV2.Column.Decorator',
|
'x-decorator': 'TableV2.Column.Decorator',
|
||||||
|
@ -131,7 +131,7 @@ export default class ApprovalInstruction extends Instruction {
|
|||||||
'executions.id': processor.execution.id,
|
'executions.id': processor.execution.id,
|
||||||
},
|
},
|
||||||
fields: ['id', 'status', 'data', 'summary', 'collectionName'],
|
fields: ['id', 'status', 'data', 'summary', 'collectionName'],
|
||||||
appends: ['approvalExecutions'],
|
appends: ['approvalExecutions', 'createdBy'],
|
||||||
except: ['data'],
|
except: ['data'],
|
||||||
});
|
});
|
||||||
const approvalExecution = approval.approvalExecutions.find((item) => item.executionId === processor.execution.id);
|
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) => ({
|
assignees.map((userId, index) => ({
|
||||||
approvalId: approval.id,
|
approvalId: approval.id,
|
||||||
approvalExecutionId: approvalExecution.id,
|
approvalExecutionId: approvalExecution.id,
|
||||||
|
createdById: approval.createdBy?.id,
|
||||||
userId,
|
userId,
|
||||||
jobId: job.id,
|
jobId: job.id,
|
||||||
nodeId: node.id,
|
nodeId: node.id,
|
||||||
|
@ -5,6 +5,7 @@ export default defineCollection({
|
|||||||
namespace: 'workflow.approvalRecords',
|
namespace: 'workflow.approvalRecords',
|
||||||
dumpRules: 'required',
|
dumpRules: 'required',
|
||||||
name: 'approvalRecords',
|
name: 'approvalRecords',
|
||||||
|
createdBy: true,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
Loading…
Reference in New Issue
Block a user