|
@@ -158,9 +158,6 @@ function CommitAuditModal(props) {
|
|
if (res.data) {
|
|
if (res.data) {
|
|
const formList = JSON.parse(res.data.json);
|
|
const formList = JSON.parse(res.data.json);
|
|
setApprovalProcess(formList.approvalProcess || {});
|
|
setApprovalProcess(formList.approvalProcess || {});
|
|
- const temp = formList.formList;
|
|
|
|
- const prevFormData = (temp && temp.length) ? temp.map(tempItem => JSON.parse(tempItem)) : [];
|
|
|
|
- setFormComponentValues(prevFormData);
|
|
|
|
return formList;
|
|
return formList;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -260,8 +257,15 @@ function CommitAuditModal(props) {
|
|
// 加载之前提交的form数据
|
|
// 加载之前提交的form数据
|
|
const resFormData = await initFormList();
|
|
const resFormData = await initFormList();
|
|
const resData = resFormData?.formList;
|
|
const resData = resFormData?.formList;
|
|
-
|
|
|
|
const prevFormData = resData && resData.length ? resData.map(resItem => JSON.parse(resItem)) : null;
|
|
const prevFormData = resData && resData.length ? resData.map(resItem => JSON.parse(resItem)) : null;
|
|
|
|
+ if (prevFormData && prevFormData.length) {
|
|
|
|
+ const formValues = {}
|
|
|
|
+ prevFormData.forEach(pItem => {
|
|
|
|
+ formValues[pItem.template_node_id] = [...pItem.formComponentValues]
|
|
|
|
+ })
|
|
|
|
+ setFormComponentValues(formValues)
|
|
|
|
+ }
|
|
|
|
+
|
|
if (value) {
|
|
if (value) {
|
|
changeAudit(value[value.length - 1]);
|
|
changeAudit(value[value.length - 1]);
|
|
if (prevFormData !== null) {
|
|
if (prevFormData !== null) {
|
|
@@ -357,12 +361,11 @@ function CommitAuditModal(props) {
|
|
addAuditList.forEach((item, index) => {
|
|
addAuditList.forEach((item, index) => {
|
|
// 回填历史数据
|
|
// 回填历史数据
|
|
if (prevFormData.length) {
|
|
if (prevFormData.length) {
|
|
- const currentForm = prevFormData.find(pItem=>pItem.template_node_id===item.nodeId);
|
|
|
|
|
|
+ const currentForm = prevFormData.find(pItem => pItem.template_node_id === item.nodeId);
|
|
item.items.forEach((DDComponent) => {
|
|
item.items.forEach((DDComponent) => {
|
|
- console.log(currentForm, DDComponent)
|
|
|
|
const prevValue = currentForm?.formComponentValues?.find(cItem => cItem.id === DDComponent.props.id)
|
|
const prevValue = currentForm?.formComponentValues?.find(cItem => cItem.id === DDComponent.props.id)
|
|
- // console.log(prevValue)
|
|
|
|
DDComponent.props.defaultValue = prevValue?.value || prevValue?.defaultValue
|
|
DDComponent.props.defaultValue = prevValue?.value || prevValue?.defaultValue
|
|
|
|
+
|
|
})
|
|
})
|
|
}
|
|
}
|
|
let Components = Form3x.create({
|
|
let Components = Form3x.create({
|
|
@@ -390,6 +393,7 @@ function CommitAuditModal(props) {
|
|
})
|
|
})
|
|
.filter(item => item);
|
|
.filter(item => item);
|
|
if (getReComputeAudit(items, changedValues)) advanceSubmit();
|
|
if (getReComputeAudit(items, changedValues)) advanceSubmit();
|
|
|
|
+ console.log(formComponentValues)
|
|
setFormComponentValues({...formComponentValues});
|
|
setFormComponentValues({...formComponentValues});
|
|
},
|
|
},
|
|
})(AuditDetailed);
|
|
})(AuditDetailed);
|
|
@@ -418,8 +422,8 @@ function CommitAuditModal(props) {
|
|
firstList.forEach(id => {
|
|
firstList.forEach(id => {
|
|
let approvalNode = flowDetail.nodes.find?.(item => item.Id == id);
|
|
let approvalNode = flowDetail.nodes.find?.(item => item.Id == id);
|
|
if (!approvalNode) return;
|
|
if (!approvalNode) return;
|
|
- const prevValues = data.length ? data.find((item)=>item.template_node_id === approvalNode.Id).formComponentValues : []
|
|
|
|
- let values = data[approvalNode.Id] || prevValues || [];
|
|
|
|
|
|
+ const prevValues = data.length ? data.find((item) => item.template_node_id === approvalNode.Id).formComponentValues : []
|
|
|
|
+ let values = data[approvalNode.Id] || prevValues || [];
|
|
let audit_list = [],
|
|
let audit_list = [],
|
|
cc_list = [];
|
|
cc_list = [];
|
|
approvalProcess[approvalNode.Id]?.forEach(item => {
|
|
approvalProcess[approvalNode.Id]?.forEach(item => {
|
|
@@ -427,7 +431,6 @@ function CommitAuditModal(props) {
|
|
if (item[0].type == 'role') return arr.push(item[0].nowValue);
|
|
if (item[0].type == 'role') return arr.push(item[0].nowValue);
|
|
return arr.push(item[0].value);
|
|
return arr.push(item[0].value);
|
|
});
|
|
});
|
|
- console.log(values)
|
|
|
|
const formItem = {
|
|
const formItem = {
|
|
flow_id: approvalNode.flow_id,
|
|
flow_id: approvalNode.flow_id,
|
|
template_node_id: approvalNode.Id,
|
|
template_node_id: approvalNode.Id,
|
|
@@ -569,7 +572,6 @@ function CommitAuditModal(props) {
|
|
message.error('当前存在审批节点未绑定审批流程!请联系管理员。');
|
|
message.error('当前存在审批节点未绑定审批流程!请联系管理员。');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- debugger
|
|
|
|
await querySaveBomForm({
|
|
await querySaveBomForm({
|
|
project_id: version.project_id,
|
|
project_id: version.project_id,
|
|
node_id: version.template_node_id,
|
|
node_id: version.template_node_id,
|