1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
| var vm = new Vue({
| el: '#app',
| data: function () {
| return {
| isLoading: false,
| userInfo: {
| "loginGuid": '',
| "loginAccount": '',
| },
| data: [],
| loading: false,
| finished: false,
| refreshing: false,
| current: 0,
| pageIndex: 0,
| limit: 20,
| totalPage: 0,
| totalCount: 0,
|
| checked: true,
| id: '',
| searchKeyword: '', // 搜索关键词
| originalData: [], // 保存原始数据
| }
| },
| mounted() {
| var that = this;
| this.userInfo = {
| loginGuid: this.GetLoginInfor().loginGuid,
| loginAccount: this.GetLoginInfor().loginAccount,
| };
| this.onLoad();
| },
| methods: {
|
| // 新增搜索处理方法
| handleSearch() {
| this.pageIndex = 0;
| this.data = [];
| this.finished = false;
| this.isSearching = true;
| this.onLoad();
| },
|
| onLoad() {
|
| if (this.refreshing) {
| this.data = [];
| this.refreshing = false;
| }
|
| let result = "未完成";
| if (this.current === 1) {
| result = "已完成";
| }
|
| this.pageIndex++;
|
| var that = this;
| that.AxiosHttp("post", 'LLJ/getPage', {
| pageIndex: that.pageIndex,
| limit: that.limit,
| createUser: that.userInfo.loginAccount,
| result: result,
| keyword: that.searchKeyword.trim(), // 新增搜索参数
| }, false)
| .then(function (res) {
| var json = res;
| if (json.status == 0) {
| //this.$notify({ type: 'success', message: json.data.tbBillList });
|
| if (that.pageIndex === 1) {
| // 如果是第一页,直接覆盖原数据
| that.data = json.data.tbBillList;
|
| } else {
|
| if (json.data.tbBillList.length > 0) {
| // 如果是下一页,追加新数据
| let thisData = that.data;
| that.data = [...thisData, ...json.data.tbBillList];
| }
|
| }
| that.totalCount = json.totalCount;
| that.totalPage = Math.ceil(that.totalCount / that.limit);
| that.loading = false;
|
| if (that.pageIndex >= that.totalPage) {
| that.finished = true;
| }
|
| }
| else {
| that.$toast.fail(json.message);
| }
| })
| .catch(function (error) {
| that.$toast.fail("网络错误,请重试!");
| console.log(error);
| });
| },
| onRefresh() {
| // 清空列表数据
| this.finished = false;
|
| // 重新加载数据
| // 将 loading 设置为 true,表示处于加载状态
| this.loading = true;
| this.pageIndex = 0;
| this.onLoad();
| },
|
| onClickTab(name, title) {
| this.current = name;
| this.pageIndex = 0;
| this.onLoad();
| }
| }
| })
|
|