Files
WMS/HHWMS.Web/Areas/Receipt/Views/ReceiptInOperation/Index.cshtml
T

119 lines
4.1 KiB
Plaintext

<el-row id="opapp">
<el-card class="box-card" :span="16">
<el-table :data="tableData" ref="multipleTable" border style="width: 100%" @@selection-change="handleSelectionChange">
>
<el-table-column type="selection"
width="55">
</el-table-column>
<el-table-column prop="boxName" label="周转箱" align="center">
</el-table-column>
<el-table-column label="工位" align="center" prop="label">
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-button type="primary" @@click="inOperation()">启动入库</el-button>
</div>
</el-card>
</el-row>
<script>
var app = new Vue({
el: "#opapp",
data() {
return {
// 表格数据
tableData: [
{
boxName: 'L01',
label: '左侧',
station: '3',
},
{
boxName: 'L02',
label: '右侧',
station: '1',
},
],
selectData: []
};
},
mounted: function () {
// 获取所有单据编码
// $.ajax({
// type: "post",
// dataType: "json",
// data:{},
// url: "/receipt/ReceiptIn/SelectReceiptCode",
// success: function (json) {
// app.options = json.Data;
// },
// error: function (json) {
// alert("加载失败");
// }
// });
},
methods: {
handleSelectionChange(val) {
console.log(22);
val.forEach(row => {
if (row.station == '') {
this.$refs.multipleTable.toggleRowSelection(row);
this.$message({
message: "此周转箱没有选择站台!",
type: "warning",
duration: "5000",
});
}
});
this.selectData = val;
let names = this.selectData.map(item => item["station"]);
let nameSet = new Set(names);
if (nameSet.size != names.length) {
this.$message({
message: "站台不能重复!",
type: "warning",
duration: "5000",
});
this.$refs.multipleTable.clearSelection();
this.selectData = [];
}
console.log(this.selectData);
},
// 启动入库
inOperation() {
console.log(this.tableData)
var _this = this;
for (var i = 0; i < _this.tableData.length; i++) {
if (_this.tableData[i].station == null || _this.tableData[i].station == "") {
this.$message({
message: "必须全部选择!",
type: "warning",
duration: "5000",
});
return;
}
}
$.ajax({
type: "post",
dataType: "json",
data: { data: _this.tableData },
url: "/receipt/ReceiptInOperation/InOperation",
success: function (json) {
if (json.Code == 200) {
_this.$message({
message: "启动成功!",
type: "success",
});
}
},
error: function (json) {
alert("加载失败");
}
});
}
}
});
</script>