Przeglądaj źródła

feat: 软件锁生成状态提供接收操作+更换功能调整+删除日志

outaozhen 4 lat temu
rodzic
commit
6556aa5b3c

+ 18 - 13
src/pages/Product/Lock/LockStore/components/LocksDetail/LockModal.jsx

@@ -6,7 +6,7 @@ import { queryClient } from '@/services/customer'
 import { queryLock } from '@/services/product'
 import consts from '@/basic/consts'
 import { useDebounceFn } from 'ahooks'
-import { apiSoftwareAddLonglelog } from '@/services/product'
+import { apiSoftwareAddLonglelog, apiReceiveLock } from '@/services/product'
 import { useDispatch, connect } from 'umi'
 // import { createUid } from '@/utils/utils'
 // import DragIniter from '@/components/Modal/src/components/DragIniter'
@@ -149,8 +149,18 @@ const LockModal = props => {
   }, [visible, type])
 
   const handleonOk = () => {
-    form.validateFields().then(values => {
-      onConfirm({ ...values, preserveStatus: type })
+    form.validateFields().then(async values => {
+      if (type === lockTypeEnum.RECEIVE) {
+        const { code = -1 } = await apiReceiveLock({
+          longleId
+        })
+        if (code === consts.RET_CODE.SUCCESS) {
+          message.success('接收成功')
+          onCancel()
+        }
+      } else {
+        onConfirm({ ...values, preserveStatus: type })
+      }
       dispatch({
         type: 'refresh/commitAction',
         payload: 'longle'
@@ -257,8 +267,7 @@ const LockModal = props => {
             </Button>
           </div>
         )
-      }
-    >
+      }>
       {type === lockTypeEnum.SALE ? (
         <div className="text-center mb-6">
           <Radio.Group value={state.sellStatus} buttonStyle="solid" onChange={checkGroupOnChange}>
@@ -273,8 +282,7 @@ const LockModal = props => {
           className={styles.modalContainer}
           ref={scrollRef}
           onScroll={handleListScroll}
-          style={{ paddingBottom: 0 }}
-        >
+          style={{ paddingBottom: 0 }}>
           <div className={styles.modalContent}>
             <Spin spinning={state.loading}>
               {type === lockTypeEnum.SALE &&
@@ -289,8 +297,7 @@ const LockModal = props => {
                         title="确认选择ta"
                         onConfirm={() => connectClient(item.id)}
                         okText="确认"
-                        cancelText="取消"
-                      >
+                        cancelText="取消">
                         <Button type="primary" size="small">
                           选择ta
                         </Button>
@@ -308,8 +315,7 @@ const LockModal = props => {
                         title="确认选择ta"
                         onConfirm={() => connectLongle(item.id)}
                         okText="确认"
-                        cancelText="取消"
-                      >
+                        cancelText="取消">
                         <Button type="primary" size="small">
                           更换
                         </Button>
@@ -343,8 +349,7 @@ const LockModal = props => {
                     return Promise.resolve(value)
                   }
                 })
-              ]}
-            >
+              ]}>
               <Select
                 placeholder="请选择产品"
                 onDropdownVisibleChange={async e => {

+ 67 - 17
src/pages/Product/Lock/LockStore/components/LocksDetail/TabList.jsx

@@ -1,8 +1,8 @@
 import React, { useState } from 'react'
-import { Row, Col, List, Tabs, message, Button } from 'antd'
+import { Row, Col, List, Tabs, message, Button, Popconfirm } from 'antd'
 import { dayjsFormat } from '@/utils/utils'
 import consts from '@/consts'
-import { apiSoftwareAddLonglelog } from '@/services/product'
+import { apiSoftwareAddLonglelog, apiDelLonglelog } from '@/services/product'
 import { ProductLabel } from '@/pages/Product/Lock/LockStore'
 import LockModal, { lockTypeEnum } from './LockModal'
 import ClientDetail from '@/pages/Customer/Client/components/ClientDetail'
@@ -25,7 +25,16 @@ const RenderLongleCon = ({ longleService }) => {
 }
 
 const LockTabList = props => {
-  const { longleLog, longleId, keyNum, clientId, logStatus, upgradeProduct, sellStatus } = props
+  const {
+    longleLog,
+    longleId,
+    keyNum,
+    clientId,
+    logStatus,
+    upgradeProduct,
+    logStockStatus,
+    logSellStatus
+  } = props
   const { toggleDrawer, setDrawerProps } = useModal()
   const dispatch = useDispatch()
   const { TabPane } = Tabs
@@ -69,6 +78,20 @@ const LockTabList = props => {
     toggleDrawer()
   }
 
+  // 删除软件锁日志
+  const delLonglelog = async id => {
+    const { code = -1 } = await apiDelLonglelog({
+      id
+    })
+    if (code === consts.RET_CODE.SUCCESS) {
+      message.success('删除成功')
+      dispatch({
+        type: 'refresh/commitAction',
+        payload: 'longle'
+      })
+    }
+  }
+
   return (
     <div>
       <div className="pl-4">
@@ -103,6 +126,20 @@ const LockTabList = props => {
                       </Col>
                       <Col span="16">
                         <RenderLongleCon longleService={item} />
+                        {item.status === 3 ||
+                        item.status === 4 ||
+                        item.status === 5 ||
+                        item.status === 9 ? (
+                          <Popconfirm
+                            title="确认删除"
+                            onConfirm={() => delLonglelog(item.longleId)}
+                            okText="确认"
+                            cancelText="取消">
+                            <Button className="mt-2" type="primary" ghost size="small" danger>
+                              删除
+                            </Button>
+                          </Popconfirm>
+                        ) : null}
                       </Col>
                     </Row>
                   </List.Item>
@@ -113,28 +150,41 @@ const LockTabList = props => {
         </Tabs>
       </div>
       <div className="sheet-btns pl-4 pt-4 flex">
+        {logStockStatus !== 2 ? (
+          <Button
+            type="primary"
+            ghost
+            size="small"
+            className="mr-3px"
+            onClick={() =>
+              setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.RECEIVE })
+            }>
+            接收
+          </Button>
+        ) : null}
+        {logStockStatus === 2 && logSellStatus === 0 ? (
+          <Button
+            type="primary"
+            ghost
+            size="small"
+            className="mr-3px"
+            onClick={() =>
+              setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.SALE })
+            }>
+            借销赠
+          </Button>
+        ) : null}
         <Button
           type="primary"
           ghost
           size="small"
-          className="mr-3px"
-          onClick={() =>
-            setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.SALE })
-          }>
-          借销赠
-        </Button>
-        {/* <Button
-          type="primary"
-          ghost
-          size="small"
           className="mr-1"
           onClick={() =>
             setAddLonglelog({ ...setAddLonglelog, visible: true, type: lockTypeEnum.UPDATE })
-          }
-        >
+          }>
           升级
-        </Button> */}
-        {sellStatus !== 0 ? (
+        </Button>
+        {logSellStatus === 0 ? (
           <Button
             type="primary"
             ghost

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

@@ -98,7 +98,8 @@ const Index = props => {
               keyNum={state.longle.keyNum}
               upgradeProduct={state.longle.product?.split('+') || []}
               logStatus={state.longle.status}
-              sellStatus={state.longle.sellStatus}
+              logStockStatus={state.longle.stockStatus}
+              logSellStatus={state.longle.sellStatus}
             />
             <LockLowerList log={state.log} />
           </Col>

+ 7 - 0
src/services/product.js

@@ -56,6 +56,13 @@ export async function apiReceiveLock(params) {
   })
 }
 
+/** 删除软件锁日志 */
+export async function apiDelLonglelog(params) {
+  return request.post('/software/delete/longlelog', {
+    data: params
+  })
+}
+
 /** 云版产品列表 */
 export async function queryRoadpricingList(params) {
   return request.post('/RoadPricing/list', {