yangys
2025-09-22 b14bf62abb3480d95beee8314fcb08c0d893813b
src/views/tasks/machinereturnfileop.vue
@@ -15,11 +15,14 @@
                <el-button type="primary" :disabled="this.selectedList.length==0" plain @click="exportExcel">导出到EXCEL</el-button>
            </template>
            <template #menu="scope">
                <el-button type="primary" text size="default"
                    @click.stop="handleAction(scope.row, scope.index)">审批
                </el-button>
                <el-button type="primary" text size="default" @click.stop="showContent(scope.row)">查看</el-button>
                <el-button type="primary" text size="default" @click.stop="download(scope.row, scope.index)">下载</el-button>
            </template>
        </avue-crud>
        <el-dialog title="程序内容" append-to-body v-model="fileViewModel">
            <div v-html="appContent" class="app-content"></div>
        </el-dialog>
    </basic-container>
</template>
@@ -28,7 +31,7 @@
import { exportBlob } from '@/api/common';
import { getToken } from '@/utils/auth';
import NProgress from 'nprogress';
import { downloadXls } from '@/utils/util';
import { downloadXls,downloadFile } from '@/utils/util';
import 'nprogress/nprogress.css';
export default {
    name: 'MachineReturnFileOp',
@@ -43,6 +46,8 @@
            query: {status:1},
            loading: true,
            data: [],
            fileViewModel:false,
            appContent:'',
            option: {
                addBtn: false,
                editBtn: false,
@@ -55,8 +60,8 @@
                border: true,
                index: true,
                selection: true,
                menuWidth: 100,
                menu: false,
                menuWidth: 110,
                menu: true,
                dialogClickModal: false,
                column: [
                    
@@ -139,6 +144,36 @@
        }
    },
    methods: {
        showContent(row) {
            this.fileViewModel = true;
            this.appContent = '';
            axios({
                url: '/blade-mdm/ossfile/file-content',
                method: 'get',
                params: {ossFileName: row.ossName}
            }).then(
                res => {
                    console.log(res)
                    if(res.data.code === 200) {
                        this.appContent = res.data.data;
                    } else {
                        this.appContent = '程序内容加载失败'
                    }
            });
        },
        download(row){
            exportBlob(
            `/blade-mdm/machinefile/filehandle/download-by-id?id=${row.id}&${this.website.tokenHeader}=${getToken()}`,
            ).then(res => {
                let name = res.headers['content-disposition'].split('filename=')[1]
                //console.log(res.headers['content-disposition'].split('filename=')[1]);
                name = decodeURI(name)
                downloadFile(res.data, `${name}`);
                NProgress.done();
            });
        },
        selectionChange (list) {
            this.selectedList = list;
        },