条件查询,前端分页

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 -15
View File
@@ -23,11 +23,39 @@
}
</style>
<el-row id="XWMSSOH">
<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.materialcode" 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.cust" 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>
@@ -49,6 +77,15 @@
<el-table-column label="发货地址" width="100" align="center" prop="BPAADD_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>
@@ -56,25 +93,42 @@
el: "#XWMSSOH",
data() {
return {
billTable: [],
form: {
address: '',
billno: '',
cust: '',
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/XWMSSOH/Search",
success: function (json) {
app.billTable = json.Data;
},
error: function (json) {
alert("加载失败");
}
});
// $.ajax({
// type: "post",
// dataType: "json",
// data: {},
// url: "/xwms/XWMSSOH/Search",
// success: function (json) {
// app.tableData = json.Data;
// },
// error: function (json) {
// alert("加载失败");
// }
// });
},
computed: {
foodLabel() {
@@ -99,6 +153,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,
cust: _this.form.cust,
materialcode: _this.form.materialcode
},
url: "/xwms/XWMSSOH/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/XWMSSOH/Create",
success: function (json) {
if (json.Code == 200) {
_this.$message({
message: "创建成功!"
});
_this.$refs.multipleTable.clearSelection();
}
},
error: function (json) {
alert("加载失败");
}
});
}
},
});