From 54735790a866023caa4b979bf066d9473a40d254 Mon Sep 17 00:00:00 2001 From: zhangds Date: Thu, 15 Jun 2023 09:44:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E4=BD=9C=E5=BA=9F=E6=8E=A5=E5=8F=A3=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 11 ++ src/components/UseUploadExcel/index.jsx | 135 ++++++++++++------------ src/pages/plan/keyList/index.jsx | 45 ++++---- src/tools/apiTools copy.js | 53 ++++++++++ src/tools/apiTools.js | 66 +++++++----- 5 files changed, 199 insertions(+), 111 deletions(-) create mode 100644 src/tools/apiTools copy.js diff --git a/src/assets/api.js b/src/assets/api.js index b4411ff8..5888b9be 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -981,4 +981,15 @@ export const dingTaskQuery = (id) => { export const searchPendingOrderByObject = (data) => { return req("get", baseurl + "/order/searchPendingOrderByObject", data); }; + +// 批量作废--文件上传 +export const searchPendingOrderByHash = (data) => { + return req("post", baseurl + "/order/searchPendingOrderByHash", data); +}; + +// 批量作废--列表check +export const searchPendingOrderByKeys = (data) => { + return req("post", baseurl + "/order/searchPendingOrderByKeys", data); +}; + export { req }; diff --git a/src/components/UseUploadExcel/index.jsx b/src/components/UseUploadExcel/index.jsx index bcb7e8e7..8a44c6b0 100644 --- a/src/components/UseUploadExcel/index.jsx +++ b/src/components/UseUploadExcel/index.jsx @@ -6,16 +6,16 @@ import "./style.less"; const columns = [ { title: "行号", - name: "id" + name: "id", }, { title: "key", - name: "key" + name: "key", }, { title: "错误原因", - name: "msg" - } + name: "msg", + }, ]; const UseUploadExcel = (props) => { @@ -78,7 +78,7 @@ const UseUploadExcel = (props) => { return { key: item.key, id: index + 1, - msg: erObj(item.msg) + msg: erObj(item.msg), }; }); setTableData(errArr); @@ -176,23 +176,23 @@ const UseUploadExcel = (props) => { const uploadTop = () => { return (
-
-
-
1
- 上传文件 +
+
+
1
+ 上传文件
-
-
+
+
-
-
2
- 导入完成 +
+
2
+ 导入完成
-
-
直接上传
-
+
+
直接上传
+
- 支持文件类型:xls,xlsx,csv
- 支持所有基础字段的导入,一次至多导入 100 @@ -210,12 +210,12 @@ const UseUploadExcel = (props) => { */ const uploadExcel = () => { return ( -
+
(e.target.value = "")} onChange={(e) => fileChange(e)} /> @@ -223,8 +223,9 @@ const UseUploadExcel = (props) => { style={{ background: "#1890ff", color: "#FFFFFF", - border: "none" - }}> + border: "none", + }} + > 上传文件
@@ -237,16 +238,16 @@ const UseUploadExcel = (props) => { */ const tipSuccess = () => { return ( -
- +
+ 文件解析成功, 点击 "确定导入" 即可导入
); }; const tipErr = () => { return ( -
- +
+ 文件解析失败, 请查看导入规则并更新文件
); @@ -258,21 +259,21 @@ const UseUploadExcel = (props) => { */ const upFilesExcel = () => { return ( -
-
-

- +

+
+

+ {filesName}

-
+
(e.target.value = "")} onChange={(e) => fileChange(e)} /> - + 更新文件
@@ -297,26 +298,27 @@ const UseUploadExcel = (props) => { */ const uploadFooter = () => { return ( -
-
下载模板并填写后上传
-
+
+
下载模板并填写后上传
+
请先下载「数字世界营销管理系统_keys_模板」并按照模板填写后再上传。
-
-
@@ -352,42 +355,44 @@ const UseUploadExcel = (props) => { const partSuccess = () => { return (
-
+
文件上传成功.共 {totalData} 条key码,其中 {totalData - errCoun} 条可成功导入
-
+
发现以下 {errCoun} 条不符合要求,将不会被导入
-
+
-
-
+
+
@@ -400,14 +405,14 @@ const UseUploadExcel = (props) => {
{visible ? (
-
-
- -
-
{title}
+
+
+ +
+
{title}
bachOnClose()} />
diff --git a/src/pages/plan/keyList/index.jsx b/src/pages/plan/keyList/index.jsx index c2bf3a5c..269ab251 100644 --- a/src/pages/plan/keyList/index.jsx +++ b/src/pages/plan/keyList/index.jsx @@ -271,25 +271,34 @@ const UseKeyList = () => { return item.key; }); - let formdata = { - keys: keys, - }; - keyBatchCancel(formdata).then((res) => { - handelResponse( - res, - (req, msg) => { - Notify.success("批量作废成功"); - clearSelectTableBtn(); - setState({ - multipleDisabledBtn: true, - isQuery: !state.isQuery, + let param = { keys: keys }; + try { + commonSearchOrder(param, 2).then((res) => { + if (res === 1 || res === 2) { + let formdata = { + keys: keys, + }; + keyBatchCancel(formdata).then((res) => { + handelResponse( + res, + (req, msg) => { + Notify.success("批量作废成功"); + clearSelectTableBtn(); + setState({ + multipleDisabledBtn: true, + isQuery: !state.isQuery, + }); + }, + (err) => { + Notify.error(err); + } + ); }); - }, - (err) => { - Notify.error(err); } - ); - }); + }); + } catch (err) { + console.log("pages/plan/keyList/index.jsx =>", err); + } }; /** @@ -602,7 +611,7 @@ const UseKeyList = () => { onClick={() => multipleCancel()} disabled={state.multipleDisabledBtn} > - 批量作废 + 批量作废2