|
@@ -66,8 +66,9 @@ let isInLine = location.host.includes('work.greentech.com');
|
|
|
const ContractModal = (props) => {
|
|
|
const [form] = Form.useForm();
|
|
|
const {
|
|
|
- initialState: { user },
|
|
|
+ initialState,
|
|
|
} = useModel('@@initialState');
|
|
|
+ const user = initialState?.user || {}
|
|
|
const { userList, run: userListRun } = useModel('userList');
|
|
|
const { depList, run: depListRun } = useModel('depList');
|
|
|
const [auditList, setAuditList] = useState([]);
|
|
@@ -97,6 +98,10 @@ 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);
|
|
@@ -107,9 +112,12 @@ 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);
|
|
@@ -219,6 +227,7 @@ const ContractModal = (props) => {
|
|
|
manual: true,
|
|
|
formatResult: (response) => response.data,
|
|
|
});
|
|
|
+<<<<<<< HEAD
|
|
|
|
|
|
//填写表单时计算审批流接口
|
|
|
const { run: runAuditList } = useRequest(
|
|
@@ -254,7 +263,42 @@ 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: [
|
|
@@ -273,7 +317,82 @@ 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 }),
|
|
@@ -406,6 +525,55 @@ 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;
|
|
@@ -422,12 +590,16 @@ 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);
|
|
@@ -441,6 +613,7 @@ const ContractModal = (props) => {
|
|
|
runAuditList(param);
|
|
|
}, [company, archives_dep]);
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
//根据项目名称填充项目编号逻辑
|
|
|
useEffect(() => {
|
|
|
if (
|
|
@@ -449,6 +622,10 @@ 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;
|
|
@@ -458,7 +635,10 @@ const ContractModal = (props) => {
|
|
|
form.setFieldsValue({ project_code: '' });
|
|
|
}
|
|
|
}, [project_name]);
|
|
|
+<<<<<<< HEAD
|
|
|
|
|
|
+=======
|
|
|
+>>>>>>> master
|
|
|
const supplyList = useMemo(() => {
|
|
|
return companyData ? [...companyData, ...supplierList] : supplierList;
|
|
|
}, [companyData, supplierList]);
|
|
@@ -553,10 +733,14 @@ 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);
|
|
@@ -578,6 +762,23 @@ 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
|
|
|
}
|
|
|
});
|
|
|
};
|
|
@@ -609,6 +810,7 @@ const ContractModal = (props) => {
|
|
|
const renderFooter = () => {
|
|
|
return (
|
|
|
<Space>
|
|
|
+<<<<<<< HEAD
|
|
|
{data?.status == Status.Checking && (
|
|
|
<Button onClick={() => handlerReCall(auditData?.id)}>撤回</Button>
|
|
|
)}
|
|
@@ -630,13 +832,22 @@ 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
|
|
@@ -1021,9 +1232,13 @@ 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>
|
|
@@ -1083,7 +1298,11 @@ const ContractModal = (props) => {
|
|
|
</div>
|
|
|
}
|
|
|
>
|
|
|
+<<<<<<< HEAD
|
|
|
{type == Type.add || forceModify ? (
|
|
|
+=======
|
|
|
+ {type == Type.add ? (
|
|
|
+>>>>>>> master
|
|
|
<Upload {...UploadPropsExtend}>
|
|
|
<Button icon={<CloudUploadOutlined />}>Upload</Button>
|
|
|
</Upload>
|
|
@@ -1103,7 +1322,11 @@ const ContractModal = (props) => {
|
|
|
</Col>
|
|
|
</Row>
|
|
|
|
|
|
+<<<<<<< HEAD
|
|
|
{data?.status >= Status.Checking && !forceModify && (
|
|
|
+=======
|
|
|
+ {data?.status >= Status.Checking && (
|
|
|
+>>>>>>> master
|
|
|
<>
|
|
|
<ModuleTitle title="归档流程" />
|
|
|
<div className={styles.modelItem}>
|
|
@@ -1111,6 +1334,61 @@ 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="作废信息" />
|
|
@@ -1157,7 +1435,63 @@ 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="审批流程" />
|