| | |
| | | </template> |
| | | <script> |
| | | import ttable from '@/views/common/ztt-table.vue' |
| | | import { getRawInspectList,delObj,exportRawMaterial,getObj,downloadReport } from '@/api/quality/rawMaterial' |
| | | import { getRawInspectList,delObj,exportRawMaterial,getObj,downloadReport,checkPutIFS } from '@/api/quality/rawMaterial' |
| | | import RawMaterialForm from './rawMaterial-form' |
| | | import * as fecha from 'element-ui/lib/utils/date' |
| | | import { mapGetters } from 'vuex' |
| | |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | render: { fun: this.addOrUpdateHandle } |
| | | }, |
| | | { |
| | | minWidth: '120', |
| | | prop: 'type', |
| | | label: '检验类型', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'select', |
| | | optList: () => { |
| | | return this.typeList |
| | | } |
| | | }, |
| | | { |
| | | minWidth: '120', |
| | | prop: 'checkState', |
| | | label: '审核状态', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'select', |
| | | formatter: this.checkStateFormat, |
| | | optList: () => { |
| | | return this.checkStateList |
| | | } |
| | | }, |
| | | { |
| | | minWidth: '120', |
| | |
| | | }, |
| | | { |
| | | minWidth: '120', |
| | | prop: 'createTime', |
| | | prop: 'startTime', |
| | | label: '报检日期', |
| | | isTrue: true, |
| | | sort: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | searchInfoType: 'datetimerange', |
| | | formatter: this.formatDateTime, |
| | | }, |
| | | { |
| | |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | searchInfoType: 'datetimerange', |
| | | formatter: this.formatDateTime, |
| | | }, |
| | | { |
| | |
| | | return this.StateList |
| | | } |
| | | }, |
| | | { |
| | | minWidth: '120', |
| | | prop: 'remark', |
| | | label: '备注', |
| | | isTrue: true, |
| | | isSearch: true, |
| | | searchInfoType: 'text', |
| | | }, |
| | | ], |
| | | toolbar: [], |
| | | operator: null, |
| | |
| | | }, |
| | | insStateList: [{label:'全部',value:''},{label:'已检测',value:'1'},{label:'未检测',value:'0'}], |
| | | StateList: [{label:'全部',value:''},{label:'已合格',value:'1'},{label:'不合格',value:'0'}], |
| | | typeList: [{label:'全部',value:''},{label:'首检',value:'首检'},{label:'返检',value:'返检'}], |
| | | checkStateList: [{label:'未审核',value:'0'},{label:'审核通过',value:'1'},{label:'审核不通过',value:'2'}], |
| | | } |
| | | }, |
| | | components: { |
| | |
| | | this.table.toolbar.push({ |
| | | text: '下载检验报告', |
| | | type: 'primary', |
| | | fun: this.downloadReport |
| | | loading: false, |
| | | disabled: false, |
| | | fun: this.downloadReport, |
| | | |
| | | }) |
| | | } |
| | | if(this.permissions.quality_rawMaterial_del){ |
| | | if(this.permissions.quality_rawMaterial_check){ |
| | | this.table.operator = [{ |
| | | text: '审核', |
| | | type: 'text', |
| | | size: 'small', |
| | | fun: this.examineHandle, |
| | | showFun: (row)=>{return row.type==='首检'&& row.insState==='1'}, |
| | | show: { |
| | | key: 'checkState', |
| | | val: ['0','2'] |
| | | } |
| | | }] |
| | | } |
| | | if(this.permissions.quality_rawMaterial_del){ |
| | | this.table.operator.push({ |
| | | text: '作废', |
| | | type: 'text', |
| | | size: 'small', |
| | | fun: this.deleteHandle |
| | | }] |
| | | fun: this.deleteHandle, |
| | | show: { |
| | | key: 'judgeState', |
| | | val: ['',null] |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | } |
| | | }, |
| | | methods:{ |
| | | examineHandle(val){ |
| | | this.$confirm('是否审核通过该检验项?', '提示', { |
| | | distinguishCancelAndClose: true, |
| | | confirmButtonText: '通过', |
| | | cancelButtonText: '不通过', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.checkPutIFSFun(val.id,1); |
| | | }).catch((action) => { |
| | | if(action === 'cancel'){ |
| | | this.checkPutIFSFun(val.id,2); |
| | | } |
| | | }); |
| | | }, |
| | | checkPutIFSFun(id,result){ |
| | | checkPutIFS(id, result).then(res=>{ |
| | | if(res.status===200){ |
| | | this.getData() |
| | | } |
| | | }).catch(error=>{ |
| | | console.error(error) |
| | | }) |
| | | }, |
| | | downloadReport(){ |
| | | let selection = this.multipleSelection |
| | | if(!selection || selection.length < 1){ |
| | |
| | | selection.forEach(ele=>{ |
| | | ids.push(ele.id) |
| | | }) |
| | | downloadReport({ids : ids}).then(res=>{ |
| | | transformZip(res) |
| | | }).catch(error=>{ |
| | | this.table.toolbar.find((e) => e.text === '下载检验报告').loading = true |
| | | this.table.toolbar.find((e) => e.text === '下载检验报告').disabled = true |
| | | try{ |
| | | downloadReport({ids : ids}).then(res=>{ |
| | | transformZip(res) |
| | | }) |
| | | }catch(error){ |
| | | console.log(error) |
| | | }) |
| | | } finally{ |
| | | this.table.toolbar.find((e) => e.text === '下载检验报告').loading = false |
| | | this.table.toolbar.find((e) => e.text === '下载检验报告').disabled = false |
| | | } |
| | | } |
| | | }, |
| | | //查看报告按钮 |
| | |
| | | type: "html", |
| | | // header: "原材料检测报告", |
| | | targetStyles: ["*"], |
| | | style: `@page {margin: 0mm 5mm;size: A4;} |
| | | style: `@page {margin: 0mm 5mm;size: A4 landscape;} |
| | | html {zoom:100%;} |
| | | @media print { |
| | | html,body{ |
| | |
| | | this.$router.push({ |
| | | name: 'rawMaterialForm', |
| | | query: { |
| | | id: row == null ? null : row.id, |
| | | id: row == null ? null : row.id |
| | | }, |
| | | params: { |
| | | resultVal: row == null ? null : row.judgeState |
| | | } |
| | | }) |
| | |
| | | formatJudgeState(row, column, cellValue){ |
| | | if(cellValue != undefined && cellValue != null && cellValue != ''){ |
| | | if(cellValue == 0){ |
| | | console.log(cellValue); |
| | | return "<span style='color:#E84738;'>不合格</span>" |
| | | } |
| | | return "<span style='color:#34BD66;'>合格</span>" |
| | | } |
| | | }, |
| | | checkStateFormat(row, column, cellValue){ |
| | | this.checkStateList.forEach((obj) => { |
| | | if (obj.value === cellValue) { |
| | | cellValue = obj.label |
| | | } |
| | | }) |
| | | return cellValue |
| | | }, |
| | | formatDateTime(row, column, cellValue) { |
| | | return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd') : '' |
| | | }, |