Selaa lähdekoodia

软件锁相关

outaozhen 5 vuotta sitten
vanhempi
commit
8d2bc03ccd

+ 13 - 2
src/pages/Product/Lock/Lockstore/components/LocksDetail/LockForm.jsx

@@ -6,6 +6,17 @@ import { ProductLabel } from '@/pages/Product/Lock/Lockstore'
 
 const LockForm = props => {
   const { longle } = props
+  const longleStatusNum = {
+    1: '生成',
+    2: '接收',
+    3: '借出',
+    4: '销售',
+    5: '升级',
+    6: '更换',
+    7: '收回',
+    8: '备注',
+    9: '赠送'
+  }
   return (
     <div>
       <Row>
@@ -23,14 +34,14 @@ const LockForm = props => {
         <Divider />
         <Col span={6}>产品</Col>
         <Col span={18}>
-          <ProductLabel data={longle.product}></ProductLabel>
+          <ProductLabel data={longle.product} />
         </Col>
         <Divider />
         <Col span={6}>期限</Col>
         <Col span={18}>{longle.allotedTime}</Col>
         <Divider />
         <Col span={6}>使用状态</Col>
-        <Col span={18}>{longle.statusT}</Col>
+        <Col span={18}>{longleStatusNum[longle.status]}</Col>
         <Divider />
         <Col span={6}>负责人</Col>
         <Col span={18}>{longle.responsible}</Col>

+ 51 - 19
src/pages/Product/Lock/Lockstore/components/LocksDetail/LockModal.jsx

@@ -1,5 +1,5 @@
 import React, { useState, useEffect, useRef } from 'react'
-import { Modal, Form, Select, Input, Spin, Button } from 'antd'
+import { Modal, Form, Select, Input, Spin, Button, Radio } from 'antd'
 import styles from './index.less'
 import { SearchOutlined } from '@ant-design/icons'
 import { queryContact } from '@/services/contact'
@@ -7,6 +7,7 @@ import { queryLock } from '@/services/lock'
 import consts from '@/basic/consts'
 import { useDebounceFn } from 'ahooks'
 import { apiSoftwareAddLonglelog } from '@/services/lock'
+import { useDispatch } from 'dva'
 
 export const lockTypeEnum = {
   SALE: 3,
@@ -27,6 +28,7 @@ const LockModal = props => {
     6: '输入新锁号'
   }
   const [form] = Form.useForm()
+  const dispatch = useDispatch()
   const { Option } = Select
   const scrollRef = useRef()
   const { visible, onCancel, onConfirm, loading, type, longleId, keyNum, status } = props
@@ -112,6 +114,27 @@ const LockModal = props => {
     if (code === consts.RET_CODE.SUCCESS) {
       onCancel()
     }
+    dispatch({
+      type: 'refresh/commitAction',
+      payload: 'longle'
+    })
+  }
+
+  // 更换软件锁
+  const connectLongle = async id => {
+    const { code = -1 } = await apiSoftwareAddLonglelog({
+      id,
+      // newLongleId,
+      status: type,
+      longleId
+    })
+    if (code === consts.RET_CODE.SUCCESS) {
+      onCancel()
+    }
+    dispatch({
+      type: 'refresh/commitAction',
+      payload: 'longle'
+    })
   }
 
   const handleListScroll = () => {
@@ -163,25 +186,34 @@ const LockModal = props => {
         )
       }>
       {type === lockTypeEnum.SALE ? (
-        <div className={styles.modalContainer} ref={scrollRef} onScroll={handleListScroll}>
-          <div className={styles.modalContent}>
-            <Spin spinning={state.laoding}>
-              {state.client.map((item, index) => (
-                <div key={index} className={styles.card}>
-                  <div className="zh-flex-sub">{item.clientName}</div>
-                  <div className="zh-flex-sub">{item.position}</div>
-                  <div className="zh-flex-sub">{item.telephone}</div>
-                  <div className="zh-flex-sub zh-justify-between">
-                    <span>{item.companyName}</span>
-                    <Button type="primary" size="small" onClick={() => connectClient(item.id)}>
-                      选择ta
-                    </Button>
+        <>
+          <div className="zh-text-center zh-mg-bottom-25">
+            <Radio.Group defaultValue="3" buttonStyle="solid">
+              <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}>
+                {state.client.map((item, index) => (
+                  <div key={index} className={styles.card}>
+                    <div className="zh-flex-sub">{item.clientName}</div>
+                    <div className="zh-flex-sub">{item.position}</div>
+                    <div className="zh-flex-sub">{item.telephone}</div>
+                    <div className="zh-flex-sub zh-justify-between">
+                      <span>{item.companyName}</span>
+                      <Button type="primary" size="small" onClick={() => connectClient(item.id)}>
+                        选择ta
+                      </Button>
+                    </div>
                   </div>
-                </div>
-              ))}
-            </Spin>
+                ))}
+              </Spin>
+            </div>
           </div>
-        </div>
+        </>
       ) : null}
       {type === lockTypeEnum.CHANGE ? (
         <div className={[styles.modalContainer].join(' ')}>
@@ -192,7 +224,7 @@ const LockModal = props => {
                   <div className="zh-flex-sub">{item.keyNum}</div>
                   <div className="zh-flex-sub zh-justify-between">
                     <span>{item.product}</span>
-                    <Button type="primary" size="small">
+                    <Button type="primary" size="small" onClick={() => connectLongle(item.id)}>
                       更换
                     </Button>
                   </div>

+ 1 - 1
src/pages/Product/Lock/Lockstore/components/LocksDetail/LockTabList.jsx

@@ -10,7 +10,7 @@ import { servicelogEnum, showProductsStatus, showNewLongleStatus, showMarkStatus
 import { useDispatch } from 'dva'
 
 const LockTabList = props => {
-  const { longleLog, longleId, keyNum, clientId } = props
+  const { longleLog, longleId, keyNum } = props
   const dispatch = useDispatch()
   const [state, setState] = useState({
     visible: false