refactor: 流程配置页去掉提交环节开关,附件只按节点配置
This commit is contained in:
@@ -9,15 +9,6 @@ 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'];
|
||||
|
||||
@@ -26,6 +17,6 @@ export const WRITABLE_TYPES = ['APPROVE', 'COUNTERSIGN', 'CONFIRM'];
|
||||
|
||||
/** 节点类型显示名 */
|
||||
export function nodeTypeLabel(type?: string) {
|
||||
const item = NODE_TYPE_LABELS.find((option) => option.value === type);
|
||||
const item = NODE_TYPE_OPTIONS.find((option) => option.value === type);
|
||||
return item ? item.label : type || '';
|
||||
}
|
||||
|
||||
@@ -61,19 +61,6 @@
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<div class="submit-stage">
|
||||
<div class="submit-stage-header">
|
||||
<span class="submit-stage-title">提交环节</span>
|
||||
<a-radio-group v-model:value="submitMode" size="small">
|
||||
<a-radio-button value="FOLLOW">跟随代码</a-radio-button>
|
||||
<a-radio-button value="ON">必须上传附件</a-radio-button>
|
||||
<a-radio-button value="OFF">不必上传附件</a-radio-button>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<div class="submit-stage-tip">
|
||||
「跟随代码」沿用单据实现里声明的附件要求;选定后本环节作为链首只读节点发布,不产生待办。
|
||||
</div>
|
||||
</div>
|
||||
<a-empty
|
||||
v-if="!nodes.length"
|
||||
description="该流程尚未发布,点击「载入出厂模板」开始编辑"
|
||||
@@ -170,43 +157,17 @@
|
||||
const historyLoading = ref(false);
|
||||
const history = ref<ApprovalFlowVersion[]>([]);
|
||||
|
||||
/* 提交环节: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
|
||||
];
|
||||
/* 深拷贝节点:编辑区不能直接改列表里的对象 */
|
||||
const cloneNodes = (nodes?: ApprovalFlowNode[]) => {
|
||||
return JSON.parse(JSON.stringify(nodes || [])) as ApprovalFlowNode[];
|
||||
};
|
||||
|
||||
/* 加载编辑区:整链替换时递增 revision,强制节点卡片重新初始化 */
|
||||
const applyFlow = (flow: ApprovalFlow) => {
|
||||
current.value = flow;
|
||||
flowCode.value = flow.flowCode;
|
||||
setChain(flow.nodes);
|
||||
nodes.value = cloneNodes(flow.nodes);
|
||||
editorRevision.value = editorRevision.value + 1;
|
||||
};
|
||||
|
||||
const refreshFlows = (keepCode?: string) => {
|
||||
@@ -275,7 +236,8 @@
|
||||
okText: '载入',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
setChain(current.value?.factoryNodes);
|
||||
nodes.value = cloneNodes(current.value?.factoryNodes);
|
||||
editorRevision.value = editorRevision.value + 1;
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -298,7 +260,8 @@
|
||||
};
|
||||
|
||||
const loadVersion = (item: ApprovalFlowVersion) => {
|
||||
setChain(item.nodes);
|
||||
nodes.value = cloneNodes(item.nodes);
|
||||
editorRevision.value = editorRevision.value + 1;
|
||||
historyVisible.value = false;
|
||||
message.info('已载入 v' + item.version + ',确认后点「保存并发布」');
|
||||
};
|
||||
@@ -321,7 +284,7 @@
|
||||
saving.value = true;
|
||||
return publishFlowConfig({
|
||||
flowCode: current.value!.flowCode,
|
||||
nodes: buildChain()
|
||||
nodes: nodes.value
|
||||
})
|
||||
.then((data) => {
|
||||
saving.value = false;
|
||||
@@ -386,31 +349,6 @@
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user