|
|
|
@ -6,6 +6,9 @@ import { Button, ConfigProvider, Form, Input, Modal, Pagination, Select, Table,
|
|
|
|
|
import { rowClassName } from '@/utils';
|
|
|
|
|
import ButtonComp from '@/components/ButtonComp';
|
|
|
|
|
import { secretBodyImport, secretFormatList, secretList, secretUpdateSecret } from '@/services/my';
|
|
|
|
|
import { useParams } from 'umi';
|
|
|
|
|
import { fileStr, sysType, sysTypeStr } from '@/utils/sysType';
|
|
|
|
|
import ImportProgress from '@/components/ImportProgress';
|
|
|
|
|
|
|
|
|
|
export default function Page() {
|
|
|
|
|
const [activeTab, setActiveTab] = useState(1);
|
|
|
|
@ -18,15 +21,16 @@ export default function Page() {
|
|
|
|
|
const [productNumber, setProductNumber] = useState('');
|
|
|
|
|
const [speed, setSpeed] = useState(1);
|
|
|
|
|
const [selectData, setSelectData] = useState<any>({
|
|
|
|
|
keyType: [],
|
|
|
|
|
productName: [],
|
|
|
|
|
carrierType: [],
|
|
|
|
|
carrierNumber: [],
|
|
|
|
|
publisherType: [],
|
|
|
|
|
orderDirection: []
|
|
|
|
|
carrierModel: [],
|
|
|
|
|
net: []
|
|
|
|
|
});
|
|
|
|
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
|
|
|
const [allRowKeys, setAllRowKeys] = useState([]);
|
|
|
|
|
|
|
|
|
|
const urlParams = useParams();
|
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
|
|
|
|
|
const formItemSty = { width: 'auto', marginBottom: 20, marginRight: 30 };
|
|
|
|
@ -43,9 +47,9 @@ export default function Page() {
|
|
|
|
|
{ title: '载体类型', dataIndex: 'carrierType', key: 'carrierType', align: 'center' },
|
|
|
|
|
{ title: '载体型号', dataIndex: 'applyModel', key: 'applyModel', align: 'center' },
|
|
|
|
|
{ title: '数量', dataIndex: 'number', key: 'number', align: 'center' },
|
|
|
|
|
// { title: '来源', dataIndex: 'orderDirection', key: 'orderDirection', align: 'center' },
|
|
|
|
|
{ title: '来源', dataIndex: 'source', key: 'source', align: 'center' },
|
|
|
|
|
{ title: '当前状态', dataIndex: 'currentStatus', key: 'currentStatus', align: 'center' },
|
|
|
|
|
{ title: '导入时间', dataIndex: 'importTime', key: 'importTime', align: 'center' },
|
|
|
|
|
{ title: '导入时间', dataIndex: 'importTime', key: 'importTime', align: 'center'},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
@ -54,30 +58,32 @@ export default function Page() {
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
const initForm = () => {
|
|
|
|
|
form.setFieldsValue({
|
|
|
|
|
productName: '',
|
|
|
|
|
carrierType: '',
|
|
|
|
|
carrierNumber: '',
|
|
|
|
|
// orderDirection: '',
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取下拉框数据
|
|
|
|
|
const getSelect = () => {
|
|
|
|
|
secretFormatList({ pageNumber, pageSize }).then((res) => {
|
|
|
|
|
if (res?.result == "success") {
|
|
|
|
|
let list = res.data[0].list;
|
|
|
|
|
let productName = list.map((item: any) => { return { label: item.productName, value: item.productName } });
|
|
|
|
|
let carrierType = list.map((item: any) => { return { label: item.carrierType, value: item.carrierType } });
|
|
|
|
|
let carrierNumber = list.map((item: any) => { return { label: item.carrierNumber, value: item.carrierNumber } });
|
|
|
|
|
setSelectData({
|
|
|
|
|
productName: [{ label: '全部', value: '' }, ...productName],
|
|
|
|
|
carrierType: [{ label: '全部', value: '' }, ...carrierType],
|
|
|
|
|
carrierNumber: [{ label: '全部', value: '' }, ...carrierNumber],
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
message.error(res?.errorMsg);
|
|
|
|
|
}
|
|
|
|
|
setSelectData({
|
|
|
|
|
keyType: [
|
|
|
|
|
{ label: '密钥种类1', value: '密钥种类1' },
|
|
|
|
|
{ label: '密钥种类2', value: '密钥种类2' }
|
|
|
|
|
],
|
|
|
|
|
productName: [
|
|
|
|
|
{ label: '产品名称1', value: '产品名称1' },
|
|
|
|
|
{ label: '产品名称2', value: '产品名称2' }
|
|
|
|
|
],
|
|
|
|
|
carrierType: [
|
|
|
|
|
{ label: '软盘', value: '软盘' },
|
|
|
|
|
{ label: '移动盘', value: '移动盘' },
|
|
|
|
|
{ label: '全部', value: '全部' }
|
|
|
|
|
],
|
|
|
|
|
carrierModel: [
|
|
|
|
|
{ label: '三寸', value: '三寸' },
|
|
|
|
|
{ label: '全部', value: '全部' }
|
|
|
|
|
],
|
|
|
|
|
net: [
|
|
|
|
|
{ label: '来自产品1', value: '来自产品1' },
|
|
|
|
|
{ label: '来自产品2', value: '来自产品2' },
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -89,15 +95,10 @@ export default function Page() {
|
|
|
|
|
|
|
|
|
|
// 获取密钥体列表
|
|
|
|
|
const getList = () => {
|
|
|
|
|
let data = form.getFieldsValue()
|
|
|
|
|
let params = {
|
|
|
|
|
'secretImport.productName': data.productName,
|
|
|
|
|
'secretImport.carrierType': data.carrierType,
|
|
|
|
|
'secretImport.carrierNumber': data.carrierNumber,
|
|
|
|
|
}
|
|
|
|
|
secretList({ pageNumber, pageSize, ...params}).then((res) => {
|
|
|
|
|
secretList({ pageNumber, pageSize }).then((res) => {
|
|
|
|
|
if (res?.result == "success") {
|
|
|
|
|
setTotal(res.data[0].total)
|
|
|
|
|
res.data[0].list = res.data[0].list.filter((val: any) => {return val?.content != 'PMCS'})
|
|
|
|
|
setTotal(res.data[0].total - 1)
|
|
|
|
|
setTableData(res.data[0].list)
|
|
|
|
|
const keys = res.data[0].list.map((item: any) => item?.id);
|
|
|
|
|
setAllRowKeys(keys);
|
|
|
|
@ -133,6 +134,19 @@ export default function Page() {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let jg = false;
|
|
|
|
|
tableData.forEach((item: any) => {
|
|
|
|
|
selectedRowKeys.forEach(item2 => {
|
|
|
|
|
if (item2 == item?.id && item?.currentStatus == '已使用') {
|
|
|
|
|
jg = true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (jg) {
|
|
|
|
|
message.info('当前状态为已使用的不能删除, 请先将已使用的'); return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let promises = selectedRowKeys.map(item => {
|
|
|
|
|
return secretUpdateSecret({ id: item, type }).then((res) => {
|
|
|
|
|
if (res?.result === "success") {
|
|
|
|
@ -144,7 +158,7 @@ export default function Page() {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let str: any = { 1: '删除成功', 2: '还原成功', 3: '清理成功'}
|
|
|
|
|
let str: any = { 1: '删除成功', 2: '还原成功', 3: '清理成功' }
|
|
|
|
|
Promise.all(promises).then(results => {
|
|
|
|
|
let recordCount = results.reduce((acc: any, val) => acc + val, 0);
|
|
|
|
|
if (recordCount === selectedRowKeys.length) {
|
|
|
|
@ -156,6 +170,29 @@ export default function Page() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const uploadFiles = () => {
|
|
|
|
|
let data = form.getFieldsValue()
|
|
|
|
|
let sysTypeName: string = sysType[urlParams?.fileType] + fileStr[urlParams?.fileType]
|
|
|
|
|
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('file', fileInfo);
|
|
|
|
|
formData.append('productNumber', `${productNumber}`);
|
|
|
|
|
formData.append('keyType', `${data?.keyType}`);
|
|
|
|
|
formData.append('productName', `${data?.productName}`);
|
|
|
|
|
formData.append('carrierType', `${data?.carrierType}`);
|
|
|
|
|
formData.append('carrierModel', `${data?.carrierModel}`);
|
|
|
|
|
formData.append('net', `${data?.net}`);
|
|
|
|
|
formData.append('sysType', `${sysTypeStr[sysTypeName]}`);
|
|
|
|
|
secretBodyImport(formData).then((res) => {
|
|
|
|
|
if (res?.result == "success") {
|
|
|
|
|
setSpeed(4)
|
|
|
|
|
setVisibility(false)
|
|
|
|
|
} else {
|
|
|
|
|
message.error(res?.errorMsg);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className={`${styles.params_warp}`}>
|
|
|
|
|
<TabsComp
|
|
|
|
@ -164,40 +201,33 @@ export default function Page() {
|
|
|
|
|
onChange={(e) => setActiveTab(e)} />
|
|
|
|
|
|
|
|
|
|
<Form form={form} layout={'inline'} onFinish={onFinish} className='mt20'>
|
|
|
|
|
{/* <Form.Item name="keyType" label="密钥种类" style={formItemSty}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择密钥种类" onChange={(e) => { }} options={[
|
|
|
|
|
{ label: '全部', value: '' },
|
|
|
|
|
{ label: '1管理密销', value: 1 },
|
|
|
|
|
{ label: '2用户密钥', value: 2 },
|
|
|
|
|
{ label: '3用户密钥', value: 3 }
|
|
|
|
|
]} />
|
|
|
|
|
</Form.Item> */}
|
|
|
|
|
<Form.Item name="productName" label="产品名称" style={formItemSty}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择产品名称" onChange={(e) => { }} options={selectData.productName} />
|
|
|
|
|
<Form.Item name="keyType" label="密钥种类" style={formItemSty} rules={[{ required: true, message: '请选择密钥种类' }]}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择密钥种类" options={selectData.keyType} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item name="carrierType" label="载体类型" style={formItemSty}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择载体类型" onChange={(e) => { }} options={selectData.carrierType} />
|
|
|
|
|
<Form.Item name="productName" label="产品名称" style={formItemSty} rules={[{ required: true, message: '请选择产品名称' }]}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择产品名称" options={selectData.productName} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item name="carrierNumber" label="载体型号" style={formItemSty}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择载体型号" onChange={(e) => { }} options={selectData.carrierNumber} />
|
|
|
|
|
<Form.Item name="carrierType" label="载体类型" style={formItemSty} rules={[{ required: true, message: '请选择载体类型' }]}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择载体类型" options={selectData.carrierType} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item name="carrierModel" label="载体型号" style={formItemSty} rules={[{ required: true, message: '请选择载体型号' }]}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择载体型号" options={selectData.carrierModel} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item name="net" label="来源" style={{ ...formItemSty, marginLeft: 30 }} rules={[{ required: true, message: '请选择来源' }]}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择来源" options={selectData.net} />
|
|
|
|
|
</Form.Item>
|
|
|
|
|
{/* <Form.Item name="orderDirection" label=" 来源" style={formItemSty}>
|
|
|
|
|
<Select style={{ width: 260 }} placeholder="请选择来源" onChange={(e) => { }} options={[
|
|
|
|
|
{ label: '全部', value: '' },
|
|
|
|
|
{ label: '来自产品1', value: 1 },
|
|
|
|
|
{ label: '来自产品2', value: 2 },
|
|
|
|
|
]} />
|
|
|
|
|
</Form.Item> */}
|
|
|
|
|
</Form>
|
|
|
|
|
|
|
|
|
|
<div className='flex_jE' style={{ marginBottom: 30 }}>
|
|
|
|
|
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'导入'} onClick={() => {
|
|
|
|
|
setSpeed(1);
|
|
|
|
|
setFileInfo(null);
|
|
|
|
|
setProductNumber('');
|
|
|
|
|
setVisibility(true)
|
|
|
|
|
form.validateFields().then(() => {
|
|
|
|
|
setSpeed(1);
|
|
|
|
|
setFileInfo(null);
|
|
|
|
|
setProductNumber('');
|
|
|
|
|
setVisibility(true)
|
|
|
|
|
})
|
|
|
|
|
}} />
|
|
|
|
|
<ButtonComp text={'查询'} onClick={() => form.submit()} />
|
|
|
|
|
<ButtonComp text={'查询'} onClick={() => onFinish()} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className='mb20 flex_aiC_jB'>
|
|
|
|
@ -237,14 +267,14 @@ export default function Page() {
|
|
|
|
|
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'删除'} onClick={() => sending(1)} />
|
|
|
|
|
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'还原'} onClick={() => sending(2)} />
|
|
|
|
|
<ButtonComp style={{ marginRight: 20 }} type={'cancel'} text={'清理'} onClick={() => sending(3)} />
|
|
|
|
|
<ButtonComp type={'cancel'} text={'载体输出'} onClick={() => { message.info('建设中')}} />
|
|
|
|
|
<ButtonComp type={'cancel'} text={'载体输出'} onClick={() => { message.info('建设中') }} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Modal
|
|
|
|
|
title="请确认或者输入产品编号"
|
|
|
|
|
open={visibility}
|
|
|
|
|
centered
|
|
|
|
|
width={550}
|
|
|
|
|
width={speed != 2 ? 425 : 515}
|
|
|
|
|
onCancel={() => setVisibility(false)}
|
|
|
|
|
footer={null}>
|
|
|
|
|
<div>
|
|
|
|
@ -266,39 +296,32 @@ export default function Page() {
|
|
|
|
|
<div className='mb10'>请选择载体的输入路径</div>
|
|
|
|
|
<div className='flex_aiC'>
|
|
|
|
|
<span style={{ marginRight: 4, color: 'red' }}>*</span>文件路径
|
|
|
|
|
<Input style={{ width: 300, marginLeft: 16 }} value={fileInfo?.name || ''} disabled={true} />
|
|
|
|
|
<Input style={{ width: 300, marginLeft: 16 }} value={fileInfo?.name || ''} disabled={true} />
|
|
|
|
|
<Upload {...props} showUploadList={false}>
|
|
|
|
|
<ButtonComp style={{ marginLeft: 20 }} text={'选择'} onClick={() => { }} />
|
|
|
|
|
<ButtonComp style={{ marginLeft: 20 }} text={'选择'} />
|
|
|
|
|
</Upload>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
{speed == 3 && <div>是否到密钥体?</div>}
|
|
|
|
|
{speed == 4 && <div>导入密钥体成功</div>}
|
|
|
|
|
{speed == 5 && <div>导入密钥体成功!</div>}
|
|
|
|
|
{speed == 6 && <div>导入密钥体失败!</div>}
|
|
|
|
|
</div>
|
|
|
|
|
<div className='flex_jE mt20'>
|
|
|
|
|
<ButtonComp style={{ marginRight: 20 }} text={'确定'} onClick={() => {
|
|
|
|
|
switch (speed) {
|
|
|
|
|
case 1:
|
|
|
|
|
if (!productNumber.trim()) { message.error('产品编号不能为空'); return }
|
|
|
|
|
if (!productNumber.trim()) { message.error('请输入产品编号'); return }
|
|
|
|
|
setSpeed(2)
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('file', fileInfo);
|
|
|
|
|
formData.append('productNumber', `${productNumber}`);
|
|
|
|
|
secretBodyImport(formData).then((res) => {
|
|
|
|
|
if (res?.result == "success") {
|
|
|
|
|
setSpeed(3)
|
|
|
|
|
} else {
|
|
|
|
|
message.error(res?.errorMsg);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (!fileInfo) { message.error('请选择文件路径'); return }
|
|
|
|
|
setSpeed(3)
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
setSpeed(4)
|
|
|
|
|
uploadFiles()
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
case 5:
|
|
|
|
|
onFinish()
|
|
|
|
|
setVisibility(false)
|
|
|
|
|
break;
|
|
|
|
@ -307,6 +330,11 @@ export default function Page() {
|
|
|
|
|
<ButtonComp type='cancel' text={'取消'} onClick={() => setVisibility(false)} />
|
|
|
|
|
</div>
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
{speed == 4 && <ImportProgress show={speed == 4 ? true : false} onoK={() => {
|
|
|
|
|
setVisibility(true)
|
|
|
|
|
setSpeed(5)
|
|
|
|
|
}}/>}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|