shaogen1995 пре 1 месец
родитељ
комит
c451ca7960

+ 1 - 1
后台管理/src/pages/A0goodsInfo/Tab2log/index.tsx

@@ -67,7 +67,7 @@ function Tab2log({ sId }: Props) {
                 const obj = dataChange(item)
                 if (obj) {
                   authorityFu(obj.id, `您没有${obj.name}页面权限`, () => {
-                    openLink(`${obj.path}_look/1/${item.id}`)
+                    openLink(`${obj.path}_look/3/${item.id}`)
                   })
                 } else MessageFu.warning(`type字段:${item.type} 错误`)
               }}

+ 102 - 27
后台管理/src/pages/A1workbench/index.tsx

@@ -1,7 +1,7 @@
 import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { changGetFu, getTokenInfo } from '@/utils/storage'
-import history from '@/utils/history'
+import history, { aduitBtnRoleFu, resubmitBtnRoleFu } from '@/utils/history'
 import { authorityFu } from '@/utils/authority'
 import { Button, DatePicker, Input, Select } from 'antd'
 import { useDispatch, useSelector } from 'react-redux'
@@ -16,6 +16,11 @@ import { statusSelect } from '@/utils/select'
 import MyTable from '@/components/MyTable'
 import tabLeftArr from '../Layout/data'
 import { A1tableC } from '@/utils/tableData'
+import { MessageFu } from '@/utils/message'
+import A0addGoods from '../A0addGoods'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { API_getGoodsInfo } from '@/store/action/B1ledger'
+import { B4_APIresubmit } from '@/store/action/B4delete'
 const { RangePicker } = DatePicker
 
 const userInfo = getTokenInfo().user || {}
@@ -91,32 +96,6 @@ function A1workbench() {
   // 从仓库拿数据
   const tableInfo = useSelector((state: RootState) => state.A1workbench.tableInfo)
 
-  // 各按钮的操作逻辑
-  // 点击查看
-
-  const tableLastBtn = useMemo(() => {
-    return [
-      {
-        title: '操作',
-        render: (item: B1listType) => {
-          return (
-            <>
-              <Button
-                size='small'
-                type='text'
-                onClick={() => {
-                  console.log(123456, item.type)
-                }}
-              >
-                查看
-              </Button>
-            </>
-          )
-        }
-      }
-    ]
-  }, [])
-
   // 页码变化
   const paginationChange = useCallback(
     (pageNum: number, pageSize: number) => {
@@ -144,6 +123,92 @@ function A1workbench() {
     [pageType]
   )
 
+  // 各按钮的操作逻辑
+
+  // 藏品登记、修改(isEditresubmit)重新提交
+  const [editId, setEditId] = useState({ orderId: 0, goodsId: 0, isEditresubmit: false })
+
+  // 藏品删除点击重新提交
+  const resubmitFu = useCallback(async (item: B1listType) => {
+    // 先拿详情
+    const res1 = await API_getGoodsInfo(item.goodIds)
+    if (res1.code === 0) {
+      const obj = res1.data
+      const res2 = await B4_APIresubmit(item.id, obj)
+      if (res2.code === 0) {
+        MessageFu.success('重新提交成功')
+        history.push(`delete_look/3/${item.id}`)
+      }
+    }
+  }, [])
+
+  // 点击查看和审批
+  const btnLookAudioFu = useCallback(
+    (item: B1listType, pageKey: 2 | 3 | 4) => {
+      const pathBase = pageType.find(v => v.pageType === item.type)
+      if (pathBase) {
+        authorityFu(pathBase.id, `您没有${pathBase.name}页面权限`, () => {
+          // 重新提交部分模块和其他逻辑不同
+          if (pageKey === 2) {
+            // 藏品登记、修改
+            if (['DJ', 'XG'].includes(item.type)) {
+              setEditId({
+                orderId: item.id,
+                goodsId: Number(item.goodIds),
+                isEditresubmit: item.type === 'XG'
+              })
+              return
+            }
+          }
+
+          history.push(`${pathBase.path}_look/${pageKey}/${item.id}`)
+        })
+      } else MessageFu.warning(`数据type ${item.type} 错误`)
+    },
+    [pageType]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: B1listType) => {
+          return (
+            <>
+              <Button size='small' type='text' onClick={() => btnLookAudioFu(item, 3)}>
+                查看
+              </Button>
+
+              {resubmitBtnRoleFu(item) ? (
+                item.type === 'SC' ? (
+                  <MyPopconfirm
+                    txtK='重新提交'
+                    onConfirm={() => resubmitFu(item)}
+                    Dom={
+                      <Button size='small' type='text'>
+                        重新提交
+                      </Button>
+                    }
+                  />
+                ) : (
+                  <Button size='small' type='text' onClick={() => btnLookAudioFu(item, 2)}>
+                    重新提交
+                  </Button>
+                )
+              ) : null}
+
+              {aduitBtnRoleFu(item) ? (
+                <Button size='small' type='text' onClick={() => btnLookAudioFu(item, 4)}>
+                  审批
+                </Button>
+              ) : null}
+            </>
+          )
+        }
+      }
+    ]
+  }, [btnLookAudioFu, resubmitFu])
+
   return (
     <div className={styles.A1workbench}>
       <div className='pageTitle'>工作台</div>
@@ -277,6 +342,16 @@ function A1workbench() {
           succFu={gettStockFu}
         />
       ) : null}
+
+      {/* 藏品登记重新提交 */}
+      {editId.goodsId ? (
+        <A0addGoods
+          sId={editId.goodsId}
+          orderId={editId.orderId}
+          closeFu={() => setEditId({ orderId: 0, goodsId: 0, isEditresubmit: false })}
+          isEditresubmit={editId.isEditresubmit}
+        />
+      ) : null}
     </div>
   )
 }