lanjianrong il y a 4 ans
Parent
commit
72fb349455

+ 12 - 20
src/pages/Product/Lock/LockStore/components/ChangeClient/index.jsx

@@ -8,7 +8,8 @@ import styles from './index.less'
 import { useModal } from '@/components/ModalStore'
 
 const ChangeClient = ({
-  dataSource: { clientName = '', longleId, clientId, actionPayload }
+  actionPayload,
+  dataSource: { clientName = '', longleId, clientId }
 } = {}) => {
   const dispatchModal = useModal()
   const dispatch = useDispatch()
@@ -21,18 +22,16 @@ const ChangeClient = ({
     })
   }
 
+  const openConnectClientModal = () =>
+    dispatchModal('M_CONNECT_CLIENT', {
+      onSelect: refreshClient,
+      dataId: longleId,
+      preUrl: actionPayload.main,
+      showFooter: false
+    })
+
   const notValueRender = (
-    <div
-      onClick={() =>
-        dispatchModal('M_CONNECT_CLIENT', {
-          onSelect: refreshClient,
-          dataId: longleId,
-          preUrl: actionPayload,
-          showFooter: false
-        })
-      }
-      className={styles.notCompanyContent}
-    >
+    <div onClick={openConnectClientModal} className={styles.notCompanyContent}>
       <LinkOne size="14" />
       <span className="ml-5px">关联客户</span>
     </div>
@@ -53,14 +52,7 @@ const ChangeClient = ({
             placement="right"
             title="更换客户"
             className="ml-5px"
-            onClick={() =>
-              dispatchModal('M_CONNECT_CLIENT', {
-                onSelect: refreshClient,
-                dataId: longleId,
-                preUrl: actionPayload,
-                showFooter: false
-              })
-            }
+            onClick={openConnectClientModal}
           >
             <span className={styles.switchIcon}>
               <Switch />

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

@@ -10,12 +10,11 @@ import ChangeCompanyInput, {
 } from '@/pages/Customer/Company/components/ChangeCompany'
 
 const LockForm = props => {
-  const { longle } = props
+  const { longle, actionPayload } = props
   const changeClientInputData = {
     clientName: longle.client,
     longleId: longle.id,
-    clientId: longle.clientId,
-    actionPayload: ChangeCompMap.SOFTWARE.key
+    clientId: longle.clientId
   }
 
   const changeCompanyInputData = {
@@ -23,7 +22,6 @@ const LockForm = props => {
     dataId: longle.id,
     customerName: longle.customerName,
     targetName: longle.keyNum,
-    actionPayload: ChangeCompMap.SOFTWARE.key,
     title: '软件锁'
   }
 
@@ -122,6 +120,7 @@ const LockForm = props => {
         <Col span={6}>单位名称</Col>
         <Col span={18}>
           <ChangeCompanyInput
+            actionPayload={actionPayload}
             dataSource={changeCompanyInputData}
             showRemoveIcon={false}
             showConnectIcon={false}
@@ -130,7 +129,7 @@ const LockForm = props => {
         <Divider style={{ margin: '12px 0' }} />
         <Col span={6}>客户</Col>
         <Col span={18}>
-          <ChangeClient dataSource={changeClientInputData} />
+          <ChangeClient actionPayload={actionPayload} dataSource={changeClientInputData} />
         </Col>
         <Divider style={{ margin: '12px 0' }} />
         <Col span={6}>注册码</Col>
@@ -140,7 +139,7 @@ const LockForm = props => {
         <Col span={6} />
         <Col span={18}>
           <small>
-            使用方法:复制以上注册码,打开软件帮助菜单/产品注册/下一步/下一步/选择"手工输入注册码"。将注册码不分段不空格复制粘贴到"注册码"栏内确定即可。
+            使用方法:复制以上注册码,打开软件帮助菜单/产品注册/下一步/下一步/选择&quot;手工输入注册码&quot;。将注册码不分段不空格复制粘贴到&quot;注册码&quot;栏内确定即可。
           </small>
         </Col>
         <Divider style={{ margin: '12px 0' }} />

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

@@ -18,12 +18,7 @@ const LockLowerList = 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>
                 )}
               />

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

@@ -150,20 +150,21 @@ const OpreateLock = props => {
   const handleonOk = () => {
     form.validateFields().then(async values => {
       if (type === lockTypeEnum.RECEIVE) {
-        const { code = -1 } = await apiReceiveLock({
-          longleId
-        })
+        const { code = -1 } = await apiReceiveLock({ longleId })
         if (code === consts.RET_CODE.SUCCESS) {
           message.success('接收成功')
           resetModalProps.onCancel()
+          dispatch({
+            type: 'refresh/commitAction',
+            payload: {
+              main: 'software',
+              target: longleId
+            }
+          })
         }
       } else {
         onConfirm({ ...values, preserveStatus: type })
       }
-      dispatch({
-        type: 'refresh/commitAction',
-        payload: 'software'
-      })
     })
   }
 
@@ -194,7 +195,10 @@ const OpreateLock = props => {
       message.success('新增成功')
       dispatch({
         type: 'refresh/commitAction',
-        payload: 'software'
+        payload: {
+          main: 'software',
+          target: longleId
+        }
       })
       onCancel()
     }
@@ -211,7 +215,10 @@ const OpreateLock = props => {
       message.success('新增成功')
       dispatch({
         type: 'refresh/commitAction',
-        payload: 'software'
+        payload: {
+          main: 'software',
+          target: longleId
+        }
       })
       onCancel()
     }
@@ -373,17 +380,6 @@ const OpreateLock = props => {
             </Form.Item>
           </>
         ) : null}
-
-        {/* {type === lockTypeEnum.RECEIVE ? (
-          <>
-            <p>
-              确认接收锁 <b>{keyNum}</b>
-            </p>
-            <Form.Item name="longleId" hidden>
-              <Input />
-            </Form.Item>
-          </>
-        ) : null} */}
       </Form>
     </Modal>
   )

+ 4 - 12
src/pages/Product/Lock/LockStore/components/LockDetail/TabList.jsx

@@ -14,7 +14,7 @@ const LockTabList = props => {
     longle: { id: longleId, keyNum, status, stockStatus, sellStatus, preserveStatus } = {},
     longleLog,
     upgradeProduct,
-    updateKey
+    actionPayload
   } = props
   const hasAddPerm = useAccess()?.validatePermByType('lockstore_delete_record')
   const dispatchModal = useModal()
@@ -40,7 +40,7 @@ const LockTabList = props => {
       // 刷新数据
       dispatch({
         type: 'refresh/commitAction',
-        payload: updateKey
+        payload: actionPayload
       })
     }
   }
@@ -48,12 +48,6 @@ const LockTabList = props => {
   // 点击新软件锁详情
   const showLongleClick = newLongleId => {
     dispatchModal('D_LOCK_DETAIL', { dataId: newLongleId })
-    setTimeout(() => {
-      dispatch({
-        type: 'refresh/commitAction',
-        payload: updateKey
-      })
-    }, 0)
   }
 
   const renderNewLog = longleService => {
@@ -94,14 +88,12 @@ const LockTabList = props => {
 
   // 删除软件锁日志
   const delLonglelog = async id => {
-    const { code = -1 } = await apiDelLonglelog({
-      id
-    })
+    const { code = -1 } = await apiDelLonglelog({ id })
     if (code === consts.RET_CODE.SUCCESS) {
       message.success('删除成功')
       dispatch({
         type: 'refresh/commitAction',
-        payload: updateKey
+        payload: actionPayload
       })
     }
   }

+ 11 - 5
src/pages/Product/Lock/LockStore/components/LockDetail/index.jsx

@@ -13,13 +13,13 @@ const LockDetail = props => {
   const {
     visible,
     dispatch,
-    dataId = '',
+    dataId,
     refresh,
     orderIds = [],
     updateKey = 'software',
     ...resetDrawerProps
   } = props
-  const shouldUpdate = refresh?.[updateKey] || false
+  const shouldUpdate = refresh?.[dataId ?? updateKey] || false
   const [state, setState] = useState({
     loading: false,
     longle: {},
@@ -38,7 +38,10 @@ const LockDetail = props => {
       if (shouldUpdate) {
         dispatch({
           type: 'refresh/commitAction',
-          payload: updateKey
+          payload: {
+            main: updateKey,
+            target: dataId
+          }
         })
       }
       setState({ ...state, longle, log, longleLog, loading: false })
@@ -89,7 +92,10 @@ const LockDetail = props => {
                 </div>
               ) : null}
               <div className="sheet-left-panel pr-4">
-                <LockForm longle={state.longle} />
+                <LockForm
+                  longle={state.longle}
+                  actionPayload={{ main: updateKey, target: dataId }}
+                />
               </div>
             </Col>
             <Col span={15} className="sheet-box-right">
@@ -97,7 +103,7 @@ const LockDetail = props => {
                 longleLog={state.longleLog}
                 longle={state.longle}
                 upgradeProduct={state.longle.product?.split('+') || []}
-                updateKey={updateKey}
+                actionPayload={{ main: updateKey, target: dataId }}
               />
               <LockLowerList log={state.log} />
             </Col>