|
@@ -1,4 +1,4 @@
|
|
|
-import React, { useMemo, useState, useEffect } from 'react'
|
|
|
|
|
|
|
+import React, { useMemo, useState, useEffect, useCallback } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
import styles from './index.module.scss'
|
|
|
import history from '@/utils/history'
|
|
import history from '@/utils/history'
|
|
|
import { MessageFu } from '@/utils/message'
|
|
import { MessageFu } from '@/utils/message'
|
|
@@ -12,6 +12,7 @@ import { baseFormData } from '@/pages/Zother/data'
|
|
|
import { voucherCenterTableC } from '@/utils/tableData'
|
|
import { voucherCenterTableC } from '@/utils/tableData'
|
|
|
import { Button, message } from 'antd'
|
|
import { Button, message } from 'antd'
|
|
|
import tabLeftArr from '@/pages/Layout/data'
|
|
import tabLeftArr from '@/pages/Layout/data'
|
|
|
|
|
+import { downloadFileByUrl } from '@/utils'
|
|
|
|
|
|
|
|
function A4proof() {
|
|
function A4proof() {
|
|
|
const tableInfo = useSelector((state: RootState) => state.A4proof.tableInfo)
|
|
const tableInfo = useSelector((state: RootState) => state.A4proof.tableInfo)
|
|
@@ -67,7 +68,7 @@ function A4proof() {
|
|
|
window.open(fullUrl)
|
|
window.open(fullUrl)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // 已知路径,单独下载
|
|
|
|
|
|
|
+ // 已知路径,单独下载 改为使用downloadFileByUrl
|
|
|
// const downloadSingleFn = (path: string, fileName: string) => {
|
|
// const downloadSingleFn = (path: string, fileName: string) => {
|
|
|
// const downloadUrl = `${baseURL}${path}`
|
|
// const downloadUrl = `${baseURL}${path}`
|
|
|
// const link = document.createElement('a')
|
|
// const link = document.createElement('a')
|
|
@@ -89,12 +90,19 @@ function A4proof() {
|
|
|
setList(arr)
|
|
setList(arr)
|
|
|
}, [])
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
+ // 点击各种操作按钮
|
|
|
|
|
+ const tableBtnFu = useCallback((id: number, key: string) => {
|
|
|
|
|
+ history.push(`/proof_edit/${key}/${id}`)
|
|
|
|
|
+ }, [])
|
|
|
|
|
+
|
|
|
const staBtn = useMemo(() => {
|
|
const staBtn = useMemo(() => {
|
|
|
return [
|
|
return [
|
|
|
{
|
|
{
|
|
|
- title: '申请类型',
|
|
|
|
|
|
|
+ title: '业务类型',
|
|
|
render: (item: any) => {
|
|
render: (item: any) => {
|
|
|
let txt = '(空)'
|
|
let txt = '(空)'
|
|
|
|
|
+ console.log('--------', item.moduleName)
|
|
|
|
|
+
|
|
|
const obj = list.find(v => v.value === item.moduleName)
|
|
const obj = list.find(v => v.value === item.moduleName)
|
|
|
if (obj) txt = obj.label
|
|
if (obj) txt = obj.label
|
|
|
return txt
|
|
return txt
|
|
@@ -159,32 +167,13 @@ function A4proof() {
|
|
|
title: '操作',
|
|
title: '操作',
|
|
|
render: (item: any) => (
|
|
render: (item: any) => (
|
|
|
<>
|
|
<>
|
|
|
- <Button
|
|
|
|
|
- size='small'
|
|
|
|
|
- type='text'
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- console.log(item)
|
|
|
|
|
- const obj = list.find(v => v.value === item.type)
|
|
|
|
|
- if (obj) {
|
|
|
|
|
- authorityFu(obj.id, obj.label, () =>
|
|
|
|
|
- history.push(`${obj.path}_edit/4/${item.id}`)
|
|
|
|
|
- )
|
|
|
|
|
- } else MessageFu.warning('申请类型错误')
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <Button size='small' type='text' onClick={() => tableBtnFu(item.moduleId, '4')}>
|
|
|
查看
|
|
查看
|
|
|
</Button>
|
|
</Button>
|
|
|
<Button
|
|
<Button
|
|
|
size='small'
|
|
size='small'
|
|
|
type='text'
|
|
type='text'
|
|
|
- onClick={() => {
|
|
|
|
|
- const id = Number(item.id)
|
|
|
|
|
- if (Number.isNaN(id)) {
|
|
|
|
|
- message.error('当前附件ID异常,无法下载')
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- downloadFn(id)
|
|
|
|
|
- }}
|
|
|
|
|
|
|
+ onClick={() => downloadFileByUrl(item.filePath, item.fileName)}
|
|
|
>
|
|
>
|
|
|
下载
|
|
下载
|
|
|
</Button>
|
|
</Button>
|
|
@@ -192,7 +181,7 @@ function A4proof() {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
- }, [list])
|
|
|
|
|
|
|
+ }, [tableBtnFu])
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.A4proof}>
|
|
<div className={styles.A4proof}>
|
|
@@ -201,7 +190,7 @@ function A4proof() {
|
|
|
<TableList
|
|
<TableList
|
|
|
baseFormData={baseFormData}
|
|
baseFormData={baseFormData}
|
|
|
getListAPI={API_getGoodsList}
|
|
getListAPI={API_getGoodsList}
|
|
|
- pageKey='A4proof'
|
|
|
|
|
|
|
+ pageKey='proof'
|
|
|
tableInfo={tableInfo}
|
|
tableInfo={tableInfo}
|
|
|
columnsTemp={voucherCenterTableC}
|
|
columnsTemp={voucherCenterTableC}
|
|
|
rightBtnWidth={240}
|
|
rightBtnWidth={240}
|