n20-common-lib 2.2.5 → 2.2.7

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.5",
3
+ "version": "2.2.7",
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,99 @@
1
+ .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
+ }
45
+
46
+ .elx-cell--sort {
47
+ display: inline-flex;
48
+ flex-direction: row-reverse;
49
+ align-items: center;
50
+ width: 16px;
51
+ height: 16px;
52
+ line-height: 16px;
53
+ vertical-align: middle;
54
+ cursor: pointer;
55
+ }
56
+ .elx-sort--asc-btn,
57
+ .elx-sort--desc-btn {
58
+ width: 8px;
59
+ height: 16px;
60
+ border: none;
61
+ font-style: normal;
62
+ position: static;
63
+ &:before {
64
+ content: '\e61c';
65
+ font-family: 'core-lib-iconfont';
66
+ font-size: 12px;
67
+ line-height: 12px;
68
+ position: relative;
69
+ left: auto;
70
+ top: 1px;
71
+ right: 3px;
72
+ bottom: auto;
73
+ border: none;
74
+ }
75
+ &:hover {
76
+ color: $--color-primary-light-6;
77
+ }
78
+ &.sort--active {
79
+ color: $--color-primary;
80
+ }
81
+ }
82
+ .elx-sort--desc-btn:before {
83
+ content: '\e61d';
84
+ font-family: 'core-lib-iconfont';
85
+ position: relative;
86
+ right: 1px;
87
+ }
88
+ .elx-cell--filter {
89
+ padding-left: 0;
90
+ }
91
+ .elx-table--filter-wrapper {
92
+ margin-top: 16px;
93
+ }
94
+ .filter--active {
95
+ .elx-cell--title {
96
+ color: $--color-primary;
97
+ }
98
+ }
99
+ }
@@ -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() {
@@ -19,10 +19,14 @@
19
19
  <script>
20
20
  import { $lc } from '../../utils/i18n/index'
21
21
  let disabledDate_1 = (t) => {
22
- return t < Date.now() - 86400000
22
+ let now = new Date()
23
+ now.setHours(0, 0, -1)
24
+ return t < now
23
25
  }
24
26
  let disabledDate_2 = (t) => {
25
- return t >= Date.now()
27
+ let now = new Date()
28
+ now.setHours(23, 59, 59)
29
+ return t > now
26
30
  }
27
31
  let shortcuts_1 = [
28
32
  {
@@ -120,10 +124,6 @@ export default {
120
124
  type: [String, Number, Date],
121
125
  default: undefined
122
126
  },
123
- valueFormat: {
124
- type: String,
125
- default: 'yyyy-MM-dd'
126
- },
127
127
  startDate: {
128
128
  type: [String, Number, Date],
129
129
  default: null
@@ -132,6 +132,10 @@ export default {
132
132
  type: [String, Number, Date],
133
133
  default: null
134
134
  },
135
+ valueFormat: {
136
+ type: String,
137
+ default: 'yyyy-MM-dd'
138
+ },
135
139
  minNow: {
136
140
  type: Boolean,
137
141
  default: false
@@ -140,7 +144,7 @@ export default {
140
144
  type: Boolean,
141
145
  default: false
142
146
  },
143
- showShortcut: {
147
+ shortcuts: {
144
148
  type: Boolean,
145
149
  default: true
146
150
  },
@@ -155,8 +159,8 @@ export default {
155
159
  },
156
160
  data() {
157
161
  let shortcuts = undefined
158
- if (['date', 'datetime'].includes(this.type)) shortcuts = shortcuts_1
159
- if (['daterange', 'datetimerange'].includes(this.type)) shortcuts = shortcuts_2
162
+ if (this.shortcuts && ['date', 'datetime'].includes(this.type)) shortcuts = shortcuts_1
163
+ if (this.shortcuts && ['daterange', 'datetimerange'].includes(this.type)) shortcuts = shortcuts_2
160
164
 
161
165
  this.pickerOptionsAs = Object.assign(
162
166
  {
@@ -184,9 +188,30 @@ export default {
184
188
  },
185
189
  set(val) {
186
190
  if (['daterange', 'monthrange', 'datetimerange'].includes(this.type)) {
187
- this.$emit('update:start-date', val ? val[0] : null)
188
- this.$emit('update:end-date', val ? val[1] : null)
189
- this.$emit('change', val)
191
+ if (val && val[0]) {
192
+ if (this.type === 'monthrange' && ['yyyy-MM-dd', 'yyyy-MM-dd HH:mm:ss'].includes(this.valueFormat)) {
193
+ let end = new Date(val[1])
194
+ end.setMonth(end.getMonth() + 1)
195
+ end.setDate(0)
196
+ let Y = end.getFullYear()
197
+ let M = end.getMonth() + 1
198
+ let D = end.getDate()
199
+ let str = `${Y}-${M > 9 ? M : '0' + M}-${D > 9 ? D : '0' + D}`
200
+ if (this.valueFormat === 'yyyy-MM-dd HH:mm:ss') str = str + ' 23:59:59'
201
+
202
+ this.$emit('update:start-date', val[0])
203
+ this.$emit('update:end-date', str)
204
+ this.$emit('change', [val[0], str])
205
+ } else {
206
+ this.$emit('update:start-date', val[0])
207
+ this.$emit('update:end-date', val[1])
208
+ this.$emit('change', val)
209
+ }
210
+ } else {
211
+ this.$emit('update:start-date', null)
212
+ this.$emit('update:end-date', null)
213
+ this.$emit('change', val)
214
+ }
190
215
  } else {
191
216
  this.$emit('input', val)
192
217
  this.$emit('change', val)
@@ -55,6 +55,7 @@
55
55
  </template>
56
56
 
57
57
  <script>
58
+ // TODO: 双休绑定数值格式不统一
58
59
  import datePicker from '../DatePicker/index.vue'
59
60
  import quarterDatePicker from './quarterDatePicker'
60
61
  import dayjs from 'dayjs'
@@ -108,7 +109,6 @@ export default {
108
109
  break
109
110
  case '月':
110
111
  this.month = dayjs(this.value.startDate).format('YYYY-MM')
111
- console.log(this.month)
112
112
  break
113
113
  case '季':
114
114
  this.quarter = this.value
@@ -58,3 +58,31 @@ 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) {
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) => ({ ...item, label: item.text }))
87
+ }
88
+ }
@@ -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,45 @@
23
24
  />
24
25
  </template>
25
26
  </el-table>
27
+ <ux-table
28
+ v-else
29
+ :key="colsKey"
30
+ :header-cell-style="{ 'text-align': 'center' }"
31
+ :data="data"
32
+ :height="height"
33
+ v-bind="$attrs"
34
+ v-on="$listeners"
35
+ >
36
+ <template v-for="(item, i) in columns">
37
+ <slot v-if="item.slotName" :name="item.slotName" :column="item"></slot>
38
+ <ux-table-column
39
+ v-else-if="item.render"
40
+ :key="'cl-table-' + i"
41
+ :field="item.prop"
42
+ :title="item.label"
43
+ :type="item.type | typeF"
44
+ v-bind="item"
45
+ >
46
+ <columnRender slot-scope="{ row, $index }" :c-render="item.render" :row="row" :index="$index" />
47
+ </ux-table-column>
48
+
49
+ <ux-table-column
50
+ v-else
51
+ :key="'cl-table-' + i"
52
+ :formatter="item.formatter | colf_BD_F(item.formatterMap)"
53
+ :filters="item.filters | colft_BD_F(filtersMap)"
54
+ :field="item.prop"
55
+ :title="item.label"
56
+ :type="item.type | typeF"
57
+ v-bind="item"
58
+ />
59
+ </template>
60
+ </ux-table>
26
61
  </template>
27
62
 
28
63
  <script>
29
- import { $lc } from '../../utils/i18n/index'
30
- import { colfF, colftF } from './filters'
64
+ // import { $lc } from '../../utils/i18n/index'
65
+ import { colfF, colftF, colf_BD_F, colft_BD_F } from './filters'
31
66
 
32
67
  const columnRender = {
33
68
  props: {
@@ -53,9 +88,18 @@ export default {
53
88
  },
54
89
  filters: {
55
90
  colfF,
56
- colftF
91
+ colftF,
92
+ typeF(type) {
93
+ return type && type === 'selection' ? 'checkbox' : type
94
+ },
95
+ colf_BD_F,
96
+ colft_BD_F
57
97
  },
58
98
  props: {
99
+ bigData: {
100
+ type: Boolean,
101
+ default: false
102
+ },
59
103
  column: {
60
104
  type: Boolean,
61
105
  default: false
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <div
3
+ class="elx-table--filter-wrapper filter--prevent-default p-a"
4
+ :class="{
5
+ 't--animat': $parent.animat,
6
+ 'is--multiple': filterStore.multiple,
7
+ 'filter--active': filterStore.visible
8
+ }"
9
+ :style="filterStore.style"
10
+ >
11
+ <slot v-if="filterStore.visible">
12
+ <el-input
13
+ v-model="searchVal"
14
+ class="input-w m-b"
15
+ :placeholder="'请输入' | $lc"
16
+ clearable
17
+ suffix-icon="el-icon-search"
18
+ />
19
+ <div v-if="filterStore.multiple">
20
+ <el-checkbox v-model="allCheck" :label="true" :indeterminate="indeterminate">全部</el-checkbox>
21
+ <div class="input-w p-b-s" style="max-height: 226px; overflow: auto">
22
+ <template v-for="filter in filters">
23
+ <el-checkbox
24
+ v-if="filter.label.includes(searchVal)"
25
+ :key="filter.value"
26
+ v-model="filter.checked"
27
+ class="m-t-s m-r-0"
28
+ style="display: block"
29
+ >
30
+ <span class="align-bottom">{{ filter.label }}</span>
31
+ </el-checkbox>
32
+ </template>
33
+ </div>
34
+ </div>
35
+ <div v-else>
36
+ <ul class="el-table-filter__list">
37
+ <li class="el-table-filter__list-item text-l" :class="{ 'is-active': !allCheck }">全部</li>
38
+ </ul>
39
+ <ul class="el-table-filter__list" style="max-height: 226px; overflow: auto">
40
+ <template v-for="filter in filters">
41
+ <li
42
+ v-if="filter.label.includes(searchVal)"
43
+ :key="filter.value"
44
+ class="el-table-filter__list-item text-l"
45
+ :class="{ 'is-active': filter.checked }"
46
+ @click="filter.checked = !filter.checked"
47
+ >
48
+ <span class="text-ellipsis align-bottom" style="display: inline-block; max-width: 12em">{{
49
+ filter.label
50
+ }}</span>
51
+ </li>
52
+ </template>
53
+ </ul>
54
+ </div>
55
+ </slot>
56
+ </div>
57
+ </template>
58
+
59
+ <script>
60
+ import { $lc } from '../../utils/i18n/index'
61
+ export default {
62
+ name: 'ElxTableFilter',
63
+ props: {
64
+ filterStore: { type: Object, default: () => ({}) }
65
+ },
66
+ data() {
67
+ return {
68
+ searchVal: '',
69
+ filteredValue: []
70
+ }
71
+ },
72
+ computed: {
73
+ column() {
74
+ return this.filterStore.column || {}
75
+ },
76
+ filters() {
77
+ return this.filterStore.options
78
+ // _checked
79
+ },
80
+ multiple() {
81
+ return this.filterStore.multiple
82
+ },
83
+ indeterminate() {
84
+ return this.filterStore.isIndeterminate
85
+ },
86
+ allCheck: {
87
+ get() {
88
+ return this.filterStore.isAllSelected
89
+ },
90
+ set(val) {
91
+ this.filterStore.isAllSelected = val
92
+ }
93
+ }
94
+ },
95
+ watch: {
96
+ 'filterStore.visible': {
97
+ handler() {
98
+ console.log(this.filterStore, 1212)
99
+ }
100
+ }
101
+ },
102
+ mounted() {},
103
+ methods: {}
104
+ }
105
+ </script>