<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">
|
<template slot="common-column-slot" slot-scope="{ row, col }">
|
<template v-if="col.prop == 'allocationText'">
|
<template>
|
<el-tag :color="setStatusBgColor(row[col.prop])" :style="setStatusColor(row[col.prop])" class="cursor-pointer">
|
{{ row[col.prop] }}
|
</el-tag>
|
</template>
|
</template>
|
<!--分拣状态字段-->
|
<template v-else-if="col.prop == 'sortingStatus'">
|
<template>
|
<el-tag v-if="row[col.prop] == 1" color="#ffff33" style="color:black;border:0">
|
{{ $refs[dataListRef].translateText( col.prop, row[col.prop], col.dropdown_Id ) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop] == 2" color="#00ff99" style="color:black;border:0">
|
{{ $refs[dataListRef].translateText( col.prop, row[col.prop], col.dropdown_Id ) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop] == 3" color="#ff0000" style="color:black;border:0;color:#fff;">
|
{{ $refs[dataListRef].translateText( col.prop, row[col.prop], col.dropdown_Id ) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop] == 5" color="#6699FF" style="color:black;border:0;color:#fff;">
|
{{ $refs[dataListRef].translateText( col.prop, row[col.prop], col.dropdown_Id ) }}
|
</el-tag>
|
<span v-else>
|
{{ row[col.prop] }}
|
</span>
|
</template>
|
</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" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes" :btn-read-only="btnReadOnly" :use-detail-slot="['sortingStatus', 'lackStorage']" @on-edit-load-after="onEditLoadAfter">
|
</yrt-editor>
|
|
<!--明细选择器-->
|
<yrt-selector ref="selector-dialog" :config="selectorConfig" :visible.sync="selectorConfig.visible" @on-selected="onSelected"></yrt-selector>
|
|
<!-- 批量导入 -->
|
<import-dialog :visible.sync="importConfig.isShowDialog" :import-config="importConfig"></import-dialog>
|
|
</div>
|
</template>
|
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
import yrtSelector from "@/components/common/yrtSelector.vue";
|
import ImportDialog from "@/components/common/components/import-common-dialog";
|
|
export default {
|
name: "outbound-require-allocation",
|
components: {
|
yrtSelector,
|
ImportDialog
|
},
|
mixins: [baseLayout],
|
data() {
|
return {
|
// 预到货状态值
|
statusValueList: [
|
{
|
status: "审核成功",
|
bgColor: "#00ff99",
|
color: "black"
|
},
|
{
|
status: "新建",
|
bgColor: "#ffff66",
|
color: "#000"
|
},
|
{
|
status: "审核失败",
|
bgColor: "#ffcc66",
|
color: "#fff"
|
},
|
{
|
status: "终止",
|
bgColor: "#ff0066",
|
color: "#fff"
|
}
|
],
|
// 选择器配置参数
|
selectorConfig: {
|
title: "物料选择器",
|
width: "1000px",
|
visible: false,
|
// 配置路由
|
router: "/selector/s-product-selector"
|
},
|
// 导入对话框参数
|
importConfig: {
|
// 显示导入对话框
|
isShowDialog: false,
|
title: "要货调拨导入",
|
// 导入地址
|
url: "/api/outbound/allocation/importExcel",
|
// 模板地址
|
templateUrl: "https://auod-beijing.oss-cn-beijing.aliyuncs.com/node-wms/template/调拨单导入模板.xlsx"
|
}
|
};
|
},
|
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 "batchSort":
|
// 批量分拣
|
this.batchSort(this.dataListSelections);
|
break;
|
case "printPickBill":
|
// 打印拣配单
|
this.printPickBill(this.dataListSelections);
|
break;
|
case "confirmAllocation":
|
// 生成调拨单
|
this.confirmAllocation(this.dataListSelections);
|
break;
|
case "imporallot":
|
// 导入
|
this.importConfig.isShowDialog = true;
|
return true;
|
}
|
},
|
// 明细按钮点击事件
|
detailButtonClick(authNode) {
|
switch (authNode) {
|
case "detailAdd":
|
// 明细添加
|
this.selectorConfig.visible = true;
|
return true;
|
}
|
},
|
// 数据加载后,设置是否可编辑
|
onEditLoadAfter(formData) {
|
var allocationText = formData.allocationText;
|
if (allocationText === "新建") {
|
// 新建
|
this.btnReadOnly.auditing = false;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.copy = true;
|
this.btnReadOnly.save = false;
|
this.editorOptions.config.disabled = false; // 整个对话框可编辑
|
} else if (allocationText === "审核成功") {
|
// 审核成功
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = false;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
this.btnReadOnly.copy = false;
|
} else if (allocationText === "终止") {
|
// 9-终止
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = false;
|
this.btnReadOnly.save = true;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
this.btnReadOnly.copy = false;
|
} else {
|
this.btnReadOnly.auditing = true;
|
this.btnReadOnly.stop = true;
|
this.btnReadOnly.open = true;
|
this.btnReadOnly.save = true;
|
this.editorOptions.config.disabled = true; // 整个对话框可编辑
|
this.btnReadOnly.copy = false;
|
}
|
},
|
// 将明细选择器选择中的数据填充到明细表中
|
onSelected(rows) {
|
rows.forEach(element => {
|
// element.sortingStatus = 1;
|
// element.quantityOrder = 1;
|
});
|
this.editor.addDetailDataRow(rows);
|
this.selectorConfig.visible = false;
|
},
|
// 确认调拨
|
confirmAllocation(dataList) {
|
// 获得已选中的ID
|
const selectIDs = dataList.map((item, index, Array) => {
|
return item.allocation_Id;
|
});
|
if (!selectIDs.length) {
|
this.$message({
|
message: "至少选中一行!",
|
type: "warning"
|
});
|
return;
|
}
|
|
const the = this;
|
this.$confirm("操作确认调拨操作吗?", "确认调拨", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
const url = "/api/outbound/allocation/confirmAllocation";
|
const params = {
|
allocation_Ids: selectIDs
|
};
|
const ref = the.dataList;
|
var callback = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
ref.loadData();
|
}
|
};
|
the.common.ajax(url, params, callback, ref);
|
})
|
.catch(() => {
|
the.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
},
|
// 分拣
|
batchSort(dataList) {
|
const the = this;
|
this.$confirm("确认操作分拣操作吗?", "分拣", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
// 获得已选中的ID
|
const selectIDs = dataList.map((item, index, Array) => {
|
return item.allocation_Id;
|
});
|
if (selectIDs === "") {
|
this.$message({
|
message: "至少选中一行!",
|
type: "warning"
|
});
|
return;
|
}
|
const url = "/api/outbound/allocation/batchSort";
|
const params = {
|
allocation_Ids: selectIDs
|
};
|
const ref = the.dataList;
|
var callback = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
ref.loadData();
|
}
|
};
|
the.common.ajax(url, params, callback, ref);
|
})
|
.catch(() => {
|
the.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
},
|
// 打印拣配单
|
printPickBill(dataList) {
|
// 获得已选中的ID
|
const selectIDs = dataList.map((item, index, Array) => {
|
return item.allocation_Id;
|
});
|
window.open("/#/outbound/require/allocation-pick-bill-print/" + selectIDs.join(","));
|
}
|
}
|
};
|
</script>
|