浏览代码

保存草稿不填合同名称添加提示

Renxy 2 年之前
父节点
当前提交
38714f0767
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      src/pages/ContractManager/component/Modal.jsx

+ 7 - 3
src/pages/ContractManager/component/Modal.jsx

@@ -93,7 +93,6 @@ const ContractModal = (props) => {
       ID: '行政部',
     },
   ];
-
   const [companyDepList, setCompanyDepList] = useState(depList || []);
   const [archivesDepList, setArchivesDepList] = useState(archivesOptions);
   const [dealDisable, setDealDisable] = useState(false);
@@ -543,6 +542,10 @@ const ContractModal = (props) => {
 
   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
@@ -556,7 +559,6 @@ const ContractModal = (props) => {
       content: JSON.stringify(values),
     };
     if (data?.id) params.id = data?.id;
-    console.log(values, params);
     handleOk(params, Type.save);
   };
 
@@ -800,7 +802,9 @@ const ContractModal = (props) => {
               <Form.Item
                 name="effect_on"
                 label="合同签订日期:"
-                initialValue={dayjs(data?.effect_on, FORMAT)}
+                initialValue={
+                  data?.effect_on ? dayjs(data?.effect_on, FORMAT) : ''
+                }
                 tooltip="合同主体各方签字盖章完成之日,以最后签字盖章的为准"
                 rules={[
                   {