xujunjie 1 жил өмнө
parent
commit
09300c043c

+ 66 - 18
src/pages/Cad/components/CreateModal.js

@@ -12,6 +12,7 @@ import {
   Row,
   Col,
   Cascader,
+  Timeline,
 } from 'antd';
 import { useEffect, useState } from 'react';
 import ApprovalProcess from '@/pages/Flow/components/ApprovalProcess';
@@ -103,14 +104,14 @@ const CreateModal = ({
     let audit_list = [];
     let cc_list = [];
     approvalProcess?.forEach((item, index) => {
-      let arr = item[0].is_cc === 1 ? cc_list : audit_list;
+      // let arr = item[0].is_cc === 1 ? cc_list : audit_list;
 
-      if (item[0].type === 'role') arr.push(auditCheck[index]);
+      if (item[0].type === 'role') audit_list.push(auditCheck[index]);
       else if (item[0].type === 'leader')
-        arr.push(
+        audit_list.push(
           ...leaderData.slice(0, item[0].value).map((leader) => leader.ID),
         );
-      else arr.push(item.map((cur) => cur.value));
+      else audit_list.push(item.map((cur) => cur.value));
     });
 
     form.validateFields().then((values) => {
@@ -122,7 +123,10 @@ const CreateModal = ({
       values.dir_id = 0;
       if (!values.cad_path) values.cad_path = cadPath.join(',');
       console.log(values, audit_list);
-      onOk(values, { audit_list: audit_list.flat(), cc_list: cc_list.flat() });
+      onOk(values, {
+        audit_list: audit_list.flat(),
+        cc_list: values.ccList || [],
+      });
     });
   };
 
@@ -135,9 +139,9 @@ const CreateModal = ({
       onOk={handleOk}
       onCancel={handleCancel}
     >
-      <Row gutter={24}>
-        <Col span={16}>
-          <Form {...layout} name="basic" form={form}>
+      <Form {...layout} name="basic" form={form}>
+        <Row gutter={24}>
+          <Col span={16}>
             <Form.Item
               name="name"
               label="图纸名称:"
@@ -207,17 +211,61 @@ const CreateModal = ({
             <Form.Item name="remark" label="备注:">
               <Input.TextArea />
             </Form.Item>
-          </Form>
-        </Col>
-        <Col span={8}>
-          <ApprovalProcess
-            leaderData={[]}
-            approvalProcess={approvalProcess}
-            onChange={setAuditCheck}
-          />
-        </Col>
-      </Row>
+          </Col>
+          <Col span={8}>
+            <ApprovalProcess
+              leaderData={[]}
+              approvalProcess={approvalProcess}
+              onChange={setAuditCheck}
+            />
+            <Form.Item wrapperCol={{ span: 24 }} name="ccList">
+              <CCItem userList={userList} />
+            </Form.Item>
+          </Col>
+        </Row>
+      </Form>
     </Modal>
   );
 };
+
+const CCItem = ({ userList, onChange, value }) => {
+  return (
+    <Timeline
+      items={[
+        {
+          children: (
+            <div
+              style={{
+                marginBottom: 20,
+                cursor: 'pointer',
+                display: 'flex',
+                justifyContent: 'space-between',
+              }}
+            >
+              <div style={{ fontSize: '18px' }}>抄送人</div>
+              <Select
+                value={value}
+                mode="multiple"
+                style={{ width: 200 }}
+                onChange={(value) => {
+                  onChange(value);
+                }}
+                filterOption={(input, option) =>
+                  (option?.label ?? '')
+                    .toLowerCase()
+                    .includes(input.toLowerCase())
+                }
+                options={userList?.map((item) => ({
+                  value: item.ID,
+                  label: item.CName,
+                }))}
+              />
+            </div>
+          ),
+        },
+      ]}
+    ></Timeline>
+  );
+};
+
 export default CreateModal;