This commit is contained in:
zhangds 2022-08-16 15:18:04 +08:00
parent 496047276b
commit a5dc4e1a6f
2 changed files with 127 additions and 62 deletions

View File

@ -200,7 +200,7 @@ const UseUploadExcel = (props) => {
<div> - 支持文件类型xlsxlsxcsv</div> <div> - 支持文件类型xlsxlsxcsv</div>
<div> <div>
- 支持所有基础字段的导入一次至多导入 10000 - 支持所有基础字段的导入一次至多导入 10000
手机号不符合规则整条任务不予以导入 key码不符合规则整条任务不予以导入
</div> </div>
</div> </div>
</div> </div>
@ -358,7 +358,7 @@ const UseUploadExcel = (props) => {
return ( return (
<div> <div>
<div className="file-upload-tip"> <div className="file-upload-tip">
文件上传成功. {totalData} 手机号,其中 {totalData - errCoun} 文件上传成功. {totalData} key码,其中 {totalData - errCoun}
条可成功导入 条可成功导入
</div> </div>
<div className="file-errmsg1"> <div className="file-errmsg1">

View File

@ -157,6 +157,10 @@ const UseKeyList = () => {
usageTotal: 0, usageTotal: 0,
outdateTotal: 0, outdateTotal: 0,
invalidTotal: 0, invalidTotal: 0,
dialogTitle: "",
bachVisible: false,
bachUrl: "",
bachApiType: 0,
}); });
/** /**
@ -187,7 +191,7 @@ const UseKeyList = () => {
}; };
/** /**
* 获取表 * 获取表
*/ */
const getTable = () => { const getTable = () => {
const param = getParam(); const param = getParam();
@ -244,42 +248,6 @@ const UseKeyList = () => {
setState({ page: 1, limit: 10, hash: "" }); setState({ page: 1, limit: 10, hash: "" });
}; };
/**
* 批量上传操作
*/
const bachUploadQuery = () => {
let obj = {
bachUrl: "/key/import?type=1",
dialogTitle: "批量上传查询",
bachVisible: true,
bachApiType: 1,
};
};
/**
* 批量上传作废
*/
const bachUploadVoid = () => {
let obj = {
bachUrl: "/key/import?type=2",
dialogTitle: "批量上传作废",
bachVisible: true,
bachApiType: 2,
};
};
/**
* 批量上传使用
*/
const bachUploadTagUse = () => {
let obj = {
bachUrl: "/key/import?type=3",
dialogTitle: "批量上传使用",
bachVisible: true,
bachApiType: 3,
};
};
/** /**
* 清空 select table * 清空 select table
*/ */
@ -350,8 +318,10 @@ const UseKeyList = () => {
*/ */
const bachExportKey = () => { const bachExportKey = () => {
let tag = false; let tag = false;
let param = getParam(); let param = getParam();
delete param.page;
delete param.limit;
// hash
if (state.hash !== "") { if (state.hash !== "") {
param.hash = state.hash; param.hash = state.hash;
} }
@ -367,6 +337,7 @@ const UseKeyList = () => {
tag = true; tag = true;
} }
} }
// //
if (state.selectTable.length > 0) { if (state.selectTable.length > 0) {
let key_arr = []; let key_arr = [];
@ -378,8 +349,6 @@ const UseKeyList = () => {
}; };
tag = true; tag = true;
} }
console.log("param =>", param);
return;
if (tag) { if (tag) {
exportKey(param).then((res) => { exportKey(param).then((res) => {
if (res.type == "application/json") { if (res.type == "application/json") {
@ -412,7 +381,6 @@ const UseKeyList = () => {
}; };
const selectionFun = (data) => { const selectionFun = (data) => {
console.log("data select =>", data);
if (data.length > 0) { if (data.length > 0) {
setState({ multipleDisabledBtn: false }); setState({ multipleDisabledBtn: false });
} else { } else {
@ -475,6 +443,101 @@ const UseKeyList = () => {
} }
}; };
/**
* 批量上传操作
*/
const bachUploadQuery = () => {
let obj = {
bachUrl: "/key/import?type=1",
dialogTitle: "批量上传查询",
bachVisible: true,
bachApiType: 1,
};
setState(obj);
};
/**
* 批量上传作废
*/
const bachUploadVoid = () => {
let obj = {
bachUrl: "/key/import?type=2",
dialogTitle: "批量上传作废",
bachVisible: true,
bachApiType: 2,
};
setState(obj);
};
/**
* 批量上传使用
*/
const bachUploadTagUse = () => {
let obj = {
bachUrl: "/key/import?type=3",
dialogTitle: "批量上传使用",
bachVisible: true,
bachApiType: 3,
};
setState(obj);
};
const bachOnClose = () => {
setState({ bachVisible: false });
};
const bachImportBtn = (data) => {
//
if (state.bachApiType === 1) {
setState({ page: 1, hash: data, isQuery: !state.isQuery });
return;
}
//
if (state.bachApiType === 2) {
batchUploadVoid({ hash: data }).then((res) => {
handelResponse(
res,
(req, msg) => {
Notify.success("批量上传标记为作废");
setState({
page: 1,
limit: 10,
hash: data,
isQuery: !state.isQuery,
});
},
(err) => {
Notify.error(err);
}
);
});
return;
}
// 使
if (state.bachApiType === 3) {
batchUploadUsed({ hash: data }).then((res) => {
handelResponse(
res,
(req, msg) => {
Notify.success("批量上传标记为使用");
setState({
page: 1,
limit: 10,
hash: data,
isQuery: !state.isQuery,
});
},
(err) => {
Notify.error(err);
}
);
});
return;
}
};
return ( return (
<div className="key-container" id="dislist"> <div className="key-container" id="dislist">
<TabPage tabs={state.tabList} style={{ paddingBottom: 0 }}> <TabPage tabs={state.tabList} style={{ paddingBottom: 0 }}>
@ -587,23 +650,6 @@ const UseKeyList = () => {
); );
} }
if (com == "opearo") { if (com == "opearo") {
<span>
<Dropdown position={DropdownPosition.RightTop}>
<DropdownContent>
<Menu
onClick={(e, key) => menuItemClick(e, key, rowData)}
>
<MenuItem key="1" disabled>
标记成已使用
</MenuItem>
<MenuItem key="2" disabled={rowData.status != 2}>
作废
</MenuItem>
</Menu>
</DropdownContent>
</Dropdown>
</span>;
return ( return (
<span> <span>
<a <a
@ -622,10 +668,20 @@ const UseKeyList = () => {
<Menu <Menu
onClick={(e, key) => menuItemClick(e, key, rowData)} onClick={(e, key) => menuItemClick(e, key, rowData)}
> >
<MenuItem key="1" disabled={rowData.status != 1}> <MenuItem
key="1"
disabled={rowData.status === 1 ? false : true}
>
标记成已使用 标记成已使用
</MenuItem> </MenuItem>
<MenuItem key="2" disabled={rowData.status != 2}> <MenuItem
key="2"
disabled={
rowData.status !== 4 && rowData.status !== 3
? false
: true
}
>
作废 作废
</MenuItem> </MenuItem>
<MenuItem key="3">日志</MenuItem> <MenuItem key="3">日志</MenuItem>
@ -639,6 +695,15 @@ const UseKeyList = () => {
/> />
</div> </div>
</TabPage> </TabPage>
{/* 批量上传 */}
<UseUploadExcel
title={state.dialogTitle}
visible={state.bachVisible}
url={state.bachUrl}
onClose={() => bachOnClose()}
onImport={(data) => bachImportBtn(data)}
></UseUploadExcel>
</div> </div>
); );
}; };