yangys
2025-09-09 9bc4c3cfe5a5e2a1404184fb2c2b5a96e58d31fd
增加异常文件列表
已添加2个文件
217 ■■■■■ 文件已修改
src/api/statreport/machinefileexception.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/statreport/machinefileexception.vue 199 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/statreport/machinefileexception.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
/*
 * @Date: 2025-08-24 22:38:05
 * @LastEditors: yangys
 * @LastEditTime: 2025-08-24 08:32:12
 * @FilePath: /mdmweb/src/api/flowmgr/exceptiontask.js
 */
import request from '@/axios';
export const getList = (current, size, params) => {
  return request({
    url: '/blade-mdm/statreport/exceptionfile/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    },
  })
};
src/views/statreport/machinefileexception.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,199 @@
<!--
 æ–‡ä»¶å¼‚常记录
 * @Date: 2025-06-18 09:17:09
 * @LastEditors: gaoshp
 * @LastEditTime: 2025-08-13 21:23:34
 * @FilePath: /mdmweb/src/views/tasks/machinereturnfileop.vue
-->
<template>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model:search="query" v-model:page="page" v-model="form" ref="crud"
            @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
            @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" @selection-change="selectionChange">
            <template #menu-left>
                <el-button type="primary" 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>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
import { getList } from '@/api/statreport/machinefileexception.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() {
        return {
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            form: {},
            query: {},
            loading: true,
            data: [],
            option: {
                addBtn: false,
                editBtn: false,
                delBtn: false,
                columnBtn: false,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                dialogWidth: '60%',
                // tree: true,
                border: true,
                index: true,
                menu: false,
                dialogClickModal: false,
                column: [
                    {
                        label: '文件名称',
                        prop: 'name',
                        search:true,
                    },
                    {
                        label: '机床',
                        prop: 'machineCode',
                    },
                    {
                        label: '异常信息',
                        prop: 'exceptionType',
                        render: ({row}) => {
                            var txt = '未知';
                            switch(row.exceptionType){
                                case 1:
                                    txt = '非文本';
                                    break;
                                case 2:
                                    txt = '文件名格式错误';
                                    break;
                                case 3:
                                    txt = '文件确失';
                                    break;
                                case 4:
                                    txt = '段数与下发记录不匹配'
                                    break;
                                default:
                                    txt = '未知';
                            }
                            return txt;
                        }
                    },
                    {
                        label: '时间', //文件到达时间
                        prop: 'fileCreateTime',
                        type: 'datetime',
                        search:true,
                        searchSpan:8,
                        searchRange: true,
                        format: 'YYYY-MM-DD HH:mm:ss',
                        valueFormat: 'YYYY-MM-DD HH:mm:ss',
                    }
                ],
            },
            selectedList: [],
        }
    },
    methods: {
        selectionChange (list) {
            this.selectedList = list;
        },
        exportExcel() {
            if (this.selectedList.length === 0) {
                this.$message.warning('请先选择需要导出的数据');
                return;
            }
            this.$confirm('是否导出?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            }).then(() => {
                NProgress.start();
                exportBlob(
                    `/blade-mdm/machinefile/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 = {}
            data = {
                name:this.query.name,
                fileCreateTimeBegin: this.query.fileCreateTime?.[0]||'',
                fileCreateTimeEnd: this.query.fileCreateTime?.[1]||'',
            }
            this.query = data
            this.onLoad(this.page, data);
            done();
        },
        searchReset() {
            let data = {}
            this.query = params;
            this.page.currentPage = 1;
            data = {
                name:this.query.name,
                fileCreateTimeBegin: params.fileCreateTimeBegin,
                fileCreateTimeEnd: params.fileCreateTimeEnd,
            }
            this.onLoad(this.page, data);
            done();
        },
        currentChange(currentPage) {
            this.page.currentPage = currentPage;
        },
        sizeChange(pageSize) {
            this.page.pageSize = pageSize;
        },
        refreshChange() {
            this.onLoad(this.page, this.query);
        },
        /** * é¡µé¢åŠ è½½æ—¶èŽ·å–æ•°æ®
         */
        onLoad(page, params = {}) {
            console.log('onLoad', page, params);
            const query = {
                ...this.query,
            };
            /*
            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;
            });
        }
    }
};
</script>
<style lang="scss" scoped></style>