eoss-ui 0.4.31 → 0.4.33

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 (60) hide show
  1. package/CHANGELOG.md +929 -0
  2. package/lib/button-group.js +33 -61
  3. package/lib/button.js +33 -61
  4. package/lib/checkbox-group.js +33 -61
  5. package/lib/data-table-form.js +33 -61
  6. package/lib/data-table.js +47 -67
  7. package/lib/date-picker.js +33 -61
  8. package/lib/dialog.js +33 -61
  9. package/lib/eoss-ui.common.js +197 -174
  10. package/lib/flow-group.js +43 -67
  11. package/lib/flow-list.js +33 -61
  12. package/lib/flow.js +33 -61
  13. package/lib/form.js +38 -65
  14. package/lib/handle-user.js +33 -61
  15. package/lib/handler.js +33 -61
  16. package/lib/index.js +1 -1
  17. package/lib/input-number.js +33 -61
  18. package/lib/input.js +33 -61
  19. package/lib/login.js +47 -72
  20. package/lib/main.js +58 -75
  21. package/lib/mainComp.js +36 -68
  22. package/lib/nav.js +33 -61
  23. package/lib/page.js +33 -61
  24. package/lib/player.js +33 -61
  25. package/lib/qr-code.js +33 -61
  26. package/lib/radio-group.js +33 -61
  27. package/lib/select-ganged.js +33 -61
  28. package/lib/select.js +33 -61
  29. package/lib/selector-panel.js +33 -61
  30. package/lib/selector.js +33 -61
  31. package/lib/sizer.js +33 -61
  32. package/lib/steps.js +33 -61
  33. package/lib/switch.js +33 -61
  34. package/lib/table-form.js +33 -61
  35. package/lib/tabs.js +33 -61
  36. package/lib/theme-chalk/form.css +1 -1
  37. package/lib/theme-chalk/index.css +1 -1
  38. package/lib/tips.js +33 -61
  39. package/lib/tree-group.js +43 -63
  40. package/lib/tree.js +48 -63
  41. package/lib/upload.js +61 -82
  42. package/lib/utils/util.js +33 -61
  43. package/lib/wujie.js +33 -61
  44. package/lib/wxlogin.js +33 -61
  45. package/package.json +2 -2
  46. package/packages/data-table/src/main.vue +9 -2
  47. package/packages/flow-group/src/main.vue +5 -4
  48. package/packages/form/src/main.vue +4 -2
  49. package/packages/login/src/main.vue +12 -9
  50. package/packages/main/src/main.vue +13 -3
  51. package/packages/main/src/userinfo.vue +21 -24
  52. package/packages/mainComp/src/main.vue +1 -5
  53. package/packages/theme-chalk/lib/form.css +1 -1
  54. package/packages/theme-chalk/lib/index.css +1 -1
  55. package/packages/theme-chalk/src/form.scss +1 -1
  56. package/packages/tree/src/main.vue +12 -0
  57. package/packages/tree-group/src/main.vue +6 -0
  58. package/packages/upload/src/main.vue +25 -25
  59. package/src/index.js +1 -1
  60. package/src/utils/util.js +50 -77
@@ -231,7 +231,7 @@
231
231
  color: #c0c4cc;
232
232
  line-height: 40px;
233
233
  }
234
- & > div:not(.es-range) {
234
+ & > div:not(.es-range):not(.es-flex-none) {
235
235
  flex: 1;
236
236
  }
237
237
  }
@@ -61,6 +61,7 @@
61
61
  :expand-on-click-node="false"
62
62
  :highlight-current="true"
63
63
  :show-checkbox="showCheckbox"
64
+ :current-node-key="currentNodeKey"
64
65
  v-on="{
65
66
  ...$listeners,
66
67
  'node-click': handleNodeClick,
@@ -159,6 +160,8 @@ export default {
159
160
  },
160
161
  // 选择项本地数据
161
162
  data: Array,
163
+ currentFirst: Boolean,
164
+ currentNodeKey: [String, Number],
162
165
  icon: {
163
166
  type: Boolean,
164
167
  default: true
@@ -381,6 +384,15 @@ export default {
381
384
  this.loading = false;
382
385
  if (res.rCode === 0) {
383
386
  this.treeList = JSON.parse(JSON.stringify(res.results));
387
+ if (this.currentFirst) {
388
+ let currentNode = this.treeList[0].children[0].id;
389
+ this.$emit('current-first', this.treeList[0]);
390
+ if (!this.currentNodeKey) {
391
+ this.$nextTick(() => {
392
+ this.$refs.oaTree.setCurrentKey(currentNode);
393
+ });
394
+ }
395
+ }
384
396
  this.expandedKeys = this.treeList.filter((item) => {
385
397
  if (item.open) {
386
398
  return item.id;
@@ -25,6 +25,7 @@
25
25
  :ref="item.ref ? item.ref : 'groupTree' + index"
26
26
  @node-click="handleNodeClick"
27
27
  @check-change="handleCheckChange"
28
+ @current-first="handleCurrentFirst"
28
29
  v-on="item.tree && item.tree.events ? item.tree.events : {}"
29
30
  >
30
31
  <template v-if="item.enterprise" slot="filtrate">
@@ -48,6 +49,7 @@
48
49
  ref="groupTree"
49
50
  @node-click="handleNodeClick"
50
51
  @check-change="handleCheckChange"
52
+ @current-first="handleCurrentFirst"
51
53
  v-on="tree.events ? tree.events : {}"
52
54
  >
53
55
  <template v-if="enterprise" slot="filtrate">
@@ -432,6 +434,10 @@ export default {
432
434
  handleConfirm(res) {
433
435
  this.checkeds = res;
434
436
  this.$emit('enterprise-confirm', res);
437
+ },
438
+ handleCurrentFirst(res) {
439
+ this.checkeds = res.children[0];
440
+ this.$emit('current-first', res);
435
441
  }
436
442
  }
437
443
  };
@@ -542,12 +542,14 @@ export default {
542
542
  return this.image;
543
543
  }
544
544
  return (
545
- this.host + previewAdjunct + '?adjunctId=' + this.image.adjunctId
545
+ this.host + this.previewAdjunct + '?adjunctId=' + this.image.adjunctId
546
546
  );
547
547
  }
548
548
  if (this.value) {
549
549
  if (typeof this.value === 'string') {
550
- if (this.value.indexOf('data:image/') === -1) {
550
+ if (this.value.indexOf('data:image/') === 0) {
551
+ return this.value;
552
+ } else if (this.value.indexOf(this.previewAdjunct) > -1) {
551
553
  let val =
552
554
  this.host +
553
555
  util.jointUrl({
@@ -555,38 +557,36 @@ export default {
555
557
  reg: '/main2'
556
558
  });
557
559
  return val;
558
- }
559
- if (
560
- this.value.indexOf(previewAdjunct) === -1 ||
561
- this.value.indexOf('/') === -1
562
- ) {
563
- return this.host + previewAdjunct + '?adjunctId=' + this.value;
560
+ } else if (this.value.indexOf('/') === -1) {
561
+ return this.host + this.previewAdjunct + '?adjunctId=' + this.value;
564
562
  }
565
563
  return this.value;
566
564
  } else if (Array.isArray(this.value)) {
567
565
  let adjunctId = this.value[0].response
568
566
  ? this.value[0].response.adjunctId
569
567
  : this.value[0].adjunctId;
570
- return this.host + previewAdjunct + '?adjunctId=' + adjunctId;
568
+ return this.host + this.previewAdjunct + '?adjunctId=' + adjunctId;
571
569
  } else {
572
570
  let adjunctId = this.value.response
573
571
  ? this.value.response.adjunctId
574
572
  : this.value.adjunctId;
575
- return this.host + previewAdjunct + '?adjunctId=' + adjunctId;
573
+ return this.host + this.previewAdjunct + '?adjunctId=' + adjunctId;
576
574
  }
577
575
  }
578
- if (
579
- this.photo &&
580
- typeof this.photo === 'string' &&
581
- this.photo.indexOf('data:image/') === -1
582
- ) {
583
- let val =
584
- this.host +
585
- util.jointUrl({
586
- url: this.photo,
587
- reg: '/main2'
588
- });
589
- return val;
576
+ if (this.photo && typeof this.photo === 'string') {
577
+ if (this.photo.indexOf('data:image/') === 0) {
578
+ return this.photo;
579
+ } else if (this.photo.indexOf(this.previewAdjunct) > -1) {
580
+ let val =
581
+ this.host +
582
+ util.jointUrl({
583
+ url: this.value,
584
+ reg: '/main2'
585
+ });
586
+ return val;
587
+ } else if (this.photo.indexOf('/') === -1) {
588
+ return this.host + this.previewAdjunct + '?adjunctId=' + this.photo;
589
+ }
590
590
  }
591
591
  return this.photo;
592
592
  }
@@ -782,7 +782,7 @@ export default {
782
782
  ) {
783
783
  this.imgUrl =
784
784
  this.host +
785
- (url ? url : previewAdjunct) +
785
+ (url ? url : this.previewAdjunct) +
786
786
  '?adjunctId=' +
787
787
  file.adjunctId;
788
788
  this.title = file.originalName;
@@ -794,7 +794,7 @@ export default {
794
794
  this.source = {
795
795
  src:
796
796
  this.host +
797
- (url ? url : previewAdjunct) +
797
+ (url ? url : this.previewAdjunct) +
798
798
  '?adjunctId=' +
799
799
  file.adjunctId
800
800
  };
@@ -803,7 +803,7 @@ export default {
803
803
  } else {
804
804
  util.win.open(
805
805
  this.host +
806
- (url ? url : previewAdjunct) +
806
+ (url ? url : this.previewAdjunct) +
807
807
  '?adjunctId=' +
808
808
  file.adjunctId
809
809
  );
package/src/index.js CHANGED
@@ -115,7 +115,7 @@ if (typeof window !== 'undefined' && window.Vue) {
115
115
  }
116
116
 
117
117
  export default {
118
- version: '0.4.31',
118
+ version: '0.4.33',
119
119
  install,
120
120
  Button,
121
121
  ButtonGroup,
package/src/utils/util.js CHANGED
@@ -22,6 +22,7 @@ const $brightnessStep2 = 0.15;
22
22
  const $lightColorCount = 5;
23
23
  const $darkColorCount = 4;
24
24
  const publicKey = 'abcdefghijklmnopqrstuvwxyz12345678';
25
+ let loginMsg;
25
26
 
26
27
  const JSONbigToString = JSONbig({ storeAsString: true });
27
28
  import { MessageBox, Loading } from 'eoss-element';
@@ -43,7 +44,6 @@ import { MessageBox, Loading } from 'eoss-element';
43
44
  * @param {Object} [loading] - loading加载对象
44
45
  **/
45
46
  // 请求
46
- let _timer = null;
47
47
  const pendingRequest = new Map();
48
48
  function getRequestKey(config) {
49
49
  const { method, url, params, data } = config;
@@ -169,63 +169,55 @@ const ajax = function ({
169
169
  'useCaseCodes',
170
170
  'mainConfig'
171
171
  ]);
172
-
173
- let timer = getStorage('timer') || 0;
174
- timer = parseInt(timer, 10);
175
172
  if (
176
173
  win.top.location.href.indexOf('#/login') === -1 &&
177
- win.top.location.href.indexOf('/login.html') === -1 &&
178
- !timer
174
+ win.top.location.href.indexOf('/login.html') === -1
179
175
  ) {
180
- sessionStorage.setItem('timer', 1);
181
- MessageBox.confirm(
182
- response.data.rCode === 69
183
- ? '该账号在其他地方已登陆!'
184
- : '登录已过期,请重新登录!',
185
- '提示',
186
- response.data.rCode === 69
187
- ? {
188
- confirmButtonText: '确定',
189
- closeOnClickModal: false,
190
- type: 'warning'
191
- }
192
- : {
193
- confirmButtonText: '确定',
194
- cancelButtonText: '取消',
195
- closeOnClickModal: false,
196
- type: 'warning'
197
- }
198
- )
199
- .then(() => {
200
- const loginPage = getStorage('login') || getStorage('loginPage');
201
- if (loginPage) {
202
- win.top.location.href = loginPage;
203
- } else if (win.top.location.href.indexOf('main.html') > -1) {
204
- win.top.location.href = './login.html';
205
- } else {
206
- const hash = win.top.location.hash;
207
- if (
208
- hash ||
209
- (win.top.location.indexOf('model=') &&
210
- win.top.location.indexOf('view=') &&
211
- win.top.location.indexOf('render.html'))
212
- ) {
213
- const len = win.top.location.href.indexOf(hash);
214
- let href = win.top.location.href.slice(0, len) + '#/login';
215
- win.top.location.href = href;
176
+ clearTimeout(loginMsg);
177
+ loginMsg = setTimeout(() => {
178
+ MessageBox.confirm(
179
+ response.data.rCode === 69
180
+ ? '该账号在其他地方已登陆!'
181
+ : '登录已过期,请重新登录!',
182
+ '提示',
183
+ response.data.rCode === 69
184
+ ? {
185
+ confirmButtonText: '确定',
186
+ closeOnClickModal: false,
187
+ type: 'warning'
188
+ }
189
+ : {
190
+ confirmButtonText: '确定',
191
+ cancelButtonText: '取消',
192
+ closeOnClickModal: false,
193
+ type: 'warning'
194
+ }
195
+ )
196
+ .then(() => {
197
+ const loginPage = getStorage('login') || getStorage('loginPage');
198
+ if (loginPage) {
199
+ win.top.location.href = loginPage;
200
+ } else if (win.top.location.href.indexOf('main.html') > -1) {
201
+ win.top.location.href = './login.html';
216
202
  } else {
217
- win.top.location.href = '/login.html';
203
+ const hash = win.top.location.hash;
204
+ if (
205
+ hash ||
206
+ (win.top.location.indexOf('model=') &&
207
+ win.top.location.indexOf('view=') &&
208
+ win.top.location.indexOf('render.html'))
209
+ ) {
210
+ const len = win.top.location.href.indexOf(hash);
211
+ let href = win.top.location.href.slice(0, len) + '#/login';
212
+ win.top.location.href = href;
213
+ } else {
214
+ win.top.location.href = '/login.html';
215
+ }
218
216
  }
219
- }
220
- })
221
- .catch(e => {
222
- _timer && clearTimeout(_timer);
223
- _timer = setTimeout(() => {
224
- removeStorage('timer');
225
- clearTimeout(_timer);
226
- _timer = null;
227
- }, 1000);
228
- });
217
+ })
218
+ .catch(e => {
219
+ });
220
+ }, 1000);
229
221
  }
230
222
  return Promise.reject(response.data);
231
223
  } else {
@@ -371,32 +363,13 @@ const browser = function () {
371
363
  * @param {Boolean} [immediate] - 是否首次触发执行
372
364
  **/
373
365
 
374
- const debounce = function (fn, wait, immediate) {
375
- let timeout;
366
+ const debounce = function (callback, delay) {
367
+ var timeout = null;
376
368
  return function () {
377
- let self = this;
378
- let args = arguments;
379
-
380
- if (timeout) clearTimeout(timeout);
381
- // 是否在某一批事件中首次执行
382
- if (immediate) {
383
- let callNow = !timeout;
384
- timeout = setTimeout(function () {
385
- timeout = null;
386
- fn.apply(self, args);
387
- immediate = true;
388
- }, wait);
389
- if (callNow) {
390
- fn.apply(self, args);
391
- }
392
- immediate = false;
393
- } else {
394
- timeout = setTimeout(function () {
395
- fn.apply(self, args);
396
- immediate = true;
397
- }, wait);
398
- }
369
+ clearTimeout(timeout);
370
+ timeout = setTimeout(callback, delay ? delay : 500);
399
371
  };
372
+
400
373
  };
401
374
  /**
402
375
  * delUrlParam