vue2-client 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/.env +15 -15
  2. package/CHANGELOG.md +31 -1
  3. package/Components.md +60 -0
  4. package/index.js +39 -30
  5. package/package.json +4 -2
  6. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +316 -316
  7. package/src/base-client/components/common/CitySelect/CitySelect.vue +247 -247
  8. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -667
  9. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +735 -733
  10. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +466 -468
  11. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +510 -508
  12. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +144 -146
  13. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +165 -165
  14. package/src/base-client/components/common/JSONToTree/jsontotree.vue +275 -275
  15. package/src/base-client/components/common/Upload/Upload.vue +168 -168
  16. package/src/base-client/components/common/XAddForm/XAddForm.vue +72 -325
  17. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +365 -279
  18. package/src/base-client/components/common/XAddNativeForm/index.md +96 -56
  19. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  20. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -0
  21. package/src/base-client/components/common/XDataDrawer/index.js +3 -0
  22. package/src/base-client/components/common/XDataDrawer/index.md +41 -0
  23. package/src/base-client/components/common/XForm/XForm.vue +178 -180
  24. package/src/base-client/components/common/XForm/XFormItem.vue +521 -513
  25. package/src/base-client/components/common/XForm/XTreeSelect.vue +184 -184
  26. package/src/base-client/components/common/XFormCol/XFormCol.vue +38 -38
  27. package/src/base-client/components/common/XFormTable/XFormTable.vue +356 -344
  28. package/src/base-client/components/common/XFormTable/index.md +97 -97
  29. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +132 -132
  30. package/src/base-client/components/common/XTable/XTable.vue +519 -506
  31. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +111 -111
  32. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +231 -231
  33. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  34. package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +807 -807
  35. package/src/base-client/components/ticket/TicketDetailsView/index.md +29 -29
  36. package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +260 -260
  37. package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +532 -532
  38. package/src/base-client/components/ticket/TicketSubmitSuccessView/index.md +29 -29
  39. package/src/base-client/plugins/AppData.js +76 -76
  40. package/src/base-client/plugins/GetLoginInfoService.js +179 -179
  41. package/src/base-client/plugins/PagedList.js +177 -177
  42. package/src/base-client/plugins/compatible/LoginServiceOA.js +20 -20
  43. package/src/base-client/plugins/i18n-extend.js +32 -32
  44. package/src/components/Ellipsis/Ellipsis.vue +65 -65
  45. package/src/components/Ellipsis/index.md +38 -38
  46. package/src/components/NumberInfo/index.md +43 -43
  47. package/src/components/STable/README.md +341 -341
  48. package/src/components/STable/index.js +318 -318
  49. package/src/components/Trend/index.md +45 -45
  50. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  51. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  52. package/src/components/exception/ExceptionPage.vue +70 -70
  53. package/src/components/form/FormRow.vue +52 -52
  54. package/src/components/index.js +36 -36
  55. package/src/components/menu/SideMenu.vue +62 -62
  56. package/src/components/menu/menu.js +273 -273
  57. package/src/components/page/header/index.less +40 -40
  58. package/src/components/setting/Setting.vue +235 -235
  59. package/src/components/table/StandardTable.vue +141 -141
  60. package/src/components/table/advance/ActionColumns.vue +158 -158
  61. package/src/components/table/advance/SearchArea.vue +355 -355
  62. package/src/components/tool/AStepItem.vue +60 -60
  63. package/src/components/tool/AvatarList.vue +68 -68
  64. package/src/components/tool/Drawer.vue +142 -142
  65. package/src/components/tool/TagSelect.vue +83 -83
  66. package/src/components/transition/PageToggleTransition.vue +97 -97
  67. package/src/config/CreateQueryConfig.js +307 -307
  68. package/src/config/default/admin.config.js +18 -18
  69. package/src/config/default/setting.config.js +3 -1
  70. package/src/config/replacer/resolve.config.js +67 -67
  71. package/src/layouts/CommonLayout.vue +42 -42
  72. package/src/layouts/ComponentLayoutOne.vue +47 -47
  73. package/src/layouts/PageLayout.vue +151 -151
  74. package/src/layouts/SinglePageView.vue +116 -116
  75. package/src/layouts/footer/PageFooter.vue +49 -49
  76. package/src/layouts/header/AdminHeader.vue +134 -134
  77. package/src/layouts/header/HeaderAvatar.vue +64 -64
  78. package/src/layouts/header/HeaderNotice.vue +176 -176
  79. package/src/layouts/header/HeaderSearch.vue +67 -67
  80. package/src/layouts/header/InstitutionDetail.vue +181 -181
  81. package/src/layouts/header/index.less +92 -92
  82. package/src/layouts/tabs/TabsHead.vue +190 -190
  83. package/src/layouts/tabs/TabsView.vue +379 -379
  84. package/src/mock/goods/index.js +108 -108
  85. package/src/pages/CreateQueryPage.vue +84 -84
  86. package/src/pages/login/Login.vue +369 -369
  87. package/src/pages/report/ReportTable.js +124 -124
  88. package/src/pages/report/ReportTableHome.vue +28 -28
  89. package/src/pages/resourceManage/orgListManage.vue +98 -98
  90. package/src/pages/system/dictionary/index.vue +43 -43
  91. package/src/pages/system/file/index.vue +317 -317
  92. package/src/pages/system/monitor/loginInfor/index.vue +36 -36
  93. package/src/pages/system/monitor/operLog/index.vue +36 -36
  94. package/src/pages/system/settings/index.vue +126 -126
  95. package/src/pages/system/settings/modifyPassword.vue +109 -109
  96. package/src/router/async/config.async.js +28 -28
  97. package/src/router/async/router.map.js +66 -66
  98. package/src/router/guards.js +52 -12
  99. package/src/router/index.js +27 -27
  100. package/src/services/api/DictionaryDetailsViewApi.js +6 -6
  101. package/src/services/api/LogDetailsViewApi.js +10 -10
  102. package/src/services/api/QueryParamsDetailsViewApi.js +6 -6
  103. package/src/services/api/TicketDetailsViewApi.js +34 -34
  104. package/src/services/api/cas.js +79 -79
  105. package/src/services/api/common.js +137 -137
  106. package/src/services/api/commonTempTable.js +10 -10
  107. package/src/services/api/index.js +17 -17
  108. package/src/services/api/logininfor/index.js +6 -6
  109. package/src/services/api/manage.js +8 -8
  110. package/src/services/apiService.js +14 -14
  111. package/src/services/user.js +67 -67
  112. package/src/store/modules/index.js +4 -4
  113. package/src/theme/default/nprogress.less +76 -76
  114. package/src/theme/default/style.less +58 -58
  115. package/src/utils/EncryptUtil.js +53 -53
  116. package/src/utils/colors.js +107 -107
  117. package/src/utils/excel/Blob.js +180 -180
  118. package/src/utils/excel/Export2Excel.js +141 -141
  119. package/src/utils/formatter.js +68 -68
  120. package/src/utils/i18n.js +80 -80
  121. package/src/utils/login.js +138 -0
  122. package/src/utils/map-utils.js +37 -37
  123. package/src/utils/theme-color-replacer-extend.js +91 -91
  124. package/src/utils/themeUtil.js +100 -100
  125. package/src/utils/util.js +230 -230
  126. package/vue.config.js +106 -106
@@ -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
+ }