n20-common-lib 2.2.6 → 2.2.8

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": "n20-common-lib",
3
- "version": "2.2.6",
3
+ "version": "2.2.8",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -54,6 +54,7 @@
54
54
  "qrcode": "*",
55
55
  "resize-detector": "*",
56
56
  "strip-json-comments": "*",
57
+ "umy-table": "^1.1.8",
57
58
  "v-viewer": "*",
58
59
  "vuedraggable": "*"
59
60
  },
@@ -2,6 +2,9 @@
2
2
  @import './rootvar.scss';
3
3
  @import './font-icon.scss';
4
4
 
5
+ @import './el-button.scss';
6
+ @import './el-table.scss';
7
+
5
8
  @import './title-pop.scss';
6
9
  @import './cl-form-item.scss';
7
10
  @import './cl-approve-card.scss';
@@ -30,6 +33,9 @@
30
33
  @import './cl-general-card.scss';
31
34
  @import './cl-anchor.scss';
32
35
  @import './cl-flow-step.scss';
36
+ @import './umy-table/u-table.scss';
37
+ @import './umy-table/u-tree-table.scss';
38
+ @import './umy-table/ux-grid.scss';
33
39
 
34
40
  @import '../../plugins/Print/print.scss';
35
41
  @import './select.scss';
@@ -38,9 +44,3 @@
38
44
  /* 临时引入 */
39
45
  @import '../../components/ChildRange/style.scss';
40
46
  @import '../../components/PageHeader/style.scss';
41
- .table-header-popover.el-popover {
42
- padding: 16px;
43
- }
44
- .el-form-item__label {
45
- color: $--color-text-primary;
46
- }
@@ -733,3 +733,7 @@ $--input-max: 224px;
733
733
  top: 100%;
734
734
  left: 0;
735
735
  }
736
+
737
+ .el-form-item__label {
738
+ color: $--color-text-primary;
739
+ }
@@ -14,6 +14,18 @@
14
14
  font-size: 12px;
15
15
  }
16
16
  }
17
+ .el-table--small,
18
+ .el-table--mini {
19
+ .el-table__cell {
20
+ .el-button--text {
21
+ padding-top: 2px;
22
+ padding-bottom: 2px;
23
+ }
24
+ .el-link {
25
+ line-height: initial;
26
+ }
27
+ }
28
+ }
17
29
 
18
30
  .el-table th {
19
31
  font-weight: $--font-weight-primary;
@@ -99,3 +111,7 @@
99
111
  .el-table .descending .sort-caret.descending {
100
112
  color: $--color-primary;
101
113
  }
114
+
115
+ .table-header-popover.el-popover {
116
+ padding: 16px;
117
+ }
@@ -6,9 +6,6 @@
6
6
  $--font-path: '~element-ui/lib/theme-chalk/fonts';
7
7
 
8
8
  @import '~element-ui/packages/theme-chalk/src/index';
9
- @import './el-button.scss';
10
- @import './el-table.scss';
11
- @import "./alert.scss";
12
9
 
13
10
  .update-doc {
14
11
  ul > li {
@@ -5,7 +5,5 @@
5
5
  /* 改变 icon 字体路径变量,必需 */
6
6
  $--font-path: '~element-ui/lib/theme-chalk/fonts';
7
7
  @import '~element-ui/packages/theme-chalk/src/index';
8
- @import './el-button.scss';
9
- @import './el-table.scss';
10
8
 
11
9
  @import './_coreLib.scss';
@@ -0,0 +1,63 @@
1
+ .plTableBox {
2
+ width: 100%;
3
+ position: relative;
4
+ .el-table {
5
+ .umy-table-beyond {
6
+ white-space: nowrap !important;
7
+ position: relative;
8
+ }
9
+ }
10
+ .el-table__virtual-wrapper {
11
+ .el-table__body {
12
+ width: 100%;
13
+ }
14
+ }
15
+ .el-table--fixed__virtual-wrapper {
16
+ width: auto !important;
17
+ }
18
+ .el-table__footer-wrapper {
19
+ margin-top: 0 !important;
20
+ }
21
+ .umy-table-header-border-right-none-th {
22
+ border-right: none !important;
23
+ }
24
+ .fixed-columns-roll-style {
25
+ .el-table__body-wrapper {
26
+ z-index: 2 !important;
27
+ }
28
+ .pltableFixedWrapper {
29
+ z-index: 2 !important;
30
+ }
31
+ }
32
+ .myPagination {
33
+ padding-top: 20px;
34
+ text-align: right;
35
+ }
36
+ }
37
+ .modal-backdrop {
38
+ position: fixed;
39
+ top: 0;
40
+ right: 0;
41
+ bottom: 0;
42
+ left: 0;
43
+ z-index: 5555 !important;
44
+ background-color: #000;
45
+ opacity: 0.2;
46
+ }
47
+ .beautifyTableClass {
48
+ .plTbaleTotal {
49
+ .el-table__footer-two {
50
+ border-top: 1px solid #c7c9cc;
51
+ }
52
+ }
53
+ }
54
+
55
+ .plTableBox {
56
+ .el-table {
57
+ .hidden-columns {
58
+ visibility: hidden;
59
+ position: absolute;
60
+ z-index: -1;
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,34 @@
1
+ .cell--tree-node {
2
+ position: relative;
3
+ }
4
+ .pl-tree-cell {
5
+ overflow: hidden;
6
+ text-overflow: ellipsis;
7
+ white-space: nowrap;
8
+ display: block;
9
+ padding-left: 1.5em;
10
+ }
11
+ .tree--btn-wrapper {
12
+ position: absolute;
13
+ top: 50%;
14
+ width: 1em;
15
+ height: 1em;
16
+ line-height: 1em;
17
+ margin-top: -0.5em;
18
+ transition: transform 0.2s ease-in-out;
19
+ z-index: 1;
20
+ user-select: none;
21
+ color: #333333 !important;
22
+ font-size: 16px;
23
+ cursor: pointer;
24
+ &.tree--btn-wrapper-show {
25
+ transform: rotate(90deg);
26
+ }
27
+ }
28
+ .reverse-table {
29
+ .u-table--fixed-left-wrapper {
30
+ .u-body--column {
31
+ background-color: $--table-header-background-color;
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,111 @@
1
+ .plTableBox .elx-table {
2
+ .elx-body--column,
3
+ .elx-footer--column,
4
+ .elx-header--column {
5
+ &.col--ellipsis {
6
+ height: 40px;
7
+ }
8
+ }
9
+ &.elx-editable .elx-body--column {
10
+ height: 40px;
11
+ }
12
+
13
+ &.border--default,
14
+ &.border--default,
15
+ &.border--outer {
16
+ .elx-table--header-wrapper {
17
+ background-color: --table-header-background-color;
18
+ }
19
+ }
20
+ &.border--full {
21
+ .elx-body--column,
22
+ .elx-footer--column,
23
+ .elx-header--column {
24
+ background-image: linear-gradient($--table-border-color, $--table-border-color),
25
+ linear-gradient($--table-border-color, $--table-border-color);
26
+ }
27
+ }
28
+
29
+ .elx-cell--checkbox {
30
+ .elx-checkbox--icon {
31
+ width: 16px;
32
+ height: 16px;
33
+ &:before {
34
+ width: 16px;
35
+ height: 16px;
36
+ border: 1px solid $--radio-input-border-color;
37
+ border-radius: 2px;
38
+ }
39
+ &:after {
40
+ left: 6px;
41
+ top: 3px;
42
+ }
43
+ }
44
+ .elx-checkbox--indeterminate-icon:after {
45
+ position: absolute;
46
+ top: 50%;
47
+ left: 50%;
48
+ width: 7px;
49
+ }
50
+ }
51
+
52
+ .elx-cell--sort {
53
+ display: inline-flex;
54
+ flex-direction: row-reverse;
55
+ align-items: center;
56
+ width: 16px;
57
+ height: 16px;
58
+ line-height: 16px;
59
+ vertical-align: middle;
60
+ cursor: pointer;
61
+ }
62
+ .elx-sort--asc-btn,
63
+ .elx-sort--desc-btn {
64
+ width: 8px;
65
+ height: 16px;
66
+ border: none;
67
+ font-style: normal;
68
+ position: static;
69
+ &:before {
70
+ content: '\e61c';
71
+ font-family: 'core-lib-iconfont';
72
+ font-size: 12px;
73
+ line-height: 12px;
74
+ position: relative;
75
+ left: auto;
76
+ top: 1px;
77
+ right: 3px;
78
+ bottom: auto;
79
+ border: none;
80
+ }
81
+ &:hover {
82
+ color: $--color-primary-light-6;
83
+ }
84
+ &.sort--active {
85
+ color: $--color-primary;
86
+ }
87
+ }
88
+ .elx-sort--desc-btn:before {
89
+ content: '\e61d';
90
+ font-family: 'core-lib-iconfont';
91
+ position: relative;
92
+ right: 1px;
93
+ }
94
+ .elx-cell--filter {
95
+ padding-left: 0;
96
+ }
97
+ .elx-table--filter-wrapper {
98
+ margin-top: 6px;
99
+ min-width: auto;
100
+ border: 1px solid #ebeef5;
101
+ border-radius: 2px;
102
+ background-color: #fff;
103
+ box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.15);
104
+ box-sizing: border-box;
105
+ }
106
+ .filter--active {
107
+ .elx-cell--title {
108
+ color: $--color-primary;
109
+ }
110
+ }
111
+ }
@@ -327,7 +327,7 @@ export default {
327
327
  }
328
328
  } else {
329
329
  this.$message.success(str + $lc('成功'))
330
- this.goFrom()
330
+ setTimeout(this.goFrom, 300)
331
331
  }
332
332
  },
333
333
  addErrFn() {
@@ -146,6 +146,7 @@ import qrCode from './qrcode.vue'
146
146
  import { siteTree2menus, siteTree2RelaNos } from './utils'
147
147
  import CaMap from '../../plugins/Sign/CaMap.js'
148
148
  import importG from '../../utils/importGlobal.js'
149
+ import { setItem } from '../../utils/storageEdit'
149
150
 
150
151
  function encode(pwd = '', key = 0) {
151
152
  if (pwd === '') return ''
@@ -596,15 +597,18 @@ export default {
596
597
  sessionStorage.setItem('menuTree', JSON.stringify(layoutMenus))
597
598
 
598
599
  let relaNos = siteTree2RelaNos(data)
599
- sessionStorage.setItem('relaNos', JSON.stringify(relaNos))
600
+ // sessionStorage.setItem('relaNos', JSON.stringify(relaNos))
601
+ setItem('relaNos', relaNos)
600
602
 
601
603
  // XXX: 兼容旧版resources
602
- sessionStorage.setItem('resources', JSON.stringify(data))
604
+ // sessionStorage.setItem('resources', JSON.stringify(data))
605
+ setItem('resources', data)
603
606
  },
604
607
  // 新增不同单位对应不同角色,具有不同权限
605
608
  getCltRelaNos() {
606
609
  if (this.asyncRelaNos) {
607
- sessionStorage.setItem('cltrelaNos', '{}')
610
+ // sessionStorage.setItem('cltrelaNos', '{}')
611
+ setItem('cltrelaNos', {})
608
612
  return Promise.resolve()
609
613
  }
610
614
 
@@ -621,7 +625,8 @@ export default {
621
625
  cltrelaMap.forEach((item) => {
622
626
  cltrelaNos[item.cltNo] = item.relaNos
623
627
  })
624
- sessionStorage.setItem('cltrelaNos', JSON.stringify(cltrelaNos))
628
+ // sessionStorage.setItem('cltrelaNos', JSON.stringify(cltrelaNos))
629
+ setItem('cltrelaNos', cltrelaNos)
625
630
  })
626
631
  .finally(resolve)
627
632
  })
@@ -58,3 +58,35 @@ export function colftF(colft, fMap) {
58
58
  if (typeof colft !== 'string') return colft
59
59
  return fMap[colft]
60
60
  }
61
+
62
+ export function colf_BD_F(colf, map) {
63
+ if (!colf) return undefined
64
+ if (typeof colf !== 'string') {
65
+ return ({ cellValue, row, column }) => colf(row, column, cellValue)
66
+ }
67
+ let sc = colf.split(/{.+?}/g) || []
68
+ let mc = colf.match(/{.+?}/g) || []
69
+ let mck = []
70
+ mc.forEach((t) => {
71
+ t = t.replace(/^{|\s+|}$/g, '').split('|')
72
+ mck.push(t)
73
+ })
74
+
75
+ return ({ row }) => tplFn(row, sc, mck, map)
76
+ }
77
+
78
+ export function colft_BD_F(colft, fMap, key) {
79
+ let list = undefined
80
+ if (typeof colft !== 'string') {
81
+ list = colft
82
+ } else {
83
+ list = fMap[colft]
84
+ }
85
+ if (Array.isArray(list)) {
86
+ return list.map((item) => ({
87
+ label: item.text,
88
+ data: { count: item.count },
89
+ ...item
90
+ }))
91
+ }
92
+ }
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <el-table
3
+ v-if="!bigData"
3
4
  ref="el-table"
4
5
  :key="colsKey"
5
6
  :header-cell-style="{ 'text-align': 'center' }"
@@ -23,11 +24,51 @@
23
24
  />
24
25
  </template>
25
26
  </el-table>
27
+ <ux-table
28
+ v-else
29
+ ref="ux-table"
30
+ :key="colsKey"
31
+ :header-cell-style="{ 'text-align': 'center' }"
32
+ :data="data"
33
+ :height="height"
34
+ v-bind="$attrs"
35
+ v-on="{ ...$listeners, 'filter-change': bigFilter, 'expand-change': bigExpand }"
36
+ >
37
+ <template v-for="(item, i) in columns">
38
+ <slot v-if="item.slotName" :name="item.slotName" :column="item" :big-data="bigData"></slot>
39
+ <ux-table-column
40
+ v-else-if="item.render"
41
+ :key="'cl-table-' + i"
42
+ :filters="item.filters | colft_BD_F(filtersMap)"
43
+ :class-name="item | colKey"
44
+ :field="item.prop"
45
+ :title="item.label"
46
+ :type="item.type | typeF"
47
+ :show-overflow="item | overflowF"
48
+ v-bind="item"
49
+ >
50
+ <columnRender slot-scope="{ row, $rowIndex }" :c-render="item.render" :row="row" :index="$rowIndex" />
51
+ </ux-table-column>
52
+
53
+ <ux-table-column
54
+ v-else
55
+ :key="'cl-table-' + i"
56
+ :formatter="item.formatter | colf_BD_F(item.formatterMap)"
57
+ :filters="item.filters | colft_BD_F(filtersMap)"
58
+ :class-name="item | colKey"
59
+ :field="item.prop"
60
+ :title="item.label"
61
+ :type="item.type | typeF"
62
+ :show-overflow="item | overflowF"
63
+ v-bind="item"
64
+ />
65
+ </template>
66
+ </ux-table>
26
67
  </template>
27
68
 
28
69
  <script>
29
- import { $lc } from '../../utils/i18n/index'
30
- import { colfF, colftF } from './filters'
70
+ // import { $lc } from '../../utils/i18n/index'
71
+ import { colfF, colftF, colf_BD_F, colft_BD_F } from './filters'
31
72
 
32
73
  const columnRender = {
33
74
  props: {
@@ -53,9 +94,25 @@ export default {
53
94
  },
54
95
  filters: {
55
96
  colfF,
56
- colftF
97
+ colftF,
98
+ typeF(type) {
99
+ return type && type === 'selection' ? 'checkbox' : type
100
+ },
101
+ overflowF(item) {
102
+ return item.showOverflowTooltip || item['show-overflow-tooltip'] ? 'tooltip' : 'ellipsis'
103
+ },
104
+ colf_BD_F,
105
+ colft_BD_F,
106
+ colKey(item) {
107
+ let key = item.columnKey || item['column-key']
108
+ return key ? 'key@' + key : ''
109
+ }
57
110
  },
58
111
  props: {
112
+ bigData: {
113
+ type: Boolean,
114
+ default: false
115
+ },
59
116
  column: {
60
117
  type: Boolean,
61
118
  default: false
@@ -91,24 +148,71 @@ export default {
91
148
  colsKey: 0
92
149
  }
93
150
  },
151
+ provide() {
152
+ let bigData = this.bigData
153
+ return {
154
+ bigData
155
+ }
156
+ },
94
157
  watch: {
95
158
  columns() {
96
159
  this.colsKey = this.colsKey + 1
97
160
  }
98
161
  },
99
162
  mounted() {
100
- let inTable = this.$refs['el-table']
101
- if (inTable) {
102
- this.$refs['table'] = inTable
103
- this.clearSelection = inTable.clearSelection
104
- this.toggleRowSelection = inTable.toggleRowSelection
105
- this.toggleAllSelection = inTable.toggleAllSelection
106
- this.toggleRowExpansion = inTable.toggleRowExpansion
107
- this.setCurrentRow = inTable.setCurrentRow
108
- this.clearSort = inTable.clearSort
109
- this.clearFilter = inTable.clearFilter
110
- this.doLayout = inTable.doLayout
111
- this.sort = inTable.sort
163
+ if (!this.bigData) {
164
+ let inTable = this.$refs['el-table']
165
+ if (inTable) {
166
+ this.$refs['table'] = inTable
167
+ this.clearSelection = inTable.clearSelection
168
+ this.toggleRowSelection = inTable.toggleRowSelection
169
+ this.toggleAllSelection = inTable.toggleAllSelection
170
+ this.toggleRowExpansion = inTable.toggleRowExpansion
171
+ this.setCurrentRow = inTable.setCurrentRow
172
+ this.clearSort = inTable.clearSort
173
+ this.clearFilter = inTable.clearFilter
174
+ this.doLayout = inTable.doLayout
175
+ this.sort = inTable.sort
176
+ }
177
+ } else {
178
+ let inTable = this.$refs['ux-table']
179
+ if (inTable) {
180
+ this.$refs['table'] = inTable
181
+ this.clearSelection = inTable.clearSelection
182
+ this.toggleRowSelection = function (row, selected) {
183
+ inTable.toggleRowSelection([{ row, selected }])
184
+ }
185
+ this.toggleAllSelection = inTable.toggleAllSelection
186
+ this.toggleRowExpansion = inTable.toggleRowExpansion
187
+ this.setCurrentRow = inTable.setCurrentRow
188
+ this.clearSort = inTable.clearSort
189
+ this.clearFilter = inTable.clearFilter
190
+ //
191
+ this.doLayout = inTable.loadData
192
+ this.sort = inTable.sort
193
+ }
194
+ }
195
+ },
196
+ methods: {
197
+ bigFilter(arg) {
198
+ let filters = arg.filters || []
199
+ let elFilters = {}
200
+ filters.forEach((item) => {
201
+ let key = item.column.className
202
+ if (key && typeof key === 'string') {
203
+ let _key = key.split(',').find((s) => s.includes('key@'))
204
+
205
+ if (_key) _key = _key.replace('key@', '')
206
+
207
+ if (_key) key = _key
208
+ }
209
+
210
+ elFilters[key || item.property] = item.column.filterMultiple ? item.values : item.values[0]
211
+ })
212
+ this.$emit('filter-change', elFilters, arg)
213
+ },
214
+ bigExpand(arg) {
215
+ this.$emit('expand-change', arg.row, arg.expanded, arg)
112
216
  }
113
217
  }
114
218
  }
@@ -1,17 +1,21 @@
1
1
  <template>
2
- <el-table-column v-bind="$attrs">
2
+ <el-table-column v-if="!bigData" v-bind="$attrs">
3
3
  <OperateBtns slot-scope="{ row, $index }" :btn-list="btnList" :row="row" @command="(c) => $emit(c, row, $index)" />
4
4
  </el-table-column>
5
+ <ux-table-column v-else :field="$attrs.prop" :title="$attrs.label" v-bind="$attrs">
6
+ <OperateBtns slot-scope="{ row, $index }" :btn-list="btnList" :row="row" @command="(c) => $emit(c, row, $index)" />
7
+ </ux-table-column>
5
8
  </template>
6
9
 
7
10
  <script>
8
- import { $lc } from '../../utils/i18n/index'
11
+ // import { $lc } from '../../utils/i18n/index'
9
12
  import OperateBtns from './OperateBtns.vue'
10
13
  export default {
11
14
  name: 'TableOperateColumn',
12
15
  components: {
13
16
  OperateBtns
14
17
  },
18
+ inject: ['bigData'],
15
19
  props: {
16
20
  btnList: {
17
21
  type: Array,