@dhccmobile/vue3-lo-form 1.1.41 → 2.0.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 (165) hide show
  1. package/.env.local.bak +6 -6
  2. package/.eslintrc.js +28 -28
  3. package/README.md +70 -62
  4. package/babel.config.js +3 -3
  5. package/dist/vue3-lo-form.common.js +7700 -107778
  6. package/dist/vue3-lo-form.common.js.map +1 -1
  7. package/dist/vue3-lo-form.css +1 -1
  8. package/dist/vue3-lo-form.umd.js +7773 -107851
  9. package/dist/vue3-lo-form.umd.js.map +1 -1
  10. package/dist/vue3-lo-form.umd.min.js +1 -56
  11. package/dist/vue3-lo-form.umd.min.js.map +1 -1
  12. package/package.json +65 -61
  13. package/public/index.html +17 -17
  14. package/public/js/pinyin.ts +101 -101
  15. package/src/App.vue +741 -741
  16. package/src/components/form/DvForm.vue +642 -642
  17. package/src/components/form/DvFormLayout.vue +1569 -1569
  18. package/src/components/form/StretchText.vue +90 -90
  19. package/src/components/index.ts +3 -3
  20. package/src/constants/config/form-template.config.ts +32 -32
  21. package/src/constants/config/form.config.ts +4 -4
  22. package/src/constants/config/storage.config.ts +4 -4
  23. package/src/constants/encode-assets/svg.ts +11 -11
  24. package/src/constants/enum/builtIn-label.enum.ts +5 -5
  25. package/src/constants/enum/cache-type.enum.ts +7 -7
  26. package/src/constants/enum/control-format-type.enum.ts +9 -9
  27. package/src/constants/enum/dynamic-option-type.enum.ts +6 -6
  28. package/src/constants/enum/form-bus-attr.enum.ts +8 -8
  29. package/src/constants/enum/form-field-class.enum.ts +7 -7
  30. package/src/constants/enum/form-field-type.enum.ts +25 -25
  31. package/src/constants/enum/form-type.enum.ts +5 -5
  32. package/src/constants/enum/index.ts +19 -19
  33. package/src/constants/enum/lateral-arrangement.enum.ts +9 -9
  34. package/src/constants/enum/money-unit.enum.ts +6 -6
  35. package/src/constants/enum/option-type.enum.ts +5 -5
  36. package/src/constants/enum/submitted-type.enum.ts +32 -31
  37. package/src/constants/enum/support-upload-type.enum.ts +5 -5
  38. package/src/constants/enum/switch.enum.ts +5 -5
  39. package/src/constants/enum/upload-type.enum.ts +17 -17
  40. package/src/constants/enum/validate-rules.enum.ts +25 -25
  41. package/src/constants/enum/validate-status.enum.ts +8 -8
  42. package/src/constants/enum/vertical-arrangement.enum.ts +7 -7
  43. package/src/constants/enum/zoom-type.ts +6 -6
  44. package/src/constants/index.ts +3 -3
  45. package/src/core/FormApi.ts +1238 -1238
  46. package/src/core/index.ts +1 -1
  47. package/src/domain/AbstractControl.ts +6 -6
  48. package/src/domain/Control.ts +14 -14
  49. package/src/domain/CustomFormat.ts +6 -6
  50. package/src/domain/DesForm.ts +48 -48
  51. package/src/domain/DesFormControl.ts +241 -241
  52. package/src/domain/DesFormLayout.ts +51 -51
  53. package/src/domain/FieldChangeHistory.ts +9 -9
  54. package/src/domain/FormConfig.ts +15 -15
  55. package/src/domain/FormControl.ts +125 -125
  56. package/src/domain/FormEnum.ts +9 -9
  57. package/src/domain/FormGroup.ts +42 -42
  58. package/src/domain/FormRestfulResponse.ts +6 -6
  59. package/src/domain/ProvideInjectData.ts +10 -10
  60. package/src/domain/SysDictDetail.ts +38 -38
  61. package/src/domain/SysDictInfo.ts +40 -40
  62. package/src/domain/SysDictTreeDetail.ts +52 -52
  63. package/src/domain/index.ts +12 -12
  64. package/src/filtres/amount-capitalization.filter.ts +154 -147
  65. package/src/filtres/extract-options.filter.ts +53 -53
  66. package/src/filtres/generate-grid-column-end.filter.ts +22 -22
  67. package/src/filtres/generate-grid-template-columns.filter.ts +24 -24
  68. package/src/filtres/switch-enum-convert.filter.ts +18 -18
  69. package/src/filtres/zoom-multiple.filter.ts +32 -32
  70. package/src/index.ts +73 -73
  71. package/src/main.ts +17 -17
  72. package/src/services/api.service.ts +73 -73
  73. package/src/services/clean-local-forage.service.ts +58 -58
  74. package/src/services/date-format.service.ts +74 -74
  75. package/src/services/dict-local-forage.service.ts +58 -58
  76. package/src/services/form-bean-utils.service.ts +41 -41
  77. package/src/services/form-local-forage.service.ts +59 -59
  78. package/src/services/form-tools.service.ts +739 -659
  79. package/src/services/form-tree-node-convert.service.ts +240 -240
  80. package/src/services/form-validate.service.ts +103 -103
  81. package/src/services/index.ts +9 -9
  82. package/src/services/router.service.ts +96 -96
  83. package/src/services/validate-generator.service.ts +710 -710
  84. package/src/shims-vue.d.ts +6 -6
  85. package/src/store/dict.store.ts +63 -63
  86. package/src/store/form.store.ts +32 -32
  87. package/src/store/index.ts +2 -2
  88. package/src/styles/datePicker.scss +125 -125
  89. package/src/styles/index.scss +195 -195
  90. package/src/styles/theme1.scss +277 -277
  91. package/src/styles/theme2.scss +376 -376
  92. package/src/styles/themes.scss +9 -9
  93. package/src/types/vfForm.ts +11 -11
  94. package/tsconfig.json +40 -40
  95. package/types/components/index.d.ts +3 -3
  96. package/types/constants/config/form-template.config.d.ts +30 -30
  97. package/types/constants/config/form.config.d.ts +4 -4
  98. package/types/constants/config/storage.config.d.ts +4 -4
  99. package/types/constants/encode-assets/svg.d.ts +5 -5
  100. package/types/constants/enum/builtIn-label.enum.d.ts +7 -7
  101. package/types/constants/enum/cache-type.enum.d.ts +15 -15
  102. package/types/constants/enum/control-format-type.enum.d.ts +23 -23
  103. package/types/constants/enum/dynamic-option-type.enum.d.ts +11 -11
  104. package/types/constants/enum/form-bus-attr.enum.d.ts +19 -19
  105. package/types/constants/enum/form-field-class.enum.d.ts +18 -18
  106. package/types/constants/enum/form-field-type.enum.d.ts +111 -111
  107. package/types/constants/enum/form-type.enum.d.ts +11 -11
  108. package/types/constants/enum/index.d.ts +19 -19
  109. package/types/constants/enum/lateral-arrangement.enum.d.ts +23 -23
  110. package/types/constants/enum/money-unit.enum.d.ts +15 -15
  111. package/types/constants/enum/option-type.enum.d.ts +11 -11
  112. package/types/constants/enum/submitted-type.enum.d.ts +115 -111
  113. package/types/constants/enum/support-upload-type.enum.d.ts +11 -11
  114. package/types/constants/enum/switch.enum.d.ts +11 -11
  115. package/types/constants/enum/upload-type.enum.d.ts +59 -59
  116. package/types/constants/enum/validate-rules.enum.d.ts +2 -2
  117. package/types/constants/enum/validate-status.enum.d.ts +2 -2
  118. package/types/constants/enum/vertical-arrangement.enum.d.ts +21 -21
  119. package/types/constants/enum/zoom-type.d.ts +15 -15
  120. package/types/constants/index.d.ts +3 -3
  121. package/types/core/FormApi.d.ts +376 -376
  122. package/types/core/index.d.ts +1 -1
  123. package/types/domain/AbstractControl.d.ts +5 -5
  124. package/types/domain/Control.d.ts +13 -13
  125. package/types/domain/CustomFormat.d.ts +5 -5
  126. package/types/domain/DesForm.d.ts +32 -32
  127. package/types/domain/DesFormControl.d.ts +160 -160
  128. package/types/domain/DesFormLayout.d.ts +33 -33
  129. package/types/domain/FieldChangeHistory.d.ts +9 -9
  130. package/types/domain/FormConfig.d.ts +15 -15
  131. package/types/domain/FormControl.d.ts +60 -60
  132. package/types/domain/FormEnum.d.ts +10 -10
  133. package/types/domain/FormGroup.d.ts +27 -27
  134. package/types/domain/FormRestfulResponse.d.ts +6 -6
  135. package/types/domain/ProvideInjectData.d.ts +10 -10
  136. package/types/domain/SysDictDetail.d.ts +24 -24
  137. package/types/domain/SysDictInfo.d.ts +26 -26
  138. package/types/domain/SysDictTreeDetail.d.ts +34 -34
  139. package/types/domain/index.d.ts +12 -12
  140. package/types/filtres/amount-capitalization.filter.d.ts +7 -7
  141. package/types/filtres/extract-options.filter.d.ts +13 -13
  142. package/types/filtres/generate-grid-column-end.filter.d.ts +11 -11
  143. package/types/filtres/generate-grid-template-columns.filter.d.ts +11 -11
  144. package/types/filtres/switch-enum-convert.filter.d.ts +2 -2
  145. package/types/filtres/zoom-multiple.filter.d.ts +3 -3
  146. package/types/index.d.ts +13 -13
  147. package/types/main.d.ts +2 -2
  148. package/types/services/api.service.d.ts +25 -25
  149. package/types/services/clean-local-forage.service.d.ts +28 -28
  150. package/types/services/date-format.service.d.ts +21 -21
  151. package/types/services/dict-local-forage.service.d.ts +28 -28
  152. package/types/services/form-bean-utils.service.d.ts +23 -23
  153. package/types/services/form-local-forage.service.d.ts +28 -28
  154. package/types/services/form-tools.service.d.ts +153 -144
  155. package/types/services/form-tree-node-convert.service.d.ts +104 -104
  156. package/types/services/form-validate.service.d.ts +32 -32
  157. package/types/services/index.d.ts +9 -9
  158. package/types/services/router.service.d.ts +40 -40
  159. package/types/services/validate-generator.service.d.ts +154 -154
  160. package/types/store/dict.store.d.ts +29 -29
  161. package/types/store/form.store.d.ts +17 -17
  162. package/types/store/index.d.ts +2 -2
  163. package/types/types/vfForm.d.ts +10 -10
  164. package/vue.config.js +38 -29
  165. package/dhccmobile-vue3-lo-form-1.1.41.tgz +0 -0
@@ -1,40 +1,40 @@
1
- import { SysDictDetail } from "./SysDictDetail";
2
- import { SysDictTreeDetail } from "./SysDictTreeDetail";
3
-
4
- export class SysDictInfo {
5
- dictId: string;
6
- tenantId: string;
7
- appId: string;
8
- dictCd: string;
9
- dictNm: string;
10
- dictTp: string;
11
- useState: string;
12
- mark: string;
13
- comDictKeyValues: SysDictDetail[];
14
- treeDictKeyValues: SysDictTreeDetail[];
15
- constructor(
16
- options: {
17
- dictId?: string;
18
- tenantId?: string;
19
- appId?: string;
20
- dictCd?: string;
21
- dictNm?: string;
22
- dictTp?: string;
23
- useState?: string;
24
- mark?: string;
25
- comDictKeyValues?: SysDictDetail[];
26
- treeDictKeyValues?: SysDictTreeDetail[];
27
- } = {}
28
- ) {
29
- this.dictId = options.dictId || '';
30
- this.tenantId = options.tenantId || '';
31
- this.appId = options.appId || '';
32
- this.dictCd = options.dictCd || '';
33
- this.dictNm = options.dictNm || '';
34
- this.dictTp = options.dictTp || '';
35
- this.useState = options.useState || '';
36
- this.mark = options.mark || '';
37
- this.comDictKeyValues = options.comDictKeyValues || [];
38
- this.treeDictKeyValues = options.treeDictKeyValues || [];
39
- }
40
- }
1
+ import { SysDictDetail } from "./SysDictDetail";
2
+ import { SysDictTreeDetail } from "./SysDictTreeDetail";
3
+
4
+ export class SysDictInfo {
5
+ dictId: string;
6
+ tenantId: string;
7
+ appId: string;
8
+ dictCd: string;
9
+ dictNm: string;
10
+ dictTp: string;
11
+ useState: string;
12
+ mark: string;
13
+ comDictKeyValues: SysDictDetail[];
14
+ treeDictKeyValues: SysDictTreeDetail[];
15
+ constructor(
16
+ options: {
17
+ dictId?: string;
18
+ tenantId?: string;
19
+ appId?: string;
20
+ dictCd?: string;
21
+ dictNm?: string;
22
+ dictTp?: string;
23
+ useState?: string;
24
+ mark?: string;
25
+ comDictKeyValues?: SysDictDetail[];
26
+ treeDictKeyValues?: SysDictTreeDetail[];
27
+ } = {}
28
+ ) {
29
+ this.dictId = options.dictId || '';
30
+ this.tenantId = options.tenantId || '';
31
+ this.appId = options.appId || '';
32
+ this.dictCd = options.dictCd || '';
33
+ this.dictNm = options.dictNm || '';
34
+ this.dictTp = options.dictTp || '';
35
+ this.useState = options.useState || '';
36
+ this.mark = options.mark || '';
37
+ this.comDictKeyValues = options.comDictKeyValues || [];
38
+ this.treeDictKeyValues = options.treeDictKeyValues || [];
39
+ }
40
+ }
@@ -1,52 +1,52 @@
1
- export class SysDictTreeDetail {
2
- dictId: string;
3
- appId: string;
4
- dicEntryPk: string;
5
- dataId: string;
6
- dicEntryRank: string;
7
- dictCd: string;
8
- dictNm: string;
9
- dicKey: string;
10
- dicValue: string;
11
- suprDicPk: string;
12
- treedictLevel: string;
13
- isLeaf: string;
14
- sortNo: string;
15
- useState: string;
16
- children: SysDictTreeDetail[];
17
- constructor(
18
- options: {
19
- dictId?: string;
20
- appId?: string;
21
- dicEntryPk?: string;
22
- dataId?: string;
23
- dicEntryRank?: string;
24
- dictCd?: string;
25
- dictNm?: string;
26
- dicKey?: string;
27
- dicValue?: string;
28
- suprDicPk?: string;
29
- treedictLevel?: string;
30
- isLeaf?: string;
31
- sortNo?: string;
32
- useState?: string;
33
- children?: SysDictTreeDetail[]
34
- } = {}
35
- ) {
36
- this.dictId = options.dictId || '';
37
- this.appId = options.appId || '';
38
- this.dicEntryPk = options.dicEntryPk || '';
39
- this.dataId = options.dataId || '';
40
- this.dicEntryRank = options.dicEntryRank || '';
41
- this.dictCd = options.dictCd || '';
42
- this.dictNm = options.dictNm || '';
43
- this.dicKey = options.dicKey || '';
44
- this.dicValue = options.dicValue || '';
45
- this.suprDicPk = options.suprDicPk || '';
46
- this.treedictLevel = options.treedictLevel || '';
47
- this.isLeaf = options.isLeaf || '';
48
- this.sortNo = options.sortNo || '';
49
- this.useState = options.useState || '';
50
- this.children = options.children || [];
51
- }
52
- }
1
+ export class SysDictTreeDetail {
2
+ dictId: string;
3
+ appId: string;
4
+ dicEntryPk: string;
5
+ dataId: string;
6
+ dicEntryRank: string;
7
+ dictCd: string;
8
+ dictNm: string;
9
+ dicKey: string;
10
+ dicValue: string;
11
+ suprDicPk: string;
12
+ treedictLevel: string;
13
+ isLeaf: string;
14
+ sortNo: string;
15
+ useState: string;
16
+ children: SysDictTreeDetail[];
17
+ constructor(
18
+ options: {
19
+ dictId?: string;
20
+ appId?: string;
21
+ dicEntryPk?: string;
22
+ dataId?: string;
23
+ dicEntryRank?: string;
24
+ dictCd?: string;
25
+ dictNm?: string;
26
+ dicKey?: string;
27
+ dicValue?: string;
28
+ suprDicPk?: string;
29
+ treedictLevel?: string;
30
+ isLeaf?: string;
31
+ sortNo?: string;
32
+ useState?: string;
33
+ children?: SysDictTreeDetail[]
34
+ } = {}
35
+ ) {
36
+ this.dictId = options.dictId || '';
37
+ this.appId = options.appId || '';
38
+ this.dicEntryPk = options.dicEntryPk || '';
39
+ this.dataId = options.dataId || '';
40
+ this.dicEntryRank = options.dicEntryRank || '';
41
+ this.dictCd = options.dictCd || '';
42
+ this.dictNm = options.dictNm || '';
43
+ this.dicKey = options.dicKey || '';
44
+ this.dicValue = options.dicValue || '';
45
+ this.suprDicPk = options.suprDicPk || '';
46
+ this.treedictLevel = options.treedictLevel || '';
47
+ this.isLeaf = options.isLeaf || '';
48
+ this.sortNo = options.sortNo || '';
49
+ this.useState = options.useState || '';
50
+ this.children = options.children || [];
51
+ }
52
+ }
@@ -1,12 +1,12 @@
1
- export * from "./DesFormControl";
2
- export * from "./Control";
3
- export * from "./DesForm";
4
- export * from "./DesFormControl";
5
- export * from "./DesFormLayout";
6
- export * from "./FormConfig";
7
- export * from "./FormControl";
8
- export * from "./FormEnum";
9
- export * from "./FormGroup";
10
- export * from "./FormRestfulResponse";
11
- export * from "./CustomFormat";
12
- export * from "./FieldChangeHistory";
1
+ export * from "./DesFormControl";
2
+ export * from "./Control";
3
+ export * from "./DesForm";
4
+ export * from "./DesFormControl";
5
+ export * from "./DesFormLayout";
6
+ export * from "./FormConfig";
7
+ export * from "./FormControl";
8
+ export * from "./FormEnum";
9
+ export * from "./FormGroup";
10
+ export * from "./FormRestfulResponse";
11
+ export * from "./CustomFormat";
12
+ export * from "./FieldChangeHistory";
@@ -1,147 +1,154 @@
1
- function transform(currencyDigits: any): any {
2
- // Constants:
3
- const MAXIMUM_NUMBER = 999999999999.99;
4
- // Predefine the radix characters and currency symbols for output:
5
- const CN_ZERO = "零";
6
- const CN_ONE = "壹";
7
- const CN_TWO = "贰";
8
- const CN_THREE = "叁";
9
- const CN_FOUR = "肆";
10
- const CN_FIVE = "伍";
11
- const CN_SIX = "陆";
12
- const CN_SEVEN = "柒";
13
- const CN_EIGHT = "捌";
14
- const CN_NINE = "玖";
15
- const CN_TEN = "拾";
16
- const CN_HUNDRED = "佰";
17
- const CN_THOUSAND = "仟";
18
- const CN_TEN_THOUSAND = "万";
19
- const CN_HUNDRED_MILLION = "亿";
20
- // 满足数字大写转换需求
21
- const CN_SYMBOL = ""; // 不带前缀【金额:】
22
- const CN_DOLLAR = ""; // 元
23
- const DROP = "点"; // 点 2023年8月31日10:51:25
24
- const CN_TEN_CENT = ""; // 角
25
- const CN_CENT = ""; // 分
26
- const CN_INTEGER = ""; // 整
27
-
28
- // constiables:
29
- let integral; // Represent integral part of digit number.
30
- let decimal; // Represent decimal part of digit number.
31
- let outputCharacters; // The output result.
32
- let parts = [];
33
- let digits = [],
34
- radices = [],
35
- bigRadices = [],
36
- decimals = [];
37
- let zeroCount;
38
- let i, p, d;
39
- let quotient, modulus;
40
-
41
- // Validate input string:
42
- currencyDigits = currencyDigits != undefined ? currencyDigits.toString() : "";
43
-
44
- let prefix = "";
45
- if (currencyDigits != null && currencyDigits.indexOf("-") === 0) {
46
- prefix = "负";
47
- currencyDigits = currencyDigits.substr(1);
48
- }
49
- if (currencyDigits === "") {
50
- return "空"; // 默认提示
51
- }
52
- if (currencyDigits.match(/[^,.\d]/) != null) {
53
- return "您的输入含有无效字符";
54
- }
55
- if (currencyDigits.match(/^((\d{1,3}(,\d{3})*(.((\d{3},)*\d{1,3}))?)|(\d+(.\d+)?))$/) == null) {
56
- return "您的输入的数字格式不正确";
57
- }
58
-
59
- // Normalize the format of input digits:
60
- currencyDigits = currencyDigits.replace(/,/g, ""); // Remove comma delimiters.
61
- currencyDigits = currencyDigits.replace(/^0+/, ""); // Trim zeros at the beginning.
62
- // Assert the number is not greater than the maximum number.
63
- if (Number(currencyDigits) > MAXIMUM_NUMBER) {
64
- let divisor = 1000000000000;
65
- if (currencyDigits.indexOf(".") > -1) {
66
- const num = currencyDigits.split(".")[1].length;
67
- for (let i = 0; i < num; i++) {
68
- divisor = divisor * 10;
69
- }
70
- currencyDigits = currencyDigits.replace(".", "");
71
- }
72
- return Number(currencyDigits) / Number(divisor) + "万亿元";
73
- }
74
-
75
- // Process the coversion from currency digits to characters:
76
- // Separate integral and decimal parts before processing coversion:
77
- parts = currencyDigits.split(".");
78
- if (parts.length > 1) {
79
- integral = parts[0];
80
- decimal = parts[1];
81
- // Cut down redundant decimal digits that are after the second.
82
- decimal = decimal.substr(0, 2);
83
- } else {
84
- integral = parts[0];
85
- decimal = "";
86
- }
87
- // Prepare the characters corresponding to the digits:
88
- digits = [CN_ZERO, CN_ONE, CN_TWO, CN_THREE, CN_FOUR, CN_FIVE, CN_SIX, CN_SEVEN, CN_EIGHT, CN_NINE];
89
- radices = ["", CN_TEN, CN_HUNDRED, CN_THOUSAND];
90
- bigRadices = ["", CN_TEN_THOUSAND, CN_HUNDRED_MILLION];
91
- decimals = [CN_TEN_CENT, CN_CENT];
92
- // Start processing:
93
- outputCharacters = "";
94
- // Process integral part if it is larger than 0:
95
- if (Number(integral) > 0) {
96
- zeroCount = 0;
97
- for (i = 0; i < integral.length; i++) {
98
- p = integral.length - i - 1;
99
- d = integral.substr(i, 1);
100
- quotient = p / 4;
101
- modulus = p % 4;
102
- if (d === "0") {
103
- zeroCount++;
104
- } else {
105
- if (zeroCount > 0) {
106
- outputCharacters += digits[0];
107
- }
108
- zeroCount = 0;
109
- outputCharacters += digits[Number(d)] + radices[modulus];
110
- }
111
- if (modulus === 0 && zeroCount < 4) {
112
- outputCharacters += bigRadices[quotient];
113
- zeroCount = 0;
114
- }
115
- }
116
- // outputCharacters += CN_DOLLAR; // 原来的【元】
117
- }
118
- // Process decimal part if there is:
119
- if (decimal !== "") {
120
- outputCharacters += DROP; // new 2023年8月31日10:52:54
121
- for (i = 0; i < decimal.length; i++) {
122
- d = decimal.substr(i, 1);
123
- if (d !== "0") {
124
- outputCharacters += digits[Number(d)] + decimals[i];
125
- }
126
- }
127
- }
128
- // Confirm and return the final output string:
129
- if (outputCharacters === "") {
130
- outputCharacters = CN_ZERO + CN_DOLLAR;
131
- }
132
- if (decimal === "") {
133
- outputCharacters += CN_INTEGER;
134
- }
135
- outputCharacters = CN_SYMBOL + prefix + outputCharacters;
136
- return outputCharacters;
137
- }
138
- /**
139
- * @description: 跨列计算
140
- * @author ChenRui
141
- * @date 2020/12/1 19:34
142
- */
143
- const amountCapitalization = (data: any) => {
144
- return transform(data);
145
- };
146
-
147
- export default amountCapitalization;
1
+ function transform(currencyDigits: any): any {
2
+ // Constants:
3
+ const MAXIMUM_NUMBER = 999999999999.99;
4
+ // Predefine the radix characters and currency symbols for output:
5
+ const CN_ZERO = "零";
6
+ const CN_ONE = "壹";
7
+ const CN_TWO = "贰";
8
+ const CN_THREE = "叁";
9
+ const CN_FOUR = "肆";
10
+ const CN_FIVE = "伍";
11
+ const CN_SIX = "陆";
12
+ const CN_SEVEN = "柒";
13
+ const CN_EIGHT = "捌";
14
+ const CN_NINE = "玖";
15
+ const CN_TEN = "拾";
16
+ const CN_HUNDRED = "佰";
17
+ const CN_THOUSAND = "仟";
18
+ const CN_TEN_THOUSAND = "万";
19
+ const CN_HUNDRED_MILLION = "亿";
20
+ // 满足数字大写转换需求
21
+ const CN_SYMBOL = ""; // 不带前缀【金额:】
22
+ const CN_DOLLAR = ""; // 元
23
+ const DROP = "点"; // 点 2023年8月31日10:51:25
24
+ const CN_TEN_CENT = ""; // 角
25
+ const CN_CENT = ""; // 分
26
+ const CN_INTEGER = ""; // 整
27
+
28
+ // constiables:
29
+ let integral; // Represent integral part of digit number.
30
+ let decimal; // Represent decimal part of digit number.
31
+ let outputCharacters; // The output result.
32
+ let parts = [];
33
+ let digits = [],
34
+ radices = [],
35
+ bigRadices = [],
36
+ decimals = [];
37
+ let zeroCount;
38
+ let i, p, d;
39
+ let quotient, modulus;
40
+
41
+ // Validate input string:
42
+ currencyDigits = currencyDigits != undefined ? currencyDigits.toString() : "";
43
+
44
+ let prefix = "";
45
+ if (currencyDigits != null && currencyDigits.indexOf("-") === 0) {
46
+ prefix = "负";
47
+ currencyDigits = currencyDigits.substr(1);
48
+ }
49
+ if (currencyDigits === "") {
50
+ return "空"; // 默认提示
51
+ }
52
+ if (currencyDigits.match(/[^,.\d]/) != null) {
53
+ return "您的输入含有无效字符";
54
+ }
55
+ if (currencyDigits.match(/^((\d{1,3}(,\d{3})*(.((\d{3},)*\d{1,3}))?)|(\d+(.\d+)?))$/) == null) {
56
+ return "您的输入的数字格式不正确";
57
+ }
58
+
59
+ // Normalize the format of input digits:
60
+ currencyDigits = currencyDigits.replace(/,/g, ""); // Remove comma delimiters.
61
+ currencyDigits = currencyDigits.replace(/^0+/, ""); // Trim zeros at the beginning.
62
+ // Assert the number is not greater than the maximum number.
63
+ if (Number(currencyDigits) > MAXIMUM_NUMBER) {
64
+ let divisor = 1000000000000;
65
+ if (currencyDigits.indexOf(".") > -1) {
66
+ const num = currencyDigits.split(".")[1].length;
67
+ for (let i = 0; i < num; i++) {
68
+ divisor = divisor * 10;
69
+ }
70
+ currencyDigits = currencyDigits.replace(".", "");
71
+ }
72
+ return Number(currencyDigits) / Number(divisor) + "万亿元";
73
+ }
74
+
75
+ // Process the coversion from currency digits to characters:
76
+ // Separate integral and decimal parts before processing coversion:
77
+ parts = currencyDigits.split(".");
78
+ if (parts.length > 1) {
79
+ integral = parts[0];
80
+ decimal = parts[1];
81
+ // Cut down redundant decimal digits that are after the second.
82
+ decimal = decimal.substr(0, 2);
83
+ } else {
84
+ integral = parts[0];
85
+ decimal = "";
86
+ }
87
+ // Prepare the characters corresponding to the digits:
88
+ digits = [CN_ZERO, CN_ONE, CN_TWO, CN_THREE, CN_FOUR, CN_FIVE, CN_SIX, CN_SEVEN, CN_EIGHT, CN_NINE];
89
+ radices = ["", CN_TEN, CN_HUNDRED, CN_THOUSAND];
90
+ bigRadices = ["", CN_TEN_THOUSAND, CN_HUNDRED_MILLION];
91
+ decimals = [CN_TEN_CENT, CN_CENT];
92
+ // Start processing:
93
+ outputCharacters = "";
94
+ // Process integral part if it is larger than 0:
95
+ if (Number(integral) > 0) {
96
+ zeroCount = 0;
97
+ for (i = 0; i < integral.length; i++) {
98
+ p = integral.length - i - 1;
99
+ d = integral.substr(i, 1);
100
+ quotient = p / 4;
101
+ modulus = p % 4;
102
+ if (d === "0") {
103
+ zeroCount++;
104
+ } else {
105
+ if (zeroCount > 0) {
106
+ outputCharacters += digits[0];
107
+ }
108
+ zeroCount = 0;
109
+ outputCharacters += digits[Number(d)] + radices[modulus];
110
+ }
111
+ if (modulus === 0 && zeroCount < 4) {
112
+ outputCharacters += bigRadices[quotient];
113
+ zeroCount = 0;
114
+ }
115
+ }
116
+ // outputCharacters += CN_DOLLAR; // 原来的【元】
117
+ } else {
118
+ //整数位为'零'
119
+ outputCharacters = digits[Number(integral)];
120
+ }
121
+ // Process decimal part if there is:
122
+ //校验小数位是否有值
123
+ if (decimal !== "" && decimal !== "0" && decimal !== "00") {
124
+ outputCharacters += DROP; // new 2023年8月31日10:52:54
125
+ for (i = 0; i < decimal.length; i++) {
126
+ d = decimal.substr(i, 1);
127
+ if (d !== "0") {
128
+ outputCharacters += digits[Number(d)] + decimals[i];
129
+ } else if (i === 0) {
130
+ //处理金额十分位数值为0时的大写转换
131
+ outputCharacters += digits[Number(d)];
132
+ }
133
+ }
134
+ }
135
+ // Confirm and return the final output string:
136
+ if (outputCharacters === "") {
137
+ outputCharacters = CN_ZERO + CN_DOLLAR;
138
+ }
139
+ if (decimal === "") {
140
+ outputCharacters += CN_INTEGER;
141
+ }
142
+ outputCharacters = CN_SYMBOL + prefix + outputCharacters;
143
+ return outputCharacters;
144
+ }
145
+ /**
146
+ * @description: 跨列计算
147
+ * @author ChenRui
148
+ * @date 2020/12/1 19:34
149
+ */
150
+ const amountCapitalization = (data: any) => {
151
+ return transform(data);
152
+ };
153
+
154
+ export default amountCapitalization;
@@ -1,53 +1,53 @@
1
- import { OptionType } from "../constants/enum/option-type.enum";
2
- import { DynamicOptionType } from "../constants/enum/dynamic-option-type.enum";
3
-
4
- function transformReverse(controlAttr: any, data: any[]): void {
5
- if (data == null) {
6
- data = [];
7
- }
8
- if (controlAttr != null) {
9
- if (controlAttr.isOptionType === OptionType.Fixed.code) {
10
- controlAttr.optionConfig = data;
11
- } else if (controlAttr.isOptionType === OptionType.Dynamic.code) {
12
- if (controlAttr.dynamicOptionType === DynamicOptionType.GeneralDictionary.code) {
13
- controlAttr.generalDictionaryOptions = data;
14
- } else if (controlAttr.dynamicOptionType === DynamicOptionType.TreeDictionary.code) {
15
- controlAttr.treeShapeOptions = data;
16
- }
17
- }
18
- }
19
- }
20
-
21
- function transform(controlAttr: any): any[] {
22
- if (controlAttr != null) {
23
- if (controlAttr.isOptionType === OptionType.Fixed.code) {
24
- return controlAttr.optionConfig || [];
25
- } else if (controlAttr.isOptionType === OptionType.Dynamic.code) {
26
- if (controlAttr.dynamicOptionType === DynamicOptionType.GeneralDictionary.code) {
27
- return controlAttr.generalDictionaryOptions || [];
28
- } else if (controlAttr.dynamicOptionType === DynamicOptionType.TreeDictionary.code) {
29
- return controlAttr.treeShapeOptions || [];
30
- }
31
- }
32
- }
33
- return [];
34
- }
35
-
36
- /**
37
- * @description: 根据字典类型获取可选项
38
- * @author ChenRui
39
- * @date 2020/12/30 11:18
40
- */
41
- const extractOptions = (controlAttr: any, ...args: any[]): any[] => {
42
- return transform(controlAttr);
43
- };
44
-
45
- /**
46
- * @description: 保存可选项
47
- * @author ChenRui
48
- * @date 2021/1/29 16:17
49
- */
50
- const storageOptions = (controlAttr: any, data: any[]): void => {
51
- return transformReverse(controlAttr, data);
52
- };
53
- export { storageOptions, extractOptions };
1
+ import { OptionType } from "../constants/enum/option-type.enum";
2
+ import { DynamicOptionType } from "../constants/enum/dynamic-option-type.enum";
3
+
4
+ function transformReverse(controlAttr: any, data: any[]): void {
5
+ if (data == null) {
6
+ data = [];
7
+ }
8
+ if (controlAttr != null) {
9
+ if (controlAttr.isOptionType === OptionType.Fixed.code) {
10
+ controlAttr.optionConfig = data;
11
+ } else if (controlAttr.isOptionType === OptionType.Dynamic.code) {
12
+ if (controlAttr.dynamicOptionType === DynamicOptionType.GeneralDictionary.code) {
13
+ controlAttr.generalDictionaryOptions = data;
14
+ } else if (controlAttr.dynamicOptionType === DynamicOptionType.TreeDictionary.code) {
15
+ controlAttr.treeShapeOptions = data;
16
+ }
17
+ }
18
+ }
19
+ }
20
+
21
+ function transform(controlAttr: any): any[] {
22
+ if (controlAttr != null) {
23
+ if (controlAttr.isOptionType === OptionType.Fixed.code) {
24
+ return controlAttr.optionConfig || [];
25
+ } else if (controlAttr.isOptionType === OptionType.Dynamic.code) {
26
+ if (controlAttr.dynamicOptionType === DynamicOptionType.GeneralDictionary.code) {
27
+ return controlAttr.generalDictionaryOptions || [];
28
+ } else if (controlAttr.dynamicOptionType === DynamicOptionType.TreeDictionary.code) {
29
+ return controlAttr.treeShapeOptions || [];
30
+ }
31
+ }
32
+ }
33
+ return [];
34
+ }
35
+
36
+ /**
37
+ * @description: 根据字典类型获取可选项
38
+ * @author ChenRui
39
+ * @date 2020/12/30 11:18
40
+ */
41
+ const extractOptions = (controlAttr: any, ...args: any[]): any[] => {
42
+ return transform(controlAttr);
43
+ };
44
+
45
+ /**
46
+ * @description: 保存可选项
47
+ * @author ChenRui
48
+ * @date 2021/1/29 16:17
49
+ */
50
+ const storageOptions = (controlAttr: any, data: any[]): void => {
51
+ return transformReverse(controlAttr, data);
52
+ };
53
+ export { storageOptions, extractOptions };
@@ -1,22 +1,22 @@
1
- interface Config {
2
- value: number;
3
- order: number;
4
- }
5
-
6
- function transform(configs: Config[]): unknown {
7
- if (configs != null && configs.length > 0) {
8
- return configs.length + 1;
9
- } else {
10
- return 2;
11
- }
12
- }
13
- /**
14
- * @description: 跨列计算
15
- * @author ChenRui
16
- * @date 2020/12/1 19:34
17
- */
18
- const generateGridColumnEnd = (configs: Config[]) => {
19
- return transform(configs);
20
- };
21
-
22
- export default generateGridColumnEnd;
1
+ interface Config {
2
+ value: number;
3
+ order: number;
4
+ }
5
+
6
+ function transform(configs: Config[]): unknown {
7
+ if (configs != null && configs.length > 0) {
8
+ return configs.length + 1;
9
+ } else {
10
+ return 2;
11
+ }
12
+ }
13
+ /**
14
+ * @description: 跨列计算
15
+ * @author ChenRui
16
+ * @date 2020/12/1 19:34
17
+ */
18
+ const generateGridColumnEnd = (configs: Config[]) => {
19
+ return transform(configs);
20
+ };
21
+
22
+ export default generateGridColumnEnd;