wl-design-mobile 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/list/lambo-list.vue
CHANGED
|
@@ -62,7 +62,8 @@ export default {
|
|
|
62
62
|
limit: 10,
|
|
63
63
|
list: [],
|
|
64
64
|
error:false,
|
|
65
|
-
errorText:''
|
|
65
|
+
errorText:'',
|
|
66
|
+
currentRequestId: 0 // 当前请求标识符
|
|
66
67
|
};
|
|
67
68
|
},
|
|
68
69
|
mounted() {
|
|
@@ -73,16 +74,17 @@ export default {
|
|
|
73
74
|
handler: function (val, oldVal) {
|
|
74
75
|
console.log("searchParams -- val,oldVal:", {val, oldVal})
|
|
75
76
|
console.log("searchParams -- val===oldVal:", val === oldVal)
|
|
76
|
-
|
|
77
|
+
//查询时重置页码和请求标识符
|
|
77
78
|
this.pageNum = 1
|
|
78
79
|
this.offset = 0
|
|
79
80
|
this.limit = 10
|
|
80
81
|
this.list = []
|
|
82
|
+
this.currentRequestId = 0 // 重置请求标识符
|
|
81
83
|
|
|
82
84
|
this.onLoad()
|
|
83
85
|
},
|
|
84
86
|
deep: true
|
|
85
|
-
}
|
|
87
|
+
},
|
|
86
88
|
},
|
|
87
89
|
methods: {
|
|
88
90
|
onLoad() {
|
|
@@ -91,9 +93,14 @@ export default {
|
|
|
91
93
|
this.refreshing = false;
|
|
92
94
|
}
|
|
93
95
|
this.loading = true
|
|
96
|
+
const requestId = ++this.currentRequestId;
|
|
94
97
|
if (this.testMode === true) {
|
|
95
98
|
console.log("lambo-list -- onLoad -- loadData:", this.pageNum)
|
|
96
99
|
setTimeout(() => {
|
|
100
|
+
// 检查是否是最新的请求
|
|
101
|
+
if (requestId !== this.currentRequestId) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
97
104
|
console.log('this.searchParams',this.searchParams)
|
|
98
105
|
let arr = [
|
|
99
106
|
{title: "XX市XXXX酒业商行", time: "2024-01-01", person:"01", dpt: "储配部", note: "XX工作"},
|
|
@@ -112,16 +119,22 @@ export default {
|
|
|
112
119
|
this.loading = false
|
|
113
120
|
this.offset = this.pageNum * 10
|
|
114
121
|
this.pageNum++;
|
|
122
|
+
// 手动触发list-change事件
|
|
123
|
+
this.$emit('list-change', this.list);
|
|
115
124
|
}, 1000); // 暂停1秒
|
|
116
125
|
|
|
117
126
|
}else{
|
|
118
127
|
let params = {offset: this.offset, limit: this.limit, ...this.searchParams}
|
|
119
128
|
axios.get(this.url, {params}).then(res => {
|
|
129
|
+
// 检查是否是最新的请求
|
|
130
|
+
if (requestId !== this.currentRequestId) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
120
133
|
console.log("lambo-list -- onLoad -- loadData:", res)
|
|
121
134
|
if (res && res.code === 1) {
|
|
122
135
|
let pageData = res.data
|
|
123
|
-
|
|
124
136
|
if (pageData && pageData.rows.length > 0) {
|
|
137
|
+
|
|
125
138
|
for (let item of pageData.rows) {
|
|
126
139
|
if (this.list.length < pageData.total) {
|
|
127
140
|
this.list.push(item)
|
|
@@ -133,8 +146,12 @@ export default {
|
|
|
133
146
|
this.offset = this.pageNum * 10
|
|
134
147
|
this.pageNum++;
|
|
135
148
|
this.finishedTxt = "没有更多了"
|
|
149
|
+
// 手动触发list-change事件
|
|
150
|
+
this.$emit('list-change', this.list);
|
|
136
151
|
} else {
|
|
137
152
|
this.finished = true; // 数据加载完毕
|
|
153
|
+
// 手动触发list-change事件
|
|
154
|
+
this.$emit('list-change', this.list);
|
|
138
155
|
}
|
|
139
156
|
|
|
140
157
|
} else {
|
|
@@ -145,6 +162,10 @@ export default {
|
|
|
145
162
|
}
|
|
146
163
|
this.loading = false; // 加载状态结束
|
|
147
164
|
}).catch(err => {
|
|
165
|
+
// 检查是否是最新的请求
|
|
166
|
+
if (requestId !== this.currentRequestId) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
148
169
|
console.error("lambo-init-list -- onLoad -- 查询[" + this.title + "]异常:", err)
|
|
149
170
|
Toast.fail("查询[" + this.url + "]数据异常")
|
|
150
171
|
this.error = true;
|
|
@@ -164,6 +185,7 @@ export default {
|
|
|
164
185
|
this.pageNum = 1
|
|
165
186
|
this.offset = 0
|
|
166
187
|
this.limit = 10
|
|
188
|
+
this.currentRequestId = 0 // 重置请求标识符
|
|
167
189
|
|
|
168
190
|
this.loading = true
|
|
169
191
|
this.onLoad()
|
package/package.json
CHANGED
package/table/lambo-ag-table.vue
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
<script>
|
|
37
37
|
import 'ag-grid-community/styles/ag-grid.css'
|
|
38
38
|
import 'ag-grid-community/styles/ag-theme-balham.css'
|
|
39
|
+
|
|
39
40
|
/**
|
|
40
41
|
* 打包时候把这一行放开,下面的一行注释掉
|
|
41
42
|
*
|
|
@@ -45,6 +46,8 @@ import {AgGridVue} from 'ag-grid-vue/lib/main.cjs.js'
|
|
|
45
46
|
* 本地运行的时候,把这一行放开,上面的一行注释掉
|
|
46
47
|
* import {AgGridVue} from 'ag-grid-vue'
|
|
47
48
|
*/
|
|
49
|
+
|
|
50
|
+
|
|
48
51
|
import {Toast} from "vant"
|
|
49
52
|
import {axios} from "../util/axios"
|
|
50
53
|
|