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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
 
<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-barcode",
  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() {
      if (this.tableData[0].quantity > this.tableData[0].productStorage) {
        this.$message({
          message: "打印数量不可大于库存量",
          type: "warning"
        });
        return;
      }
      debugger;
      // 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);
 
      const url = "/api/storage/check/updateData";
      var creator = localStorage.getItem("creator") || ''; //创建人  
      debugger
      const detailList = JSON.stringify(
        this.tableData.map(m => {
          return {
            poCode: this.tableData[0].poCode,
            productCode: this.tableData[0].productCode,
            number: this.tableData[0].quantity,
            saleCode: this.tableData[0].saleCode,
            trackting: this.tableData[0].extendField04,
            creator: creator //后端class subStroage
          };
        })
      );
      debugger;
      const paramss = {
        productPosition_Id: this.tableData[0].productPosition_Id,
        quantity: this.tableData[0].quantity,
        totalWeight: this.tableData[0].totalWeight,
 
        detailList: detailList
      };
      var callback = res => {
        this.common.showMsg(res);
        debugger;
        if (res.result) {
          this.tableData.forEach(item => {
            window.open("/#/print/base-template-id/" + 20001 + "/" + 1611 + "/" + item.productPosition_Id + "?key=" + key);
          });
 
          // debugger;
          // res.data;
        }
        res.msg;
        debugger;
 
        this.currentVisible = false;
      };
      this.common.ajax(url, paramss, callback, true);
    },
    // 打印标签更改数量
    // updateData() {
 
    // },
    quantityJudge() {
      if (this.tableData[0].quantity > this.tableData[0].productStorage) {
        this.$message({
          message: "打印数量不可大于库存量",
          type: "warning"
        });
        return;
      }
    }
  }
};
</script>
<style lang="less" scoped>
@deep: ~">>>";
@{deep} .el-dialog__body {
  padding: 0px 10px;
}
</style>