|
@@ -22,7 +22,12 @@ import { useForm } from 'rc-field-form';
|
|
|
import { async } from '@antv/x6/lib/registry/marker/async';
|
|
|
import AuditDetailed from './AuditDetailed';
|
|
|
import AuditFlow from './AuditFlow';
|
|
|
-import { queryDingSchema, queryProcessFlows } from '@/services/boom';
|
|
|
+import {
|
|
|
+ queryDingSchema,
|
|
|
+ queryGetBomForm,
|
|
|
+ queryProcessFlows,
|
|
|
+ querySaveBomForm,
|
|
|
+} from '@/services/boom';
|
|
|
import { Form as Form3x } from '@ant-design/compatible';
|
|
|
import { getCurrentUser } from '@/utils/authority';
|
|
|
import DDCode from '@/components/DDComponents/DDCode';
|
|
@@ -63,6 +68,7 @@ function CommitAuditModal(props) {
|
|
|
useEffect(() => {
|
|
|
if (!visible) return;
|
|
|
const { edges, nodes } = flowDetail;
|
|
|
+ initFormList();
|
|
|
let Id = version.template_node_id;
|
|
|
const currentId = flowDetail.nodes.find?.(item => item.Id == Id)?.node_id;
|
|
|
const data = treeData(currentId);
|
|
@@ -93,6 +99,34 @@ function CommitAuditModal(props) {
|
|
|
setAuditList([]);
|
|
|
}, [visible]);
|
|
|
|
|
|
+ const initFormList = async () => {
|
|
|
+ const res = await queryGetBomForm({
|
|
|
+ project_id: version.project_id,
|
|
|
+ node_id: version.template_node_id,
|
|
|
+ });
|
|
|
+ if (res.data) {
|
|
|
+ const formList = JSON.parse(res.data.json);
|
|
|
+
|
|
|
+ const defaultApproval = {};
|
|
|
+ formList.forEach(item => {
|
|
|
+ const curItem = JSON.parse(item);
|
|
|
+ const audit_list = curItem.audit_list.map(audit => {
|
|
|
+ return [{ type: 'user', value: audit, name: null }];
|
|
|
+ });
|
|
|
+ defaultApproval[curItem.template_node_id] = audit_list;
|
|
|
+ });
|
|
|
+ // const defaultFormData = {};
|
|
|
+ // formList.forEach(item => {
|
|
|
+ // const curItem = JSON.parse(item);
|
|
|
+ // defaultFormData[curItem.template_node_id] = curItem.formComponentValues;
|
|
|
+ // });
|
|
|
+ // console.log('========defaultApproval==============', defaultApproval);
|
|
|
+ // console.log('========defaultFormData==============', defaultFormData);
|
|
|
+ setApprovalProcess(defaultApproval);
|
|
|
+ // setFormComponentValues(defaultFormData);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const treeData = currentId => {
|
|
|
const list = getNextNodes(currentId, 'custom-circle');
|
|
|
const fun = nodes => {
|
|
@@ -283,14 +317,13 @@ function CommitAuditModal(props) {
|
|
|
})
|
|
|
.filter(item => item);
|
|
|
if (getReComputeAudit(items, changedValues)) advanceSubmit();
|
|
|
- // console.log('==================================', { ...formComponentValues });
|
|
|
setFormComponentValues({ ...formComponentValues });
|
|
|
},
|
|
|
})(AuditDetailed);
|
|
|
item.FormComponents = <Components items={item.items} />;
|
|
|
});
|
|
|
setAuditList(addAuditList);
|
|
|
- advanceSubmit();
|
|
|
+ if (Object.keys(approvalProcess).length == 0) advanceSubmit();
|
|
|
};
|
|
|
|
|
|
const getFromData = async idList => {
|
|
@@ -450,6 +483,11 @@ function CommitAuditModal(props) {
|
|
|
message.error('当前存在审批节点未绑定审批流程!请联系管理员。');
|
|
|
return;
|
|
|
}
|
|
|
+ await querySaveBomForm({
|
|
|
+ project_id: version.project_id,
|
|
|
+ node_id: version.template_node_id,
|
|
|
+ json: JSON.stringify(formList),
|
|
|
+ });
|
|
|
onOk(params);
|
|
|
};
|
|
|
const CascaderNode = index => {
|
|
@@ -511,7 +549,7 @@ function CommitAuditModal(props) {
|
|
|
// rules={[{ required: true, message: '请选择业务节点' }]}
|
|
|
>
|
|
|
<Select style={{ width: '100%' }}>
|
|
|
- {getNextNodes(data.length < 0 ? currentNodeId : auditId, 'custom-rect').map(item => (
|
|
|
+ {getNextNodes(auditId || currentNodeId, 'custom-rect').map(item => (
|
|
|
<Option key={item.value}>{item.label}</Option>
|
|
|
))}
|
|
|
</Select>
|