vue2-client 1.8.230 → 1.8.231

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.8.230",
3
+ "version": "1.8.231",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <a-row id="XDescriptionGroup" :gutter="24">
3
3
  <a-col :span="4" v-if="showLeftTab && realData.length">
4
- <a-tabs tab-position="left" @change="scrollToGroup">
4
+ <a-tabs tab-position="left" v-model="activeTab" @change="scrollToGroup">
5
5
  <template v-for="(item,index) in realData">
6
6
  <a-tab-pane
7
7
  :tab="item.title"
@@ -11,7 +11,7 @@
11
11
  </template>
12
12
  </a-tabs>
13
13
  </a-col>
14
- <a-col :span="showLeftTab ? 20 : 24" class="descriptionsGroupContext">
14
+ <a-col :span="showLeftTab ? 20 : 24" ref="descriptionsGroupContext" class="descriptionsGroupContext">
15
15
  <div
16
16
  class="descriptions-item"
17
17
  :ref="`descriptions-item-${index}`"
@@ -126,6 +126,14 @@ export default {
126
126
  default: false
127
127
  }
128
128
  },
129
+ mounted () {
130
+ },
131
+ beforeDestroy () {
132
+ const formGroupContext = this.$refs.formGroupContext?.$el
133
+ if (formGroupContext && formGroupContext.removeEventListener) {
134
+ formGroupContext.removeEventListener('scroll', this.onScroll)
135
+ }
136
+ },
129
137
  created () {
130
138
  this.initConfig()
131
139
  },
@@ -136,7 +144,8 @@ export default {
136
144
  loadError: false,
137
145
  realData: [],
138
146
  // 获取到的配置组
139
- groups: {}
147
+ groups: {},
148
+ activeTab: 0
140
149
  }
141
150
  },
142
151
  computed: {
@@ -147,6 +156,12 @@ export default {
147
156
  this.loading = true
148
157
  if (this.configName) {
149
158
  this.getConfig()
159
+ this.$nextTick(() => {
160
+ const formGroupContext = this.$refs.descriptionsGroupContext?.$el
161
+ if (formGroupContext && formGroupContext.addEventListener) {
162
+ formGroupContext.addEventListener('scroll', this.onScroll)
163
+ }
164
+ })
150
165
  } else {
151
166
  this.loading = false
152
167
  this.loadError = true
@@ -209,7 +224,6 @@ export default {
209
224
  }
210
225
  }
211
226
  }).filter((item) => item)
212
- console.log(this.realData)
213
227
  } else {
214
228
  this.loading = false
215
229
  this.loadError = true
@@ -226,6 +240,22 @@ export default {
226
240
  } else {
227
241
  return this.data[key] || ''
228
242
  }
243
+ },
244
+ onScroll () {
245
+ const formGroupContext = this.$refs.descriptionsGroupContext.$el
246
+ let groupItems = []
247
+ if (formGroupContext && formGroupContext.querySelectorAll) {
248
+ groupItems = formGroupContext.querySelectorAll('.descriptions-item')
249
+ }
250
+ let activeIndex = this.activeTab
251
+
252
+ groupItems.forEach((item, index) => {
253
+ const rect = item.getBoundingClientRect()
254
+ if (rect.top <= 205 && rect.bottom > 200) {
255
+ activeIndex = index
256
+ }
257
+ })
258
+ this.activeTab = activeIndex
229
259
  }
230
260
  },
231
261
  watch: {
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div :class="groups.length ? 'XFormGroupClass' : ''">
3
3
  <a-empty v-if="loadingErr" description="配置走丢了"/>
4
- <a-spin v-else tip="正在努力加载。。。" :spinning="spinning" wrapperClassName="heigth100">
5
- <a-row :gutter="24" style="height:100%">
4
+ <a-spin v-else tip="正在努力加载..." :spinning="spinning" wrapperClassName="heigth100">
5
+ <a-row :gutter="24" style="height: 100%">
6
6
  <a-col :span="3" v-if="showLeftTab && groups.length">
7
- <a-tabs tab-position="left" @change="scrollToGroup">
8
- <template v-for="(item,index) in groups">
7
+ <a-tabs tab-position="left" v-model="activeTab" @change="scrollToGroup">
8
+ <template v-for="(item, index) in groups">
9
9
  <a-tab-pane
10
10
  :tab="item.describe"
11
11
  :key="index"
@@ -14,9 +14,9 @@
14
14
  </template>
15
15
  </a-tabs>
16
16
  </a-col>
17
- <a-col :span="showLeftTab ? 21 : 24" class="formGroupContext">
17
+ <a-col :span="showLeftTab ? 21 : 24" class="formGroupContext" ref="formGroupContext">
18
18
  <div class="group-item" :ref="`group-${index}`" :key="index" v-for="(item, index) in groups">
19
- <a-row :style="{marginTop: index === 0 ? '':'8px'}">
19
+ <a-row :style="{ marginTop: index === 0 ? '' : '8px' }">
20
20
  <a-col :span="5">
21
21
  <span class="xFormGroupTitle">{{ item.describe }}</span>
22
22
  </a-col>
@@ -57,14 +57,18 @@ export default {
57
57
  businessType: {},
58
58
  env: 'prod',
59
59
  spinning: true,
60
- loadingErr: false
60
+ loadingErr: false,
61
+ activeTab: 0
61
62
  }
62
63
  },
63
64
  mounted () {
64
65
  },
65
- props: {},
66
- watch: {},
67
- computed: {},
66
+ beforeDestroy () {
67
+ const formGroupContext = this.$refs.formGroupContext?.$el
68
+ if (formGroupContext && formGroupContext.removeEventListener) {
69
+ formGroupContext.removeEventListener('scroll', this.onScroll)
70
+ }
71
+ },
68
72
  methods: {
69
73
  setRef (refName, refValue) {
70
74
  if (!this.$refs[refName]) {
@@ -81,15 +85,21 @@ export default {
81
85
  * @param businessType 新增还是修改
82
86
  */
83
87
  init ({
84
- groups,
85
- modifyModelData = {},
86
- serviceName = process.env.VUE_APP_SYSTEM_NAME,
87
- env = 'prod',
88
- showLeftTab = false,
89
- businessType = '新增'
90
- }) {
88
+ groups,
89
+ modifyModelData = {},
90
+ serviceName = process.env.VUE_APP_SYSTEM_NAME,
91
+ env = 'prod',
92
+ showLeftTab = false,
93
+ businessType = '新增'
94
+ }) {
91
95
  Object.assign(this, { groups, modifyModelData, serviceName, env, showLeftTab, businessType })
92
96
  this.initView()
97
+ this.$nextTick(() => {
98
+ const formGroupContext = this.$refs.formGroupContext?.$el
99
+ if (formGroupContext && formGroupContext.addEventListener) {
100
+ formGroupContext.addEventListener('scroll', this.onScroll)
101
+ }
102
+ })
93
103
  },
94
104
  // 初始化组件
95
105
  initView () {
@@ -151,9 +161,6 @@ export default {
151
161
  groupElement.scrollIntoView({ behavior: 'smooth' })
152
162
  }
153
163
  },
154
- onClose () {
155
- this.$emit('update:visible', false)
156
- },
157
164
  // xfromitem 一路传递上来的事件
158
165
  emitFunc (func, data) {
159
166
  this.$emit('x-form-item-emit-func', func, data)
@@ -189,6 +196,22 @@ export default {
189
196
  } catch (error) {
190
197
  return Promise.reject(new Error('An unexpected error occurred'))
191
198
  }
199
+ },
200
+ onScroll () {
201
+ const formGroupContext = this.$refs.formGroupContext.$el
202
+ let groupItems = []
203
+ if (formGroupContext && formGroupContext.querySelectorAll) {
204
+ groupItems = formGroupContext.querySelectorAll('.group-item')
205
+ }
206
+ let activeIndex = this.activeTab
207
+
208
+ groupItems.forEach((item, index) => {
209
+ const rect = item.getBoundingClientRect()
210
+ if (rect.top <= 205 && rect.bottom > 200) {
211
+ activeIndex = index
212
+ }
213
+ })
214
+ this.activeTab = activeIndex
192
215
  }
193
216
  }
194
217
  }