Ver código fonte

合同管理增加日常项目

xjj 2 anos atrás
pai
commit
8b5574e2a3

+ 18 - 8
src/pages/ContractManager/component/Modal.jsx

@@ -282,6 +282,23 @@ const ContractModal = (props) => {
     return fun(depList);
   };
 
+  const projectNameList = useMemo(() => {
+    let arr =
+      projectList?.map((item) => {
+        return {
+          key: item.id,
+          value: item.project_name,
+        };
+      }) || [];
+    return [
+      {
+        key: 10000,
+        value: '日常项目',
+      },
+      ...arr,
+    ];
+  }, [projectList]);
+
   return (
     <Modal
       width={'85%'}
@@ -504,14 +521,7 @@ const ContractModal = (props) => {
                 },
               ]}
             >
-              <InputSelect
-                list={projectList?.map((item) => {
-                  return {
-                    key: item.id,
-                    value: item.project_name,
-                  };
-                })}
-              />
+              <InputSelect list={projectNameList} />
               {/* <Select
                 style={{ width: '100%' }}
                 placeholder="请选择"

+ 19 - 7
src/pages/ContractManager/index.jsx

@@ -1,4 +1,4 @@
-import React, { useState, useRef, useEffect } from 'react';
+import React, { useState, useRef, useEffect, useMemo } from 'react';
 import {
   Button,
   DatePicker,
@@ -332,6 +332,23 @@ const ConteactManager = (props) => {
     }
   };
 
+  const projectNameList = useMemo(() => {
+    let arr =
+      projectData?.list?.map((item) => {
+        return {
+          value: item.project_name,
+          label: item.project_name,
+        };
+      }) || [];
+    return [
+      {
+        value: '日常项目',
+        label: '日常项目',
+      },
+      ...arr,
+    ];
+  }, [projectData]);
+
   const handleOk = (data) => {
     if (typeRef.current == Type.add) {
       editRun(data);
@@ -369,12 +386,7 @@ const ConteactManager = (props) => {
                 project_name: e,
               });
             }}
-            options={projectData?.list?.map((item) => {
-              return {
-                value: item.project_name,
-                label: item.project_name,
-              };
-            })}
+            options={projectNameList}
           />
         </div>
         <div className={styles.itemFlex}>