fix: approval-mobile, show task node & approval, update snapshot (#1367)
Reviewed-on: daoyoucloud/tachybase#1367 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
27ce763165
commit
6546331781
@ -35,7 +35,6 @@ export const TabApprovalItem = observer((props) => {
|
|||||||
changeWorkflowNoticeService(api, t, cm, compile, input, setData, params?.[tabKey], filter, user?.data?.data);
|
changeWorkflowNoticeService(api, t, cm, compile, input, setData, params?.[tabKey], filter, user?.data?.data);
|
||||||
}
|
}
|
||||||
}, [filter, params, input]);
|
}, [filter, params, input]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ marginTop: '10px', minHeight: '70vh' }}>
|
<div style={{ marginTop: '10px', minHeight: '70vh' }}>
|
||||||
{data.length ? (
|
{data.length ? (
|
||||||
@ -52,6 +51,9 @@ export const TabApprovalItem = observer((props) => {
|
|||||||
{/* <Badge color="#6ac3ff" content={Badge.dot} style={{ '--right': '100%' }}> */}
|
{/* <Badge color="#6ac3ff" content={Badge.dot} style={{ '--right': '100%' }}> */}
|
||||||
<Space block>
|
<Space block>
|
||||||
{item.title}
|
{item.title}
|
||||||
|
<Tag color="primary" fill="solid">
|
||||||
|
{item.node?.title}
|
||||||
|
</Tag>
|
||||||
{item.statusTitle ? (
|
{item.statusTitle ? (
|
||||||
<Tag color={item.statusColor} fill="outline">
|
<Tag color={item.statusColor} fill="outline">
|
||||||
{item.statusIcon}
|
{item.statusIcon}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import { parseCollectionName } from '@tachybase/data-source-manager';
|
||||||
import { UiSchemaRepository } from '@tachybase/plugin-ui-schema-storage';
|
import { UiSchemaRepository } from '@tachybase/plugin-ui-schema-storage';
|
||||||
import { uid } from '@tachybase/utils';
|
import { uid } from '@tachybase/utils';
|
||||||
|
|
||||||
import { JOB_STATUS } from '../../constants';
|
import { JOB_STATUS } from '../../constants';
|
||||||
import Instruction from '../../instructions';
|
import Instruction from '../../instructions';
|
||||||
|
import { toJSON } from '../../utils';
|
||||||
|
import ApprovalTrigger from './ApprovalTrigger';
|
||||||
import { APPROVAL_ACTION_STATUS, APPROVAL_STATUS } from './constants';
|
import { APPROVAL_ACTION_STATUS, APPROVAL_STATUS } from './constants';
|
||||||
|
|
||||||
const NEGOTIATION_MODE = {
|
const NEGOTIATION_MODE = {
|
||||||
@ -184,6 +187,7 @@ export default class ApprovalInstruction extends Instruction {
|
|||||||
filter: {
|
filter: {
|
||||||
jobId: job.id,
|
jobId: job.id,
|
||||||
},
|
},
|
||||||
|
appends: ['approval'],
|
||||||
except: ['snapshot'],
|
except: ['snapshot'],
|
||||||
sort: ['index'],
|
sort: ['index'],
|
||||||
transaction: processor.transaction,
|
transaction: processor.transaction,
|
||||||
@ -238,6 +242,44 @@ export default class ApprovalInstruction extends Instruction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// NOTE: 审批对象数据, 可能在此期间变更, 需要拿到最新的审批对象数据, 更新到最新的 snapshot
|
||||||
|
/** 以下为更新 snapshot 逻辑 */
|
||||||
|
try {
|
||||||
|
const approval = records[0].approval;
|
||||||
|
const [dataSourceName, collectionName] = parseCollectionName(approval.collectionName);
|
||||||
|
const { repository } = this.workflow.app.dataSourceManager.dataSources
|
||||||
|
.get(dataSourceName)
|
||||||
|
.collectionManager.getCollection(collectionName);
|
||||||
|
|
||||||
|
const workflow = await approval.getWorkflow({
|
||||||
|
where: {
|
||||||
|
id: approval.get('workflowId'),
|
||||||
|
type: ApprovalTrigger.TYPE,
|
||||||
|
enabled: true,
|
||||||
|
'config.collection': approval.collectionName,
|
||||||
|
},
|
||||||
|
transaction: processor.transaction,
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await repository.findOne({
|
||||||
|
filterByTk: approval.get('dataKey'),
|
||||||
|
appends: workflow.config.appends,
|
||||||
|
transaction: this.workflow.useDataSourceTransaction(dataSourceName, processor.transaction),
|
||||||
|
});
|
||||||
|
|
||||||
|
await RecordRepo.update({
|
||||||
|
values: {
|
||||||
|
snapshot: toJSON(data),
|
||||||
|
},
|
||||||
|
filter: {
|
||||||
|
jobId: job.id,
|
||||||
|
},
|
||||||
|
transaction: processor.transaction,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log('%c Line:269 🥛 error', error);
|
||||||
|
}
|
||||||
|
/** 以上为更新 snapshot 逻辑 */
|
||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
async duplicateConfig(node, { transaction }) {
|
async duplicateConfig(node, { transaction }) {
|
||||||
|
Loading…
Reference in New Issue
Block a user