298 lines
12 KiB
Plaintext
298 lines
12 KiB
Plaintext
<style lang='scss'>
|
|
.item{
|
|
.item__input{
|
|
display: none;
|
|
width: 80px;
|
|
/* 调整elementUI中样式 如果不需要调整请忽略 */
|
|
.el-input__inner{
|
|
height: 35px!important;
|
|
}
|
|
/* 调整elementUI中样式 如果不需要调整请忽略 */
|
|
.el-input__suffix{
|
|
i{
|
|
font-size: 12px !important;
|
|
line-height: 26px !important;
|
|
}
|
|
}
|
|
}
|
|
.item__txt{
|
|
box-sizing: border-box;
|
|
line-height: 24px;
|
|
padding: 0 9px;
|
|
}
|
|
}
|
|
</style>
|
|
<el-row id="XWMSSHIP">
|
|
<el-form :inline="true" :model="form">
|
|
<el-col span="24">
|
|
<el-button type="primary" icon="el-icon-plus" @@click="create">创建单据</el-button>
|
|
</el-col>
|
|
<el-form-item>
|
|
<el-select v-model="form.address" placeholder="地点">
|
|
<el-option v-for="item in addressList"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-input v-model="form.sbill" placeholder="发货单号"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-input v-model="form.billno" placeholder="采购订单"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-input v-model="form.materialcode" placeholder="物料编码"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-input v-model="form.ITMDES2_0" placeholder="代号"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button icon="el-icon-search" @@click="search" circle></el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-table :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
|
|
max-height="650"
|
|
stripe border
|
|
style="width: 100%"
|
|
size="small"
|
|
ref="tableData"
|
|
v-loading="loading"
|
|
show-summary
|
|
:highlight-current-row="true"
|
|
@@row-click="handleClickTableRow"
|
|
@@cell-mouse-enter="handleCellEnter"
|
|
@@cell-mouse-leave="handleCellLeave"
|
|
@@selection-change="handleSelectionChange">
|
|
<el-table-column type="selection"
|
|
width="55">
|
|
</el-table-column>
|
|
@* <el-table-column label="地点" align="center" prop="FCY_0"></el-table-column> *@
|
|
<el-table-column label="发货日期" width="100" align="center" prop="SHIDAT_0"></el-table-column>
|
|
@* <el-table-column label="内部供应商" width="150" align="center" prop="STOFCY_0" show-overflow-tooltip></el-table-column> *@
|
|
<el-table-column label="内部供应商名称" width="150" align="center" prop="BPRNAM_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="发货单号" width="150" align="center" prop="SDHNUM_0"></el-table-column>
|
|
<el-table-column label="发货行号" width="100" align="center" prop="SDDLIN_0"></el-table-column>
|
|
<el-table-column label="产品编码" width="180" align="center" prop="ITMREF_0"></el-table-column>
|
|
<el-table-column label="名称" width="150" align="center" prop="ITMDES1_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="代号" width="150" align="center" prop="ITMDES2_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="数量" width="100" align="center" prop="QTY_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="批次" width="150" align="center" prop="LOT_0"></el-table-column>
|
|
<el-table-column label="批次数量" width="100" align="center" prop="QTYSTU_0"></el-table-column>
|
|
<el-table-column label="库存状态" width="100" align="center" prop="STATUS">
|
|
<div class="item" slot-scope="scope">
|
|
<el-select class="item__input" v-model="scope.row.STATUS" placeholder="请选择">
|
|
<el-option v-for="item in options"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value">
|
|
</el-option>
|
|
</el-select>
|
|
<div class="item__txt">{{foodLabel(scope.row.STATUS)}}</div>
|
|
</div>
|
|
</el-table-column>
|
|
<el-table-column label="备注" width="100" align="center" prop="YITMDES4_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="材料" width="100" align="center" prop="ITMDES3_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="销售单位" width="100" align="center" prop="SAU_0"></el-table-column>
|
|
<el-table-column label="采购订单号" width="180" align="center" prop="POHNUM_0"></el-table-column>
|
|
<el-table-column label="订单行号" width="100" align="center" prop="POPLIN_0"></el-table-column>
|
|
|
|
</el-table>
|
|
<el-pagination align='center'
|
|
@@size-change="handleSizeChange"
|
|
@@current-change="handleCurrentChange"
|
|
:current-page="currentPage"
|
|
:page-sizes="[1,5,10,20,50,100,1000]"
|
|
:page-size="pageSize"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
:total="tableData.length">
|
|
</el-pagination>
|
|
</el-row>
|
|
|
|
<script>
|
|
var app = new Vue({
|
|
el: "#XWMSSHIP",
|
|
data() {
|
|
return {
|
|
form: {
|
|
address: 'HYB',
|
|
billno: '',
|
|
sbill: '',
|
|
materialcode: '',
|
|
ITMDES2_0:''
|
|
},
|
|
addressList: [{
|
|
value: 'HYB',
|
|
label: 'HYB'
|
|
}],
|
|
options: [
|
|
{
|
|
value: '',
|
|
label: '请选择'
|
|
}, {
|
|
value: 'A',
|
|
label: 'A'
|
|
}, {
|
|
value: 'Q',
|
|
label: 'Q'
|
|
}, {
|
|
value: 'R',
|
|
label: 'R'
|
|
}],
|
|
loading: false,
|
|
tableData: [],
|
|
currentPage: 1, // 当前页码
|
|
total: 20, // 总条数
|
|
pageSize: 20, // 每页的数据条数
|
|
multipleSelection: [],
|
|
// 需要编辑的属性
|
|
editProp: ['STATUS']
|
|
};
|
|
},
|
|
mounted: function () {
|
|
// 获取所有单据编码
|
|
// $.ajax({
|
|
// type: "post",
|
|
// dataType: "json",
|
|
// data: {},
|
|
// url: "/xwms/XWMSSHIP/Search",
|
|
// success: function (json) {
|
|
// app.tableData = json.Data;
|
|
// },
|
|
// error: function (json) {
|
|
// alert("加载失败");
|
|
// }
|
|
// });
|
|
},
|
|
computed: {
|
|
foodLabel() {
|
|
return (val) => {
|
|
if(val!="")
|
|
return this.options.find(o => o.value === val).label
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
/** 鼠标移入cell */
|
|
handleCellEnter(row, column, cell, event) {
|
|
const property = column.property
|
|
if (this.editProp.includes(property)) {
|
|
cell.querySelector('.item__input').style.display = 'block'
|
|
cell.querySelector('.item__txt').style.display = 'none'
|
|
}
|
|
},
|
|
/** 鼠标移出cell */
|
|
handleCellLeave(row, column, cell, event) {
|
|
const property = column.property
|
|
if (this.editProp.includes(property)) {
|
|
cell.querySelector('.item__input').style.display = 'none'
|
|
cell.querySelector('.item__txt').style.display = 'block'
|
|
}
|
|
},
|
|
//每页条数改变时触发 选择一页显示多少行
|
|
handleSizeChange(val) {
|
|
this.currentPage = 1;
|
|
this.pageSize = val;
|
|
},
|
|
//当前页改变时触发 跳转其他页
|
|
handleCurrentChange(val) {
|
|
this.currentPage = val;
|
|
},
|
|
handleSelectionChange(val) {
|
|
this.multipleSelection = val;
|
|
},
|
|
handleClickTableRow(row) {
|
|
this.$refs.tableData.toggleRowSelection(row, true)
|
|
},
|
|
search() {
|
|
var _this = this;
|
|
_this.loading = true;
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data: {
|
|
address: _this.form.address,
|
|
billno: _this.form.billno,
|
|
sbill: _this.form.sbill,
|
|
materialcode: _this.form.materialcode,
|
|
ITMDES2_0: _this.form.ITMDES2_0
|
|
},
|
|
url: "/xwms/XWMSSHIP/Search",
|
|
success: function (json) {
|
|
_this.tableData = json.Data;
|
|
_this.loading = false;
|
|
},
|
|
error: function (json) {
|
|
_this.$message.error("加载失败");
|
|
_this.loading = false;
|
|
}
|
|
});
|
|
},
|
|
create() {
|
|
var _this = this;
|
|
_this.$confirm('注意:您确认要对此单据进行创建内部收货吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
//加校验
|
|
if (_this.multipleSelection.length == 0) {
|
|
_this.$message.error("至少选择一张单据!");
|
|
return;
|
|
}
|
|
if (_this.verify(_this.multipleSelection)) {
|
|
_this.$message.error("请选择同一张单据!");
|
|
return;
|
|
}
|
|
//收货单要完整收完
|
|
var SDHNUM_0 = _this.multipleSelection[0].SDHNUM_0;
|
|
var tmp = [];
|
|
_this.tableData.forEach(function (x) {
|
|
if (x.SDHNUM_0 == SDHNUM_0) {
|
|
tmp.push(x.SDHNUM_0)
|
|
}
|
|
});
|
|
if (tmp.length != _this.multipleSelection.length) {
|
|
_this.$message.error("一张收货单必须全部收完!");
|
|
return;
|
|
}
|
|
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data: {
|
|
data: _this.multipleSelection
|
|
},
|
|
url: "/xwms/XWMSSHIP/Create",
|
|
success: function (json) {
|
|
if (json.Code == 200) {
|
|
_this.$message("创建成功!");
|
|
_this.$refs.tableData.clearSelection();
|
|
}
|
|
else {
|
|
_this.$message.error("创建失败!" + json.Msg);
|
|
}
|
|
},
|
|
error: function (json) {
|
|
_this.$message.error("创建失败!");
|
|
}
|
|
});
|
|
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消!'
|
|
});
|
|
});
|
|
},
|
|
verify(array) {
|
|
const tmp = new Set();
|
|
array.forEach(x => tmp.add(x.SDHNUM_0));
|
|
return tmp.size > 1 ? true : false;
|
|
}
|
|
},
|
|
});
|
|
</script>
|
|
|