|
@@ -7,7 +7,7 @@ import { useForm } from 'rc-field-form';
|
|
import { async } from '@antv/x6/lib/registry/marker/async';
|
|
import { async } from '@antv/x6/lib/registry/marker/async';
|
|
import AuditDetailed from './AuditDetailed';
|
|
import AuditDetailed from './AuditDetailed';
|
|
import AuditFlow from './AuditFlow';
|
|
import AuditFlow from './AuditFlow';
|
|
-import { queryDingSchema } from '@/services/boom';
|
|
|
|
|
|
+import { queryDingSchema, queryProcessFlows } from '@/services/boom';
|
|
import { Form as Form3x } from '@ant-design/compatible';
|
|
import { Form as Form3x } from '@ant-design/compatible';
|
|
import { getCurrentUser } from '@/utils/authority';
|
|
import { getCurrentUser } from '@/utils/authority';
|
|
import DDCode from '@/components/DDComponents/DDCode';
|
|
import DDCode from '@/components/DDComponents/DDCode';
|
|
@@ -154,20 +154,28 @@ function CommitAuditModal(props) {
|
|
.map(Id => {
|
|
.map(Id => {
|
|
return flowDetail.nodes.find?.(item => item.Id == Id);
|
|
return flowDetail.nodes.find?.(item => item.Id == Id);
|
|
})
|
|
})
|
|
- .filter(item => item.process_code);
|
|
|
|
- for (let i = 0; i < codeList.length; i++) {
|
|
|
|
- let res = await queryDingSchema({ process_code: codeList[i].process_code });
|
|
|
|
- if (res) {
|
|
|
|
- res.data.result.nodeId = codeList[i].Id;
|
|
|
|
- addAuditList.push(res.data.result);
|
|
|
|
- }
|
|
|
|
|
|
+ .filter(item => item);
|
|
|
|
+ console.log('============', codeList);
|
|
|
|
+ let flowIds = [...new Set(codeList.map(item => item.flow_id))].join(',');
|
|
|
|
+ let data = await queryProcessFlows({ ids: flowIds });
|
|
|
|
+ if (data && data?.length > 0) {
|
|
|
|
+ let newlist = codeList.map(node => {
|
|
|
|
+ let curData = data.find(item => item.id == node.flow_id);
|
|
|
|
+ let newItem = {
|
|
|
|
+ name: curData?.name,
|
|
|
|
+ nodeId: node.Id,
|
|
|
|
+ items: JSON.parse(curData.form_json),
|
|
|
|
+ };
|
|
|
|
+ return newItem;
|
|
|
|
+ });
|
|
|
|
+ addAuditList = [...addAuditList, ...newlist];
|
|
}
|
|
}
|
|
- console.log(JSON.stringify(addAuditList));
|
|
|
|
|
|
+
|
|
|
|
+ console.log(addAuditList);
|
|
addAuditList.forEach((item, index) => {
|
|
addAuditList.forEach((item, index) => {
|
|
let Components = Form3x.create({
|
|
let Components = Form3x.create({
|
|
onValuesChange: (props, changedValues, allValues) => {
|
|
onValuesChange: (props, changedValues, allValues) => {
|
|
const { items } = props;
|
|
const { items } = props;
|
|
- console.log(item);
|
|
|
|
formComponentValues[item.nodeId] = items
|
|
formComponentValues[item.nodeId] = items
|
|
.map(item => {
|
|
.map(item => {
|
|
const itemProps = item.props;
|
|
const itemProps = item.props;
|
|
@@ -182,7 +190,7 @@ function CommitAuditModal(props) {
|
|
} else if (allValues[itemProps.id]) {
|
|
} else if (allValues[itemProps.id]) {
|
|
return {
|
|
return {
|
|
name: itemProps.label,
|
|
name: itemProps.label,
|
|
- // id: itemProps.id,
|
|
|
|
|
|
+ id: itemProps.id,
|
|
value: allValues[itemProps.id] || undefined,
|
|
value: allValues[itemProps.id] || undefined,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
@@ -191,7 +199,7 @@ function CommitAuditModal(props) {
|
|
setFormComponentValues({ ...formComponentValues });
|
|
setFormComponentValues({ ...formComponentValues });
|
|
},
|
|
},
|
|
})(AuditDetailed);
|
|
})(AuditDetailed);
|
|
- item.FormComponents = <Components items={item.schemaContent.items} />;
|
|
|
|
|
|
+ item.FormComponents = <Components items={item.items} />;
|
|
});
|
|
});
|
|
setAuditList(addAuditList);
|
|
setAuditList(addAuditList);
|
|
};
|
|
};
|
|
@@ -211,24 +219,12 @@ function CommitAuditModal(props) {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
let firstList = [...new Set(list)];
|
|
let firstList = [...new Set(list)];
|
|
- // let firstList = idList[0];
|
|
|
|
- // for (let i = 1; i < idList.length; i++) {
|
|
|
|
- // let item = idList[i];
|
|
|
|
- // item.forEach(itemId => {
|
|
|
|
- // let idx = firstList.findIndex(id => id == itemId);
|
|
|
|
- // if (idx > 0 && !firstList.find(cur => cur == item[idx - 1])) {
|
|
|
|
- // firstList.splice(idx, 0, item[i - 1]);
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
let attachment = await upload();
|
|
let attachment = await upload();
|
|
firstList.forEach(id => {
|
|
firstList.forEach(id => {
|
|
let approvalNode = flowDetail.nodes.find?.(item => item.Id == id);
|
|
let approvalNode = flowDetail.nodes.find?.(item => item.Id == id);
|
|
let values = data[approvalNode.Id] || [];
|
|
let values = data[approvalNode.Id] || [];
|
|
const formItem = {
|
|
const formItem = {
|
|
- processCode: approvalNode.process_code,
|
|
|
|
- originatorUserId: currentUser.DingUserId || getCurrentUser()?.DingUserId, //'16569001414345099',
|
|
|
|
- deptId: '14237557', //currentUser.DingDepId || getCurrentUser()?.DingDepId,
|
|
|
|
|
|
+ flow_id: `${approvalNode.flow_id}`,
|
|
template_node_id: `${approvalNode.Id}`,
|
|
template_node_id: `${approvalNode.Id}`,
|
|
formComponentValues: [...values, { name: '附件', value: JSON.stringify(attachment) }],
|
|
formComponentValues: [...values, { name: '附件', value: JSON.stringify(attachment) }],
|
|
};
|
|
};
|
|
@@ -238,7 +234,7 @@ function CommitAuditModal(props) {
|
|
};
|
|
};
|
|
const onFinish = async () => {
|
|
const onFinish = async () => {
|
|
var fieldsValue = await form.validateFields();
|
|
var fieldsValue = await form.validateFields();
|
|
- console.log(formComponentValues);
|
|
|
|
|
|
+ console.log();
|
|
let hasFlowId = true; //是否都绑定审批节点
|
|
let hasFlowId = true; //是否都绑定审批节点
|
|
const getFlowPath = node => {
|
|
const getFlowPath = node => {
|
|
//[134, 135]
|
|
//[134, 135]
|