|
|
@ -10,11 +10,12 @@ const { Search } = Input; |
|
|
|
import { CreditCardFilled, FilePdfOutlined } from '@ant-design/icons'; |
|
|
|
import { agent } from 'superagent'; |
|
|
|
const CheckboxGroup = Checkbox.Group; |
|
|
|
|
|
|
|
import JSZip from 'jszip' |
|
|
|
import { savAes } from 'file-saver' |
|
|
|
|
|
|
|
function SpecificationLibrary ({ loading, clientHeight, actions, dispatch, }) { |
|
|
|
|
|
|
|
const { resourceRetrieval } = actions |
|
|
|
const { safetySpecification } = actions |
|
|
|
const [checkAll, setCheckAll] = useState(false) |
|
|
|
const [query, setQuery] = useState({ page: 0, limit: 20 }); |
|
|
|
const [fileData, setFileData] = useState({ data: [], count: 0 }) |
|
|
@ -32,7 +33,7 @@ function SpecificationLibrary ({ loading, clientHeight, actions, dispatch, }) { |
|
|
|
|
|
|
|
let resourceData = (data) => { |
|
|
|
let params = data || query |
|
|
|
dispatch(resourceRetrieval.getSpecifications({ keyword: keyword, ...params, })).then(res => { |
|
|
|
dispatch(safetySpecification.getSpecifications({ keyword: keyword, ...params, })).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setFileData({ data: res.payload.data?.rows, count: res.payload.data?.count }) |
|
|
|
|
|
|
@ -40,6 +41,7 @@ function SpecificationLibrary ({ loading, clientHeight, actions, dispatch, }) { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return <> |
|
|
|
|
|
|
|
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: 20 }}> |
|
|
@ -58,10 +60,16 @@ function SpecificationLibrary ({ loading, clientHeight, actions, dispatch, }) { |
|
|
|
<Button type="primary" onClick={() => { |
|
|
|
setFileModal(true) |
|
|
|
}}>上传</Button> |
|
|
|
<Button type="primary">下载</Button> |
|
|
|
<Button type="primary" onClick={() => { |
|
|
|
// let fileUrlList = fileData?.data?.filter(d => fileId.current.includes(d.id))?.map(s => s.path)
|
|
|
|
|
|
|
|
// RouteRequest.post(RouteTable.packBulk, { fileUrl: fileUrlList });
|
|
|
|
|
|
|
|
|
|
|
|
}}>下载</Button> |
|
|
|
<Button type="primary" onClick={() => { |
|
|
|
if (fileId.current?.length) { |
|
|
|
dispatch(resourceRetrieval.delSpecifications(fileId.current)).then(res => { |
|
|
|
dispatch(safetySpecification.delSpecifications(fileId.current)).then(res => { |
|
|
|
if (res.success) { |
|
|
|
let url = [] |
|
|
|
fileData?.data?.map(f => { |
|
|
@ -115,7 +123,7 @@ function SpecificationLibrary ({ loading, clientHeight, actions, dispatch, }) { |
|
|
|
> |
|
|
|
{ |
|
|
|
fileData?.data?.map((v, i) => { |
|
|
|
return <div style={{ width: 310, display: 'inline-block', margin:'0 18px 10px 0', }}> |
|
|
|
return <div style={{ width: 310, display: 'inline-block', margin: '0 18px 10px 0', }}> |
|
|
|
<div style={{ display: 'flex', padding: '10px 0', border: `1px solid ${fileId.current?.includes(v.id) ? 'rgb(42 207 98)' : '#fff'}` }} onClick={() => { |
|
|
|
if (fileId.current?.includes(v.id)) { |
|
|
|
fileId.current = fileId.current?.filter(c => c != v.id) |
|
|
|