|
@@ -98,10 +98,6 @@ const ContractModal = (props) => {
|
|
|
},
|
|
|
];
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
-=======
|
|
|
- const [isPass, setIsPass] = useState(1);
|
|
|
->>>>>>> master
|
|
|
const [companyDepList, setCompanyDepList] = useState(depList || []);
|
|
|
const [archivesDepList, setArchivesDepList] = useState(archivesOptions);
|
|
|
const [dealDisable, setDealDisable] = useState(false);
|
|
@@ -112,12 +108,9 @@ const ContractModal = (props) => {
|
|
|
const company = Form.useWatch('company_id', form);
|
|
|
const project_name = Form.useWatch('project_name', form);
|
|
|
const archives_dep = Form.useWatch('archives_dep', form);
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
|
// 当为审核拒绝状态时,点击编辑按钮可以时为强制修改状态
|
|
|
const [forceModify, setForceModify] = useState(false);
|
|
|
-=======
|
|
|
->>>>>>> master
|
|
|
|
|
|
//是否补充协议,是的话需要填合同编号
|
|
|
const is_supplement = Form.useWatch('is_supplement', form);
|
|
@@ -227,7 +220,6 @@ const ContractModal = (props) => {
|
|
|
manual: true,
|
|
|
formatResult: (response) => response.data,
|
|
|
});
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
|
//填写表单时计算审批流接口
|
|
|
const { run: runAuditList } = useRequest(
|
|
@@ -263,42 +255,7 @@ const ContractModal = (props) => {
|
|
|
});
|
|
|
},
|
|
|
});
|
|
|
-=======
|
|
|
->>>>>>> master
|
|
|
|
|
|
- //填写表单时计算审批流接口
|
|
|
- const { run: runAuditList } = useRequest(
|
|
|
- (data) => advanceSubmitNextNode(data),
|
|
|
- {
|
|
|
- debounceInterval: 500,
|
|
|
- manual: true,
|
|
|
- formatResult(res) {
|
|
|
- const list = res.data[0]?.map((item) => {
|
|
|
- const name = userList?.find(
|
|
|
- (user) => user.ID == item[0].value,
|
|
|
- )?.CName;
|
|
|
- return { ...item[0], name };
|
|
|
- });
|
|
|
- setAuditList(
|
|
|
- res.data[0]?.map((item) => {
|
|
|
- const name = userList?.find(
|
|
|
- (user) => user.ID == item[0].value,
|
|
|
- )?.CName;
|
|
|
- return { ...item[0], name };
|
|
|
- }),
|
|
|
- );
|
|
|
- },
|
|
|
- },
|
|
|
- );
|
|
|
- //计算合同编号接口
|
|
|
- const { run: runCode } = useRequest((data) => queryContractCode(data), {
|
|
|
- manual: true,
|
|
|
- onSuccess: (data) => {
|
|
|
- form.setFieldsValue({
|
|
|
- code: data?.code,
|
|
|
- });
|
|
|
- },
|
|
|
- });
|
|
|
//供应商列表
|
|
|
const { data: supplierList = [], loading } = useRequest(querySupplierList, {
|
|
|
defaultParams: [
|
|
@@ -317,82 +274,7 @@ const ContractModal = (props) => {
|
|
|
: [];
|
|
|
},
|
|
|
});
|
|
|
- //获取OA 归档审批列表
|
|
|
- const { data: auditData, run: runAudit } = useRequest(
|
|
|
- (data) => queryAuditByCode({ ...data, extend_type: 0 }),
|
|
|
- {
|
|
|
- manual: true,
|
|
|
- formatResult: (res) => {
|
|
|
- if (res?.data) {
|
|
|
- return res.data;
|
|
|
- } else {
|
|
|
- if (data?.status == Status.CheckReject) {
|
|
|
- return { ...oldAuditList, audit_status: 2 };
|
|
|
- }
|
|
|
- return oldAuditList;
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- );
|
|
|
- //获取OA 作废审批列表
|
|
|
- const { data: auditCelData, run: runCalAudit } = useRequest(
|
|
|
- (data) => queryAuditByCode({ ...data, extend_type: 1 }),
|
|
|
- {
|
|
|
- manual: true,
|
|
|
- formatResult: (res) => {
|
|
|
- if (res?.data) {
|
|
|
- return res.data;
|
|
|
- } else {
|
|
|
- if (data?.status == Status.CalCheckReject) {
|
|
|
- return { ...oldAuditList, audit_status: 2 };
|
|
|
- }
|
|
|
- return oldAuditList;
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- );
|
|
|
|
|
|
- useEffect(() => {
|
|
|
- setCompanyDepList(depList);
|
|
|
- }, [depList]);
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- if (!visible) {
|
|
|
- setIsPass(1);
|
|
|
- setDealDisable(false);
|
|
|
- setAuditList([]);
|
|
|
- // setCompanyDepList([]);
|
|
|
- setArchivesDepList([]);
|
|
|
- } else {
|
|
|
- userListRun();
|
|
|
- depListRun();
|
|
|
- runCompany();
|
|
|
- runCompanyDeps();
|
|
|
- }
|
|
|
- }, [visible]);
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- form.resetFields();
|
|
|
- if (data?.status >= Status.Checking) runAudit({ extend_code: data.code });
|
|
|
- if (data?.status >= Status.CalChecking)
|
|
|
- runCalAudit({ extend_code: data.code });
|
|
|
- let result = { attach: [], attach_extend: [] };
|
|
|
- if (data?.attach) {
|
|
|
- let att = JSON.parse(data.attach);
|
|
|
- result.attach = att.map((item, idx) => {
|
|
|
- return { ...item, uid: idx, status: 'done' };
|
|
|
- });
|
|
|
- }
|
|
|
- if (data?.attach_extend) {
|
|
|
- let att = JSON.parse(data.attach_extend);
|
|
|
- result.attach_extend = att.map((item, idx) => {
|
|
|
- return { ...item, uid: idx, status: 'done' };
|
|
|
- });
|
|
|
- }
|
|
|
- setAttachData(result);
|
|
|
- }, [data]);
|
|
|
-
|
|
|
-<<<<<<< HEAD
|
|
|
//获取OA 归档审批列表
|
|
|
const { data: auditData, run: runAudit } = useRequest(
|
|
|
(data) => queryAuditByCode({ ...data, extend_type: 0 }),
|
|
@@ -525,55 +407,6 @@ const ContractModal = (props) => {
|
|
|
|
|
|
//获取合同编号逻辑 只有新增才请求
|
|
|
useEffect(() => {
|
|
|
-=======
|
|
|
- const isSuper = useMemo(() => {
|
|
|
- if (
|
|
|
- type == Type.add ||
|
|
|
- type == Type.cancel ||
|
|
|
- data?.status == Status.ReCall
|
|
|
- )
|
|
|
- return true;
|
|
|
- let currentAuditUserID;
|
|
|
- if (data?.status == Status.Checking && auditData) {
|
|
|
- const { OaAuditList, audit_status } = auditData;
|
|
|
- currentAuditUserID = OaAuditList[audit_status]?.auditor;
|
|
|
- } else if (data?.status == Status.CalChecking && auditCelData) {
|
|
|
- const { OaAuditList, audit_status } = auditCelData;
|
|
|
- currentAuditUserID = OaAuditList[audit_status]?.auditor;
|
|
|
- }
|
|
|
- if (user.ID == currentAuditUserID) return true;
|
|
|
- return false;
|
|
|
- }, [user, data, auditData, auditCelData]);
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- if (type !== Type.add && data?.status !== Status.ReCall) return;
|
|
|
- const newCompony = company || data?.company_id; //recall状态时compony是空, 需要用data?.company_id
|
|
|
- if (!newCompony) {
|
|
|
- setCompanyDepList([]);
|
|
|
- setArchivesDepList([]);
|
|
|
- return;
|
|
|
- }
|
|
|
- const deps = getDepItemById(newCompony)?.children;
|
|
|
- deps ? setCompanyDepList(deps) : setCompanyDepList([]);
|
|
|
- const item = companyData?.find((item) => item.ID == newCompony);
|
|
|
- if (item?.Flag == 1) {
|
|
|
- //公司为本部 经办人为自己并不可编辑 合同存档部门从财务和行政部选
|
|
|
- setDealDisable(false);
|
|
|
- setArchivesDepList(archivesOptions);
|
|
|
- form.setFieldsValue({ deal_by: user?.CName });
|
|
|
- // 公司为本部时,使用另一个接口获取部门数据
|
|
|
- companyDeps ? setCompanyDepList(companyDeps) : setCompanyDepList([]);
|
|
|
- } else {
|
|
|
- //公司为分子公司 经办人为手动输入 合同存档部门从所选分子公司的子部门选择
|
|
|
- setDealDisable(true);
|
|
|
- setArchivesDepList(deps);
|
|
|
- form.setFieldsValue({ deal_by: '' });
|
|
|
- }
|
|
|
- }, [company, data]);
|
|
|
-
|
|
|
- //获取合同编号逻辑 只有新增才请求
|
|
|
- useEffect(() => {
|
|
|
->>>>>>> master
|
|
|
if (type !== Type.add || !company || !dep_id) return;
|
|
|
const item = companyData?.find((item) => item.ID == company);
|
|
|
const dep_code = getDepItemById(dep_id)?.Code;
|
|
@@ -590,16 +423,12 @@ const ContractModal = (props) => {
|
|
|
|
|
|
//获取审批流逻辑
|
|
|
useEffect(() => {
|
|
|
-<<<<<<< HEAD
|
|
|
if (
|
|
|
type !== Type.add &&
|
|
|
data?.status !== Status.ReCall &&
|
|
|
data?.status !== Status.CheckReject
|
|
|
)
|
|
|
return;
|
|
|
-=======
|
|
|
- if (type !== Type.add && data?.status !== Status.ReCall) return;
|
|
|
->>>>>>> master
|
|
|
const param = { ...advance };
|
|
|
let formValues = [];
|
|
|
const item = companyData?.find((item) => item.ID == company);
|
|
@@ -613,7 +442,6 @@ const ContractModal = (props) => {
|
|
|
runAuditList(param);
|
|
|
}, [company, archives_dep]);
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
//根据项目名称填充项目编号逻辑
|
|
|
useEffect(() => {
|
|
|
if (
|
|
@@ -622,10 +450,6 @@ const ContractModal = (props) => {
|
|
|
data?.status !== Status.CheckReject
|
|
|
)
|
|
|
return;
|
|
|
-=======
|
|
|
- useEffect(() => {
|
|
|
- if (type !== Type.add && data?.status !== Status.ReCall) return;
|
|
|
->>>>>>> master
|
|
|
const project_code = projectList?.find(
|
|
|
(item) => item.project_name == project_name,
|
|
|
)?.project_full_code;
|
|
@@ -635,10 +459,7 @@ const ContractModal = (props) => {
|
|
|
form.setFieldsValue({ project_code: '' });
|
|
|
}
|
|
|
}, [project_name]);
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
|
-=======
|
|
|
->>>>>>> master
|
|
|
const supplyList = useMemo(() => {
|
|
|
return companyData ? [...companyData, ...supplierList] : supplierList;
|
|
|
}, [companyData, supplierList]);
|
|
@@ -733,14 +554,10 @@ const ContractModal = (props) => {
|
|
|
code: data?.code,
|
|
|
};
|
|
|
handleOk(result, Type.cancel, form, audit_list);
|
|
|
-<<<<<<< HEAD
|
|
|
} else if (
|
|
|
data?.status == Status.ReCall ||
|
|
|
data?.status == Status.CheckReject
|
|
|
) {
|
|
|
-=======
|
|
|
- } else if (data?.status == Status.ReCall) {
|
|
|
->>>>>>> master
|
|
|
const form = getAuditData(values, '1');
|
|
|
const audit_list = auditList.map((item) => item.value);
|
|
|
values.effect_on = dayjs(values.effect_on).format(FORMAT);
|
|
@@ -762,23 +579,6 @@ const ContractModal = (props) => {
|
|
|
values.created_by = user?.ID;
|
|
|
values.id = data?.id;
|
|
|
handleOk(values, Type.add, form, audit_list);
|
|
|
-<<<<<<< HEAD
|
|
|
-=======
|
|
|
- } else if (data?.status == Status.Checking) {
|
|
|
- let result = {
|
|
|
- id: auditData?.id,
|
|
|
- status: values.is_pass,
|
|
|
- desc: '',
|
|
|
- };
|
|
|
- handleOk(result, Type.check, data?.status);
|
|
|
- } else if (data?.status == Status.CalChecking) {
|
|
|
- let result = {
|
|
|
- id: auditCelData?.id,
|
|
|
- status: values.is_pass,
|
|
|
- desc: '',
|
|
|
- };
|
|
|
- handleOk(result, Type.check, data?.status);
|
|
|
->>>>>>> master
|
|
|
}
|
|
|
});
|
|
|
};
|
|
@@ -810,7 +610,6 @@ const ContractModal = (props) => {
|
|
|
const renderFooter = () => {
|
|
|
return (
|
|
|
<Space>
|
|
|
-<<<<<<< HEAD
|
|
|
{data?.status == Status.Checking && (
|
|
|
<Button onClick={() => handlerReCall(auditData?.id)}>撤回</Button>
|
|
|
)}
|
|
@@ -832,22 +631,13 @@ const ContractModal = (props) => {
|
|
|
修改
|
|
|
</Button>
|
|
|
)}
|
|
|
-=======
|
|
|
- {data?.status == Status.Checking && type !== Type.check && (
|
|
|
- <Button onClick={() => handlerReCall(auditData?.id)}>撤回</Button>
|
|
|
- )}
|
|
|
- <Button onClick={handleCancel}>取消</Button>
|
|
|
->>>>>>> master
|
|
|
<Button type="primary" onClick={handleSubmit} disabled={!isSuper}>
|
|
|
提交
|
|
|
</Button>
|
|
|
</Space>
|
|
|
);
|
|
|
};
|
|
|
-<<<<<<< HEAD
|
|
|
|
|
|
-=======
|
|
|
->>>>>>> master
|
|
|
return (
|
|
|
<>
|
|
|
<Modal
|
|
@@ -1232,13 +1022,9 @@ const ContractModal = (props) => {
|
|
|
}
|
|
|
initialValue={attachData.attach}
|
|
|
>
|
|
|
-<<<<<<< HEAD
|
|
|
{type == Type.add ||
|
|
|
data?.status == Status.ReCall ||
|
|
|
forceModify ? (
|
|
|
-=======
|
|
|
- {type == Type.add || data?.status == Status.ReCall ? (
|
|
|
->>>>>>> master
|
|
|
<Upload {...UploadProps}>
|
|
|
<Button icon={<CloudUploadOutlined />}>Upload</Button>
|
|
|
</Upload>
|
|
@@ -1298,11 +1084,7 @@ const ContractModal = (props) => {
|
|
|
</div>
|
|
|
}
|
|
|
>
|
|
|
-<<<<<<< HEAD
|
|
|
{type == Type.add || forceModify ? (
|
|
|
-=======
|
|
|
- {type == Type.add ? (
|
|
|
->>>>>>> master
|
|
|
<Upload {...UploadPropsExtend}>
|
|
|
<Button icon={<CloudUploadOutlined />}>Upload</Button>
|
|
|
</Upload>
|
|
@@ -1322,11 +1104,7 @@ const ContractModal = (props) => {
|
|
|
</Col>
|
|
|
</Row>
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
{data?.status >= Status.Checking && !forceModify && (
|
|
|
-=======
|
|
|
- {data?.status >= Status.Checking && (
|
|
|
->>>>>>> master
|
|
|
<>
|
|
|
<ModuleTitle title="归档流程" />
|
|
|
<div className={styles.modelItem}>
|
|
@@ -1334,61 +1112,6 @@ const ContractModal = (props) => {
|
|
|
</div>
|
|
|
</>
|
|
|
)}
|
|
|
-<<<<<<< HEAD
|
|
|
-=======
|
|
|
- {isSuper && data.status == Status.Checking && (
|
|
|
- <>
|
|
|
- <ModuleTitle title="审核情况" />
|
|
|
- <Row>
|
|
|
- <Col span={10} offset={1}>
|
|
|
- <Form.Item
|
|
|
- name="check_by"
|
|
|
- initialValue={user?.CName}
|
|
|
- label="审核人:"
|
|
|
- >
|
|
|
- <Input disabled />
|
|
|
- </Form.Item>
|
|
|
- <Form.Item name="is_pass" initialValue={1} label="审核意见:">
|
|
|
- <Select
|
|
|
- onChange={(e) => {
|
|
|
- setIsPass(e);
|
|
|
- }}
|
|
|
- style={{ width: '100%' }}
|
|
|
- options={[
|
|
|
- {
|
|
|
- value: 1,
|
|
|
- label: '同意',
|
|
|
- },
|
|
|
- {
|
|
|
- value: 2,
|
|
|
- label: '拒绝',
|
|
|
- },
|
|
|
- ]}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={10}>
|
|
|
- <Form.Item
|
|
|
- name="check_date"
|
|
|
- initialValue={dayjs().format(FORMAT)}
|
|
|
- label="审核时间:"
|
|
|
- >
|
|
|
- <Input disabled />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- {isPass == 2 && (
|
|
|
- <Form.Item
|
|
|
- name="check_desc"
|
|
|
- label="拒绝原因:"
|
|
|
- labelCol={{ span: 4 }}
|
|
|
- >
|
|
|
- <Input.TextArea />
|
|
|
- </Form.Item>
|
|
|
- )}
|
|
|
- </>
|
|
|
- )}
|
|
|
->>>>>>> master
|
|
|
{(type == Type.cancel || data?.status >= Status.CalChecking) && (
|
|
|
<>
|
|
|
<ModuleTitle title="作废信息" />
|
|
@@ -1435,63 +1158,7 @@ const ContractModal = (props) => {
|
|
|
</div>
|
|
|
</>
|
|
|
)}
|
|
|
-<<<<<<< HEAD
|
|
|
{(type == Type.add || data?.status == Status.ReCall || forceModify) &&
|
|
|
-=======
|
|
|
- {isSuper && data.status == Status.CalChecking && (
|
|
|
- <>
|
|
|
- <ModuleTitle title="审核情况" />
|
|
|
- <Row>
|
|
|
- <Col span={10} offset={1}>
|
|
|
- <Form.Item
|
|
|
- name="cancel_check_by"
|
|
|
- initialValue={user?.CName}
|
|
|
- label="审核人:"
|
|
|
- >
|
|
|
- <Input disabled />
|
|
|
- </Form.Item>
|
|
|
- <Form.Item name="is_pass" initialValue={1} label="审核意见:">
|
|
|
- <Select
|
|
|
- onChange={(e) => {
|
|
|
- setIsPass(e);
|
|
|
- }}
|
|
|
- style={{ width: '100%' }}
|
|
|
- options={[
|
|
|
- {
|
|
|
- value: 1,
|
|
|
- label: '同意',
|
|
|
- },
|
|
|
- {
|
|
|
- value: 0,
|
|
|
- label: '拒绝',
|
|
|
- },
|
|
|
- ]}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={10}>
|
|
|
- <Form.Item
|
|
|
- name="check_date"
|
|
|
- initialValue={dayjs().format(FORMAT)}
|
|
|
- label="审核时间:"
|
|
|
- >
|
|
|
- <Input disabled />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
- {!isPass && (
|
|
|
- <Form.Item
|
|
|
- name="cancel_check_result"
|
|
|
- label="拒绝原因:"
|
|
|
- labelCol={{ span: 4 }}
|
|
|
- >
|
|
|
- <Input.TextArea />
|
|
|
- </Form.Item>
|
|
|
- )}
|
|
|
- </>
|
|
|
- )}
|
|
|
- {(type == Type.add || data?.status == Status.ReCall) &&
|
|
|
->>>>>>> master
|
|
|
auditList.length > 0 && (
|
|
|
<>
|
|
|
<ModuleTitle title="审批流程" />
|