vue2-client 1.20.37 → 1.20.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.20.37",
3
+ "version": "1.20.38",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -152,7 +152,7 @@ export default {
152
152
  }
153
153
  }
154
154
  </script>
155
- <style>
155
+ <style lang="less" scoped>
156
156
  .row {
157
157
  display: flex;
158
158
 
@@ -44,10 +44,9 @@
44
44
  </template>
45
45
  <a-descriptions v-else-if="realDataItem.title" :column="isMobile ? 1 : column" :title="realDataItem.title">
46
46
  <a-descriptions-item
47
- v-for="(item, index) in realDataItem.column"
47
+ v-for="(item, index) in visibleDescriptionFields(realDataItem.column)"
48
48
  :key="index"
49
49
  :span="item.span || 1"
50
- v-if="shouldShowField(item, data)"
51
50
  >
52
51
  <template #label>
53
52
  {{ item.key }}
@@ -122,10 +121,9 @@
122
121
  :title="tabMode === 'top' ? undefined : realData[activeTab].title"
123
122
  >
124
123
  <a-descriptions-item
125
- v-for="(fieldItem, fieldIndex) in realData[activeTab].column"
124
+ v-for="(fieldItem, fieldIndex) in visibleDescriptionFields(realData[activeTab].column)"
126
125
  :key="fieldIndex"
127
126
  :span="fieldItem.span || 1"
128
- v-if="shouldShowField(fieldItem, data)"
129
127
  >
130
128
  <template #label>
131
129
  {{ fieldItem.key }}
@@ -197,10 +195,9 @@
197
195
  </template>
198
196
  <a-descriptions v-else-if="realDataItem.title" :column="isMobile ? 1 : column" :title="realDataItem.title">
199
197
  <a-descriptions-item
200
- v-for="(item, index) in realDataItem.column"
198
+ v-for="(item, index) in visibleDescriptionFields(realDataItem.column)"
201
199
  :key="index"
202
200
  :span="item.span || 1"
203
- v-if="shouldShowField(item, data)"
204
201
  >
205
202
  <template #label>
206
203
  {{ item.key }}
@@ -499,6 +496,11 @@ export default {
499
496
  return true
500
497
  }
501
498
  },
499
+ /** 供模板循环使用,避免在同一元素上混用 v-for 与 v-if */
500
+ visibleDescriptionFields(column) {
501
+ if (!column?.length) return []
502
+ return column.filter(item => this.shouldShowField(item, this.data))
503
+ },
502
504
  // 获取字段样式
503
505
  getFieldStyle(field, data) {
504
506
  if (!field.styleFunc) return {}
@@ -11,6 +11,7 @@
11
11
  :closable="false"
12
12
  :visible="userInfoDetailVisible"
13
13
  @close="onClose">
14
+ <a-spin :spinning="detailLoading" tip="加载中..." style="min-height: 200px; display: block;">
14
15
  <a-page-header v-if="userInfoDetailVisible && userInfo" :title="`用户编号:${ userInfo ? userInfo.f_userinfo_code : '' }`">
15
16
  <x-descriptions
16
17
  :title="null"
@@ -33,6 +34,7 @@
33
34
  <a-button type="dashed" @click="refresh">刷新</a-button>
34
35
  </template>
35
36
  </a-page-header>
37
+ </a-spin>
36
38
  </a-drawer>
37
39
  <!-- 阀控管理弹框 -->
38
40
  <a-modal
@@ -136,6 +138,7 @@ export default {
136
138
  selectedOption: '手动',
137
139
  operateReason: '',
138
140
  operateReasonError: false,
141
+ detailLoading: false
139
142
  }
140
143
  },
141
144
  watch: {
@@ -158,10 +161,20 @@ export default {
158
161
  this.operateReasonError = false
159
162
  }
160
163
  },
161
- refresh () {
162
- return runLogic('getUserInfoDetailV4', this.userInfo, 'af-revenue').then(res => {
164
+ async fetchUserDetail () {
165
+ if (!this.userInfo) return
166
+ this.detailLoading = true
167
+ try {
168
+ const res = await runLogic('getUserInfoDetailV4', this.userInfo, 'af-revenue')
163
169
  this.userInfo = res
164
- })
170
+ } catch (e) {
171
+ this.$message.error(e.message || '加载用户详情失败')
172
+ } finally {
173
+ this.detailLoading = false
174
+ }
175
+ },
176
+ refresh () {
177
+ return this.fetchUserDetail()
165
178
  },
166
179
  openUser () {
167
180
  this.$confirm({
@@ -193,9 +206,9 @@ export default {
193
206
  },
194
207
  async init (user) {
195
208
  this.userInfo = user
196
- await this.refresh()
197
- this.userInfoDetailVisible = true
198
209
  this.operateReasonError = false
210
+ this.userInfoDetailVisible = true
211
+ await this.fetchUserDetail()
199
212
  },
200
213
  onClose () {
201
214
  this.userInfoDetailVisible = false