vue2-client 1.8.274 → 1.8.276

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.274",
3
+ "version": "1.8.276",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -40,6 +40,7 @@
40
40
  "lodash.debounce": "^4",
41
41
  "mockjs": "^1.1.0",
42
42
  "nprogress": "^0.2.0",
43
+ "qs": "^6.11.2",
43
44
  "regenerator-runtime": "^0.14.0",
44
45
  "videojs-contrib-hls": "^5.15.0",
45
46
  "viser-vue": "^2.4.8",
@@ -459,7 +459,7 @@ import moment from 'moment'
459
459
  import util from '.././../../../utils/util'
460
460
  import XTreeSelect from '@vue2-client/base-client/components/common/XForm/XTreeSelect'
461
461
  import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
462
- import { searchToOption } from '@vue2-client/services/v3Api'
462
+ import { searchToListOption, searchToOption } from '@vue2-client/services/v3Api'
463
463
  import { mapState } from 'vuex'
464
464
  import executeStrFunction from '@vue2-client/utils/runEvalFunction'
465
465
 
@@ -721,10 +721,18 @@ export default {
721
721
  }
722
722
  if (this.attr.keyName && this.attr.keyName.indexOf('search@') !== -1) {
723
723
  // `tool.getFullTree(this.getRights().where(row.getType()==$organization$))`
724
- searchToOption({
725
- source: this.attr.keyName.substring(7),
726
- userid: this.currUser.id
727
- }, res => this.getDataCallback(res))
724
+ if (this.attr.type === 'select' || this.attr.type === 'checkbox') {
725
+ // 仅获取最内层数据
726
+ searchToListOption({
727
+ source: this.attr.keyName.substring(7),
728
+ userid: this.currUser.id
729
+ }, res => this.getDataCallback(res))
730
+ } else {
731
+ searchToOption({
732
+ source: this.attr.keyName.substring(7),
733
+ userid: this.currUser.id
734
+ }, res => this.getDataCallback(res))
735
+ }
728
736
  } else if (this.attr.keyName && this.attr.keyName.indexOf('config@') !== -1) {
729
737
  const configName = this.attr.keyName.substring(7)
730
738
  getConfigByName(configName, this.serviceName, res => {
@@ -20,6 +20,25 @@ export async function searchToOption (params, callback) {
20
20
  })
21
21
  }
22
22
 
23
+ export async function searchToListOption (params, callback) {
24
+ return search(params).then(res => {
25
+ const leafNodes = getLeafNodes(res)
26
+ callback(transformData(leafNodes))
27
+ })
28
+ }
29
+
30
+ function getLeafNodes (nodes) {
31
+ let leaves = []
32
+ nodes.forEach(node => {
33
+ if (node.children && node.children.length) {
34
+ leaves = leaves.concat(getLeafNodes(node.children))
35
+ } else {
36
+ leaves.push(node)
37
+ }
38
+ })
39
+ return leaves
40
+ }
41
+
23
42
  export async function search (params) {
24
43
  return request('/rs/search', METHOD.POST, params)
25
44
  }