@truenewx/tnxvue3 3.4.0 → 3.4.1

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.
Files changed (55) hide show
  1. package/eslint.config.cjs +58 -0
  2. package/index.html +12 -12
  3. package/package.json +16 -40
  4. package/src/aj-captcha/Verify/VerifySlide.vue +9 -9
  5. package/src/aj-captcha/api/index.js +2 -10
  6. package/src/aj-captcha/utils/ase.js +1 -1
  7. package/src/bootstrap-vue/alert/Alert.vue +79 -79
  8. package/src/bootstrap-vue/button/Button.vue +40 -40
  9. package/src/bootstrap-vue/enum-select/EnumSelect.vue +4 -5
  10. package/src/bootstrap-vue/form/Form.vue +320 -320
  11. package/src/bootstrap-vue/form/FormGroup.vue +73 -73
  12. package/src/bootstrap-vue/loading-icon/LoadingIcon.vue +46 -46
  13. package/src/bootstrap-vue/paged/Paged.vue +119 -119
  14. package/src/bootstrap-vue/progress/Progress.vue +58 -58
  15. package/src/bootstrap-vue/query-table/QueryTable.vue +84 -84
  16. package/src/bootstrap-vue/region-cascader/RegionCascader.vue +119 -119
  17. package/src/bootstrap-vue/select/Select.vue +375 -375
  18. package/src/bootstrap-vue/submit-form/SubmitForm.vue +180 -176
  19. package/src/bootstrap-vue/tags-input/TagsInput.vue +64 -64
  20. package/src/bootstrap-vue/tnxbsv.css +107 -107
  21. package/src/bootstrap-vue/tnxbsv.js +109 -92
  22. package/src/bootstrap-vue/upload/Upload.vue +173 -173
  23. package/src/element-plus/avatar/Avatar.vue +8 -9
  24. package/src/element-plus/button/Button.vue +2 -2
  25. package/src/element-plus/curd/Curd.vue +20 -23
  26. package/src/element-plus/date-picker/DatePicker.vue +1 -1
  27. package/src/element-plus/detail-form/DetailForm.vue +1 -1
  28. package/src/element-plus/dialog/Dialog.vue +18 -20
  29. package/src/element-plus/drawer/Drawer.vue +10 -9
  30. package/src/element-plus/edit-table/EditTable.vue +3 -3
  31. package/src/element-plus/enum-select/EnumSelect.vue +3 -3
  32. package/src/element-plus/enum-view/EnumView.vue +41 -41
  33. package/src/element-plus/fetch-cascader/FetchCascader.vue +3 -4
  34. package/src/element-plus/fetch-select/FetchSelect.vue +10 -11
  35. package/src/element-plus/fetch-tags/FetchTags.vue +4 -5
  36. package/src/element-plus/fss-upload/FssUpload.vue +18 -18
  37. package/src/element-plus/fss-view/FssView.vue +1 -1
  38. package/src/element-plus/icon/Icon.vue +6 -0
  39. package/src/element-plus/input-dropdown/InputDropdown.vue +74 -74
  40. package/src/element-plus/query-form/QueryForm.vue +1 -1
  41. package/src/element-plus/query-table/QueryTable.vue +22 -26
  42. package/src/element-plus/region-cascader/RegionCascader.vue +4 -5
  43. package/src/element-plus/select/Select.vue +2 -2
  44. package/src/element-plus/steps-nav/StepsNav.vue +3 -4
  45. package/src/element-plus/submit-form/SubmitForm.vue +36 -39
  46. package/src/element-plus/tabs/Tabs.vue +1 -1
  47. package/src/element-plus/tnxel.css +22 -0
  48. package/src/element-plus/tnxel.js +101 -93
  49. package/src/element-plus/toolbar/ToolBarItem.js +15 -15
  50. package/src/element-plus/toolbar/Toolbar.vue +56 -56
  51. package/src/element-plus/transfer/Transfer.vue +8 -9
  52. package/src/element-plus/upload/Upload.vue +24 -24
  53. package/src/tnxvue-router.js +4 -4
  54. package/src/tnxvue-validator.js +8 -2
  55. package/src/tnxvue.js +13 -26
@@ -100,11 +100,10 @@ export default {
100
100
  mounted() {
101
101
  this.initRules();
102
102
 
103
- let vm = this;
104
- this.$nextTick(function () {
105
- let container = $(vm.container);
103
+ this.$nextTick(() => {
104
+ let container = $(this.container);
106
105
  if (container.length) {
107
- vm.topOffset = $('#' + vm.id).offset().top - container.offset().top - 16;
106
+ this.topOffset = $('#' + this.id).offset().top - container.offset().top - 16;
108
107
  }
109
108
  });
110
109
  },
@@ -112,18 +111,17 @@ export default {
112
111
  initRules() {
113
112
  if (this.rules) {
114
113
  if (typeof this.rules === 'string') {
115
- const vm = this;
116
- window.tnx.app.rpc.getMeta(this.rules, meta => {
117
- if (vm.rulesLoaded) {
118
- vm.rulesLoaded(meta.$rules);
114
+ window.tnx.app.rpc.getMeta(this.rules, this.rulesApp).then(meta => {
115
+ if (this.rulesLoaded) {
116
+ this.rulesLoaded(meta.$rules);
119
117
  } else {
120
- vm.$emit('rules-loaded', meta.$rules);
118
+ this.$emit('rules-loaded', meta.$rules);
121
119
  }
122
- vm.validationRules = meta.$rules;
120
+ this.validationRules = meta.$rules;
123
121
  delete meta.$rules;
124
122
  this.$emit('meta', meta);
125
- vm.fieldNames = Object.keys(meta);
126
- }, this.rulesApp);
123
+ this.fieldNames = Object.keys(meta);
124
+ });
127
125
  } else {
128
126
  this.validationRules = {};
129
127
  Object.keys(this.rules).forEach(fieldName => {
@@ -166,28 +164,29 @@ export default {
166
164
  this.$refs.form.scrollToField(fieldName);
167
165
  }
168
166
  },
169
- validate(callback, errorFocus) {
170
- let _this = this;
171
- this.$refs.form.validate().then(function () {
172
- if (typeof callback === 'function') {
173
- callback(true);
174
- }
175
- }).catch(function (errors) {
176
- if (_this.errorFocus && errorFocus !== false) {
177
- _this.$nextTick(function () {
178
- _this.focusError.call(_this, errors);
167
+ validate() {
168
+ return new Promise((resolve) => {
169
+ if (this.$refs.form) {
170
+ this.$refs.form.validate((valid) => {
171
+ resolve(valid);
179
172
  });
180
- }
181
- if (typeof callback === 'function') {
182
- callback(false);
173
+ } else if (this.rules) {
174
+ const validator = new AsyncValidator(this.rules);
175
+ validator.validate(this.model).then(() => {
176
+ resolve(true);
177
+ }).catch(() => {
178
+ resolve(false);
179
+ });
180
+ } else {
181
+ resolve(true);
183
182
  }
184
183
  });
185
184
  },
186
185
  validateField(props, callback, errorFocus) {
187
186
  let _this = this;
188
- this.$refs.form.validateField(props, function (errorMessage) {
187
+ this.$refs.form.validateField(props, (errorMessage) => {
189
188
  if (errorMessage && _this.errorFocus && errorFocus !== false) {
190
- _this.$nextTick(function () {
189
+ _this.$nextTick(() => {
191
190
  _this.focusError.call(_this);
192
191
  });
193
192
  }
@@ -200,17 +199,16 @@ export default {
200
199
  this.$refs.form.clearValidate(props);
201
200
  },
202
201
  toSubmit(callback, disabled) {
203
- const vm = this;
204
- this.validate(function (success) {
202
+ this.validate().then(success => {
205
203
  if (success) {
206
204
  if (typeof callback !== 'function') {
207
- callback = vm.submit;
205
+ callback = this.submit;
208
206
  }
209
207
  if (typeof callback === 'function') {
210
208
  if (disabled !== false) {
211
- vm.disable();
209
+ this.disable();
212
210
  }
213
- callback(vm);
211
+ callback(this);
214
212
  }
215
213
  }
216
214
  });
@@ -229,12 +227,14 @@ export default {
229
227
  },
230
228
  /**
231
229
  * 执行所有的校验规则,以自定义方式处理错误
232
- * @param callback 校验后的回调函数,首个参数为错误消息字符串数组,没有错误时为null
233
230
  * @param fieldLabels 字段标签,可以是一个函数,也可以是一个对象,用于自定义错误消息中的字段标签
231
+ * @returns Promise<string[]|null> 错误消息字符串数组,没有错误时为null
234
232
  */
235
- validateRules(callback, fieldLabels) {
233
+ validateRules(fieldLabels) {
236
234
  let validator = new AsyncValidator(this.validationRules);
237
- validator.validate(this.model, function (errors) {
235
+ return validator.validate(this.model).then(() => {
236
+ return null;
237
+ }).catch((errors) => {
238
238
  let messages = [];
239
239
  if (errors) {
240
240
  for (let error of errors) {
@@ -248,10 +248,7 @@ export default {
248
248
  messages.push(fieldLabel + error.message);
249
249
  }
250
250
  }
251
- if (messages.length === 0) {
252
- messages = null;
253
- }
254
- callback(messages);
251
+ return messages.length === 0 ? null : messages;
255
252
  });
256
253
  }
257
254
  }
@@ -64,7 +64,7 @@ export default {
64
64
  let cache = this.getCache();
65
65
  if (cache) {
66
66
  let vm = this;
67
- setTimeout(function () {
67
+ setTimeout(() => {
68
68
  if (vm.$route.meta.isHistory()) {
69
69
  let model = cache[vm.id];
70
70
  if (model) {
@@ -882,3 +882,25 @@ i svg {
882
882
  word-break: break-all;
883
883
  overflow-wrap: break-word;
884
884
  }
885
+
886
+ .link {
887
+ color: var(--el-color-primary);
888
+ text-decoration: none;
889
+ cursor: pointer;
890
+ }
891
+
892
+ .link:hover {
893
+ color: var(--el-color-primary-light-5);
894
+ }
895
+
896
+ .is-disabled .link {
897
+ color: var(--el-color-primary-light-5);
898
+ cursor: not-allowed;
899
+ }
900
+
901
+ .el-input-group__append div.el-select .el-select__wrapper,
902
+ .el-input-group__append div.el-select:hover .el-select__wrapper,
903
+ .el-input-group__prepend div.el-select .el-select__wrapper,
904
+ .el-input-group__prepend div.el-select:hover .el-select__wrapper {
905
+ background-color: var(--el-color-white);
906
+ }
@@ -142,22 +142,24 @@ export default build('tnxel', () => {
142
142
  window.tnx.dialogInstances.push(dialog);
143
143
  return dialog;
144
144
  },
145
- closeDialog(all, callback) {
146
- if (typeof all === 'function') {
147
- callback = all;
148
- all = false;
149
- }
150
- if (window.tnx.dialogInstances.length) {
151
- let dialog = window.tnx.dialogInstances.pop();
152
- while (dialog) {
153
- dialog.close(callback);
154
- if (all) {
155
- dialog = window.tnx.dialogInstances.pop();
156
- } else {
157
- break;
145
+ closeDialog(all) {
146
+ return new Promise((resolve) => {
147
+ if (window.tnx.dialogInstances.length) {
148
+ let dialog = window.tnx.dialogInstances.pop();
149
+ let promises = [];
150
+ while (dialog) {
151
+ promises.push(dialog.close());
152
+ if (all) {
153
+ dialog = window.tnx.dialogInstances.pop();
154
+ } else {
155
+ break;
156
+ }
158
157
  }
158
+ Promise.all(promises).then(resolve);
159
+ } else {
160
+ resolve();
159
161
  }
160
- }
162
+ });
161
163
  },
162
164
  drawerInstances: [], // 抽屉堆栈
163
165
  drawer(content, title, buttons, options, contentProps) {
@@ -202,29 +204,31 @@ export default build('tnxel', () => {
202
204
  window.tnx.drawerInstances.push(drawer);
203
205
  return drawer;
204
206
  },
205
- closeDrawer(all, callback) {
206
- if (typeof all === 'function') {
207
- callback = all;
208
- all = false;
209
- }
210
- if (window.tnx.drawerInstances.length) {
211
- let drawer = window.tnx.drawerInstances.pop();
212
- while (drawer) {
213
- drawer.close(callback);
214
- if (all) {
215
- drawer = window.tnx.drawerInstances.pop();
216
- } else {
217
- break;
207
+ closeDrawer(all) {
208
+ return new Promise((resolve) => {
209
+ if (window.tnx.drawerInstances.length) {
210
+ let drawer = window.tnx.drawerInstances.pop();
211
+ let promises = [];
212
+ while (drawer) {
213
+ promises.push(drawer.close());
214
+ if (all) {
215
+ drawer = window.tnx.drawerInstances.pop();
216
+ } else {
217
+ break;
218
+ }
218
219
  }
220
+ Promise.all(promises).then(resolve);
221
+ } else {
222
+ resolve();
219
223
  }
220
- }
224
+ });
221
225
  },
222
226
  _closeMessage() {
223
227
  ElMessage.closeAll();
224
228
  this.closeLoading();
225
229
  },
226
230
  _handleZIndex(selector) {
227
- setTimeout(function () {
231
+ setTimeout(() => {
228
232
  const topZIndex = window.tnx.util.dom.minTopZIndex(2);
229
233
  if (selector.endsWith(':last')) {
230
234
  selector = selector.substring(0, selector.length - ':last'.length);
@@ -243,11 +247,9 @@ export default build('tnxel', () => {
243
247
  }
244
248
  });
245
249
  },
246
- alert(message, title, callback, options) {
247
- this.closeLoading();
248
- if (typeof title === 'function') {
249
- options = callback;
250
- callback = title;
250
+ alert(message, title, options) {
251
+ if (typeof title === 'object') {
252
+ options = title;
251
253
  title = '提示';
252
254
  }
253
255
  options = Object.assign({
@@ -255,46 +257,45 @@ export default build('tnxel', () => {
255
257
  type: 'warning',
256
258
  confirmButtonText: '确定',
257
259
  }, options);
258
- this.closeLoading();
259
- ElMessageBox.alert(message, title || '提示', options).then(callback);
260
+ this._closeMessage();
261
+ const promise = ElMessageBox.alert(message, title || '提示', options);
260
262
  this._handleZIndex('.el-message-box__wrapper:last');
261
263
  this.app.eventBus.emit('tnx.alert', options);
264
+ return promise;
262
265
  },
263
- success(message, callback, options) {
264
- this.closeLoading();
266
+ success(message, options) {
265
267
  options = Object.assign({
266
268
  dangerouslyUseHTMLString: true,
267
269
  }, options, {
268
270
  type: 'success',
269
271
  confirmButtonText: '确定',
270
272
  });
271
- this.closeLoading();
272
- ElMessageBox.alert(message, '成功', options).then(callback);
273
+ this._closeMessage();
274
+ const promise = ElMessageBox.alert(message, '成功', options);
273
275
  this._handleZIndex('.el-message-box__wrapper:last');
274
276
  this.app.eventBus.emit('tnx.success', options);
277
+ return promise;
275
278
  },
276
- error(message, callback, options) {
277
- this.closeLoading();
279
+ error(message, options) {
278
280
  options = Object.assign({
279
281
  dangerouslyUseHTMLString: true,
280
282
  }, options, {
281
283
  type: 'error',
282
284
  confirmButtonText: '确定',
283
285
  });
284
- this.closeLoading();
285
- ElMessageBox.alert(message, '错误', options).then(callback);
286
+ this._closeMessage();
287
+ const promise = ElMessageBox.alert(message, '错误', options);
286
288
  this._handleZIndex('.el-message-box__wrapper:last');
287
289
  this.app.eventBus.emit('tnx.error', options);
288
290
  // 打印TypeError对象,便于调试
289
291
  if (typeof message === 'object' && message.name === 'TypeError') {
290
292
  console.error(message);
291
293
  }
294
+ return promise;
292
295
  },
293
- confirm(message, title, callback, options) {
294
- this.closeLoading();
295
- if (typeof title === 'function') {
296
- options = callback;
297
- callback = title;
296
+ confirm(message, title = '确认', options) {
297
+ if (typeof title === 'object') {
298
+ options = title;
298
299
  title = '确认';
299
300
  }
300
301
  options = Object.assign({
@@ -315,29 +316,20 @@ export default build('tnxel', () => {
315
316
  options.confirmButtonText = options.cancelButtonText;
316
317
  options.cancelButtonText = buttonText;
317
318
  }
318
- if (typeof callback === 'function') {
319
- options.callback = function (action) {
320
- let yes = undefined;
321
- if (action === 'confirm') {
322
- yes = !options.reverse;
323
- } else if (action === 'cancel') {
324
- yes = !!options.reverse;
325
- }
326
- callback(yes);
327
- }
328
- }
329
- this.closeLoading();
330
- ElMessageBox.confirm(message, title, options);
331
- this._handleZIndex('.el-message-box__wrapper:last');
332
- this.app.eventBus.emit('tnx.confirm', options);
319
+
320
+ this._closeMessage();
321
+ return new Promise(resolve => {
322
+ ElMessageBox.confirm(message, title, options).then(() => {
323
+ resolve(true);
324
+ }).catch(() => {
325
+ resolve(false);
326
+ });
327
+ this._handleZIndex('.el-message-box__wrapper:last');
328
+ this.app.eventBus.emit('tnx.confirm', options);
329
+ })
330
+
333
331
  },
334
- toast(message, timeout, callback, options) {
335
- this.closeLoading();
336
- if (typeof timeout === 'function') {
337
- options = callback;
338
- callback = timeout;
339
- timeout = undefined;
340
- }
332
+ toast(message, timeout, options) {
341
333
  options = Object.assign({
342
334
  type: 'success', // 默认为成功主题,可更改为其它主题
343
335
  offset: this.util.dom.getDocHeight() * 0.4,
@@ -348,46 +340,62 @@ export default build('tnxel', () => {
348
340
  message: message,
349
341
  duration: timeout || 1500,
350
342
  customClass: 'tnxel-toast',
351
- onClose: callback,
352
343
  });
344
+
353
345
  this._closeMessage();
354
- ElMessage(options);
346
+ const messageInstance = ElMessage(options);
355
347
  this._handleZIndex('.el-message:last');
356
348
  this.app.eventBus.emit('tnx.toast', options);
349
+
350
+ // 创建一个Promise,在消息关闭时resolve
351
+ return new Promise((resolve) => {
352
+ const originalOnClose = options.onClose;
353
+ options.onClose = () => {
354
+ if (originalOnClose) {
355
+ originalOnClose();
356
+ }
357
+ resolve();
358
+ };
359
+ // 如果消息实例有close方法,重新设置onClose
360
+ if (messageInstance && messageInstance.close) {
361
+ const originalClose = messageInstance.close;
362
+ messageInstance.close = () => {
363
+ originalClose.call(messageInstance);
364
+ options.onClose();
365
+ };
366
+ }
367
+ });
357
368
  },
358
- showLoading(message, callback, options) {
369
+ showLoading(message, options) {
359
370
  if (typeof message !== 'string') {
360
- options = callback;
361
- callback = message;
371
+ options = message;
362
372
  message = undefined;
363
373
  }
364
- if (typeof callback !== 'function') {
365
- options = callback;
366
- callback = undefined;
367
- }
368
374
  options = Object.assign({
369
375
  dangerouslyUseHTMLString: true,
370
376
  }, options, {
371
377
  text: message,
372
378
  });
373
- this._closeMessage();
374
- try {
375
- window.tnx.loadingInstance = ElLoading.service(options);
376
- this._handleZIndex('.el-loading-mask');
377
- window.tnx.app.eventBus.emit('tnx.showLoading', options);
378
- if (callback) {
379
+ return new Promise((resolve, reject) => {
380
+ window.tnx._closeMessage();
381
+ try {
382
+ window.tnx.loadingInstance = ElLoading.service(options);
383
+ this._handleZIndex('.el-loading-mask');
384
+ window.tnx.app.eventBus.emit('tnx.showLoading', options);
379
385
  let vm = window.tnx.loadingInstance.vm;
380
386
  if (vm) {
381
- this.nextTickTimeout(vm, callback, 500);
387
+ window.tnx.nextTickTimeout(vm, () => {
388
+ resolve(window.tnx.loadingInstance);
389
+ }, 500);
382
390
  } else {
383
- callback();
391
+ resolve(window.tnx.loadingInstance);
384
392
  }
393
+ } catch (e) {
394
+ window.tnx.loadingInstance = null;
395
+ console.error(e);
396
+ reject(e);
385
397
  }
386
- } catch (e) {
387
- window.tnx.loadingInstance = null;
388
- console.error(e);
389
- }
390
- return window.tnx.loadingInstance;
398
+ });
391
399
  },
392
400
  closeLoading() {
393
401
  if (window.tnx.loadingInstance) { // 确保绝对的单例
@@ -1,15 +1,15 @@
1
- /**
2
- * 工具栏项
3
- */
4
- export default class ToolBarItem {
5
-
6
- icon = '';
7
- caption = '';
8
- disabled = false;
9
- click = null;
10
-
11
- static from(object) {
12
- return Object.assign(new ToolBarItem(), object);
13
- }
14
-
15
- }
1
+ /**
2
+ * 工具栏项
3
+ */
4
+ export default class ToolBarItem {
5
+
6
+ icon = '';
7
+ caption = '';
8
+ disabled = false;
9
+ click = null;
10
+
11
+ static from(object) {
12
+ return Object.assign(new ToolBarItem(), object);
13
+ }
14
+
15
+ }
@@ -1,56 +1,56 @@
1
- <template>
2
- <div class="tnxel-toolbar">
3
- <div class="flex-v-center">
4
- <template v-for="(item, index) of leftItems" :key="index">
5
- <el-divider direction="vertical" v-if="item === '|'"/>
6
- <ToolBarItem
7
- :item="Item.from(item)"
8
- :size="size"
9
- v-else-if="typeof item ==='object'"/>
10
- </template>
11
- </div>
12
- <div class="flex-v-center">
13
- <ToolBarItem v-for="(item, index) of rightItems" :key="index"
14
- :item="Item.from(item)"
15
- :size="size"/>
16
- </div>
17
- </div>
18
- </template>
19
-
20
- <script>
21
- import ToolBarItem from './ToolBarItem.vue';
22
- import Item from './ToolBarItem.js';
23
-
24
- export default {
25
- name: 'TnxelToolbar',
26
- components: {ToolBarItem},
27
- props: {
28
- leftItems: Array,
29
- rightItems: Array,
30
- size: {
31
- type: String,
32
- validator: value => {
33
- return ['small', 'default', 'large'].includes(value);
34
- },
35
- default: 'default',
36
- },
37
- },
38
- data() {
39
- return {
40
- Item,
41
- model: {},
42
- };
43
- },
44
- methods: {}
45
- }
46
- </script>
47
-
48
- <style>
49
- .tnxel-toolbar {
50
- height: 32px;
51
- padding: 0 8px;
52
- display: flex;
53
- align-items: center;
54
- justify-content: space-between;
55
- }
56
- </style>
1
+ <template>
2
+ <div class="tnxel-toolbar">
3
+ <div class="flex-v-center">
4
+ <template v-for="(item, index) of leftItems" :key="index">
5
+ <el-divider direction="vertical" v-if="item === '|'"/>
6
+ <ToolBarItem
7
+ :item="Item.from(item)"
8
+ :size="size"
9
+ v-else-if="typeof item ==='object'"/>
10
+ </template>
11
+ </div>
12
+ <div class="flex-v-center">
13
+ <ToolBarItem v-for="(item, index) of rightItems" :key="index"
14
+ :item="Item.from(item)"
15
+ :size="size"/>
16
+ </div>
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import ToolBarItem from './ToolBarItem.vue';
22
+ import Item from './ToolBarItem.js';
23
+
24
+ export default {
25
+ name: 'TnxelToolbar',
26
+ components: {ToolBarItem},
27
+ props: {
28
+ leftItems: Array,
29
+ rightItems: Array,
30
+ size: {
31
+ type: String,
32
+ validator: value => {
33
+ return ['small', 'default', 'large'].includes(value);
34
+ },
35
+ default: 'default',
36
+ },
37
+ },
38
+ data() {
39
+ return {
40
+ Item,
41
+ model: {},
42
+ };
43
+ },
44
+ methods: {}
45
+ }
46
+ </script>
47
+
48
+ <style>
49
+ .tnxel-toolbar {
50
+ height: 32px;
51
+ padding: 0 8px;
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: space-between;
55
+ }
56
+ </style>
@@ -59,23 +59,22 @@ export default {
59
59
  }
60
60
  },
61
61
  created() {
62
- let vm = this;
63
62
  let params;
64
63
  if (typeof this.params === 'function') {
65
64
  params = this.params();
66
65
  } else {
67
66
  params = this.params;
68
67
  }
69
- window.tnx.app.rpc.get(this.url, params, function(list) {
70
- vm.selectable = [];
68
+ window.tnx.app.rpc.get(this.url, params).then((list) => {
69
+ this.selectable = [];
71
70
  list.forEach(item => {
72
- if (vm.formatter) {
73
- vm.formatter(item);
71
+ if (this.formatter) {
72
+ this.formatter(item);
74
73
  }
75
- vm.selectable.push({
76
- key: item[vm.keyName],
77
- label: item[vm.labelName],
78
- index: item[vm.indexName],
74
+ this.selectable.push({
75
+ key: item[this.keyName],
76
+ label: item[this.labelName],
77
+ index: item[this.indexName],
79
78
  });
80
79
  });
81
80
  });