| | |
| | | <div class="content-main"> |
| | | <div class="rawPage"> |
| | | <basic-container> |
| | | <ttable |
| | | <ttable |
| | | :table="table" |
| | | @handleSelectionChange="handleSelectionChange" |
| | | :prelang="prelang" |
| | |
| | | import ttable from '@/views/common/ztt-table.vue' |
| | | import * as fecha from 'element-ui/lib/utils/date' |
| | | import finishedProductInspectionAdd from './finishedProduct-form' |
| | | import { page,deletePro,exportExaminationProducts,queryById } from '@/api/quality/finishedProduct' |
| | | import { page,deletePro,exportExaminationProducts,queryById,downloadReport } from '@/api/quality/finishedProduct' |
| | | import { transform } from '@/util/fileTransform' |
| | | import { mapGetters } from 'vuex' |
| | | import printTemplate from './finishedProducter-print.vue' |
| | | import PrintJS from 'print-js' |
| | | import { transformZip } from '@/util/fileTransform' |
| | | export default { |
| | | components: { |
| | | finishedProductInspectionAdd, |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | multipleSelection: [], |
| | | printFormData: null, |
| | | printDialogVisible: false, |
| | | result:[{label:'全部',value: ''},{label:'合格',value: '1'},{label:'不合格',value: '0'}], |
| | |
| | | }, |
| | | { |
| | | minWidth: '130', |
| | | width: '150', |
| | | prop: 'projectName', |
| | | label: '工程名称', |
| | | sort: true, |
| | |
| | | }, |
| | | { |
| | | minWidth: '120', |
| | | width: '150', |
| | | prop: 'material', |
| | | label: '产品大类', |
| | | label: '产品名称', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text' |
| | |
| | | { |
| | | minWidth: '120', |
| | | prop: 'createTime', |
| | | label: '检验日期', |
| | | label: '报检日期', |
| | | sort: true, |
| | | isTrue: true, |
| | | isSearch: true, |
| | |
| | | }, |
| | | } |
| | | }, |
| | | created() { |
| | | created() { |
| | | if(this.permissions.quality_finishedProductInspection_download){ |
| | | this.table.toolbar.push({ |
| | | text: '下载检验报告', |
| | | type: 'primary', |
| | | loading: false, |
| | | disabled: false, |
| | | fun: this.downloadProReport |
| | | }) |
| | | } |
| | |
| | | }, |
| | | methods: { |
| | | downloadProReport(){ |
| | | const _than = this |
| | | let selection = this.multipleSelection |
| | | if(!selection || selection.length < 1){ |
| | | this.$message.error("请先选择检验数据") |
| | | return |
| | | }else{ |
| | | let arr = selection.filter(s=>{ |
| | | return s.result==null || s.result=='' |
| | | }) |
| | | if(arr.length > 0){ |
| | | this.$message.error("只能选择已检测的数据") |
| | | return |
| | | } |
| | | let ids = [] |
| | | selection.forEach(ele=>{ |
| | | ids.push(ele.id) |
| | | }) |
| | | _than.table.toolbar.find((e) => e.text === '下载检验报告').loading = true |
| | | _than.table.toolbar.find((e) => e.text === '下载检验报告').disabled = true |
| | | try { |
| | | downloadReport({ids : ids}).then(res=>{ |
| | | transformZip(res) |
| | | }) |
| | | } catch (error) { |
| | | console.log(error) |
| | | } finally{ |
| | | _than.table.toolbar.find((e) => e.text === '下载检验报告').loading = false |
| | | _than.table.toolbar.find((e) => e.text === '下载检验报告').disabled = false |
| | | } |
| | | } |
| | | }, |
| | | //打印按钮 |
| | | printFun() { |
| | |
| | | } |
| | | this.$router.push({ |
| | | name: 'finishedProductForm', |
| | | query: { |
| | | query: { |
| | | id: row == null ? null : row.id, |
| | | }, |
| | | params: { |
| | | resultVal: row == null ? null : row.result |
| | | resultVal: row == null ? null : row.result |
| | | } |
| | | }) |
| | | }, |
| | |
| | | formatDateTime(row, column, cellValue) { |
| | | return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd') : '' |
| | | }, |
| | | handleSelectionChange(){ }, |
| | | handleSelectionChange(val){ |
| | | this.multipleSelection = val |
| | | }, |
| | | getData() { |
| | | this.$refs.finishedProduct.getDataList() |
| | | }, |
| | |
| | | flex: 1; |
| | | overflow-y: scroll; |
| | | } */ |
| | | </style> |
| | | </style> |