|
<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>
|