Renxy преди 1 година
родител
ревизия
a63c9413d9

+ 5 - 6
.umirc.ts

@@ -39,11 +39,11 @@ export default defineConfig({
   //   { src: '/ZwCloud2DSDK/ZwWasmJs.js' },
   //   { src: '/ZwCloud2DSDK/ZwCloud2DAPI.js' },
   // ],
-  // headScripts: [
-  //   `${publicPath}ZwCloud2DSDK/ZwCloud2D.js`,
-  //   `${publicPath}ZwCloud2DSDK/ZwWasmJs.js`,
-  //   `${publicPath}ZwCloud2DSDK/ZwCloud2DPrivateAPI.js`,
-  // ],
+  headScripts: [
+    `${publicPath}ZwCloud2DSDK/ZwCloud2D.js`,
+    `${publicPath}ZwCloud2DSDK/ZwWasmJs.js`,
+    `${publicPath}ZwCloud2DSDK/ZwCloud2DPrivateAPI.js`,
+  ],
   proxy: {
     '/api': {
       // target: 'http://192.168.20.232:1007/',
@@ -177,7 +177,6 @@ export default defineConfig({
       name: 'CAD实例',
       path: '/cad',
       component: './Cad',
-      hideInMenu: true,
       icon: 'https://water-service-test.oss-cn-hangzhou.aliyuncs.com/doc/contract/2023-07-31/3f72fccf-4f9c-4891-a6ec-f04fe4b1d9a2.png',
     },
     {

+ 51 - 0
src/pages/Cad/components/CadOADetail.js

@@ -0,0 +1,51 @@
+import AttachmentTable from '@/components/AttachmentTable';
+import { Card, Row, Col, Table } from 'antd';
+import { useRequest, useNavigate } from '@umijs/max';
+
+const CadOADetail = (props) => {
+  let navigate = useNavigate();
+  const { data, fileList } = props;
+
+  const cadData = data?.cad_path?.split(',').map((item) => {
+    return { name: item };
+  });
+
+  const columns = [
+    {
+      title: '名称',
+      dataIndex: 'name',
+      key: 'name',
+    },
+    {
+      title: '操作',
+      render: (record) => (
+        <a
+          onClick={() =>
+            navigate('/cad/detail', {
+              state: {
+                path: record.name,
+              },
+            })
+          }
+        >
+          查看
+        </a>
+      ),
+    },
+  ];
+
+  return (
+    <Card title="图纸信息">
+      <Row gutter={20}>
+        <Col span={12}>
+          <Table dataSource={cadData} columns={columns} />
+        </Col>
+
+        <Col span={12}>
+          <AttachmentTable excelFileList={fileList} />
+        </Col>
+      </Row>
+    </Card>
+  );
+};
+export default CadOADetail;

+ 240 - 0
src/pages/Cad/components/CreateModal.js

@@ -0,0 +1,240 @@
+import ModuleTitle from '@/components/ModuleTitle/moduleTitle';
+import { advanceSubmitNextNode } from '@/services/boom';
+import { CloudUploadOutlined } from '@ant-design/icons';
+import { useModel, useRequest } from '@umijs/max';
+import {
+  Modal,
+  Form,
+  Input,
+  Upload,
+  Select,
+  Button,
+  Steps,
+  Row,
+  Col,
+} from 'antd';
+import { useEffect, useState } from 'react';
+import styles from './index.less';
+import ApprovalProcess from '@/pages/Flow/components/ApprovalProcess';
+
+//计算审批流数据
+const advance = {
+  flow_id: 67,
+  form_list: null,
+  formComponentValues: '',
+};
+const formItemValues = [
+  {
+    name: '是否PID图和平面图',
+    id: 'DDSelectField_b8169258-d569-442e-a7b0-e2bd171aaac2',
+    type: 'DDSelectField',
+    value: [],
+  },
+  // {
+  //   name: '图纸审批"',
+  //   id: 'TextField_eb5b191b-6135-48ba-a01c-5609ed367d83"',
+  //   type: 'TextField',
+  //   value: [],
+  // },
+];
+
+const CreateModal = ({ loading, projectList, open, onOk, handleCancel }) => {
+  const { userList, run: userListRun } = useModel('userList');
+  const [form] = Form.useForm();
+  const layout = {
+    labelCol: { span: 6 },
+    wrapperCol: { span: 16 },
+  };
+
+  const [upLoading, setUpLoading] = useState([]);
+  const [auditCheck, setAuditCheck] = useState([]);
+  const [approvalProcess, setApprovalProcess] = useState([]);
+  const pic_type = Form.useWatch('pic_type', form);
+
+  useEffect(() => {
+    if (!open) return;
+    form.resetFields();
+    setApprovalProcess([]);
+    userListRun();
+    const params = { ...advance };
+    runAuditList(params);
+  }, [open]);
+
+  useEffect(() => {
+    const formComponentValues = [...formItemValues];
+    formComponentValues[0].value = [pic_type];
+    runAuditList({ ...advance, formComponentValues });
+  }, [pic_type]);
+
+  //填写表单时计算审批流接口
+  const { run: runAuditList } = useRequest(
+    (data) => advanceSubmitNextNode(data),
+    {
+      debounceInterval: 500,
+      manual: true,
+      formatResult(res) {
+        setApprovalProcess(res.data[0]);
+      },
+    },
+  );
+
+  function dwgUpload() {
+    let uploadDwg = document.getElementById('uploadDwg');
+    uploadDwg.click();
+  }
+
+  function uploadDwg(event) {
+    const selectedFile = event.target.files[0];
+    if (selectedFile) {
+      // ZwCloud2D.ZwEditor.ZwSetLoadingState(true);
+      setUpLoading(true);
+      ZwCloud2D.ZwDataProcessor.uploadDwg(selectedFile).then((res) => {
+        if (res.code == 200) {
+          const oldPath = form.getFieldValue('cad_path');
+          const cad_path = oldPath
+            ? oldPath + ',' + res.data.path
+            : res.data.path;
+          form.setFieldsValue({ cad_path });
+        }
+        setUpLoading(false);
+      });
+    }
+  }
+
+  const handleOk = () => {
+    // const audit_list = auditList.map((item) => item.value);
+
+    let audit_list = [];
+    let cc_list = [];
+    approvalProcess?.forEach((item, index) => {
+      let arr = item[0].is_cc === 1 ? cc_list : audit_list;
+
+      if (item[0].type === 'role') arr.push(auditCheck[index]);
+      else if (item[0].type === 'leader')
+        arr.push(
+          ...leaderData.slice(0, item[0].value).map((leader) => leader.ID),
+        );
+      else arr.push(item.map((cur) => cur.value));
+    });
+
+    form.validateFields().then((values) => {
+      if (values.project_id)
+        values.project_name = projectList.find(
+          (item) => (item.value = values.project_id),
+        )?.label;
+      if (values.dir_id)
+        values.dir_name = projectList.find(
+          (item) => (item.value = values.dir_id),
+        )?.label;
+      if (!values.cad_path) values.cad_path = 'test';
+      console.log(values, audit_list);
+      onOk(values, { audit_list: audit_list.flat(), cc_list: cc_list.flat() });
+    });
+  };
+
+  return (
+    <Modal
+      title="新建图纸"
+      width={1200}
+      open={open}
+      confirmLoading={loading}
+      onOk={handleOk}
+      onCancel={handleCancel}
+    >
+      <Row gutter={24}>
+        <Col span={16}>
+          <Form {...layout} name="basic" form={form}>
+            <Form.Item
+              name="name"
+              label="图纸名称:"
+              rules={[{ required: true }]}
+            >
+              <Input />
+            </Form.Item>
+            <Form.Item
+              name="project_id"
+              label="所属项目:"
+              rules={[{ required: true }]}
+            >
+              <Select options={projectList} />
+            </Form.Item>
+            <Form.Item
+              name="dir_id"
+              label="归档目录:"
+              rules={[{ required: true }]}
+            >
+              <Select
+                options={[
+                  {
+                    label: '工艺',
+                    value: 1,
+                  },
+                  {
+                    label: '电气',
+                    value: 2,
+                  },
+                ]}
+              />
+            </Form.Item>
+            <Form.Item
+              name="pic_type"
+              label="是否PID图和平面图"
+              rules={[{ required: true }]}
+            >
+              <Select
+                options={[
+                  {
+                    value: '是',
+                  },
+                  {
+                    value: '否',
+                  },
+                ]}
+              />
+            </Form.Item>
+            <Form.Item
+              name="version"
+              label="版本:"
+              rules={[{ required: true }]}
+            >
+              <Input />
+            </Form.Item>
+            <Form.Item name="cad_path" label="上传:">
+              <Button
+                loading={upLoading}
+                icon={<CloudUploadOutlined />}
+                onClick={dwgUpload}
+              >
+                Upload
+              </Button>
+              {form.getFieldValue('cad_path')}
+              {/* <Upload {...UploadProps}>
+            <Button icon={<CloudUploadOutlined />}>Upload</Button>
+          </Upload> */}
+            </Form.Item>
+            <Form.Item name="doc" label="备注:">
+              <Input.TextArea />
+            </Form.Item>
+          </Form>{' '}
+        </Col>
+        <Col span={8}>
+          <ApprovalProcess
+            leaderData={[]}
+            approvalProcess={approvalProcess}
+            onChange={setAuditCheck}
+          />
+        </Col>
+      </Row>
+
+      <input
+        // multiple
+        style={{ display: 'none' }}
+        id="uploadDwg"
+        type="file"
+        onChange={uploadDwg}
+        accept=".dwg, .dxf"
+      />
+    </Modal>
+  );
+};
+export default CreateModal;

+ 3 - 0
src/pages/Cad/components/index.less

@@ -0,0 +1,3 @@
+.modelItem {
+  margin: 0 40px;
+}

+ 3 - 3
src/pages/Cad/detail.js

@@ -15,9 +15,9 @@ const CadDeTail = () => {
     window.ZwCloud2D.ZwEditor.ZwInit(content);
 
     ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl(
-      'http://222.130.26.205:9080',
-      'http://222.130.26.205:5121',
-      'ws://222.130.26.205:5121',
+      'http://47.111.24.13:9080',
+      'http://47.111.24.13:5121',
+      'ws://47.111.24.13:5121',
     );
     ZwCloud2D.ZwDataProcessor.ZwSetLoadDwg(path);
     window.ZwCloud2D.ZwDataProcessor.ZwLoad();

+ 132 - 73
src/pages/Cad/index.js

@@ -1,38 +1,41 @@
 import { useRef, useEffect, useState } from 'react';
 import PageContent from '@/components/PageContent';
-import { queryCadList, queryCreateCad } from '@/services/cad';
+import { queryCadList, queryCreateCad, queryProject } from '@/services/cad';
 import { useRequest, useNavigate } from '@umijs/max';
-import { Table, Button, message, Space } from 'antd';
+import { Table, Button, message, Space, Select, Input } from 'antd';
+import CreateModal from './components/CreateModal';
+import { createAduit } from '@/services/boom';
 
 const CadDemo = () => {
   let navigate = useNavigate();
+  const [createLoading, setCreateLoading] = useState(false);
+  const [visible, setVisible] = useState(false);
+  const [params, setParams] = useState({
+    // project_name: '',
+    // name: '',
+    page: 1,
+    page_size: 20,
+  });
+
+  const auditListRef = useRef();
+
   const columns = [
     {
       title: '名称',
       dataIndex: 'name',
       key: 'name',
-      align: 'center',
       width: 160,
     },
     {
-      title: '创建人',
-      dataIndex: 'created_by',
-      key: 'created_by',
-      align: 'center',
+      title: '所属项目',
+      dataIndex: 'project_name',
+      key: 'project_name',
       width: 120,
     },
-    {
-      title: '创建时间',
-      dataIndex: 'created_on',
-      key: 'created_on',
-      align: 'center',
-      width: 100,
-    },
     {
       title: '状态',
       dataIndex: 'status',
       key: 'status',
-      align: 'center',
       width: 100,
       render: (status) => {
         let str = '';
@@ -56,90 +59,146 @@ const CadDemo = () => {
     },
     {
       title: '操作',
-      align: 'center',
       width: '10%',
-      render: (record) => (
-        <Space>
-          <a
-            onClick={() =>
-              navigate('/cad/detail', {
-                state: {
-                  path: record.path,
-                },
-              })
-            }
-          >
-            详情
-          </a>
-          <a onClick={() => {}}>提审</a>
-        </Space>
-      ),
+      render: (record) => {
+        return record.canShow ? (
+          <Space>
+            <a
+              onClick={() =>
+                navigate('/cad/detail', {
+                  state: {
+                    path: record.name,
+                  },
+                })
+              }
+            >
+              查看
+            </a>
+          </Space>
+        ) : (
+          ''
+        );
+      },
     },
   ];
-  const [uploading, setUpLoading] = useState(false);
+
+  const { data: projectList } = useRequest(queryProject, {
+    formatResult: (res) => {
+      return res?.data?.list?.map((item) => {
+        return { label: item.Name, value: item.ID };
+      });
+    },
+  });
 
   //请求列表
-  const { data, run, loading } = useRequest(queryCadList);
+  const { data, run, loading } = useRequest(queryCadList, {
+    defaultParams: [params],
+    formatResult: (res) => {
+      res.data?.list?.forEach((item) => {
+        item.children?.forEach((cur) => {
+          cur.name = item.name + cur.version;
+          if (cur.cad_path) {
+            const pathList = cur.cad_path.split(',');
+            cur.children = pathList.map((item) => {
+              return {
+                name: item,
+                canShow: true,
+              };
+            });
+          }
+        });
+      });
+      return res.data?.list;
+    },
+  });
 
   //上传
-  const { run: runCreate } = useRequest((data) => queryCreateCad(data), {
+  const { run: runCreate } = useRequest(queryCreateCad, {
     manual: true,
-    onSuccess: () => {
-      run();
-      message.success('上传成功');
-      setUpLoading(false);
+    onSuccess: (data) => {
+      createOARun({
+        ...auditListRef.current,
+        extend_code: data.cad_id + '',
+        extend_type: 2, //2图纸
+      });
     },
   });
 
+  //发起OA审批
+  const { run: createOARun } = useRequest(
+    (data) => createAduit({ ...data, flow_id: 67, files: '' }),
+    {
+      manual: true,
+      onSuccess: () => {
+        run();
+        message.success('新建成功');
+        setVisible(false);
+        setCreateLoading(false);
+      },
+    },
+  );
+
   useEffect(() => {
     ZwCloud2D.ZwDataProcessor.ZwSetConnectUrl(
-      'http://222.130.26.205:9080',
+      'http://222.130.26.205:9080', //47.111.24.13
       'http://222.130.26.205:5121',
       'ws://222.130.26.205:5121',
     );
   }, []);
 
-  function uploadDwg(event) {
-    const selectedFile = event.target.files[0];
-    if (selectedFile) {
-      // ZwCloud2D.ZwEditor.ZwSetLoadingState(true);
-      setUpLoading(true);
-      ZwCloud2D.ZwDataProcessor.uploadDwg(selectedFile).then((res) => {
-        if (res.code == 200) {
-          runCreate({ name: res.data.name, path: res.data.path });
-        }
-        setUpLoading(false);
-      });
-    }
-  }
-  function dwgUpload() {
-    let uploadDwg = document.getElementById('uploadDwg');
-    uploadDwg.click();
-  }
+  const handleCreate = (values, audit_list) => {
+    setCreateLoading(true);
+    auditListRef.current = audit_list;
+    runCreate(values);
+  };
 
   return (
     <PageContent>
-      <Button type="primary" onClick={dwgUpload}>
-        上传
-      </Button>
+      <Space>
+        <Button type="primary" onClick={() => setVisible(true)}>
+          新建图纸
+        </Button>
+        <div>
+          项目名称:
+          <Select
+            style={{ width: 130 }}
+            allowClear
+            options={projectList}
+            onChange={(value) => {
+              const project_name = projectList?.find(
+                (item) => item.value == value,
+              )?.label;
+              setParams({ ...params, project_name });
+            }}
+          />
+        </div>
+        <div>
+          图纸名称:
+          <Input
+            allowClear
+            style={{ width: '200px' }}
+            onChange={(e) => {
+              setParams({ ...params, name: e.target.value });
+            }}
+          />
+        </div>
+        <Button type="primary" onClick={() => run(params)}>
+          查询
+        </Button>
+      </Space>
       <Table
+        rowKey="id"
         loading={loading}
         columns={columns}
-        dataSource={data?.list}
+        dataSource={data}
         indentSize={70}
-        // pagination={{
-        //   ...pagination,
-        //   showSizeChanger: false,
-        //   onChange: onPageChange,
-        // }}
       />
-      {/* <div id="container"></div> */}
-      <input
-        style={{ display: 'none' }}
-        id="uploadDwg"
-        type="file"
-        onChange={uploadDwg}
-        accept=".dwg, .dxf"
+      <CreateModal
+        loading={createLoading}
+        projectList={projectList}
+        open={visible}
+        onOk={handleCreate}
+        handleCancel={() => setVisible(false)}
       />
     </PageContent>
   );

+ 133 - 23
src/pages/Flow/OaAuditDetail.js

@@ -1,37 +1,56 @@
 // 审批详情
 import React, { useState, useMemo, useEffect } from 'react';
-import { Steps, Button, Tooltip, message, Spin } from 'antd';
+import { Steps, Button, Tooltip, message, Spin, Upload } from 'antd';
 import { useRequest, useModel, useLocation } from 'umi';
 import AuditModal from './components/AuditModal';
+import AddCCModal from './components/AddCCModal';
 import FormAndFilesNode from './components/FormAndFilesNode';
-import { queryAuditDetail, updateAuditList } from '@/services/boom';
+import {
+  queryAuditDetail,
+  updateAuditList,
+  updateCCList,
+  uploadAttachment,
+} from '@/services/boom';
 import { queryGetContractList } from '@/services/contract';
 import PageContent from '@/components/PageContent';
 import SignModal from './components/SignModal';
 import ContractDetail from '../ContractManager/detail';
 import { Type } from '../Profile';
 import { queryContractDetail } from '../../services/contract';
+import { queryCadInfo } from '../../services/cad';
+import CadOADetail from '../Cad/components/CadOADetail';
 
 function OaAuditDetail(props) {
   const { initialState } = useModel('@@initialState');
   const user = initialState?.user || {};
+  const { userList, run: runUserList } = useModel('userList');
   const [auditVisible, setAuditVisible] = useState(false);
   const [visible, setVisible] = useState(false);
+  const [ccVisible, setCCVisible] = useState(false);
 
   const location = useLocation();
   const queryParams = new URLSearchParams(location.search);
   // 使用queryParams来获取特定查询参数
   const id = queryParams.get('id');
   const code = queryParams.get('code');
+  const type = queryParams.get('type') * 1 || Type.OA;
   const token = queryParams.get('JWT-TOKEN');
   if (!localStorage['JWT-TOKEN']) {
     localStorage['JWT-TOKEN'] = token;
   }
 
-  const type = code ? Type.CON : Type.OA;
+  // const type = code ? Type.CON : Type.OA;
 
   useEffect(() => {
-    if (type == Type.CON) runCon({ code });
+    runUserList();
+  }, []);
+
+  useEffect(() => {
+    if (type == Type.CON) {
+      runCon({ code });
+    } else if (type == Type.CAD) {
+      runCad({ cad_id: code * 1 });
+    }
   }, [type]);
 
   const { data, loading, refresh } = useRequest(queryAuditDetail, {
@@ -41,13 +60,13 @@ function OaAuditDetail(props) {
     current_seq,
     form,
     OaAuditList,
+    OaCcs,
     Files = [],
     audit_status,
     AuditorInfo,
   } = data || {};
   // if (OaAuditList) console.log(JSON.stringify(OaAuditList));
 
-  //请求列表
   const {
     data: conData,
     run: runCon,
@@ -57,18 +76,31 @@ function OaAuditDetail(props) {
     formatResult: (res) => {
       return res?.data?.detail;
     },
-    onSuccess: (res) => {},
   });
-  // console.log(conData);
 
-  const getDescription = (node) => {
+  const {
+    data: cadData,
+    run: runCad,
+    loading: loadingCad,
+  } = useRequest(queryCadInfo, {
+    manual: true,
+    formatResult: (res) => {
+      console.log(res);
+      return res?.data?.info;
+    },
+  });
+
+  const getDescription = (node, idx) => {
     let str = node?.AuditRoleInfo
       ? `审批人:${node?.AuditRoleInfo.Name || '-'}`
       : `审批人:${node?.AuditorUser.CName || '-'}`;
-    if (node.desc) {
-      return (
-        <div>
-          {str}
+
+    //最后一个审批节点显示抄送人信息
+    const showCCList = idx == OaAuditList?.length - 1 && OaCcs.length > 0;
+    return (
+      <div>
+        {str}
+        {node.desc && (
           <div>
             <Tooltip title={node.desc}>
               <span style={{ color: '#1A73E8', textDecoration: 'undeline' }}>
@@ -76,10 +108,15 @@ function OaAuditDetail(props) {
               </span>
             </Tooltip>
           </div>
-        </div>
-      );
-    }
-    return str;
+        )}
+        {showCCList && (
+          <div>
+            抄送人:
+            {OaCcs?.map((item) => item.User?.CName).join(',')}
+          </div>
+        )}
+      </div>
+    );
   };
   const updateRes = useRequest(
     (values) => {
@@ -107,6 +144,49 @@ function OaAuditDetail(props) {
     },
   );
 
+  //加抄送人
+  const { run: runCC, loading: loadingCC } = useRequest(
+    (ids) =>
+      updateCCList({
+        oa_id: Number(id),
+        audit_list: ids,
+      }),
+    {
+      manual: true,
+      onSuccess() {
+        message.success('添加抄送人成功');
+        setCCVisible(false);
+        refresh();
+      },
+    },
+  );
+
+  //上传附件
+  const { run: runAttach, loading: loadingAttach } = useRequest(
+    uploadAttachment,
+    {
+      manual: true,
+      onSuccess() {
+        message.success('上传成功');
+      },
+    },
+  );
+
+  const handleUploadClick = () => {};
+  const UploadProps = {
+    showUploadList: false,
+    action: `/api/v1/oa/attachment/${id}`,
+    headers: {
+      'JWT-TOKEN': localStorage.getItem('JWT-TOKEN'),
+    },
+    onChange({ file, fileList }) {
+      if (file.status !== 'uploading') {
+        console.log(fileList);
+        message.success('上传成功');
+      }
+    },
+  };
+
   const btns = useMemo(() => {
     if (!user || !data) return;
     if (
@@ -129,27 +209,56 @@ function OaAuditDetail(props) {
         <Button key={3} onClick={() => setVisible(true)}>
           加签
         </Button>,
+        <Button key={4} onClick={() => setCCVisible(true)}>
+          加抄送人
+        </Button>,
+        <Upload {...UploadProps}>
+          <Button>上传附件</Button>
+        </Upload>,
+        // <Button key={5} onClick={handleUploadClick}>
+        //   上传附件
+        // </Button>,
       ];
     }
     return [];
   }, [user, data]);
 
+  const renderDetail = () => {
+    let content = '';
+    switch (type) {
+      case Type.CAD:
+        content = <CadOADetail data={cadData} fileList={Files} />;
+        break;
+      case Type.CON:
+        content = <ContractDetail data={conData} />;
+        break;
+      default:
+        content = <FormAndFilesNode formData={form} fileList={Files} />;
+    }
+    return content;
+  };
+
   return (
     <PageContent extra={btns} loading={loading && conLoading}>
       <Steps
         style={{ marginBottom: 20 }}
         current={audit_status == 3 ? OaAuditList?.length : current_seq - 1}
         status={audit_status == 2 ? 'error' : 'process'}
-        items={OaAuditList?.map((item) => ({
+        items={OaAuditList?.map((item, idx) => ({
           title: item.seq_name,
-          description: getDescription(item),
+          description: getDescription(item, idx),
         }))}
       ></Steps>
-      {type == Type.OA ? (
-        <FormAndFilesNode formData={form} fileList={Files} />
-      ) : (
-        <ContractDetail data={conData} />
-      )}
+
+      {renderDetail()}
+
+      <AddCCModal
+        userList={userList}
+        visible={ccVisible}
+        onCancel={() => setCCVisible(false)}
+        onCreate={runCC}
+        loading={loadingCC}
+      />
 
       <AuditModal
         id={id}
@@ -158,6 +267,7 @@ function OaAuditDetail(props) {
         onOk={refresh}
       />
       <SignModal
+        userList={userList}
         visible={visible}
         onCancel={() => setVisible(false)}
         onCreate={(values) => updateRes.run(values)}

+ 47 - 0
src/pages/Flow/components/AddCCModal.js

@@ -0,0 +1,47 @@
+import { useState } from 'react';
+import { Modal, Form, Radio, Select, Button, message } from 'antd';
+import { useModel, useRequest } from '@umijs/max';
+
+const { Option } = Select;
+
+const AddCCModal = ({ userList, visible, onCancel, onCreate, loading }) => {
+  const [ids, setIds] = useState([]);
+
+  const handleOk = () => {
+    if (ids.length == 0) message.error('请选择抄送人');
+    onCreate(ids);
+  };
+
+  return (
+    <Modal
+      open={visible}
+      title="添加抄送人"
+      onCancel={onCancel}
+      onOk={handleOk}
+      destroyOnClose
+      confirmLoading={loading}
+    >
+      <div>
+        抄送人:
+        <Select
+          style={{ width: 200 }}
+          mode="multiple"
+          showSearch
+          filterOption={(input, option) =>
+            (option.children ?? '').toLowerCase().includes(input.toLowerCase())
+          }
+          placeholder="请选择抄送人"
+          onChange={(values) => setIds(values)}
+        >
+          {userList?.map((item) => (
+            <Option value={item.ID} key={item.ID}>
+              {item.CName}
+            </Option>
+          ))}
+        </Select>
+      </div>
+    </Modal>
+  );
+};
+
+export default AddCCModal;

+ 4 - 3
src/pages/Flow/components/SignModal.js

@@ -4,9 +4,8 @@ import { useModel, useRequest } from '@umijs/max';
 
 const { Option } = Select;
 
-const SignModal = ({ visible, onCancel, onCreate, loading }) => {
+const SignModal = ({ userList, visible, onCancel, onCreate, loading }) => {
   const [form] = Form.useForm();
-  const { userList } = useModel('userList');
 
   const handleOk = () => {
     form.validateFields().then((values) => {
@@ -43,7 +42,9 @@ const SignModal = ({ visible, onCancel, onCreate, loading }) => {
           <Select
             showSearch
             filterOption={(input, option) =>
-              (option.children ?? '').toLowerCase().includes(input.toLowerCase())
+              (option.children ?? '')
+                .toLowerCase()
+                .includes(input.toLowerCase())
             }
             placeholder="请选择审批人"
           >

+ 11 - 11
src/pages/Home/index.js

@@ -95,15 +95,15 @@ function HomePage(props) {
       },
       Icon: require('@/assets/UnityMenu/userCenter.png'),
     },
-    // {
-    //   id: 10,
-    //   name: 'cad管理',
-    //   active: true,
-    //   click: () => {
-    //     navigate('/cad');
-    //   },
-    //   Icon: require('@/assets/UnityMenu/cad.png'),
-    // },
+    {
+      id: 11,
+      name: 'cad管理',
+      active: true,
+      click: () => {
+        navigate('/cad');
+      },
+      Icon: require('@/assets/UnityMenu/cad.png'),
+    },
     {
       id: 10,
       name: 'Scada功能',
@@ -126,8 +126,8 @@ function HomePage(props) {
 function MenuContent({ list }) {
   const row = useMemo(() => {
     const result = [];
-    for (let i = 0; i < list.length; i += 5) {
-      result.push(list.slice(i, i + 5));
+    for (let i = 0; i < list.length; i += 6) {
+      result.push(list.slice(i, i + 6));
     }
     return result;
   }, [list]);

+ 9 - 2
src/pages/Profile/index.js

@@ -20,6 +20,7 @@ import { ExclamationCircleOutlined } from '@ant-design/icons';
 export const Type = {
   OA: 1,
   CON: 2,
+  CAD: 3,
 };
 
 function profile(props) {
@@ -84,8 +85,14 @@ function profile(props) {
                 <a
                   style={{ color: '#4096ff' }}
                   onClick={() => {
-                    if (record.extend_code) {
-                      navigate(`/profile/detail?id=${record.id}&code=${record.extend_code}`);
+                    if (record.extend_type == 2) {
+                      navigate(
+                        `/profile/detail?id=${record.id}&code=${record.extend_code}&type=${Type.CAD}`,
+                      );
+                    } else if (record.extend_code) {
+                      navigate(
+                        `/profile/detail?id=${record.id}&code=${record.extend_code}&type=${Type.CON}`,
+                      );
                     } else {
                       navigate(`/profile/detail?id=${record.id}`);
                     }

+ 17 - 0
src/services/boom.js

@@ -261,3 +261,20 @@ export async function updateAuditList(data, isAfter) {
   }
   return res;
 }
+//添加抄送人
+export async function updateCCList(data) {
+  let res = await request(`/api/v1/oa/submit/add-cc`, {
+    method: 'POST',
+    data,
+  });
+  return res;
+}
+
+//审批时上传附加
+export async function uploadAttachment(data) {
+  let res = await request(`/api/v1/oa/attachment/184`, {
+    method: 'POST',
+    data,
+  });
+  return res;
+}

+ 21 - 2
src/services/cad.js

@@ -1,10 +1,29 @@
 import { request } from 'umi';
-export const queryCadList = async () => {
-  return await request('/api/contract/v1/cad');
+export const queryCadList = async (data) => {
+  return await request('/api/archive/v1/cad/list', {
+    method: 'POST',
+    data,
+  });
 };
 export async function queryCreateCad(data) {
+  return request(`/api/archive/v1/cad/create`, {
+    method: 'POST',
+    data,
+  });
+}
+export const queryProject = async () => {
+  return await request('/api/v2/project');
+};
+
+export async function queryCreateCadOld(data) {
   return request(`/api/contract/v1/cad`, {
     method: 'POST',
     data,
   });
 }
+export async function queryCadInfo(data) {
+  return request(`/api/archive/v1/cad/info`, {
+    method: 'POST',
+    data,
+  });
+}