emacroh5lib 1.0.84 → 1.0.86
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.
- package/dist/{A.mtl → aaa/A.mtl} +0 -0
- package/dist/{A.obj → aaa/A.obj} +0 -0
- package/dist/emacroh5lib.min.js +1 -1
- package/dist/emacroh5lib.min.js.LICENSE.txt +0 -4
- package/package.json +3 -5
- package/src/components/SelectBox.jsx +29 -0
- package/src/utilities/E9ChartUtils.js +189 -0
- package/src/utilities/EMacro.ts +35 -3
- package/src/views/ExcelExporter/index.vue +0 -1
- package/src/views/ModelViewer/index.vue +8 -5
- package/src/views/ModelViewer/style/css/index.css +1 -0
- package/src/views/TestView/Export2Excel.ts +1 -2
- package/src/views/TestView/index.vue +21 -9
- package/src/views/TestView/txt.js +6 -0
- package/webpack.config.js +5 -5
- package/ob.rar +0 -0
@@ -36,10 +36,6 @@ Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
36
36
|
version 0.6.9
|
37
37
|
*/
|
38
38
|
|
39
|
-
/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */
|
40
|
-
|
41
|
-
/*! xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
|
42
|
-
|
43
39
|
/**
|
44
40
|
* vue-class-component v7.2.3
|
45
41
|
* (c) 2015-present Evan You
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "emacroh5lib",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.86",
|
4
4
|
"description": "EMacro前端组件库",
|
5
5
|
"main": "dist/emacroh5lib.min.js",
|
6
6
|
"scripts": {
|
@@ -95,7 +95,6 @@
|
|
95
95
|
"register-service-worker": "^1.7.2",
|
96
96
|
"sync-task-queue": "^1.0.4",
|
97
97
|
"three": "^0.139.2",
|
98
|
-
"types": "file:../../browser-md5-file",
|
99
98
|
"typings": "^2.1.1",
|
100
99
|
"vue": "^2.6.14",
|
101
100
|
"vue-class-component": "^7.2.3",
|
@@ -103,7 +102,6 @@
|
|
103
102
|
"vue-property-decorator": "^9.1.2",
|
104
103
|
"vue-tsx-support": "^3.2.0",
|
105
104
|
"vuex": "^3.6.2",
|
106
|
-
"xlsx": "^0.18.5"
|
107
|
-
"xlsx-style": "^0.8.13"
|
105
|
+
"xlsx": "^0.18.5"
|
108
106
|
}
|
109
|
-
}
|
107
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!-- 下拉可编辑输入框 -->
|
2
|
+
<div style="position:relative;">
|
3
|
+
<select v-model='faultAction' onchange="this.nextElementSibling.value=''">
|
4
|
+
<option v-for="(item, index) in optionListAction">{{ fieldsMap[item] || $t(item) }}</option>
|
5
|
+
</select>
|
6
|
+
<input class="select-input" type="text" value="" autocomplete="off" @input="(item)=>{this.faultAction = item.target.value}" />
|
7
|
+
</div>
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
.select-input {
|
12
|
+
position: absolute;
|
13
|
+
top: 0px;
|
14
|
+
left: 0px;
|
15
|
+
right: 5px;
|
16
|
+
height: 100%;
|
17
|
+
padding: 0px;
|
18
|
+
margin-left: 5px;
|
19
|
+
font-size: 17px !important;
|
20
|
+
border: none !important;
|
21
|
+
background-color: transparent;
|
22
|
+
outline: transparent !important;
|
23
|
+
border: transparent !important;
|
24
|
+
box-shadow: none !important;
|
25
|
+
|
26
|
+
&:focus {
|
27
|
+
outline: none;
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,189 @@
|
|
1
|
+
/**
|
2
|
+
* echarts tooltip 自动轮播
|
3
|
+
* @author dalalalalaa
|
4
|
+
* @param chart
|
5
|
+
* @param chartOption
|
6
|
+
* @param options
|
7
|
+
* {
|
8
|
+
* interval 轮播时间间隔,单位毫秒,默认为2000
|
9
|
+
* loopSeries boolean类型,默认为false。
|
10
|
+
* true表示循环所有series的tooltip,false则显示指定seriesIndex的tooltip
|
11
|
+
* seriesIndex 默认为0,指定某个系列(option中的series索引)循环显示tooltip,
|
12
|
+
* 当loopSeries为true时,从seriesIndex系列开始执行.
|
13
|
+
* }
|
14
|
+
* @returns {{clearLoop: clearLoop}}
|
15
|
+
*/
|
16
|
+
const loopShowTooltip = function (chart, chartOption, options) {
|
17
|
+
var defaultOptions = {
|
18
|
+
interval: 3000,
|
19
|
+
loopSeries: true,
|
20
|
+
seriesIndex: 0,
|
21
|
+
updateData: null,
|
22
|
+
};
|
23
|
+
|
24
|
+
if (!chart) {
|
25
|
+
return {};
|
26
|
+
}
|
27
|
+
if (!chartOption) {
|
28
|
+
chartOption = chart.getOption();
|
29
|
+
}
|
30
|
+
|
31
|
+
var dataIndex = 0; // 数据索引,初始化为-1,是为了判断是否是第一次执行
|
32
|
+
var seriesIndex = 0; // 系列索引
|
33
|
+
var timeTicket = 0;
|
34
|
+
var seriesLen = chartOption.series.length; // 系列个数
|
35
|
+
var dataLen = 0; // 某个系列数据个数
|
36
|
+
var chartType; // 系列类型
|
37
|
+
var first = true;
|
38
|
+
|
39
|
+
// 不循环series时seriesIndex指定显示tooltip的系列,不指定默认为0,指定多个则默认为第一个
|
40
|
+
// 循环series时seriesIndex指定循环的series,不指定则从0开始循环所有series,指定单个则相当于不循环,指定多个
|
41
|
+
// 要不要添加开始series索引和开始的data索引?
|
42
|
+
|
43
|
+
if (options) {
|
44
|
+
options.interval = options.interval || defaultOptions.interval;
|
45
|
+
options.loopSeries = options.loopSeries || defaultOptions.loopSeries;
|
46
|
+
options.seriesIndex = options.seriesIndex || defaultOptions.seriesIndex;
|
47
|
+
options.updateData = options.updateData || defaultOptions.updateData;
|
48
|
+
} else {
|
49
|
+
options = defaultOptions;
|
50
|
+
}
|
51
|
+
|
52
|
+
// 如果设置的seriesIndex无效,则默认为0
|
53
|
+
if (options.seriesIndex < 0 || options.seriesIndex >= seriesLen) {
|
54
|
+
seriesIndex = 0;
|
55
|
+
} else {
|
56
|
+
seriesIndex = options.seriesIndex;
|
57
|
+
}
|
58
|
+
|
59
|
+
function autoShowTip() {
|
60
|
+
function showTip() {
|
61
|
+
// 判断是否更新数据
|
62
|
+
if (
|
63
|
+
dataIndex === 0 &&
|
64
|
+
!first &&
|
65
|
+
typeof options.updateData === 'function'
|
66
|
+
) {
|
67
|
+
options.updateData();
|
68
|
+
chart.setOption(chartOption);
|
69
|
+
}
|
70
|
+
|
71
|
+
var series = chartOption.series;
|
72
|
+
chartType = series[seriesIndex].type; // 系列类型
|
73
|
+
dataLen = series[seriesIndex].data.length; // 某个系列的数据个数
|
74
|
+
|
75
|
+
var tipParams = { seriesIndex: seriesIndex };
|
76
|
+
switch (chartType) {
|
77
|
+
case 'map':
|
78
|
+
case 'pie':
|
79
|
+
case 'chord':
|
80
|
+
tipParams.name = series[seriesIndex].data[dataIndex].name;
|
81
|
+
break;
|
82
|
+
case 'radar': // 雷达图
|
83
|
+
tipParams.seriesIndex = seriesIndex;
|
84
|
+
tipParams.dataIndex = dataIndex;
|
85
|
+
break;
|
86
|
+
default:
|
87
|
+
tipParams.dataIndex = dataIndex;
|
88
|
+
break;
|
89
|
+
}
|
90
|
+
|
91
|
+
if (chartType === 'pie' || chartType === 'radar') {
|
92
|
+
// 取消之前高亮的图形
|
93
|
+
chart.dispatchAction({
|
94
|
+
type: 'downplay',
|
95
|
+
seriesIndex: options.loopSeries
|
96
|
+
? seriesIndex === 0
|
97
|
+
? seriesLen - 1
|
98
|
+
: seriesIndex - 1
|
99
|
+
: seriesIndex,
|
100
|
+
dataIndex: dataIndex === 0 ? dataLen - 1 : dataIndex - 1,
|
101
|
+
});
|
102
|
+
|
103
|
+
// 高亮当前图形
|
104
|
+
chart.dispatchAction({
|
105
|
+
type: 'highlight',
|
106
|
+
seriesIndex: seriesIndex,
|
107
|
+
dataIndex: dataIndex,
|
108
|
+
});
|
109
|
+
}
|
110
|
+
|
111
|
+
// 显示 tooltip
|
112
|
+
tipParams.type = 'showTip';
|
113
|
+
chart.dispatchAction(tipParams);
|
114
|
+
|
115
|
+
dataIndex = (dataIndex + 1) % dataLen;
|
116
|
+
if (options.loopSeries && dataIndex === 0 && !first) {
|
117
|
+
// 数据索引归0表示当前系列数据已经循环完
|
118
|
+
seriesIndex = (seriesIndex + 1) % seriesLen;
|
119
|
+
}
|
120
|
+
|
121
|
+
first = false;
|
122
|
+
}
|
123
|
+
|
124
|
+
showTip();
|
125
|
+
timeTicket = setInterval(showTip, options.interval);
|
126
|
+
}
|
127
|
+
|
128
|
+
// 关闭轮播
|
129
|
+
function stopAutoShow() {
|
130
|
+
if (timeTicket) {
|
131
|
+
clearInterval(timeTicket);
|
132
|
+
timeTicket = 0;
|
133
|
+
|
134
|
+
if (chartType === 'pie' || chartType === 'radar') {
|
135
|
+
// 取消高亮的图形
|
136
|
+
chart.dispatchAction({
|
137
|
+
type: 'downplay',
|
138
|
+
seriesIndex: options.loopSeries
|
139
|
+
? seriesIndex === 0
|
140
|
+
? seriesLen - 1
|
141
|
+
: seriesIndex - 1
|
142
|
+
: seriesIndex,
|
143
|
+
dataIndex: dataIndex === 0 ? dataLen - 1 : dataIndex - 1,
|
144
|
+
});
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
var zRender = chart.getZr();
|
150
|
+
|
151
|
+
function zRenderMouseMove(param) {
|
152
|
+
if (param.event) {
|
153
|
+
// 阻止canvas上的鼠标移动事件冒泡
|
154
|
+
param.event.cancelBubble = true;
|
155
|
+
}
|
156
|
+
|
157
|
+
stopAutoShow();
|
158
|
+
}
|
159
|
+
|
160
|
+
// 离开echarts图时恢复自动轮播
|
161
|
+
function zRenderGlobalOut() {
|
162
|
+
if (!timeTicket) {
|
163
|
+
autoShowTip();
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
// 鼠标在echarts图上时停止轮播
|
168
|
+
chart.on('mousemove', stopAutoShow);
|
169
|
+
zRender.on('mousemove', zRenderMouseMove);
|
170
|
+
zRender.on('globalout', zRenderGlobalOut);
|
171
|
+
|
172
|
+
autoShowTip();
|
173
|
+
|
174
|
+
return {
|
175
|
+
clearLoop: function () {
|
176
|
+
if (timeTicket) {
|
177
|
+
clearInterval(timeTicket);
|
178
|
+
timeTicket = 0;
|
179
|
+
}
|
180
|
+
chart.off('mousemove', stopAutoShow);
|
181
|
+
zRender.off('mousemove', zRenderMouseMove);
|
182
|
+
zRender.off('globalout', zRenderGlobalOut);
|
183
|
+
},
|
184
|
+
};
|
185
|
+
};
|
186
|
+
|
187
|
+
|
188
|
+
export { loopShowTooltip };
|
189
|
+
|
package/src/utilities/EMacro.ts
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
|
2
|
-
import
|
2
|
+
import XLSX from "xlsx";
|
3
|
+
// import XLSX from "./dist/xlsx.js";
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
// const XLSX = require("./dist/xlsx.js")
|
3
8
|
import BMF from 'browser-md5-file';
|
4
9
|
|
5
10
|
import createTaskQueue from 'sync-task-queue'
|
6
11
|
|
12
|
+
import { saveAs } from 'file-saver';
|
13
|
+
|
7
14
|
export namespace EMacro {
|
8
15
|
|
9
16
|
export const version = "1.72"
|
@@ -147,6 +154,31 @@ export namespace EMacro {
|
|
147
154
|
})
|
148
155
|
}
|
149
156
|
|
157
|
+
// type: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string'
|
158
|
+
public static toExcel(data, type) {
|
159
|
+
let workbook = XLSX.read(data, { type: type });
|
160
|
+
return workbook;
|
161
|
+
}
|
162
|
+
|
163
|
+
public static downloadExcel(workbook, name) {
|
164
|
+
|
165
|
+
/* bookType can be 'xlsx' or 'xlsm' or 'xlsb' */
|
166
|
+
const wopts:any = { bookType: 'xls', bookSST: false, type: 'binary', cellStyles: true };
|
167
|
+
|
168
|
+
var wbout = XLSX.write(workbook, wopts);
|
169
|
+
|
170
|
+
function s2ab(s) {
|
171
|
+
var buf = new ArrayBuffer(s.length);
|
172
|
+
var view = new Uint8Array(buf);
|
173
|
+
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
174
|
+
return buf;
|
175
|
+
}
|
176
|
+
|
177
|
+
/* the saveAs call downloads a file on the local machine */
|
178
|
+
saveAs(new Blob([s2ab(wbout)], { type: 'application/octet-stream' }), name)
|
179
|
+
|
180
|
+
}
|
181
|
+
|
150
182
|
}
|
151
183
|
|
152
184
|
export const fullScreen = (docElm: any = null) => {
|
@@ -251,12 +283,12 @@ export namespace EMacro {
|
|
251
283
|
return base64;
|
252
284
|
}
|
253
285
|
|
254
|
-
export function getType(values){
|
286
|
+
export function getType(values) {
|
255
287
|
return Object
|
256
288
|
.prototype
|
257
289
|
.toString
|
258
290
|
.call(values)
|
259
|
-
.replace(/\[(\S+) (\S+)\]/,'$2')
|
291
|
+
.replace(/\[(\S+) (\S+)\]/, '$2')
|
260
292
|
}
|
261
293
|
|
262
294
|
export const extensionToLowerCase = (fileName: string) => {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<div class="duo-viewer-mask">
|
4
4
|
<div id="WebGL-output" class="duo-viewer-mask__image" :style="viewerStyle()" v-loading="loading"
|
5
5
|
element-loading-text="模型加载中" element-loading-spinner="el-icon-loading"
|
6
|
-
element-loading-background="rgba(0, 0, 0, 0.
|
6
|
+
element-loading-background="rgba(0, 0, 0, 0.0)">
|
7
7
|
</div>
|
8
8
|
</div>
|
9
9
|
<div class="duo-viewer-footer" v-if="showThumbnail">
|
@@ -132,6 +132,10 @@
|
|
132
132
|
background: {
|
133
133
|
type: Number,
|
134
134
|
default: 0xb9d3ff,
|
135
|
+
},
|
136
|
+
transparency: {
|
137
|
+
type: Number,
|
138
|
+
default: 0.6,
|
135
139
|
}
|
136
140
|
},
|
137
141
|
computed: {
|
@@ -186,8 +190,6 @@
|
|
186
190
|
return scale;
|
187
191
|
},
|
188
192
|
|
189
|
-
|
190
|
-
|
191
193
|
viewerStyle() {
|
192
194
|
return `width:${this.width};height:${this.height};`
|
193
195
|
},
|
@@ -754,6 +756,7 @@
|
|
754
756
|
this.gl.pointLight = pointLight
|
755
757
|
pointLight.position.set(200, 300, 10); //点光源位置,参数分别代表:
|
756
758
|
this.gl.scene.add(pointLight);
|
759
|
+
this.gl.scene.background = null;
|
757
760
|
//环境光
|
758
761
|
let ambient = new THREE.AmbientLight(0x444444, 1);
|
759
762
|
this.gl.ambient = ambient
|
@@ -773,9 +776,9 @@
|
|
773
776
|
/**
|
774
777
|
* 创建渲染器对象
|
775
778
|
*/
|
776
|
-
this.gl.renderer = new THREE.WebGLRenderer();
|
779
|
+
this.gl.renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
|
777
780
|
this.gl.renderer.setSize(width, height); //设置渲染区域尺寸
|
778
|
-
this.gl.renderer.setClearColor(this.background,
|
781
|
+
this.gl.renderer.setClearColor(this.background, this.transparency); //设置背景颜色
|
779
782
|
|
780
783
|
this.gl.WebGLoutput.innerHTML = ""
|
781
784
|
this.gl.renderer.domElement.style.width = "100%"
|
@@ -6,10 +6,11 @@
|
|
6
6
|
<button @click="exportExcel($event)">透过Excel模板导出表格</button>
|
7
7
|
<button @click="selectFile($event)">选择文件</button>
|
8
8
|
<button @click="fileMD5($event)">文件MD5</button>
|
9
|
+
<button @click="excelTest()">Excel测试</button>
|
9
10
|
|
10
11
|
<image-viewer :list="srcList" @open="openCallback" @close="closeCallback" :show.sync="showViewer"
|
11
12
|
:currentIndex="currentIndex" />
|
12
|
-
|
13
|
+
|
13
14
|
<div class="list" id="list" v-if="false">
|
14
15
|
<DragResizeView v-for="(rect, index) in rects" :key="index" :isStorage="true" :name="rect.name" :w="rect.width"
|
15
16
|
:h="rect.height" :x="rect.left" :y="rect.top" :parentW="listWidth" :parentH="listHeight" :axis="rect.axis"
|
@@ -25,9 +26,9 @@
|
|
25
26
|
<Draw v-if="false">
|
26
27
|
<div class="filler2">111</div>
|
27
28
|
</Draw>
|
28
|
-
|
29
|
+
|
29
30
|
<!-- <video-viewer :list="srcList" :show.sync="showVideoViewer" width="80%" height="80%" /> -->
|
30
|
-
<model-viewer :list="modelList" :show.sync="showModelViewer" width="
|
31
|
+
<model-viewer :list="modelList" :show.sync="showModelViewer" width="90%" height="90%" :background="null" />
|
31
32
|
|
32
33
|
</div>
|
33
34
|
</template>
|
@@ -46,6 +47,7 @@
|
|
46
47
|
import LAY_EXCEL from 'lay-excel';
|
47
48
|
import BMF from 'browser-md5-file';
|
48
49
|
import { info } from "console";
|
50
|
+
import base64 from "./txt.js";
|
49
51
|
|
50
52
|
|
51
53
|
@Component({
|
@@ -62,6 +64,7 @@
|
|
62
64
|
})
|
63
65
|
export default class TestView extends Vue {
|
64
66
|
|
67
|
+
|
65
68
|
public currentIndex: Number = 0; // 打开图片查看器时,需要定位到的图片的索引
|
66
69
|
public srcList: Array<String> = [
|
67
70
|
"http://emacrosys.cn:8069/H5/GetFile?type=0&path=C:\\SOP\\PCB001\\看板整体图.png",
|
@@ -190,6 +193,21 @@
|
|
190
193
|
}
|
191
194
|
]
|
192
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
|
+
|
193
211
|
public exportExcel(e): void {
|
194
212
|
console.log('event', e);
|
195
213
|
|
@@ -292,22 +310,16 @@
|
|
292
310
|
if (files == null) {
|
293
311
|
return
|
294
312
|
}
|
295
|
-
|
296
313
|
EMacro.File.getFileMD5(files[0]).then(md5 => {
|
297
|
-
|
298
314
|
console.log("文件MD5", md5);
|
299
|
-
|
300
315
|
})
|
301
316
|
|
302
|
-
|
303
317
|
// new MD5().update(buffer).digest()
|
304
318
|
|
305
|
-
|
306
319
|
// const hash = crypto
|
307
320
|
// .createHash('md5')
|
308
321
|
// .update(files[0], 'utf8')
|
309
322
|
// .digest('hex');
|
310
|
-
|
311
323
|
})
|
312
324
|
|
313
325
|
|