|
@@ -70,7 +70,6 @@ function Detail(props) {
|
|
|
diff: 0,
|
|
|
add: 0,
|
|
|
});
|
|
|
- // const [fileVisible, setFileVisible] = useState(false);
|
|
|
const [exportDate, setExportData] = useState([]);
|
|
|
const sheetRef = useRef();
|
|
|
const sheetRef2 = useRef();
|
|
@@ -94,32 +93,6 @@ function Detail(props) {
|
|
|
|
|
|
const projectId = parseInt(params.projectId);
|
|
|
const templateId = parseInt(params.templateId);
|
|
|
- const auditDetail = useMemo(() => {
|
|
|
- let data = {
|
|
|
- processCode: '',
|
|
|
- deptId: '14169890',
|
|
|
- tasks: [],
|
|
|
- // userId: '16569001414345099',
|
|
|
- // deptId: currentUser.DingDepId || getCurrentUser()?.DingDepId,
|
|
|
- userId: currentUser.DingUserId || getCurrentUser()?.DingUserId,
|
|
|
- formComponentValues: [],
|
|
|
- activityId: '',
|
|
|
- cc_userids: [],
|
|
|
- status: version.audit_status,
|
|
|
- };
|
|
|
- if (version?.flow_id && instanceDetail?.tasks && instanceDetail.tasks?.length > 0) {
|
|
|
- let item = flowDetail.nodes.find(item => item.Id == version.template_node_id);
|
|
|
- if (!item) return data;
|
|
|
- const { tasks, form_component_values, cc_userids } = instanceDetail;
|
|
|
- data.processCode = item.process_code;
|
|
|
- data.activityId = tasks[tasks.length - 1]?.activity_id;
|
|
|
- data.tasks = tasks || [];
|
|
|
- data.cc_userids = cc_userids;
|
|
|
- data.formComponentValues = form_component_values?.filter(item => item.name);
|
|
|
- if (version.status == 1) data.status = -1;
|
|
|
- }
|
|
|
- return data;
|
|
|
- }, [instanceDetail, version]);
|
|
|
|
|
|
const flow = useMemo(() => {
|
|
|
let data = {
|
|
@@ -145,10 +118,7 @@ function Detail(props) {
|
|
|
}, [auditList, version]);
|
|
|
const active_audit = flow.active_audit;
|
|
|
const isAuditor = useMemo(() => {
|
|
|
- const getUserRole = () => {
|
|
|
- return flow.currentNode?.auditor == currentUser.ID;
|
|
|
- };
|
|
|
- return active_audit == 1 && getUserRole();
|
|
|
+ return active_audit == 1 && flow.currentNode?.auditor == currentUser.ID;
|
|
|
}, [active_audit, flow, currentUser]);
|
|
|
|
|
|
const onCompare = async checkSheets => {
|
|
@@ -198,7 +168,6 @@ function Detail(props) {
|
|
|
className={styles.sheet}
|
|
|
ref={!index ? sheetRef3 : sheetRef2}
|
|
|
data={item.data || null}
|
|
|
- // onClickCell={onClickCell}
|
|
|
/>
|
|
|
</div>
|
|
|
);
|
|
@@ -216,31 +185,12 @@ function Detail(props) {
|
|
|
type: 'detail/queryComment',
|
|
|
payload,
|
|
|
});
|
|
|
-
|
|
|
- // setCommentVisible(true);
|
|
|
}
|
|
|
- // 比对模式下双excl同步选中
|
|
|
- // if (statusRef.current.compare) {
|
|
|
- // sheetRef3.current.selectCell(position.r, position.c, s.order);
|
|
|
- // sheetRef2.current.selectCell(position.r, position.c, s.order);
|
|
|
- // }
|
|
|
};
|
|
|
|
|
|
const onCommit = params => {
|
|
|
- let currentNode = flowDetail.nodes.find?.(item => item.Id == version.template_node_id);
|
|
|
let currentData = sheetRef.current.getSheetJson().data;
|
|
|
let sheets = JSON.parse(JSON.stringify(currentData));
|
|
|
- if (!currentNode.muti_version) {
|
|
|
- // audit_status=4 表示为清单推进后留存的副本.不计入多清单计算
|
|
|
- let serviceVersion = versionList.find(
|
|
|
- item => item.audit_status != 4 && item.template_node_id == currentNode.Id
|
|
|
- );
|
|
|
- if (serviceVersion) {
|
|
|
- message.error(`新建清单失败!业务节点【${currentNode.label}】只能有一个清单!`);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
sheets.forEach(item => {
|
|
|
delete item.data;
|
|
|
});
|
|
@@ -323,102 +273,7 @@ function Detail(props) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- const onApprove = flag => {
|
|
|
- if (!flag) {
|
|
|
- setAuditVisible(true);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- let isSingle = false;
|
|
|
- let serviceNode;
|
|
|
- const flowNode = flow.currentNode;
|
|
|
- const getLastTemplateNodeId = data => {
|
|
|
- let result;
|
|
|
- const getFun = item => {
|
|
|
- if (item.flow_path?.length > 0) {
|
|
|
- getFun(item.flow_path[0]);
|
|
|
- } else {
|
|
|
- result = item.template_node_id;
|
|
|
- }
|
|
|
- };
|
|
|
- if (!data) return version.template_node_id;
|
|
|
- getFun(data[0]);
|
|
|
- return result;
|
|
|
- };
|
|
|
- let lastTemplateNodeId = version.template_node_id;
|
|
|
- if (version.flow_path) {
|
|
|
- //如果多节点审批 获取当前是否审批流程的最后一个审批节点
|
|
|
- let flowPathList = JSON.parse(version.flow_path);
|
|
|
- lastTemplateNodeId = getLastTemplateNodeId(flowPathList);
|
|
|
- }
|
|
|
-
|
|
|
- // 判断是否为最后一个审批节点
|
|
|
- if (
|
|
|
- lastTemplateNodeId == version.template_node_id &&
|
|
|
- flow.current == flow.list.FlowNodes.length - 1
|
|
|
- ) {
|
|
|
- serviceNode = flowDetail.nodes.find?.(item => item.Id == version.next_template_node_id);
|
|
|
- if (!serviceNode.muti_version) {
|
|
|
- //audit_status=4 表示为清单推进后留存的副本.不计入多清单计算
|
|
|
- isSingle = versionList.find(
|
|
|
- item => item.audit_status != 4 && item.template_node_id == serviceNode.Id
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
- Modal.confirm({
|
|
|
- title: '提示',
|
|
|
- content: isSingle
|
|
|
- ? `节点【${serviceNode.label}】只能拥有一个清单,是否覆盖?`
|
|
|
- : `是否通过审批。`,
|
|
|
- okText: '确定',
|
|
|
- cancelText: '取消',
|
|
|
- onOk: () => {
|
|
|
- dispatch({
|
|
|
- type: 'detail/approve',
|
|
|
- payload: {
|
|
|
- id: flow.active_id,
|
|
|
- project_id: projectId,
|
|
|
- audit_status: 3,
|
|
|
- flow_id: flowNode.flow_id,
|
|
|
- node_id: flowNode.seq,
|
|
|
- },
|
|
|
- callback: newVersion => {
|
|
|
- // 更新flow流程图
|
|
|
- dispatch({
|
|
|
- type: 'xflow/queryBoomFlowDetail',
|
|
|
- payload: {
|
|
|
- id: templateId,
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
- // 更新审批流
|
|
|
- dispatch({
|
|
|
- type: 'detail/queryAuditList',
|
|
|
- payload: {
|
|
|
- template_id: version.template_id,
|
|
|
- template_node_id: version.template_node_id,
|
|
|
- flow_id: version.flow_id,
|
|
|
- version_id: version.version_id,
|
|
|
- audit_series: version.audit_series,
|
|
|
- },
|
|
|
- });
|
|
|
- if (flow.current == flow.list.FlowNodes.length - 1) {
|
|
|
- // 最后一个审核节点通过后 需要更新version id 不更不更,留在原地
|
|
|
- // localStorage.excelId = newVersion.id;
|
|
|
- // setVersion({
|
|
|
- // ...version,
|
|
|
- // flow_id: newVersion.flow_id,
|
|
|
- // id: newVersion.id,
|
|
|
- // });
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
const onMergeVersion = async sheet2 => {
|
|
|
- // const [sheet1, sheet2] = checkSheets;
|
|
|
const sheet1 = version;
|
|
|
if (!sheet1.data) {
|
|
|
sheet1.data = (
|
|
@@ -437,9 +292,6 @@ function Detail(props) {
|
|
|
|
|
|
setIsMerge(true);
|
|
|
setCompareList([sheet1, sheet2]);
|
|
|
- // setTimeout(() => {
|
|
|
- // sheetRef3.current.mergeExcl(sheet.data);
|
|
|
- // }, 400);
|
|
|
};
|
|
|
|
|
|
const handleMenuClick = e => {
|
|
@@ -477,15 +329,6 @@ function Detail(props) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- const getRowOneList = () => {
|
|
|
- const obj = sheetRef.current.getSheetJson();
|
|
|
- const list = [];
|
|
|
- obj.data.forEach(item => {
|
|
|
- list.push(item.data[0]);
|
|
|
- });
|
|
|
- return list;
|
|
|
- };
|
|
|
-
|
|
|
//点击导出弹出选择导出列弹框
|
|
|
const handleExportClick = () => {
|
|
|
setExportData(sheetRef.current.getSheetJson());
|
|
@@ -497,73 +340,11 @@ function Detail(props) {
|
|
|
setExportVisible(false);
|
|
|
};
|
|
|
|
|
|
- const queryHistory = id => {
|
|
|
- return new Promise(reslove => {
|
|
|
- dispatch({
|
|
|
- type: 'detail/queryHistory',
|
|
|
- payload: {
|
|
|
- // excel_id: id || excelId,
|
|
|
- project_id: projectId,
|
|
|
- },
|
|
|
- callback: reslove,
|
|
|
- });
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
- const getUploadProps = () => {
|
|
|
- const token = getToken() || GetTokenFromUrl();
|
|
|
- const uploadProps = {
|
|
|
- name: 'file',
|
|
|
- // showUploadList: false,
|
|
|
- action: `/api/v1/purchase/attachment/${projectId}`,
|
|
|
- headers: {
|
|
|
- 'JWT-TOKEN': token,
|
|
|
- },
|
|
|
- data: {
|
|
|
- type: 'file',
|
|
|
- file_type: 1, // '0 全局文件 1节点合同文件',
|
|
|
- },
|
|
|
- onChange(info) {
|
|
|
- if (info.file.status !== 'uploading') {
|
|
|
- console.log(info.file, info.fileList);
|
|
|
- }
|
|
|
- if (info.file.status === 'done') {
|
|
|
- message.success(`${info.file.name} 文件上传成功`);
|
|
|
- // queryFiles();
|
|
|
- } else if (info.file.status === 'error') {
|
|
|
- message.error(`${info.file.name} 文件上传失败`);
|
|
|
- }
|
|
|
- },
|
|
|
- };
|
|
|
- return uploadProps;
|
|
|
- };
|
|
|
-
|
|
|
-
|
|
|
- const queryHistoryDetail = async item => {
|
|
|
- return new Promise(resolve => {
|
|
|
- dispatch({
|
|
|
- type: 'detail/queryHistoryDetail',
|
|
|
- payload: {
|
|
|
- excel_id: item.excel_id,
|
|
|
- history_id: item.id,
|
|
|
- },
|
|
|
- callback: sheet => {
|
|
|
- resolve(sheet);
|
|
|
- },
|
|
|
- });
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
const getLoading = () => {
|
|
|
let effects = loading.effects;
|
|
|
return !loading.effects['detail/queryComment'] && loading.models.detail;
|
|
|
};
|
|
|
|
|
|
- const getFilesLoading = () => {
|
|
|
- let effects = loading.effects;
|
|
|
- return loading.effects['detail/queryFiles'];
|
|
|
- };
|
|
|
-
|
|
|
const changeVersion = id => {
|
|
|
let version;
|
|
|
if (typeof id == 'object') {
|
|
@@ -598,23 +379,6 @@ function Detail(props) {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const onSubmitNextNode = values => {
|
|
|
- dispatch({
|
|
|
- type: 'detail/submitNextNode',
|
|
|
- payload: values,
|
|
|
- callback: newVersion => {
|
|
|
- setCommitAuditVisible(false);
|
|
|
- // 更新flow流程图
|
|
|
- dispatch({
|
|
|
- type: 'xflow/queryBoomFlowDetail',
|
|
|
- payload: {
|
|
|
- id: templateId,
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
const getUser = newUser => {
|
|
|
try {
|
|
|
if (JSON.stringify(newUser) != JSON.stringify(userRef.current)) {
|
|
@@ -748,7 +512,15 @@ function Detail(props) {
|
|
|
onChange={e => exportExcl(e.target.files)}
|
|
|
/>
|
|
|
</div>
|
|
|
- <TimeNode flow={flow} isAuditor={isAuditor} onApprove={onApprove}></TimeNode>
|
|
|
+ <TimeNode
|
|
|
+ flow={flow}
|
|
|
+ flowDetail={flowDetail}
|
|
|
+ isAuditor={isAuditor}
|
|
|
+ version={version}
|
|
|
+ templateId={templateId}
|
|
|
+ projectId={projectId}
|
|
|
+ setAuditVisible={setAuditVisible}
|
|
|
+ ></TimeNode>
|
|
|
|
|
|
{/* 判断是否为比对模式 */}
|
|
|
{compareList.length == 2 ? (
|
|
@@ -789,8 +561,6 @@ function Detail(props) {
|
|
|
excelFileList={excelFileList}
|
|
|
version={version}
|
|
|
/>
|
|
|
- {/* <CommentContent title="单元格沟通记录" /> */}
|
|
|
-
|
|
|
<RightDrawer
|
|
|
version={version}
|
|
|
visible={commentVisible}
|
|
@@ -829,23 +599,10 @@ function Detail(props) {
|
|
|
onClose={() => setAuditVisible(false)}
|
|
|
onOk={onAudit}
|
|
|
/>
|
|
|
- {/* <FilesModal
|
|
|
- projectId={projectId}
|
|
|
- typeOptions={typeOptions}
|
|
|
- // loading={getFilesLoading()}
|
|
|
- visible={fileVisible}
|
|
|
- onClose={() => setFileVisible(false)}
|
|
|
- queryFiles={queryFiles}
|
|
|
- // uploadProps={getUploadProps()}
|
|
|
- DeleteFile={deleteFile}
|
|
|
- downloadFile={downloadFile}
|
|
|
- data={fileList}
|
|
|
- /> */}
|
|
|
<VersionModal
|
|
|
typeOptions={typeOptions}
|
|
|
visible={versionVisible}
|
|
|
flowDetail={flowDetail}
|
|
|
- sheetRef={sheetRef}
|
|
|
versionList={versionList}
|
|
|
version={version}
|
|
|
onClose={() => setVersionVisible(false)}
|
|
@@ -853,13 +610,11 @@ function Detail(props) {
|
|
|
loading={getLoading()}
|
|
|
/>
|
|
|
<CommitAuditModal
|
|
|
- uploadProps={getUploadProps()}
|
|
|
- loading={getFilesLoading()}
|
|
|
visible={commitAuditVisible}
|
|
|
version={version}
|
|
|
onClose={() => setCommitAuditVisible(false)}
|
|
|
- onOk={onSubmitNextNode}
|
|
|
luckysheet={sheetRef}
|
|
|
+ templateId={templateId}
|
|
|
/>
|
|
|
</div>
|
|
|
);
|