458 lines
18 KiB
Plaintext
458 lines
18 KiB
Plaintext
@* <div id="test">
|
|
<el-table
|
|
:data="tableData"
|
|
size="mini"
|
|
style="width: 600px"
|
|
@@cell-mouse-enter="handleCellEnter"
|
|
@@cell-mouse-leave="handleCellLeave"
|
|
>
|
|
<el-table-column
|
|
prop="date"
|
|
label="日期"
|
|
width="180">
|
|
<div class="item" slot-scope="scope">
|
|
<el-input class="item__input" v-model="scope.row.date" placeholder="请输入内容"></el-input>
|
|
<div class="item__txt">{{scope.row.date}}</div>
|
|
</div>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="name"
|
|
label="姓名"
|
|
width="180">
|
|
<div class="item" slot-scope="scope">
|
|
<el-input class="item__input" v-model="scope.row.name" placeholder="请输入内容"></el-input>
|
|
<div class="item__txt">{{scope.row.name}}</div>
|
|
</div>
|
|
</el-table-column>
|
|
<el-table-column
|
|
prop="food"
|
|
label="食物">
|
|
<div class="item" slot-scope="scope">
|
|
<el-select class="item__input" v-model="scope.row.food" 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.food)}}</div>
|
|
</div>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
|
|
<script>
|
|
var app = new Vue({
|
|
el: '#test',
|
|
data() {
|
|
return {
|
|
// 下拉选项
|
|
options: [{
|
|
value: '选项1',
|
|
label: '黄金糕'
|
|
}, {
|
|
value: '选项2',
|
|
label: '双皮奶'
|
|
}, {
|
|
value: '选项3',
|
|
label: '蚵仔煎'
|
|
}, {
|
|
value: '选项4',
|
|
label: '龙须面'
|
|
}, {
|
|
value: '选项5',
|
|
label: '北京烤鸭'
|
|
}],
|
|
// 表格数据
|
|
tableData: [{
|
|
date: '2016-05-02',
|
|
name: '王小虎',
|
|
food: '选项5'
|
|
}, {
|
|
date: '2016-05-04',
|
|
name: '王小虎',
|
|
food: '选项5'
|
|
}, {
|
|
date: '2016-05-01',
|
|
name: '王小虎',
|
|
food: '选项5'
|
|
}, {
|
|
date: '2016-05-03',
|
|
name: '王小虎',
|
|
food: '选项5'
|
|
}],
|
|
// 需要编辑的属性
|
|
editProp: ['date', 'name', 'food']
|
|
}
|
|
},
|
|
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'
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style lang='scss'>
|
|
.item{
|
|
.item__input{
|
|
display: none;
|
|
width: 100px;
|
|
/* 调整elementUI中样式 如果不需要调整请忽略 */
|
|
.el-input__inner{
|
|
height: 24px!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>
|
|
*@
|
|
|
|
<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="XWMSPOH">
|
|
<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.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-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)"
|
|
height="650" stripe border
|
|
style="width: 100%"
|
|
size="small"
|
|
ref="tableData"
|
|
v-loading="loading"
|
|
:header-cell-style="headerStyleEvent"
|
|
:highlight-current-row="true"
|
|
@@row-click="handleClickTableRow"
|
|
@@cell-mouse-enter="handleCellEnter"
|
|
@@cell-mouse-leave="handleCellLeave"
|
|
@@selection-change="handleSelectionChange">
|
|
<el-table-column type="index"
|
|
width="50">
|
|
</el-table-column>
|
|
<el-table-column type="selection"
|
|
width="55">
|
|
</el-table-column>
|
|
@* <el-table-column label="地点" align="center" prop="POHFCY_0"></el-table-column> *@
|
|
<el-table-column label="订单日期" width="100" align="center" prop="ORDDAT_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="BPRNAM_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="订单号" width="150" align="center" prop="POHNUM_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="行号" width="80" align="center" prop="POPLIN_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="产品" width="150" align="center" prop="ITMREF_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="150" align="center" prop="ITMDES2_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="本次收量(采购单位kg)" width="100" align="center" prop="THISQTYUOM">
|
|
<div class="item" slot-scope="scope">
|
|
<el-input class="item__input" v-model="scope.row.THISQTYUOM" placeholder="请输入内容"></el-input>
|
|
<div class="item__txt">{{scope.row.THISQTYUOM}}</div>
|
|
</div>
|
|
</el-table-column>
|
|
<el-table-column label="库存状态" width="100" align="center" prop="STA_0">
|
|
<div class="item" slot-scope="scope">
|
|
<el-select class="item__input" v-model="scope.row.STA_0" 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.STA_0)}}</div>
|
|
</div>
|
|
</el-table-column>
|
|
<el-table-column label="未收库存数量" width="100" align="center" prop="NRCPQTYSTU_0"></el-table-column>
|
|
<el-table-column label="未收采购数量" width="100" align="center" prop="NRCPQTYPUU_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" show-overflow-tooltip></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="100" align="center" prop="QTYSTU_0"></el-table-column>
|
|
<el-table-column label="库存单位" width="100" align="center" prop="STU_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="计量单位/存货单位系数" width="100" align="center" prop="UOMSTUCOE_0" show-overflow-tooltip></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="PJTNAM_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="材料" align="center" prop="ITMDES3_0" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="备注" align="center" prop="YITMDES4_0" show-overflow-tooltip></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: "#XWMSPOH",
|
|
data() {
|
|
return {
|
|
form: {
|
|
address: 'HYB',
|
|
billno: '',
|
|
supply: '',
|
|
materialcode: '',
|
|
ITMDES2_0:''
|
|
},
|
|
addressList: [{
|
|
value: 'HYB',
|
|
label: 'HYB'
|
|
}],
|
|
options: [{
|
|
value: 'A',
|
|
label: 'A'
|
|
}, {
|
|
value: 'Q',
|
|
label: 'Q'
|
|
}, {
|
|
value: 'R',
|
|
label: 'R'
|
|
}],
|
|
loading: false,
|
|
tableData: [],
|
|
currentPage: 1, // 当前页码
|
|
total: 20, // 总条数
|
|
pageSize: 20, // 每页的数据条数
|
|
// 需要编辑的属性
|
|
editProp: ['THISQTYSTU', 'STA_0', 'THISQTYUOM'],
|
|
multipleSelection: []
|
|
};
|
|
},
|
|
mounted: function () {
|
|
// var t = localStorage.getItem("WareHouseId");
|
|
// console.log(t);
|
|
// 获取所有单据编码
|
|
// $.ajax({
|
|
// type: "post",
|
|
// dataType: "json",
|
|
// data: {},
|
|
// url: "/xwms/XWMSPOH/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: {
|
|
headerStyleEvent({ row, column, rowIndex, columnIndex }) {
|
|
if (columnIndex == 9
|
|
|| columnIndex == 10
|
|
|| columnIndex == 11) {
|
|
return 'background-color:#FFFF99'
|
|
}
|
|
},
|
|
/** 鼠标移入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") {
|
|
// // 库存单位除以系数
|
|
// row.THISQTYUOM = row.THISQTYSTU / row.UOMSTUCOE_0;
|
|
// }
|
|
// if (property == "THISQTYUOM") {
|
|
// // 采购单位 乘 系数
|
|
// row.THISQTYSTU = row.THISQTYUOM * 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,
|
|
ITMDES2_0 : _this.form.ITMDES2_0
|
|
},
|
|
url: "/xwms/XWMSPOH/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/XWMSPOH/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.POHNUM_0));
|
|
return tmp.size > 1 ? true : false;
|
|
}
|
|
},
|
|
});
|
|
</script>
|