t20-common-lib 0.9.14 → 0.10.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 (43) hide show
  1. package/package.json +64 -86
  2. package/packages/branch-bank-select/index.js +8 -8
  3. package/packages/branch-bank-select/src/main.vue +179 -179
  4. package/packages/common-collapse/index.js +8 -8
  5. package/packages/common-collapse/src/main.vue +147 -147
  6. package/packages/date-picker-por/index.js +8 -0
  7. package/packages/date-picker-por/src/main.vue +306 -0
  8. package/packages/form-page/index.js +8 -8
  9. package/packages/form-page/src/main.vue +55 -55
  10. package/packages/input-number/index.js +8 -0
  11. package/packages/input-number/src/main.vue +184 -0
  12. package/packages/main-page/index.js +8 -8
  13. package/packages/main-page/src/main.vue +43 -43
  14. package/packages/multi-currency-statistics/index.js +8 -8
  15. package/packages/multi-currency-statistics/src/main.vue +229 -229
  16. package/packages/page-header/index.js +8 -8
  17. package/packages/page-header/src/main.vue +95 -95
  18. package/packages/statis-card/index.js +8 -8
  19. package/packages/statis-card/src/main.vue +250 -250
  20. package/packages/tab-page/index.js +8 -8
  21. package/packages/tab-page/src/main.vue +101 -101
  22. package/packages/tab-pane/index.js +8 -8
  23. package/packages/tab-pane/src/main.vue +185 -185
  24. package/packages/table-page/index.js +8 -8
  25. package/packages/table-page/src/main.vue +42 -42
  26. package/packages/theme-chalk/src/common/element-variables.scss +1045 -1045
  27. package/packages/theme-chalk/src/common/normalize.scss +869 -869
  28. package/packages/theme-chalk/src/index.scss +8 -8
  29. package/src/api/common.js +20 -20
  30. package/src/i18n.json +4 -4
  31. package/src/index.js +78 -71
  32. package/src/store/index.js +25 -25
  33. package/src/store/modules/user.js +42 -42
  34. package/src/utils/asciiWidth.js +107 -107
  35. package/src/utils/common.js +12 -12
  36. package/src/utils/date.js +43 -43
  37. package/src/utils/exportFile.js +6 -6
  38. package/src/utils/i18n/cn2hk.json +1270 -1270
  39. package/src/utils/i18n/index.js +69 -69
  40. package/src/utils/repairElementUI.js +141 -141
  41. package/src/utils/tableCellUtils.js +54 -54
  42. package/src/utils/tableheaderFilterpanel.vue +257 -257
  43. package/style/index.css +25 -25
@@ -1,229 +1,229 @@
1
- <template>
2
- <div class="footer-static flex-box">
3
- <N20-statis-popover v-if="!onlyAll" class="m-r-s" :lists="selectStatistics" :countLabel="[$l('笔数')]" :total="selectTotal"/>
4
- <N20-statis-popover :lists="allStatistics" :countLabel="[$l('笔数')]" :total="multipleTotal"/>
5
- </div>
6
- </template>
7
- <script>
8
- export default {
9
- name: 'MultiCurrencyStatistics',
10
- props: {
11
- views: {
12
- type: Array,
13
- default: () => []
14
- },
15
- config: {
16
- type: Array,
17
- default: () => []
18
- },
19
- // 选中的数据
20
- selected: {
21
- type: Array,
22
- default: () => []
23
- },
24
- // 数据是否是在币种列表中
25
- isMultiple: {
26
- type: Boolean,
27
- default: false
28
- },
29
- multipleKey: {
30
- type: String,
31
- default: 'curreyNoList'
32
- },
33
- onlyAll: {
34
- type: Boolean,
35
- default: false
36
- },
37
- multipleTotal: {
38
- type: Number,
39
- default: 0
40
- }
41
- },
42
- data() {
43
- return {
44
- allStatistics: [],
45
- selectStatistics: [],
46
- selectStatisticsTpl: [],
47
- selectTotal: 0
48
- }
49
- },
50
- watch: {
51
- selected: {
52
- deep: true,
53
- immediate: true,
54
- handler() {
55
- this.calculationSelected()
56
- }
57
- },
58
- views: {
59
- deep: true,
60
- immediate: true,
61
- handler() {
62
- this.generateStatistics()
63
- }
64
- }
65
- },
66
- methods: {
67
- /**
68
- * 计算已选数据
69
- */
70
- calculationSelected() {
71
- this.selectTotal = 0
72
- if (!this.selected.length) {
73
- this.selectStatistics = [this.selectStatisticsTpl[0]]
74
- return
75
- }
76
- let selectedList = []
77
- this.selectStatistics = []
78
- this.selectTotal = this.selected.length
79
- if (this.isMultiple) {
80
- const arr = []
81
- this.selected.forEach(item => {
82
- if (item[this.multipleKey] && !arr.includes(item.accountNo)) {
83
- item[this.multipleKey].forEach(currency => {
84
- selectedList.push({...item, ...currency, [this.multipleKey]: undefined})
85
- })
86
- }
87
- if (!arr.includes(item.accountNo)) {
88
- arr.push(item.accountNo)
89
- }
90
- })
91
- this.selectTotal = arr.length
92
- } else {
93
- selectedList = this.selected
94
- }
95
-
96
- this.selectStatisticsTpl.forEach((statistic) => {
97
- const coins = selectedList.filter(item => {
98
- return item.currencyName === statistic.title
99
- })
100
-
101
- if (coins.length) {
102
- const statis = [
103
- {
104
- type: this.$l('已选合计'), //已选合计
105
- list: this.config.map(c => ({
106
- label: c.label,
107
- value: (() => {
108
- if (c.label === this.$l('笔数')) {
109
- //笔|条 数
110
- return coins.length
111
- }
112
- return coins.reduce((amount, item) => amount + item[c.key], 0)
113
- })()
114
- }))
115
- }
116
- ]
117
- this.selectStatistics.push({...statistic, statis})
118
- }
119
- })
120
- },
121
- uniqueByAccountNo(arr) {
122
- return arr.reduce((acc, current) => {
123
- const exists = acc.some(item => item.accountNo === current.accountNo);
124
- if (!exists) {
125
- acc.push(current);
126
- }
127
- return acc;
128
- }, []);
129
- },
130
- /**
131
- * 构造底部统计数据
132
- */
133
- generateStatistics() {
134
- this.selectTotal = 0
135
- if (!this.views.length) {
136
- this.allStatistics = [{
137
- title: this.$l('人民币'),
138
- statis: [
139
- {
140
- type: this.$l('全部合计'),
141
- list: this.config.map(c => ({label: c.label, value: 0}))
142
- }
143
- ]
144
- }]
145
- this.selectStatistics = [{
146
- title: this.$l('人民币'),
147
- statis: [
148
- {
149
- type: this.$l('已选合计'),
150
- list: this.config.map(c => ({label: c.label, value: 0}))
151
- }
152
- ]
153
- }]
154
- this.selectStatisticsTpl = [{
155
- title: this.$l('人民币'),
156
- statis: [
157
- {
158
- type: this.$l('已选合计'),
159
- list: this.config.map(c => ({label: c.label, value: 0}))
160
- }
161
- ]
162
- }]
163
- return
164
- }
165
- const allStatistics = []
166
- const selectedStatistics = []
167
- this.views.forEach(item => {
168
- allStatistics.push({
169
- title: item.currencyName,
170
- currencyNo: item.currencyNo,
171
- statis: [
172
- {
173
- type: this.$l('全部合计'), //全部合计
174
- list: this.config.map(c => ({label: c.label, value: item[c.code] || '0'}))
175
- }
176
- ]
177
- })
178
- selectedStatistics.push({
179
- title: item.currencyName,
180
- currencyNo: item.currencyNo,
181
- statis: [
182
- {
183
- type: this.$l('已选合计'), //已选合计
184
- list: this.config.map(c => ({label: c.label, value: 0}))
185
- }
186
- ]
187
- })
188
- })
189
- this.allStatistics = this.sortCurrencyToFront(allStatistics)
190
- this.selectStatisticsTpl = this.sortCurrencyToFront(selectedStatistics)
191
- this.selectStatistics = [this.sortCurrencyToFront(selectedStatistics)[0]]
192
- // 回调一次计算已选合计的过程,处理一个接口导致的全部合计再次刷新的问题
193
- this.$nextTick(()=>{
194
- this.calculationSelected()
195
- })
196
- },
197
- sortCurrencyToFront(data) {
198
- let currencyNo = 'CNY'
199
- if (this.$store && this.$store.state && this.$store.state.user && this.$store.state.user.defaultCurrencyNo) {
200
- currencyNo = this.$store.state.user.defaultCurrencyNo
201
- }
202
- // 创建一个新数组以避免修改原数组
203
- const newArray = [...data];
204
-
205
- // 查找匹配的货币索引
206
- const index = newArray.findIndex(item =>
207
- item.currencyNo && item.currencyNo.trim().toUpperCase() === currencyNo.trim().toUpperCase()
208
- );
209
-
210
- // 如果找到匹配项
211
- if (index > -1) {
212
- // 从数组中移除匹配项
213
- const [matchedItem] = newArray.splice(index, 1);
214
- // 将匹配项添加到数组开头
215
- newArray.unshift(matchedItem);
216
- }
217
-
218
- return newArray;
219
- }
220
- }
221
- }
222
- </script>
223
-
224
- <style scoped lang="scss">
225
- .footer-static{
226
- flex: 1;
227
- flex-wrap: wrap;
228
- }
229
- </style>
1
+ <template>
2
+ <div class="footer-static flex-box">
3
+ <N20-statis-popover v-if="!onlyAll" class="m-r-s" :lists="selectStatistics" :countLabel="[$l('笔数')]" :total="selectTotal"/>
4
+ <N20-statis-popover :lists="allStatistics" :countLabel="[$l('笔数')]" :total="multipleTotal"/>
5
+ </div>
6
+ </template>
7
+ <script>
8
+ export default {
9
+ name: 'MultiCurrencyStatistics',
10
+ props: {
11
+ views: {
12
+ type: Array,
13
+ default: () => []
14
+ },
15
+ config: {
16
+ type: Array,
17
+ default: () => []
18
+ },
19
+ // 选中的数据
20
+ selected: {
21
+ type: Array,
22
+ default: () => []
23
+ },
24
+ // 数据是否是在币种列表中
25
+ isMultiple: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ multipleKey: {
30
+ type: String,
31
+ default: 'curreyNoList'
32
+ },
33
+ onlyAll: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ multipleTotal: {
38
+ type: Number,
39
+ default: 0
40
+ }
41
+ },
42
+ data() {
43
+ return {
44
+ allStatistics: [],
45
+ selectStatistics: [],
46
+ selectStatisticsTpl: [],
47
+ selectTotal: 0
48
+ }
49
+ },
50
+ watch: {
51
+ selected: {
52
+ deep: true,
53
+ immediate: true,
54
+ handler() {
55
+ this.calculationSelected()
56
+ }
57
+ },
58
+ views: {
59
+ deep: true,
60
+ immediate: true,
61
+ handler() {
62
+ this.generateStatistics()
63
+ }
64
+ }
65
+ },
66
+ methods: {
67
+ /**
68
+ * 计算已选数据
69
+ */
70
+ calculationSelected() {
71
+ this.selectTotal = 0
72
+ if (!this.selected.length) {
73
+ this.selectStatistics = [this.selectStatisticsTpl[0]]
74
+ return
75
+ }
76
+ let selectedList = []
77
+ this.selectStatistics = []
78
+ this.selectTotal = this.selected.length
79
+ if (this.isMultiple) {
80
+ const arr = []
81
+ this.selected.forEach(item => {
82
+ if (item[this.multipleKey] && !arr.includes(item.accountNo)) {
83
+ item[this.multipleKey].forEach(currency => {
84
+ selectedList.push({...item, ...currency, [this.multipleKey]: undefined})
85
+ })
86
+ }
87
+ if (!arr.includes(item.accountNo)) {
88
+ arr.push(item.accountNo)
89
+ }
90
+ })
91
+ this.selectTotal = arr.length
92
+ } else {
93
+ selectedList = this.selected
94
+ }
95
+
96
+ this.selectStatisticsTpl.forEach((statistic) => {
97
+ const coins = selectedList.filter(item => {
98
+ return item.currencyName === statistic.title
99
+ })
100
+
101
+ if (coins.length) {
102
+ const statis = [
103
+ {
104
+ type: this.$l('已选合计'), //已选合计
105
+ list: this.config.map(c => ({
106
+ label: c.label,
107
+ value: (() => {
108
+ if (c.label === this.$l('笔数')) {
109
+ //笔|条 数
110
+ return coins.length
111
+ }
112
+ return coins.reduce((amount, item) => amount + item[c.key], 0)
113
+ })()
114
+ }))
115
+ }
116
+ ]
117
+ this.selectStatistics.push({...statistic, statis})
118
+ }
119
+ })
120
+ },
121
+ uniqueByAccountNo(arr) {
122
+ return arr.reduce((acc, current) => {
123
+ const exists = acc.some(item => item.accountNo === current.accountNo);
124
+ if (!exists) {
125
+ acc.push(current);
126
+ }
127
+ return acc;
128
+ }, []);
129
+ },
130
+ /**
131
+ * 构造底部统计数据
132
+ */
133
+ generateStatistics() {
134
+ this.selectTotal = 0
135
+ if (!this.views.length) {
136
+ this.allStatistics = [{
137
+ title: this.$l('人民币'),
138
+ statis: [
139
+ {
140
+ type: this.$l('全部合计'),
141
+ list: this.config.map(c => ({label: c.label, value: 0}))
142
+ }
143
+ ]
144
+ }]
145
+ this.selectStatistics = [{
146
+ title: this.$l('人民币'),
147
+ statis: [
148
+ {
149
+ type: this.$l('已选合计'),
150
+ list: this.config.map(c => ({label: c.label, value: 0}))
151
+ }
152
+ ]
153
+ }]
154
+ this.selectStatisticsTpl = [{
155
+ title: this.$l('人民币'),
156
+ statis: [
157
+ {
158
+ type: this.$l('已选合计'),
159
+ list: this.config.map(c => ({label: c.label, value: 0}))
160
+ }
161
+ ]
162
+ }]
163
+ return
164
+ }
165
+ const allStatistics = []
166
+ const selectedStatistics = []
167
+ this.views.forEach(item => {
168
+ allStatistics.push({
169
+ title: item.currencyName,
170
+ currencyNo: item.currencyNo,
171
+ statis: [
172
+ {
173
+ type: this.$l('全部合计'), //全部合计
174
+ list: this.config.map(c => ({label: c.label, value: item[c.code] || '0'}))
175
+ }
176
+ ]
177
+ })
178
+ selectedStatistics.push({
179
+ title: item.currencyName,
180
+ currencyNo: item.currencyNo,
181
+ statis: [
182
+ {
183
+ type: this.$l('已选合计'), //已选合计
184
+ list: this.config.map(c => ({label: c.label, value: 0}))
185
+ }
186
+ ]
187
+ })
188
+ })
189
+ this.allStatistics = this.sortCurrencyToFront(allStatistics)
190
+ this.selectStatisticsTpl = this.sortCurrencyToFront(selectedStatistics)
191
+ this.selectStatistics = [this.sortCurrencyToFront(selectedStatistics)[0]]
192
+ // 回调一次计算已选合计的过程,处理一个接口导致的全部合计再次刷新的问题
193
+ this.$nextTick(()=>{
194
+ this.calculationSelected()
195
+ })
196
+ },
197
+ sortCurrencyToFront(data) {
198
+ let currencyNo = 'CNY'
199
+ if (this.$store && this.$store.state && this.$store.state.user && this.$store.state.user.defaultCurrencyNo) {
200
+ currencyNo = this.$store.state.user.defaultCurrencyNo
201
+ }
202
+ // 创建一个新数组以避免修改原数组
203
+ const newArray = [...data];
204
+
205
+ // 查找匹配的货币索引
206
+ const index = newArray.findIndex(item =>
207
+ item.currencyNo && item.currencyNo.trim().toUpperCase() === currencyNo.trim().toUpperCase()
208
+ );
209
+
210
+ // 如果找到匹配项
211
+ if (index > -1) {
212
+ // 从数组中移除匹配项
213
+ const [matchedItem] = newArray.splice(index, 1);
214
+ // 将匹配项添加到数组开头
215
+ newArray.unshift(matchedItem);
216
+ }
217
+
218
+ return newArray;
219
+ }
220
+ }
221
+ }
222
+ </script>
223
+
224
+ <style scoped lang="scss">
225
+ .footer-static{
226
+ flex: 1;
227
+ flex-wrap: wrap;
228
+ }
229
+ </style>
@@ -1,8 +1,8 @@
1
- import PageHeader from './src/main';
2
-
3
- /* istanbul ignore next */
4
- PageHeader.install = function(Vue) {
5
- Vue.component(PageHeader.name, PageHeader);
6
- };
7
-
8
- export default PageHeader;
1
+ import PageHeader from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ PageHeader.install = function(Vue) {
5
+ Vue.component(PageHeader.name, PageHeader);
6
+ };
7
+
8
+ export default PageHeader;
@@ -1,96 +1,96 @@
1
- <template>
2
- <div class="t20-page-header">
3
- <div v-if="!disable" class="page-header__left" @click="$emit('back')">
4
- <i :class="icon"></i>
5
- <div class="page-header__title">
6
- <slot name="title">{{ title }}</slot>
7
- </div>
8
- </div>
9
- <div class="page-header__content">
10
- <slot name="content">{{ content }}</slot>
11
- </div>
12
- <div class="header-btn">
13
- <slot name="headerButtons"></slot>
14
- </div>
15
- </div>
16
- </template>
17
-
18
- <script>
19
- import { $lc } from '../../../src/utils/i18n/index'
20
-
21
- export default {
22
- name: 'PageHeader',
23
- props: {
24
- title: {
25
- type: String,
26
- default() {
27
- return $lc('返回')
28
- }
29
- },
30
- content: {
31
- type: String,
32
- default: ''
33
- },
34
- disable: {
35
- type: Boolean,
36
- default: false
37
- },
38
- icon: {
39
- type: String,
40
- default: 'n20-icon-yuefenqiehuan-zuoce'
41
- }
42
- }
43
- }
44
- </script>
45
-
46
- <style lang="scss" scoped>
47
- .t20-page-header {
48
- display: flex;
49
- line-height: 20px;
50
- padding-bottom: 2px;
51
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
52
-
53
- .page-header__left {
54
- display: flex;
55
- align-items: center;
56
- cursor: pointer;
57
- margin-right: 16px;
58
- position: relative;
59
- }
60
-
61
- .page-header__left:hover {
62
- color: var(--color-primary);
63
-
64
- .page-header__title {
65
- color: var(--color-primary);
66
- }
67
- }
68
-
69
- .page-header__left:after {
70
- content: '';
71
- position: absolute;
72
- width: 1px;
73
- height: 16px;
74
- right: -8px;
75
- top: 50%;
76
- transform: translateY(-50%);
77
- background-color: #dcdfe6;
78
- }
79
-
80
- .page-header__title {
81
- font-size: 14px;
82
- line-height: 20px;
83
- color: #3d4a57;
84
- }
85
-
86
- .page-header__content {
87
- font-size: 14px;
88
- line-height: 26px;
89
- color: #3d4a57;
90
- }
91
-
92
- .header-btn {
93
- margin-left: auto;
94
- }
95
- }
1
+ <template>
2
+ <div class="t20-page-header">
3
+ <div v-if="!disable" class="page-header__left" @click="$emit('back')">
4
+ <i :class="icon"></i>
5
+ <div class="page-header__title">
6
+ <slot name="title">{{ title }}</slot>
7
+ </div>
8
+ </div>
9
+ <div class="page-header__content">
10
+ <slot name="content">{{ content }}</slot>
11
+ </div>
12
+ <div class="header-btn">
13
+ <slot name="headerButtons"></slot>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ import { $lc } from '../../../src/utils/i18n/index'
20
+
21
+ export default {
22
+ name: 'PageHeader',
23
+ props: {
24
+ title: {
25
+ type: String,
26
+ default() {
27
+ return $lc('返回')
28
+ }
29
+ },
30
+ content: {
31
+ type: String,
32
+ default: ''
33
+ },
34
+ disable: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ icon: {
39
+ type: String,
40
+ default: 'n20-icon-yuefenqiehuan-zuoce'
41
+ }
42
+ }
43
+ }
44
+ </script>
45
+
46
+ <style lang="scss" scoped>
47
+ .t20-page-header {
48
+ display: flex;
49
+ line-height: 20px;
50
+ padding-bottom: 2px;
51
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
52
+
53
+ .page-header__left {
54
+ display: flex;
55
+ align-items: center;
56
+ cursor: pointer;
57
+ margin-right: 16px;
58
+ position: relative;
59
+ }
60
+
61
+ .page-header__left:hover {
62
+ color: var(--color-primary);
63
+
64
+ .page-header__title {
65
+ color: var(--color-primary);
66
+ }
67
+ }
68
+
69
+ .page-header__left:after {
70
+ content: '';
71
+ position: absolute;
72
+ width: 1px;
73
+ height: 16px;
74
+ right: -8px;
75
+ top: 50%;
76
+ transform: translateY(-50%);
77
+ background-color: #dcdfe6;
78
+ }
79
+
80
+ .page-header__title {
81
+ font-size: 14px;
82
+ line-height: 20px;
83
+ color: #3d4a57;
84
+ }
85
+
86
+ .page-header__content {
87
+ font-size: 14px;
88
+ line-height: 26px;
89
+ color: #3d4a57;
90
+ }
91
+
92
+ .header-btn {
93
+ margin-left: auto;
94
+ }
95
+ }
96
96
  </style>
@@ -1,8 +1,8 @@
1
- import StatisCard from './src/main';
2
-
3
- /* istanbul ignore next */
4
- StatisCard.install = function(Vue) {
5
- Vue.component(StatisCard.name, StatisCard);
6
- };
7
-
8
- export default StatisCard;
1
+ import StatisCard from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ StatisCard.install = function(Vue) {
5
+ Vue.component(StatisCard.name, StatisCard);
6
+ };
7
+
8
+ export default StatisCard;