n20-common-lib 2.4.5 → 2.4.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.
Files changed (175) hide show
  1. package/README.md +1 -1
  2. package/nstc-g6/components/Calendar/index.js +5 -5
  3. package/nstc-g6/components/Calendar/src/basic/month-table.vue +12 -20
  4. package/nstc-g6/components/Calendar/src/basic/year-table.vue +18 -22
  5. package/nstc-g6/components/Calendar/src/main.vue +1 -5
  6. package/nstc-g6/components/DialogForm/index.js +5 -5
  7. package/nstc-g6/components/DialogForm/src/demo/index.vue +18 -27
  8. package/nstc-g6/components/DialogForm/src/main.vue +15 -21
  9. package/nstc-g6/components/Form/A_DEMO/component/originalForm.vue +35 -50
  10. package/nstc-g6/components/Form/A_DEMO/config/config_3.js +1115 -1110
  11. package/nstc-g6/components/Form/A_DEMO/index.vue +7 -29
  12. package/nstc-g6/components/Form/AutocompleteCustom/index.vue +3 -5
  13. package/nstc-g6/components/Form/BusinessSpecific/InputMultiple.vue +60 -62
  14. package/nstc-g6/components/Form/BusinessSpecific/InputWithUnit.vue +12 -35
  15. package/nstc-g6/components/Form/BusinessSpecific/SelectTreeDialog.vue +77 -77
  16. package/nstc-g6/components/Form/CascaderCustom/index.vue +4 -4
  17. package/nstc-g6/components/Form/CheckboxCustom/index.vue +5 -11
  18. package/nstc-g6/components/Form/Component.vue +56 -78
  19. package/nstc-g6/components/Form/ComponentSecond.vue +55 -77
  20. package/nstc-g6/components/Form/InputAndDialog/index.js +5 -5
  21. package/nstc-g6/components/Form/InputAndDialog/src/main.vue +130 -153
  22. package/nstc-g6/components/Form/InputCustom/demo/index.vue +4 -12
  23. package/nstc-g6/components/Form/InputCustom/index.vue +51 -54
  24. package/nstc-g6/components/Form/IntervalinputCustom/demo/index.vue +1 -3
  25. package/nstc-g6/components/Form/IntervalinputCustom/index.vue +19 -41
  26. package/nstc-g6/components/Form/Item.vue +15 -30
  27. package/nstc-g6/components/Form/ItemSecond.vue +7 -22
  28. package/nstc-g6/components/Form/List.vue +12 -28
  29. package/nstc-g6/components/Form/ListSecond.vue +11 -27
  30. package/nstc-g6/components/Form/RadioCustom/index.vue +5 -23
  31. package/nstc-g6/components/Form/SelectAccount/index.js +5 -5
  32. package/nstc-g6/components/Form/SelectAccount/src/demo/index.vue +34 -28
  33. package/nstc-g6/components/Form/SelectAccount/src/main.vue +112 -83
  34. package/nstc-g6/components/Form/SelectAndDialog/index.js +5 -5
  35. package/nstc-g6/components/Form/SelectAndDialog/src/main.vue +126 -149
  36. package/nstc-g6/components/Form/SelectCashFlow/index.js +5 -5
  37. package/nstc-g6/components/Form/SelectCashFlow/src/demo/index.vue +18 -19
  38. package/nstc-g6/components/Form/SelectCashFlow/src/main.vue +52 -41
  39. package/nstc-g6/components/Form/SelectCustom/demo/index.vue +14 -16
  40. package/nstc-g6/components/Form/SelectCustom/index.vue +129 -139
  41. package/nstc-g6/components/Form/SelectSubject/index.js +5 -5
  42. package/nstc-g6/components/Form/SelectSubject/src/demo/index.vue +42 -48
  43. package/nstc-g6/components/Form/SelectSubject/src/main.vue +83 -86
  44. package/nstc-g6/components/Form/SelectindialogCustom/demo/index.vue +34 -35
  45. package/nstc-g6/components/Form/SelectindialogCustom/index.vue +133 -148
  46. package/nstc-g6/components/Form/SelectindialogCustom/install.js +3 -3
  47. package/nstc-g6/components/Form/TableRadioCustom/demo/index.vue +1 -7
  48. package/nstc-g6/components/Form/TableRadioCustom/index.vue +17 -26
  49. package/nstc-g6/components/Form/TextCustom/index.vue +2 -2
  50. package/nstc-g6/components/Form/UploadCustom/demo/index.vue +1 -3
  51. package/nstc-g6/components/Form/UploadCustom/index.vue +143 -173
  52. package/nstc-g6/components/Form/configs.js +3 -14
  53. package/nstc-g6/components/Form/configsSecond.js +3 -16
  54. package/nstc-g6/components/Form/index.js +1 -1
  55. package/nstc-g6/components/Form/payeePersonSelect/index.js +5 -5
  56. package/nstc-g6/components/Form/payeePersonSelect/src/demo/index.vue +50 -44
  57. package/nstc-g6/components/Form/payeePersonSelect/src/main.vue +73 -82
  58. package/nstc-g6/components/FormGroup/index.js +5 -5
  59. package/nstc-g6/components/FormGroup/src/demo/config.js +18 -19
  60. package/nstc-g6/components/FormGroup/src/demo/index.vue +14 -22
  61. package/nstc-g6/components/FormGroup/src/main.vue +122 -141
  62. package/nstc-g6/components/FormGroup/src/validate.js +11 -13
  63. package/nstc-g6/components/InputTag/InputTag.vue +78 -111
  64. package/nstc-g6/components/NstcBackToTop/NstcBackToTop.vue +24 -24
  65. package/nstc-g6/components/NstcBranchLazyLoad/NstcBranchLazyLoad.vue +4 -13
  66. package/nstc-g6/components/NstcCharts/NstcCharts.vue +9 -18
  67. package/nstc-g6/components/NstcCharts/define.js +1 -6
  68. package/nstc-g6/components/NstcConfirm/NstcConfirm.vue +6 -21
  69. package/nstc-g6/components/NstcConfirm/index.js +21 -19
  70. package/nstc-g6/components/NstcDialog/NstcDialog.vue +34 -38
  71. package/nstc-g6/components/NstcDialogForm/NstcDialogForm.vue +17 -21
  72. package/nstc-g6/components/NstcDialogTable/NstcDialogTable.vue +4 -17
  73. package/nstc-g6/components/NstcDropdown/NstcDropdown.vue +2 -12
  74. package/nstc-g6/components/NstcDropdownTree/NstcDropdownTree.vue +3 -13
  75. package/nstc-g6/components/NstcElectronicFile/NstcElectronicFile.vue +18 -78
  76. package/nstc-g6/components/NstcExcelCustomImport/NstcExcelCustomImport.vue +121 -147
  77. package/nstc-g6/components/NstcExcelImport/NstcExcelImport.vue +9 -31
  78. package/nstc-g6/components/NstcExcelImportN/NstcExcelImportN.vue +10 -33
  79. package/nstc-g6/components/NstcExpandCollapse/NstcExpandCollapse.vue +12 -16
  80. package/nstc-g6/components/NstcFileUpload/NstcFileUpload.vue +19 -75
  81. package/nstc-g6/components/NstcForm/A_DEMO/component/originalForm.vue +35 -50
  82. package/nstc-g6/components/NstcForm/A_DEMO/config/config_3.js +1115 -1110
  83. package/nstc-g6/components/NstcForm/A_DEMO/index.vue +340 -354
  84. package/nstc-g6/components/NstcForm/AutocompleteCustom/index.vue +2 -2
  85. package/nstc-g6/components/NstcForm/BusinessSpecific/InputWithUnit.vue +11 -34
  86. package/nstc-g6/components/NstcForm/BusinessSpecific/SelectTreeDialog.vue +77 -77
  87. package/nstc-g6/components/NstcForm/CheckboxCustom/index.vue +5 -11
  88. package/nstc-g6/components/NstcForm/Component.vue +17 -62
  89. package/nstc-g6/components/NstcForm/ComponentSecond.vue +55 -77
  90. package/nstc-g6/components/NstcForm/InputAndDialog/NstcInputAndDialog.vue +6 -24
  91. package/nstc-g6/components/NstcForm/InputCustom/index.vue +2 -8
  92. package/nstc-g6/components/NstcForm/IntervalInputCustom/index.vue +4 -21
  93. package/nstc-g6/components/NstcForm/Item.vue +3 -15
  94. package/nstc-g6/components/NstcForm/ItemSecond.vue +7 -22
  95. package/nstc-g6/components/NstcForm/List.vue +12 -28
  96. package/nstc-g6/components/NstcForm/ListSecond.vue +11 -27
  97. package/nstc-g6/components/NstcForm/RadioCustom/index.vue +5 -23
  98. package/nstc-g6/components/NstcForm/SelectAccount/NstcSelectAccount.vue +4 -24
  99. package/nstc-g6/components/NstcForm/SelectAndDialog/NstcSelectAndDialog.vue +7 -30
  100. package/nstc-g6/components/NstcForm/SelectCashFlow/NstcSelectCashFlow.vue +50 -38
  101. package/nstc-g6/components/NstcForm/SelectCustom/index.vue +6 -16
  102. package/nstc-g6/components/NstcForm/SelectSubject/NstcSelectSubject.vue +72 -82
  103. package/nstc-g6/components/NstcForm/SelectindialogCustom/index.vue +6 -20
  104. package/nstc-g6/components/NstcForm/TableRadioCustom/index.vue +17 -26
  105. package/nstc-g6/components/NstcForm/TextCustom/index.vue +2 -2
  106. package/nstc-g6/components/NstcForm/UploadCustom/index.vue +13 -60
  107. package/nstc-g6/components/NstcForm/configs.js +3 -14
  108. package/nstc-g6/components/NstcForm/configsSecond.js +3 -16
  109. package/nstc-g6/components/NstcForm/index.js +1 -1
  110. package/nstc-g6/components/NstcForm/payeePersonSelect/NstcPayeePerson.vue +57 -73
  111. package/nstc-g6/components/NstcPagination/NstcPagination.vue +2 -12
  112. package/nstc-g6/components/NstcScreenFull/NstcScreenFull.vue +2 -3
  113. package/nstc-g6/components/NstcSelectTree/NstcSelectTree.vue +4 -15
  114. package/nstc-g6/components/NstcSelectTreeList/NstcSelectTreeList.vue +5 -20
  115. package/nstc-g6/components/NstcSticky/NstcSticky.vue +10 -4
  116. package/nstc-g6/components/NstcSvgIcon/NstcSvgIcon.vue +1 -7
  117. package/nstc-g6/components/NstcTab/NstcTab.vue +8 -20
  118. package/nstc-g6/components/NstcTabWithBadge/NstcTabWithBadge.vue +7 -7
  119. package/nstc-g6/components/NstcTable/ElTableColumnCustom/index.vue +88 -126
  120. package/nstc-g6/components/NstcTable/NstcTable.vue +4 -17
  121. package/nstc-g6/components/NstcTableSet/NstcTableSet.vue +27 -72
  122. package/nstc-g6/components/NstcThemePicker/NstcThemePicker.vue +13 -14
  123. package/nstc-g6/components/NstcUploadCustomExcel/NstcUploadCustomExcel.vue +3 -13
  124. package/nstc-g6/components/NstcUploadExcel/NstcUploadExcel.vue +21 -22
  125. package/nstc-g6/components/NstcWorkBench/NstcWorkBench.vue +4 -17
  126. package/nstc-g6/components/Search/NstcSearch.vue +12 -47
  127. package/nstc-g6/components/Search/src/demo/index copy.vue +28 -28
  128. package/nstc-g6/components/Search/src/demo/index.vue +36 -36
  129. package/nstc-g6/components/Search/src/main copy.vue +169 -204
  130. package/nstc-g6/components/approvelTwo/main.vue +2 -6
  131. package/nstc-g6/components/approvelTwo/progress.vue +7 -29
  132. package/nstc-g6/directives/VCopy/index.js +52 -54
  133. package/nstc-g6/directives/VNstcNumber/index.js +1 -1
  134. package/nstc-g6/directives/VNstcNumber/temp.js +357 -362
  135. package/nstc-g6/utils/mapper_aims.js +774 -775
  136. package/nstc-g6/utils/parseTime.js +38 -36
  137. package/nstc-g6/utils/validate/index.js +2 -2
  138. package/nstc-g6/utils/vendor/Export2Excel.js +110 -111
  139. package/nstc-g6/utils/vendor/Export2Zip.js +12 -7
  140. package/nstc-g6/utils/vue-bus.js +1 -1
  141. package/package.json +1 -1
  142. package/src/assets/iconFont/demo_index.html +1 -1
  143. package/src/assets/iconFont/iconfont.js +66 -1
  144. package/src/assets/iconFont2/demo_index.html +277 -286
  145. package/src/assets/iconFont2/iconfont.js +66 -1
  146. package/src/components/Button/button-group.vue +1 -1
  147. package/src/components/Layout/HeaderWrap/indexN.vue +1 -1
  148. package/src/components/Layout/indexN.vue +1 -2
  149. package/src/components/LoginTemporary/indexN.vue +12 -2
  150. package/src/components/TableOperateColumn/index.vue +1 -1
  151. package/src/plugins/Print/print-js/README.md +5 -5
  152. package/src/plugins/Print/print-js/package.json +2 -2
  153. package/src/plugins/Print/print-js/src/index.d.ts +36 -36
  154. package/src/plugins/Print/print-js/src/js/browser.js +3 -1
  155. package/src/plugins/Print/print-js/src/js/functions.js +16 -10
  156. package/src/plugins/Print/print-js/src/js/html.js +2 -2
  157. package/src/plugins/Print/print-js/src/js/image.js +1 -1
  158. package/src/plugins/Print/print-js/src/js/init.js +15 -7
  159. package/src/plugins/Print/print-js/src/js/json.js +14 -4
  160. package/src/plugins/Print/print-js/src/js/modal.js +16 -15
  161. package/src/plugins/Print/print-js/src/js/pdf.js +1 -1
  162. package/src/plugins/Print/print-js/src/js/print.js +6 -6
  163. package/src/plugins/Sign/NetSM3/InfosecNetSignCNGAgent.min.js +1825 -1592
  164. package/src/plugins/Sign/cfca/index.js +525 -520
  165. package/src/plugins/Sign/sign.js +128 -128
  166. package/style/index.css +1 -1
  167. package/style/index.css.map +1 -1
  168. package/theme/blue.css +1 -1
  169. package/theme/cctcRed.css +1 -1
  170. package/theme/green.css +1 -1
  171. package/theme/lightBlue.css +1 -1
  172. package/theme/orange.css +1 -1
  173. package/theme/purple.css +1 -1
  174. package/theme/red.css +1 -1
  175. package/theme/yellow.css +1 -1
@@ -5,44 +5,46 @@
5
5
  * @returns {string | null}
6
6
  */
7
7
  export function parseTime(time, cFormat = '{y}-{m}-{d} {h}:{i}:{s}') {
8
- if (arguments.length === 0 || !time) {
9
- return null
8
+ if (arguments.length === 0 || !time) {
9
+ return null
10
+ }
11
+ const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
12
+ let date
13
+ if (typeof time === 'object') {
14
+ date = time
15
+ } else {
16
+ if (typeof time === 'string') {
17
+ if (/^[0-9]+$/.test(time)) {
18
+ // support "1548221490638"
19
+ time = parseInt(time)
20
+ } else {
21
+ // support safari
22
+ // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
23
+ time = time.replace(new RegExp(/-/gm), '/')
24
+ }
10
25
  }
11
- const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
12
- let date
13
- if (typeof time === 'object') {
14
- date = time
15
- } else {
16
- if ((typeof time === 'string')) {
17
- if ((/^[0-9]+$/.test(time))) {
18
- // support "1548221490638"
19
- time = parseInt(time)
20
- } else {
21
- // support safari
22
- // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
23
- time = time.replace(new RegExp(/-/gm), '/')
24
- }
25
- }
26
26
 
27
- if ((typeof time === 'number') && (time.toString().length === 10)) {
28
- time = time * 1000
29
- }
30
- date = new Date(time)
27
+ if (typeof time === 'number' && time.toString().length === 10) {
28
+ time = time * 1000
31
29
  }
32
- const formatObj = {
33
- y: date.getFullYear(),
34
- m: date.getMonth() + 1,
35
- d: date.getDate(),
36
- h: date.getHours(),
37
- i: date.getMinutes(),
38
- s: date.getSeconds(),
39
- a: date.getDay()
30
+ date = new Date(time)
31
+ }
32
+ const formatObj = {
33
+ y: date.getFullYear(),
34
+ m: date.getMonth() + 1,
35
+ d: date.getDate(),
36
+ h: date.getHours(),
37
+ i: date.getMinutes(),
38
+ s: date.getSeconds(),
39
+ a: date.getDay()
40
+ }
41
+ const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
42
+ const value = formatObj[key]
43
+ // Note: getDay() returns 0 on Sunday
44
+ if (key === 'a') {
45
+ return ['日', '一', '二', '三', '四', '五', '六'][value]
40
46
  }
41
- const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
42
- const value = formatObj[key]
43
- // Note: getDay() returns 0 on Sunday
44
- if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
45
- return value.toString().padStart(2, '0')
46
- })
47
- return time_str
47
+ return value.toString().padStart(2, '0')
48
+ })
49
+ return time_str
48
50
  }
@@ -3,5 +3,5 @@
3
3
  * @returns {Boolean}
4
4
  */
5
5
  export function isExternal(path) {
6
- return /^(https?:|mailto:|tel:)/.test(path)
7
- }
6
+ return /^(https?:|mailto:|tel:)/.test(path)
7
+ }
@@ -3,31 +3,31 @@ import { saveAs } from 'file-saver'
3
3
  import XLSX from 'xlsx'
4
4
  import XLSXS from 'xlsx-style'
5
5
  function generateArray(table) {
6
- var out = [];
7
- var rows = table.querySelectorAll('tr');
8
- var ranges = [];
6
+ var out = []
7
+ var rows = table.querySelectorAll('tr')
8
+ var ranges = []
9
9
  for (var R = 0; R < rows.length; ++R) {
10
- var outRow = [];
11
- var row = rows[R];
12
- var columns = row.querySelectorAll('td');
10
+ var outRow = []
11
+ var row = rows[R]
12
+ var columns = row.querySelectorAll('td')
13
13
  for (var C = 0; C < columns.length; ++C) {
14
- var cell = columns[C];
15
- var colspan = cell.getAttribute('colspan');
16
- var rowspan = cell.getAttribute('rowspan');
17
- var cellValue = cell.innerText;
18
- if (cellValue !== "" && cellValue == +cellValue) cellValue = +cellValue;
14
+ var cell = columns[C]
15
+ var colspan = cell.getAttribute('colspan')
16
+ var rowspan = cell.getAttribute('rowspan')
17
+ var cellValue = cell.innerText
18
+ if (cellValue !== '' && cellValue == +cellValue) cellValue = +cellValue
19
19
 
20
20
  //Skip ranges
21
21
  ranges.forEach(function (range) {
22
22
  if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
23
- for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
23
+ for (var i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null)
24
24
  }
25
- });
25
+ })
26
26
 
27
27
  //Handle Row Span
28
28
  if (rowspan || colspan) {
29
- rowspan = rowspan || 1;
30
- colspan = colspan || 1;
29
+ rowspan = rowspan || 1
30
+ colspan = colspan || 1
31
31
  ranges.push({
32
32
  s: {
33
33
  r: R,
@@ -37,29 +37,28 @@ function generateArray(table) {
37
37
  r: R + rowspan - 1,
38
38
  c: outRow.length + colspan - 1
39
39
  }
40
- });
41
- };
40
+ })
41
+ }
42
42
 
43
43
  //Handle Value
44
- outRow.push(cellValue !== "" ? cellValue : null);
44
+ outRow.push(cellValue !== '' ? cellValue : null)
45
45
 
46
46
  //Handle Colspan
47
- if (colspan)
48
- for (var k = 0; k < colspan - 1; ++k) outRow.push(null);
47
+ if (colspan) for (var k = 0; k < colspan - 1; ++k) outRow.push(null)
49
48
  }
50
- out.push(outRow);
49
+ out.push(outRow)
51
50
  }
52
- return [out, ranges];
53
- };
51
+ return [out, ranges]
52
+ }
54
53
 
55
54
  function datenum(v, date1904) {
56
- if (date1904) v += 1462;
57
- var epoch = Date.parse(v);
58
- return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
55
+ if (date1904) v += 1462
56
+ var epoch = Date.parse(v)
57
+ return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000)
59
58
  }
60
59
 
61
60
  export function sheet_from_array_of_arrays(data, opts) {
62
- var ws = {};
61
+ var ws = {}
63
62
  var range = {
64
63
  s: {
65
64
  c: 10000000,
@@ -69,161 +68,161 @@ export function sheet_from_array_of_arrays(data, opts) {
69
68
  c: 0,
70
69
  r: 0
71
70
  }
72
- };
71
+ }
73
72
  for (var R = 0; R != data.length; ++R) {
74
73
  for (var C = 0; C != data[R].length; ++C) {
75
- if (range.s.r > R) range.s.r = R;
76
- if (range.s.c > C) range.s.c = C;
77
- if (range.e.r < R) range.e.r = R;
78
- if (range.e.c < C) range.e.c = C;
74
+ if (range.s.r > R) range.s.r = R
75
+ if (range.s.c > C) range.s.c = C
76
+ if (range.e.r < R) range.e.r = R
77
+ if (range.e.c < C) range.e.c = C
79
78
  var cell = {
80
79
  v: data[R][C]
81
- };
82
- if (cell.v == null) continue;
80
+ }
81
+ if (cell.v == null) continue
83
82
  var cell_ref = XLSX.utils.encode_cell({
84
83
  c: C,
85
84
  r: R
86
- });
85
+ })
87
86
 
88
- if (typeof cell.v === 'number') cell.t = 'n';
89
- else if (typeof cell.v === 'boolean') cell.t = 'b';
87
+ if (typeof cell.v === 'number') cell.t = 'n'
88
+ else if (typeof cell.v === 'boolean') cell.t = 'b'
90
89
  else if (cell.v instanceof Date) {
91
- cell.t = 'n';
92
- cell.z = XLSX.SSF._table[14];
93
- cell.v = datenum(cell.v);
94
- } else cell.t = 's';
90
+ cell.t = 'n'
91
+ cell.z = XLSX.SSF._table[14]
92
+ cell.v = datenum(cell.v)
93
+ } else cell.t = 's'
95
94
 
96
- ws[cell_ref] = cell;
95
+ ws[cell_ref] = cell
97
96
  }
98
97
  }
99
- if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
100
- return ws;
98
+ if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range)
99
+ return ws
101
100
  }
102
101
 
103
102
  function Workbook() {
104
- if (!(this instanceof Workbook)) return new Workbook();
105
- this.SheetNames = [];
106
- this.Sheets = {};
103
+ if (!(this instanceof Workbook)) return new Workbook()
104
+ this.SheetNames = []
105
+ this.Sheets = {}
107
106
  }
108
107
 
109
108
  function s2ab(s) {
110
- var buf = new ArrayBuffer(s.length);
111
- var view = new Uint8Array(buf);
112
- for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
113
- return buf;
109
+ var buf = new ArrayBuffer(s.length)
110
+ var view = new Uint8Array(buf)
111
+ for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xff
112
+ return buf
114
113
  }
115
114
 
116
115
  export function export_table_to_excel(id) {
117
- var theTable = document.getElementById(id);
118
- var oo = generateArray(theTable);
119
- var ranges = oo[1];
116
+ var theTable = document.getElementById(id)
117
+ var oo = generateArray(theTable)
118
+ var ranges = oo[1]
120
119
 
121
120
  /* original data */
122
- var data = oo[0];
123
- var ws_name = "SheetJS";
121
+ var data = oo[0]
122
+ var ws_name = 'SheetJS'
124
123
 
125
124
  var wb = new Workbook(),
126
- ws = sheet_from_array_of_arrays(data);
125
+ ws = sheet_from_array_of_arrays(data)
127
126
 
128
127
  /* add ranges to worksheet */
129
128
  // ws['!cols'] = ['apple', 'banan'];
130
- ws['!merges'] = ranges;
129
+ ws['!merges'] = ranges
131
130
 
132
131
  /* add worksheet to workbook */
133
- wb.SheetNames.push(ws_name);
134
- wb.Sheets[ws_name] = ws;
132
+ wb.SheetNames.push(ws_name)
133
+ wb.Sheets[ws_name] = ws
135
134
 
136
135
  var wbout = XLSX.write(wb, {
137
136
  bookType: 'xlsx',
138
137
  bookSST: false,
139
138
  type: 'binary'
140
- });
141
-
142
- saveAs(new Blob([s2ab(wbout)], {
143
- type: "application/octet-stream"
144
- }), "test.xlsx")
139
+ })
140
+
141
+ saveAs(
142
+ new Blob([s2ab(wbout)], {
143
+ type: 'application/octet-stream'
144
+ }),
145
+ 'test.xlsx'
146
+ )
145
147
  }
146
148
 
147
- export function export_json_to_excel({
148
- multiHeader = [],
149
- header,
150
- data,
151
- filename,
152
- merges = [],
153
- autoWidth = true,
154
- bookType = 'xlsx'
155
- } = {}, cellStyle = {}) {
149
+ export function export_json_to_excel(
150
+ { multiHeader = [], header, data, filename, merges = [], autoWidth = true, bookType = 'xlsx' } = {},
151
+ cellStyle = {}
152
+ ) {
156
153
  /* original data */
157
154
  filename = filename || 'excel-list'
158
155
  data = [...data]
159
- data.unshift(header);
156
+ data.unshift(header)
160
157
 
161
158
  for (let i = multiHeader.length - 1; i > -1; i--) {
162
159
  data.unshift(multiHeader[i])
163
160
  }
164
161
 
165
- var ws_name = "SheetJS";
162
+ var ws_name = 'SheetJS'
166
163
  var wb = new Workbook(),
167
- ws = sheet_from_array_of_arrays(data);
164
+ ws = sheet_from_array_of_arrays(data)
168
165
 
169
166
  if (merges.length > 0) {
170
- if (!ws['!merges']) ws['!merges'] = [];
171
- merges.forEach(item => {
167
+ if (!ws['!merges']) ws['!merges'] = []
168
+ merges.forEach((item) => {
172
169
  ws['!merges'].push(XLSX.utils.decode_range(item))
173
170
  })
174
171
  }
175
172
 
176
173
  if (autoWidth) {
177
174
  /*设置worksheet每列的最大宽度*/
178
- const colWidth = data.map(row => row.map(val => {
179
- /*先判断是否为null/undefined*/
180
- if (val == null) {
181
- return {
182
- 'wch': 10
183
- };
184
- }
185
- /*再判断是否为中文*/
186
- else if (val.toString().charCodeAt(0) > 255) {
187
- return {
188
- 'wch': val.toString().length * 2 < 20 ? 20 : val.toString().length * 2
189
- };
190
- } else {
191
- return {
192
- 'wch': val.toString().length * 2 < 20 ? 20 : val.toString().length * 2
193
- };
194
- }
195
- }))
175
+ const colWidth = data.map((row) =>
176
+ row.map((val) => {
177
+ /*先判断是否为null/undefined*/
178
+ if (val == null) {
179
+ return {
180
+ wch: 10
181
+ }
182
+ } else if (val.toString().charCodeAt(0) > 255) {
183
+ /*再判断是否为中文*/
184
+ return {
185
+ wch: val.toString().length * 2 < 20 ? 20 : val.toString().length * 2
186
+ }
187
+ } else {
188
+ return {
189
+ wch: val.toString().length * 2 < 20 ? 20 : val.toString().length * 2
190
+ }
191
+ }
192
+ })
193
+ )
196
194
  /*以第一行为初始值*/
197
- let result = colWidth[0];
195
+ let result = colWidth[0]
198
196
  for (let i = 1; i < colWidth.length; i++) {
199
197
  for (let j = 0; j < colWidth[i].length; j++) {
200
198
  if (result[j]['wch'] < colWidth[i][j]['wch']) {
201
- result[j]['wch'] = colWidth[i][j]['wch'];
199
+ result[j]['wch'] = colWidth[i][j]['wch']
202
200
  }
203
201
  }
204
202
  }
205
- ws['!cols'] = result;
203
+ ws['!cols'] = result
206
204
  }
207
205
 
208
206
  /* add worksheet to workbook */
209
- wb.SheetNames.push(ws_name);
210
- wb.Sheets[ws_name] = ws;
207
+ wb.SheetNames.push(ws_name)
208
+ wb.Sheets[ws_name] = ws
211
209
  // 设置某一列的单元格样式
212
- for(let key in ws) {
213
- for(let colName in cellStyle) {
214
- if(key.startsWith(colName)) {
210
+ for (let key in ws) {
211
+ for (let colName in cellStyle) {
212
+ if (key.startsWith(colName)) {
215
213
  ws[key].s = cellStyle[colName]
216
-
217
214
  }
218
215
  }
219
-
220
216
  }
221
217
  var wbout = XLSXS.write(wb, {
222
218
  bookType: bookType,
223
219
  bookSST: false,
224
220
  type: 'binary'
225
- });
226
- saveAs(new Blob([s2ab(wbout)], {
227
- type: "application/octet-stream"
228
- }), `${filename}.${bookType}`);
221
+ })
222
+ saveAs(
223
+ new Blob([s2ab(wbout)], {
224
+ type: 'application/octet-stream'
225
+ }),
226
+ `${filename}.${bookType}`
227
+ )
229
228
  }
@@ -14,11 +14,16 @@ export function export_txt_to_zip(th, jsonData, txtName, zipName) {
14
14
  txtData += `${tempStr}\r\n`
15
15
  })
16
16
  zip.file(`${txt_name}.txt`, txtData)
17
- zip.generateAsync({
18
- type: "blob"
19
- }).then((blob) => {
20
- saveAs(blob, `${zip_name}.zip`)
21
- }, (err) => {
22
- alert('导出失败')
23
- })
17
+ zip
18
+ .generateAsync({
19
+ type: 'blob'
20
+ })
21
+ .then(
22
+ (blob) => {
23
+ saveAs(blob, `${zip_name}.zip`)
24
+ },
25
+ (err) => {
26
+ alert('导出失败')
27
+ }
28
+ )
24
29
  }
@@ -2,4 +2,4 @@ import Vue from 'vue'
2
2
 
3
3
  const VueBus = new Vue()
4
4
 
5
- export default VueBus
5
+ export default VueBus
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.4.5",
3
+ "version": "2.4.7",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8" />