cuijian
6 天以前 fe87f8fe2250e1ffc7d1474fb97cc0ceb89ae55e
src/views/tms/modules/inbound/InboundListRight.vue
@@ -1,5 +1,5 @@
<template>
  <a-card :bordered="false">
  <a-card :bordered="false" style="flex: 1;overflow:auto;max-height: 600px; min-height: 600px">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
@@ -9,7 +9,7 @@
            :sm="8"
          >
            <a-form-item
              label="工具编号"
              label="工具编码"
              :labelCol="{span: 5}"
              :wrapperCol="{span: 18, offset: 1}"
            >
@@ -99,23 +99,14 @@
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
       <span
          slot="action"
          slot-scope="text, record"
        >
          <a
            href="javascript:;"
            @click="handlePrint(record)"
          >打印二维码</a>
        </span>
      </a-table>
@@ -147,6 +138,13 @@
    <inbound-model ref="modalForm" @ok="modalFormOk" :nodeSelected="nodeSelected"></inbound-model>
    <inbound-apply-model-list ref="inboundApplyModelList"></inbound-apply-model-list>
    <div id="printArea" style="display: block;">
      <div v-for="(item, index) in qrList" :key="index" class="qrcode-item">
        <p>{{ item.onlyCode }}</p>
        <p>{{ item.toolName }}</p>
        <img :src="item.base64" alt="QR Code">
      </div>
    </div>
  </a-card>
</template>
@@ -166,6 +164,7 @@
  import ParaBladeList from '.././baseTools/ParaBladeList'
  import InboundModel from './InboundModel'
  import InboundApplyModelList from './InboundApplyModelList.vue'
  import printJS from 'print-js';
  export default {
    name: 'InboundListRight',
@@ -188,8 +187,8 @@
        /* 分页参数 */
      ipagination:{
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '50'],
        pageSize: 5,
        pageSizeOptions: ['5', '10', '30'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
@@ -258,14 +257,14 @@
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          // {
          //   title: '操作',
          //   dataIndex: 'action',
          //   align:"center",
          //   fixed:"right",
          //   width:147,
          //   scopedSlots: { customRender: 'action' }
          // }
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/tms/inStoreDetail/list",
@@ -281,13 +280,15 @@
          exportXlsUrl: "/tms/baseTools/exportXls",
          importExcelUrl: "tms/baseTools/importExcel",
          queryParaByToolCode:"/tms/baseTools/queryByToolCode",
          queryByToolCode:"/tms/toolsConfigProperty/queryByToolCode"
          queryByToolCode:"/tms/toolsConfigProperty/queryByToolCode",
          print:'/tms/inStoreDetail/print'
        },
        dictOptions:{},
        superFieldList:[],
        nodeSelected: {}, // 当前选中的节点数据
        paraTypeFlag:'',
        disableMixinCreated:true
        disableMixinCreated:true,
        qrList: []
      }
    },
    created() {
@@ -349,10 +350,11 @@
        }
      },
      onSelectChange(selectedRowKeys) {
      onSelectChange(selectedRowKeys,selectionRows) {
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows
        //通过id查询管理参数和参数数据
        getAction(this.url.queryParaByToolCode, { toolCode: this.selectedRowKeys[0],paraTypeFlag:this.paraTypeFlag}).then((res) => {
        getAction(this.url.queryParaByToolCode, { toolCode: this.selectionRows[0].toolCodeId,paraTypeFlag:this.paraTypeFlag}).then((res) => {
          if (res.success) {
            if(this.paraTypeFlag === "1"){
              this.$refs.paraCommonToolList.getPara(res.result);
@@ -371,7 +373,7 @@
            this.$message.warning(res.message);
          }
        })
        getAction(this.url.queryByToolCode, { toolCode: this.selectedRowKeys[0]}).then((res) => {
        getAction(this.url.queryByToolCode, { toolCode: this.selectionRows[0].toolCodeId}).then((res) => {
          if (res.success) {
            this.$refs.toolsConfigPropertyList.getPara(res.result);
          } else {
@@ -491,9 +493,10 @@
              this.ipagination.total = res.result.total
              //默认选中第一条数据
              this.selectedRowKeys[0] = res.result.records[0].id
              this.onSelectChange(this.selectedRowKeys)
              this.selectionRows = res.result.records
              this.onSelectChange(this.selectedRowKeys,this.selectionRows)
            } else {
              this.$message.warning("请选择叶子节点进行查询");
              //this.$message.warning("请选择叶子节点进行查询");
              this.ipagination.total = 0
            }
          })
@@ -501,7 +504,7 @@
            this.loading = false;
          });
        } else {
          this.$message.warning("请选择叶子节点进行查询");
          //this.$message.warning("请选择叶子节点进行查询");
        }
      },
      onClearSelected() {
@@ -525,7 +528,46 @@
        this.$refs.paraTurningToolsList.visable = false
        this.$refs.paraBladeList.visable = false
        this.$refs.toolsConfigPropertyList.visable = false
      }
      },
      handlePrint(record){
          this.loading = true
          getAction(this.url.print, {onlyCode:record.onlyCode})
            .then((res) => {
              if (res.success) {
                this.qrList = res.result.map((content, i) => ({
                  onlyCode:res.result[i].onlyCode,
                  toolName:res.result[i].toolName,
                  base64: res.result[i].image
                  }));
                  this.handleBacthPrint();
                this.$emit('ok', new Date())
              } else {
                this.$message.warning(res.message)
              }
            })
            .finally(() => {
              this.loading = false
              this.close()
            })
    },
    // 执行打印
    handleBacthPrint() {
      this.$nextTick(() => {
        printJS({
          printable: 'printArea',
          type: 'html',
          style: `
            .qrcode-item {
              page-break-inside: avoid;
              margin: 10px;
              text-align: center;
            }
            img { width: 100px; height: 100px; }
          `,
          scanStyles: false
        });
      });
    }
      
    },
  }