运检食堂代码更新2
This commit is contained in:
parent
460ec31177
commit
b0c2b0cd3b
12
package.json
12
package.json
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "bonus",
|
"name": "bonus",
|
||||||
"version": "3.6.4",
|
"version": "3.6.4",
|
||||||
"description": "绿智食堂",
|
"description": "博诺思管理系统",
|
||||||
"author": "博创",
|
"author": "博诺思",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve",
|
||||||
|
|
@ -49,20 +49,22 @@
|
||||||
"js-beautify": "1.13.0",
|
"js-beautify": "1.13.0",
|
||||||
"js-cookie": "3.0.1",
|
"js-cookie": "3.0.1",
|
||||||
"jsencrypt": "3.0.0-rc.1",
|
"jsencrypt": "3.0.0-rc.1",
|
||||||
|
"jszip": "^3.10.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"quill": "1.3.7",
|
"quill": "1.3.7",
|
||||||
"screenfull": "5.0.2",
|
"screenfull": "5.0.2",
|
||||||
"sm-crypto": "^0.3.13",
|
"sm-crypto": "^0.3.13",
|
||||||
"sortablejs": "1.10.2",
|
"sortablejs": "1.10.2",
|
||||||
"wl-core": "^1.1.9",
|
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"vue": "2.6.12",
|
"vue": "2.6.12",
|
||||||
"vue-count-to": "1.0.13",
|
"vue-count-to": "1.0.13",
|
||||||
"vue-cropper": "0.5.5",
|
"vue-cropper": "0.5.5",
|
||||||
"vue-meta": "2.4.0",
|
"vue-meta": "2.4.0",
|
||||||
"vue-router": "3.4.9",
|
"vue-router": "3.4.9",
|
||||||
"vuedraggable": "2.24.3",
|
"vuedraggable": "2.24.3",
|
||||||
"vuex": "3.6.0"
|
"vuex": "3.6.0",
|
||||||
|
"webstomp-client": "^1.2.6",
|
||||||
|
"wl-core": "^1.1.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vue/cli-plugin-babel": "4.4.6",
|
"@vue/cli-plugin-babel": "4.4.6",
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,9 @@ import {
|
||||||
} from "@/api/canteen/customers";
|
} from "@/api/canteen/customers";
|
||||||
import {findDict} from "@/api/canteen/foodStatistics";
|
import {findDict} from "@/api/canteen/foodStatistics";
|
||||||
import {listCanteenAll} from "@/api/canteen/canteenIncome";
|
import {listCanteenAll} from "@/api/canteen/canteenIncome";
|
||||||
|
import JSZip from 'jszip';
|
||||||
|
import { saveAs } from 'file-saver';
|
||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Customers",
|
name: "Customers",
|
||||||
|
|
@ -524,10 +527,48 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
async handleExport() {
|
||||||
this.yjDownload('/canteen/customers/exportCustomers', {
|
const params = { ...this.queryParams };
|
||||||
...this.queryParams
|
// 对手机号加密同查询逻辑保持一致
|
||||||
}, `食堂客户.xlsx`)
|
if (this.queryPhonenumber) {
|
||||||
|
params.phonenumber = btoa(this.queryPhonenumber);
|
||||||
|
}
|
||||||
|
const excelFileName = '食堂客户.xlsx';
|
||||||
|
// 开启加载提示
|
||||||
|
const loadingInstance = this.$loading({
|
||||||
|
lock: true,
|
||||||
|
text: '正在导出,请稍候...',
|
||||||
|
spinner: 'el-icon-loading',
|
||||||
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const data = await request({
|
||||||
|
url: '/canteen/customers/exportCustomers',
|
||||||
|
method: 'post',
|
||||||
|
data: params,
|
||||||
|
responseType: 'blob'
|
||||||
|
});
|
||||||
|
// data 为 zip Blob
|
||||||
|
const zip = await JSZip.loadAsync(data);
|
||||||
|
let targetFile;
|
||||||
|
zip.forEach((relativePath, file) => {
|
||||||
|
if (relativePath.endsWith('.xlsx') && !targetFile) {
|
||||||
|
targetFile = file; // 取第一份 Excel
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!targetFile) {
|
||||||
|
this.$message.error('压缩包中未找到 Excel 文件');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const content = await targetFile.async('arraybuffer');
|
||||||
|
const excelBlob = new Blob([content], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
||||||
|
saveAs(excelBlob, excelFileName);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
this.$message.error('导出失败,请稍后重试');
|
||||||
|
} finally {
|
||||||
|
loadingInstance.close();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
rowStyle({ row }) {
|
rowStyle({ row }) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue