t20-common-lib 0.9.14 → 0.10.0

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 (41) 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/form-page/index.js +8 -8
  7. package/packages/form-page/src/main.vue +55 -55
  8. package/packages/input-number/index.js +8 -0
  9. package/packages/input-number/src/main.vue +184 -0
  10. package/packages/main-page/index.js +8 -8
  11. package/packages/main-page/src/main.vue +43 -43
  12. package/packages/multi-currency-statistics/index.js +8 -8
  13. package/packages/multi-currency-statistics/src/main.vue +229 -229
  14. package/packages/page-header/index.js +8 -8
  15. package/packages/page-header/src/main.vue +95 -95
  16. package/packages/statis-card/index.js +8 -8
  17. package/packages/statis-card/src/main.vue +250 -250
  18. package/packages/tab-page/index.js +8 -8
  19. package/packages/tab-page/src/main.vue +101 -101
  20. package/packages/tab-pane/index.js +8 -8
  21. package/packages/tab-pane/src/main.vue +185 -185
  22. package/packages/table-page/index.js +8 -8
  23. package/packages/table-page/src/main.vue +42 -42
  24. package/packages/theme-chalk/src/common/element-variables.scss +1045 -1045
  25. package/packages/theme-chalk/src/common/normalize.scss +869 -869
  26. package/packages/theme-chalk/src/index.scss +8 -8
  27. package/src/api/common.js +20 -20
  28. package/src/i18n.json +4 -4
  29. package/src/index.js +75 -71
  30. package/src/store/index.js +25 -25
  31. package/src/store/modules/user.js +42 -42
  32. package/src/utils/asciiWidth.js +107 -107
  33. package/src/utils/common.js +12 -12
  34. package/src/utils/date.js +43 -43
  35. package/src/utils/exportFile.js +6 -6
  36. package/src/utils/i18n/cn2hk.json +1270 -1270
  37. package/src/utils/i18n/index.js +69 -69
  38. package/src/utils/repairElementUI.js +141 -141
  39. package/src/utils/tableCellUtils.js +54 -54
  40. package/src/utils/tableheaderFilterpanel.vue +257 -257
  41. package/style/index.css +25 -25
@@ -1,44 +1,44 @@
1
- <template>
2
- <div class="flex-column main-page">
3
- <div v-if="$slots.header" class="header">
4
- <slot name="header"></slot>
5
- </div>
6
- <div v-if="$slots.card || $slots.tab" style="position: relative;">
7
- <slot name="card"></slot>
8
- <div class="tab" v-if="$slots.tab">
9
- <slot name="tab"></slot>
10
- </div>
11
- </div>
12
- <div class="bg-white flex-1 overflow">
13
- <slot></slot>
14
- </div>
15
- </div>
16
- </template>
17
-
18
- <script>
19
- export default {
20
- name: 'MainPage'
21
- }
22
- </script>
23
-
24
- <style lang="scss" scoped>
25
- .tab {
26
- position: absolute;
27
- bottom: -40px;
28
- left: 8px;
29
- }
30
-
31
- .bg-white {
32
- background-color: #fff !important;
33
- }
34
-
35
- .header {
36
- height: 32px;
37
- line-height: 32px;
38
- }
39
-
40
- .main-page {
41
- padding: 0 !important;
42
- background: #f0f2f5;
43
- }
1
+ <template>
2
+ <div class="flex-column main-page">
3
+ <div v-if="$slots.header" class="header">
4
+ <slot name="header"></slot>
5
+ </div>
6
+ <div v-if="$slots.card || $slots.tab" style="position: relative;">
7
+ <slot name="card"></slot>
8
+ <div class="tab" v-if="$slots.tab">
9
+ <slot name="tab"></slot>
10
+ </div>
11
+ </div>
12
+ <div class="bg-white flex-1 overflow">
13
+ <slot></slot>
14
+ </div>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'MainPage'
21
+ }
22
+ </script>
23
+
24
+ <style lang="scss" scoped>
25
+ .tab {
26
+ position: absolute;
27
+ bottom: -40px;
28
+ left: 8px;
29
+ }
30
+
31
+ .bg-white {
32
+ background-color: #fff !important;
33
+ }
34
+
35
+ .header {
36
+ height: 32px;
37
+ line-height: 32px;
38
+ }
39
+
40
+ .main-page {
41
+ padding: 0 !important;
42
+ background: #f0f2f5;
43
+ }
44
44
  </style>
@@ -1,8 +1,8 @@
1
- import MultiCurrencyStatistics from './src/main';
2
-
3
- /* istanbul ignore next */
4
- MultiCurrencyStatistics.install = function(Vue) {
5
- Vue.component(MultiCurrencyStatistics.name, MultiCurrencyStatistics);
6
- };
7
-
8
- export default MultiCurrencyStatistics;
1
+ import MultiCurrencyStatistics from './src/main';
2
+
3
+ /* istanbul ignore next */
4
+ MultiCurrencyStatistics.install = function(Vue) {
5
+ Vue.component(MultiCurrencyStatistics.name, MultiCurrencyStatistics);
6
+ };
7
+
8
+ export default MultiCurrencyStatistics;
@@ -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;