| | |
| | | <!-- |
| | | * @Date: 2025-06-20 20:48:17 |
| | | * @LastEditors: gaoshp |
| | | * @LastEditTime: 2025-07-07 22:27:50 |
| | | * @LastEditTime: 2025-08-17 10:17:27 |
| | | * @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"> |
| | | <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> |
| | | </template> |
| | | <template #menu="scope"> |
| | | <!-- <el-button type="primary" text size="default" |
| | | @click.stop="handleAction(scope.row, scope.index)">处理意见 |
| | | </el-button> --> |
| | | </template> |
| | | </avue-crud> |
| | | <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="tabsClick"> |
| | | <el-tab-pane label="待办" name="todo"> |
| | | <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" :disabled="this.selection.length==0" 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> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="已办" name="completed"> |
| | | <avue-crud :option="optionCompleted" :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" :disabled="this.selection.length==0" 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> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <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'; |
| | | import {todoChangeNotify} from '@/api/flow/todolist'; |
| | | import { downloadFile } from '@/utils/util'; |
| | | export default { |
| | | name: 'programexport', |
| | | data() { |
| | | return { |
| | | activeName: "todo", |
| | | // Define your data properties here |
| | | page: { |
| | | pageSize: 10, |
| | |
| | | query: {}, |
| | | loading: true, |
| | | data: [], |
| | | selection: [], |
| | | option: { |
| | | addBtn: false, |
| | | editBtn: false, |
| | |
| | | tip: false, |
| | | // simplePage: true, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | searchEnter:true, |
| | | dialogWidth: '60%', |
| | | // tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | // viewBtn: true, |
| | | menuWidth: 200, |
| | | menu: false, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: '流程标题', |
| | | prop: 'title', |
| | | with: 250 |
| | | }, |
| | | { |
| | | label: '零组件号', |
| | | prop: 'drawingNo', |
| | | }, |
| | | { |
| | | label: '工序号', |
| | | prop: 'processNo', |
| | | with: 75 |
| | | }, |
| | | |
| | | { |
| | | label: '工序版次', |
| | | prop: 'processEdition', |
| | | with: 85 |
| | | }, |
| | | { |
| | | label: '工序名称', |
| | | prop: 'processName', |
| | | with: 85 |
| | | }, |
| | | { |
| | | label: '图号版次', |
| | | prop: 'drawingNoEdition', |
| | | with: 85 |
| | | }, |
| | | |
| | | { |
| | | label: '程序包名', |
| | | prop: 'name', |
| | | search: true, |
| | | with: 100 |
| | | }, |
| | | { |
| | | 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, |
| | | }, |
| | | ], |
| | | }, |
| | | optionCompleted: { |
| | | addBtn: false, |
| | | editBtn: false, |
| | | delBtn: false, |
| | | viewBtn: true, |
| | | columnBtn: false, |
| | | tip: false, |
| | | // simplePage: true, |
| | | searchShow: true, |
| | | searchEnter:true, |
| | | searchMenuSpan: 6, |
| | | dialogWidth: '60%', |
| | | // tree: true, |
| | |
| | | menu: false, |
| | | dialogClickModal: false, |
| | | column: [ |
| | | { |
| | | label: '图号', |
| | | prop: 'partNo', |
| | | { |
| | | label: '流程标题', |
| | | prop: 'title', |
| | | with: 200 |
| | | }, |
| | | { |
| | | label: '图号版次', |
| | | prop: 'partNoEdition', |
| | | label: '零组件号', |
| | | prop: 'drawingNo', |
| | | }, |
| | | { |
| | | label: '工序号', |
| | | prop: 'processNo', |
| | | width: 70 |
| | | }, |
| | | { |
| | | label: '工序版次', |
| | | prop: 'processEdition', |
| | | width: 85 |
| | | }, |
| | | { |
| | | label: '工序名称', |
| | | prop: 'processName', |
| | | width: 85 |
| | | }, |
| | | { |
| | | label: '程序名称', |
| | | label: '图号版次', |
| | | prop: 'drawingNoEdition', |
| | | width: 85 |
| | | }, |
| | | |
| | | { |
| | | label: '程序包名', |
| | | prop: 'name', |
| | | search: true, |
| | | }, |
| | | { |
| | | label: '通过时间', |
| | | prop: 'createTime', |
| | | sortable: true, |
| | | }, |
| | | { |
| | | label: '完成时间', |
| | | label: '导出人', |
| | | prop: 'exporter', |
| | | width: 70 |
| | | }, |
| | | { |
| | | label: '已办时间', |
| | | prop: 'updateTime', |
| | | sortable: true, |
| | | }, |
| | | { |
| | | label: '通过时间', |
| | | prop: 'passTime', |
| | | search: true, |
| | | hide: true, |
| | |
| | | valueFormat: 'YYYY-MM-DD HH:mm:ss', |
| | | searchRange: true, |
| | | searchSpan: 8, |
| | | sortable: true, |
| | | }, |
| | | ], |
| | | } |
| | | }; |
| | | }, |
| | | methods: { |
| | | tabsClick(tab,event) { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selection = list; |
| | | }, |
| | | // Define your methods here |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | |
| | | /** * 页面加载时获取数据 |
| | | */ |
| | | onLoad(page, params = {}) { |
| | | console.log('onLoad', page, params); |
| | | const query = { |
| | | ...this.query, |
| | | // category: params.category ? flowCategory(params.category) : null, |
| | | mode: this.mode, |
| | | }; |
| | | var status = this.activeName == 'todo'?null:2; |
| | | params.status = status; |
| | | try { |
| | | delete query.confirmTime; // 删除不必要的查询条件 |
| | | } catch (error) { |
| | |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | findDuplicates(arr) { |
| | | const seen = new Set(); |
| | | const duplicates = new Set(); |
| | | |
| | | arr.forEach(item => { |
| | | if (seen.has(item)) { |
| | | duplicates.add(item); |
| | | } else { |
| | | seen.add(item); |
| | | } |
| | | }); |
| | | |
| | | return Array.from(duplicates); |
| | | }, |
| | | exportExcel() { |
| | | this.$confirm('是否导出?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }).then(() => { |
| | | //console.log(this.selection) |
| | | let selectArray = []; |
| | | for(var i=0;i<this.selection.length;i++){ |
| | | selectArray.push(this.selection[i].name+"-"+this.selection[i].processEdition) |
| | | } |
| | | let dupData = this.findDuplicates(selectArray); |
| | | if(dupData.length > 0){ |
| | | this.$message.error('不能在一次导出中选择一个程序的不同版本:['+dupData.join()+"]"); |
| | | return; |
| | | } |
| | | if(this.selection == null || this.selection.length == 0){ |
| | | this.$message.error('请至少选择一条导出'); |
| | | return; |
| | | } |
| | | 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`); |
| | | console.log('status='+res.status) |
| | | if(res.status == 200){ |
| | | let name = res.headers['content-disposition'].split('filename=')[1] |
| | | name = decodeURI(name) |
| | | //console.log(res.headers['content-disposition'].split('filename=')[1]); |
| | | downloadFile(res.data, `${name}`); |
| | | |
| | | }else{ |
| | | this.$message.error('导出错误'); |
| | | console.log(res); |
| | | } |
| | | todoChangeNotify(); |
| | | NProgress.done(); |
| | | this.onLoad(this.page, this.query); |
| | | }); |
| | | }); |
| | | }, |