333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
 
<template>
  <el-dialog :visible.sync="currentVisible" title="打印物料标签" append-to-body width="1000px">
    <el-alert title="提示:下面可改变打印标签的数量" type="success"></el-alert>
    <el-table :data="tableData" stripe style="width: 100%">
      <el-table-column prop="productCode" label="物料编号" width="160">
      </el-table-column>
      <el-table-column prop="productName" label="物料名称" width="160">
      </el-table-column>
      <el-table-column prop="productStorage" label="未打印数量" width="100">
      </el-table-column>
 
      <el-table-column prop="quantity" label="打印数量" width="120">
        <template slot-scope="{$idnex, row}">
          <el-input-number v-model.number="row.quantity" controls-position="right" class="w-100" @change="quantityJudge"></el-input-number>
        </template>
      </el-table-column>
      <el-table-column prop="quantity" label="打印重量" width="120">
        <template slot-scope="{$idnex, row}">
          <el-input-number v-model.number="row.totalWeight" controls-position="right" class="w-100"></el-input-number>
        </template>
      </el-table-column>
      <el-table-column prop="poCode" label="采购单号" width="135">
      </el-table-column>
      <el-table-column prop="itemNumber" label="采购项号" width="120">
      </el-table-column>
      <el-table-column prop="saleCode" label="销售单号" width="120">
      </el-table-column>
      <el-table-column prop="extendField08" label="销售项号" width="120">
      </el-table-column>
      <el-table-column prop="extendField04" label="跟踪号" width="120">
      </el-table-column>
      <el-table-column prop="limitDate" label="限用日期" width="160">
      </el-table-column>
 
      <!-- <el-table-column prop="productSpec" label="规格">
      </el-table-column> -->
    </el-table>
 
    <div slot="footer" class="dialog-footer">
      <el-button @click="currentVisible = false">取 消</el-button>
      <el-button type="primary" @click="printBarcode">确 定</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
export default {
  name: "order-barcodes",
  components: {},
  props: {
    visible: {
      type: Boolean,
      default: false,
      required: true
    }
  },
  data() {
    return {
      id: "",
      tableData: [],
      formLabelWidth: "80px",
      // 管理列表dataOptions参数
      dataOptions: {
        type: Object,
        default: () => {
          return {};
        }
      }
    };
  },
  computed: {
    currentVisible: {
      get: function() {
        return this.visible;
      },
      set: function(val) {
        this.$emit("update:visible", val);
      }
    }
  },
  methods: {
    showData(rows, keyValues) {
      localStorage.setItem("keyValues", JSON.stringify(keyValues));
      this.tableData = rows;
    },
    printBarcode() {
      // const idField = this.dataOptions.idField;
      // var ids = this.$parent.dataListSelections.map(item => item[idField]);
 
      if (!this.tableData.length) {
        this.$message.error("执行选择一项");
        return;
      }
      var params = Object.assign({}, this.$parent.dataOptions);
      const quantity = this.tableData[0].quantity;
      const totalWeight = this.tableData[0].totalWeight;
      // 将数量传入到打印页面
      params.quantity = quantity;
      params.totalWeight = totalWeight;
 
      // 明细参数处理
      var ref = this.findRef(this.$parent.editorRef);
      params.detailList = ref.detailFields.map(item => {
        const newItem = {
          tableName: item.subTableView,
          pageIndex: item.options.pageIndex,
          pageSize: item.options.pageSize,
          idField: item.options.idField,
          orderBy: item.options.orderBy,
          quantity: item.quantity
        };
        if (item.options.showSumField) {
          newItem.sumColumnNames = item.options.sumColumnNames;
        }
        return newItem;
      });
      debugger;
      const key = this.common.getGUID();
      sessionStorage[key] = JSON.stringify(params);
      this.updateData();
      this.tableData.forEach(item => {
        window.open("/#/print/base-template-id/" + 20002 + "/" + 1616 + "/" + item.position_Id + "?key=" + key);
      });
    },
    // 打印标签更改数量
    updateData() {
      const url = "/api/storage/check/updatePrintCount";
      debugger;
      const params = {
        position_Id: this.tableData[0].position_Id
      };
      var callback = res => {
        if (res.result) {
          res.data;
        }
      };
      this.common.ajax(url, params, callback, true);
    }
  }
};
</script>
<style lang="less" scoped>
@deep: ~">>>";
@{deep} .el-dialog__body {
  padding: 0px 10px;
}
</style>