Просмотр исходного кода

fix: [单位、锁库] 更换单位弹窗列表页码由10->25

lanjianrong 4 лет назад
Родитель
Сommit
42818434af

+ 31 - 41
src/pages/Customer/Company/components/ConnectCompany/index.jsx

@@ -11,14 +11,7 @@ import { formatValues } from '@/components/LazyCascader'
 import { apiChangeCustomer } from '@/services/customer'
 import { useModal } from '@/components/ModalStore'
 
-const ConnectCompany = ({
-  onCancel,
-  dataId,
-  onSelect,
-  preUrl = 'Client',
-  defaultAddibleValue,
-  ...resetModalProps
-}) => {
+const ConnectCompany = ({ onCancel, dataId, onSelect, preUrl = 'Client', defaultAddibleValue, ...resetModalProps }) => {
   const hasAddPerm = useAccess()?.validatePermByType('company_add')
   const dispatchModal = useModal()
   const scrollRef = useRef()
@@ -28,12 +21,14 @@ const ConnectCompany = ({
     noMore: false,
     searchVal: '',
     current: 1,
-    pageSize: 10,
+    pageSize: 25,
     total: 0
   })
   const initData = async params => {
-    const { data: { customer, total } = { customer: [], total: 0 }, code = -1 } =
-      await queryCustomers({ ...params, waiver: true })
+    const { data: { customer, total } = { customer: [], total: 0 }, code = -1 } = await queryCustomers({
+      ...params,
+      waiver: true
+    })
     if (code === consts.RET_CODE.SUCCESS) {
       if (params?.current === 1) {
         scrollRef.current?.scrollTo({ top: 0 })
@@ -53,7 +48,7 @@ const ConnectCompany = ({
   }
 
   useEffect(() => {
-    initData({ current: 1, pageSize: 10 })
+    initData({ current: 1, pageSize: 25 })
   }, [])
   const onChange = e => {
     const { value = '' } = e.target || e.currentTarget
@@ -88,13 +83,10 @@ const ConnectCompany = ({
     }
   }
 
-  const handleListScroll = () => {
+  const handleListScroll = e => {
     if (!scrollRef.current) return
     // 未滚动到底部
-    if (
-      scrollRef.current.scrollHeight - scrollRef.current.clientHeight <=
-      scrollRef.current.scrollTop
-    ) {
+    if (scrollRef.current.scrollHeight - scrollRef.current.clientHeight <= scrollRef.current.scrollTop) {
       // 已到底部
       if (state.current * state.pageSize > state.total) {
         setState({ ...state, noMore: true })
@@ -134,31 +126,29 @@ const ConnectCompany = ({
           </Button>
         )
       }>
-      <div
-        className={styles.modalContent}
-        ref={scrollRef}
-        onScroll={handleListScroll}
-        style={{ paddingBottom: 0 }}>
-        <Spin spinning={state.laoding}>
-          {state.customer.map(item => (
-            <div key={item.id} className={styles.card}>
-              <div className="flex flex-1">{item.companyName}</div>
-              <div className="flex flex-1 justify-between">
-                <span>{item.districtName}</span>
-                <Popconfirm
-                  title="确认关联ta"
-                  onConfirm={() => connectCustomer(item.id)}
-                  okText="确认"
-                  cancelText="取消">
-                  <Button type="primary" size="small">
-                    关联
-                  </Button>
-                </Popconfirm>
+      <div className={styles.modalContainer}>
+        <div className={styles.modalContent} ref={scrollRef} onScroll={handleListScroll}>
+          <Spin spinning={state.laoding}>
+            {state.customer.map(item => (
+              <div key={item.id} className={styles.card}>
+                <div className="flex flex-1">{item.companyName}</div>
+                <div className="flex flex-1 justify-between">
+                  <span>{item.districtName}</span>
+                  <Popconfirm
+                    title="确认关联ta"
+                    onConfirm={() => connectCustomer(item.id)}
+                    okText="确认"
+                    cancelText="取消">
+                    <Button type="primary" size="small">
+                      关联
+                    </Button>
+                  </Popconfirm>
+                </div>
               </div>
-            </div>
-          ))}
-        </Spin>
-        {state.noMore && <div className="text-center text-gray-400 my-4">已到底部</div>}
+            ))}
+          </Spin>
+          {state.noMore && <div className="text-center text-gray-400 my-4">已到底部</div>}
+        </div>
       </div>
     </Modal>
   )

+ 16 - 28
src/pages/Customer/Company/index.jsx

@@ -17,16 +17,7 @@ import { useModal } from '@/components/ModalStore'
 // import FilterCascader from '@/components/Table/src/components/FilterCascader'
 
 const Company = props => {
-  const {
-    personTagColorMap,
-    teamTagColorMap,
-    personTags,
-    teamTags,
-    natures,
-    dispatch,
-    shouldUpdate,
-    loading
-  } = props
+  const { personTagColorMap, teamTagColorMap, personTags, teamTags, natures, dispatch, shouldUpdate, loading } = props
 
   const { initialState: { permData } = { permData: {} } } = useModel('@@initialState')
 
@@ -57,8 +48,13 @@ const Company = props => {
         payload: { tagType: TagTypeEnum.TEAMTAG, tagColumn: TagDataTypeEnum.COMPANY }
       })
     }
+    if (!natures.length) {
+      dispatch({
+        type: 'company/fetchNatures'
+      })
+    }
+
     if (shouldUpdate) {
-      console.log('1111')
       tRef.current.reload()
     }
   }, [shouldUpdate])
@@ -88,10 +84,7 @@ const Company = props => {
       teamTagMap[item.id] = {
         text: (
           <>
-            <span
-              className="inline-block w-12px h-12px mr-3px"
-              style={{ backgroundColor: teamTagColorMap[item.id] }}
-            />
+            <span className="inline-block w-12px h-12px mr-3px" style={{ backgroundColor: teamTagColorMap[item.id] }} />
             <span>{item.name}</span>
           </>
         )
@@ -99,11 +92,7 @@ const Company = props => {
     })
     natures.forEach(item => {
       natureMap[item.value] = {
-        text: (
-          <>
-            <span>{item.label}</span>
-          </>
-        )
+        text: <span>{item.label}</span>
       }
     })
 
@@ -153,9 +142,7 @@ const Company = props => {
       sorter: true,
       render: (text, record) => (
         <span
-          onClick={() =>
-            dispatchModal('D_COMPANY_DETAIL', { dataId: record.id, orderIds: state.orderIds })
-          }
+          onClick={() => dispatchModal('D_COMPANY_DETAIL', { dataId: record.id, orderIds: state.orderIds })}
           className="text-primary cursor-pointer hover:text-hex-967bbd">
           {text}
         </span>
@@ -467,8 +454,11 @@ const Company = props => {
         request={async (params, sort, filter) => {
           const srotOrder = generateSortField(sort)
           const nFilter = generateFilterField(filter)
-          const { code = -1, data: { customer = [], total = 0 } = { customer: [], total: 0 } } =
-            await queryCompany({ ...params, ...srotOrder, ...nFilter })
+          const { code = -1, data: { customer = [], total = 0 } = { customer: [], total: 0 } } = await queryCompany({
+            ...params,
+            ...srotOrder,
+            ...nFilter
+          })
           setState({ ...state, orderIds: customer.map(item => item.id) })
           return {
             data: customer,
@@ -484,9 +474,7 @@ const Company = props => {
                 style={{ width: '250px' }}
                 allowClear={true}
                 placeholder={`在${
-                  permData[PermDataTypeEunm.CUSTOMER]?.find(
-                    item => item.value === defaultPermAuthCache
-                  )?.label
+                  permData[PermDataTypeEunm.CUSTOMER]?.find(item => item.value === defaultPermAuthCache)?.label
                 }下搜索`}
                 onSearch={handleSearch}
               />

+ 6 - 6
src/pages/Product/Lock/LockStore/components/LockDetail/OpreateLock.jsx

@@ -45,7 +45,7 @@ const OpreateLock = props => {
     sellStatus: 1,
     noMore: false,
     current: 1,
-    pageSize: 10,
+    pageSize: 25,
     total: 0
   })
 
@@ -123,11 +123,11 @@ const OpreateLock = props => {
   useEffect(() => {
     if (resetModalProps.visible) {
       if (type === lockTypeEnum.CHANGE) {
-        initData({ current: 1, pageSize: 10 })
+        initData({ current: 1, pageSize: 25 })
         return
       }
       if (type === lockTypeEnum.SALE) {
-        initData({ current: 1, pageSize: 10, sellStatus: state.sellStatus })
+        initData({ current: 1, pageSize: 25, sellStatus: state.sellStatus })
         return
       }
       form.resetFields()
@@ -169,7 +169,7 @@ const OpreateLock = props => {
       // logStatus: logStatusEnum[state.logStatus],
       sellStatus: value,
       current: 1,
-      pageSize: 10,
+      pageSize: 25,
       search: state.search
     })
   }
@@ -243,7 +243,7 @@ const OpreateLock = props => {
           />
         )
       }
-      width={800}
+      width="60vw"
       getContainer={() => document.getElementById('root')}
       footer={
         type !== lockTypeEnum.UPDATE &&
@@ -270,7 +270,7 @@ const OpreateLock = props => {
         </div>
       ) : null}
       {type === lockTypeEnum.CHANGE || type === lockTypeEnum.SALE ? (
-        <div className={styles.modalContainer} style={{ paddingBottom: 0 }}>
+        <div className={styles.modalContainer}>
           <div className={styles.modalContent} ref={scrollRef} onScroll={handleListScroll}>
             <Spin spinning={state.loading}>
               {type === lockTypeEnum.SALE &&