wl-design-mobile 0.7.5 → 0.7.7

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.
@@ -27,9 +27,11 @@
27
27
  <div class="cell-group-div">
28
28
  <van-cell-group>
29
29
  <van-search v-model="searchField" placeholder="请输入筛选名称" clearable @input="search"/>
30
- <van-cell v-for="(c, index) in searchData" :key="index" :title="`${c.V}`" clickable @click="radioClick(c)">
30
+ <van-cell v-for="(c, index) in searchData" :key="index" :title="`${c.V}`" clickable @click.stop="radioClick(c)">
31
31
  <template #right-icon>
32
- <van-radio :name="c.K" checked-color="#0070D2"/>
32
+ <div style="pointer-events: none;">
33
+ <van-radio :name="c.K" checked-color="#0070D2"/>
34
+ </div>
33
35
  </template>
34
36
  </van-cell>
35
37
  </van-cell-group>
@@ -123,12 +125,12 @@ export default {
123
125
  this.showBottom = false
124
126
  },
125
127
  onConfirm() {
126
- if (this.selectItem && this.selectItem.K) {
128
+ if (this.selectItem && this.selectItem.K && this.selectItem.K !== '') {
127
129
  this.val = this.selectItem.K
128
130
  this.valName = this.selectItem.V
129
131
  this.$emit('on-ok', this.selectItem)
130
132
  } else {
131
- console.error('lambo-select -- 条件选择失败,this.selectItem:', this.selectItem)
133
+ console.log('lambo-select -- 用户取消选择或未选择,清空值')
132
134
  this.val = ''
133
135
  this.valName = ''
134
136
  this.$emit('on-ok', {K: '', V: ''})
@@ -136,7 +138,10 @@ export default {
136
138
  this.showBottom = false
137
139
  },
138
140
  radioClick(data) {
139
- if (data && data.K) {
141
+ if (this.selectItem.K === data.K) {
142
+ this.selectItem.K = ''
143
+ this.selectItem.V = ''
144
+ } else {
140
145
  this.selectItem.K = data.K
141
146
  this.selectItem.V = data.V
142
147
  }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wl-design-mobile",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",