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

    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="search">
        <a-row :gutter="28">
          <a-col :md="5" :sm="8">
            <a-form-item label="识别码" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
              <a-input placeholder="请输入识别码" v-model="querySource.uniqueCode"></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.trim="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.trim="querySource.name"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="工艺状态">
              <j-dict-select-tag placeholder="请选择" v-model="querySource.status" dictCode="gyStatus"/>
            </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="printBatch2" icon="printer"-->
                <!--                        style="margin-left: 8px">批量打印(50*80)</a-button>-->
              </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <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"
      :scroll="{x:true}"
      :columns="columns"
      :loading="loading"
      :pagination="ipagination"
      :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: selectChanges}"
      :dataSource="dataSource"
      @change="handleTableChange">
      <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},
      },
      /* 分页参数 */
      ipagination: {
        current: 1,
        pageSize: 50,
        pageSizeOptions: ['50', '100', '150'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      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: 'uniqueCode',
          key: 'uniqueCode'
        },
        {
          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.id = id;
      this.loadData();
    },

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

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


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

    printChoose() {
      if (this.drawno == '') {
        this.$message.error("请至少选择一条")
        return false;
      }
      //var url = 'http://localhost:8080/wms/jmreport/view/948082815679328256?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJhZG1pbiJdLCJleHAiOjE3NDY2NzI5MjYsIndhcmVob3VzZUNvZGUiOiJDUzAwMDEiLCJ1c2VybmFtZSI6ImFkbWluIn0.pDlobi-3NjvDhLXhpddvT1U_jGs3rRBZcb5kIshyB_E&id=' + this.id + '&drawingNo=' +  encodeURIComponent(this.drawno);
      var url = 'http://172.16.50.12:8080/wms/jmreport/view/948082815679328256?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJhZG1pbiJdLCJleHAiOjE3NTIyODgyOTYsIndhcmVob3VzZUNvZGUiOiJDUzAwMDEiLCJ1c2VybmFtZSI6ImFkbWluIn0.fnIFRTVfpUP4eWmL0iFxASIjQXPlyk4N1NOluu2Km0A&id=' + this.id + '&drawingNo=' +  encodeURIComponent(this.drawno);
      //window.open(url, '_blank');
      window.open(url, "newWindow", "toolbar=no,scrollbars=no,menubar=no,screenX=100,screenY=100");
    },

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

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


  }
}
</script>

<style scoped>

</style>