PrintModal.vue 6.1 KB
<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
    okText="打印完成">
    <a-card :bordered="false" :class="{'abcdefg':true}">
      <div class="no-print" style="text-align: right">
        <a-button v-print="'#printContent'" ghost type="primary">打印</a-button>
      </div>
      <section ref="print" id="printContent" class="abcdefg">
        <div style="text-align: center">
          <p style="font-size: 24px;font-weight: 800">出货单</p>
        </div>
        <div style="height: 1px;border-top: 1px solid #000000;margin-bottom: 30px;"></div>
        <!--签字-->
        <a-table
          ref="table"
          size="middle"
          bordered
          rowKey="id"
          :scroll="{x:true}"
          :columns="columns"
          :dataSource="dataSource"
          :loading="loading"
          :pagination="false"
        >
        </a-table>
        <a-row style="margin-top: 20px;">
          <a-col :span="12">
            <span>
              收货人:
            </span>
          </a-col>
          <a-col :span="12">
            <span >收货日期:</span>
          </a-col>
        </a-row>
      </section>
    </a-card>
  </j-modal>
</template>

<script>

  import { httpAction,getAction } from '@/api/manage'
  import { validateDuplicateValue,formatDate,filterObj } from '@/utils/util'
  
  export default {
    name: "PrintModal",
    components: {
    },
    props:{
      
    },
    data () {
      return {
        title:"出货",
        width:800,
        visible: false,
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'物料编号',
            align:"center",
            dataIndex: 'partNumber'
          },
          {
            title:'品名',
            align:"center",
            dataIndex: 'productName'
          },
          {
            title:'型号',
            align:"center",
            dataIndex: 'type'
          },
          {
            title:'规格',
            align:"center",
            dataIndex: 'spec'
          },
          {
            title:'数量',
            align:"center",
            dataIndex: 'operNumber'
          },
        ],
        dataSource:[],
        confirmLoading: false,
        loading: false,
        url: {
          delivery: "/order_form/tblOrderForm/delivery",
          list: "/order_form/tblOrderForm/listTblWorkOrderByMainIdNoPage",
        },
        /* 排序参数 */
        isorter:{
          column: 'createTime',
          order: 'desc',
        },
        /* 筛选参数 */
        filters: {},
        /* 查询条件-请不要在queryParam中声明非字符串值的属性 */
        queryParam: {},
        model: {},
      }
    },
    created () {
    },
    methods: {
      open(record){
        this.visible = true;
        this.loading = true;
        this.queryParam['orderFormId'] = record.id;
        var params = this.getQueryParams();//查询条件
        this.loading = true;
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records||res.result;
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading = false
        })
      },
      getQueryParams() {
        //获取查询条件
        let sqp = {}
        var param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
        param.field = this.getQueryField();
        return filterObj(param);
      },
      getQueryField() {
        //TODO 字段权限控制
        var str = "id,";
        this.columns.forEach(function (value) {
          str += "," + value.dataIndex;
        });
        return str;
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        const that = this;
        that.confirmLoading = true;
        let httpurl = '';
        let method = '';
        httpurl+=this.url.delivery;
        method = 'put';
        this.model.id = this.queryParam['orderFormId'];
        httpAction(httpurl,this.model,method).then((res)=>{
          if(res.success){
            that.$message.success(res.message);
            that.$emit('ok');
          }else{
            that.$message.warning(res.message);
          }
        }).finally(() => {
          that.confirmLoading = false;
          that.close();
        })
          
      },
      handleCancel () {
        this.close()
      },
      


    }
  }
</script>
<style scoped>
  /*update_begin author:scott date:20191203 for:打印机打印的字体模糊问题 */
  * {
    color: #000000!important;
    -webkit-tap-highlight-color: #000000!important;
  }
  /*update_end author:scott date:20191203 for:打印机打印的字体模糊问题 */
  
  .abcdefg .ant-card-body{
    margin-left: 0%;
    margin-right: 0%;
    margin-bottom: 1%;
    border:0px solid black;
    min-width: 800px;
    color:#000000!important;
  }
  .explain{
    text-align: left;
    margin-left: 50px;
    color:#000000!important;
  }
  .explain .ant-input,.sign .ant-input{
    font-weight:bolder;
    text-align:center;
    border-left-width:0px!important;
    border-top-width:0px!important;
    border-right-width:0px!important;
  }
  .explain div{
    margin-bottom: 10px;
  }
  /* you can make up upload button and sample style by using stylesheets */
  .ant-upload-select-picture-card i {
    font-size: 32px;
    color: #999;
  }
  
  .ant-upload-select-picture-card .ant-upload-text {
    margin-top: 8px;
    color: #666;
  }
</style>