vue2-client 1.8.184-test → 1.8.185

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.184-test",
3
+ "version": "1.8.185",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -456,10 +456,10 @@ export default {
456
456
  this.getData({}, res => this.getDataCallback(res))
457
457
  } if (this.attr.keyName && this.attr.keyName.indexOf('search@') !== -1) {
458
458
  // `tool.getFullTree(this.getRights().where(row.getType()==$organization$))`
459
- this.getDataCallback(searchToOption({
460
- source: this.attr.keyName.substring(6),
459
+ searchToOption({
460
+ source: this.attr.keyName.substring(7),
461
461
  userid: this.currUser.id
462
- }))
462
+ }, res => this.getDataCallback(res))
463
463
  } else if (this.attr.keyName && this.attr.keyName.indexOf('config@') !== -1) {
464
464
  const configName = this.attr.keyName.substring(7)
465
465
  getConfigByName(configName, this.serviceName, res => {
@@ -1,13 +1,8 @@
1
1
  import { METHOD, request } from '@vue2-client/utils/request'
2
2
 
3
- export async function searchToOption (params) {
3
+ export async function searchToOption (params, callback) {
4
4
  return search(params).then(res => {
5
- return res.data.map(item => {
6
- return {
7
- label: item.name,
8
- value: item.id
9
- }
10
- })
5
+ callback(transformData(res[0]?.children[0]?.children || []))
11
6
  })
12
7
  }
13
8
 
@@ -15,4 +10,15 @@ export async function search (params) {
15
10
  return request('/rs/search', METHOD.POST, params)
16
11
  }
17
12
 
13
+ function transformData (inputData) {
14
+ function transform (node) {
15
+ return {
16
+ label: node.name,
17
+ value: node.id,
18
+ children: node.children ? node.children.map(transform) : []
19
+ }
20
+ }
21
+ return inputData.map(transform)
22
+ }
23
+
18
24
  export default { searchToOption, search }