|
@@ -1,6 +1,6 @@
|
|
|
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
|
-import { DownOutlined } from '@ant-design/icons';
|
|
|
-import { Button, Modal, message, Alert, Spin, Select, Menu, Dropdown } from 'antd';
|
|
|
+import { UnorderedListOutlined } from '@ant-design/icons';
|
|
|
+import { Button, Modal, message, Alert, Avatar, Spin, Select, Menu, Dropdown } from 'antd';
|
|
|
import { connect } from 'dva';
|
|
|
import styles from './Index.less';
|
|
|
import LuckySheet from './LuckySheet';
|
|
@@ -18,11 +18,10 @@ import FilesModal from './FilesModal';
|
|
|
import VersionModal from './VersionModal';
|
|
|
import CommitAuditModal from './CommitAuditModal';
|
|
|
import { GetTokenFromUrl, getToken } from '@/utils/utils';
|
|
|
-
|
|
|
+import { queryDetail } from '@/services/boom';
|
|
|
const LocalData = localStorage.luckysheet;
|
|
|
|
|
|
const { Option } = Select;
|
|
|
-let cell_position = {};
|
|
|
|
|
|
function Detail(props) {
|
|
|
const {
|
|
@@ -41,7 +40,6 @@ function Detail(props) {
|
|
|
} = props;
|
|
|
// const audit_status = 0
|
|
|
const [commentVisible, setCommentVisible] = useState(false);
|
|
|
- const [historyVisible, setHistoryVisible] = useState(false);
|
|
|
const [compareVisible, setCompareVisible] = useState(false);
|
|
|
const [exportVisible, setExportVisible] = useState(false);
|
|
|
const [commitVisible, setCommitVisible] = useState(false);
|
|
@@ -54,6 +52,7 @@ function Detail(props) {
|
|
|
const [edit, setEdit] = useState(false);
|
|
|
const [isMerge, setIsMerge] = useState(false);
|
|
|
const [version, setVersion] = useState({});
|
|
|
+ const [user, setUser] = useState([]);
|
|
|
const [updateCount, setUpdateCount] = useState({
|
|
|
diff: 0,
|
|
|
add: 0,
|
|
@@ -64,19 +63,22 @@ function Detail(props) {
|
|
|
// const [lastCommit, setLastCommit] = useState({ data: [] });
|
|
|
const sheetRef = useRef();
|
|
|
const sheetRef2 = useRef();
|
|
|
+ const sheetRef3 = useRef();
|
|
|
const fileRef = useRef();
|
|
|
const statusRef = useRef({
|
|
|
edit: false,
|
|
|
compare: false,
|
|
|
});
|
|
|
- const audit_status = version.audit_status;
|
|
|
+ const cellPosition = useRef({});
|
|
|
|
|
|
- const excelId = parseInt(params.excelId);
|
|
|
+ // const [excelId, setExcelId] = useState(parseInt(params.excelId));
|
|
|
+ // const excelId = parseInt(params.excelId);
|
|
|
const projectId = parseInt(params.projectId);
|
|
|
|
|
|
const flow = useMemo(() => {
|
|
|
let data = {
|
|
|
active: 0,
|
|
|
+ active_id: null,
|
|
|
current: 0,
|
|
|
currentNode: {},
|
|
|
list: {
|
|
@@ -86,14 +88,25 @@ function Detail(props) {
|
|
|
if (version?.flow_id && auditList?.length > 0) {
|
|
|
let item = auditList.find(item => item.list.id == version.flow_id);
|
|
|
if (!item) return data;
|
|
|
- item.current = item.list.FlowNodes.findIndex(node => node.id == item.active);
|
|
|
- item.current = item.current == -1 ? 0 : item.current;
|
|
|
+ // 合并同审批级别项
|
|
|
+ let nodes = {};
|
|
|
+ item.list.FlowNodes.map(item => {
|
|
|
+ if (!nodes[item.seq]) nodes[item.seq] = { ...item, user: [] };
|
|
|
+ nodes[item.seq].user.push(item.AuditorUser);
|
|
|
+ });
|
|
|
+ item.list.FlowNodes = Object.values(nodes);
|
|
|
+ // 查询当前节点
|
|
|
+ let current = item.list.FlowNodes.findIndex(node => node.seq == item.active);
|
|
|
+ item.current = current == -1 ? 0 : current;
|
|
|
+ // 保存当前所处节点
|
|
|
item.currentNode = item.list.FlowNodes[item.current];
|
|
|
data = item;
|
|
|
}
|
|
|
|
|
|
return data;
|
|
|
}, [auditList, version]);
|
|
|
+ const audit_status = flow.active_audit;
|
|
|
+ // const audit_status = 1;
|
|
|
|
|
|
const onSave = () => {
|
|
|
setEdit(false);
|
|
@@ -103,7 +116,7 @@ function Detail(props) {
|
|
|
console.log(jsonData);
|
|
|
let newExcl = {
|
|
|
...sheet,
|
|
|
- excel_id: excelId,
|
|
|
+ excel_id: version.id,
|
|
|
title: '',
|
|
|
data: jsonData.data,
|
|
|
};
|
|
@@ -113,11 +126,20 @@ function Detail(props) {
|
|
|
|
|
|
const onCompare = async checkSheets => {
|
|
|
if (checkSheets) {
|
|
|
- if (!checkSheets[0].data) {
|
|
|
- checkSheets[0].data = await queryHistoryDetail(checkSheets[0]);
|
|
|
+ const [sheet1, sheet2] = checkSheets;
|
|
|
+ if (!sheet1.data) {
|
|
|
+ sheet1.data = (
|
|
|
+ await queryDetail({
|
|
|
+ excel_id: sheet1.id,
|
|
|
+ })
|
|
|
+ ).data;
|
|
|
}
|
|
|
- if (!checkSheets[1].data) {
|
|
|
- checkSheets[1].data = await queryHistoryDetail(checkSheets[1]);
|
|
|
+ if (!sheet2.data) {
|
|
|
+ sheet2.data = (
|
|
|
+ await queryDetail({
|
|
|
+ excel_id: sheet2.id,
|
|
|
+ })
|
|
|
+ ).data;
|
|
|
}
|
|
|
|
|
|
setCompareList(checkSheets);
|
|
@@ -126,7 +148,7 @@ function Detail(props) {
|
|
|
let index = compareList.findIndex(item => item.id == sheet.id);
|
|
|
// 退出比对模式
|
|
|
if (index == 0) {
|
|
|
- sheetRef.current.toggleCompare(false);
|
|
|
+ sheetRef3.current.toggleCompare(false);
|
|
|
} else if (index == 1) {
|
|
|
sheetRef2.current.toggleCompare(false);
|
|
|
}
|
|
@@ -145,16 +167,16 @@ function Detail(props) {
|
|
|
setCommentVisible(false);
|
|
|
};
|
|
|
|
|
|
- const exportSheet = async item => {
|
|
|
- console.log(item);
|
|
|
- var sheets = await queryHistoryDetail(item);
|
|
|
- sheets.id = sheets.sheet_id;
|
|
|
- setSheet({
|
|
|
- ...item,
|
|
|
- name: item.version_name,
|
|
|
- data: sheets,
|
|
|
- });
|
|
|
- };
|
|
|
+ // const exportSheet = async item => {
|
|
|
+ // console.log(item);
|
|
|
+ // var sheets = await queryHistoryDetail(item);
|
|
|
+ // sheets.id = sheets.sheet_id;
|
|
|
+ // setSheet({
|
|
|
+ // ...item,
|
|
|
+ // name: item.version_name,
|
|
|
+ // data: sheets,
|
|
|
+ // });
|
|
|
+ // };
|
|
|
|
|
|
const renderSheetDom = (item, index) => {
|
|
|
return (
|
|
@@ -165,14 +187,9 @@ function Detail(props) {
|
|
|
</h3>
|
|
|
<LuckySheet
|
|
|
className={styles.sheet}
|
|
|
- ref={!index ? sheetRef : sheetRef2}
|
|
|
+ ref={!index ? sheetRef3 : sheetRef2}
|
|
|
data={item.data || null}
|
|
|
onClickCell={onClickCell}
|
|
|
- onLoad={() => {
|
|
|
- if (compareList.length == 0) {
|
|
|
- sheetRef.current.renderSheet(item.data);
|
|
|
- }
|
|
|
- }}
|
|
|
/>
|
|
|
</div>
|
|
|
);
|
|
@@ -183,31 +200,36 @@ function Detail(props) {
|
|
|
if (cell?.cid && !statusRef.current.edit) {
|
|
|
let payload = {
|
|
|
sheet_id: s.order || '0',
|
|
|
- excel_id: excelId,
|
|
|
+ excel_id: version.id,
|
|
|
cid: cell.cid,
|
|
|
};
|
|
|
dispatch({
|
|
|
type: 'detail/queryComment',
|
|
|
payload,
|
|
|
});
|
|
|
- cell_position = {
|
|
|
+ cellPosition.current = {
|
|
|
...payload,
|
|
|
sheet_index: (s.seq || 0) + '',
|
|
|
};
|
|
|
setCommentVisible(true);
|
|
|
}
|
|
|
// 比对模式下双excl同步选中
|
|
|
- if (statusRef.current.compare) {
|
|
|
- sheetRef.current.selectCell(position.r, position.c, s.order);
|
|
|
- sheetRef2.current.selectCell(position.r, position.c, s.order);
|
|
|
- }
|
|
|
+ // if (statusRef.current.compare) {
|
|
|
+ // sheetRef3.current.selectCell(position.r, position.c, s.order);
|
|
|
+ // sheetRef2.current.selectCell(position.r, position.c, s.order);
|
|
|
+ // }
|
|
|
};
|
|
|
|
|
|
- const onCommit = (values, new_version) => {
|
|
|
+ const onCommit = (values, id) => {
|
|
|
let currentData = sheetRef.current.getSheetJson().data;
|
|
|
+ let sheets = JSON.parse(JSON.stringify(currentData));
|
|
|
+ sheets.forEach(item => {
|
|
|
+ delete item.data;
|
|
|
+ });
|
|
|
+ console.log(sheets);
|
|
|
let params = {
|
|
|
...values,
|
|
|
- // id: version.id,
|
|
|
+ id: id,
|
|
|
project_id: version.project_id,
|
|
|
name: version.name,
|
|
|
guid: version.guid,
|
|
@@ -216,8 +238,8 @@ function Detail(props) {
|
|
|
template_node_id: version.template_node_id,
|
|
|
flow_id: version.flow_id,
|
|
|
node_id: version.node_id,
|
|
|
- new_version: String(new_version),
|
|
|
- data: JSON.stringify(currentData),
|
|
|
+ new_version: '0',
|
|
|
+ data: JSON.stringify(sheets),
|
|
|
};
|
|
|
dispatch({
|
|
|
type: 'detail/commitSheet',
|
|
@@ -278,11 +300,11 @@ function Detail(props) {
|
|
|
dispatch({
|
|
|
type: 'detail/approve',
|
|
|
payload: {
|
|
|
- id: excelId,
|
|
|
+ id: version.id,
|
|
|
project_id: projectId,
|
|
|
audit_status: 2,
|
|
|
flow_id: flowNode.flow_id,
|
|
|
- node_id: flowNode.id,
|
|
|
+ node_id: flowNode.seq,
|
|
|
audit_comment,
|
|
|
},
|
|
|
callback: () => {
|
|
@@ -302,7 +324,7 @@ function Detail(props) {
|
|
|
dispatch({
|
|
|
type: 'detail/submitAudit',
|
|
|
payload: {
|
|
|
- id: excelId,
|
|
|
+ id: version.id,
|
|
|
flow_id: flowNode.flow_id,
|
|
|
node_id: flowNode.id,
|
|
|
projectId,
|
|
@@ -327,11 +349,21 @@ function Detail(props) {
|
|
|
dispatch({
|
|
|
type: 'detail/approve',
|
|
|
payload: {
|
|
|
- id: excelId,
|
|
|
+ id: flow.active_id,
|
|
|
project_id: projectId,
|
|
|
audit_status: flag ? 3 : 2,
|
|
|
flow_id: flowNode.flow_id,
|
|
|
- node_id: flowNode.id,
|
|
|
+ node_id: flowNode.seq,
|
|
|
+ },
|
|
|
+ callback: newVersion => {
|
|
|
+ if (flow.current == flow.list.FlowNodes.length - 1) {
|
|
|
+ // 最后一个审核节点通过后 需要更新version id
|
|
|
+ localStorage.excelId = newVersion.id;
|
|
|
+ setVersion({
|
|
|
+ ...version,
|
|
|
+ id: newVersion.id,
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
});
|
|
|
},
|
|
@@ -411,15 +443,17 @@ function Detail(props) {
|
|
|
};
|
|
|
|
|
|
const getUserRole = () => {
|
|
|
- if (currentUser.ID == flow.currentNode?.auditor) return true;
|
|
|
- let roleId = Number(flow.currentNode?.audit_role);
|
|
|
- console.log(roleId);
|
|
|
- if (roleId) {
|
|
|
- let role = roleList.find(item => item.ID == roleId);
|
|
|
- if (role) {
|
|
|
- return role.User.find(item => item.ID == currentUser.ID);
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (currentUser.ID == flow.currentNode?.auditor) return true;
|
|
|
+ let item = flow.currentNode?.user?.find?.(item => item.ID == currentUser.ID);
|
|
|
+ if (item) return true;
|
|
|
+ // let roleId = Number(flow.currentNode?.audit_role);
|
|
|
+ // console.log(roleId);
|
|
|
+ // if (roleId) {
|
|
|
+ // let role = roleList.find(item => item.ID == roleId);
|
|
|
+ // if (role) {
|
|
|
+ // return role.User.find(item => item.ID == currentUser.ID);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
return false;
|
|
|
};
|
|
|
|
|
@@ -430,16 +464,24 @@ function Detail(props) {
|
|
|
// 返回
|
|
|
router.push(`/home`);
|
|
|
break;
|
|
|
- case 'version':
|
|
|
- // 版本
|
|
|
- queryHistory();
|
|
|
- setCommentVisible(false);
|
|
|
- setHistoryVisible(true);
|
|
|
- break;
|
|
|
+ // case 'version':
|
|
|
+ // // 版本
|
|
|
+ // queryHistory();
|
|
|
+ // setCommentVisible(false);
|
|
|
+ // setHistoryVisible(true);
|
|
|
+ // break;
|
|
|
case 'export':
|
|
|
// 导出
|
|
|
handleExportClick();
|
|
|
break;
|
|
|
+ case 'commitAudit':
|
|
|
+ // 提交流转
|
|
|
+ setCommitAuditVisible(true);
|
|
|
+ break;
|
|
|
+ case 'flow':
|
|
|
+ // 查看流程
|
|
|
+ setFlowVisible(true);
|
|
|
+ break;
|
|
|
case 'compare':
|
|
|
// 比对
|
|
|
setCompareVisible(true);
|
|
@@ -456,9 +498,9 @@ function Detail(props) {
|
|
|
// // 审核拒绝
|
|
|
// onApprove(false);
|
|
|
// break;
|
|
|
- case 'edit':
|
|
|
- // 编辑
|
|
|
- handleEdit(true);
|
|
|
+ // case 'edit':
|
|
|
+ // // 编辑
|
|
|
+ // handleEdit(true);
|
|
|
case 'merge':
|
|
|
// 同步版本
|
|
|
|
|
@@ -501,7 +543,7 @@ function Detail(props) {
|
|
|
{/* <Button type="success" onClick={() => onMerge()}>
|
|
|
同步新增内容
|
|
|
</Button>*/}
|
|
|
- <Button onClick={() => handleEdit(true)}>编辑</Button>
|
|
|
+ {/* <Button onClick={() => handleEdit(true)}>编辑</Button> */}
|
|
|
<Button onClick={() => setCommitVisible(true)}>确认提交</Button>
|
|
|
<Button onClick={() => onCompare(false)}>取消比对</Button>
|
|
|
</>
|
|
@@ -515,13 +557,15 @@ function Detail(props) {
|
|
|
const menuList = [
|
|
|
<Menu.Item key="back">返回</Menu.Item>,
|
|
|
<Menu.Item key="export">导出</Menu.Item>,
|
|
|
+ <Menu.Item key="commitAudit">提交流转</Menu.Item>,
|
|
|
+ <Menu.Item key="flow">查看流程</Menu.Item>,
|
|
|
<Menu.Item key="compare">比对</Menu.Item>,
|
|
|
<Menu.Item key="attachment">附件</Menu.Item>,
|
|
|
];
|
|
|
- if (audit_status != 1) {
|
|
|
- menuList.push(<Menu.Item key="version">历史提交</Menu.Item>);
|
|
|
- // menuList.push(<Menu.Item key="template">模板</Menu.Item>);
|
|
|
- }
|
|
|
+ // if (audit_status != 1) {
|
|
|
+ // menuList.push(<Menu.Item key="version">历史提交</Menu.Item>);
|
|
|
+ // // menuList.push(<Menu.Item key="template">模板</Menu.Item>);
|
|
|
+ // }
|
|
|
if (!isAuditor && canEdit()) {
|
|
|
menuList.push(<Menu.Item key="edit">编辑</Menu.Item>);
|
|
|
menuList.push(<Menu.Item key="merge">合并</Menu.Item>);
|
|
@@ -543,9 +587,10 @@ function Detail(props) {
|
|
|
</>
|
|
|
)}
|
|
|
<Dropdown overlay={<Menu onClick={handleMenuClick}>{menuList}</Menu>}>
|
|
|
- <Button type="primary">
|
|
|
+ {/* <Button type="primary">
|
|
|
其他操作 <DownOutlined />
|
|
|
- </Button>
|
|
|
+ </Button> */}
|
|
|
+ <UnorderedListOutlined style={{ fontSize: 30, cursor: 'pointer' }} />
|
|
|
</Dropdown>
|
|
|
</>
|
|
|
);
|
|
@@ -558,13 +603,15 @@ function Detail(props) {
|
|
|
|
|
|
const renderAlert = () => {
|
|
|
const audit_comment = history.list[0]?.audit_comment;
|
|
|
+ let item = '';
|
|
|
switch (audit_status) {
|
|
|
case 0:
|
|
|
return;
|
|
|
case 1:
|
|
|
- return <Alert message="等待审核中" type="info" />;
|
|
|
+ item = <Alert message="等待审核中" type="info" />;
|
|
|
+ break;
|
|
|
case 2:
|
|
|
- return (
|
|
|
+ item = (
|
|
|
<Alert
|
|
|
message={`审批被拒绝${
|
|
|
audit_comment ? `,拒绝原因:${audit_comment}` : ''
|
|
@@ -572,9 +619,13 @@ function Detail(props) {
|
|
|
type="error"
|
|
|
/>
|
|
|
);
|
|
|
+ break;
|
|
|
case 3:
|
|
|
- return <Alert message="审批通过" type="success" />;
|
|
|
+ item = <Alert message="审批通过" type="success" />;
|
|
|
+ break;
|
|
|
}
|
|
|
+
|
|
|
+ return <div style={{ marginTop: 20 }}>{item}</div>;
|
|
|
};
|
|
|
|
|
|
const exportExcl = files => {
|
|
@@ -604,17 +655,6 @@ function Detail(props) {
|
|
|
setExportVisible(false);
|
|
|
};
|
|
|
|
|
|
- const addComment = (data, callback) => {
|
|
|
- dispatch({
|
|
|
- type: 'detail/addComment',
|
|
|
- payload: {
|
|
|
- ...cell_position,
|
|
|
- comment: data,
|
|
|
- },
|
|
|
- callback,
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
const queryHistory = id => {
|
|
|
return new Promise(reslove => {
|
|
|
dispatch({
|
|
@@ -633,7 +673,7 @@ function Detail(props) {
|
|
|
type: 'detail/queryFiles',
|
|
|
payload: {
|
|
|
// excel_id: id || excelId,
|
|
|
- excel_id: excelId,
|
|
|
+ excel_id: version.id,
|
|
|
},
|
|
|
});
|
|
|
};
|
|
@@ -642,7 +682,7 @@ function Detail(props) {
|
|
|
const uploadProps = {
|
|
|
name: 'file',
|
|
|
showUploadList: false,
|
|
|
- action: `/api/v1/purchase/attachment/${excelId}`,
|
|
|
+ action: `/api/v1/purchase/attachment/${version.id}`,
|
|
|
headers: {
|
|
|
'JWT-TOKEN': token,
|
|
|
},
|
|
@@ -702,41 +742,45 @@ function Detail(props) {
|
|
|
|
|
|
const changeVersion = id => {
|
|
|
let version = versionList.find(item => item.id == id);
|
|
|
- if (!version) return message.error('版本不存在!');
|
|
|
+ if (!version) return;
|
|
|
+ localStorage.excelId = id;
|
|
|
setVersion(version);
|
|
|
|
|
|
// 查询excel内容
|
|
|
- dispatch({
|
|
|
- type: 'detail/queryRecord',
|
|
|
- payload: {
|
|
|
- project_id: projectId,
|
|
|
- template_id: version.template_id,
|
|
|
- template_node_id: version.template_node_id,
|
|
|
- version_id: version.id,
|
|
|
- },
|
|
|
- callback: sheets => {
|
|
|
- console.log(sheets);
|
|
|
- setSheet(sheets);
|
|
|
- sheetRef.current.renderSheet(sheets.data);
|
|
|
- },
|
|
|
- });
|
|
|
+ // dispatch({
|
|
|
+ // type: 'detail/queryRecord',
|
|
|
+ // payload: {
|
|
|
+ // project_id: projectId,
|
|
|
+ // template_id: version.template_id,
|
|
|
+ // template_node_id: version.template_node_id,
|
|
|
+ // version_id: version.id,
|
|
|
+ // },
|
|
|
+ // callback: sheets => {
|
|
|
+ // console.log(sheets);
|
|
|
+ // setSheet(sheets);
|
|
|
+ // // sheetRef.current.renderSheet(sheets.data);
|
|
|
+ // },
|
|
|
+ // });
|
|
|
|
|
|
- // 查询历史修改
|
|
|
- dispatch({
|
|
|
- type: 'detail/queryHistoryList',
|
|
|
- payload: {
|
|
|
- version_id: version.id,
|
|
|
- },
|
|
|
- });
|
|
|
- // 判断是否审批节点
|
|
|
+ // // 查询历史修改
|
|
|
// dispatch({
|
|
|
- // type: 'detail/queryAuditList',
|
|
|
+ // type: 'detail/queryHistoryList',
|
|
|
// payload: {
|
|
|
- // template_id: version.template_id ,
|
|
|
- // template_node_id: version.template_node_id ,
|
|
|
- // flow_id: version.flow_id
|
|
|
- // }
|
|
|
- // })
|
|
|
+ // version_id: version.id,
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // 判断是否审批节点
|
|
|
+ if (version.flow_id) {
|
|
|
+ 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.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
const onSubmitNextNode = values => {
|
|
@@ -749,6 +793,10 @@ function Detail(props) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ const getUser = user => {
|
|
|
+ setUser(user);
|
|
|
+ };
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
dispatch({
|
|
|
type: 'detail/queryProjectRecord',
|
|
@@ -763,9 +811,9 @@ function Detail(props) {
|
|
|
},
|
|
|
});
|
|
|
// 审批流程
|
|
|
- dispatch({
|
|
|
- type: 'detail/queryAuditList',
|
|
|
- });
|
|
|
+ // dispatch({
|
|
|
+ // type: 'detail/queryAuditList',
|
|
|
+ // });
|
|
|
// 查询节点
|
|
|
// dispatch({
|
|
|
// type: 'detail/queryFlowInfo',
|
|
@@ -814,7 +862,7 @@ function Detail(props) {
|
|
|
};
|
|
|
});
|
|
|
};
|
|
|
- var update1 = sheetRef.current.toggleCompare(true, compareList[1].data, callback);
|
|
|
+ var update1 = sheetRef3.current.toggleCompare(true, compareList[1].data, callback);
|
|
|
var update2 = sheetRef2.current.toggleCompare(true, compareList[0].data, callback);
|
|
|
}
|
|
|
}, [compareList]);
|
|
@@ -822,45 +870,47 @@ function Detail(props) {
|
|
|
useEffect(() => {
|
|
|
if (versionList.length == 0) return;
|
|
|
if (!version.id) {
|
|
|
+ const excelId = localStorage.excelId;
|
|
|
changeVersion(excelId);
|
|
|
} else {
|
|
|
changeVersion(version.id);
|
|
|
}
|
|
|
+ // else if (version.id != params.excelId) {
|
|
|
+ // changeVersion(version.id);
|
|
|
+ // }
|
|
|
}, [versionList]);
|
|
|
|
|
|
return (
|
|
|
<Spin spinning={false}>
|
|
|
{/* <Spin spinning={getLoading()}> */}
|
|
|
- <Button type="primary" onClick={() => setFlowVisible(true)}>
|
|
|
- 查看流程
|
|
|
- </Button>
|
|
|
+
|
|
|
<div className={styles.top}>
|
|
|
- <div>
|
|
|
+ <div style={{ minWidth: 700, marginTop: 20 }}>
|
|
|
{/* 当前节点: {version.template_node_id}
|
|
|
<br />
|
|
|
当前状态:{version.audit_status} */}
|
|
|
- {flow.active !== 0 && <TimeNode flow={flow}></TimeNode>}
|
|
|
- </div>
|
|
|
- <div className={styles.btns}>
|
|
|
- {renderBtns()}
|
|
|
- <Button type="primary" onClick={() => setCommitAuditVisible(true)}>
|
|
|
- 提交流转
|
|
|
- </Button>
|
|
|
- <Button type="primary" onClick={() => setVersionVisible(true)}>
|
|
|
- 创建版本
|
|
|
- </Button>
|
|
|
- <Select style={{ width: 140 }} value={version.id} onChange={changeVersion}>
|
|
|
+ <TimeNode nodeId={version.template_node_id} flow={flow}></TimeNode>
|
|
|
+ <Select
|
|
|
+ style={{ width: 140, marginLeft: 10 }}
|
|
|
+ value={version.id}
|
|
|
+ onChange={changeVersion}
|
|
|
+ >
|
|
|
{versionList.map(item => (
|
|
|
<Option value={item.id} key={item.id}>
|
|
|
{item.version_name}
|
|
|
</Option>
|
|
|
))}
|
|
|
</Select>
|
|
|
+ <Button type="primary" onClick={() => setVersionVisible(true)}>
|
|
|
+ 创建版本
|
|
|
+ </Button>
|
|
|
+ </div>
|
|
|
+ <div className={styles.btns}>
|
|
|
+ {user.map(item => (
|
|
|
+ <Avatar size="large">{item.Name}</Avatar>
|
|
|
+ ))}
|
|
|
+ {renderBtns()}
|
|
|
</div>
|
|
|
- {/*
|
|
|
-
|
|
|
- <div className={styles.btns}>{renderBtns()}</div>
|
|
|
- */}
|
|
|
<input
|
|
|
type="file"
|
|
|
ref={fileRef}
|
|
@@ -868,7 +918,7 @@ function Detail(props) {
|
|
|
onChange={e => exportExcl(e.target.files)}
|
|
|
/>
|
|
|
</div>
|
|
|
- <div style={{ marginTop: 20 }}>{renderAlert()}</div>
|
|
|
+ {renderAlert()}
|
|
|
{/* 判断是否为比对模式 */}
|
|
|
{compareList.length == 2 ? (
|
|
|
<>
|
|
@@ -879,23 +929,32 @@ function Detail(props) {
|
|
|
<div className={styles.sheetBox}>{compareList.map(renderSheetDom)}</div>
|
|
|
</>
|
|
|
) : (
|
|
|
- <div className={styles.sheetBox}>{renderSheetDom(sheet)}</div>
|
|
|
+ <div className={styles.sheetBox}>
|
|
|
+ {version.id && (
|
|
|
+ <LuckySheet
|
|
|
+ className={styles.sheet}
|
|
|
+ ref={sheetRef}
|
|
|
+ onClickCell={onClickCell}
|
|
|
+ version={version}
|
|
|
+ getUser={getUser}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
)}
|
|
|
|
|
|
<RightDrawer
|
|
|
- list={comment?.list || []}
|
|
|
+ version={version}
|
|
|
visible={commentVisible}
|
|
|
- addComment={addComment}
|
|
|
- loading={loading.effects['detail/queryComment'] || loading.effects['detail/addComment']}
|
|
|
onClose={() => setCommentVisible(false)}
|
|
|
+ cellPosition={cellPosition}
|
|
|
/>
|
|
|
- <HistoryModal
|
|
|
+ {/* <HistoryModal
|
|
|
visible={historyVisible}
|
|
|
version={version}
|
|
|
// onChange={queryHistory}
|
|
|
onClose={() => setHistoryVisible(false)}
|
|
|
onSelect={item => exportSheet(item)}
|
|
|
- />
|
|
|
+ /> */}
|
|
|
<CompareModal
|
|
|
visible={compareVisible}
|
|
|
version={version}
|
|
@@ -918,6 +977,7 @@ function Detail(props) {
|
|
|
<FlowModal
|
|
|
visible={flowVisible}
|
|
|
onClose={() => setFlowVisible(false)}
|
|
|
+ version={version}
|
|
|
// onOk={onCommit}
|
|
|
onChangeVersion={version => changeVersion(version.id)}
|
|
|
/>
|
|
@@ -940,7 +1000,7 @@ function Detail(props) {
|
|
|
loading={getLoading()}
|
|
|
visible={versionVisible}
|
|
|
onClose={() => setVersionVisible(false)}
|
|
|
- onOk={values => onCommit(values, 0)}
|
|
|
+ onOk={values => onCommit(values)}
|
|
|
/>
|
|
|
<CommitAuditModal
|
|
|
loading={getLoading()}
|
|
@@ -961,7 +1021,6 @@ export default connect(({ detail, user, loading }) => ({
|
|
|
comment: detail.comment,
|
|
|
currentUser: user.currentUser,
|
|
|
roleList: detail.roleList,
|
|
|
- version: detail.version,
|
|
|
versionList: detail.versionList,
|
|
|
loading,
|
|
|
}))(Detail);
|