Commit 7472809e by Jie Feng
parents 1a60b8da 38497800
.idea/*
*.iml
.project
......@@ -165,7 +165,7 @@
<div class="status" id="workStatus" >
工作状态:
<select @change="updateWOStatus">
<option v-for="(item,index) in woStates" :value='index'> {{item.text}}
<option v-for="(item) in woStates" :value='item.value'> {{item.text}}
</option>
</select>
</div>
......@@ -181,7 +181,7 @@
aria-controls="myTabDrop1-contents" aria-expanded="false" v-on:click="processed()">已完结</a>
</li>
</ul>
<div class="detail" id="numCount">1-10条,共{{message}}条数据</div>
<div class="detail" id="numCount">{{pageStart}}-{{pageEnd}}条,共{{count}}条数据</div>
<!-- 表格 -->
<table class="table" id="order-list">
......@@ -204,11 +204,11 @@
<th scope="row">{{wo.id}}</th>
<td>{{wo.urgentLevelDisplay}}</td>
<td>{{wo.woType}}</td>
<td>{{wo.woCreateUname}}</td>
<td>{{wo.woCreateName}}</td>
<td>{{wo.deptName}}</td>
<td>{{wo.statusDisplay}}</td>
<td>{{wo.woStartTime}}</td>
<td>12:00</td>
<td>{{wo.woFormattedStartTime}}</td>
<td>{{wo.remainTime}}</td>
<td><a href="#" v-on:click="woDetail(wo)">查看</a></td>
</tr>
</tbody>
......
jQuery(document).ready(function ($) {
var pageSize = 10
var prePageSize
// 工单列表逻辑
var orderList = new Vue({
el: '#order-list',
......@@ -16,7 +18,7 @@ jQuery(document).ready(function ($) {
})
function initLoadWO() {
var url = "/work/wo/list?page=1&limit=10";
var url = "/work/wo/list?page=1&limit=" + pageSize;
var data = JSON.stringify({
"woStatus": 0,
"woType": "revisit",
......@@ -31,15 +33,18 @@ jQuery(document).ready(function ($) {
success: function (res) {
console.log(res);
orderList.workOrders = res.data.list;
numCount.message = res.data.total;
// 计算页数
if (Math.round(res.data.total % res.data.size) == 0) {
pager.totalPage = Math.round(res.data.total / res.data.size);
numCount.count = res.data.total;
numCount.pageStart = 1;
var curItems;
if(res.data.size < pageSize){
curItems = res.data.size;
} else {
console.log(res.data.total / res.data.size);
pager.totalPage = Math.round(res.data.total / res.data.size) + 1;
curItems = pageSize;
}
numCount.pageEnd = curItems;
pager.curPage = 1;
// 计算页数
pager.totalPage = Math.ceil(res.data.total / pageSize);
}
});
}
......@@ -78,12 +83,11 @@ jQuery(document).ready(function ($) {
},
data: {
woStates: [
{value: 0, text: '空闲中'},
{value: 1, text: '下班'},
{value: 2, text: '挂起'},
{value: 1, text: '空闲中'},
{value: 2, text: '下班'},
{value: 3, text: '接待中'},
{value: 4, text: '会议中'},
{value: 5, text: '午饭中'}
{value: 5, text: '短暂离开'}
]
}
})
......@@ -93,15 +97,17 @@ jQuery(document).ready(function ($) {
var numCount = new Vue({
el: '#numCount',
data: {
message: "100"
count: "",
pageStart:"",
pageEnd:""
}
})
// 页面分页按钮逻辑
var pager = new Vue({
el: '#pager',
data: {
curPage: 1,
totalPage: 1
curPage: "",
totalPage: ""
},
methods: {
prePage: function () {
......@@ -110,6 +116,28 @@ jQuery(document).ready(function ($) {
} else {
this.curPage = this.curPage - 1;
}
var url = "/work/wo/list?page=" + this.curPage + "&limit=" + pageSize;
var data = JSON.stringify({
"woStatus": 0,
"woType": "revisit",
"woProcessUid": 1
});
$.ajax({
url: url,
dataType: "json",
data: data,
type: 'post',
contentType: "application/json; charset=utf-8",
success: function (res) {
console.log(res);
orderList.workOrders = res.data.list;
numCount.pageStart = numCount.pageStart - pageSize;
numCount.pageEnd = numCount.pageEnd - prePageSize;
prePageSize = res.data.size;
}
});
},
nextPage: function () {
if (this.curPage + 1 > this.totalPage) {
......@@ -117,12 +145,42 @@ jQuery(document).ready(function ($) {
} else {
this.curPage = this.curPage + 1;
}
var url = "/work/wo/list?page=" + this.curPage + "&limit=" + pageSize;
var data = JSON.stringify({
"woStatus": 0,
"woType": "revisit",
"woProcessUid": 1
});
$.ajax({
url: url,
dataType: "json",
data: data,
type: 'post',
contentType: "application/json; charset=utf-8",
success: function (res) {
console.log(res);
orderList.workOrders = res.data.list;
prePageSize = res.data.size;
numCount.pageStart = numCount.pageStart + pageSize;
var curItems;
if(res.data.size < pageSize){
curItems = res.data.size;
} else {
curItems = pageSize;
}
// 计算页数
numCount.pageEnd = numCount.pageEnd + curItems;
}
});
}
}
})
// 工单状态选择Tab逻辑
var url = "/work/wo/list?page=1&limit=10";
var url = "/work/wo/list?page=1&limit=" + pageSize;
var statusTab = new Vue({
el: '#statusTab',
methods: {
......@@ -143,13 +201,18 @@ jQuery(document).ready(function ($) {
success: function (res) {
console.log(res);
orderList.workOrders = res.data.list;
// 计算页数
if (res.data.total % res.data.size == 0) {
pager.totalPage = Math.round(res.data.total / res.data.size);
numCount.count = res.data.total;
numCount.pageStart = 1;
var curItems;
if(res.data.size < pageSize){
curItems = res.data.size;
} else {
console.log(res.data.total / res.data.size);
pager.totalPage = Math.round(res.data.total / res.data.size) + 1;
curItems = pageSize;
}
numCount.pageEnd = curItems;
pager.curPage = 1;
// 计算页数
pager.totalPage = Math.ceil(res.data.total / pageSize);
},
fail: function (msg) {
console.log("Error happened, Please contact Administrator. " + msg);
......@@ -174,13 +237,18 @@ jQuery(document).ready(function ($) {
success: function (res) {
console.log(res);
orderList.workOrders = res.data.list;
// 计算页数
if (Math.round(res.data.total % res.data.size) == 0) {
pager.totalPage = Math.round(res.data.total / res.data.size);
numCount.count = res.data.total;
numCount.pageStart = 1;
var curItems;
if(res.data.size < pageSize){
curItems = res.data.size;
} else {
console.log(res.data.total / res.data.size);
pager.totalPage = Math.round(res.data.total / res.data.size) + 1;
curItems = pageSize;
}
pager.curPage = 1;
numCount.pageEnd = curItems;
// 计算页数
pager.totalPage = Math.ceil(res.data.total / pageSize);
},
fail: function (msg) {
console.log(msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment