lanjianrong 5 лет назад
Родитель
Сommit
f086f9c734

+ 3 - 3
src/pages/Customer/Company/components/PersonLabel/index.jsx

@@ -62,12 +62,12 @@ const PersonLabel = props => {
   const [dropdownType, setDropdownType] = useState(DropdownTypeEnum.check)
 
   if (modeType === 0) {
-    console.log('tagIds', tagIds)
+    // console.log('tagIds', tagIds)
   }
   const [checkedIds, setCheckedIds] = useState([...tagIds])
 
   if (modeType === 0) {
-    console.log('222', checkedIds)
+    // console.log('222', checkedIds)
   }
 
   const [showOkBtn, setShowOkBtn] = useState(false)
@@ -150,7 +150,7 @@ const DropDownMenu = props => {
     initCallBack
   } = props
 
-  console.log('checkedIds', checkedIds)
+  // console.log('checkedIds', checkedIds)
 
   const [activeState, setActiveState] = useState({
     id: '',

+ 70 - 73
src/pages/Customer/Contact/index.jsx

@@ -36,19 +36,22 @@ const Contact = props => {
     setSelectKeys(selectedRowKeys)
   }
 
+  const [searchOpt, setSearchOpt] = useState({
+    page: 1,
+    size: 20
+  })
   const [state, setState] = useState({
     data: [],
     journal: [],
     servicelog: [],
-    total: 0,
-    page: 1,
-    size: 20,
     loading: false,
+    total: 0,
     id: '',
     tail: { department: 0, email: 0, telephone: 0 }
   })
 
-  const initData = async payload => {
+  const initData = async (payload = searchOpt) => {
+    console.log('payload', payload)
     setState({ ...state, loading: true })
     const {
       code = -1,
@@ -61,7 +64,6 @@ const Contact = props => {
       }
     } = await queryContact(payload)
     if (code === consts.RET_CODE.SUCCESS) {
-      console.log(payload?.page, state.page)
       setState({
         ...state,
         data: client,
@@ -69,9 +71,9 @@ const Contact = props => {
         servicelist: serviceLog,
         total,
         tail,
-        loading: false,
-        page: payload?.page || state.page
+        loading: false
       })
+      setSearchOpt({ ...searchOpt, ...payload })
     }
   }
 
@@ -447,6 +449,66 @@ const Contact = props => {
     initData()
   }
 
+  const renderTableAlert = ({ selectedRowKeys }) => {
+    return (
+      <div className="zh-flex-row">
+        <div className="zh-mg-right-5">
+          <PersonLabel
+            tagType={TagTypeEnum.PERSONTAG}
+            tagColumn={TagDataTypeEnum.CONTACT}
+            checkCallBack={toolbarOptionsChange}
+            modeType={LabelModeType.toolbar}>
+            {tagState.tagIds.length ? (
+              <Button>
+                {tagState.tagIds.map(item => (
+                  <span
+                    key={item}
+                    className="zh-circle-icon zh-mg-right-3"
+                    style={{ backgroundColor: personTagColorMap[item] }}
+                  />
+                ))}
+                <IconPark type="down" />
+              </Button>
+            ) : (
+              <Button>
+                个人标签
+                <IconPark type="down" />
+              </Button>
+            )}
+          </PersonLabel>
+        </div>
+        <div className="zh-mg-right-5">
+          <PersonLabel
+            tagType={TagTypeEnum.TEAMTAG}
+            tagColumn={TagDataTypeEnum.CONTACT}
+            checkCallBack={toolbarOptionsChange}
+            modeType={LabelModeType.toolbar}>
+            {tagState.tagCooperationIds.length ? (
+              <Button>
+                {tagState.tagCooperationIds.map(item => (
+                  <span
+                    key={item}
+                    className="zh-square-icon zh-mg-right-3"
+                    style={{ backgroundColor: teamTagColorMap[item] }}
+                  />
+                ))}
+                <IconPark type="down" />
+              </Button>
+            ) : (
+              <Button>
+                协作标签
+                <IconPark type="down" />
+              </Button>
+            )}
+          </PersonLabel>
+        </div>
+        <Button onClick={() => tagsSettingConfirm(selectedRowKeys)}>
+          <IconPark type="check" size={14} />
+          确认
+        </Button>
+      </div>
+    )
+  }
   return (
     <ProTable
       loading={state.loading}
@@ -471,66 +533,7 @@ const Contact = props => {
           initData({ page, size })
         }
       }}
-      tableAlertRender={({ selectedRowKeys }) => {
-        return (
-          <div className="zh-flex-row">
-            <div className="zh-mg-right-5">
-              <PersonLabel
-                tagType={TagTypeEnum.PERSONTAG}
-                tagColumn={TagDataTypeEnum.CONTACT}
-                checkCallBack={toolbarOptionsChange}
-                modeType={LabelModeType.toolbar}>
-                {tagState.tagIds.length ? (
-                  <Button>
-                    {tagState.tagIds.map(item => (
-                      <span
-                        key={item}
-                        className="zh-circle-icon zh-mg-right-3"
-                        style={{ backgroundColor: personTagColorMap[item] }}
-                      />
-                    ))}
-                    <IconPark type="down" />
-                  </Button>
-                ) : (
-                  <Button>
-                    个人标签
-                    <IconPark type="down" />
-                  </Button>
-                )}
-              </PersonLabel>
-            </div>
-            <div className="zh-mg-right-5">
-              <PersonLabel
-                tagType={TagTypeEnum.TEAMTAG}
-                tagColumn={TagDataTypeEnum.CONTACT}
-                checkCallBack={toolbarOptionsChange}
-                modeType={LabelModeType.toolbar}>
-                {tagState.tagCooperationIds.length ? (
-                  <Button>
-                    {tagState.tagCooperationIds.map(item => (
-                      <span
-                        key={item}
-                        className="zh-square-icon zh-mg-right-3"
-                        style={{ backgroundColor: teamTagColorMap[item] }}
-                      />
-                    ))}
-                    <IconPark type="down" />
-                  </Button>
-                ) : (
-                  <Button>
-                    协作标签
-                    <IconPark type="down" />
-                  </Button>
-                )}
-              </PersonLabel>
-            </div>
-            <Button onClick={() => tagsSettingConfirm(selectedRowKeys)}>
-              <IconPark type="check" size={14} />
-              确认
-            </Button>
-          </div>
-        )
-      }}
+      tableAlertRender={renderTableAlert}
       rowSelection={{
         onChange: hanleRowSelectChange,
         type: 'checkbox'
@@ -551,12 +554,6 @@ const Contact = props => {
       columnsStateMap={columnsStateMap}
       onColumnsStateChange={map => setColumnsStateMap(map)}
       headerTitle="联系人"
-      // toolBarRender={() => [
-      //   <Button key="button" type="primary">
-      //     <SvgIcon type="icon-plus" />
-      //     联系人
-      //   </Button>
-      // ]}
     />
   )
 }