emacroh5lib 1.0.87 → 1.0.89

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.
@@ -1,24 +1,69 @@
1
1
  <template>
2
2
  <div class="app-container">
3
-
4
3
  <button @click="handleOpen">打开查看器</button>
5
4
  <button @click="handleOpen2">打开模型查看器查看器</button>
6
5
  <button @click="exportExcel($event)">透过Excel模板导出表格</button>
6
+ <button @click="importExcel($event)">读取excel文件</button>
7
7
  <button @click="selectFile($event)">选择文件</button>
8
8
  <button @click="fileMD5($event)">文件MD5</button>
9
9
  <button @click="excelTest()">Excel测试</button>
10
+ <button @click="printElement('printtestdiv')">打印元素</button>
11
+
12
+ <div id="printtestdiv">
13
+ <div
14
+ style="
15
+ width: 100%;
16
+ height: 100%;
17
+ background-color: aqua;
18
+ color: royalblue;
19
+ left: 0;
20
+ top: 0;
21
+ "
22
+ >
23
+ <label>打印测试</label>
24
+
25
+ <div>1111</div>
26
+
27
+ <div style="margin-top: 29vh; font-size: 46px">就算...</div>
28
+ </div>
29
+ </div>
10
30
 
11
- <image-viewer :list="srcList" @open="openCallback" @close="closeCallback" :show.sync="showViewer"
12
- :currentIndex="currentIndex" />
31
+ <image-viewer
32
+ :list="srcList"
33
+ @open="openCallback"
34
+ @close="closeCallback"
35
+ :show.sync="showViewer"
36
+ :currentIndex="currentIndex"
37
+ />
13
38
 
14
39
  <div class="list" id="list" v-if="false">
15
- <DragResizeView v-for="(rect, index) in rects" :key="index" :isStorage="true" :name="rect.name" :w="rect.width"
16
- :h="rect.height" :x="rect.left" :y="rect.top" :parentW="listWidth" :parentH="listHeight" :axis="rect.axis"
17
- :isActive="rect.active" :minw="rect.minw" :minh="rect.minh" :isDraggable="rect.draggable"
18
- :isResizable="rect.resizable" :parentLimitation="rect.parentLim" :snapToGrid="rect.snapToGrid"
19
- :aspectRatio="rect.aspectRatio" :z="rect.zIndex" :contentClass="rect.class" v-on:activated="activateEv(index)"
20
- v-on:deactivated="deactivateEv(index)" v-on:dragging="changePosition($event, index)"
21
- v-on:resizing="changeSize($event, index)">
40
+ <DragResizeView
41
+ v-for="(rect, index) in rects"
42
+ :key="index"
43
+ :isStorage="true"
44
+ :name="rect.name"
45
+ :w="rect.width"
46
+ :h="rect.height"
47
+ :x="rect.left"
48
+ :y="rect.top"
49
+ :parentW="listWidth"
50
+ :parentH="listHeight"
51
+ :axis="rect.axis"
52
+ :isActive="rect.active"
53
+ :minw="rect.minw"
54
+ :minh="rect.minh"
55
+ :isDraggable="rect.draggable"
56
+ :isResizable="rect.resizable"
57
+ :parentLimitation="rect.parentLim"
58
+ :snapToGrid="rect.snapToGrid"
59
+ :aspectRatio="rect.aspectRatio"
60
+ :z="rect.zIndex"
61
+ :contentClass="rect.class"
62
+ v-on:activated="activateEv(index)"
63
+ v-on:deactivated="deactivateEv(index)"
64
+ v-on:dragging="changePosition($event, index)"
65
+ v-on:resizing="changeSize($event, index)"
66
+ >
22
67
  <div class="filler" :style="{ backgroundColor: rect.color }"></div>
23
68
  </DragResizeView>
24
69
  </div>
@@ -26,328 +71,386 @@
26
71
  <Draw v-if="false">
27
72
  <div class="filler2">111</div>
28
73
  </Draw>
29
-
30
- <!-- <video-viewer :list="srcList" :show.sync="showVideoViewer" width="80%" height="80%" /> -->
31
- <model-viewer :list="modelList" :show.sync="showModelViewer" width="90%" height="90%" :background="null" />
32
74
 
75
+ <!-- <video-viewer :list="srcList" :show.sync="showVideoViewer" width="80%" height="80%" /> -->
76
+ <model-viewer
77
+ :list="modelList"
78
+ :show.sync="showModelViewer"
79
+ width="90%"
80
+ height="90%"
81
+ :background="null"
82
+ />
33
83
  </div>
34
84
  </template>
35
85
 
36
86
  <script lang="ts">
37
- import { Component, Vue } from "vue-property-decorator";
38
- import ImageViewer from "@/views/ImageViewer/index.vue";
39
- import VideoViewer from "@/views/VideoViewer/index.vue";
40
- import ModelViewer from "@/views/ModelViewer/index.vue";
41
- import DragResizeView from "@/views/DragResizeView/index.vue";
42
- import Draw from "@/views/Draw/index.vue";
43
- import { formatJson, export_json_to_excel, number_to_excel, testToExcel } from "./Export2Excel"
44
- import { EMacro } from "../../utilities/EMacro";
45
- import axios from 'axios'
46
- import Cookie from 'js-cookie'
47
- import LAY_EXCEL from 'lay-excel';
48
- import BMF from 'browser-md5-file';
49
- import { info } from "console";
50
- import base64 from "./txt.js";
51
-
52
-
53
- @Component({
54
- components: {
55
- ImageViewer,
56
- DragResizeView,
57
- VideoViewer,
58
- ModelViewer,
59
- Draw
60
- },
61
- mounted() {
62
-
63
- }
64
- })
65
- export default class TestView extends Vue {
66
-
67
-
68
- public currentIndex: Number = 0; // 打开图片查看器时,需要定位到的图片的索引
69
- public srcList: Array<String> = [
70
- "http://emacrosys.cn:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\看板整体图.png",
71
- "http://emacrosys.cn:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\060 广西电子商务公共服务平台大数据中心.png",
72
- "https://scpic.chinaz.net/files/pic/pic9/202203/apic39703.jpg",
73
- "https://scpic.chinaz.net/files/pic/pic9/202005/zzpic24899.jpg",
74
- "https://scpic.chinaz.net/files/pic/pic9/202109/bpic24244.jpg",
75
- "https://scpic.chinaz.net/files/pic/pic9/202110/hpic4529.jpg",
76
- "https://scpic.chinaz.net/files/pic/pic9/201912/zzpic22106.jpg",
77
- "https://scpic.chinaz.net/files/pic/pic9/202202/apic38580.jpg",
78
- // "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\编程向未来.mp4",
79
- // "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\ker.mp4",
80
- // "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\video2.mp4",
81
- // "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\看板整体图.png",
82
- ] // 图片查看器数据集
83
-
84
- public modelList: Array<Object> = [{
87
+ import { Component, Vue } from "vue-property-decorator";
88
+ import ImageViewer from "@/views/ImageViewer/index.vue";
89
+ import VideoViewer from "@/views/VideoViewer/index.vue";
90
+ import ModelViewer from "@/views/ModelViewer/index.vue";
91
+ import DragResizeView from "@/views/DragResizeView/index.vue";
92
+ import Draw from "@/views/Draw/index.vue";
93
+ import {
94
+ formatJson,
95
+ export_json_to_excel,
96
+ number_to_excel,
97
+ testToExcel,
98
+ } from "./Export2Excel";
99
+ import { EMacro } from "../../utilities/EMacro";
100
+ import axios from "axios";
101
+ import Cookie from "js-cookie";
102
+ import LAY_EXCEL from "lay-excel";
103
+ import BMF from "browser-md5-file";
104
+ import { info } from "console";
105
+ import base64 from "./txt.js";
106
+
107
+ @Component({
108
+ components: {
109
+ ImageViewer,
110
+ DragResizeView,
111
+ VideoViewer,
112
+ ModelViewer,
113
+ Draw,
114
+ },
115
+ mounted() {},
116
+ })
117
+ export default class TestView extends Vue {
118
+ public currentIndex: Number = 0; // 打开图片查看器时,需要定位到的图片的索引
119
+ public srcList: Array<String> = [
120
+ "http://emacrosys.cn:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\看板整体图.png",
121
+ "http://emacrosys.cn:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\060 广西电子商务公共服务平台大数据中心.png",
122
+ "https://scpic.chinaz.net/files/pic/pic9/202203/apic39703.jpg",
123
+ "https://scpic.chinaz.net/files/pic/pic9/202005/zzpic24899.jpg",
124
+ "https://scpic.chinaz.net/files/pic/pic9/202109/bpic24244.jpg",
125
+ "https://scpic.chinaz.net/files/pic/pic9/202110/hpic4529.jpg",
126
+ "https://scpic.chinaz.net/files/pic/pic9/201912/zzpic22106.jpg",
127
+ "https://scpic.chinaz.net/files/pic/pic9/202202/apic38580.jpg",
128
+ // "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\编程向未来.mp4",
129
+ // "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\ker.mp4",
130
+ // "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\video2.mp4",
131
+ // "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\看板整体图.png",
132
+ ]; // 图片查看器数据集
133
+
134
+ public modelList: Array<Object> = [
135
+ {
85
136
  type: "obj",
86
137
  name: "产品1",
87
138
  // mtl: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\test.mtl",
88
139
  // obj: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:/SOP/PCB001/test.obj"
89
140
  mtl: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\File\\book\\test7.mtl",
90
- obj: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\File\\book\\test7.obj"
91
- }, {
141
+ obj: "http://www.emacrosys.cn:8019/H5/GetFile?type=0&path=C:\\SOP\\File\\book\\test7.obj",
142
+ },
143
+ {
92
144
  type: "obj",
93
145
  name: "产品2",
94
146
  mtl: "http://221.225.49.240:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\test.mtl",
95
- obj: "http://221.225.49.240:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\test.obj"
96
- }]
97
-
98
- // public src: String = "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\编程向未来.mp4"
99
-
100
- public showViewer: Boolean = false // 是否打开图片查看器
101
- public showVideoViewer: Boolean = false // 是否打开图片查看器
102
- public showModelViewer: Boolean = false
103
-
104
- public listWidth = 0;
105
- public listHeight = 0;
106
-
107
- public handleOpen() {
108
- this.showViewer = true;
109
- // this.showVideoViewer = true;
110
- }
111
-
112
- public handleOpen2() {
113
- this.showModelViewer = true;
114
- // this.showVideoViewer = true;
115
- }
116
-
117
- public openCallback() { } // 打开时的回调
118
- public closeCallback() { } // 关闭时的回调
119
-
120
- public rects = [
121
- {
122
- 'name': "test-0",
123
- 'width': 200,
124
- 'height': 150,
125
- 'top': 10,
126
- 'left': 10,
127
- 'draggable': true,
128
- 'resizable': true,
129
- 'minw': 10,
130
- 'minh': 10,
131
- 'axis': 'both',
132
- 'parentLim': true,
133
- 'snapToGrid': false,
134
- 'aspectRatio': false,
135
- 'zIndex': 1,
136
- 'color': '#EF9A9A',
137
- 'active': false
138
- },
139
- {
140
- 'name': "test-1",
141
- 'width': 200,
142
- 'height': 150,
143
- 'top': 170,
144
- 'left': 220,
145
- 'draggable': true,
146
- 'resizable': true,
147
- 'minw': 10,
148
- 'minh': 10,
149
- 'axis': 'both',
150
- 'parentLim': true,
151
- 'snapToGrid': false,
152
- 'aspectRatio': false,
153
- 'zIndex': 1,
154
- 'color': '#E6C27A',
155
- 'active': false,
156
- 'class': 'box-shaddow'
157
- },
158
- {
159
- 'name': "test-2",
160
- 'width': 200,
161
- 'height': 150,
162
- 'top': 10,
163
- 'left': 220,
164
- 'draggable': true,
165
- 'resizable': true,
166
- 'minw': 10,
167
- 'minh': 10,
168
- 'axis': 'both',
169
- 'parentLim': true,
170
- 'snapToGrid': false,
171
- 'aspectRatio': false,
172
- 'zIndex': 2,
173
- 'color': '#AED581',
174
- 'active': false
175
- },
176
- {
177
- 'name': "test-3",
178
- 'width': 200,
179
- 'height': 150,
180
- 'top': 170,
181
- 'left': 10,
182
- 'draggable': true,
183
- 'resizable': true,
184
- 'minw': 10,
185
- 'minh': 10,
186
- 'axis': 'both',
187
- 'parentLim': true,
188
- 'snapToGrid': false,
189
- 'aspectRatio': false,
190
- 'zIndex': 3,
191
- 'color': '#81D4FA',
192
- 'active': false
193
- }
194
- ]
195
-
196
-
197
- public excelTest() {
198
-
199
- console.log("测试", base64);
200
- const workbook = EMacro.File.toExcel(base64, "base64")
201
- // console.log("测试", workbook.Sheets["Sheet1"]["A23"]);
202
-
203
- // workbook.Sheets["Sheet1"]["A23"].v = "测试abc"
204
- // console.log("测试", workbook.Sheets["Sheet1"]["A23"]);
205
- // console.log("测试", workbook);
206
-
207
- EMacro.File.downloadExcel(workbook, "Report2222.xls");
208
-
209
- }
210
-
211
- public exportExcel(e): void {
212
- console.log('event', e);
147
+ obj: "http://221.225.49.240:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\test.obj",
148
+ },
149
+ ];
213
150
 
214
- // testToExcel(e)
215
- // LAY_EXCEL.exportExcel([[1, 2, 3]], '表格导出.xlsx', 'xlsx')
151
+ // public src: String = "http://192.168.0.107:99/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\编程向未来.mp4"
216
152
 
217
- // var list = [[null,1, 2, 3], [null,1, 2, "a撒地方打赏打发士大夫"]]
218
- var list = {
219
- "aaa1撒旦飞洒": [
220
- [null, 1, 2, 3]
221
- ],
222
- "bbb1": [
223
- [2, 1, 2, null]
224
- ]
225
- }
153
+ public showViewer: Boolean = false; // 是否打开图片查看器
154
+ public showVideoViewer: Boolean = false; // 是否打开图片查看器
155
+ public showModelViewer: Boolean = false;
226
156
 
227
- // 2. 使用批量设置样式函数 setExportCellStyle 对单元格维度的数据进行批量设置样式
228
- // PS:注意这里是ARGB,前两位是透明度
229
- LAY_EXCEL.setExportCellStyle(list, 'A1:Z1', {
230
- s: {
231
- border: {
232
- top: { style: 'thick', color: { rgb: 'FFFF0000' } },
233
- bottom: { style: 'thick', color: { rgb: 'FFFF0000' } },
234
- left: { style: 'thick', color: { rgb: 'FFFF0000' } },
235
- right: { style: 'thick', color: { rgb: 'FFFF0000' } }
236
- },
237
- fill: {
238
- fgColor: {
239
- rgb: "ffff00"
240
- }
241
- },
242
- font: {
243
- name: "楷体",
244
- sz: 22,
245
- color: {
246
- rgb: "ff0000"
247
- },
248
- bold: true,
249
- italic: false,
250
- underline: false
251
- },
252
- }
253
- })
157
+ public listWidth = 0;
158
+ public listHeight = 0;
254
159
 
255
- LAY_EXCEL.exportExcel(list, '表格导出.xlsx', 'xlsx')
256
- }
160
+ public handleOpen() {
161
+ this.showViewer = true;
162
+ // this.showVideoViewer = true;
163
+ }
257
164
 
258
- public selectFile(e) {
165
+ public handleOpen2() {
166
+ this.showModelViewer = true;
167
+ // this.showVideoViewer = true;
168
+ }
259
169
 
260
- EMacro.File.selectFile().then((files) => {
261
- EMacro.File.uploadFiles(files, file => {
170
+ public openCallback() {} // 打开时的回调
171
+ public closeCallback() {} // 关闭时的回调
172
+
173
+ public rects = [
174
+ {
175
+ name: "test-0",
176
+ width: 200,
177
+ height: 150,
178
+ top: 10,
179
+ left: 10,
180
+ draggable: true,
181
+ resizable: true,
182
+ minw: 10,
183
+ minh: 10,
184
+ axis: "both",
185
+ parentLim: true,
186
+ snapToGrid: false,
187
+ aspectRatio: false,
188
+ zIndex: 1,
189
+ color: "#EF9A9A",
190
+ active: false,
191
+ },
192
+ {
193
+ name: "test-1",
194
+ width: 200,
195
+ height: 150,
196
+ top: 170,
197
+ left: 220,
198
+ draggable: true,
199
+ resizable: true,
200
+ minw: 10,
201
+ minh: 10,
202
+ axis: "both",
203
+ parentLim: true,
204
+ snapToGrid: false,
205
+ aspectRatio: false,
206
+ zIndex: 1,
207
+ color: "#E6C27A",
208
+ active: false,
209
+ class: "box-shaddow",
210
+ },
211
+ {
212
+ name: "test-2",
213
+ width: 200,
214
+ height: 150,
215
+ top: 10,
216
+ left: 220,
217
+ draggable: true,
218
+ resizable: true,
219
+ minw: 10,
220
+ minh: 10,
221
+ axis: "both",
222
+ parentLim: true,
223
+ snapToGrid: false,
224
+ aspectRatio: false,
225
+ zIndex: 2,
226
+ color: "#AED581",
227
+ active: false,
228
+ },
229
+ {
230
+ name: "test-3",
231
+ width: 200,
232
+ height: 150,
233
+ top: 170,
234
+ left: 10,
235
+ draggable: true,
236
+ resizable: true,
237
+ minw: 10,
238
+ minh: 10,
239
+ axis: "both",
240
+ parentLim: true,
241
+ snapToGrid: false,
242
+ aspectRatio: false,
243
+ zIndex: 3,
244
+ color: "#81D4FA",
245
+ active: false,
246
+ },
247
+ ];
262
248
 
263
- file.savePath = "C:\\MES\\EMacroAndroidServer_Windows_v1.1\\EMacroAssets\\file\\" + file.fileName
249
+ importExcel() {
264
250
 
265
- let postData = { 'id': 0, 'message': '', 'action': 'uploadSOPFile', 'user': {}, 'data': file }
266
- axios.post("http://121.228.113.68:8019/H5/prod/Command/requestVueData", postData, {
267
- timeout: 6000,
268
- headers: {
269
- Authorization: "Basic RU1hY3JvOkVNYWNybw==",
270
- "Content-Type": "application/json;charset=UTF-8",
271
- }
272
- }).then(data => {
251
+ EMacro.File.readLocalExcel((file, workbook) => {
273
252
 
274
- console.log("上传返回", data);
253
+ console.log("导入", workbook);
275
254
 
276
- }).catch(err => {
277
- console.error("上传错误: ", err);
278
- })
255
+ })
279
256
 
280
- })
281
257
 
282
- }).catch(err => {
283
- console.error(err);
284
- })
258
+ }
285
259
 
286
- }
260
+ printElement(id) {
261
+ const el = document.getElementById(id);
287
262
 
288
- activateEv(index) {
289
- console.log("activateEv index", index);
263
+ if (el == null) {
264
+ alert("元素找不到");
265
+ return;
290
266
  }
291
267
 
292
- deactivateEv(index) {
293
- console.log("deactivateEv index", index);
268
+ if (!el.innerHTML) {
269
+ alert("元素内容空");
270
+ return;
294
271
  }
295
272
 
296
- changePosition(newRect, index) {
297
- console.log("changePosition newRect", newRect);
298
- console.log("changePosition index", index);
299
- }
273
+ const iframe = document.createElement("IFRAME") as any;
274
+
275
+ const attributes = {
276
+ style:
277
+ "position: absolute;top: 500vh;left:0;width: 100%;height: 100%; display: flex;align-items: flex-start; justify-items: flex-start; ",
278
+ height: "100%",
279
+ width: "100%",
280
+ frameborder: "no",
281
+ border: "0",
282
+ marginwidth: "0",
283
+ marginheight: "0",
284
+ scrolling: "no",
285
+ allowtransparency: "yes",
286
+ seamless: "true",
287
+ allowfullscreen: "true",
288
+ webkitallowfullscreen: "true",
289
+ mozallowfullscreen: "true",
290
+ };
291
+ Object.keys(attributes).forEach((key) => {
292
+ iframe.setAttribute(key, attributes[key]);
293
+ });
294
+ document.body.appendChild(iframe);
295
+ const doc = iframe.contentWindow.document as any;
296
+ doc.write("<div>" + el.innerHTML + "</div>");
297
+ doc.close();
298
+ iframe.contentWindow.focus();
299
+ iframe.contentWindow.print();
300
+
301
+ document.body.removeChild(iframe);
302
+ }
300
303
 
301
- changeSize(newRect, index) {
302
- console.log("changeSize newRect", newRect);
303
- console.log("changeSize index", index);
304
- }
304
+ public excelTest() {
305
+ console.log("测试", base64);
306
+ const workbook = EMacro.File.toExcel(base64, "base64");
307
+ // console.log("测试", workbook.Sheets["Sheet1"]["A23"]);
305
308
 
306
- public fileMD5() {
309
+ // workbook.Sheets["Sheet1"]["A23"].v = "测试abc"
310
+ // console.log("测试", workbook.Sheets["Sheet1"]["A23"]);
311
+ // console.log("测试", workbook);
307
312
 
308
- EMacro.File.selectFile().then(files => {
313
+ EMacro.File.downloadExcel(workbook, "Report2222.xls");
314
+ }
309
315
 
310
- if (files == null) {
311
- return
312
- }
313
- EMacro.File.getFileMD5(files[0]).then(md5 => {
314
- console.log("文件MD5", md5);
315
- })
316
+ public exportExcel(e): void {
317
+ console.log("event", e);
318
+
319
+ // testToExcel(e)
320
+ // LAY_EXCEL.exportExcel([[1, 2, 3]], '表格导出.xlsx', 'xlsx')
321
+
322
+ // var list = [[null,1, 2, 3], [null,1, 2, "a撒地方打赏打发士大夫"]]
323
+ var list = {
324
+ aaa1撒旦飞洒: [[null, 1, 2, 3]],
325
+ bbb1: [[2, 1, 2, null]],
326
+ };
327
+
328
+ // 2. 使用批量设置样式函数 setExportCellStyle 对单元格维度的数据进行批量设置样式
329
+ // PS:注意这里是ARGB,前两位是透明度
330
+ LAY_EXCEL.setExportCellStyle(list, "A1:Z1", {
331
+ s: {
332
+ border: {
333
+ top: { style: "thick", color: { rgb: "FFFF0000" } },
334
+ bottom: { style: "thick", color: { rgb: "FFFF0000" } },
335
+ left: { style: "thick", color: { rgb: "FFFF0000" } },
336
+ right: { style: "thick", color: { rgb: "FFFF0000" } },
337
+ },
338
+ fill: {
339
+ fgColor: {
340
+ rgb: "ffff00",
341
+ },
342
+ },
343
+ font: {
344
+ name: "楷体",
345
+ sz: 22,
346
+ color: {
347
+ rgb: "ff0000",
348
+ },
349
+ bold: true,
350
+ italic: false,
351
+ underline: false,
352
+ },
353
+ },
354
+ });
316
355
 
317
- // new MD5().update(buffer).digest()
356
+ LAY_EXCEL.exportExcel(list, "表格导出.xlsx", "xlsx");
357
+ }
318
358
 
319
- // const hash = crypto
320
- // .createHash('md5')
321
- // .update(files[0], 'utf8')
322
- // .digest('hex');
359
+ public selectFile(e) {
360
+ EMacro.File.selectFile()
361
+ .then((files) => {
362
+ EMacro.File.uploadFiles(files, (file) => {
363
+ file.savePath =
364
+ "C:\\MES\\EMacroAndroidServer_Windows_v1.1\\EMacroAssets\\file\\" +
365
+ file.fileName;
366
+
367
+ let postData = {
368
+ id: 0,
369
+ message: "",
370
+ action: "uploadSOPFile",
371
+ user: {},
372
+ data: file,
373
+ };
374
+ axios
375
+ .post(
376
+ "http://121.228.113.68:8019/H5/prod/Command/requestVueData",
377
+ postData,
378
+ {
379
+ timeout: 6000,
380
+ headers: {
381
+ Authorization: "Basic RU1hY3JvOkVNYWNybw==",
382
+ "Content-Type": "application/json;charset=UTF-8",
383
+ },
384
+ }
385
+ )
386
+ .then((data) => {
387
+ console.log("上传返回", data);
388
+ })
389
+ .catch((err) => {
390
+ console.error("上传错误: ", err);
391
+ });
392
+ });
323
393
  })
394
+ .catch((err) => {
395
+ console.error(err);
396
+ });
397
+ }
324
398
 
399
+ activateEv(index) {
400
+ console.log("activateEv index", index);
401
+ }
325
402
 
403
+ deactivateEv(index) {
404
+ console.log("deactivateEv index", index);
405
+ }
326
406
 
327
- }
407
+ changePosition(newRect, index) {
408
+ console.log("changePosition newRect", newRect);
409
+ console.log("changePosition index", index);
410
+ }
328
411
 
329
- public mounted() {
412
+ changeSize(newRect, index) {
413
+ console.log("changeSize newRect", newRect);
414
+ console.log("changeSize index", index);
415
+ }
330
416
 
331
- EMacro.getVideoScale("http://121.228.113.68:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\编程向未来.mp4").then(info => {
332
- console.log("获取视频", info);
417
+ public fileMD5() {
418
+ EMacro.File.selectFile().then((files) => {
419
+ if (files == null) {
420
+ return;
421
+ }
422
+ EMacro.File.getFileMD5(files[0]).then((md5) => {
423
+ console.log("文件MD5", md5);
333
424
  });
334
425
 
426
+ // new MD5().update(buffer).digest()
335
427
 
428
+ // const hash = crypto
429
+ // .createHash('md5')
430
+ // .update(files[0], 'utf8')
431
+ // .digest('hex');
432
+ });
433
+ }
336
434
 
337
- // const listEl = document.getElementById('list') as HTMLElement;
338
- // this.listWidth = listEl.clientWidth;
339
- // this.listHeight = listEl.clientHeight;
340
-
341
- window.addEventListener('resize', () => {
342
- // this.listWidth = listEl.clientWidth;
343
- // this.listHeight = listEl.clientHeight;
344
- })
345
- }
435
+ public mounted() {
436
+ EMacro.getVideoScale(
437
+ "http://121.228.113.68:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\编程向未来.mp4"
438
+ ).then((info) => {
439
+ console.log("获取视频", info);
440
+ });
346
441
 
442
+ // const listEl = document.getElementById('list') as HTMLElement;
443
+ // this.listWidth = listEl.clientWidth;
444
+ // this.listHeight = listEl.clientHeight;
347
445
 
446
+ window.addEventListener("resize", () => {
447
+ // this.listWidth = listEl.clientWidth;
448
+ // this.listHeight = listEl.clientHeight;
449
+ });
348
450
  }
451
+ }
349
452
  </script>
350
453
 
351
454
  <style lang="less" scoped>
352
- @import "index.less";
353
- </style>
455
+ @import "index.less";
456
+ </style>