278 lines
12 KiB
Plaintext
278 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="XWMSPTH">
|
|
<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.materialcode" placeholder="物料编码"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-input v-model="form.cgsh" 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.supply" 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)" height="650" stripe border
|
|
style="width: 100%"
|
|
size="small"
|
|
ref="tableData"
|
|
v-loading="loading"
|
|
: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="PRHFCY_0"></el-table-column>
|
|
<el-table-column label="收货日期" width="100" align="center" prop="RCPDAT_0"></el-table-column>
|
|
@* <el-table-column label="供应商" align="center" prop="BPSNUM_0"></el-table-column> *@
|
|
<el-table-column label="供应商名称" width="150" align="center" prop="BPSNAM_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="采购收货号" width="150" align="center" prop="PTHNUM_0"></el-table-column>
|
|
<el-table-column label="行号" width="100" align="center" prop="PTDLIN_0"></el-table-column>
|
|
<el-table-column label="项目号" width="150" align="center" prop="PJT_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="项目名称" width="150" align="center" prop="OPPEXTNUM_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="产品" width="150" align="center" prop="ITMREF_0"></el-table-column>
|
|
<el-table-column label="采购说明" width="150" align="center" prop="POHITMDES1_0" show-overflow-tooltip></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="100" align="center" prop="ITMDES2_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="150" align="center" prop="YITMDES4_0" show-overflow-tooltip></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-column label="采购订单库存数量" width="100" align="center" prop="POHQTYSTU_0"></el-table-column>
|
|
<el-table-column label="采购订单采购数量" width="100" align="center" prop="POHQTYUOM_0"></el-table-column>
|
|
<el-table-column label="收货数量(采购单位)" width="100" align="center" prop="QTYUOM_0"></el-table-column>
|
|
<el-table-column label="采购单位" width="100" align="center" prop="UOM_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="STU_0"></el-table-column>
|
|
<el-table-column label="已退货库存数量" align="center" prop="RTNQTYSTU_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="收货单存货/采购数量系统" align="center" prop="UOMSTUCOE_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="本次退货量(库存单位)" width="100" align="center" prop="THISQTYSTU">
|
|
<div class="item" slot-scope="scope">
|
|
<el-input class="item__input" v-model="scope.row.THISQTYSTU" placeholder="请输入内容"></el-input>
|
|
<div class="item__txt">{{scope.row.THISQTYSTU}}</div>
|
|
</div>
|
|
</el-table-column>
|
|
<el-table-column label="退货量(采购单位)" width="100" align="center" prop="THISQTYUOM"></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: "#XWMSPTH",
|
|
data() {
|
|
return {
|
|
form: {
|
|
address: 'HYB',
|
|
billno: '',
|
|
supply: '',
|
|
materialcode: '',
|
|
cgsh: ''
|
|
},
|
|
addressList: [{
|
|
value: 'HYB',
|
|
label: 'HYB'
|
|
}],
|
|
loading: false,
|
|
tableData: [],
|
|
currentPage: 1, // 当前页码
|
|
total: 20, // 总条数
|
|
pageSize: 20, // 每页的数据条数
|
|
multipleSelection: [],
|
|
// 需要编辑的属性
|
|
editProp: ['THISQTYSTU']
|
|
};
|
|
},
|
|
mounted: function () {
|
|
// 获取所有单据编码
|
|
// $.ajax({
|
|
// type: "post",
|
|
// dataType: "json",
|
|
// data: {},
|
|
// url: "/xwms/XWMSPTH/Search",
|
|
// success: function (json) {
|
|
// app.tableData = json.Data;
|
|
// },
|
|
// error: function (json) {
|
|
// alert("加载失败");
|
|
// }
|
|
// });
|
|
},
|
|
computed: {
|
|
foodLabel() {
|
|
return (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'
|
|
}
|
|
if (property == "THISQTYSTU") {
|
|
// 库存单位除以系数
|
|
if (row.THISQTYSTU > row.QTYSTU_0) {
|
|
row.THISQTYSTU = row.QTYSTU_0;
|
|
this.$message.error("不能超出单据数量");
|
|
}
|
|
else {
|
|
row.THISQTYUOM = row.THISQTYSTU / row.UOMSTUCOE_0;
|
|
}
|
|
}
|
|
},
|
|
//每页条数改变时触发 选择一页显示多少行
|
|
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,
|
|
supply: _this.form.supply,
|
|
materialcode: _this.form.materialcode,
|
|
cgsh: _this.form.cgsh,
|
|
},
|
|
url: "/xwms/XWMSPTH/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;
|
|
}
|
|
$.ajax({
|
|
type: "post",
|
|
dataType: "json",
|
|
data: {
|
|
data: _this.multipleSelection
|
|
},
|
|
url: "/xwms/XWMSPTH/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.PTHNUM_0));
|
|
return tmp.size > 1 ? true : false;
|
|
}
|
|
},
|
|
});
|
|
</script>
|
|
|