条件查询,前端分页

This commit is contained in:
zgf committed 2023-12-22 13:22:47 +08:00
1 parent 75c580115c
commit 720cf26a59
10 files changed
+648 -81

No files matched your search

+123 -16
View File
@@ -23,11 +23,38 @@
}
</style>
<el-row id="XWMSSHIP">
<el-table :data="billTable" height="750" stripe border
<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-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"
@@cell-mouse-enter="handleCellEnter"
@@cell-mouse-leave="handleCellLeave">
@@cell-mouse-leave="handleCellLeave"
@@selection-change="handleSelectionChange">
<el-table-column type="selection"
width="55">
</el-table-column>
@@ -37,7 +64,7 @@
<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="100" align="center" prop="ITMREF_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="YITMDES4_0" show-overflow-tooltip></el-table-column>
@@ -51,6 +78,15 @@
<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]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.length">
</el-pagination>
</el-row>
<script>
@@ -58,25 +94,42 @@
el: "#XWMSSHIP",
data() {
return {
billTable: [],
form: {
address: '',
billno: '',
sbill: '',
materialcode: ''
},
addressList: [{
value: 'QCT',
label: 'QCT'
}, {
value: 'SBD',
label: 'SBD'
}],
tableData: [],
currentPage: 1, // 当前页码
total: 20, // 总条数
pageSize: 20, // 每页的数据条数
multipleSelection: [],
// 需要编辑的属性
editProp: ['POHFCY_0']
};
},
mounted: function () {
// 获取所有单据编码
$.ajax({
type: "post",
dataType: "json",
data: {},
url: "/xwms/XWMSSHIP/Search",
success: function (json) {
app.billTable = json.Data;
},
error: function (json) {
alert("加载失败");
}
});
// $.ajax({
// type: "post",
// dataType: "json",
// data: {},
// url: "/xwms/XWMSSHIP/Search",
// success: function (json) {
// app.tableData = json.Data;
// },
// error: function (json) {
// alert("加载失败");
// }
// });
},
computed: {
foodLabel() {
@@ -101,6 +154,60 @@
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;
},
search() {
var _this = this;
$.ajax({
type: "post",
dataType: "json",
data: {
address: _this.form.address,
billno: _this.form.billno,
sbill: _this.form.sbill,
materialcode: _this.form.materialcode
},
url: "/xwms/XWMSSHIP/Search",
success: function (json) {
app.tableData = json.Data;
},
error: function (json) {
alert("加载失败");
}
});
},
create() {
var _this = this;
$.ajax({
type: "post",
dataType: "json",
data: {
data: _this.multipleSelection
},
url: "/xwms/XWMSSHIP/Create",
success: function (json) {
if (json.Code == 200) {
_this.$message({
message: "创建成功!"
});
_this.$refs.multipleTable.clearSelection();
}
},
error: function (json) {
alert("加载失败");
}
});
}
},
});