From 7c9ce5f1625b6468d1775f9814834ca1832e0d20 Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期一, 07 七月 2025 23:02:03 +0800 Subject: [PATCH] 导出zip --- src/views/flowmgr/programexport.vue | 195 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 195 insertions(+), 0 deletions(-) diff --git a/src/views/flowmgr/programexport.vue b/src/views/flowmgr/programexport.vue new file mode 100644 index 0000000..0a18d27 --- /dev/null +++ b/src/views/flowmgr/programexport.vue @@ -0,0 +1,195 @@ +<!-- + * @Date: 2025-06-20 20:48:17 + * @LastEditors: gaoshp + * @LastEditTime: 2025-07-07 23:00:25 + * @FilePath: /mdmweb/src/views/flowmgr/programexport.vue +--> +<template> + <basic-container> + <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" v-model="form" ref="crud" @current-change="currentChange" + @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"> + <template #menu-left> + <!-- <el-button type="primary" plain @click="exportWebSite">瀵煎嚭鍥炰紶娑夊瘑缃�</el-button> --> + <!-- <el-button type="primary" plain @click="reassign">鎸傝浇杞﹀簥绋嬪簭搴�</el-button> --> + <el-button type="primary" plain @click="exportExcel">瀵煎嚭</el-button> + </template> + <template #menu="scope"> + <!-- <el-button type="primary" text size="default" + @click.stop="handleAction(scope.row, scope.index)">澶勭悊鎰忚 + </el-button> --> + </template> + </avue-crud> + </basic-container> +</template> + +<script> + import { getList } from '@/api/flowmgr/programexport.js'; + import NProgress from 'nprogress'; + import { exportBlobPost } from '@/api/common'; + import { getToken } from '@/utils/auth'; + import { downloadFile } from '@/utils/util'; + export default { + name: 'programexport', + data() { + return { + // Define your data properties here + page: { + pageSize: 10, + currentPage: 1, + total: 0, + }, + form: {}, + query: {}, + loading: true, + data: [], + selection: [], + option: { + addBtn: false, + editBtn: false, + delBtn: false, + viewBtn: true, + columnBtn: false, + tip: false, + // simplePage: true, + searchShow: true, + searchMenuSpan: 6, + dialogWidth: '60%', + // tree: true, + border: true, + index: true, + selection: true, + // viewBtn: true, + menuWidth: 200, + menu: false, + dialogClickModal: false, + column: [ + { + label: '鍥惧彿', + prop: 'partNo', + }, + { + label: '鍥惧彿鐗堟', + prop: 'partNoEdition', + }, + { + label: '宸ュ簭鍚嶇О', + prop: 'processName', + }, + { + label: '绋嬪簭鍚嶇О', + prop: 'name', + search: true, + }, + { + label: '閫氳繃鏃堕棿', + prop: 'createTime', + }, + { + label: '瀹屾垚鏃堕棿', + prop: 'passTime', + search: true, + hide: true, + type: 'datetime', + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + searchRange: true, + searchSpan: 8, + }, + ], + } + }; + }, + methods: { + selectionChange(list) { + this.selection = list; + }, + // Define your methods here + currentChange(currentPage) { + this.page.currentPage = currentPage; + // this.onLoad(); + }, + sizeChange(pageSize) { + this.page.pageSize = pageSize; + }, + refreshChange() { + this.onLoad(this.page, this.query); + }, + searchChange(params, done) { + let data = {} + this.query = params; + this.page.currentPage = 1; + console.log('searchChange', params); + params.passTimeBegin = params?.passTime?.[0] || ''; + params.passTimeEnd = params?.passTime?.[1] || ''; + console.log(params); + data = { + createTimeBegin: params.passTimeBegin, + createTimeEnd: params.passTimeEnd, + name: params.name || '' + } + this.query = data + this.onLoad(this.page, data); + done(); + }, + searchReset() { + this.query = {}; + this.onLoad(this.page); + }, + /** * 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹� + */ + onLoad(page, params = {}) { + console.log('onLoad', page, params); + const query = { + ...this.query, + // category: params.category ? flowCategory(params.category) : null, + mode: this.mode, + }; + try { + delete query.confirmTime; // 鍒犻櫎涓嶅繀瑕佺殑鏌ヨ鏉′欢 + } catch (error) { + console.error('鏃ユ湡鏍煎紡鍖栭敊璇�', error); + } + + this.loading = true; + getList(page.currentPage, page.pageSize, Object.assign(query, params)).then(res => { + const data = res.data.data; + this.page.total = data.total; + this.data = data.records; + this.loading = false; + }, () => { + this.data = []; + this.loading = false; + }).catch(err => { + this.data = []; + this.loading = false; + }); + }, + exportExcel() { + this.$confirm('鏄惁瀵煎嚭?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning', + }).then(() => { + console.log(this.selection) + NProgress.start(); + exportBlobPost( + `/blade-mdm/program/exchange/export-dnc`, + {}, + {ids: this.selection.map(item => item.id)}, + ).then(res => { + console.log(res); + downloadFile(res.data, `瀵煎嚭DNC${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.zip`); + NProgress.done(); + }); + }); + }, + }, + mounted() { + + } +} +</script> + +<style lang="scss" scoped> + +</style> \ No newline at end of file -- Gitblit v1.9.3