eoss-ui 0.5.64 → 0.5.65

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 (42) hide show
  1. package/CHANGELOG.md +929 -0
  2. package/lib/button-group.js +39 -21
  3. package/lib/button.js +61 -37
  4. package/lib/calendar.js +13 -5
  5. package/lib/data-table.js +108 -23
  6. package/lib/eoss-ui.common.js +448 -240
  7. package/lib/index.js +1 -1
  8. package/lib/login.js +11 -2
  9. package/lib/main.js +183 -121
  10. package/lib/theme-chalk/base.css +1 -1
  11. package/lib/theme-chalk/button-group.css +1 -1
  12. package/lib/theme-chalk/button.css +1 -1
  13. package/lib/theme-chalk/calendar.css +1 -1
  14. package/lib/theme-chalk/index.css +1 -1
  15. package/lib/theme-chalk/main.css +1 -1
  16. package/lib/theme-chalk/menu.css +1 -1
  17. package/lib/theme-chalk/sizer.css +1 -1
  18. package/lib/theme-chalk/upload.css +1 -1
  19. package/lib/upload.js +8 -6
  20. package/package.json +2 -2
  21. package/packages/button/src/main.vue +92 -56
  22. package/packages/button-group/src/main.vue +10 -1
  23. package/packages/calendar/src/main.vue +11 -4
  24. package/packages/data-table/src/children.vue +3 -1
  25. package/packages/data-table/src/main.vue +55 -10
  26. package/packages/login/src/main.vue +8 -0
  27. package/packages/main/src/main.vue +141 -96
  28. package/packages/theme-chalk/lib/base.css +1 -1
  29. package/packages/theme-chalk/lib/button-group.css +1 -1
  30. package/packages/theme-chalk/lib/button.css +1 -1
  31. package/packages/theme-chalk/lib/calendar.css +1 -1
  32. package/packages/theme-chalk/lib/index.css +1 -1
  33. package/packages/theme-chalk/lib/main.css +1 -1
  34. package/packages/theme-chalk/lib/menu.css +1 -1
  35. package/packages/theme-chalk/lib/sizer.css +1 -1
  36. package/packages/theme-chalk/lib/upload.css +1 -1
  37. package/packages/theme-chalk/src/base.scss +3 -0
  38. package/packages/theme-chalk/src/button-group.scss +110 -0
  39. package/packages/theme-chalk/src/button.scss +6 -0
  40. package/packages/theme-chalk/src/calendar.scss +3 -0
  41. package/packages/upload/src/main.vue +3 -1
  42. package/src/index.js +1 -1
@@ -43,7 +43,6 @@
43
43
  ref="oaTable"
44
44
  v-bind="{
45
45
  ...$attrs,
46
- data: datas,
47
46
  emptyText: emptyText,
48
47
  showSummary: showTotal,
49
48
  sumText: sumText || totalText,
@@ -54,28 +53,46 @@
54
53
  : undefined,
55
54
  border: _border,
56
55
  infiniteScroll: getTableData,
57
- infiniteScrollDisabled: infiniteDisabled
56
+ infiniteScrollDisabled: infiniteDisabled,
57
+ dragSort: dragSort,
58
+ dragSortClass: dragSortIcon
58
59
  }"
60
+ :data.sync="datas"
59
61
  v-on="{
60
62
  ...$listeners,
61
63
  'row-click': rowClick,
62
64
  'selection-change': selectionChange,
63
65
  'filter-column': handleFilterColumn,
64
- 'sort-change': handleSortChange
66
+ 'sort-change': handleSortChange,
67
+ 'update-drag-sort': handleUpdateDragSort
65
68
  }"
66
69
  :class="
67
70
  'es-table' +
68
71
  (theadBorder && border != 'none' ? ' es-thead-border' : '')
69
72
  "
70
73
  >
74
+ <!-- <el-table-column v-if="dragSort" width="32" fixed>
75
+ <template slot-scope="scope">
76
+ <es-icon :contents="dragSortIcon"></es-icon>
77
+ </template>
78
+ </el-table-column> -->
71
79
  <slot name="prepend"></slot>
72
80
  <slot></slot>
73
81
  <template v-for="(item, index) in theads">
74
82
  <template v-if="item.hide !== true">
75
83
  <el-table-column
76
- v-if="item.type === 'index' || item.type === 'selection'"
84
+ v-if="item.type === 'sort'"
85
+ width="32"
86
+ :key="index"
87
+ >
88
+ <template slot-scope="scope">
89
+ <es-icon class="es-move" :contents="dragSortIcon"></es-icon>
90
+ </template>
91
+ </el-table-column>
92
+ <el-table-column
93
+ v-else-if="item.type === 'index' || item.type === 'selection'"
77
94
  :key="index"
78
- v-bind="item"
95
+ v-bind="dragSort ? { ...item, fixed: false } : item"
79
96
  ></el-table-column>
80
97
  <children
81
98
  v-else
@@ -86,7 +103,8 @@
86
103
  form: form,
87
104
  readonly: readonly,
88
105
  optionData: optionDatas,
89
- ...item
106
+ dragSort: dragSort,
107
+ ...(dragSort ? { ...item, fixed: false } : item)
90
108
  }"
91
109
  v-on="{
92
110
  handleClick: handleClick,
@@ -402,6 +420,11 @@ export default {
402
420
  default() {
403
421
  return {};
404
422
  }
423
+ },
424
+ dragSort: Boolean,
425
+ dragSortIcon: {
426
+ type: String,
427
+ default: 'es-icon-caidan'
405
428
  }
406
429
  },
407
430
  data() {
@@ -430,7 +453,8 @@ export default {
430
453
  icon: true,
431
454
  show: true,
432
455
  sysCodes: [],
433
- infiniteDisabled: this.infiniteScroll
456
+ infiniteDisabled: this.infiniteScroll,
457
+ isUpadeData: false
434
458
  };
435
459
  },
436
460
  computed: {
@@ -450,7 +474,23 @@ export default {
450
474
  theads: {
451
475
  get() {
452
476
  let thead = [];
453
- if (this.checkbox) {
477
+ let types = this.theadData
478
+ .filter((item) => {
479
+ return (
480
+ item.type == 'selection' ||
481
+ item.type == 'index' ||
482
+ item.type == 'sort'
483
+ );
484
+ })
485
+ .map((item) => {
486
+ return item.type;
487
+ });
488
+ if (this.dragSort && !types.includes('sort')) {
489
+ thead.push({
490
+ type: 'sort'
491
+ });
492
+ }
493
+ if (this.checkbox && !types.includes('selection')) {
454
494
  thead.push({
455
495
  type: 'selection',
456
496
  width: '55',
@@ -460,7 +500,7 @@ export default {
460
500
  reserveSelection: this.reserveSelection
461
501
  });
462
502
  }
463
- if (this.numbers) {
503
+ if (this.numbers && !types.includes('index')) {
464
504
  let index = 1;
465
505
  if (this.infiniteScroll) {
466
506
  index = typeof this.index == 'boolean' ? 1 : this.index;
@@ -476,7 +516,8 @@ export default {
476
516
  width: '70',
477
517
  align: 'center',
478
518
  fixed: 'left',
479
- index: index
519
+ index: index,
520
+ filterIcon: this.filter ? 'es-icon-biao' : undefined
480
521
  });
481
522
  }
482
523
  if (this.theadData.length) {
@@ -512,6 +553,7 @@ export default {
512
553
  return this.data;
513
554
  },
514
555
  set(val) {
556
+ this.$emit('update:data', val);
515
557
  return val;
516
558
  }
517
559
  },
@@ -1481,6 +1523,9 @@ export default {
1481
1523
  }
1482
1524
  this.$emit('sort-change', res);
1483
1525
  },
1526
+ handleUpdateDragSort(data, event) {
1527
+ this.$emit('update-drag-sort', data, event);
1528
+ },
1484
1529
  mergeThead(res) {
1485
1530
  this.theadData = res;
1486
1531
  this.icon = true;
@@ -695,6 +695,11 @@ export default {
695
695
  this.loginInfo(val == 3);
696
696
  }
697
697
  },
698
+ identifyingId(val) {
699
+ if (val) {
700
+ this.loginInfo(this.active == 3);
701
+ }
702
+ },
698
703
  appName: {
699
704
  immediate: true,
700
705
  handler(val) {
@@ -1345,6 +1350,9 @@ export default {
1345
1350
  }
1346
1351
  },
1347
1352
  initRequestLoginInfo() {
1353
+ if (this.identifyingId == '') {
1354
+ return false;
1355
+ }
1348
1356
  util
1349
1357
  .ajax({
1350
1358
  method: 'post',
@@ -671,8 +671,9 @@ export default {
671
671
  },
672
672
  created() {
673
673
  let params = util.getParams() || {};
674
- this.homePage =
675
- typeof this.loadHomePage === 'string' ? this.loadHomePage : '';
674
+ if (typeof this.loadHomePage === 'string') {
675
+ this.homePage = this.loadHomePage;
676
+ }
676
677
  this.isHeader = params.header;
677
678
  let sysLogoIco = sessionStorage.getItem('sysLogoIco');
678
679
  sysLogoIco && util.setFavicon(sysLogoIco);
@@ -791,11 +792,7 @@ export default {
791
792
  this.setTitle(ids[0]);
792
793
  }
793
794
  } else if (sessionStorage.getItem('jump') && this.isHistory) {
794
- let ids = this.getId(
795
- this.menus,
796
- sessionStorage.getItem('jump'),
797
- true
798
- );
795
+ let ids = this.getId(this.menus, sessionStorage.getItem('jump'));
799
796
  if (ids) {
800
797
  this.defaultActive = ids;
801
798
  this.navIds = ids;
@@ -807,18 +804,14 @@ export default {
807
804
  hash = hash.split('?')[0];
808
805
  }
809
806
  if (hash !== '#/' && hash !== '#/main') {
810
- let ids = this.getId(this.menus, util.win.location.hash, true);
807
+ let ids = this.getId(this.menus, util.win.location.hash);
811
808
  if (ids) {
812
809
  this.defaultActive = ids;
813
810
  this.navIds = ids;
814
811
  this.setTitle(ids[0]);
815
812
  }
816
813
  } else if (sessionStorage.getItem('jump') && this.isHistory) {
817
- let ids = this.getId(
818
- this.menus,
819
- sessionStorage.getItem('jump'),
820
- true
821
- );
814
+ let ids = this.getId(this.menus, sessionStorage.getItem('jump'));
822
815
  if (ids) {
823
816
  this.defaultActive = ids;
824
817
  this.navIds = ids;
@@ -907,10 +900,10 @@ export default {
907
900
  }
908
901
  let jump = sessionStorage.getItem('jump');
909
902
  if (
910
- !applicationid &&
911
- (!jump || !this.isHistory) &&
912
- hash === '#/' &&
913
- hash === '#/main'
903
+ (!applicationid &&
904
+ (!jump || !this.isHistory) &&
905
+ (hash === '#/' || hash === '#/main')) ||
906
+ jump == results[i]
914
907
  ) {
915
908
  this.homePage =
916
909
  typeof this.loadHomePage === 'string'
@@ -1032,17 +1025,71 @@ export default {
1032
1025
  }
1033
1026
  });
1034
1027
  },
1035
- jumpMenu(res, flag, param) {
1036
- let option = { url: res, flag: flag, param: param };
1028
+ /**
1029
+ * @desc 跳转菜单
1030
+ * @param {Object/String} [res] - 菜单id(多个用,隔开)或url地址或系统菜单数据对象
1031
+ * @param {Boolean} [isUrl] - res是否是url地址
1032
+ * @param {Object} [param] - 拼接地址后的参数
1033
+ */
1034
+ jumpMenu(res, isUrl, path) {
1035
+ let option = { url: res, isUrl: isUrl, path: path };
1037
1036
  if (util.isObject(res)) {
1038
- option = { ...option, ...res };
1037
+ if (res.urlopenmode == 1) {
1038
+ util.win.open(res.url);
1039
+ return;
1040
+ } else if (res.urlopenmode == 2) {
1041
+ location.href = res.url;
1042
+ return;
1043
+ } else {
1044
+ option = { ...option, ...res };
1045
+ }
1039
1046
  }
1040
1047
  let ids;
1041
1048
  if (typeof option.url === 'string') {
1042
- if (option.flag) {
1043
- ids = this.getId(this.menus, option.url, true);
1049
+ if (
1050
+ option.isUrl ||
1051
+ option.url.indexOf('.html') > -1 ||
1052
+ option.url.indexOf('.dhtml') > -1 ||
1053
+ option.url.indexOf('/#/') > -1 ||
1054
+ option.url.indexOf('#/') > -1
1055
+ ) {
1056
+ option.isUrlc = true;
1057
+ ids = this.getId(this.menus, option.url);
1044
1058
  if (!ids) {
1045
- this.$message.error('未在菜单栏中找到此地址');
1059
+ if (
1060
+ option.url.indexOf('.html') === -1 &&
1061
+ option.url.indexOf('#/') === -1
1062
+ ) {
1063
+ this.method = 'iframe';
1064
+ this.refresh = false;
1065
+ this.page = option.url;
1066
+ } else {
1067
+ this.method = 'router';
1068
+ const routes = this.$router.options.routes;
1069
+ if (routes) {
1070
+ let path = this.hasRouter(routes, option.url);
1071
+ if (path) {
1072
+ let params = util.getParams({ url: option.url });
1073
+ this.$router.push({
1074
+ path: path,
1075
+ query: params
1076
+ });
1077
+ } else {
1078
+ if (this.loadWujie === false || (this.downgrade && isIE)) {
1079
+ this.method = 'iframe';
1080
+ this.refresh = false;
1081
+ this.page = option.url;
1082
+ } else {
1083
+ this.method = 'wujie';
1084
+ this.wjName = 'application' + Date.now();
1085
+ this.page = this.host + option.url;
1086
+ }
1087
+ }
1088
+ }
1089
+ }
1090
+ this.$nextTick(() => {
1091
+ this.refresh = true;
1092
+ });
1046
1093
  return;
1047
1094
  }
1048
1095
  } else {
@@ -1053,17 +1100,22 @@ export default {
1053
1100
  }
1054
1101
  this.setDefault(this.menus, ids, option.param);
1055
1102
  },
1056
- getId(arry, res, path) {
1057
- if (!res) {
1103
+ /**
1104
+ * @desc 获取菜单层级id
1105
+ * @param {Array} [menus] - 系统菜单数据对象
1106
+ * @param {String} [url] - 菜单id或url地址
1107
+ */
1108
+ getId(menus, url) {
1109
+ if (!url) {
1058
1110
  return false;
1059
1111
  }
1060
- for (let i = 0; i < arry.length; i++) {
1061
- let item = arry[i];
1112
+ for (let i = 0; i < menus.length; i++) {
1113
+ let item = menus[i];
1062
1114
  if (
1063
1115
  Object.prototype.hasOwnProperty.call(item, 'children') &&
1064
1116
  item.children.length
1065
1117
  ) {
1066
- let id = this.getId(item.children, res, path);
1118
+ let id = this.getId(item.children, url);
1067
1119
  if (id) {
1068
1120
  if (typeof id === 'string') {
1069
1121
  this.isTabs = false;
@@ -1079,7 +1131,7 @@ export default {
1079
1131
  Object.prototype.hasOwnProperty.call(item, 'fourthTabs') &&
1080
1132
  item.fourthTabs.length
1081
1133
  ) {
1082
- let id = this.getId(item.fourthTabs, res, path);
1134
+ let id = this.getId(item.fourthTabs, url);
1083
1135
  if (id) {
1084
1136
  if (typeof id === 'string') {
1085
1137
  this.isTabs = true;
@@ -1091,12 +1143,12 @@ export default {
1091
1143
  }
1092
1144
  return id;
1093
1145
  }
1094
- } else if (item.id === res || item.url == res) {
1146
+ } else if (item.id === url || item.url == url) {
1095
1147
  return item.id;
1096
1148
  } else {
1097
- if (path && item.url) {
1149
+ if (item.url) {
1098
1150
  let url = new URL(item.url, window.location.origin);
1099
- if (url.hash == res) {
1151
+ if (url.hash == url) {
1100
1152
  return item.id;
1101
1153
  }
1102
1154
  }
@@ -1114,54 +1166,6 @@ export default {
1114
1166
  if (res.rCode === 0) {
1115
1167
  if (res.results && res.results.length) {
1116
1168
  this.menus = JSON.parse(JSON.stringify(res.results));
1117
- let applicationid =
1118
- util.getParams('applicationid') ||
1119
- util.getParams('applicationId');
1120
- if (applicationid) {
1121
- let ids = this.getId(this.menus, applicationid);
1122
- if (ids) {
1123
- this.defaultActive = ids;
1124
- }
1125
- } else if (sessionStorage.getItem('jump') && this.isHistory) {
1126
- let ids = this.getId(
1127
- this.menus,
1128
- sessionStorage.getItem('jump'),
1129
- true
1130
- );
1131
- if (ids) {
1132
- this.defaultActive = ids;
1133
- this.navIds = ids;
1134
- this.setTitle(ids[0]);
1135
- }
1136
- } else if (util.win.location.hash) {
1137
- let hash = util.win.location.hash;
1138
- if (hash) {
1139
- hash = hash.split('?')[0];
1140
- }
1141
- if (hash !== '#/' && hash !== '#/main') {
1142
- let ids = this.getId(
1143
- this.menus,
1144
- util.win.location.hash,
1145
- true
1146
- );
1147
- if (ids) {
1148
- this.defaultActive = ids;
1149
- this.navIds = ids;
1150
- this.setTitle(ids[0]);
1151
- }
1152
- } else if (sessionStorage.getItem('jump') && this.isHistory) {
1153
- let ids = this.getId(
1154
- this.menus,
1155
- sessionStorage.getItem('jump'),
1156
- true
1157
- );
1158
- if (ids) {
1159
- this.defaultActive = ids;
1160
- this.navIds = ids;
1161
- this.setTitle(ids[0]);
1162
- }
1163
- }
1164
- }
1165
1169
  this.setTips(this.menus);
1166
1170
  store.set('nav', this.menus);
1167
1171
  this.setMenu(this.menus);
@@ -1181,6 +1185,34 @@ export default {
1181
1185
  },
1182
1186
  //设置默认左侧导航
1183
1187
  setMenu(res) {
1188
+ let applicationid =
1189
+ util.getParams('applicationid') || util.getParams('applicationId');
1190
+ if (applicationid) {
1191
+ let ids = this.getId(this.menus, applicationid);
1192
+ if (ids) {
1193
+ this.defaultActive = ids;
1194
+ }
1195
+ } else if (util.win.location.hash) {
1196
+ let hash = util.win.location.hash;
1197
+ if (hash) {
1198
+ hash = hash.split('?')[0];
1199
+ }
1200
+ if (hash !== '#/' && hash !== '#/main') {
1201
+ let ids = this.getId(this.menus, util.win.location.hash);
1202
+ if (ids) {
1203
+ this.defaultActive = ids;
1204
+ this.navIds = ids;
1205
+ this.setTitle(ids[0]);
1206
+ }
1207
+ }
1208
+ } else if (sessionStorage.getItem('jump') && this.isHistory) {
1209
+ let ids = this.getId(this.menus, sessionStorage.getItem('jump'));
1210
+ if (ids) {
1211
+ this.defaultActive = ids;
1212
+ this.navIds = ids;
1213
+ this.setTitle(ids[0]);
1214
+ }
1215
+ }
1184
1216
  if (this.defaultActive && this.defaultActive.length) {
1185
1217
  this.isDefault = false;
1186
1218
  this.setDefault(res, this.defaultActive);
@@ -1255,11 +1287,24 @@ export default {
1255
1287
  if (id && this.menu[0].id !== id) {
1256
1288
  this.active.push(id);
1257
1289
  } else {
1258
- this.handleJump(
1259
- this.menu[0].url,
1260
- this.menu[0].urlopenmode,
1261
- this.menu[0]
1262
- );
1290
+ let hash = util.win.location.hash;
1291
+ if (hash) {
1292
+ hash = hash.split('?')[0];
1293
+ if (hash !== '#/' && hash !== '#/main') {
1294
+ this.handleJump(hash);
1295
+ return;
1296
+ }
1297
+ }
1298
+ let jump = sessionStorage.getItem('jump');
1299
+ if (jump) {
1300
+ this.handleJump(jump);
1301
+ } else {
1302
+ this.handleJump(
1303
+ this.menu[0].url,
1304
+ this.menu[0].urlopenmode,
1305
+ this.menu[0]
1306
+ );
1307
+ }
1263
1308
  }
1264
1309
  }
1265
1310
  }
@@ -1406,7 +1451,7 @@ export default {
1406
1451
  break;
1407
1452
  }
1408
1453
  }
1409
- } else {
1454
+ } else if (active && active.length) {
1410
1455
  this.navs = [];
1411
1456
  this.subsystem = [];
1412
1457
  this.menu = res;
@@ -1501,12 +1546,12 @@ export default {
1501
1546
  this.active = subNode.id;
1502
1547
  this.navIds = [
1503
1548
  node.id,
1504
- ...this.getId(node.children, subNode.url, true)
1549
+ ...this.getId(node.children, subNode.url)
1505
1550
  ];
1506
1551
  }
1507
1552
  }
1508
1553
  } else {
1509
- this.navIds = this.getId(this.menus, node.url, true);
1554
+ this.navIds = this.getId(this.menus, node.url);
1510
1555
  this.setTitle(this.navIds[0]);
1511
1556
  this.tabsId = fourthTabs ? node.id : '';
1512
1557
  }
@@ -1526,7 +1571,7 @@ export default {
1526
1571
  this.active = subNode.id;
1527
1572
  this.navIds = [
1528
1573
  node.id,
1529
- ...this.getId(node.children, subNode.url, true)
1574
+ ...this.getId(node.children, subNode.url)
1530
1575
  ];
1531
1576
  }
1532
1577
  }
@@ -1546,7 +1591,7 @@ export default {
1546
1591
  let subNode = this.getFirst(node);
1547
1592
  this.active = [node.id];
1548
1593
  if (subNode && node.id !== subNode.id) {
1549
- this.navIds = this.getId(this.menus, subNode.url, true);
1594
+ this.navIds = this.getId(this.menus, subNode.url);
1550
1595
  this.$set(this.active, 1, subNode.id);
1551
1596
  }
1552
1597
  }
@@ -1570,7 +1615,7 @@ export default {
1570
1615
  } else {
1571
1616
  this.active = tab.id;
1572
1617
  }
1573
- this.navIds = this.getId(this.menus, tab.url, true);
1618
+ this.navIds = this.getId(this.menus, tab.url);
1574
1619
  }
1575
1620
  } else {
1576
1621
  let tab = (node.fourthTabs || []).filter((item) => {
@@ -1579,9 +1624,9 @@ export default {
1579
1624
  if (tab) {
1580
1625
  this.tabs = node.fourthTabs;
1581
1626
  this.tabsId = tab.id;
1582
- this.navIds = this.getId(this.menus, tab.url, true);
1627
+ this.navIds = this.getId(this.menus, tab.url);
1583
1628
  } else {
1584
- this.navIds = this.getId(this.menus, node.url, true);
1629
+ this.navIds = this.getId(this.menus, node.url);
1585
1630
  }
1586
1631
  }
1587
1632
  } else {
@@ -1593,7 +1638,7 @@ export default {
1593
1638
  this.tabs[0].urlopenmode,
1594
1639
  this.tabs[0]
1595
1640
  );
1596
- this.navIds = this.getId(this.menus, this.tabs[0].url, true);
1641
+ this.navIds = this.getId(this.menus, this.tabs[0].url);
1597
1642
  }
1598
1643
  }
1599
1644
  } else {
@@ -1606,14 +1651,14 @@ export default {
1606
1651
  } else {
1607
1652
  this.active = subNode.id;
1608
1653
  }
1609
- this.navIds = this.getId(this.menus, subNode.url, true);
1654
+ this.navIds = this.getId(this.menus, subNode.url);
1610
1655
  }
1611
1656
  }
1612
1657
  }
1613
1658
  break;
1614
1659
  case 'tabs':
1615
1660
  this.tabsId = node.id;
1616
- this.navIds = this.getId(this.menus, node.url, true);
1661
+ this.navIds = this.getId(this.menus, node.url);
1617
1662
  break;
1618
1663
  }
1619
1664
  if (node.url) {