Procházet zdrojové kódy

feat: 锁库增加单位名称更换功能

lanjianrong před 4 roky
rodič
revize
72d790b8e0

+ 1 - 1
src/models/refresh.js

@@ -4,7 +4,7 @@ export default {
     contactList: false,
     client: false,
     company: false,
-    longle: false,
+    software: false,
     department: false,
     staffList: false,
     business: false,

+ 4 - 0
src/pages/Customer/Company/components/ChangeCompany/index.jsx

@@ -17,6 +17,10 @@ export const ChangeCompMap = {
   BUSINESS: {
     key: 'business',
     title: '商机组'
+  },
+  SOFTWARE: {
+    key: 'software',
+    title: '软件锁'
   }
 }
 const ChangeCompanyInput = props => {

+ 3 - 2
src/pages/Product/Lock/LockStore/components/ChangeClient/index.jsx

@@ -28,7 +28,7 @@ const ChangeClient = props => {
         <ConnectClient
           onSelect={refreshClient}
           dataId={longleId}
-          preUrl="software"
+          preUrl={actionPayload}
           showFooter={false}
         />
       ),
@@ -67,7 +67,8 @@ const ChangeClient = props => {
             placement="right"
             title="更换客户"
             className="ml-5px"
-            onClick={handleConnectCustomer}>
+            onClick={handleConnectCustomer}
+          >
             <span className={styles.switchIcon}>
               <Switch />
             </span>

+ 18 - 29
src/pages/Product/Lock/LockStore/components/LocksDetail/Form.jsx

@@ -1,42 +1,32 @@
 import React from 'react'
 import { Row, Col, Divider } from 'antd'
-import { useModal } from '@/components/Modal'
 import { ProductLabel } from '@/pages/Product/Lock/LockStore'
 import ChangeClient from '@/pages/Product/Lock/LockStore/components/ChangeClient'
 import CopyAuthorizeStr from '../CopyAuthorizeStr'
 import DownUpdateFile from '../DownUpdateFile'
-import CompanyDetail from '@/pages/Customer/Company/components/CompanyDetail'
 import { dayjsFormat } from '@/utils/utils'
-
-export const ChangeCompMap = {
-  LONGLE: {
-    key: 'longle',
-    title: '软件锁'
-  }
-}
+import ChangeCompanyInput, {
+  ChangeCompMap
+} from '@/pages/Customer/Company/components/ChangeCompany'
 
 const LockForm = props => {
-  const { longle, customerId } = props
-  const { toggleDrawer, setDrawerProps } = useModal()
-  const changeCopInputData = {
+  const { longle } = props
+  const changeClientInputData = {
     clientName: longle.client,
     longleId: longle.id,
     clientId: longle.clientId,
-    actionPayload: ChangeCompMap.LONGLE.key
+    actionPayload: ChangeCompMap.SOFTWARE.key
   }
-  const handleCompanyClick = () => {
-    toggleDrawer()
-    setDrawerProps({
-      closable: true,
-      onClose: () => toggleDrawer(),
-      bodyStyle: {
-        height: '100vh',
-        overflowY: 'hidden'
-      },
-      children: <CompanyDetail dataId={customerId} />
-    })
-    toggleDrawer()
+
+  const changeCompanyInputData = {
+    customerId: longle.customerId,
+    dataId: longle.id,
+    customerName: longle.customerName,
+    targetName: longle.keyNum,
+    actionPayload: ChangeCompMap.SOFTWARE.key,
+    title: '软件锁'
   }
+
   // 出库状态
   const longleStockStatusNum = {
     1: '生成',
@@ -59,6 +49,7 @@ const LockForm = props => {
   //   0: '未使用',
   //   1: '使用'
   // }
+
   return (
     <div>
       <Row>
@@ -130,14 +121,12 @@ const LockForm = props => {
         <Divider style={{ margin: '12px 0' }} />
         <Col span={6}>单位名称</Col>
         <Col span={18}>
-          <span className="textPurple text-hex-967bbd cursor-pointer" onClick={handleCompanyClick}>
-            {longle.customerName}
-          </span>
+          <ChangeCompanyInput dataSource={changeCompanyInputData} />
         </Col>
         <Divider style={{ margin: '12px 0' }} />
         <Col span={6}>客户</Col>
         <Col span={18}>
-          <ChangeClient dataSource={changeCopInputData} />
+          <ChangeClient dataSource={changeClientInputData} />
         </Col>
         <Divider style={{ margin: '12px 0' }} />
         <Col span={6}>注册码</Col>

+ 2 - 2
src/pages/Product/Lock/LockStore/components/LocksDetail/index.jsx

@@ -10,7 +10,7 @@ import { Down, Up } from '@icon-park/react'
 import { FlipOverEnum, useFlipOver } from '@/hooks/web/useFlipOver'
 
 const Index = props => {
-  const { dispatch, visible, dataId = '', refresh, orderIds = [], updateKey = 'longle' } = props
+  const { dispatch, visible, dataId = '', refresh, orderIds = [], updateKey = 'software' } = props
   const shouldUpdate = refresh[updateKey] || false
   const [state, setState] = useState({
     longle: {},
@@ -82,7 +82,7 @@ const Index = props => {
               </div>
             ) : null}
             <div className="sheet-left-panel pr-4">
-              <LockForm longle={state.longle} customerId={state.longle.customerId} />
+              <LockForm longle={state.longle} />
             </div>
           </Col>
           <Col

+ 1 - 1
src/pages/Product/Lock/LockStore/index.jsx

@@ -465,5 +465,5 @@ const LockStore = ({ prodList = [], dispatch, shouldUpdate }) => {
 
 export default connect(({ lock, refresh }) => ({
   prodList: lock.prodList,
-  shouldUpdate: refresh.longle
+  shouldUpdate: refresh.software
 }))(LockStore)