diff --git a/src/components/mycomponent/dialog/productListAddDialog.vue b/src/components/mycomponent/dialog/productListAddDialog.vue index a449c8b..af487f7 100644 --- a/src/components/mycomponent/dialog/productListAddDialog.vue +++ b/src/components/mycomponent/dialog/productListAddDialog.vue @@ -1,28 +1,52 @@ diff --git a/src/components/mycomponent/dialog/productListAddDialog.vue b/src/components/mycomponent/dialog/productListAddDialog.vue index a449c8b..af487f7 100644 --- a/src/components/mycomponent/dialog/productListAddDialog.vue +++ b/src/components/mycomponent/dialog/productListAddDialog.vue @@ -1,28 +1,52 @@ diff --git a/src/utils/myUtils/exportToExcel.js b/src/utils/myUtils/exportToExcel.js index d2a221e..b14957b 100644 --- a/src/utils/myUtils/exportToExcel.js +++ b/src/utils/myUtils/exportToExcel.js @@ -1,6 +1,6 @@ import {export_json_to_excel} from '../Export2Excel' -const outToExcel = (tableAry) => { +const outToExcel = (tableAry,filename = '') => { console.log(tableAry, '全部数据') const header = Object.keys(tableAry[0]) const data = tableAry.map((user, index) => { @@ -19,7 +19,8 @@ // //把定义好的header和data放进export_json_to_excel的函数里作为参数 export_json_to_excel({ header, - data + data, + filename }) } diff --git a/src/components/mycomponent/dialog/productListAddDialog.vue b/src/components/mycomponent/dialog/productListAddDialog.vue index a449c8b..af487f7 100644 --- a/src/components/mycomponent/dialog/productListAddDialog.vue +++ b/src/components/mycomponent/dialog/productListAddDialog.vue @@ -1,28 +1,52 @@ diff --git a/src/utils/myUtils/exportToExcel.js b/src/utils/myUtils/exportToExcel.js index d2a221e..b14957b 100644 --- a/src/utils/myUtils/exportToExcel.js +++ b/src/utils/myUtils/exportToExcel.js @@ -1,6 +1,6 @@ import {export_json_to_excel} from '../Export2Excel' -const outToExcel = (tableAry) => { +const outToExcel = (tableAry,filename = '') => { console.log(tableAry, '全部数据') const header = Object.keys(tableAry[0]) const data = tableAry.map((user, index) => { @@ -19,7 +19,8 @@ // //把定义好的header和data放进export_json_to_excel的函数里作为参数 export_json_to_excel({ header, - data + data, + filename }) } diff --git a/src/views/distributor/distributorList.vue b/src/views/distributor/distributorList.vue index 3956bd0..6638e3b 100644 --- a/src/views/distributor/distributorList.vue +++ b/src/views/distributor/distributorList.vue @@ -13,9 +13,9 @@
- 查询 + 查询 重置 - 导出 + 导出
{ + // 得到相关数据 + res.rows.forEach((item, index) => { + item.index = (index + 1) + ((offset - 1) * limit) + }) + this.tableData = res + }) + }, reset() { this.selectInfo = { distributorCode: '', distributorName: '' } + this.search(10, 1) }, detail(row) { this.$refs.distributorDetail.initDialog('detail', row) - } + }, + exportToExcel() { + console.log('导出') + // 全屏加载动画; + const loading = this.$loading({ + lock: true, + text: "数据处理中,请稍后...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + listPage(`limit=100000000&offset=1`, {}) + .then((res) => { + outToExcel(res.rows); + loading.close(); // 关闭加载动画 + this.$message({ + message: "导出成功", + type: "success", + }); + }) + .catch((error) => { + loading.close(); // 关闭加载动画 + this.$message({ + message: error.message, + type: "error", + }); + }); + }, } } diff --git a/src/components/mycomponent/dialog/productListAddDialog.vue b/src/components/mycomponent/dialog/productListAddDialog.vue index a449c8b..af487f7 100644 --- a/src/components/mycomponent/dialog/productListAddDialog.vue +++ b/src/components/mycomponent/dialog/productListAddDialog.vue @@ -1,28 +1,52 @@ diff --git a/src/utils/myUtils/exportToExcel.js b/src/utils/myUtils/exportToExcel.js index d2a221e..b14957b 100644 --- a/src/utils/myUtils/exportToExcel.js +++ b/src/utils/myUtils/exportToExcel.js @@ -1,6 +1,6 @@ import {export_json_to_excel} from '../Export2Excel' -const outToExcel = (tableAry) => { +const outToExcel = (tableAry,filename = '') => { console.log(tableAry, '全部数据') const header = Object.keys(tableAry[0]) const data = tableAry.map((user, index) => { @@ -19,7 +19,8 @@ // //把定义好的header和data放进export_json_to_excel的函数里作为参数 export_json_to_excel({ header, - data + data, + filename }) } diff --git a/src/views/distributor/distributorList.vue b/src/views/distributor/distributorList.vue index 3956bd0..6638e3b 100644 --- a/src/views/distributor/distributorList.vue +++ b/src/views/distributor/distributorList.vue @@ -13,9 +13,9 @@
- 查询 + 查询 重置 - 导出 + 导出
{ + // 得到相关数据 + res.rows.forEach((item, index) => { + item.index = (index + 1) + ((offset - 1) * limit) + }) + this.tableData = res + }) + }, reset() { this.selectInfo = { distributorCode: '', distributorName: '' } + this.search(10, 1) }, detail(row) { this.$refs.distributorDetail.initDialog('detail', row) - } + }, + exportToExcel() { + console.log('导出') + // 全屏加载动画; + const loading = this.$loading({ + lock: true, + text: "数据处理中,请稍后...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + listPage(`limit=100000000&offset=1`, {}) + .then((res) => { + outToExcel(res.rows); + loading.close(); // 关闭加载动画 + this.$message({ + message: "导出成功", + type: "success", + }); + }) + .catch((error) => { + loading.close(); // 关闭加载动画 + this.$message({ + message: error.message, + type: "error", + }); + }); + }, } } diff --git a/src/views/product/productList.vue b/src/views/product/productList.vue index 0cf79bc..a84eeeb 100644 --- a/src/views/product/productList.vue +++ b/src/views/product/productList.vue @@ -334,9 +334,9 @@ console.log(ids); batchDelete({ ids: ids }).then((res) => { this.$message({ - message: "删除成功", - type: "success", - }); + message: "删除成功", + type: "success", + }); this.refresh(); }); }); @@ -365,6 +365,23 @@ exportToExcel() { listPage("offset=1", {}).then((res) => { console.log(res.rows, "全部数据"); + // 对数据进行加工 + res.rows = res.rows.map((item) => { + return { + 产品名称: item.productName, + 产品品牌: item.brandName, + 产品型号: item.productCode, + 产品品类: item.categoryStr, + 产品颜色: item.productColor, + 产品材质: item.productMaterialQuality, + 产品状态: item.productStatus, + 产品版本: item.productEdition, + 规格: item.productPackageSize, + 重量: item.productWeight, + 国际69码: item.internationalCode, + 更新时间: item.updateTime, + }; + }); this.ExportTable = res.rows; const header = Object.keys(res.rows[0]); console.log(header); @@ -383,6 +400,7 @@ export_json_to_excel({ header, data, + filename: "产品列表", }); }); }, diff --git a/src/components/mycomponent/dialog/productListAddDialog.vue b/src/components/mycomponent/dialog/productListAddDialog.vue index a449c8b..af487f7 100644 --- a/src/components/mycomponent/dialog/productListAddDialog.vue +++ b/src/components/mycomponent/dialog/productListAddDialog.vue @@ -1,28 +1,52 @@ diff --git a/src/utils/myUtils/exportToExcel.js b/src/utils/myUtils/exportToExcel.js index d2a221e..b14957b 100644 --- a/src/utils/myUtils/exportToExcel.js +++ b/src/utils/myUtils/exportToExcel.js @@ -1,6 +1,6 @@ import {export_json_to_excel} from '../Export2Excel' -const outToExcel = (tableAry) => { +const outToExcel = (tableAry,filename = '') => { console.log(tableAry, '全部数据') const header = Object.keys(tableAry[0]) const data = tableAry.map((user, index) => { @@ -19,7 +19,8 @@ // //把定义好的header和data放进export_json_to_excel的函数里作为参数 export_json_to_excel({ header, - data + data, + filename }) } diff --git a/src/views/distributor/distributorList.vue b/src/views/distributor/distributorList.vue index 3956bd0..6638e3b 100644 --- a/src/views/distributor/distributorList.vue +++ b/src/views/distributor/distributorList.vue @@ -13,9 +13,9 @@
- 查询 + 查询 重置 - 导出 + 导出
{ + // 得到相关数据 + res.rows.forEach((item, index) => { + item.index = (index + 1) + ((offset - 1) * limit) + }) + this.tableData = res + }) + }, reset() { this.selectInfo = { distributorCode: '', distributorName: '' } + this.search(10, 1) }, detail(row) { this.$refs.distributorDetail.initDialog('detail', row) - } + }, + exportToExcel() { + console.log('导出') + // 全屏加载动画; + const loading = this.$loading({ + lock: true, + text: "数据处理中,请稍后...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + listPage(`limit=100000000&offset=1`, {}) + .then((res) => { + outToExcel(res.rows); + loading.close(); // 关闭加载动画 + this.$message({ + message: "导出成功", + type: "success", + }); + }) + .catch((error) => { + loading.close(); // 关闭加载动画 + this.$message({ + message: error.message, + type: "error", + }); + }); + }, } } diff --git a/src/views/product/productList.vue b/src/views/product/productList.vue index 0cf79bc..a84eeeb 100644 --- a/src/views/product/productList.vue +++ b/src/views/product/productList.vue @@ -334,9 +334,9 @@ console.log(ids); batchDelete({ ids: ids }).then((res) => { this.$message({ - message: "删除成功", - type: "success", - }); + message: "删除成功", + type: "success", + }); this.refresh(); }); }); @@ -365,6 +365,23 @@ exportToExcel() { listPage("offset=1", {}).then((res) => { console.log(res.rows, "全部数据"); + // 对数据进行加工 + res.rows = res.rows.map((item) => { + return { + 产品名称: item.productName, + 产品品牌: item.brandName, + 产品型号: item.productCode, + 产品品类: item.categoryStr, + 产品颜色: item.productColor, + 产品材质: item.productMaterialQuality, + 产品状态: item.productStatus, + 产品版本: item.productEdition, + 规格: item.productPackageSize, + 重量: item.productWeight, + 国际69码: item.internationalCode, + 更新时间: item.updateTime, + }; + }); this.ExportTable = res.rows; const header = Object.keys(res.rows[0]); console.log(header); @@ -383,6 +400,7 @@ export_json_to_excel({ header, data, + filename: "产品列表", }); }); }, diff --git a/src/views/product/snCodeRuls.vue b/src/views/product/snCodeRuls.vue index 58c8ca9..2a7b833 100644 --- a/src/views/product/snCodeRuls.vue +++ b/src/views/product/snCodeRuls.vue @@ -5,27 +5,62 @@
SN码 (固定标识):
- +
个数:
- +
- + 查询 - + 重置 - + 新增 - + 删除 - + 导出
@@ -49,19 +84,11 @@ diff --git a/src/utils/myUtils/exportToExcel.js b/src/utils/myUtils/exportToExcel.js index d2a221e..b14957b 100644 --- a/src/utils/myUtils/exportToExcel.js +++ b/src/utils/myUtils/exportToExcel.js @@ -1,6 +1,6 @@ import {export_json_to_excel} from '../Export2Excel' -const outToExcel = (tableAry) => { +const outToExcel = (tableAry,filename = '') => { console.log(tableAry, '全部数据') const header = Object.keys(tableAry[0]) const data = tableAry.map((user, index) => { @@ -19,7 +19,8 @@ // //把定义好的header和data放进export_json_to_excel的函数里作为参数 export_json_to_excel({ header, - data + data, + filename }) } diff --git a/src/views/distributor/distributorList.vue b/src/views/distributor/distributorList.vue index 3956bd0..6638e3b 100644 --- a/src/views/distributor/distributorList.vue +++ b/src/views/distributor/distributorList.vue @@ -13,9 +13,9 @@
- 查询 + 查询 重置 - 导出 + 导出
{ + // 得到相关数据 + res.rows.forEach((item, index) => { + item.index = (index + 1) + ((offset - 1) * limit) + }) + this.tableData = res + }) + }, reset() { this.selectInfo = { distributorCode: '', distributorName: '' } + this.search(10, 1) }, detail(row) { this.$refs.distributorDetail.initDialog('detail', row) - } + }, + exportToExcel() { + console.log('导出') + // 全屏加载动画; + const loading = this.$loading({ + lock: true, + text: "数据处理中,请稍后...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + listPage(`limit=100000000&offset=1`, {}) + .then((res) => { + outToExcel(res.rows); + loading.close(); // 关闭加载动画 + this.$message({ + message: "导出成功", + type: "success", + }); + }) + .catch((error) => { + loading.close(); // 关闭加载动画 + this.$message({ + message: error.message, + type: "error", + }); + }); + }, } } diff --git a/src/views/product/productList.vue b/src/views/product/productList.vue index 0cf79bc..a84eeeb 100644 --- a/src/views/product/productList.vue +++ b/src/views/product/productList.vue @@ -334,9 +334,9 @@ console.log(ids); batchDelete({ ids: ids }).then((res) => { this.$message({ - message: "删除成功", - type: "success", - }); + message: "删除成功", + type: "success", + }); this.refresh(); }); }); @@ -365,6 +365,23 @@ exportToExcel() { listPage("offset=1", {}).then((res) => { console.log(res.rows, "全部数据"); + // 对数据进行加工 + res.rows = res.rows.map((item) => { + return { + 产品名称: item.productName, + 产品品牌: item.brandName, + 产品型号: item.productCode, + 产品品类: item.categoryStr, + 产品颜色: item.productColor, + 产品材质: item.productMaterialQuality, + 产品状态: item.productStatus, + 产品版本: item.productEdition, + 规格: item.productPackageSize, + 重量: item.productWeight, + 国际69码: item.internationalCode, + 更新时间: item.updateTime, + }; + }); this.ExportTable = res.rows; const header = Object.keys(res.rows[0]); console.log(header); @@ -383,6 +400,7 @@ export_json_to_excel({ header, data, + filename: "产品列表", }); }); }, diff --git a/src/views/product/snCodeRuls.vue b/src/views/product/snCodeRuls.vue index 58c8ca9..2a7b833 100644 --- a/src/views/product/snCodeRuls.vue +++ b/src/views/product/snCodeRuls.vue @@ -5,27 +5,62 @@
SN码 (固定标识):
- +
个数:
- +
- + 查询 - + 重置 - + 新增 - + 删除 - + 导出
@@ -49,19 +84,11 @@