<template>
|
<div ref="container" class="page-list-container">
|
<!--数据Table-->
|
<yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes">
|
</yrt-data-list>
|
|
<!--数据编辑器Editor-->
|
<yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes">
|
</yrt-editor>
|
|
<!--打印条码弹出页面-->
|
<order-barcode ref="barcode-dialog" :visible.sync="barcodeVisible"></order-barcode>
|
</div>
|
</template>
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
import orderBarcode from "@/views/storage/base/components/order-barcode.vue";
|
|
export default {
|
name: "storage-base-product-position-print",
|
components: { orderBarcode },
|
mixins: [baseLayout],
|
data() {
|
return {
|
// 显示全部
|
showAll: false,
|
fixedWhere: {
|
productStorage: {
|
operator: ">",
|
value: 0
|
}
|
},
|
barcodeVisible: false
|
};
|
},
|
methods: {
|
// 列表页面按钮点击事件
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "exportProductPosition":
|
// 导出
|
this.exportProductPosition();
|
break;
|
case "productPrint":
|
this.printBarcode();
|
return false;
|
}
|
},
|
// 打印条码
|
printBarcode() {
|
debugger;
|
// 得到,明细选中项
|
var detailSelections = this.dataListSelections;
|
if (!detailSelections.length) {
|
this.$message.error("至少选择一项!");
|
return;
|
}
|
if (detailSelections.length !== 1) {
|
this.$message.error("请选择一条库存进行操作");
|
return;
|
}
|
var rows = JSON.parse(JSON.stringify(detailSelections));
|
rows.forEach(item => {
|
item.quantity = item.productStorage;
|
});
|
|
this.barcodeVisible = true;
|
this.$refs["barcode-dialog"].showData(rows, []);
|
},
|
// 显示全部
|
onShowAll() {
|
if (this.showAll) {
|
this.fixedWhere = {};
|
} else {
|
this.fixedWhere = {
|
productStorage: {
|
operator: ">",
|
value: 0
|
}
|
};
|
}
|
this.$nextTick(() => {
|
this.dataList.loadData();
|
});
|
},
|
// 导出库存信息
|
exportProductPosition() {
|
var the = this;
|
var selectedIds = the.dataListSelections
|
.map((item, index, array) => {
|
return item.productPosition_Id;
|
})
|
.join(",");
|
if (!selectedIds.length) {
|
this.$message.error("请至少选择一行数据!");
|
return false;
|
}
|
var url = "/api/storage/productPosition/export";
|
const params = {
|
ids: selectedIds
|
};
|
var callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
const url = this.common.domain + "/api/common/download?url=" + res.data.url;
|
window.open(url);
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
}
|
}
|
};
|
</script>
|