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}"
            >
@@ -58,7 +58,7 @@
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload> -->
      <a-button @click="handleInbound(nodeSelected)" type="primary" icon="plus">申请单入库</a-button>
      <a-button @click="handleInbound" type="primary">申请单入库</a-button>
    </div>
    <!-- table区域-begin -->
@@ -76,6 +76,7 @@
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:'radio'}"
        class="j-table-force-nowrap"
        :customRow="customRow"
        @change="handleTableChange">
        <template slot="htmlSlot" slot-scope="text">
@@ -98,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>
@@ -145,6 +137,14 @@
    </a-tabs>
    <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>
@@ -163,6 +163,8 @@
  import ParaCommonToolList from '.././baseTools/ParaCommonToolList'
  import ParaBladeList from '.././baseTools/ParaBladeList'
  import InboundModel from './InboundModel'
  import InboundApplyModelList from './InboundApplyModelList.vue'
  import printJS from 'print-js';
  export default {
    name: 'InboundListRight',
@@ -176,7 +178,8 @@
      ParaTurningToolsList,
      ParaCommonToolList,
      ParaBladeList,
      InboundModel
      InboundModel,
      InboundApplyModelList
    },
    data () {
      return {
@@ -184,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 + "条"
        },
@@ -211,9 +214,14 @@
            dataIndex: 'toolCode'
          },
          {
            title:'工具编号',
            align:"center",
            dataIndex: 'onlyCode'
          },
          {
            title:'入库类型',
            align:"center",
            dataIndex: 'inStorehouseType'
            dataIndex: 'inStorehouseTypeName'
          },
          {
            title:'型号/图号',
@@ -229,7 +237,7 @@
          {
            title:'入库数量',
            align:"center",
            dataIndex: 'inStorageQuantity'
            dataIndex: 'inNumber'
          },
          // {
          //   title:'备注',
@@ -259,7 +267,7 @@
          }
        ],
        url: {
          list: "/tms/inboundDetail/list",
          list: "/tms/inStoreDetail/list",
          paraHolesToolsList:"/tms/baseTools/paraHolesToolsList",
          paraCommonToolList:"/tms/baseTools/paraCommonToolList",
          paraThreadingToolList:"/tms/baseTools/paraThreadingToolList",
@@ -272,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() {
@@ -308,6 +318,10 @@
          this.$refs.modalForm.title = "新增工具入库";
          this.$refs.modalForm.disableSubmit = false;
      },
      handleInbound() {
          this.$refs.inboundApplyModelList.show();
      },
      handleDelete(id) {
        deleteAction(this.url.delete, {id: id}).then((res) => {
                if (res.success) {
@@ -326,10 +340,21 @@
        this.$bus.$emit('queryTreeData') //刷新左侧树
      },
      onSelectChange(selectedRowKeys) {
      customRow(record) {
        return {
          on: {
            click: () => {
              this.onSelectChange(record.id.split(","), [record]);
            }
          }
        }
      },
      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);
@@ -348,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 {
@@ -466,8 +491,12 @@
            if (res.success) {
              this.dataSource = res.result.records; // 更新表格数据
              this.ipagination.total = res.result.total
              //默认选中第一条数据
              this.selectedRowKeys[0] = res.result.records[0].id
              this.selectionRows = res.result.records
              this.onSelectChange(this.selectedRowKeys,this.selectionRows)
            } else {
              this.$message.warning("请选择叶子节点进行查询");
              //this.$message.warning("请选择叶子节点进行查询");
              this.ipagination.total = 0
            }
          })
@@ -475,7 +504,7 @@
            this.loading = false;
          });
        } else {
          this.$message.warning("请选择叶子节点进行查询");
          //this.$message.warning("请选择叶子节点进行查询");
        }
      },
      onClearSelected() {
@@ -499,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
        });
      });
    }
      
    },
  }