lanjianrong преди 5 години
родител
ревизия
3c6b3ca7e3
променени са 4 файла, в които са добавени 69 реда и са изтрити 72 реда
  1. 6 6
      package.json
  2. 6 6
      src/components/EditableForm/src/editableFormItem.jsx
  3. 29 31
      src/pages/Customer/Company/index.jsx
  4. 28 29
      src/pages/Customer/Contact/index.jsx

+ 6 - 6
package.json

@@ -49,13 +49,13 @@
   "dependencies": {
     "@ant-design/icons": "^4.0.0",
     "@ant-design/pro-descriptions": "^1.0.19",
-    "@ant-design/pro-form": "^1.3.0",
+    "@ant-design/pro-form": "1.31.2",
     "@ant-design/pro-layout": "6.19.3",
-    "@ant-design/pro-table": "^2.9.16",
+    "@ant-design/pro-table": "2.43.4",
     "@icon-park/react": "^1.3.3",
     "@umijs/route-utils": "^1.0.33",
     "ahooks": "^2.10.0",
-    "antd": "^4.8.0",
+    "antd": "4.16.6",
     "classnames": "^2.2.6",
     "crypto-js": "^4.0.0",
     "dayjs": "^1.10.4",
@@ -64,10 +64,10 @@
     "moment": "^2.25.3",
     "omit.js": "^2.0.2",
     "qs": "^6.9.4",
-    "react": "^17.0.1",
-    "react-dom": "^17.0.1",
+    "react": "17.0.2",
+    "react-dom": "17.0.2",
     "react-helmet-async": "^1.0.4",
-    "umi": "^3.2.14",
+    "umi": "3.5.4",
     "use-merge-value": "^1.0.1"
   },
   "devDependencies": {

+ 6 - 6
src/components/EditableForm/src/editableFormItem.jsx

@@ -70,13 +70,13 @@ const EditableFormItem = ({
     function findTreeNode(tree, v) {
       let node = null
       tree?.some(n => {
-        if (n.value === v) {
+        if (n.value === v || n.id === v || n.key === v) {
           node = n
           return true
         }
-        return findTreeNode(n.children, v)
+        return n.children ? findTreeNode(n.children, v) : false
       })
-      return node
+      return node?.label || node?.name || node?.title
     }
     function reduceExtralVal(v) {
       if (editCellType === 'cascader') {
@@ -91,7 +91,7 @@ const EditableFormItem = ({
             }`
           }, '')
         }
-        return findTreeNode(options, v)?.label
+        return findTreeNode(options, v)
       }
       return options?.find(item => item.value === record)?.label || ''
     }
@@ -100,7 +100,7 @@ const EditableFormItem = ({
       val: record,
       extraVal: reduceExtralVal(record)
     })
-  }, [dataId])
+  }, [dataId, record])
 
   const toggleEdit = () => {
     setEditing(!editing)
@@ -220,7 +220,7 @@ const EditableFormItem = ({
     <Col span={span}>
       <Row wrap={false} className="border-t-1px border-hex-f3f3f3 border-solid pt-8px pb-8px">
         <Col flex="100px" className="text-right">
-          <span className="zh-lh-32 mr-10px">{label} :</span>
+          <span className="zh-lh-32 mr-10px">{label}:</span>
         </Col>
         <Col flex="auto">{cell}</Col>
       </Row>

+ 29 - 31
src/pages/Customer/Company/index.jsx

@@ -40,35 +40,35 @@ const Company = props => {
     const teamOptions = []
     personTags.forEach(item => {
       personOptions.push({ label: item.name, value: item.id })
-      // personTagMap[item.id] = {
-      //   text: (
-      //     <>
-      //       <span
-      //         className="zh-circle-icon zh-mg-right-3"
-      //         style={{ backgroundColor: personTagColorMap[item.id] }}
-      //       />
-      //       <span>{item.name}</span>
-      //     </>
-      //   )
-      // }
+      personTagMap[item.id] = {
+        text: (
+          <>
+            <span
+              className="zh-circle-icon zh-mg-right-3"
+              style={{ backgroundColor: personTagColorMap[item.id] }}
+            />
+            <span>{item.name}</span>
+          </>
+        )
+      }
     })
     teamTags.forEach(item => {
       teamOptions.push({ label: item.name, value: item.id })
-      // teamTagMap[item.id] = {
-      //   text: (
-      //     <>
-      //       <span
-      //         className="zh-square-icon zh-mg-right-3"
-      //         style={{ backgroundColor: teamTagColorMap[item.id] }}
-      //       />
-      //       <span>{item.name}</span>
-      //     </>
-      //   )
-      // }
+      teamTagMap[item.id] = {
+        text: (
+          <>
+            <span
+              className="zh-square-icon zh-mg-right-3"
+              style={{ backgroundColor: teamTagColorMap[item.id] }}
+            />
+            <span>{item.name}</span>
+          </>
+        )
+      }
     })
 
     return { personTagMap, teamTagMap, personOptions, teamOptions }
-  }, [personTags, teamTags, personTagColorMap, teamTagColorMap, loading])
+  }, [loading])
 
   const [state, setState] = useState({
     id: '',
@@ -175,14 +175,14 @@ const Company = props => {
       title: '个人标签',
       dataIndex: 'tagIds',
       width: 100,
-      // filters: true,
+      filters: true,
+      valueEnum: tag.personTagMap,
       valueType: 'select',
       fieldProps: {
         mode: 'multiple',
         options: tag.personOptions,
         showArrow: true
       },
-      // valueEnum: tag.personTagMap,
       render: (_, record) => (
         <div className="zh-align-center zh-flex-wrap">
           {record.tagIds.map(item => (
@@ -210,8 +210,8 @@ const Company = props => {
       dataIndex: 'tagCooperationIds',
       key: 'tagCooperationIds',
       width: 80,
-      // filters: true,
-      // valueEnum: tag.teamTagMap,
+      filters: true,
+      valueEnum: tag.teamTagMap,
       valueType: 'select',
       fieldProps: {
         mode: 'multiple',
@@ -430,10 +430,8 @@ const Company = props => {
       actionRef={tRef}
       params={state.params}
       request={async (params, sort, filter) => {
-        const {
-          code = -1,
-          data: { customer = [], total = 0 } = { customer: [], total: 0 }
-        } = await queryCompany({ ...params, ...sort, ...filter })
+        const { code = -1, data: { customer = [], total = 0 } = { customer: [], total: 0 } } =
+          await queryCompany({ ...params, ...sort, ...filter })
         setState({ ...state, orderIds: customer.map(item => item.id) })
         return {
           data: customer,

+ 28 - 29
src/pages/Customer/Contact/index.jsx

@@ -46,36 +46,36 @@ const Contact = props => {
     const teamOptions = []
     personTags.forEach(item => {
       personOptions.push({ label: item.name, value: item.id })
-      // personTagMap[item.id] = {
-      //   text: (
-      //     <>
-      //       <span
-      //         className="zh-circle-icon zh-mg-right-3"
-      //         style={{ backgroundColor: personTagColorMap[item.id] }}
-      //       />
-      //       <span>{item.name}</span>
-      //     </>
-      //   )
-      // }
+      personTagMap[item.id] = {
+        text: (
+          <>
+            <span
+              className="zh-circle-icon zh-mg-right-3"
+              style={{ backgroundColor: personTagColorMap[item.id] }}
+            />
+            <span>{item.name}</span>
+          </>
+        )
+      }
     })
 
     teamTags.forEach(item => {
       teamOptions.push({ label: item.name, value: item.id })
-      // teamTagMap[item.id] = {
-      //   text: (
-      //     <>
-      //       <span
-      //         className="zh-square-icon zh-mg-right-3"
-      //         style={{ backgroundColor: teamTagColorMap[item.id] }}
-      //       />
-      //       <span>{item.name}</span>
-      //     </>
-      //   )
-      // }
+      teamTagMap[item.id] = {
+        text: (
+          <>
+            <span
+              className="zh-square-icon zh-mg-right-3"
+              style={{ backgroundColor: teamTagColorMap[item.id] }}
+            />
+            <span>{item.name}</span>
+          </>
+        )
+      }
     })
 
     return { personTagMap, teamTagMap, personOptions, teamOptions }
-  }, [personTags, teamTags, personTagColorMap, teamTagColorMap, loading])
+  }, [loading])
 
   const toolbarOptionsChange = (type, ids) => {
     setTagState({ ...tagState, [type]: ids })
@@ -238,6 +238,9 @@ const Contact = props => {
       dataIndex: 'tagIds',
       key: 'tagIds',
       width: 60,
+      filters: true,
+      // onFilter: true,
+      valueEnum: tag.personTagMap,
       valueType: 'select',
       fieldProps: {
         mode: 'multiple',
@@ -265,15 +268,14 @@ const Contact = props => {
           </PersonLabel>
         </div>
       )
-      // filters: true
-      // onFilter: true,
-      // valueEnum: tag.personTagMap
     },
     {
       title: '协作标签',
       dataIndex: 'tagCooperationIds',
       key: 'tagCooperationIds',
       width: 60,
+      filters: true,
+      valueEnum: tag.teamTagMap,
       valueType: 'select',
       fieldProps: {
         mode: 'multiple',
@@ -302,9 +304,6 @@ const Contact = props => {
           </PersonLabel>
         </div>
       )
-      // filters: true,
-      // valueType: 'select',
-      // valueEnum: tag.teamTagMap
     },
     {
       title: '地址',