diff --git a/src/components/UseUploadExcel/index.jsx b/src/components/UseUploadExcel/index.jsx index 91222ab8..85d3be9d 100644 --- a/src/components/UseUploadExcel/index.jsx +++ b/src/components/UseUploadExcel/index.jsx @@ -200,7 +200,7 @@ const UseUploadExcel = (props) => {
- 支持文件类型:xls,xlsx,csv
- 支持所有基础字段的导入,一次至多导入 10000 - 条手机号(不符合规则整条任务不予以导入) + 条key码(不符合规则整条任务不予以导入)
@@ -358,7 +358,7 @@ const UseUploadExcel = (props) => { return (
- 文件上传成功.共 {totalData} 条手机号,其中 {totalData - errCoun} + 文件上传成功.共 {totalData} 条key码,其中 {totalData - errCoun} 条可成功导入
diff --git a/src/pages/plan/keyList/index.jsx b/src/pages/plan/keyList/index.jsx index fe667f25..da6aa937 100644 --- a/src/pages/plan/keyList/index.jsx +++ b/src/pages/plan/keyList/index.jsx @@ -157,6 +157,10 @@ const UseKeyList = () => { usageTotal: 0, outdateTotal: 0, invalidTotal: 0, + dialogTitle: "", + bachVisible: false, + bachUrl: "", + bachApiType: 0, }); /** @@ -187,7 +191,7 @@ const UseKeyList = () => { }; /** - * 获取表单 + * 获取表格 */ const getTable = () => { const param = getParam(); @@ -244,42 +248,6 @@ const UseKeyList = () => { 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 */ @@ -350,8 +318,10 @@ const UseKeyList = () => { */ const bachExportKey = () => { let tag = false; - let param = getParam(); + delete param.page; + delete param.limit; + // hash if (state.hash !== "") { param.hash = state.hash; } @@ -367,6 +337,7 @@ const UseKeyList = () => { tag = true; } } + // 如果用户勾选的数据 只导出 if (state.selectTable.length > 0) { let key_arr = []; @@ -378,8 +349,6 @@ const UseKeyList = () => { }; tag = true; } - console.log("param =>", param); - return; if (tag) { exportKey(param).then((res) => { if (res.type == "application/json") { @@ -412,7 +381,6 @@ const UseKeyList = () => { }; const selectionFun = (data) => { - console.log("data select =>", data); if (data.length > 0) { setState({ multipleDisabledBtn: false }); } 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 (
@@ -587,23 +650,6 @@ const UseKeyList = () => { ); } if (com == "opearo") { - - - - menuItemClick(e, key, rowData)} - > - - 标记成已使用 - - - 作废 - - - - - ; - return ( { menuItemClick(e, key, rowData)} > - + 标记成已使用 - + 作废 日志 @@ -639,6 +695,15 @@ const UseKeyList = () => { />
+ + {/* 批量上传 */} + bachOnClose()} + onImport={(data) => bachImportBtn(data)} + >
); };