Jelajahi Sumber

feat: 调整单位触发数据刷新逻辑

lanjianrong 4 tahun lalu
induk
melakukan
1639b4c8f6

+ 7 - 10
src/pages/Customer/Business/components/BusinessDetail/Form.jsx

@@ -8,7 +8,7 @@ import ChangeCompanyInput, {
 import Step from './Step/index'
 
 const Form = props => {
-  const { business, groupStatus, updateKey, isOwner } = props
+  const { updatePayload, business, groupStatus, isOwner } = props
 
   const isEnd = useMemo(() => {
     return groupStatus.findIndex(item => item.endProcess && item.selected) !== -1
@@ -19,16 +19,9 @@ const Form = props => {
     customerId: business.customerId,
     targetName: business.name,
     dataId: business.id,
-    actionPayload: ChangeCompMap.BUSINESS.key,
     title: ChangeCompMap.BUSINESS.title
   }
 
-  // const changeStaffOpt = {
-  //   responsibleId: business.responsibleId,
-  //   dataId: business.id,
-  //   actionPayload: ChangeCompMap.BUSINESS.key,
-  //   text: business.responsible
-  // }
   const columns = [
     {
       dataIndex: 'name',
@@ -40,7 +33,11 @@ const Form = props => {
       label: '单位名称',
       editCellType: 'custom',
       customCell: (
-        <ChangeCompanyInput dataSource={changeCopInputData} editable={!isOwner ? false : !isEnd} />
+        <ChangeCompanyInput
+          actionPayload={updatePayload}
+          dataSource={changeCopInputData}
+          editable={!isOwner ? false : !isEnd}
+        />
       ),
       span: 24
     },
@@ -94,7 +91,7 @@ const Form = props => {
         dataSource={business}
         columns={columns}
         tartgetUrl="/business/update"
-        type={updateKey}
+        type={updatePayload}
         editable={!isOwner ? false : !isEnd}
       />
     </div>

+ 2 - 2
src/pages/Customer/Business/components/BusinessDetail/TabList.jsx

@@ -50,7 +50,7 @@ const ContanctTabList = ({ businessId, clientList, isOwner }) => {
       message.success('新增成功')
       dispatch({
         type: 'refresh/commitAction',
-        payload: ChangeCompMap.BUSINESS.key
+        payload: { main: ChangeCompMap.BUSINESS.key, target: businessId }
       })
     }
   }
@@ -61,7 +61,7 @@ const ContanctTabList = ({ businessId, clientList, isOwner }) => {
   const refreshClient = () => {
     dispatch({
       type: 'refresh/commitAction',
-      payload: ChangeCompMap.BUSINESS.key
+      payload: { main: ChangeCompMap.BUSINESS.key, target: businessId }
     })
   }
 

+ 7 - 4
src/pages/Customer/Business/components/BusinessDetail/index.jsx

@@ -18,10 +18,10 @@ const Detail = props => {
     dispatch,
     updateKey = 'business',
     refresh,
-    dataId = '',
+    dataId,
     orderIds = []
   } = props
-  const shouldUpdate = refresh[updateKey] || false
+  const shouldUpdate = refresh[dataId ?? updateKey] || false
   const [state, setState] = useState({
     loading: false,
     business: {},
@@ -46,7 +46,10 @@ const Detail = props => {
       if (shouldUpdate) {
         dispatch({
           type: 'refresh/commitAction',
-          payload: 'business'
+          payload: {
+            main: updateKey,
+            target: dataId
+          }
         })
       }
       setState({
@@ -107,7 +110,7 @@ const Detail = props => {
                   isOwner={isOwner}
                   business={state.business}
                   groupStatus={state.groupStatus}
-                  updateKey={updateKey}
+                  updatePayload={{ main: updateKey, target: dataId }}
                 />
               </div>
             </Col>

+ 1 - 6
src/pages/Customer/Company/components/CompanyDetail/LowerList.jsx

@@ -53,12 +53,7 @@ const CompanyLowerList = props => {
                 renderItem={item => (
                   <List.Item>
                     <a>@{item.operatorName}</a> {item.content}
-                    <List.Item.Meta
-                      // avatar=
-                      // title=
-                      // description={ dayjsFormat(item.createTime, 'YYYY-MM-DD')}
-                      description={dayjsFormat(item.createTime)}
-                    />
+                    <List.Item.Meta description={dayjsFormat(item.createTime)} />
                   </List.Item>
                 )}
               />

+ 2 - 18
src/pages/Customer/Company/components/CompanyDetail/SyncClient.jsx

@@ -8,7 +8,7 @@ import { Table } from '@arco-design/web-react'
 import '@arco-design/web-react/dist/css/arco.css'
 import styles from './index.less'
 
-const SyncClient = ({ customer, client }) => {
+const SyncClient = ({ customer, client, actionPayload }) => {
   const dispatch = useDispatch()
   const [state, setState] = useState({
     visible: false,
@@ -20,11 +20,10 @@ const SyncClient = ({ customer, client }) => {
   const refreshCompany = () => {
     dispatch({
       type: 'refresh/commitAction',
-      payload: 'company'
+      payload: actionPayload
     })
   }
 
-  // eslint-disable-next-line consistent-return
   const handleOnConfirm = async () => {
     const { checkValues, selectedKeys } = state
     if (!checkValues?.length) {
@@ -80,7 +79,6 @@ const SyncClient = ({ customer, client }) => {
     {
       dataIndex: 'stay',
       title: '参考住宿',
-      // width: '15%',
       ellipsis: true
     }
   ]
@@ -97,8 +95,6 @@ const SyncClient = ({ customer, client }) => {
       >
         <Copy theme="two-tone" fill={['#333', '#886ab5']} />
         <span className="ml-1">同步地址信息</span>
-        {/* <div className="flex items-center justify-center">
-        </div> */}
       </Button>
       <Modal
         width="70%"
@@ -160,18 +156,6 @@ const SyncClient = ({ customer, client }) => {
             }}
           />
         </div>
-        {/* <Table
-          rowKey="id"
-          size="small"
-          columns={columns}
-          dataSource={client}
-          bordered
-          scroll={{ y: 400 }}
-          pagination={false}
-          rowSelection={{
-            onChange: selectedRowKeys => setState({ ...state, selectedKeys: selectedRowKeys })
-          }}
-        /> */}
       </Modal>
     </>
   )

+ 3 - 3
src/pages/Customer/Company/components/CompanyDetail/TabList.jsx

@@ -304,7 +304,7 @@ const CompanyTabList = ({
       // 刷新数据
       dispatch({
         type: 'refresh/commitAction',
-        payload: 'company'
+        payload: updatePayload
       })
     }
   }
@@ -317,7 +317,7 @@ const CompanyTabList = ({
       message.success(msg)
       dispatch({
         type: 'refresh/commitAction',
-        payload: 'company'
+        payload: updatePayload
       })
       initData()
     }
@@ -391,7 +391,7 @@ const CompanyTabList = ({
           客户
         </Button>
         <AddRecord onConfirm={handleAddCustomerService} />
-        <SyncClient customer={customer} client={client.client} />
+        <SyncClient actionPayload={updatePayload} customer={customer} client={client.client} />
       </div>
     </div>
   )