|  | @@ -15,8 +15,11 @@ import { useParams, useRequest, useNavigate } from 'umi';
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  const OaDetail = () => {
 |  |  const OaDetail = () => {
 | 
											
												
													
														|  |    const [form] = Form.useForm();
 |  |    const [form] = Form.useForm();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |    const [approvalProcess, setApprovalProcess] = useState([]);
 |  |    const [approvalProcess, setApprovalProcess] = useState([]);
 | 
											
												
													
														|  |    const [auditCheck, setAuditCheck] = useState([]);
 |  |    const [auditCheck, setAuditCheck] = useState([]);
 | 
											
												
													
														|  | 
 |  | +  const [tableData, setTableData] = useState({});
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |    const { oaId } = useParams();
 |  |    const { oaId } = useParams();
 | 
											
												
													
														|  |    const formValueRef = useRef({
 |  |    const formValueRef = useRef({
 | 
											
												
													
														|  |      form: '',
 |  |      form: '',
 | 
											
										
											
												
													
														|  | @@ -87,31 +90,81 @@ const OaDetail = () => {
 | 
											
												
													
														|  |      run(params);
 |  |      run(params);
 | 
											
												
													
														|  |    };
 |  |    };
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -  const submit = () => {
 |  | 
 | 
											
												
													
														|  | 
 |  | +  const handleTableValChange = (value, id, label) => {
 | 
											
												
													
														|  | 
 |  | +    let ids = id.split(';');
 | 
											
												
													
														|  | 
 |  | +    let [rowIndex, colIndex] = ids[0].split(',').map((item) => Number(item));
 | 
											
												
													
														|  | 
 |  | +    let [columnID, tableID] = ids[1].split('>');
 | 
											
												
													
														|  | 
 |  | +    let cell = { [columnID]: value + '|' + label };
 | 
											
												
													
														|  | 
 |  | +    let rows = [];
 | 
											
												
													
														|  | 
 |  | +    rows[rowIndex] = cell;
 | 
											
												
													
														|  | 
 |  | +    let table = { [tableID]: rows };
 | 
											
												
													
														|  | 
 |  | +    if (tableData) {
 | 
											
												
													
														|  | 
 |  | +      if (tableData[tableID]) {
 | 
											
												
													
														|  | 
 |  | +        if (tableData[tableID][rowIndex]) {
 | 
											
												
													
														|  | 
 |  | +          tableData[tableID][rowIndex][columnID] = value + '|' + label;
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  | 
 |  | +          tableData[tableID][rowIndex] = cell;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +      } else {
 | 
											
												
													
														|  | 
 |  | +        tableData[tableID] = rows;
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +      setTableData(tableData);
 | 
											
												
													
														|  | 
 |  | +    } else {
 | 
											
												
													
														|  | 
 |  | +      setTableData(table);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +  };
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  const convertTableData = () => {
 | 
											
												
													
														|  | 
 |  | +    let result = [];
 | 
											
												
													
														|  | 
 |  | +    for (const tableKey in tableData) {
 | 
											
												
													
														|  | 
 |  | +      if (Object.hasOwn(tableData, tableKey)) {
 | 
											
												
													
														|  | 
 |  | +        for (const rows of tableData[tableKey]) {
 | 
											
												
													
														|  | 
 |  | +          if (rows) {
 | 
											
												
													
														|  | 
 |  | +            for (const rowKey in rows) {
 | 
											
												
													
														|  | 
 |  | +              if (Object.hasOwn(rows, rowKey)) {
 | 
											
												
													
														|  | 
 |  | +                let [value, label] = rows[rowKey].split('|');
 | 
											
												
													
														|  | 
 |  | +                result.push({
 | 
											
												
													
														|  | 
 |  | +                  id: tableKey + '<' + rowKey,
 | 
											
												
													
														|  | 
 |  | +                  name: label,
 | 
											
												
													
														|  | 
 |  | +                  type: rowKey.split('_')[0],
 | 
											
												
													
														|  | 
 |  | +                  value: [value],
 | 
											
												
													
														|  | 
 |  | +                });
 | 
											
												
													
														|  | 
 |  | +              }
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +          }
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +      }
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    return result;
 | 
											
												
													
														|  | 
 |  | +  };
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  const submit = async () => {
 | 
											
												
													
														|  |      form.validateFields().then((values) => {
 |  |      form.validateFields().then((values) => {
 | 
											
												
													
														|  |        const { form: formCur } = formValueRef.current;
 |  |        const { form: formCur } = formValueRef.current;
 | 
											
												
													
														|  | -      let audit_list = [],
 |  | 
 | 
											
												
													
														|  | -        cc_list = [];
 |  | 
 | 
											
												
													
														|  | 
 |  | +      let audit_list = [];
 | 
											
												
													
														|  | 
 |  | +      let cc_list = [];
 | 
											
												
													
														|  |        approvalProcess?.forEach((item, index) => {
 |  |        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]);
 |  | 
 | 
											
												
													
														|  | -        else if (item[0].type == 'leader')
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (item[0].type === 'role') arr.push(auditCheck[index]);
 | 
											
												
													
														|  | 
 |  | +        else if (item[0].type === 'leader')
 | 
											
												
													
														|  |            arr.push(
 |  |            arr.push(
 | 
											
												
													
														|  |              ...leaderData.slice(0, item[0].value).map((leader) => leader.ID),
 |  |              ...leaderData.slice(0, item[0].value).map((leader) => leader.ID),
 | 
											
												
													
														|  |            );
 |  |            );
 | 
											
												
													
														|  |          else arr.push(item.map((cur) => cur.value));
 |  |          else arr.push(item.map((cur) => cur.value));
 | 
											
												
													
														|  |        });
 |  |        });
 | 
											
												
													
														|  | -      let files = [],
 |  | 
 | 
											
												
													
														|  | -        formData = [];
 |  | 
 | 
											
												
													
														|  | 
 |  | +      let files = [];
 | 
											
												
													
														|  | 
 |  | +      let formData = [];
 | 
											
												
													
														|  |        formCur.forEach((item) => {
 |  |        formCur.forEach((item) => {
 | 
											
												
													
														|  | -        if (item.type == 'DDAttachment') {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if (item.type === 'DDAttachment') {
 | 
											
												
													
														|  |            files = files.concat(item.value);
 |  |            files = files.concat(item.value);
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  |            formData.push(item);
 |  |            formData.push(item);
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |        });
 |  |        });
 | 
											
												
													
														|  | -      console.log(audit_list, cc_list);
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +      formData = formData.concat(...convertTableData());
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |        createRun({
 |  |        createRun({
 | 
											
												
													
														|  |          flow_id: Number(oaId),
 |  |          flow_id: Number(oaId),
 | 
											
												
													
														|  |          form: JSON.stringify(formData),
 |  |          form: JSON.stringify(formData),
 | 
											
										
											
												
													
														|  | @@ -150,6 +203,7 @@ const OaDetail = () => {
 | 
											
												
													
														|  |              form={form}
 |  |              form={form}
 | 
											
												
													
														|  |              items={data?.formData}
 |  |              items={data?.formData}
 | 
											
												
													
														|  |              onValuesChange={advanceSubmit}
 |  |              onValuesChange={advanceSubmit}
 | 
											
												
													
														|  | 
 |  | +            onTableValChange={handleTableValChange}
 | 
											
												
													
														|  |            />
 |  |            />
 | 
											
												
													
														|  |          </Col>
 |  |          </Col>
 | 
											
												
													
														|  |          <Col span={12}>
 |  |          <Col span={12}>
 |