vue2-client 1.6.49 → 1.7.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 (119) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +628 -625
  3. package/index.js +30 -30
  4. package/package.json +81 -81
  5. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  6. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  7. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +667 -667
  8. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +733 -733
  9. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +468 -462
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +508 -508
  11. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +146 -140
  12. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  13. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  14. package/src/base-client/components/common/Upload/Upload.vue +168 -168
  15. package/src/base-client/components/common/XAddForm/XAddForm.vue +325 -325
  16. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +279 -279
  17. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  18. package/src/base-client/components/common/XForm/XForm.vue +180 -180
  19. package/src/base-client/components/common/XForm/XFormItem.vue +513 -513
  20. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  21. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  22. package/src/base-client/components/common/XFormTable/XFormTable.vue +344 -336
  23. package/src/base-client/components/common/XFormTable/index.md +97 -97
  24. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  25. package/src/base-client/components/common/XTable/XTable.vue +506 -506
  26. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  27. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  28. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  29. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  30. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  31. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  32. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  33. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  34. package/src/base-client/plugins/AppData.js +76 -76
  35. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  36. package/src/base-client/plugins/PagedList.js +177 -177
  37. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  38. package/src/base-client/plugins/i18n-extend.js +32 -32
  39. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  40. package/src/components/Ellipsis/index.md +38 -38
  41. package/src/components/NumberInfo/index.md +43 -43
  42. package/src/components/STable/README.md +341 -341
  43. package/src/components/STable/index.js +318 -318
  44. package/src/components/Trend/index.md +45 -45
  45. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  46. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  47. package/src/components/exception/ExceptionPage.vue +70 -70
  48. package/src/components/form/FormRow.vue +52 -52
  49. package/src/components/index.js +36 -36
  50. package/src/components/menu/SideMenu.vue +62 -62
  51. package/src/components/menu/menu.js +273 -273
  52. package/src/components/page/header/index.less +40 -40
  53. package/src/components/setting/Setting.vue +235 -235
  54. package/src/components/table/StandardTable.vue +141 -141
  55. package/src/components/table/advance/ActionColumns.vue +158 -158
  56. package/src/components/table/advance/SearchArea.vue +355 -355
  57. package/src/components/tool/AStepItem.vue +60 -60
  58. package/src/components/tool/AvatarList.vue +68 -68
  59. package/src/components/tool/Drawer.vue +142 -142
  60. package/src/components/tool/TagSelect.vue +83 -83
  61. package/src/components/transition/PageToggleTransition.vue +97 -97
  62. package/src/config/CreateQueryConfig.js +307 -307
  63. package/src/config/default/admin.config.js +18 -18
  64. package/src/config/replacer/resolve.config.js +67 -67
  65. package/src/layouts/CommonLayout.vue +42 -42
  66. package/src/layouts/ComponentLayoutOne.vue +47 -47
  67. package/src/layouts/PageLayout.vue +151 -151
  68. package/src/layouts/SinglePageView.vue +116 -116
  69. package/src/layouts/footer/PageFooter.vue +49 -49
  70. package/src/layouts/header/AdminHeader.vue +134 -134
  71. package/src/layouts/header/HeaderAvatar.vue +64 -64
  72. package/src/layouts/header/HeaderNotice.vue +176 -176
  73. package/src/layouts/header/HeaderSearch.vue +67 -67
  74. package/src/layouts/header/InstitutionDetail.vue +181 -181
  75. package/src/layouts/header/index.less +92 -92
  76. package/src/layouts/tabs/TabsHead.vue +190 -190
  77. package/src/layouts/tabs/TabsView.vue +379 -379
  78. package/src/mock/goods/index.js +108 -108
  79. package/src/pages/CreateQueryPage.vue +84 -84
  80. package/src/pages/login/Login.vue +369 -369
  81. package/src/pages/report/ReportTable.js +124 -124
  82. package/src/pages/report/ReportTableHome.vue +28 -28
  83. package/src/pages/resourceManage/orgListManage.vue +98 -98
  84. package/src/pages/system/dictionary/index.vue +43 -43
  85. package/src/pages/system/file/index.vue +317 -317
  86. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  87. package/src/pages/system/monitor/operLog/index.vue +36 -36
  88. package/src/pages/system/settings/index.vue +126 -126
  89. package/src/pages/system/settings/modifyPassword.vue +109 -109
  90. package/src/router/async/config.async.js +28 -28
  91. package/src/router/async/router.map.js +66 -68
  92. package/src/router/index.js +27 -27
  93. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  94. package/src/services/api/LogDetailsViewApi.js +10 -10
  95. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  96. package/src/services/api/TicketDetailsViewApi.js +34 -34
  97. package/src/services/api/cas.js +79 -79
  98. package/src/services/api/common.js +137 -132
  99. package/src/services/api/commonTempTable.js +10 -10
  100. package/src/services/api/index.js +17 -17
  101. package/src/services/api/logininfor/index.js +6 -6
  102. package/src/services/api/manage.js +8 -8
  103. package/src/services/apiService.js +14 -14
  104. package/src/services/user.js +67 -67
  105. package/src/store/modules/index.js +4 -4
  106. package/src/theme/default/nprogress.less +76 -76
  107. package/src/theme/default/style.less +58 -58
  108. package/src/utils/EncryptUtil.js +53 -53
  109. package/src/utils/colors.js +107 -107
  110. package/src/utils/excel/Blob.js +180 -180
  111. package/src/utils/excel/Export2Excel.js +141 -141
  112. package/src/utils/formatter.js +68 -68
  113. package/src/utils/i18n.js +80 -80
  114. package/src/utils/map-utils.js +37 -37
  115. package/src/utils/theme-color-replacer-extend.js +91 -91
  116. package/src/utils/themeUtil.js +100 -100
  117. package/src/utils/util.js +230 -230
  118. package/vue.config.js +106 -106
  119. package/src/pages/system/queryParams/index.vue +0 -43
@@ -1,180 +1,180 @@
1
- /* eslint-disable */
2
- /* Blob.js
3
- * A Blob implementation.
4
- * 2014-05-27
5
- *
6
- * By Eli Grey, http://eligrey.com
7
- * By Devin Samarin, https://github.com/eboyjr
8
- * License: X11/MIT
9
- * See LICENSE.md
10
- */
11
-
12
- /*global self, unescape */
13
- /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
14
- plusplus: true */
15
-
16
- /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
17
-
18
- (function (view) {
19
- "use strict";
20
-
21
- view.URL = view.URL || view.webkitURL;
22
-
23
- if (view.Blob && view.URL) {
24
- try {
25
- new Blob;
26
- return;
27
- } catch (e) {
28
- }
29
- }
30
-
31
- // Internally we use a BlobBuilder implementation to base Blob off of
32
- // in order to support older browsers that only have BlobBuilder
33
- const BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function (view) {
34
- const get_class = function (object) {
35
- return Object.prototype.toString.call(object).match(/^\[object\s(.*)]$/)[1];
36
- }
37
- , FakeBlobBuilder = function BlobBuilder() {
38
- this.data = [];
39
- }
40
- , FakeBlob = function Blob(data, type, encoding) {
41
- this.data = data;
42
- this.size = data.length;
43
- this.type = type;
44
- this.encoding = encoding;
45
- }
46
- , FBB_proto = FakeBlobBuilder.prototype
47
- , FB_proto = FakeBlob.prototype
48
- , FileReaderSync = view.FileReaderSync
49
- , FileException = function (type) {
50
- this.code = this[this.name = type];
51
- }
52
- , file_ex_codes = (
53
- "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
54
- + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
55
- ).split(" ")
56
- ;let file_ex_code = file_ex_codes.length
57
- ;const real_URL = view.URL || view.webkitURL || view
58
- , real_create_object_URL = real_URL.createObjectURL
59
- , real_revoke_object_URL = real_URL.revokeObjectURL
60
- ;let URL = real_URL
61
- ;const btoa = view.btoa
62
- , atob = view.atob
63
-
64
- , ArrayBuffer = view.ArrayBuffer
65
- , Uint8Array = view.Uint8Array
66
- ;
67
- FakeBlob.fake = FB_proto.fake = true;
68
- while (file_ex_code--) {
69
- FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
70
- }
71
- if (!real_URL.createObjectURL) {
72
- URL = view.URL = {};
73
- }
74
- URL.createObjectURL = function (blob) {
75
- let type = blob.type
76
- , data_URI_header
77
- ;
78
- if (type === null) {
79
- type = "application/octet-stream";
80
- }
81
- if (blob instanceof FakeBlob) {
82
- data_URI_header = "data:" + type;
83
- if (blob.encoding === "base64") {
84
- return data_URI_header + ";base64," + blob.data;
85
- } else if (blob.encoding === "URI") {
86
- return data_URI_header + "," + decodeURIComponent(blob.data);
87
- }
88
- if (btoa) {
89
- return data_URI_header + ";base64," + btoa(blob.data);
90
- } else {
91
- return data_URI_header + "," + encodeURIComponent(blob.data);
92
- }
93
- } else if (real_create_object_URL) {
94
- return real_create_object_URL.call(real_URL, blob);
95
- }
96
- };
97
- URL.revokeObjectURL = function (object_URL) {
98
- if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
99
- real_revoke_object_URL.call(real_URL, object_URL);
100
- }
101
- };
102
- FBB_proto.append = function (data/*, endings*/) {
103
- const bb = this.data;
104
- // decode data to a binary string
105
- if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
106
- let str = ""
107
- ;const buf = new Uint8Array(data)
108
- ;let i = 0
109
- ;const buf_len = buf.length
110
- ;
111
- for (; i < buf_len; i++) {
112
- str += String.fromCharCode(buf[i]);
113
- }
114
- bb.push(str);
115
- } else if (get_class(data) === "Blob" || get_class(data) === "File") {
116
- if (FileReaderSync) {
117
- const fr = new FileReaderSync;
118
- bb.push(fr.readAsBinaryString(data));
119
- } else {
120
- // async FileReader won't work as BlobBuilder is sync
121
- throw new FileException("NOT_READABLE_ERR");
122
- }
123
- } else if (data instanceof FakeBlob) {
124
- if (data.encoding === "base64" && atob) {
125
- bb.push(atob(data.data));
126
- } else if (data.encoding === "URI") {
127
- bb.push(decodeURIComponent(data.data));
128
- } else if (data.encoding === "raw") {
129
- bb.push(data.data);
130
- }
131
- } else {
132
- if (typeof data !== "string") {
133
- data += ""; // convert unsupported types to strings
134
- }
135
- // decode UTF-16 to binary string
136
- bb.push(unescape(encodeURIComponent(data)));
137
- }
138
- };
139
- FBB_proto.getBlob = function (type) {
140
- if (!arguments.length) {
141
- type = null;
142
- }
143
- return new FakeBlob(this.data.join(""), type, "raw");
144
- };
145
- FBB_proto.toString = function () {
146
- return "[object BlobBuilder]";
147
- };
148
- FB_proto.slice = function (start, end, type) {
149
- const args = arguments.length;
150
- if (args < 3) {
151
- type = null;
152
- }
153
- return new FakeBlob(
154
- this.data.slice(start, args > 1 ? end : this.data.length)
155
- , type
156
- , this.encoding
157
- );
158
- };
159
- FB_proto.toString = function () {
160
- return "[object Blob]";
161
- };
162
- FB_proto.close = function () {
163
- this.size = this.data.length = 0;
164
- };
165
- return FakeBlobBuilder;
166
- }(view));
167
-
168
- view.Blob = function Blob(blobParts, options) {
169
- const type = options ? (options.type || "") : "";
170
- const builder = new BlobBuilder();
171
- if (blobParts) {
172
- let i = 0;
173
- const len = blobParts.length;
174
- for (; i < len; i++) {
175
- builder.append(blobParts[i]);
176
- }
177
- }
178
- return builder.getBlob(type);
179
- };
180
- }(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
1
+ /* eslint-disable */
2
+ /* Blob.js
3
+ * A Blob implementation.
4
+ * 2014-05-27
5
+ *
6
+ * By Eli Grey, http://eligrey.com
7
+ * By Devin Samarin, https://github.com/eboyjr
8
+ * License: X11/MIT
9
+ * See LICENSE.md
10
+ */
11
+
12
+ /*global self, unescape */
13
+ /*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
14
+ plusplus: true */
15
+
16
+ /*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */
17
+
18
+ (function (view) {
19
+ "use strict";
20
+
21
+ view.URL = view.URL || view.webkitURL;
22
+
23
+ if (view.Blob && view.URL) {
24
+ try {
25
+ new Blob;
26
+ return;
27
+ } catch (e) {
28
+ }
29
+ }
30
+
31
+ // Internally we use a BlobBuilder implementation to base Blob off of
32
+ // in order to support older browsers that only have BlobBuilder
33
+ const BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function (view) {
34
+ const get_class = function (object) {
35
+ return Object.prototype.toString.call(object).match(/^\[object\s(.*)]$/)[1];
36
+ }
37
+ , FakeBlobBuilder = function BlobBuilder() {
38
+ this.data = [];
39
+ }
40
+ , FakeBlob = function Blob(data, type, encoding) {
41
+ this.data = data;
42
+ this.size = data.length;
43
+ this.type = type;
44
+ this.encoding = encoding;
45
+ }
46
+ , FBB_proto = FakeBlobBuilder.prototype
47
+ , FB_proto = FakeBlob.prototype
48
+ , FileReaderSync = view.FileReaderSync
49
+ , FileException = function (type) {
50
+ this.code = this[this.name = type];
51
+ }
52
+ , file_ex_codes = (
53
+ "NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "
54
+ + "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR"
55
+ ).split(" ")
56
+ ;let file_ex_code = file_ex_codes.length
57
+ ;const real_URL = view.URL || view.webkitURL || view
58
+ , real_create_object_URL = real_URL.createObjectURL
59
+ , real_revoke_object_URL = real_URL.revokeObjectURL
60
+ ;let URL = real_URL
61
+ ;const btoa = view.btoa
62
+ , atob = view.atob
63
+
64
+ , ArrayBuffer = view.ArrayBuffer
65
+ , Uint8Array = view.Uint8Array
66
+ ;
67
+ FakeBlob.fake = FB_proto.fake = true;
68
+ while (file_ex_code--) {
69
+ FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;
70
+ }
71
+ if (!real_URL.createObjectURL) {
72
+ URL = view.URL = {};
73
+ }
74
+ URL.createObjectURL = function (blob) {
75
+ let type = blob.type
76
+ , data_URI_header
77
+ ;
78
+ if (type === null) {
79
+ type = "application/octet-stream";
80
+ }
81
+ if (blob instanceof FakeBlob) {
82
+ data_URI_header = "data:" + type;
83
+ if (blob.encoding === "base64") {
84
+ return data_URI_header + ";base64," + blob.data;
85
+ } else if (blob.encoding === "URI") {
86
+ return data_URI_header + "," + decodeURIComponent(blob.data);
87
+ }
88
+ if (btoa) {
89
+ return data_URI_header + ";base64," + btoa(blob.data);
90
+ } else {
91
+ return data_URI_header + "," + encodeURIComponent(blob.data);
92
+ }
93
+ } else if (real_create_object_URL) {
94
+ return real_create_object_URL.call(real_URL, blob);
95
+ }
96
+ };
97
+ URL.revokeObjectURL = function (object_URL) {
98
+ if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {
99
+ real_revoke_object_URL.call(real_URL, object_URL);
100
+ }
101
+ };
102
+ FBB_proto.append = function (data/*, endings*/) {
103
+ const bb = this.data;
104
+ // decode data to a binary string
105
+ if (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {
106
+ let str = ""
107
+ ;const buf = new Uint8Array(data)
108
+ ;let i = 0
109
+ ;const buf_len = buf.length
110
+ ;
111
+ for (; i < buf_len; i++) {
112
+ str += String.fromCharCode(buf[i]);
113
+ }
114
+ bb.push(str);
115
+ } else if (get_class(data) === "Blob" || get_class(data) === "File") {
116
+ if (FileReaderSync) {
117
+ const fr = new FileReaderSync;
118
+ bb.push(fr.readAsBinaryString(data));
119
+ } else {
120
+ // async FileReader won't work as BlobBuilder is sync
121
+ throw new FileException("NOT_READABLE_ERR");
122
+ }
123
+ } else if (data instanceof FakeBlob) {
124
+ if (data.encoding === "base64" && atob) {
125
+ bb.push(atob(data.data));
126
+ } else if (data.encoding === "URI") {
127
+ bb.push(decodeURIComponent(data.data));
128
+ } else if (data.encoding === "raw") {
129
+ bb.push(data.data);
130
+ }
131
+ } else {
132
+ if (typeof data !== "string") {
133
+ data += ""; // convert unsupported types to strings
134
+ }
135
+ // decode UTF-16 to binary string
136
+ bb.push(unescape(encodeURIComponent(data)));
137
+ }
138
+ };
139
+ FBB_proto.getBlob = function (type) {
140
+ if (!arguments.length) {
141
+ type = null;
142
+ }
143
+ return new FakeBlob(this.data.join(""), type, "raw");
144
+ };
145
+ FBB_proto.toString = function () {
146
+ return "[object BlobBuilder]";
147
+ };
148
+ FB_proto.slice = function (start, end, type) {
149
+ const args = arguments.length;
150
+ if (args < 3) {
151
+ type = null;
152
+ }
153
+ return new FakeBlob(
154
+ this.data.slice(start, args > 1 ? end : this.data.length)
155
+ , type
156
+ , this.encoding
157
+ );
158
+ };
159
+ FB_proto.toString = function () {
160
+ return "[object Blob]";
161
+ };
162
+ FB_proto.close = function () {
163
+ this.size = this.data.length = 0;
164
+ };
165
+ return FakeBlobBuilder;
166
+ }(view));
167
+
168
+ view.Blob = function Blob(blobParts, options) {
169
+ const type = options ? (options.type || "") : "";
170
+ const builder = new BlobBuilder();
171
+ if (blobParts) {
172
+ let i = 0;
173
+ const len = blobParts.length;
174
+ for (; i < len; i++) {
175
+ builder.append(blobParts[i]);
176
+ }
177
+ }
178
+ return builder.getBlob(type);
179
+ };
180
+ }(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));
@@ -1,141 +1,141 @@
1
- /* eslint-disable */
2
- require('script-loader!file-saver');
3
- require('./Blob.js');
4
- require('script-loader!xlsx/dist/xlsx.core.min');
5
-
6
- function generateArray(table) {
7
- const out = [];
8
- const rows = table.querySelectorAll('tr');
9
- const ranges = [];
10
- for (let R = 0; R < rows.length; ++R) {
11
- const outRow = [];
12
- const row = rows[R];
13
- const columns = row.querySelectorAll('td');
14
- for (let C = 0; C < columns.length; ++C) {
15
- const cell = columns[C];
16
- let colspan = cell.getAttribute('colspan');
17
- let rowspan = cell.getAttribute('rowspan');
18
- let cellValue = cell.innerText;
19
- if (cellValue !== "" && cellValue === +cellValue) cellValue = +cellValue;
20
-
21
- //Skip ranges
22
- ranges.forEach(function (range) {
23
- if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
24
- for (let i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
25
- }
26
- });
27
-
28
- //Handle Row Span
29
- if (rowspan || colspan) {
30
- rowspan = rowspan || 1;
31
- colspan = colspan || 1;
32
- ranges.push({s: {r: R, c: outRow.length}, e: {r: R + rowspan - 1, c: outRow.length + colspan - 1}});
33
- }
34
-
35
- //Handle Value
36
- outRow.push(cellValue !== "" ? cellValue : null);
37
-
38
- //Handle Colspan
39
- if (colspan) for (let k = 0; k < colspan - 1; ++k) outRow.push(null);
40
- }
41
- out.push(outRow);
42
- }
43
- return [out, ranges];
44
- }
45
-
46
- function datenum(v, date1904) {
47
- if (date1904) v += 1462;
48
- const epoch = Date.parse(v);
49
- return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
50
- }
51
-
52
- function sheet_from_array_of_arrays(data, opts) {
53
- const ws = {};
54
- const range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}};
55
- for (let R = 0; R !== data.length; ++R) {
56
- for (let C = 0; C !== data[R].length; ++C) {
57
- if (range.s.r > R) range.s.r = R;
58
- if (range.s.c > C) range.s.c = C;
59
- if (range.e.r < R) range.e.r = R;
60
- if (range.e.c < C) range.e.c = C;
61
- const cell = {v: data[R][C]};
62
- if (cell.v == null) continue;
63
- const cell_ref = XLSX.utils.encode_cell({c: C, r: R});
64
-
65
- if (typeof cell.v === 'number') cell.t = 'n';
66
- else if (typeof cell.v === 'boolean') cell.t = 'b';
67
- else if (cell.v instanceof Date) {
68
- cell.t = 'n';
69
- cell.z = XLSX.SSF._table[14];
70
- cell.v = datenum(cell.v);
71
- } else cell.t = 's';
72
-
73
- ws[cell_ref] = cell;
74
- }
75
- }
76
- if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
77
- return ws;
78
- }
79
-
80
- function Workbook() {
81
- if (!(this instanceof Workbook)) return new Workbook();
82
- this.SheetNames = [];
83
- this.Sheets = {};
84
- }
85
-
86
- function s2ab(s) {
87
- const buf = new ArrayBuffer(s.length);
88
- const view = new Uint8Array(buf);
89
- for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
90
- return buf;
91
- }
92
-
93
- export function exportTable(id) {
94
- const theTable = document.getElementById(id);
95
- console.log('a')
96
- const oo = generateArray(theTable);
97
- const ranges = oo[1];
98
-
99
- /* original data */
100
- const data = oo[0];
101
- const ws_name = "SheetJS";
102
- console.log(data);
103
-
104
- const wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
105
-
106
- /* add ranges to worksheet */
107
- // ws['!cols'] = ['apple', 'banan'];
108
- ws['!merges'] = ranges;
109
-
110
- /* add worksheet to workbook */
111
- wb.SheetNames.push(ws_name);
112
- wb.Sheets[ws_name] = ws;
113
-
114
- const wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
115
-
116
- saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx")
117
- }
118
-
119
- function formatJson(jsonData) {
120
- console.log(jsonData)
121
- }
122
-
123
- export function exportJson(th, jsonData, defaultTitle) {
124
-
125
- /* original data */
126
-
127
- const data = jsonData;
128
- data.unshift(th);
129
- const ws_name = "SheetJS";
130
-
131
- const wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
132
-
133
-
134
- /* add worksheet to workbook */
135
- wb.SheetNames.push(ws_name);
136
- wb.Sheets[ws_name] = ws;
137
-
138
- const wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
139
- const title = defaultTitle || '列表';
140
- saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx")
141
- }
1
+ /* eslint-disable */
2
+ require('script-loader!file-saver');
3
+ require('./Blob.js');
4
+ require('script-loader!xlsx/dist/xlsx.core.min');
5
+
6
+ function generateArray(table) {
7
+ const out = [];
8
+ const rows = table.querySelectorAll('tr');
9
+ const ranges = [];
10
+ for (let R = 0; R < rows.length; ++R) {
11
+ const outRow = [];
12
+ const row = rows[R];
13
+ const columns = row.querySelectorAll('td');
14
+ for (let C = 0; C < columns.length; ++C) {
15
+ const cell = columns[C];
16
+ let colspan = cell.getAttribute('colspan');
17
+ let rowspan = cell.getAttribute('rowspan');
18
+ let cellValue = cell.innerText;
19
+ if (cellValue !== "" && cellValue === +cellValue) cellValue = +cellValue;
20
+
21
+ //Skip ranges
22
+ ranges.forEach(function (range) {
23
+ if (R >= range.s.r && R <= range.e.r && outRow.length >= range.s.c && outRow.length <= range.e.c) {
24
+ for (let i = 0; i <= range.e.c - range.s.c; ++i) outRow.push(null);
25
+ }
26
+ });
27
+
28
+ //Handle Row Span
29
+ if (rowspan || colspan) {
30
+ rowspan = rowspan || 1;
31
+ colspan = colspan || 1;
32
+ ranges.push({s: {r: R, c: outRow.length}, e: {r: R + rowspan - 1, c: outRow.length + colspan - 1}});
33
+ }
34
+
35
+ //Handle Value
36
+ outRow.push(cellValue !== "" ? cellValue : null);
37
+
38
+ //Handle Colspan
39
+ if (colspan) for (let k = 0; k < colspan - 1; ++k) outRow.push(null);
40
+ }
41
+ out.push(outRow);
42
+ }
43
+ return [out, ranges];
44
+ }
45
+
46
+ function datenum(v, date1904) {
47
+ if (date1904) v += 1462;
48
+ const epoch = Date.parse(v);
49
+ return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
50
+ }
51
+
52
+ function sheet_from_array_of_arrays(data, opts) {
53
+ const ws = {};
54
+ const range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}};
55
+ for (let R = 0; R !== data.length; ++R) {
56
+ for (let C = 0; C !== data[R].length; ++C) {
57
+ if (range.s.r > R) range.s.r = R;
58
+ if (range.s.c > C) range.s.c = C;
59
+ if (range.e.r < R) range.e.r = R;
60
+ if (range.e.c < C) range.e.c = C;
61
+ const cell = {v: data[R][C]};
62
+ if (cell.v == null) continue;
63
+ const cell_ref = XLSX.utils.encode_cell({c: C, r: R});
64
+
65
+ if (typeof cell.v === 'number') cell.t = 'n';
66
+ else if (typeof cell.v === 'boolean') cell.t = 'b';
67
+ else if (cell.v instanceof Date) {
68
+ cell.t = 'n';
69
+ cell.z = XLSX.SSF._table[14];
70
+ cell.v = datenum(cell.v);
71
+ } else cell.t = 's';
72
+
73
+ ws[cell_ref] = cell;
74
+ }
75
+ }
76
+ if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);
77
+ return ws;
78
+ }
79
+
80
+ function Workbook() {
81
+ if (!(this instanceof Workbook)) return new Workbook();
82
+ this.SheetNames = [];
83
+ this.Sheets = {};
84
+ }
85
+
86
+ function s2ab(s) {
87
+ const buf = new ArrayBuffer(s.length);
88
+ const view = new Uint8Array(buf);
89
+ for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
90
+ return buf;
91
+ }
92
+
93
+ export function exportTable(id) {
94
+ const theTable = document.getElementById(id);
95
+ console.log('a')
96
+ const oo = generateArray(theTable);
97
+ const ranges = oo[1];
98
+
99
+ /* original data */
100
+ const data = oo[0];
101
+ const ws_name = "SheetJS";
102
+ console.log(data);
103
+
104
+ const wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
105
+
106
+ /* add ranges to worksheet */
107
+ // ws['!cols'] = ['apple', 'banan'];
108
+ ws['!merges'] = ranges;
109
+
110
+ /* add worksheet to workbook */
111
+ wb.SheetNames.push(ws_name);
112
+ wb.Sheets[ws_name] = ws;
113
+
114
+ const wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
115
+
116
+ saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx")
117
+ }
118
+
119
+ function formatJson(jsonData) {
120
+ console.log(jsonData)
121
+ }
122
+
123
+ export function exportJson(th, jsonData, defaultTitle) {
124
+
125
+ /* original data */
126
+
127
+ const data = jsonData;
128
+ data.unshift(th);
129
+ const ws_name = "SheetJS";
130
+
131
+ const wb = new Workbook(), ws = sheet_from_array_of_arrays(data);
132
+
133
+
134
+ /* add worksheet to workbook */
135
+ wb.SheetNames.push(ws_name);
136
+ wb.Sheets[ws_name] = ws;
137
+
138
+ const wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'});
139
+ const title = defaultTitle || '列表';
140
+ saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx")
141
+ }