<template>
|
<div 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" :open-expand="true" @onDeleteBefore="onDeleteBefore" @on-expand-change="onExpandChange">
|
<div slot="expand-slot" slot-scope="{row, col}" class="card-container">
|
<el-card v-for="(item, index) in subDataListGroup(row)" :key="index" class="box-card">
|
<div slot="header" class="clearfix">
|
<span class="margin-right-20">子波次号:{{ item.subOrderPrintCode }}</span>
|
<span>库区:{{ item.areaCode }}</span>
|
</div>
|
<div v-for="(item, index) in getSubBatch(row, item)" :key="index" class="text item">
|
<el-form inline label-width="80px">
|
<el-form-item label="物料名称" class="row-long">
|
{{ item.productName }}
|
</el-form-item>
|
<el-form-item label="物料编号" class="row">
|
{{ item.productCode }}
|
</el-form-item>
|
<el-form-item label="物料条码" class="row">
|
{{ item.productModel }}
|
</el-form-item>
|
<el-form-item label="货位" class="row">
|
{{ item.positionName }}
|
</el-form-item>
|
<el-form-item label="数量" class="row">
|
{{ item.quantityOrder }}
|
</el-form-item>
|
<el-form-item label="配货位" class="row">
|
{{ item.allotPositionName }}
|
</el-form-item>
|
<el-form-item label="出库单号" class="row">
|
{{ item.orderCode }}
|
</el-form-item>
|
</el-form>
|
<el-divider class="divider"></el-divider>
|
</div>
|
</el-card>
|
</div>
|
<template slot="common-column-slot" slot-scope="{row, col}">
|
<template v-if="col.prop=='statusText'">
|
<el-tag :color="setStatusBgColor(row[col.prop])" :style="setStatusColor(row[col.prop])">
|
{{ row[col.prop] }}
|
</el-tag>
|
</template>
|
<!--连接字段-->
|
<template v-else-if="col.prop==dataOptions.linkColumn">
|
<el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField]);}">{{ row[col.prop] }}</el-link>
|
</template>
|
<template v-else-if="col.dropdown_Id > 0">
|
{{ $refs[dataListRef].translateText( col.prop, row[col.prop], col.dropdown_Id ) }}
|
</template>
|
<template v-else>
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
{{ row[col.prop] }}
|
</template>
|
</template>
|
</template>
|
</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">
|
<!--自定义按钮插槽-->
|
<template slot="footer-button-region" slot-scope="{ formData }">
|
<el-button type="primary" @click.native="addOrder(formData)">添加订单</el-button>
|
<el-button type="primary" @click.native="tempModify(formData)">剔除订单</el-button>
|
<el-button :loading="isSaving" icon="el-icon-help" type="primary" @click.native="lightPicking(formData)">灯光拣选</el-button>
|
</template>
|
</yrt-editor>
|
</div>
|
</template>
|
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
|
export default {
|
name: "outbound-operation-order-batch",
|
components: {},
|
mixins: [baseLayout],
|
// 自定义处理权限函数
|
doAuth(the) {
|
// 判断当前版本是否拥有打印权限
|
var authList = [
|
{ name: "打印拣配单", auth: "detailPrint" },
|
{ name: "打印出库单", auth: "printOut" },
|
{ name: "打印物流单", auth: "printExpress" }
|
];
|
const names = authList.map(item => {
|
return item.name;
|
});
|
the.common.isSaaSAuth(names, res => {
|
authList.forEach(node => {
|
let hasAuth = res.result;
|
if (hasAuth) {
|
hasAuth = res.data.some(item => {
|
return item.moduleName === node.name;
|
});
|
}
|
the.authNodes[node.auth] = hasAuth;
|
});
|
});
|
},
|
data() {
|
return {
|
// 波次单状态值
|
statusValueList: [
|
{
|
status: "待审核",
|
bgColor: "#ffff00",
|
color: "#fff"
|
},
|
{
|
status: "审核成功",
|
bgColor: "#00ff99",
|
color: "#000"
|
},
|
{
|
status: "审核失败",
|
bgColor: "#ffcc66",
|
color: "#fff"
|
},
|
{
|
status: "波次完成",
|
bgColor: "#ffcc33",
|
color: "#fff"
|
},
|
{
|
status: "打包中",
|
bgColor: "#66cccc",
|
color: "#000"
|
},
|
{
|
status: "部分打包",
|
bgColor: "#66cccc",
|
color: "#fff"
|
},
|
{
|
status: "打包完成",
|
bgColor: "#66cccc",
|
color: "#fff"
|
},
|
{
|
status: "发运完成",
|
bgColor: "#33cc33",
|
color: "#fff"
|
},
|
{
|
status: "已发货",
|
bgColor: "#33cc33",
|
color: "#fff"
|
},
|
{
|
status: "部分退货",
|
bgColor: "#ff9999",
|
color: "#fff"
|
},
|
{
|
status: "完全退货",
|
bgColor: "#ff9999",
|
color: "#fff"
|
},
|
{
|
status: "已完成",
|
bgColor: "#99ffff",
|
color: "#fff"
|
},
|
{
|
status: "拣货中",
|
bgColor: "#33ffff",
|
color: "#fff"
|
},
|
{
|
status: "配货中",
|
bgColor: "#ccff66",
|
color: "#fff"
|
},
|
{
|
status: "等待配货",
|
bgColor: "#ccff66",
|
color: "#000"
|
},
|
{
|
status: "等待打包",
|
bgColor: "#cccc33",
|
color: "#000"
|
}
|
],
|
// 在做保存
|
isSaving: false,
|
// 子波次
|
subDataList: []
|
};
|
},
|
methods: {
|
// 状态背景颜色
|
setStatusBgColor(status) {
|
var colorItem = this.statusValueList.find(item => {
|
return item.status === status;
|
});
|
var bgColor = "#fffff";
|
if (colorItem) bgColor = colorItem.bgColor;
|
|
return bgColor;
|
},
|
// 状态字体颜色
|
setStatusColor(status) {
|
var colorItem = this.statusValueList.find(item => {
|
return item.status === status;
|
});
|
var color = "#fffff";
|
if (colorItem) color = colorItem.color;
|
|
return {
|
border: 0,
|
color: color
|
};
|
},
|
// 列表工具栏点击事件
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "detailPrint":
|
// 打印拣配单
|
this.detailPrint();
|
break;
|
case "printOut":
|
// 打印出库单
|
this.printOut();
|
break;
|
case "printExpress":
|
// 打印物流单
|
this.printExpress();
|
break;
|
}
|
},
|
// 打印拣配单
|
detailPrint() {
|
var ids = [];
|
this.dataListSelections.forEach(item => {
|
ids.push(item[this.dataOptions.idField]);
|
});
|
if (!ids.length) {
|
this.$message.error("至少选择一项!");
|
return;
|
}
|
window.open("/#/outbound/operation/order-pick-bill-print/" + ids);
|
},
|
// 打印出库单
|
printOut() {
|
var ids = [];
|
this.dataListSelections.forEach(item => {
|
ids.push(item[this.dataOptions.idField]);
|
});
|
if (!ids.length) {
|
this.$message.error("至少选择一项!");
|
return;
|
}
|
var url = "/api/outbound/orderPrint/getOrderIds";
|
var params = {
|
openNodeApi: true,
|
ids: ids
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.updatePrintCount("outerPrint", ids);
|
window.open("/#/print/base2/detail/" + res.data.join(","));
|
}
|
},
|
this.dataList
|
);
|
},
|
// 打印物流单
|
printExpress() {
|
var ids = [];
|
this.dataListSelections.forEach(item => {
|
ids.push(item[this.dataOptions.idField]);
|
});
|
if (!ids.length) {
|
this.$message.error("至少选择一项!");
|
return;
|
}
|
var url = "/api/outbound/orderPrint/getOrderIds";
|
var params = {
|
ids: ids
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.updatePrintCount("logisticsPrint", ids);
|
window.open("/#/print/base2/express/" + res.data.join(","));
|
}
|
},
|
this.dataList
|
);
|
},
|
// 更新打印次数
|
updatePrintCount(type, ids) {
|
const url = "/api/outbound/orderPrint/updatePrintCount";
|
const params = {
|
ids: ids,
|
type: type
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.dataList.reload();
|
}
|
});
|
},
|
// 添加订单
|
addOrder(formData) {
|
if (!formData.orderPrint_Id) {
|
this.$message({
|
message: "当前数据没有保存!",
|
type: "warning"
|
});
|
return;
|
}
|
this.$prompt("需要新增的订单号", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消"
|
})
|
.then(({ value }) => {
|
this.addOrderInfo(formData.orderPrint_Id, value);
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "取消输入"
|
});
|
});
|
},
|
// 确认添加订单
|
addOrderInfo(orderPrint_Id, orderCode) {
|
const the = this;
|
const url = "/api/outbound/orderPrint/addOrder";
|
const params = {
|
openNodeApi: true,
|
orderPrint_Id: orderPrint_Id,
|
orderCode: orderCode
|
};
|
const ref = the.dataList;
|
var callback = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
this.editorOptions.config.visible = false;
|
ref.loadData();
|
}
|
};
|
the.common.ajax(url, params, callback, ref);
|
},
|
// 剔除订单
|
tempModify(formData) {
|
if (!formData.orderPrint_Id) {
|
this.$message({
|
message: "当前数据没有保存!",
|
type: "warning"
|
});
|
return;
|
}
|
this.$prompt("需要剔除的订单号", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消"
|
})
|
.then(({ value }) => {
|
this.tempModifyInfo(formData.orderPrint_Id, value);
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "取消输入"
|
});
|
});
|
},
|
// 剔除订单号
|
tempModifyInfo(orderPrint_Id, orderCode) {
|
if (!orderCode) {
|
this.$message.error("订单号不能为空!");
|
return false;
|
}
|
const url = "/api/outbound/orderPrint/onFrozenOrder";
|
const params = {
|
orderPrint_Id: orderPrint_Id,
|
orderCode: orderCode
|
};
|
var callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.dataList.loadData();
|
this.editor.reload();
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
// 删除前事件
|
onDeleteBefore(rows) {
|
let statusText = true;
|
var Status = null;
|
rows.forEach(rowData => {
|
statusText = rowData.statusText;
|
Status = rowData.statusText;
|
if (statusText === "波次生成") {
|
statusText = false;
|
}
|
if (statusText === "拣货中") {
|
statusText = false;
|
}
|
if (statusText === "等待配货") {
|
statusText = false;
|
}
|
if (statusText === "配货中") {
|
statusText = false;
|
}
|
});
|
if (statusText !== false) {
|
this.$message.error("波次单状态为:" + Status + ",不允许删除!");
|
this.onDeleteBeforeValue = false;
|
return false;
|
}
|
|
return true;
|
},
|
// 灯光拣选
|
lightPicking(formData) {
|
this.isSaving = true;
|
var url = "/api/outbound/orderPrint/lightPicking";
|
var params = {
|
orderPrintCode: formData.orderPrintCode // 波次号
|
};
|
this.common.ajax(url, params, res => {
|
this.common.showMsg(res);
|
this.isSaving = false;
|
});
|
},
|
// 获得子波次
|
subDataListGroup(row) {
|
const existRow = this.subDataList.find(item => item.orderPrintCode === row.orderPrintCode);
|
if (!existRow) return [];
|
|
const groupList = existRow.data.reduce((all, next) => (all.some(item => item.areaCode === next.areaCode) ? all : [...all, next]), []);
|
return groupList;
|
},
|
|
// 展开事件
|
onExpandChange(row, expandedRows) {
|
const url = "/api/outbound/orderBatch/getSubBatch";
|
const params = {
|
orderPrint_Id: row.orderPrint_Id
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
const existRow = this.subDataList.find(item => item.orderPrintCode === row.orderPrintCode);
|
if (existRow) {
|
existRow.data = res.data;
|
} else {
|
this.subDataList.push({
|
orderPrintCode: row.orderPrintCode,
|
data: res.data
|
});
|
}
|
}
|
},
|
true
|
);
|
},
|
// 当前子波次
|
getSubBatch(row, subRow) {
|
const existRow = this.subDataList.find(item => item.orderPrintCode === row.orderPrintCode);
|
if (!existRow) return [];
|
|
return existRow.data.filter(item => item.areaCode === subRow.areaCode);
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.page-list-container {
|
min-height: calc(100vh - 110px);
|
overflow: hidden;
|
position: relative;
|
}
|
|
@media screen and (max-height: 900px) {
|
.page-list-container {
|
min-height: 600px;
|
}
|
}
|
.card-container {
|
display: flex;
|
flex-direction: row;
|
}
|
.box-card {
|
width: 500px;
|
margin-right: 10px;
|
.row-long {
|
width: 96%;
|
margin-bottom: 0;
|
}
|
.row {
|
width: 45%;
|
margin-bottom: 0;
|
}
|
.divider {
|
margin: 10px 0;
|
}
|
/deep/ .el-form-item--medium .el-form-item__content,
|
/deep/ .el-form-item--medium .el-form-item__label {
|
line-height: 24px;
|
}
|
}
|
</style>
|