yangys
2025-07-07 99098595b9cd90117e94fda4b2f41492612d7138
src/views/tasks/machinereturnfileop.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2025-06-18 09:17:09
 * @LastEditors: gaoshp
 * @LastEditTime: 2025-06-20 09:03:42
 * @LastEditTime: 2025-06-20 20:58:07
 * @FilePath: /mdmweb/src/views/tasks/machinereturnfileop.vue
-->
<template>
@@ -10,9 +10,9 @@
            @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
            @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template #menu-left>
                <el-button type="primary" plain @click="reassign">导出回传涉密网</el-button>
                <el-button type="primary" plain @click="exportWebSite">导出回传涉密网</el-button>
                <el-button type="primary" plain @click="reassign">挂载车床程序库</el-button>
                <el-button type="primary" plain @click="reassign">导出到EXCEL</el-button>
                <el-button type="primary" plain @click="exportExcel">导出到EXCEL</el-button>
            </template>
            <template #menu="scope">
                <el-button type="primary" text size="default" v-if="permission.flow_model_update"
@@ -25,6 +25,11 @@
<script>
import { getList } from '@/api/tasks/machinereturnfileop.js';
import { exportBlob } from '@/api/common';
import { getToken } from '@/utils/auth';
import NProgress from 'nprogress';
import { downloadXls } from '@/utils/util';
import 'nprogress/nprogress.css';
export default {
    name: 'MachineReturnFileOp',
    data() {
@@ -54,11 +59,12 @@
                selection: true,
                // viewBtn: true,
                menuWidth: 100,
                menu: false,
                dialogClickModal: false,
                column: [
                    {
                        label: '确认时间',
                        prop: '',
                        prop: 'confirmTime',
                        type: 'datetime',
                        format: 'YYYY-MM-DD HH:mm:ss',
                        valueFormat: 'YYYY-MM-DD HH:mm:ss',
@@ -70,50 +76,73 @@
                    {
                        label: '程序编号',
                        prop: 'processDefinitionName',
                        prop: 'code',
                    },
                    {
                        label: '回传机床',
                        prop: 'processDefinitionName',
                        prop: 'machineCode',
                    },
                    {
                        label: '文件名称',
                        prop: '',
                        formatter: (val, value, label) => {
                            return `${val?.variables?.machineCode}`;
                        },
                        prop: 'name'
                    },
                    {
                        label: '文件固化状态',
                        prop: 'startUserName',
                        prop: 'isCured',
                        formatter: (val, value, label) => {
                            return `${val==0?'未固化':"已固化"}`;
                        },
                    },
                    {
                        label: '文件到达时间',
                        prop: 'processCreateTime',
                        prop: 'arrivedTime',
                        type: 'datetime',
                        format: 'YYYY-MM-DD HH:mm:ss',
                        valueFormat: 'YYYY-MM-DD HH:mm:ss',
                    },
                    {
                        label: '文件数据库编号',
                        prop: 'createTime',
                    },
                    }
                ],
            }
        }
    },
    methods: {
        reassign() {
        exportWebSite() {
            this.$confirm('是否导出?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
                NProgress.start();
                exportBlob(
                    `/blade-mdm/machineback/filehandle/export-to-inner?${this.website.tokenHeader}=${getToken()}`
                ).then(res => {
                    downloadXls(res.data, `导出回传涉密网${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`);
                    NProgress.done();
                });
            });
        },
        exportExcel() {
            this.$confirm('是否导出?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
                NProgress.start();
                exportBlob(
                    `/blade-mdm/machineback/filehandle/export-excel?${this.website.tokenHeader}=${getToken()}`
                ).then(res => {
                    downloadXls(res.data, `导出机床回传程序${this.$dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`);
                    NProgress.done();
                });
            });
        },
        searchChange(params, done) {
            let data = {}
            this.query = params;
            this.page.currentPage = 1;
            console.log('searchChange', params);
            params.createTimeBegin = params?.processCreateTime?.[0] || '';
            params.createTimeEnd = params?.processCreateTime?.[1] || '';
            params.confirmTimeBegin = params?.confirmTime?.[0] || '';
            params.confirmTimeEnd = params?.confirmTime?.[1] || '';
            console.log(params);
            // data = {
            //     createTimeBegin: dayjs(params.createTimeBegin).isValid() ? dayjs(params.createTimeBegin).format('YYYY-MM-DD') : '',
@@ -121,10 +150,10 @@
            //     keyword: params.keyword || ''
            // }
            data = {
                createTimeBegin: params.createTimeBegin,
                createTimeEnd: params.createTimeEnd,
                keyword: params.keyword || ''
                confirmTimeBegin: params.confirmTimeBegin,
                confirmTimeEnd: params.confirmTimeEnd,
            }
            this.query = data
            this.onLoad(this.page, data);
            done();
        },
@@ -153,13 +182,14 @@
        /** * 页面加载时获取数据
         */
        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.processCreateTime; // 删除不必要的查询条件
                delete query.confirmTime; // 删除不必要的查询条件
            } catch (error) {
                console.error('日期格式化错误', error);
            }
@@ -170,7 +200,7 @@
                this.page.total = data.total;
                this.data = data.records;
                this.loading = false;
            },() => {
            }, () => {
                this.data = [];
                this.loading = false;
            }).catch(err => {