diff --git a/src/views/approval/flow/constants.ts b/src/views/approval/flow/constants.ts
index b8758ae..8ca14d5 100644
--- a/src/views/approval/flow/constants.ts
+++ b/src/views/approval/flow/constants.ts
@@ -9,6 +9,15 @@ export const NODE_TYPE_OPTIONS = [
{ value: 'ARCHIVE', label: '归档' }
];
+/** 提交环节:链首只读节点,不在可添加类型里 */
+export const NODE_SUBMIT = 'SUBMIT';
+
+/** 节点类型显示用(比可选项多一个提交环节) */
+export const NODE_TYPE_LABELS = [
+ ...NODE_TYPE_OPTIONS,
+ { value: NODE_SUBMIT, label: '提交' }
+];
+
/** 需要固定组织编码的解析器 */
export const ORG_RESOLVERS = ['orgLeaderByCode', 'orgDeputyByCode'];
@@ -17,6 +26,6 @@ export const WRITABLE_TYPES = ['APPROVE', 'COUNTERSIGN', 'CONFIRM'];
/** 节点类型显示名 */
export function nodeTypeLabel(type?: string) {
- const item = NODE_TYPE_OPTIONS.find((option) => option.value === type);
+ const item = NODE_TYPE_LABELS.find((option) => option.value === type);
return item ? item.label : type || '';
}
diff --git a/src/views/approval/flow/index.vue b/src/views/approval/flow/index.vue
index 71c315b..60f0658 100644
--- a/src/views/approval/flow/index.vue
+++ b/src/views/approval/flow/index.vue
@@ -61,6 +61,19 @@
+
+
+
+ 「跟随代码」沿用单据实现里声明的附件要求;选定后本环节作为链首只读节点发布,不产生待办。
+
+
([]);
- /* 深拷贝节点:编辑区不能直接改列表里的对象 */
- const cloneNodes = (nodes?: ApprovalFlowNode[]) => {
- return JSON.parse(JSON.stringify(nodes || [])) as ApprovalFlowNode[];
+ /* 提交环节:FOLLOW 沿用代码声明,ON/OFF 会以链首 SUBMIT 节点发布(ADR 0016) */
+ const submitMode = ref('FOLLOW');
+
+ /* 加载一条节点链:链首 SUBMIT 拆成独立的提交环节开关 */
+ const setChain = (chain?: ApprovalFlowNode[]) => {
+ const list = chain || [];
+ const head = list.length && list[0].type === 'SUBMIT' ? list[0] : null;
+ submitMode.value = head
+ ? head.attachmentRequired
+ ? 'ON'
+ : 'OFF'
+ : 'FOLLOW';
+ nodes.value = list.filter((node) => node.type !== 'SUBMIT');
+ editorRevision.value = editorRevision.value + 1;
+ };
+
+ /* 发布时拼回完整链:提交环节固定在最前 */
+ const buildChain = () => {
+ if (submitMode.value === 'FOLLOW') {
+ return nodes.value;
+ }
+ return [
+ {
+ key: 'submit',
+ type: 'SUBMIT',
+ name: '提交',
+ attachmentRequired: submitMode.value === 'ON'
+ },
+ ...nodes.value
+ ];
};
/* 加载编辑区:整链替换时递增 revision,强制节点卡片重新初始化 */
const applyFlow = (flow: ApprovalFlow) => {
current.value = flow;
flowCode.value = flow.flowCode;
- nodes.value = cloneNodes(flow.nodes);
- editorRevision.value = editorRevision.value + 1;
+ setChain(flow.nodes);
};
const refreshFlows = (keepCode?: string) => {
@@ -236,8 +275,7 @@
okText: '载入',
cancelText: '取消',
onOk: () => {
- nodes.value = cloneNodes(current.value?.factoryNodes);
- editorRevision.value = editorRevision.value + 1;
+ setChain(current.value?.factoryNodes);
}
});
};
@@ -260,8 +298,7 @@
};
const loadVersion = (item: ApprovalFlowVersion) => {
- nodes.value = cloneNodes(item.nodes);
- editorRevision.value = editorRevision.value + 1;
+ setChain(item.nodes);
historyVisible.value = false;
message.info('已载入 v' + item.version + ',确认后点「保存并发布」');
};
@@ -284,7 +321,7 @@
saving.value = true;
return publishFlowConfig({
flowCode: current.value!.flowCode,
- nodes: nodes.value
+ nodes: buildChain()
})
.then((data) => {
saving.value = false;
@@ -349,6 +386,31 @@
font-weight: 400;
}
+ .submit-stage {
+ margin-bottom: 12px;
+ padding: 12px;
+ background: rgba(0, 0, 0, 0.02);
+ border: 1px dashed rgba(0, 0, 0, 0.12);
+ border-radius: 6px;
+ }
+
+ .submit-stage-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .submit-stage-title {
+ color: rgba(0, 0, 0, 0.85);
+ font-weight: 500;
+ }
+
+ .submit-stage-tip {
+ margin-top: 6px;
+ color: rgba(0, 0, 0, 0.45);
+ font-size: 12px;
+ }
+
.flow-add {
margin-bottom: 12px;
}