|
@@ -1,16 +1,36 @@
|
|
|
import React, { useEffect, useState, useRef, useMemo, memo } from 'react';
|
|
|
-import { Modal, Input, Select, List, Row, Col, Table, message, Steps, Space, Button, Popover, Cascader, AutoComplete } from 'antd';
|
|
|
+import {
|
|
|
+ Modal,
|
|
|
+ Input,
|
|
|
+ Select,
|
|
|
+ List,
|
|
|
+ Row,
|
|
|
+ Col,
|
|
|
+ Table,
|
|
|
+ message,
|
|
|
+ Steps,
|
|
|
+ Space,
|
|
|
+ Button,
|
|
|
+ Popover,
|
|
|
+ Cascader,
|
|
|
+ AutoComplete,
|
|
|
+} from 'antd';
|
|
|
import Flow from '@/components/Flow/index';
|
|
|
import { connect } from 'dva';
|
|
|
import { GetTokenFromUrl, getToken } from '@/utils/utils';
|
|
|
import { MODELS, useXFlowApp, useModelAsync } from '@antv/xflow';
|
|
|
import { CheckOutlined } from '@ant-design/icons';
|
|
|
-import { queryDelPurchaseExcel, queryDingInstanceDetail, queryRecordSheet, queryVserionByNode } from '@/services/boom';
|
|
|
+import {
|
|
|
+ queryDelPurchaseExcel,
|
|
|
+ queryDingInstanceDetail,
|
|
|
+ queryRecordSheet,
|
|
|
+ queryVserionByNode,
|
|
|
+} from '@/services/boom';
|
|
|
import { async } from '@antv/x6/lib/registry/marker/async';
|
|
|
import VersionModal from './VersionModal';
|
|
|
import AuditFlow from './AuditFlow';
|
|
|
|
|
|
-const { Option }=Select
|
|
|
+const { Option } = Select;
|
|
|
const { Step } = Steps;
|
|
|
|
|
|
const { TextArea } = Input;
|
|
@@ -18,13 +38,13 @@ const localData = JSON.parse(localStorage.ggDetaiData || '{}');
|
|
|
const PAGE_SIZE = 8;
|
|
|
|
|
|
// 提交
|
|
|
-function FlowModal (props) {
|
|
|
+function FlowModal(props) {
|
|
|
let token = getToken();
|
|
|
const SELECT_TYPE = {
|
|
|
NAME: '0',
|
|
|
TYPE: '1',
|
|
|
CREATOR: '2',
|
|
|
- }
|
|
|
+ };
|
|
|
const {
|
|
|
visible,
|
|
|
version,
|
|
@@ -39,16 +59,16 @@ function FlowModal (props) {
|
|
|
onCommit,
|
|
|
currentUser,
|
|
|
typeOptions,
|
|
|
- userList
|
|
|
+ userList,
|
|
|
} = props;
|
|
|
const [data, setData] = useState([]);
|
|
|
- const [showData, setShowData] = useState([])
|
|
|
+ const [showData, setShowData] = useState([]);
|
|
|
const [nodeLoading, setNodeLoading] = useState(false);
|
|
|
const [pageSize, setPageSize] = useState(PAGE_SIZE);
|
|
|
const [stepsData, setStepsData] = useState([]);
|
|
|
const [versionVisible, setVersionVisible] = useState(false);
|
|
|
- const [selectType, setSelectType] = useState(SELECT_TYPE.NAME)
|
|
|
- const [inputValue, setInputValue] = useState('')
|
|
|
+ const [selectType, setSelectType] = useState(SELECT_TYPE.NAME);
|
|
|
+ const [inputValue, setInputValue] = useState('');
|
|
|
|
|
|
const graphData = useMemo(() => {
|
|
|
if (!flowDetail) return;
|
|
@@ -202,7 +222,7 @@ function FlowModal (props) {
|
|
|
return [
|
|
|
{
|
|
|
title: '名称',
|
|
|
- width: '45%',
|
|
|
+ width: '25%',
|
|
|
render: item => (
|
|
|
<span style={{ color: item.audit_status != 0 ? '#9b9b9b' : '' }}>
|
|
|
{item.id == version.id && !item.isParent && (
|
|
@@ -216,18 +236,98 @@ function FlowModal (props) {
|
|
|
},
|
|
|
{
|
|
|
title: '创建人',
|
|
|
- render: item =>(
|
|
|
- <span>{userList.find(cur => cur.ID == item.author)?.CName || '-'}</span>
|
|
|
- )
|
|
|
+ width: '15%',
|
|
|
+ render: item => {
|
|
|
+ return (
|
|
|
+ item.isParent && (
|
|
|
+ <span>{userList.find(cur => cur.ID == item.author)?.CName || '-'}</span>
|
|
|
+ )
|
|
|
+ );
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
title: '分类',
|
|
|
- width:'25%',
|
|
|
- render: item => (
|
|
|
- <span>
|
|
|
- {typeOptions.find(cur=>cur.id == item.classify_id)?.name}
|
|
|
- </span>
|
|
|
- )
|
|
|
+ width: '15%',
|
|
|
+ render: item => {
|
|
|
+ return (
|
|
|
+ item.isParent && (
|
|
|
+ <span>{typeOptions.find(cur => cur.id == item.classify_id)?.name}</span>
|
|
|
+ )
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '状态',
|
|
|
+ width: '15%',
|
|
|
+ render: item => {
|
|
|
+ if (!item.flow_id && item.isParent) return;
|
|
|
+ let style = { color: getColor(item) };
|
|
|
+ let txt = '';
|
|
|
+ let dom = '';
|
|
|
+ switch (item.audit_status) {
|
|
|
+ case 0:
|
|
|
+ txt = '未提交';
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ txt = '待审批';
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ txt = '已拒绝';
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ txt = '已通过';
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ txt = '已提交';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (item.status == 1) txt = '已失效';
|
|
|
+
|
|
|
+ // 显示拒绝原因
|
|
|
+ if (item.audit_comment) {
|
|
|
+ dom = (
|
|
|
+ <Popover content={item.audit_comment} title="原因">
|
|
|
+ {txt}
|
|
|
+ </Popover>
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ dom = txt;
|
|
|
+ }
|
|
|
+ return item.audit_status != 0 ? (
|
|
|
+ <Button onClick={() => onDelVersion(item)}>{dom}</Button>
|
|
|
+ ) : (
|
|
|
+ <span style={style}>{dom}</span>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ width: '20%',
|
|
|
+ render: item =>
|
|
|
+ (item.flow_id || !item.isParent) &&
|
|
|
+ item.id != version.id && (
|
|
|
+ <Space>
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ console.log(item);
|
|
|
+ onChangeVersion(item);
|
|
|
+ onClose();
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 加载
|
|
|
+ </a>
|
|
|
+ {item.audit_status == 0 &&
|
|
|
+ item.author == currentUser.ID && ( //自己创建的&&未提交的清单自己可以删除
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ onDelVersion({ excel_id: item.id });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </a>
|
|
|
+ )}
|
|
|
+ </Space>
|
|
|
+ ),
|
|
|
},
|
|
|
];
|
|
|
}, [version]);
|
|
@@ -276,9 +376,13 @@ function FlowModal (props) {
|
|
|
|
|
|
// 显示拒绝原因
|
|
|
if (item.audit_comment) {
|
|
|
- dom = <Popover content={item.audit_comment} title="原因">{txt}</Popover>
|
|
|
+ dom = (
|
|
|
+ <Popover content={item.audit_comment} title="原因">
|
|
|
+ {txt}
|
|
|
+ </Popover>
|
|
|
+ );
|
|
|
} else {
|
|
|
- dom = txt
|
|
|
+ dom = txt;
|
|
|
}
|
|
|
return item.audit_status != 0 ? (
|
|
|
<Button onClick={() => onDelVersion(item)}>{dom}</Button>
|
|
@@ -303,46 +407,48 @@ function FlowModal (props) {
|
|
|
>
|
|
|
加载
|
|
|
</a>
|
|
|
- {item.audit_status == 0 && item.author == currentUser.ID && //自己创建的&&未提交的清单自己可以删除
|
|
|
- (<a
|
|
|
- onClick={() => {onDelVersion({excel_id:item.id})}}
|
|
|
- >
|
|
|
- 删除
|
|
|
- </a>
|
|
|
- )}
|
|
|
+ {item.audit_status == 0 &&
|
|
|
+ item.author == currentUser.ID && ( //自己创建的&&未提交的清单自己可以删除
|
|
|
+ <a
|
|
|
+ onClick={() => {
|
|
|
+ onDelVersion({ excel_id: item.id });
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </a>
|
|
|
+ )}
|
|
|
</Space>
|
|
|
-
|
|
|
),
|
|
|
},
|
|
|
];
|
|
|
}, [version]);
|
|
|
|
|
|
- const onChange = (value) => {
|
|
|
+ const onChange = value => {
|
|
|
updateSteps([]);
|
|
|
};
|
|
|
|
|
|
useEffect(() => {
|
|
|
- if(!inputValue){
|
|
|
+ if (!inputValue) {
|
|
|
setShowData(data);
|
|
|
return;
|
|
|
}
|
|
|
let resultData = [...data];
|
|
|
switch (selectType) {
|
|
|
case SELECT_TYPE.NAME:
|
|
|
- resultData = data.filter(item=>item.version_name.includes(inputValue))
|
|
|
+ resultData = data.filter(item => item.version_name.includes(inputValue));
|
|
|
break;
|
|
|
case SELECT_TYPE.TYPE:
|
|
|
- const classify = typeOptions.find(item => item.name.includes(inputValue))
|
|
|
+ const classify = typeOptions.find(item => item.name.includes(inputValue));
|
|
|
if (classify) {
|
|
|
- resultData = data.filter(item=>item.classify_id ==classify.id )
|
|
|
+ resultData = data.filter(item => item.classify_id == classify.id);
|
|
|
}
|
|
|
break;
|
|
|
case SELECT_TYPE.CREATOR:
|
|
|
- resultData = data.filter(item=>item.AuthorInfo?.CName.includes(inputValue))
|
|
|
+ resultData = data.filter(item => item.AuthorInfo?.CName.includes(inputValue));
|
|
|
break;
|
|
|
}
|
|
|
- setShowData(resultData)
|
|
|
- }, [inputValue, data])
|
|
|
+ setShowData(resultData);
|
|
|
+ }, [inputValue, data]);
|
|
|
|
|
|
return (
|
|
|
<>
|
|
@@ -372,44 +478,49 @@ function FlowModal (props) {
|
|
|
</Button>
|
|
|
)}
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<div style={{ display: 'flex' }}>
|
|
|
<Select
|
|
|
defaultValue={selectType}
|
|
|
style={{ width: '30%' }}
|
|
|
- onChange={
|
|
|
- (value) => {
|
|
|
- setSelectType(value);
|
|
|
- setInputValue("");
|
|
|
- }}
|
|
|
+ onChange={value => {
|
|
|
+ setSelectType(value);
|
|
|
+ setInputValue('');
|
|
|
+ }}
|
|
|
>
|
|
|
<Option value={SELECT_TYPE.NAME}>名称:</Option>
|
|
|
<Option value={SELECT_TYPE.TYPE}>分类:</Option>
|
|
|
<Option value={SELECT_TYPE.CREATOR}>创建人:</Option>
|
|
|
</Select>
|
|
|
- <Input placeholder='请输入' value={inputValue} onChange={ (e)=> setInputValue(e.target.value)} />
|
|
|
- <Button type='primary' style={{ marginLeft:'10px'}}>搜索</Button>
|
|
|
+ <Input
|
|
|
+ placeholder="请输入"
|
|
|
+ value={inputValue}
|
|
|
+ onChange={e => setInputValue(e.target.value)}
|
|
|
+ />
|
|
|
+ <Button type="primary" style={{ marginLeft: '10px' }}>
|
|
|
+ 搜索
|
|
|
+ </Button>
|
|
|
</div>
|
|
|
- <div style={{ width: '100%', marginTop:'10px' }}>
|
|
|
+ <div style={{ width: '100%', marginTop: '10px' }}>
|
|
|
<Table
|
|
|
style={{ maxHeight: '80%' }}
|
|
|
columns={columns}
|
|
|
dataSource={showData} //data
|
|
|
loading={nodeLoading}
|
|
|
bordered={false}
|
|
|
- pagination={{ position: ['none', 'none'],pageSize: 999, onChange }}
|
|
|
+ pagination={{ position: ['none', 'none'], pageSize: 999, onChange }}
|
|
|
scroll={{ y: 65 * pageSize }}
|
|
|
- childrenColumnName='none'
|
|
|
- expandable={{
|
|
|
- expandedRowRender: (record) => (
|
|
|
- <Table
|
|
|
- columns={childColumns}
|
|
|
- dataSource={record.children}
|
|
|
- pagination={{ position: ['none', 'none'] }}
|
|
|
- />
|
|
|
- ),
|
|
|
- rowExpandable: (record) => record.children?.length > 0,
|
|
|
- }}
|
|
|
+ // childrenColumnName="none"
|
|
|
+ // expandable={{
|
|
|
+ // expandedRowRender: record => (
|
|
|
+ // <Table
|
|
|
+ // columns={columns}
|
|
|
+ // dataSource={record.children}
|
|
|
+ // pagination={{ position: ['none', 'none'] }}
|
|
|
+ // />
|
|
|
+ // ),
|
|
|
+ // rowExpandable: record => record.children?.length > 0,
|
|
|
+ // }}
|
|
|
/>
|
|
|
</div>
|
|
|
{stepsData.map((item, idx) => (
|