lanjianrong пре 5 година
родитељ
комит
6c5b0acd4f
1 измењених фајлова са 22 додато и 17 уклоњено
  1. 22 17
      src/pages/Product/Lock/Lockstore/components/LocksDetail/LockModal.jsx

+ 22 - 17
src/pages/Product/Lock/Lockstore/components/LocksDetail/LockModal.jsx

@@ -36,11 +36,11 @@ const LockModal = props => {
     layout: 'vertical'
   }
   const [state, setState] = useState({
-    laoding: false,
+    loading: false,
     longle: [],
     client: [],
     searchVal: '',
-    radioVal: '3',
+    radioVal: 3,
     page: 1,
     size: 10,
     total: 0
@@ -67,9 +67,21 @@ const LockModal = props => {
       if (code === consts.RET_CODE.SUCCESS) {
         if (params?.page === 1) {
           // 请求的是第一页
-          setState({ ...state, client, total, laoding: false })
+          setState({
+            ...state,
+            client,
+            total,
+            laoding: false,
+            radioVal: params.status || lockTypeEnum.SALE
+          })
         } else {
-          setState({ ...state, client: state.client.concat(client), total, laoding: false })
+          setState({
+            ...state,
+            client: state.client.concat(client),
+            total,
+            laoding: true,
+            radioVal: params.status
+          })
         }
       }
     }
@@ -105,9 +117,8 @@ const LockModal = props => {
   }
 
   const checkGroupOnChange = e => {
-    const { radioVal = '' } = e.target
-    setState({ ...state, radioVal: '' })
-    initData({ status: radioVal, page: 1, size: 10 })
+    const { value = '' } = e.target
+    initData({ status: value, page: 1, size: 10 })
   }
 
   // 关联联系人
@@ -170,12 +181,6 @@ const LockModal = props => {
       visible={visible}
       confirmLoading={loading}
       onCancel={onCancel}
-      // onOk={() => {
-      //   form.validateFields().then(values => {
-      //     values.status = type
-      //     onConfirm(values)
-      //   })
-      // }}
       width={800}
       footer={
         type !== lockTypeEnum.UPDATE &&
@@ -195,14 +200,14 @@ const LockModal = props => {
         <>
           <div className="zh-text-center zh-mg-bottom-25">
             <Radio.Group value={state.radioVal} buttonStyle="solid" onChange={checkGroupOnChange}>
-              <Radio.Button value="3">借出</Radio.Button>
-              <Radio.Button value="4">销售</Radio.Button>
-              <Radio.Button value="9">赠送</Radio.Button>
+              <Radio.Button value={3}>借出</Radio.Button>
+              <Radio.Button value={4}>销售</Radio.Button>
+              <Radio.Button value={9}>赠送</Radio.Button>
             </Radio.Group>
           </div>
           <div className={styles.modalContainer} ref={scrollRef} onScroll={handleListScroll}>
             <div className={styles.modalContent}>
-              <Spin spinning={state.laoding}>
+              <Spin spinning={state.loading}>
                 {state.client.map((item, index) => (
                   <div key={index} className={styles.card}>
                     <div className="zh-flex-sub">{item.clientName}</div>