| | |
| | | ref="addOrUpdate" |
| | | @refreshDataList="getData" |
| | | ></RawMaterialForm> |
| | | <el-dialog |
| | | top="10vh" |
| | | title="打印预览" |
| | | :visible.sync="printDialogVisible" |
| | | width="60%"> |
| | | <div style="width:100%;height: 60vh;overflow-y: scroll;"> |
| | | <printTemplate id="printRaw" :formData="printFormData"></printTemplate> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="()=>{printDialogVisible = false;this.printFormData=null}">取 消</el-button> |
| | | <el-button type="primary" @click="printFun()">打 印</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import ttable from '@/views/common/ztt-table.vue' |
| | | import { getRawInspectList,delObj,exportRawMaterial } from '@/api/quality/rawMaterial' |
| | | import { getRawInspectList,delObj,exportRawMaterial,getObj } from '@/api/quality/rawMaterial' |
| | | import RawMaterialForm from './rawMaterial-form' |
| | | import * as fecha from 'element-ui/lib/utils/date' |
| | | import { mapGetters } from 'vuex' |
| | | import PrintJS from 'print-js' |
| | | import printTemplate from './rawMaterial-print.vue' |
| | | export default { |
| | | data() { |
| | | return { |
| | | printFormData: null, |
| | | printDialogVisible: false, |
| | | queryParam: {}, |
| | | resultData:[], |
| | | addOrUpdateVisible: false, |
| | |
| | | fun: this.addOrUpdateHandle |
| | | }], |
| | | operator: [{ |
| | | text: '打印', |
| | | type: 'text', |
| | | size: 'small', |
| | | fun: this.previewFun |
| | | }, |
| | | { |
| | | text: '作废', |
| | | type: 'text', |
| | | size: 'small', |
| | |
| | | StateList: [{label:'全部',value:''},{label:'已合格',value:'1'},{label:'不合格',value:'0'}], |
| | | } |
| | | }, |
| | | // props:{ |
| | | // queryParam:{ |
| | | // type: Object, |
| | | // default: ()=>{ |
| | | // return {} |
| | | // } |
| | | // } |
| | | // }, |
| | | components: { |
| | | ttable, |
| | | RawMaterialForm, |
| | | printTemplate, |
| | | }, |
| | | created() { |
| | | |
| | |
| | | computed: { |
| | | ...mapGetters(['permissions']) |
| | | }, |
| | | watch:{ |
| | | printFormData(newVal){ |
| | | if(newVal){ |
| | | this.printFormData = newVal |
| | | } |
| | | } |
| | | }, |
| | | methods:{ |
| | | //查看报告按钮 |
| | | previewFun(row){ |
| | | getObj(row.id).then(res=>{ |
| | | this.printFormData = res.data.data |
| | | this.printDialogVisible = true |
| | | }).catch(error=>{ |
| | | console.log(error); |
| | | }) |
| | | }, |
| | | //打印按钮 |
| | | printFun() { |
| | | this.printDialogVisible = false; |
| | | PrintJS({ |
| | | printable: "printRaw", |
| | | type: "html", |
| | | maxWidth: 1200, |
| | | // header: "原材料检测报告", |
| | | style: '@page {margin: 0 5mm}', |
| | | targetStyles: ["*"], |
| | | ignoreElements: ["no-ignore"], |
| | | orientation: 'portrait' |
| | | }); |
| | | }, |
| | | getQueryParam(data){ |
| | | this.queryParam = data |
| | | }, |