vue2-client 1.14.14 → 1.14.16

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.14.14",
3
+ "version": "1.14.16",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -243,10 +243,44 @@ export default {
243
243
  isWidget: this.widget,
244
244
  currUser: this.currUser,
245
245
  getGlobalData: this.getGlobalData,
246
- setGlobalData: this.setGlobalData
246
+ setGlobalData: this.setGlobalData,
247
+ findComponentByName: this.findComponentByName
247
248
  }
248
249
  },
249
250
  methods: {
251
+ findComponentByName (instance, componentName, maxDepth, findType) {
252
+ // 基础判断:如果实例不存在或者已经超过最大深度,返回null
253
+ if (!instance || maxDepth <= 0) {
254
+ return null
255
+ }
256
+
257
+ // 检查当前实例是否有目标组件
258
+ try {
259
+ if (instance.getComponentByName && instance.getComponentByName(componentName)) {
260
+ return instance.getComponentByName(componentName)
261
+ }
262
+ } catch (e) {
263
+ console.warn('查找组件时发生错误:', e)
264
+ }
265
+
266
+ // 递归查找子组件
267
+ if (findType === 'parent') {
268
+ // 向上查找父组件
269
+ if (instance.$parent) {
270
+ return this.findComponentByName(instance.$parent, componentName, maxDepth - 1, findType)
271
+ }
272
+ } else {
273
+ if (instance.$children && instance.$children.length) {
274
+ for (const child of instance.$children) {
275
+ const result = this.findComponentByName(child, componentName, maxDepth - 1, findType)
276
+ if (result) {
277
+ return result
278
+ }
279
+ }
280
+ }
281
+ }
282
+ return null
283
+ },
250
284
  listClick (data) {
251
285
  this.$emit('listClick', data)
252
286
  },
@@ -212,7 +212,7 @@ export default {
212
212
  }
213
213
  }
214
214
  },
215
- inject: ['openDialog', 'emitEvent', 'registerComponent', 'setColSpanByName', 'setGlobalData', 'getGlobalData', 'getComponentByName', 'runLogic', 'getMixinData', 'getSelectedId', 'isInAModal', 'getConfigByName', 'getSelectedData', 'getOutEnv', 'currUser', 'isWidget'],
215
+ inject: ['openDialog', 'emitEvent', 'registerComponent', 'setColSpanByName', 'setGlobalData', 'getGlobalData', 'getComponentByName', 'runLogic', 'getMixinData', 'getSelectedId', 'isInAModal', 'getConfigByName', 'getSelectedData', 'getOutEnv', 'currUser', 'isWidget', 'findComponentByName'],
216
216
  methods: {
217
217
  getWindow,
218
218
  isMicroAppEnv,
@@ -38,6 +38,10 @@ export default {
38
38
  queryParamsName: {
39
39
  type: Object,
40
40
  default: null
41
+ },
42
+ fixedQueryForm: {
43
+ type: Object,
44
+ default: { condition: '1=1' }
41
45
  }
42
46
  },
43
47
  inject: ['getComponentByName'],
@@ -51,17 +55,17 @@ export default {
51
55
  }
52
56
  },
53
57
  created () {
54
- this.getData(this.queryParamsName)
58
+ this.getData(this.queryParamsName, this.fixedQueryForm)
55
59
  },
56
60
  methods: {
57
- async getData (config) {
61
+ async getData (config, param) {
58
62
  const that = this
59
63
  getConfigByName(config, 'af-his', res => {
60
64
  that.button = res.button
61
65
  that.icon = res.icon
62
66
  that.buttonNames = res.buttonNames || []
63
67
  that.buttonMode = res.buttonMode || false
64
- runLogic(res.data, {}, 'af-his').then(ress => {
68
+ runLogic(res.data, param, 'af-his').then(ress => {
65
69
  that.data = ress
66
70
  })
67
71
  })
@@ -69,8 +73,8 @@ export default {
69
73
  handleClick (index) {
70
74
  this.$emit('listClick', this.data[index])
71
75
  },
72
- refreshList () {
73
- this.getData(this.queryParamsName)
76
+ refreshList (param) {
77
+ this.getData(this.queryParamsName, param)
74
78
  },
75
79
  click (index, buttonIndex) {
76
80
  this.$emit('click', { data: this.data[index], name: this.buttonNames[buttonIndex] })
@@ -85,6 +89,11 @@ export default {
85
89
  this.data = res.data
86
90
  })
87
91
  }
92
+ },
93
+ watch: {
94
+ 'fixedQueryForm' (val) {
95
+ this.refreshList(val)
96
+ }
88
97
  }
89
98
  }
90
99
  </script>