gaoshp
2025-07-07 c3f0b6b4b0967e65f5d37459ac2fbeda4cb5ea76
update
已修改2个文件
34 ■■■■ 文件已修改
src/api/common.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/flowmgr/programexport.vue 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/common.js
@@ -1,3 +1,9 @@
/*
 * @Date: 2025-05-27 23:44:41
 * @LastEditors: gaoshp
 * @LastEditTime: 2025-07-07 22:47:09
 * @FilePath: /mdmweb/src/api/common.js
 */
import request from '@/axios';
/**
@@ -13,3 +19,12 @@
    responseType: 'blob',
  });
};
export const exportBlobPost = (url, params,data) => {
  return request({
    url: url,
    params: params,
    data,
    method: 'post',
    responseType: 'blob',
  });
};
src/views/flowmgr/programexport.vue
@@ -1,17 +1,17 @@
<!--
 * @Date: 2025-06-20 20:48:17
 * @LastEditors: gaoshp
 * @LastEditTime: 2025-07-07 22:27:50
 * @LastEditTime: 2025-07-07 22:51:10
 * @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">
            @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">导出到EXCEL</el-button>
                <el-button type="primary" plain @click="exportExcel">导出</el-button>
            </template>
            <template #menu="scope">
                <!-- <el-button type="primary" text size="default"
@@ -25,7 +25,7 @@
<script>
    import { getList } from '@/api/flowmgr/programexport.js';
    import NProgress from 'nprogress';
    import { exportBlob } from '@/api/common';
    import { exportBlobPost } from '@/api/common';
    import { getToken } from '@/utils/auth';
    export default {
    name: 'programexport',
@@ -41,6 +41,7 @@
            query: {},
            loading: true,
            data: [],
            selection: [],
            option: {
                addBtn: false,
                editBtn: false,
@@ -98,6 +99,9 @@
        };
    },
    methods: {
        selectionChange(list) {
            this.selection = list;
        },
        // Define your methods here
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
@@ -165,9 +169,12 @@
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
                console.log(this.selection)
                NProgress.start();
                exportBlob(
                    `/blade-mdm/program/exchange/export-dnc?${this.website.tokenHeader}=${getToken()}`
                exportBlobPost(
                    `/blade-mdm/program/exchange/export-dnc`,
                    {},
                    {ids: this.selection.map(item => item.id)},
                ).then(res => {
                    downloadXls(res.data, `导出机床回传程序${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`);
                    NProgress.done();