|
@@ -10,11 +10,15 @@ import { useRequest, useNavigate } from '@umijs/max';
|
|
import { Table, Button, message, Space, Select, Input } from 'antd';
|
|
import { Table, Button, message, Space, Select, Input } from 'antd';
|
|
import CreateModal from './components/CreateModal';
|
|
import CreateModal from './components/CreateModal';
|
|
import { createAduit } from '@/services/boom';
|
|
import { createAduit } from '@/services/boom';
|
|
|
|
+import CreateChildrenModal from './components/CreateChildrenModal';
|
|
|
|
+import { queryCreateCadVer } from '../../services/cad';
|
|
|
|
|
|
const CadDemo = () => {
|
|
const CadDemo = () => {
|
|
let navigate = useNavigate();
|
|
let navigate = useNavigate();
|
|
const [createLoading, setCreateLoading] = useState(false);
|
|
const [createLoading, setCreateLoading] = useState(false);
|
|
const [visible, setVisible] = useState(false);
|
|
const [visible, setVisible] = useState(false);
|
|
|
|
+ const [childrenVisible, setChildrenVisible] = useState(false);
|
|
|
|
+ const [parentId, setParentId] = useState();
|
|
const [params, setParams] = useState({
|
|
const [params, setParams] = useState({
|
|
// project_name: '',
|
|
// project_name: '',
|
|
// name: '',
|
|
// name: '',
|
|
@@ -39,49 +43,58 @@ const CadDemo = () => {
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '状态',
|
|
title: '状态',
|
|
- dataIndex: 'status',
|
|
|
|
- key: 'status',
|
|
|
|
|
|
+ // dataIndex: 'cad_status',
|
|
|
|
+ // key: 'cad_status',
|
|
width: 100,
|
|
width: 100,
|
|
- render: (status) => {
|
|
|
|
|
|
+ render: (record) => {
|
|
let str = '';
|
|
let str = '';
|
|
let color = 'black';
|
|
let color = 'black';
|
|
- switch (status) {
|
|
|
|
|
|
+ switch (record.cad_status) {
|
|
case 1:
|
|
case 1:
|
|
- str = '待审核';
|
|
|
|
- color = 'blue';
|
|
|
|
|
|
+ str = '已归档';
|
|
|
|
+ color = 'green';
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
- str = '审核通过';
|
|
|
|
- color = 'red';
|
|
|
|
- break;
|
|
|
|
- case 3:
|
|
|
|
str = '审核拒绝';
|
|
str = '审核拒绝';
|
|
- color = 'green';
|
|
|
|
|
|
+ color = 'red';
|
|
break;
|
|
break;
|
|
|
|
+ case 0:
|
|
|
|
+ str = '待审核';
|
|
|
|
+ color = 'blue';
|
|
}
|
|
}
|
|
- return <div style={{ color }}>{str}</div>;
|
|
|
|
|
|
+ return record.parent_id ? <div style={{ color }}>{str}</div> : '';
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: '操作',
|
|
title: '操作',
|
|
width: '10%',
|
|
width: '10%',
|
|
render: (record) => {
|
|
render: (record) => {
|
|
- return record.canShow ? (
|
|
|
|
|
|
+ return (
|
|
<Space>
|
|
<Space>
|
|
- <a
|
|
|
|
- onClick={() =>
|
|
|
|
- navigate('/cad/detail', {
|
|
|
|
- state: {
|
|
|
|
- path: record.name,
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- >
|
|
|
|
- 查看
|
|
|
|
- </a>
|
|
|
|
|
|
+ {record.canShow && (
|
|
|
|
+ <a
|
|
|
|
+ onClick={() =>
|
|
|
|
+ navigate('/cad/detail', {
|
|
|
|
+ state: {
|
|
|
|
+ path: record.name,
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ >
|
|
|
|
+ 查看
|
|
|
|
+ </a>
|
|
|
|
+ )}
|
|
|
|
+ {record.showCreate && (
|
|
|
|
+ <a
|
|
|
|
+ onClick={() => {
|
|
|
|
+ setParentId(record.id);
|
|
|
|
+ setChildrenVisible(true);
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ 新建
|
|
|
|
+ </a>
|
|
|
|
+ )}
|
|
</Space>
|
|
</Space>
|
|
- ) : (
|
|
|
|
- ''
|
|
|
|
);
|
|
);
|
|
},
|
|
},
|
|
},
|
|
},
|
|
@@ -99,9 +112,6 @@ const CadDemo = () => {
|
|
const { data: dirList } = useRequest(queryCadDirList, {
|
|
const { data: dirList } = useRequest(queryCadDirList, {
|
|
formatResult: (res) => {
|
|
formatResult: (res) => {
|
|
return res.data;
|
|
return res.data;
|
|
- // return res?.data?.list?.map((item) => {
|
|
|
|
- // return { label: item.Name, value: item.ID };
|
|
|
|
- // });
|
|
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
@@ -112,12 +122,14 @@ const CadDemo = () => {
|
|
res.data?.list?.forEach((item) => {
|
|
res.data?.list?.forEach((item) => {
|
|
item.children?.forEach((cur) => {
|
|
item.children?.forEach((cur) => {
|
|
cur.name = item.name + cur.version;
|
|
cur.name = item.name + cur.version;
|
|
|
|
+ item.showCreate = cur.cad_status == 2 ? true : false;
|
|
if (cur.cad_path) {
|
|
if (cur.cad_path) {
|
|
const pathList = cur.cad_path.split(',');
|
|
const pathList = cur.cad_path.split(',');
|
|
cur.children = pathList.map((item) => {
|
|
cur.children = pathList.map((item) => {
|
|
return {
|
|
return {
|
|
name: item,
|
|
name: item,
|
|
canShow: true,
|
|
canShow: true,
|
|
|
|
+ parent_id: cur.parent_id,
|
|
};
|
|
};
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -127,7 +139,7 @@ const CadDemo = () => {
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
- //上传
|
|
|
|
|
|
+ //创建审批
|
|
const { run: runCreate } = useRequest(queryCreateCad, {
|
|
const { run: runCreate } = useRequest(queryCreateCad, {
|
|
manual: true,
|
|
manual: true,
|
|
onSuccess: (data) => {
|
|
onSuccess: (data) => {
|
|
@@ -139,6 +151,23 @@ const CadDemo = () => {
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ //创建子审批
|
|
|
|
+ const { run: runCreateVer, loading: loadingCreateVer } = useRequest(
|
|
|
|
+ queryCreateCadVer,
|
|
|
|
+ {
|
|
|
|
+ manual: true,
|
|
|
|
+ onSuccess: (data) => {
|
|
|
|
+ message.success('新建成功');
|
|
|
|
+ setChildrenVisible(false);
|
|
|
|
+ // createOARun({
|
|
|
|
+ // ...auditListRef.current,
|
|
|
|
+ // extend_code: data.cad_id + '',
|
|
|
|
+ // extend_type: 2, //2图纸
|
|
|
|
+ // });
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ );
|
|
|
|
+
|
|
//发起OA审批
|
|
//发起OA审批
|
|
const { run: createOARun } = useRequest(
|
|
const { run: createOARun } = useRequest(
|
|
(data) => createAduit({ ...data, flow_id: 67, files: '' }),
|
|
(data) => createAduit({ ...data, flow_id: 67, files: '' }),
|
|
@@ -155,9 +184,9 @@ const CadDemo = () => {
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl(
|
|
ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl(
|
|
- 'http://172.16.69.195:9080', //47.111.24.13
|
|
|
|
- 'http://172.16.69.195:5121',
|
|
|
|
- 'ws://172.16.69.195:5121',
|
|
|
|
|
|
+ 'http://47.111.24.13:5121', //47.111.24.13
|
|
|
|
+ 'http://47.111.24.13:5121',
|
|
|
|
+ 'ws://47.111.24.13:5121',
|
|
);
|
|
);
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
@@ -216,6 +245,13 @@ const CadDemo = () => {
|
|
onOk={handleCreate}
|
|
onOk={handleCreate}
|
|
handleCancel={() => setVisible(false)}
|
|
handleCancel={() => setVisible(false)}
|
|
/>
|
|
/>
|
|
|
|
+ <CreateChildrenModal
|
|
|
|
+ parentId={parentId}
|
|
|
|
+ loading={loadingCreateVer}
|
|
|
|
+ open={childrenVisible}
|
|
|
|
+ onOk={runCreateVer}
|
|
|
|
+ handleCancel={() => setChildrenVisible(false)}
|
|
|
|
+ />
|
|
</PageContent>
|
|
</PageContent>
|
|
);
|
|
);
|
|
};
|
|
};
|