|
@@ -38,7 +38,7 @@ export const Type = {
|
|
|
add: 0, //新增
|
|
|
detail: 1, //详情
|
|
|
cancel: 2, //作废
|
|
|
- check: 3, //审核
|
|
|
+ save: 3, //保存草稿
|
|
|
};
|
|
|
|
|
|
export const StatusText = [
|
|
@@ -61,13 +61,10 @@ export const Status = {
|
|
|
CalCheckSuccess: 6,
|
|
|
};
|
|
|
|
|
|
-let isInLine = location.host.includes('work.greentech.com');
|
|
|
-
|
|
|
const ContractModal = (props) => {
|
|
|
const [form] = Form.useForm();
|
|
|
- const {
|
|
|
- initialState: { user },
|
|
|
- } = useModel('@@initialState');
|
|
|
+ const { initialState } = useModel('@@initialState');
|
|
|
+ const user = initialState?.user || {};
|
|
|
const { userList, run: userListRun } = useModel('userList');
|
|
|
const { depList, run: depListRun } = useModel('depList');
|
|
|
const [auditList, setAuditList] = useState([]);
|
|
@@ -96,8 +93,6 @@ const ContractModal = (props) => {
|
|
|
ID: '行政部',
|
|
|
},
|
|
|
];
|
|
|
-
|
|
|
- const [isPass, setIsPass] = useState(1);
|
|
|
const [companyDepList, setCompanyDepList] = useState(depList || []);
|
|
|
const [archivesDepList, setArchivesDepList] = useState(archivesOptions);
|
|
|
const [dealDisable, setDealDisable] = useState(false);
|
|
@@ -120,76 +115,38 @@ const ContractModal = (props) => {
|
|
|
const parent_code = Form.useWatch('parent_code', form);
|
|
|
|
|
|
//审批流拼接
|
|
|
- const formData = isInLine
|
|
|
- ? [
|
|
|
- {
|
|
|
- name: '是否本部',
|
|
|
- id: 'DDSelectField_4ad8bda8-60ce-428b-88a3-bf1a18c24a50',
|
|
|
- type: 'DDSelectField',
|
|
|
- value: ['是'],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '合同归档部门',
|
|
|
- id: 'DDSelectField_3b661423-9fb8-4498-9eda-bcadf2d98473',
|
|
|
- type: 'DDSelectField',
|
|
|
- value: ['财务部'],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '合同编码',
|
|
|
- id: 'TextField_f73531d8-c2c0-4769-a8ef-68b2eae2dc3a',
|
|
|
- type: 'TextField',
|
|
|
- value: ['1'],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '提审类型',
|
|
|
- id: 'DDSelectField_bed77d5f-d02c-4f1d-98bf-0638245a3331',
|
|
|
- type: 'DDSelectField',
|
|
|
- value: ['1'],
|
|
|
- },
|
|
|
- ]
|
|
|
- : [
|
|
|
- {
|
|
|
- name: '是否本部',
|
|
|
- id: 'DDSelectField_4fbddb04-9b4f-4281-991b-5047f835fb9d',
|
|
|
- type: 'DDSelectField',
|
|
|
- value: ['是'],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '合同归档部门',
|
|
|
- id: 'DDSelectField_1235c6b9-9d74-4856-a62d-6ca1bb9716a6',
|
|
|
- type: 'DDSelectField',
|
|
|
- value: ['财务部'],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '合同编码',
|
|
|
- id: 'TextField_1a01000b-4458-4dfb-bd13-74a74e7a33e5',
|
|
|
- type: 'TextField',
|
|
|
- value: ['1'],
|
|
|
- },
|
|
|
- {
|
|
|
- name: '提审类型',
|
|
|
- id: 'DDSelectField_c79e124c-c933-4ea1-b799-faceaf830a9b',
|
|
|
- type: 'DDSelectField',
|
|
|
- value: ['1'],
|
|
|
- },
|
|
|
- ];
|
|
|
+ const formData = [
|
|
|
+ {
|
|
|
+ name: '是否本部',
|
|
|
+ id: 'DDSelectField_4ad8bda8-60ce-428b-88a3-bf1a18c24a50',
|
|
|
+ type: 'DDSelectField',
|
|
|
+ value: ['是'],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '合同归档部门',
|
|
|
+ id: 'DDSelectField_3b661423-9fb8-4498-9eda-bcadf2d98473',
|
|
|
+ type: 'DDSelectField',
|
|
|
+ value: ['财务部'],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '合同编码',
|
|
|
+ id: 'TextField_f73531d8-c2c0-4769-a8ef-68b2eae2dc3a',
|
|
|
+ type: 'TextField',
|
|
|
+ value: ['1'],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '提审类型',
|
|
|
+ id: 'DDSelectField_bed77d5f-d02c-4f1d-98bf-0638245a3331',
|
|
|
+ type: 'DDSelectField',
|
|
|
+ value: ['1'],
|
|
|
+ },
|
|
|
+ ];
|
|
|
|
|
|
//计算审批流数据
|
|
|
const advance = {
|
|
|
- flow_id: isInLine ? 47 : 40,
|
|
|
+ flow_id: 47,
|
|
|
form_list: null,
|
|
|
- // node_level_id:0,
|
|
|
- // id:0,
|
|
|
- // project_id:0,
|
|
|
- // cur_template_node_id:0,
|
|
|
- // next_template_node_id:0,
|
|
|
- // template_node_id:0,
|
|
|
- // flow_path:null,
|
|
|
- // template_id:0,
|
|
|
- // cur_template_id:0,
|
|
|
- // next_template_id:0,
|
|
|
formComponentValues: '',
|
|
|
- // audit_list:[],
|
|
|
};
|
|
|
|
|
|
//旧审批流兼容
|
|
@@ -316,7 +273,6 @@ const ContractModal = (props) => {
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (!visible) {
|
|
|
- setIsPass(1);
|
|
|
setDealDisable(false);
|
|
|
setAuditList([]);
|
|
|
setCompanyDepList([]);
|
|
@@ -329,6 +285,14 @@ const ContractModal = (props) => {
|
|
|
}
|
|
|
}, [visible]);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ //兼容之前选择的所属部门,用的现在的接口匹配不到部门显示数字的问题
|
|
|
+ if (data?.company_id) {
|
|
|
+ const deps = getDepItemById(data?.company_id)?.children;
|
|
|
+ setCompanyDepList(deps);
|
|
|
+ }
|
|
|
+ }, [data, depList]);
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
form.resetFields();
|
|
|
if (data?.status >= Status.Checking) runAudit({ extend_code: data.code });
|
|
@@ -358,17 +322,7 @@ const ContractModal = (props) => {
|
|
|
(data?.status == Status.CheckReject && forceModify)
|
|
|
)
|
|
|
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, forceModify]);
|
|
|
+ }, [data, type, forceModify]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (
|
|
@@ -438,6 +392,7 @@ const ContractModal = (props) => {
|
|
|
runAuditList(param);
|
|
|
}, [company, archives_dep]);
|
|
|
|
|
|
+ //根据项目名称填充项目编号逻辑
|
|
|
useEffect(() => {
|
|
|
if (
|
|
|
type !== Type.add &&
|
|
@@ -464,9 +419,9 @@ const ContractModal = (props) => {
|
|
|
if (forceModify && data?.status == Status.CheckReject) {
|
|
|
return { contract: false, recall: false };
|
|
|
}
|
|
|
- if (data?.status == Status.ReCall) {
|
|
|
- return { contract: false, recall: true };
|
|
|
- }
|
|
|
+ // if (data?.status == Status.ReCall) {
|
|
|
+ // return { contract: false, recall: true };
|
|
|
+ // }
|
|
|
if (data?.status > Status.None) {
|
|
|
return { contract: true, recall: true };
|
|
|
}
|
|
@@ -574,24 +529,32 @@ const ContractModal = (props) => {
|
|
|
values.created_by = user?.ID;
|
|
|
values.id = data?.id;
|
|
|
handleOk(values, Type.add, form, audit_list);
|
|
|
- } 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);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ const handleSaveDraft = () => {
|
|
|
+ let values = form.getFieldsValue();
|
|
|
+ if (!values.name) {
|
|
|
+ message.error('请填写合同名称!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Object.keys(values).forEach((key) => {
|
|
|
+ if (Array.isArray(values[key]))
|
|
|
+ values[key].length == 0
|
|
|
+ ? delete values[key]
|
|
|
+ : (values[key] = JSON.stringify(values[key]));
|
|
|
+ });
|
|
|
+ if (values.effect_on)
|
|
|
+ values.effect_on = dayjs(values.effect_on).format(FORMAT);
|
|
|
+ const params = {
|
|
|
+ name: values.name,
|
|
|
+ content: JSON.stringify(values),
|
|
|
+ };
|
|
|
+ if (data?.id) params.id = data?.id;
|
|
|
+ handleOk(params, Type.save);
|
|
|
+ };
|
|
|
+
|
|
|
const getDepItemById = (id) => {
|
|
|
const fun = (list) => {
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -619,7 +582,7 @@ const ContractModal = (props) => {
|
|
|
const renderFooter = () => {
|
|
|
return (
|
|
|
<Space>
|
|
|
- {data?.status == Status.Checking && type !== Type.check && (
|
|
|
+ {data?.status == Status.Checking && (
|
|
|
<Button onClick={() => handlerReCall(auditData?.id)}>撤回</Button>
|
|
|
)}
|
|
|
<Button
|
|
@@ -640,6 +603,11 @@ const ContractModal = (props) => {
|
|
|
修改
|
|
|
</Button>
|
|
|
)}
|
|
|
+ {type == Type.add && (
|
|
|
+ <Button type="primary" onClick={handleSaveDraft}>
|
|
|
+ 保存草稿
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
<Button type="primary" onClick={handleSubmit} disabled={!isSuper}>
|
|
|
提交
|
|
|
</Button>
|
|
@@ -678,7 +646,10 @@ const ContractModal = (props) => {
|
|
|
name="company_id"
|
|
|
label="所属公司:"
|
|
|
tooltip="请选择该存档合同所属公司"
|
|
|
- initialValue={data?.company_id}
|
|
|
+ initialValue={
|
|
|
+ //不可编辑的时候直接赋值为company_name
|
|
|
+ !disableds.contract ? data?.company_id : data?.company_name
|
|
|
+ }
|
|
|
rules={[
|
|
|
{
|
|
|
required: true,
|
|
@@ -690,7 +661,7 @@ const ContractModal = (props) => {
|
|
|
showSearch
|
|
|
style={{ width: '100%' }}
|
|
|
placeholder="请选择"
|
|
|
- disabled={disableds.contract || disableds.recall}
|
|
|
+ disabled={disableds.contract}
|
|
|
filterOption={(input, option) =>
|
|
|
(option?.label ?? '')
|
|
|
.toLowerCase()
|
|
@@ -724,24 +695,7 @@ const ContractModal = (props) => {
|
|
|
},
|
|
|
]}
|
|
|
>
|
|
|
- <Select
|
|
|
- showSearch
|
|
|
- style={{ width: '100%' }}
|
|
|
- placeholder="请选择"
|
|
|
- disabled={disableds.contract || disableds.recall}
|
|
|
- filterOption={(input, option) =>
|
|
|
- (option?.label ?? '')
|
|
|
- .toLowerCase()
|
|
|
- .includes(input.toLowerCase())
|
|
|
- }
|
|
|
- options={companyDepList?.map((item) => {
|
|
|
- return {
|
|
|
- value: item.ID,
|
|
|
- label: item.Name,
|
|
|
- };
|
|
|
- })}
|
|
|
- />
|
|
|
- {/* <TreeSelect
|
|
|
+ <TreeSelect
|
|
|
style={{ width: '100%' }}
|
|
|
placeholder="请选择"
|
|
|
showSearch
|
|
@@ -751,10 +705,10 @@ const ContractModal = (props) => {
|
|
|
value: 'ID',
|
|
|
children: 'children',
|
|
|
}}
|
|
|
- disabled={disableds.contract || disableds.recall}
|
|
|
+ disabled={disableds.contract}
|
|
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
treeData={companyDepList}
|
|
|
- /> */}
|
|
|
+ />
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
</Row>
|
|
@@ -789,24 +743,7 @@ const ContractModal = (props) => {
|
|
|
},
|
|
|
]}
|
|
|
>
|
|
|
- <Select
|
|
|
- showSearch
|
|
|
- style={{ width: '100%' }}
|
|
|
- placeholder="请选择"
|
|
|
- disabled={disableds.contract}
|
|
|
- filterOption={(input, option) =>
|
|
|
- (option?.label ?? '')
|
|
|
- .toLowerCase()
|
|
|
- .includes(input.toLowerCase())
|
|
|
- }
|
|
|
- options={companyDepList?.map((item) => {
|
|
|
- return {
|
|
|
- value: item.ID,
|
|
|
- label: item.Name,
|
|
|
- };
|
|
|
- })}
|
|
|
- />
|
|
|
- {/* <TreeSelect
|
|
|
+ <TreeSelect
|
|
|
style={{ width: '100%' }}
|
|
|
placeholder="请选择"
|
|
|
showSearch
|
|
@@ -819,7 +756,7 @@ const ContractModal = (props) => {
|
|
|
}}
|
|
|
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
treeData={companyDepList}
|
|
|
- /> */}
|
|
|
+ />
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
</Row>
|
|
@@ -839,7 +776,7 @@ const ContractModal = (props) => {
|
|
|
},
|
|
|
]}
|
|
|
>
|
|
|
- <Radio.Group disabled={disableds.contract || disableds.recall}>
|
|
|
+ <Radio.Group disabled={disableds.contract}>
|
|
|
<Radio value={1}>是</Radio>
|
|
|
<Radio value={0}>否</Radio>
|
|
|
</Radio.Group>
|
|
@@ -861,7 +798,9 @@ const ContractModal = (props) => {
|
|
|
<Form.Item
|
|
|
name="effect_on"
|
|
|
label="合同签订日期:"
|
|
|
- initialValue={data?.effect_on}
|
|
|
+ initialValue={
|
|
|
+ data?.effect_on ? dayjs(data?.effect_on, FORMAT) : ''
|
|
|
+ }
|
|
|
tooltip="合同主体各方签字盖章完成之日,以最后签字盖章的为准"
|
|
|
rules={[
|
|
|
{
|
|
@@ -870,14 +809,10 @@ const ContractModal = (props) => {
|
|
|
},
|
|
|
]}
|
|
|
>
|
|
|
- {type == Type.add ? (
|
|
|
- <DatePicker
|
|
|
- style={{ width: '100%' }}
|
|
|
- disabled={disableds.contract}
|
|
|
- />
|
|
|
- ) : (
|
|
|
- <Input disabled={disableds.contract} />
|
|
|
- )}
|
|
|
+ <DatePicker
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ disabled={disableds.contract}
|
|
|
+ />
|
|
|
</Form.Item>
|
|
|
<Form.Item
|
|
|
name="project_name"
|
|
@@ -949,10 +884,7 @@ const ContractModal = (props) => {
|
|
|
: []
|
|
|
}
|
|
|
>
|
|
|
- <Input
|
|
|
- placeholder="请填写"
|
|
|
- disabled={disableds.contract || disableds.recall}
|
|
|
- />
|
|
|
+ <Input placeholder="请填写" disabled={disableds.contract} />
|
|
|
</Form.Item>
|
|
|
<Form.Item
|
|
|
name="code"
|
|
@@ -1021,7 +953,7 @@ const ContractModal = (props) => {
|
|
|
name="party_c"
|
|
|
label="丙方(及其他):"
|
|
|
tooltip="可多选。合同主体可以下拉选择,可选项需要经办人在“主页--供应商管理”中创建。经办人可以维护和更新供应商信息。"
|
|
|
- initialValue={data?.party_c ? data?.party_c.split(',') : []}
|
|
|
+ initialValue={data?.party_c ? data?.party_c?.split(',') : []}
|
|
|
labelCol={{ span: 4 }}
|
|
|
>
|
|
|
<Select
|
|
@@ -1155,58 +1087,6 @@ const ContractModal = (props) => {
|
|
|
</div>
|
|
|
</>
|
|
|
)}
|
|
|
- {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>
|
|
|
- )}
|
|
|
- </>
|
|
|
- )}
|
|
|
{(type == Type.cancel || data?.status >= Status.CalChecking) && (
|
|
|
<>
|
|
|
<ModuleTitle title="作废信息" />
|
|
@@ -1253,58 +1133,6 @@ const ContractModal = (props) => {
|
|
|
</div>
|
|
|
</>
|
|
|
)}
|
|
|
- {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 || forceModify) &&
|
|
|
auditList.length > 0 && (
|
|
|
<>
|