printSchedulerList.vue 6.5 KB
<template>
  <a-modal
    :width="modalWidth"
    :style="modalStyle"
    :visible="visible"
    :maskClosable="false"
    @cancel="handleCancel">
    <template slot="footer">
      <a-button @click="handleCancel">关闭</a-button>
    </template>

      <a-row :gutter="12">
          <a-col :md="5" :sm="8">
            <a-form-item label="物料图号" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
              <a-input placeholder="请输入物料图号" v-model="querySource.drawingNo"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="5" :sm="8">
            <a-form-item label="物料名称" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
              <a-input placeholder="请输入物料名称" v-model="querySource.name"></a-input>
            </a-form-item>
          </a-col>

        <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="search"   icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a-button type="primary" @click="printChoose" icon="printer" style="margin-left: 8px">选中打印</a-button>
              <a-button type="primary" @click="printBatch" icon="printer" style="margin-left: 8px">批量打印</a-button>
            </span>
        </a-col>
      </a-row>

    <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
      <i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项&nbsp;&nbsp;
      <a style="margin-left: 24px" @click="onClearSelected">清空</a>
    </div>

    <a-table
      ref="table"
      rowKey="id"
      size="middle"
      :columns="columns"
      :loading="loading"
      :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: selectChanges}"
      :dataSource="dataSource"
      :pagination="false">
      <span slot="action" slot-scope="text, record">
        <a @click="handleBack(record.id)"><a-icon type="redo"/>查看</a>
      </span>

      <template slot="avatarslot" slot-scope="text, record, index">
        <div class="anty-img-wrap" style="height: 100px;width: 100px">
<!--          <a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>-->

            <vue-qr :text="record.userDef3" :size="80" :margin="0"></vue-qr>

        </div>
      </template>

    </a-table>

  </a-modal>


</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {getSchedulerPrint, getSchedulerPrintDetail} from "../../api/api";
import VueQr from 'vue-qr'
export default {
  name: "PBOMList",
  mixins:[JeecgListMixin],
  components: {
    VueQr
  },
  data () {
    return {
      modalWidth: '90%',
      modalStyle: { 'top': '20px'},
      title: '操作',
      visible: false,
      querySource: {},
      loading: false,
      dataSource:[],
      bomIdList:[],
      id:'',
      drawno:'',
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      columns:[
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 120,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '工作令',
          dataIndex: 'userDef1',
          key: 'userDef1'
        }, {
          title: '项目名称',
          dataIndex: 'userDef2',
          key: 'userDef2'
        },
        {
          title: '图号',
          dataIndex: 'drawingNo',
          key: 'drawingNo'
        },
        {
          title: '物料名称',
          dataIndex: 'name',
          key: 'name'
        },
        {
          title: '物料规格',
          dataIndex: 'spec',
          key: 'spec'
        },
        {
          title: '生产数量',
          dataIndex: 'qty',
          key: 'qty'
        },{
          title: '工序',
          dataIndex: 'technology',
          key: 'technology'
        },
        {
          title: '二维码',
          dataIndex: 'userDef3',
          key: 'userDef3',
          align: "center",
          scopedSlots: {customRender: "avatarslot"}
        },

        // ,
        // {
        //   title: '操作',
        //   dataIndex: 'action',
        //   align: "center",
        //   scopedSlots: {customRender: 'action'}
        // }
      ]
    }
  },
  created () {

  },

  methods: {
    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },

    handleCancel(){
      this.visible = false
    },


    selectChanges(selectedRowKeys, selectionRows) {
      this.selectedRowKeys = selectedRowKeys;
      this.selectionRows = selectionRows;
      var array='';
      this.selectionRows.forEach(function (row) {
        array += row.drawingNo + ",";
      });
      this.drawno=array;

    },

    show(id){
      this.visible = true
      this.loadData(id);
    },

    searchEnterFun (e){
      var keyCode = window.event ? e.keyCode : e.which;
      if (keyCode == 13) {
        this.queryPrintList()
      }
    },

    loadData(id) {
      this.$message.info("加载中.....")
      this.id=id;
      getSchedulerPrint(id).then((res) => {
        this.dataSource = res;
        this.querySource.headerId = id;
      })
    },



    search() {
      getSchedulerPrintDetail(this.querySource).then((res) => {
        this.dataSource =[];
        this.dataSource = res;
      })
    },
    searchReset() {
      this.querySource.name='';
      this.querySource.drawingNo='';
    },

    printChoose(){
      if (this.drawno==''){
        this.$message.error("请至少选择一条")
        return false;
      }
      var url='http://mts.huahengweld.com/jeecg-boot/jmreport/view/792984158723371008?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzgxODExNDMsInVzZXJuYW1lIjoiY2hlbmFvIn0.AesamOZJsPqUsVgEKFt5ouFSIAFTWECxHE6TyhIwit0&id='+this.id+'&drawingNo='+this.drawno;
      window.open(url, '_blank');
    },

    printBatch() {
      var url='http://mts.huahengweld.com/jeecg-boot/jmreport/view/792899970087251968?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzgxODExNDMsInVzZXJuYW1lIjoiY2hlbmFvIn0.AesamOZJsPqUsVgEKFt5ouFSIAFTWECxHE6TyhIwit0&id='+this.id;
      window.open(url, '_blank');
    },


  }
}
</script>

<style scoped>

</style>