sale-client 3.6.128 → 3.6.129

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sale-client",
3
- "version": "3.6.128",
3
+ "version": "3.6.129",
4
4
  "description": "收费模块前台组件",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -388,7 +388,7 @@
388
388
  networkvalves: this.$appdata.getParam('阀控状态') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('阀控状态')] : [],
389
389
  valvestates: this.$appdata.getParam('阀门状态') ? [{label: '全部', value: ''}, ...this.$appdata.getParam('阀门状态')] : [],
390
390
  searchshow: false,
391
- orgcondition: ' and f_filialeid = ' + this.$login.f.orgid,
391
+ orgcondition: ' and f_filialeid = ' + `'${this.$login.f.orgid}'`,
392
392
  getfield: {},
393
393
  // 排序
394
394
  orderitem: 'f_userinfo_id desc',
@@ -11,7 +11,7 @@
11
11
  <input type="text" class="input_search" style="width:60%" v-show="false" v-model="$refs.brand.selectedItems"
12
12
  v-validate:brand='{required: true }'>
13
13
  <v-select :value.sync="row.gasbrand" :options='meterbrands' placeholder='气表品牌' close-on-select
14
- search @change='brandChange' v-model='row.gasbrand' :disabled="curuser.f_user_state != '预备'" v-ref:brand></v-select>
14
+ search @change='brandChange' v-model='row.gasbrand' v-ref:brand></v-select>
15
15
  </div>
16
16
  <div class="col-sm-4 form-group" :class="[$m.model.required ? 'has-error' : '']">
17
17
  <label for="gasmodel" class="font_normal_body">气表型号</label>
@@ -19,7 +19,7 @@
19
19
  v-validate:model='{required: true }'>
20
20
  <v-select :value.sync="row.gasmodel" :options='row.gasbrand[0].gasmodel' placeholder='气表型号'
21
21
  close-on-select
22
- v-model='row.gasmodel' :disabled="row.gasbrand.length === 0 || curuser.f_user_state != '预备'" v-ref:model></v-select>
22
+ v-model='row.gasmodel' :disabled="row.gasbrand.length === 0" v-ref:model></v-select>
23
23
  </div>
24
24
 
25
25
  <div class="col-sm-4 form-group" v-if="isiot" :class="[$m.f_meternumber.required ? 'has-error' : '']">
@@ -0,0 +1,1054 @@
1
+ <template>
2
+ <modal :show.sync="show" v-ref:modal backdrop="false" width="1439px" style="height:auto">
3
+ <header slot="modal-header">
4
+ <div class="header">
5
+ <span class="glyphicon glyphicon-remove-circle close" style="margin-top: 35px;margin-right: 30px" @click="close"></span>
6
+ <h4 class="title">高拍仪</h4>
7
+ </div>
8
+ </header>
9
+ <article slot="modal-body" class="form-control" style="padding: 0px">
10
+ <div class="form-group">
11
+ <div class="operation-group">
12
+ <strong class="operation" style="margin-top: 2px">视频操作:</strong>
13
+ <button class="btn btn-info photo" @click="bb()">拍照</button>
14
+ <button class="btn btn-info" @click="cam_switch(1)">打开视频1</button>
15
+ <button class="btn btn-info" @click="cam_switch(2)">打开视频2</button>
16
+ <button class="btn btn-info" @click="CloseVideo()">关闭视频</button>
17
+ <button class="btn btn-info" @click="openApp()">开启程序</button>
18
+ <div style="display: inline-block;margin-left: 570px">
19
+ <strong class="operation">读取身份证:</strong>
20
+ <button class="btn btn-info readIDCard" @click=Begin()>读身份证</button>
21
+ <button class="btn btn-default stop" @click=Stop()>停止读卡</button>
22
+ </div>
23
+ </div>
24
+ <div class="showInfo">
25
+ <IMG ID="Base64IMG" src="" class="img"></IMG>
26
+ <textarea id="Console" disabled="disabled"></textarea>
27
+ <IMG id="cam" :src="cameraurl" width="640" height="640">
28
+ </IMG>
29
+ </div>
30
+ <div class="IdCard">
31
+ <div class="auto IdInputDiv" style="margin-top: 20px"><strong class="IdHint">姓&emsp;&emsp;名</strong><input size=49 id="Name" class="IdInput"></div>
32
+ <div class="auto IdInputDiv" ><strong class="IdHint">性&emsp;&emsp;别</strong><input type="text" size=49 id="Sex" class="IdInput"></div>
33
+ <div class="auto IdInputDiv" ><strong class="IdHint">民&emsp;&emsp;族</strong><input type="text" size=49 id="Nation" class="IdInput"></div>
34
+ <div class="auto IdInputDiv"><strong class="IdHint">出&emsp;&emsp;生</strong><input type="text" size=49 id="Born" class="IdInput"></div>
35
+ <div class="auto IdInputDiv"><strong class="IdHint">地&emsp;&emsp;址</strong><input type="text" size=49 id="Address" class="IdInput"></div>
36
+ <div class="auto IdInputDiv"><strong class="IdHint">身份证号</strong><input type="text" size=49 id="CardNo" class="IdInput"></div>
37
+ <div class="auto IdInputDiv"><strong class="IdHint">签发机关</strong><input type="text" size=49 id="Police" class="IdInput"></div>
38
+ <div class="auto IdInputDiv"><strong class="IdHint">期限起始</strong><input type="text" size=49 id="ActivityLFrom" class="IdInput"></div>
39
+ <div class="auto IdInputDiv"><strong class="IdHint">期限失效</strong><input type="text" size=49 id="ActivityLTo" class="IdInput"></div>
40
+ <div class="auto IdInputDiv"><strong class="IdHint">设&emsp;备ID</strong><input type="text" size=49 id="DeviceNo" class="IdInput"></div>
41
+ <div class="auto IdInputDiv" style="float: left"><strong class="IdHint">照片编码</strong><TEXTAREA id="PhotoBuffer"style="width: 400px;height: 92px"></TEXTAREA>
42
+ </div>
43
+ <div class="auto IdInputDiv" style="float: left"><strong class="IdHint">照&emsp;&emsp;片</strong><IMG style="width: 130px; height:169px" id=PhotoDisplay />
44
+ </div>
45
+ <div class="auto IdInputDiv" style="padding-top:45%;padding-left:35%">
46
+ <button class="btn btn-info" style="width: max-content" @click="confirmIdCard">确定</button>
47
+ </div>
48
+ </div>
49
+ <!--<div style="display: inline-block;margin-top: 5px;margin-left: 5px;height: 640px;float: left;">-->
50
+ <!--<IMG id="IMG3" src="" style="width:300px;height:160px;display: block">-->
51
+ <!--<button class="btn btn-success" @click="DelPDF3()">删除图片</button>-->
52
+ <!--<IMG id="IMG2" src="" style="width:300px;height:160px;display: block">-->
53
+ <!--<button class="btn btn-success" @click="DelPDF2()">删除图片</button>-->
54
+ <!--<IMG id="IMG1" src="" style="width:300px;height:160px;display: block">-->
55
+ <!--<button class="btn btn-success" @click="DelPDF1()">删除图片</button>-->
56
+ <!--</div>-->
57
+ </div>
58
+ </article>
59
+ <footer slot="modal-footer" class="modal-footer">
60
+ <!--<button type="button" class="btn btn-default" @click='close'>取消</button>-->
61
+ <!--<button type="button" class="btn btn-success" @click='confirm(filename)'>确认</button>-->
62
+ </footer>
63
+ </modal>
64
+ </template>
65
+
66
+ <script>
67
+ let ws
68
+ let server_addr = 'ws://127.0.0.1:18888'// 本机端口地址
69
+ export default {
70
+ title: '高拍仪',
71
+ data () {
72
+ return {
73
+ cameraurl: ''
74
+ }
75
+ },
76
+ props: ['show'],
77
+ methods: {
78
+ // 页面load消息
79
+ onLoad () {
80
+ return new Promise((resolve, reject) => {
81
+ if (ws) {
82
+ resolve()
83
+ }
84
+ // output("正在连接:" + server_addr);
85
+ ws = new WebSocket(server_addr)
86
+ ws.onopen = (evt) => {
87
+ if (this.connected) {
88
+ resolve()
89
+ }
90
+ this.connected = true
91
+ this.output('已经连接到服务器')
92
+ // 打开视频
93
+ this.cam_switch(1)
94
+ // 打开自动裁边
95
+ resolve()
96
+ }
97
+ ws.onclose = (evt) => {
98
+ if (!this.connected) {
99
+ window.location.href = 'FLShell://'
100
+ setTimeout('this.onLoad()', 3)
101
+ } else {
102
+ this.output('已断开服务器连接')
103
+ this.connected = false
104
+ }
105
+ ws = null
106
+ reject(new Error('连接失败'))
107
+ }
108
+ ws.onmessage = (evt) => {
109
+ if (evt.data.length === 0) {
110
+ return
111
+ }
112
+ if (typeof evt.data === 'string') {
113
+ let msg = JSON.parse(evt.data)
114
+ if (msg.err && msg.err !== 0) {
115
+ this.output('错误 - ' + msg.err + ', ' + msg.msg)
116
+ reject('错误 - ' + msg.err + ', ' + msg.msg)
117
+ } else if (msg.msg) {
118
+ this.output(msg.msg)
119
+ }
120
+
121
+ if (msg.user_data) {
122
+ this.callback[msg.user_data](msg)
123
+ if (typeof msg.user_data === 'number') {
124
+ this.callback[msg.user_data] = undefined
125
+ }
126
+ }
127
+ } else {
128
+ let file = new FileReader()
129
+ file.onload = (evt) => {
130
+ if (evt.target.readyState == FileReader.DONE) {
131
+ let data = new Uint8Array(evt.target.result)
132
+ if (data[0] == this.SVR_BIN_MSG.CAP_FRAME) {
133
+ return this.drawImage(data)
134
+ }
135
+ }
136
+ }
137
+
138
+ file.readAsArrayBuffer(evt.data)
139
+ }
140
+ }
141
+ let canvas = document.getElementById('cam')
142
+ canvas.onmousedown = (e) => {
143
+ canvas.style.cursor = 'crosshair'
144
+
145
+ this.clicked = true
146
+
147
+ this.sendMsg(this.CLT_MSG.PRESET_MOUSEDOWN, {origX: e.layerX, origY: e.layerY}, function (msg) {
148
+ if (msg.err !== 0) { }
149
+ })
150
+ }
151
+
152
+ canvas.onmousemove = (e) => {
153
+ if (!this.clicked) {
154
+ canvas.style.cursor = 'default'
155
+ return
156
+ }
157
+ canvas.style.cursor = 'crosshair'
158
+
159
+ this.sendMsg(this.CLT_MSG.PRESET_MOUSEMOVE, {offx: e.layerX, offy: e.layerY}, (msg) => {
160
+ if (msg.err !== 0) { }
161
+ })
162
+ }
163
+
164
+ onmouseout = canvas.onmouseup = (e) => {
165
+ canvas.style.cursor = 'default'
166
+ if (!this.clicked) { return }
167
+
168
+ this.sendMsg(this.CLT_MSG.PRESET_MOUSEUP, {offx: e.layerX, offy: e.layerY}, (msg) => {
169
+ if (msg.err !== 0) {
170
+
171
+ }
172
+ })
173
+ this.clicked = false
174
+ }
175
+ })
176
+ },
177
+ // 打开视频
178
+ cam_switch (capID) {
179
+ if (capID == 1) {
180
+ this.cameraurl = 'http://127.0.0.1:38088/video=stream&camidx=0'
181
+ }
182
+ if (capID == 2) {
183
+ this.cameraurl = 'http://127.0.0.1:38088/video=stream&camidx=1'
184
+ }
185
+ },
186
+ // 关闭视频
187
+ CloseVideo () {
188
+ this.cameraurl = ''
189
+ },
190
+ openApp () {
191
+ window.location.href = 'cameraServicetis:0' // 启动 CameraService 服务程序
192
+ },
193
+ // //获取初始化结果
194
+ // GetInitRet(){
195
+ // if(this.iswaiting) return
196
+ // this.iswaiting = true
197
+ // this.sendMsg(this.CLT_MSG.GET_EVENT,(msg)=> {
198
+ // if(msg.err !== 0){
199
+ // this.iswaiting = false
200
+ // return
201
+ // }
202
+ // let event = msg.event
203
+ // switch(event){
204
+ // case 2:
205
+ // this.output("设备连接中断,请重新连接后再次打开视频。");
206
+ // break
207
+ //
208
+ // case 1:
209
+ // this.output("初始化成功");
210
+ // break;
211
+ //
212
+ // case 0:
213
+ // this.output("设备非法");
214
+ // break
215
+ // }
216
+ // this.iswaiting = false
217
+ // })
218
+ // },
219
+ // //获取PID
220
+ // GetPid(){
221
+ // if(this.iswaiting) return
222
+ // this.iswaiting = true
223
+ // this.sendMsg(this.CLT_MSG.GET_PID, (msg) => {
224
+ // if(msg.err !== 0) {
225
+ // this.iswaiting = false
226
+ // return
227
+ // }
228
+ //
229
+ // this.output("pid : " + msg.pid)
230
+ // this.iswaiting = false
231
+ // })
232
+ // },
233
+ // //获取分辨率
234
+ // GetFbl(){
235
+ // if(this.iswaiting) return
236
+ // this.iswaiting = true;
237
+ // this.sendMsg(this.CLT_MSG.GET_FBL, (msg) => {
238
+ // if(msg.err !== 0) {
239
+ // this.iswaiting = false;
240
+ // return;
241
+ // }
242
+ //
243
+ // this.output("分辨率 : " + msg.fbl);
244
+ // this.iswaiting = false
245
+ // });
246
+ // },
247
+ // //设置分辨率
248
+ // SetResolution(){
249
+ // if(this.iswaiting) return
250
+ // this.iswaiting = true
251
+ // let first = false
252
+ // let second = false
253
+ // this.sendMsg(this.CLT_MSG.SET_MJPG, {isMJPG:1},(msg) => { //设置MJPG格式
254
+ // if(msg.err !== 0) {
255
+ // first = true
256
+ // if(first == true && second == true){
257
+ // this.iswaiting = false
258
+ // return
259
+ // }
260
+ // }
261
+ // this.output("MJPG : " + 1)
262
+ // first = true
263
+ // if(first == true && second == true){
264
+ // this.iswaiting = false
265
+ // }
266
+ // })
267
+ // this.sendMsg(this.CLT_MSG.SET_FBL, {width:800,height:600},(msg) => { //设置分辨率
268
+ // if(msg.err !== 0) {
269
+ // second = true
270
+ // if(first == true && second == true){
271
+ // this.iswaiting = false
272
+ // }
273
+ // return
274
+ // }
275
+ // this.output("设置分辨率 : width=" + 800 + ",height=" + 600)
276
+ // second = true
277
+ // if(first == true && second == true){
278
+ // this.iswaiting = false
279
+ // }
280
+ // })
281
+ // },
282
+ // //设置视频旋转方向
283
+ // SetOrientation(){
284
+ // let oriT = 0
285
+ // // 设置转动 0 正常 1 上下转 2 左转 3 右转
286
+ // if(this.iswaiting){
287
+ // return
288
+ // }
289
+ // this.iswaiting = true
290
+ // oriT = 2
291
+ // if(oriT == 1){
292
+ // this.rotanumber = 2
293
+ // }else if(oriT == 2){
294
+ // this.rotanumber = 3
295
+ // }else if(oriT == 3){
296
+ // this.rotanumber = 1
297
+ // }
298
+ // this.sendMsg(this.CLT_MSG.SET_TURN, {turn:oriT},(msg) => {
299
+ // if(msg.err !== 0) {
300
+ // this.iswaiting = false
301
+ // return
302
+ // }
303
+ //
304
+ // this.output("设置旋转 : turn=" + oriT)
305
+ // this.iswaiting = false
306
+ // });
307
+ // },
308
+ // //设置视频旋转方向
309
+ // SetLeft(){
310
+ // // 设置转动 0 正常 1 上下转 2 左转 3 右转
311
+ // if(this.iswaiting) return
312
+ // this.iswaiting = true
313
+ // this.rotanumber--;
314
+ // let T = 0;
315
+ // if(this.rotanumber%4 == 0){
316
+ // T = 0;
317
+ // }else if(this.rotanumber%4 == -1 || this.rotanumber%4 == 3){
318
+ // T = 2;
319
+ // }else if(this.rotanumber%4 == -2 || this.rotanumber%4 == 2){
320
+ // T = 1;
321
+ // }else if(this.rotanumber%4 == -3 || this.rotanumber%4 == 1){
322
+ // T = 3
323
+ // }
324
+ // this.sendMsg(this.CLT_MSG.SET_TURN, {turn:T},(msg) => {
325
+ // if(msg.err !== 0) {
326
+ // this.iswaiting = false
327
+ // return
328
+ // }
329
+ // this.output("设置旋转 : turn=" + T)
330
+ // this.iswaiting = false
331
+ // })
332
+ // },
333
+ // //设置视频旋转方向
334
+ // SetRight(){
335
+ // // 设置转动 0 正常 1 上下转 2 左转 3 右转
336
+ // if(this.iswaiting) return
337
+ // this.iswaiting = true
338
+ // this.rotanumber++;
339
+ // var T = 0;
340
+ // if(this.rotanumber%4 == 0){
341
+ // T = 0
342
+ // }else if(this.rotanumber%4 == 1 || this.rotanumber%4 == -3){
343
+ // T = 3
344
+ // }else if(this.rotanumber%4 == 2 || this.rotanumber%4 == -2){
345
+ // T = 1
346
+ // }else if(this.rotanumber%4 == 3 || this.rotanumber%4 == -1){
347
+ // T = 2
348
+ // }
349
+ // this.sendMsg(this.CLT_MSG.SET_TURN, {turn:T},(msg) => {
350
+ // if(msg.err !== 0) {
351
+ // this.iswaiting = false
352
+ // return
353
+ // }
354
+ //
355
+ // this.output("设置旋转 : turn=" + T)
356
+ // this.iswaiting = false
357
+ // })
358
+ // },
359
+ // 设置截图保存的jpg格式压缩质量
360
+ SetQuality () {
361
+ if (this.iswaiting) return
362
+ this.iswaiting = true
363
+ this.sendMsg(this.CLT_MSG.SET_QUALITY, {quality: 50}, (msg) => {
364
+ if (msg.err !== 0) {
365
+ this.iswaiting = false
366
+ return
367
+ }
368
+ this.output('设置拍照图片质量 : quality=' + 50)
369
+ this.iswaiting = false
370
+ })
371
+ },
372
+ // 设置自动裁边开启
373
+ // SetAutoCutOn () {
374
+ // console.log('设置自动采编')
375
+ // if (this.iswaiting) return
376
+ // this.iswaiting = true
377
+ // this.sendMsg(this.CLT_MSG.SET_AUTOCROP, {open: 1}, (msg) => {
378
+ // if (msg.err !== 0) {
379
+ // this.iswaiting = false
380
+ // return
381
+ // }
382
+ // this.output('设置自动裁边 : open=' + 1)
383
+ // this.iswaiting = false
384
+ // })
385
+ // },
386
+ // 设置自动裁边关闭
387
+ SetAutoCutOff () {
388
+ if (this.iswaiting) return
389
+ this.iswaiting = true
390
+ this.sendMsg(this.CLT_MSG.SET_AUTOCROP, {open: 0}, (msg) => {
391
+ if (msg.err !== 0) {
392
+ this.iswaiting = false
393
+ return
394
+ }
395
+ this.output('设置自动裁边 : open=' + 0)
396
+ this.iswaiting = false
397
+ })
398
+ },
399
+ // //设置预设框选
400
+ // SetBox(){
401
+ // if(this.iswaiting) return
402
+ // this.iswaiting = true
403
+ // this.resetx = 20
404
+ // this.resety = 20
405
+ // this.resetwidth = 300
406
+ // this.resetheight = 400
407
+ // this.sendMsg(this.CLT_MSG.SET_PREST, {left:this.resetx, top:this.resety, width:this.resetwidth, height:this.resetheight},(msg) =>{
408
+ // if(msg.err !== 0) {
409
+ // this.iswaiting = false
410
+ // return
411
+ // }
412
+ // this.output("设置预设框选 : left=" + this.resetx + ",top=" + this.resety + ",width=" + this.resetwidth + ",height=" + this.resetheight);
413
+ // this.iswaiting = false;
414
+ // })
415
+ // },
416
+ // //获取当前预设框选参数
417
+ // ShowResetInfo(){
418
+ // if(this.iswaiting) return
419
+ // this.iswaiting = true
420
+ // this.sendMsg(this.CLT_MSG.GET_PREST_INFO, (msg) => {
421
+ // if(msg.err !== 0) {
422
+ // this.iswaiting = false
423
+ // return
424
+ // }
425
+ // this.output("当前预设 : " + msg.prest_info)
426
+ // this.iswaiting = false
427
+ // })
428
+ // },
429
+ // 取消预设框选
430
+ ResetBox () {
431
+ if (this.iswaiting) return
432
+ this.iswaiting = true
433
+ this.sendMsg(this.CLT_MSG.SET_PREST, {left: 0, top: 0, width: 0, height: 0}, (msg) => {
434
+ if (msg.err !== 0) {
435
+ this.iswaiting = false
436
+ return
437
+ }
438
+ this.resetx = 0
439
+ this.resety = 0
440
+ this.resetwidth = 0
441
+ this.resetheight = 0
442
+ this.output('取消预设框选')
443
+ this.iswaiting = false
444
+ })
445
+ },
446
+ // //视频格式弹窗
447
+ // FormatDlg(){
448
+ // if(this.iswaiting) return
449
+ // this.iswaiting = true
450
+ // this.sendMsg(this.CLT_MSG.FORMAT_DLG,(msg) => {
451
+ // if(msg.err !== 0) {
452
+ // this.iswaiting = false;
453
+ // return
454
+ // }
455
+ // this.iswaiting = false;
456
+ // })
457
+ // },
458
+ // //视频属性弹窗
459
+ // PropertyDlg(){
460
+ // if(this.iswaiting) return
461
+ // this.iswaiting = true
462
+ // this.sendMsg(this.CLT_MSG.PROPERTY_DLG,(msg) => {
463
+ // if(msg.err !== 0) {
464
+ // this.iswaiting = false;
465
+ // return
466
+ // }
467
+ // this.iswaiting = false;
468
+ // })
469
+ // },
470
+ // //设置颜色模式 只针对截图
471
+ bb () {
472
+ let camidx = 0
473
+ if (this.cameraurl === 'http://127.0.0.1:38088/video=stream&camidx=0') {
474
+ camidx = 0
475
+ } else if (this.cameraurl === 'http://127.0.0.1:38088/video=stream&camidx=1') {
476
+ camidx = 1
477
+ } else {
478
+ this.$showAlert('请先打开视频', 'warning', 2000)
479
+ return
480
+ }
481
+ let param = {
482
+ camidx: camidx
483
+ }
484
+ this.$resetpost('http://127.0.0.1:38088/video=grabimage', param).then((msg) => { // 截图
485
+ console.log(msg)
486
+
487
+ if (msg.data.code != '0') {
488
+ this.$showAlert(msg.data.message, 'warning', 2000)
489
+ return
490
+ }
491
+ let s = 'data:image/jpg;base64,' + msg.data.photoBase64
492
+ document.getElementById('Base64IMG').src = s// 网页预览图片
493
+
494
+ this.output('base64 长度 : ' + s.length)
495
+
496
+ this.$dispatch('photo-finish', msg.data.photoBase64)
497
+ // document.getElementById("Base64IMG").src= "D:\\1234.jpg?" + Math.random();//网页预览图片
498
+ })
499
+ },
500
+ // 内存截图
501
+ bbase64 () {
502
+ if (this.iswaiting) return
503
+ this.iswaiting = true
504
+ this.sendMsg(this.CLT_MSG.GET_PICTURE_MEM, {turn: 0}, (msg) => {
505
+ if (msg.err !== 0) {
506
+ this.iswaiting = false
507
+ return
508
+ }
509
+ let s = 'data:image/jpg;base64,' + msg.base64str
510
+ document.getElementById('Base64IMG').src = s// 网页预览图片
511
+ alert(s)
512
+ this.output('base64 长度 : ' + s.length)
513
+ this.iswaiting = false
514
+ })
515
+ },
516
+ // base64编码测试
517
+ TestBase64 () {
518
+ if (this.iswaiting) return
519
+ this.iswaiting = true
520
+ this.sendMsg(this.CLT_MSG.TEST_BASE64, {code: '123456789'}, (msg) => {
521
+ if (msg.err !== 0) {
522
+ this.iswaiting = false
523
+ return
524
+ }
525
+ this.output('base64 内容 : ' + msg.base64str)
526
+ this.iswaiting = false
527
+ })
528
+ },
529
+ // //开启去底色
530
+ // bbStartClean(){
531
+ // if(this.iswaiting) return;
532
+ // this.iswaiting = true;
533
+ // this.sendMsg(this.CLT_MSG.SET_CLEAN_PARAM,{param1:280,param2:1.15,param3:8},(msg) => {
534
+ // if(msg.err !== 0){
535
+ // this.iswaiting = false
536
+ // return
537
+ // }
538
+ // this.output("去底色: " + 280 + "," + 1.15 + "," + 8)
539
+ // this.iswaiting = false
540
+ // })
541
+ // },
542
+ // //关闭去底色
543
+ // bbCloseClean(){
544
+ // if(this.iswaiting) return
545
+ // this.iswaiting = true
546
+ // this.sendMsg(this.CLT_MSG.SET_CLEAN_PARAM,{param1:-1},(msg) => {
547
+ // if(msg.err !== 0){
548
+ // this.iswaiting = false;
549
+ // return
550
+ // }
551
+ // this.output("去底色: " + -1);
552
+ // this.iswaiting = false;
553
+ // });
554
+ // },
555
+ // //设置制作PDF临时目录
556
+ // SetPDFPath(){
557
+ // if(this.iswaiting) return
558
+ // this.iswaiting = true
559
+ // this.sendMsg(this.CLT_MSG.SET_TEMPDIR,{path:"d:\\tp\\temp"},(msg) => {
560
+ // if(msg.err !== 0){
561
+ // this.iswaiting = false
562
+ // return
563
+ // }
564
+ // this.output("设置PDF路径: " + "d:\\tp\\temp")
565
+ // this.iswaiting = false
566
+ // })
567
+ // },
568
+ // //开始制作PDF
569
+ // BeginPDF(){
570
+ // if(this.iswaiting) return
571
+ // this.iswaiting = true
572
+ // this.sendMsg(this.CLT_MSG.BEGIN_PDF,(msg) => {
573
+ // if(msg.err !== 0){
574
+ // this.iswaiting = false
575
+ // return
576
+ // }
577
+ // this.output("开始制作PDF")
578
+ // this.iswaiting = false
579
+ // })
580
+ // },
581
+ // //PDF截图 保存到PDF临时目录
582
+ // GetPDF(){
583
+ // if(this.iswaiting) return
584
+ // this.iswaiting = true
585
+ // this.sendMsg(this.CLT_MSG.GET_PDF_PICTURES,{turn:0},(msg) => {
586
+ // if(msg.err !== 0){
587
+ // this.iswaiting = false
588
+ // return
589
+ // }
590
+ // // let s = "file://" + msg.path
591
+ // let s = "data:image/jpg;base64," + msg.base64str;
592
+ // document.getElementById("IMG1").src= null;
593
+ // document.getElementById("IMG1").src= document.getElementById("IMG2").src;
594
+ //
595
+ // document.getElementById("IMG2").src= null;
596
+ // document.getElementById("IMG2").src= document.getElementById("IMG3").src;
597
+ //
598
+ // document.getElementById("IMG3").src= null;
599
+ // document.getElementById("IMG3").src= s;
600
+ // this.output("PDF 文件 : " + msg.path + ",PDF文件 BASE64码长度:" + msg.base64str.length);
601
+ // this.iswaiting = false;
602
+ // })
603
+ // },
604
+ // // 结束制作PDF
605
+ // EndPDF(){
606
+ // if(this.iswaiting) return
607
+ // this.iswaiting = true
608
+ // this.sendMsg(this.CLT_MSG.END_PDF_PICTURES,{path:"D:\\tp\\1234.pdf"},(msg) => {
609
+ // if(msg.err !== 0){
610
+ // this.iswaiting = false
611
+ // return
612
+ // }
613
+ // this.output("结束PDF PDF文件:" + "D:\\tp\\1234.pdf");
614
+ // this.iswaiting = false;
615
+ // })
616
+ // },
617
+ // //PDF文件转码成BASE64文件 适合所有格式文件 非PDF也可使用
618
+ // PDFtoBASE64(){
619
+ // if(this.iswaiting) return
620
+ // this.iswaiting = true
621
+ // this.sendMsg(this.CLT_MSG.PDF_TO_BASE64,{src:"D:\\tp\\1234.pdf",des:"D:\\tp\\temp\\1234.txt"},(msg) => {
622
+ // if(msg.err !== 0){
623
+ // this.iswaiting = false
624
+ // if(msg.err == 108){return this.output("读文件错误")}
625
+ // if(msg.err == 109){return this.output("写文件错误")}
626
+ // }
627
+ // this.output("文件 :" + "D:\\tp\\1234.pdf" + "转成base64 :" + "D:\\tp\\temp\\1234.txt");
628
+ // this.iswaiting = false
629
+ // })
630
+ // },
631
+ // //base64文件转成PDF文件 适合所有文件 非PDF文件也可使用
632
+ // BASE64toPDF(){
633
+ // if(this.iswaiting) return
634
+ // this.iswaiting = true
635
+ // this.sendMsg(this.CLT_MSG.BASE64_TO_PDF,{src:"D:\\tp\\temp\\1234.txt",des:"D:\\tp\\pdfpdf.pdf"},(msg) => {
636
+ // if(msg.err !== 0){
637
+ // this.iswaiting = false;
638
+ // if(msg.err == 108){return this.output("读文件错误")}
639
+ // if(msg.err == 109){return this.output("写文件错误")}
640
+ // }
641
+ // this.output("base64文件: " + "D:\\tp\\temp\\1234.txt" + "转成:" + "D:\\tp\\pdfpdf.pdf")
642
+ // this.iswaiting = false
643
+ // })
644
+ // },
645
+ // //PDF文件转成BASE64码字符串 适合所有文件 非PDF文件也可使用
646
+ // PDFtoBASE64Str(){
647
+ // if(this.iswaiting) return
648
+ // this.iswaiting = true
649
+ // this.sendMsg(this.CLT_MSG.PDF_TO_BASE64_STR,{file:"D:\\tp\\pdfpdf.pdf"},(msg) => {
650
+ // if(msg.err !== 0){
651
+ // this.iswaiting = false
652
+ // if(msg.err == 108){return this.output("读文件错误")}
653
+ // }
654
+ // alert(msg.base64str)
655
+ // this.output("文件 BASE64 长度: " + msg.base64str.length)
656
+ // this.iswaiting = false
657
+ // })
658
+ // },
659
+ // //打印图片
660
+ // printimage(){
661
+ // if(this.iswaiting) return
662
+ // this.iswaiting = true
663
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:"D:\\tp\\1234.jpg"},(msg) => {
664
+ // if(msg.err !== 0){ //错误消息可以不用处理 在config.js中已经有了统一的打印处理 在output函数中设置打印位置
665
+ // this.iswaiting = false;
666
+ // if(msg.err == 112){return this.output("开启打印机错误");}
667
+ // if(msg.err == 111){return this.output("请检查打印机纸张");}
668
+ // if(msg.err == 110){return this.output("没有默认打印机");}
669
+ // }
670
+ // this.output("打印作业号: " + msg.print_no);
671
+ // this.iswaiting = false;
672
+ // })
673
+ // },
674
+ // //显示错误弹窗
675
+ // ShowErrorInfo(){
676
+ // if(this.iswaiting) return
677
+ // this.iswaiting = true
678
+ // this.sendMsg(this.CLT_MSG.SHOW_ERROR_BOX,{on:1},(msg) => {
679
+ // if(msg.err !== 0){
680
+ // this.iswaiting = false
681
+ // return
682
+ // }
683
+ // this.output("错误提示开关:" + 1)
684
+ // this.iswaiting = false;
685
+ // })
686
+ // },
687
+ // //删除制作PDF的图片文件
688
+ // DelPDF3(){
689
+ // if(this.iswaiting) return
690
+ // this.iswaiting = true
691
+ // this.sendMsg(this.CLT_MSG.DEL_PICTURE_PDF,{file:1},(msg) => {
692
+ // if(msg.err !== 0){
693
+ // this.iswaiting = false
694
+ // return
695
+ // }
696
+ // this.output("删除PDF图片文件成功")
697
+ // this.iswaiting = false
698
+ // })
699
+ // document.getElementById("IMG3").src= null;
700
+ // document.getElementById("IMG3").src= document.getElementById("IMG2").src;
701
+ //
702
+ // document.getElementById("IMG2").src= null;
703
+ // document.getElementById("IMG2").src= document.getElementById("IMG1").src;
704
+ //
705
+ // document.getElementById("IMG1").src= null;
706
+ // },
707
+ // //删除制作PDF的临时图片文件
708
+ // DelPDF2(){
709
+ // if(this.iswaiting) return
710
+ // this.iswaiting = true
711
+ // this.sendMsg(this.CLT_MSG.DEL_PICTURE_PDF,{file:2},(msg) => {
712
+ // if(msg.err !== 0){
713
+ // this.iswaiting = false
714
+ // return
715
+ // }
716
+ // this.output("删除PDF图片文件成功")
717
+ // this.iswaiting = false
718
+ // })
719
+ // document.getElementById("IMG2").src= null;
720
+ // document.getElementById("IMG2").src= document.getElementById("IMG1").src;
721
+ // document.getElementById("IMG1").src= null;
722
+ // },
723
+ // //删除制作PDF的临时图片文件
724
+ // DelPDF1(){
725
+ // if(this.iswaiting) return
726
+ // this.iswaiting = true
727
+ // this.sendMsg(this.CLT_MSG.DEL_PICTURE_PDF,{file:3},(msg) => {
728
+ // if(msg.err !== 0){
729
+ // this.iswaiting = false;
730
+ // return
731
+ // }
732
+ // this.output("删除PDF图片文件成功")
733
+ // this.iswaiting = false
734
+ // })
735
+ // document.getElementById("IMG1").src= null;
736
+ // },
737
+ // //人证对比
738
+ // IDCardCompare(){
739
+ // if(this.iswaiting) return
740
+ // this.iswaiting = true
741
+ // let send = {file1:"D:\\1.jpg",file2:"D:\\2.jpg"}
742
+ // this.sendMsg(this.CLT_MSG.IDCARD_COMPARE,send,(msg) => {
743
+ // if(msg.err !== 0){
744
+ // this.iswaiting = false
745
+ // return
746
+ // }
747
+ // this.output("对比完成:" + send.file1 + "与" + send.file2 + "相似度"+ msg.cmpresult)
748
+ // this.iswaiting = false
749
+ // })
750
+ // },
751
+ ReadIDCard () {
752
+ return this.sendMsg(this.CLT_MSG.READ_IDCARD, (msg) => {
753
+ if (msg.err !== 0) { return }
754
+ this.setText(msg)
755
+ this.output('单读卡')
756
+ })
757
+ },
758
+ // 读身份证
759
+ Begin () {
760
+ this.$resetpost('http://127.0.0.1:38088/card=idcard', {}).then((msg) => { // 截图
761
+ console.log(msg)
762
+
763
+ if (msg.data.code != '0') {
764
+ this.$showAlert(msg.data.message, 'warning', 2000)
765
+ return
766
+ }
767
+
768
+ this.output('读取身份证')
769
+
770
+ // document.getElementById("Base64IMG").src= "D:\\1234.jpg?" + Math.random();//网页预览图片
771
+ })
772
+ this.output('开始读卡')
773
+ },
774
+ // 停止读身份证
775
+ Stop () {
776
+ this.sendMsg(this.CLT_MSG.STOP_READ_IDCARD, (msg) => {
777
+ if (msg.err !== 0) { return }
778
+ this.output('停止读卡')
779
+ })
780
+ },
781
+ // //横向复印
782
+ // HCopy(){
783
+ // this.sendMsg(this.CLT_MSG.HCOPY_IDCARD, {copy_path:"D:\\"},(msg) => {
784
+ // if(msg.err !== 0){return}
785
+ // document.getElementById("IDCardDisplay").src = "data:image/jpg;base64," + msg.hcopy
786
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:msg.filename},(msg2) => {
787
+ // if(msg2.err !== 0){ return}
788
+ // his.output("打印作业号: " + msg2.print_no)
789
+ // })
790
+ // this.output("横向复印" + msg.filename)
791
+ // })
792
+ // },
793
+ // //竖向复印
794
+ // VCopy(){
795
+ // this.sendMsg(this.CLT_MSG.VCOPY_IDCARD, {copy_path:"D:\\"},(msg) => {
796
+ // if(msg.err !== 0){return}
797
+ // document.getElementById("IDCardDisplay").src = "data:image/jpg;base64," + msg.vcopy;
798
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:msg.filename},(msg2) => {
799
+ // if(msg2.err !== 0){ return}
800
+ // this.output("打印作业号: " + msg2.print_no)
801
+ // })
802
+ // this.output("竖向复印" + msg.filename)
803
+ // })
804
+ // },
805
+ // //正面复印
806
+ // PCopy(){
807
+ // this.sendMsg(this.CLT_MSG.PCOPY_IDCARD, {copy_path:"D:\\"},(msg) => {
808
+ // if(msg.err !== 0){return}
809
+ // document.getElementById("IDCardDisplay").src = "data:image/jpg;base64," + msg.pcopy
810
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:msg.filename},(msg2) => {
811
+ // if(msg2.err !== 0){ return}
812
+ // this.output("打印作业号: " + msg2.print_no)
813
+ // })
814
+ // this.output("正面复印" + msg.filename)
815
+ // })
816
+ // },
817
+ // //反面复印
818
+ // NCopy(){
819
+ // this.sendMsg(this.CLT_MSG.NCOPY_IDCARD, {copy_path:"D:\\"},(msg) => {
820
+ // if(msg.err !== 0){return}
821
+ // document.getElementById("IDCardDisplay").src = "data:image/jpg;base64," + msg.ncopy
822
+ // this.sendMsg(this.CLT_MSG.PRINT_IMAGE,{file:msg.filename},(msg2) => {
823
+ // if(msg2.err !== 0){ return}
824
+ // this.output("打印作业号: " + msg2.print_no)
825
+ // })
826
+ // this.output("反面复印" + msg.filename)
827
+ // })
828
+ // },
829
+ // 视频帧绘制函数
830
+ drawImage (data) {
831
+ // 校验视频是否在一定时间内的
832
+ if (!this.checkTimestamp(data[2] * 256 + data[1])) {
833
+ return
834
+ }
835
+ // 视频帧头有时间戳 注意偏移 和 大小端处理
836
+ let width = data[this.base_offset + 1] * 256 + data[this.base_offset]
837
+ let height = data[this.base_offset + 3] * 256 + data[this.base_offset + 2]
838
+
839
+ let cam = document.getElementById('cam')
840
+ let context = cam.getContext('2d')
841
+ if (this.orgdrawwidth != width || this.orgdrawheight != height) {
842
+ this.orgdrawwidth = width
843
+ this.orgdrawheight = height
844
+ cam.height = cam.height
845
+ }
846
+
847
+ let image = context.createImageData(width, height)
848
+ for (let n = 0; n != height; ++n) {
849
+ for (let m = 0; m != width; ++m) {
850
+ let image_offset = ((height - n - 1) * width + m) * 4
851
+ let data_offset = (n * width + m) * 3 + this.base_offset + 4
852
+ image.data[image_offset] = data[data_offset + 2]
853
+ image.data[image_offset + 1] = data[data_offset + 1]
854
+ image.data[image_offset + 2] = data[data_offset]
855
+ image.data[image_offset + 3] = 255
856
+ }
857
+ }
858
+ context.putImageData(image, 0, 0)
859
+ },
860
+ checkTimestamp (svr_time) {
861
+ let myDate = new Date()
862
+ let clt_time = myDate.getSeconds() * 1000 + myDate.getMilliseconds()
863
+ if (clt_time < svr_time) {
864
+ clt_time += 60 * 1000
865
+ }
866
+ return clt_time - svr_time < 3000
867
+ },
868
+ sendMsg (proto, msg, cb) {
869
+ if (!ws) {
870
+ return
871
+ }
872
+
873
+ if (typeof msg !== 'object') {
874
+ if (typeof msg === 'function') {
875
+ cb = msg
876
+ msg = {}
877
+ } else {
878
+ msg = {}
879
+ }
880
+ }
881
+
882
+ msg.proto = proto
883
+ if (typeof cb === 'function') {
884
+ this.callback[++this.context] = cb
885
+ msg.user_data = this.context
886
+ }
887
+
888
+ ws.send(JSON.stringify(msg))
889
+ },
890
+ output (content) {
891
+ if (content.length == 0) { return }
892
+ let console = document.getElementById('Console')
893
+ console.value += content
894
+ console.value += '\r'
895
+ console.scrollTop = console.scrollHeight
896
+ },
897
+ // 显示读到的身份证信息
898
+ setText (msg) {
899
+ document.getElementById('Name').value = msg.strName
900
+ document.getElementById('Sex').value = msg.strSex
901
+ document.getElementById('Nation').value = msg.strNation
902
+ document.getElementById('Born').value = msg.strBirth
903
+ document.getElementById('Address').value = msg.strAddress
904
+ document.getElementById('CardNo').value = msg.strID
905
+ document.getElementById('Police').value = msg.strOrg
906
+ document.getElementById('ActivityLFrom').value = msg.strVaildityfrom
907
+ document.getElementById('ActivityLTo').value = msg.strVaildityto
908
+ document.getElementById('DeviceNo').value = msg.strName
909
+ document.getElementById('PhotoBuffer').value = msg.base64BMP
910
+ document.getElementById('PhotoDisplay').src = 'data:image/jpg;base64,' + msg.base64BMP
911
+ this.IdCardInfo = msg
912
+ },
913
+ close () {
914
+ this.show = !this.show
915
+ if (this.isopen) {
916
+ this.CloseVideo()
917
+ }
918
+ },
919
+ confirmIdCard () {
920
+ let param = this.IdCardInfo
921
+ this.$emit('confirminfo', param)
922
+ this.IdCardInfo = {}
923
+ }
924
+ },
925
+ ready () {
926
+ this.onLoad().then(() => {
927
+ this.$emit('ready')
928
+ }).catch((error) => {
929
+ this.$emit('error', error)
930
+ })
931
+ }
932
+ }
933
+ </script>
934
+
935
+ <style scoped>
936
+ .modal-bk{
937
+ border-radius:18px 0;
938
+ }
939
+ .header{
940
+ background-color: #d8e9f3;
941
+ height: 88px;
942
+ }
943
+ .title{
944
+ position: absolute;
945
+ font-family:PingFang-SC-Bold;
946
+ font-size:36px;
947
+ color: #666666;
948
+ margin-top: 32px;
949
+ margin-left: 665.5px;
950
+ margin-bottom: 0px;
951
+ }
952
+ .operation{
953
+ font-family:PingFang-SC-Medium;
954
+ font-size: 22px;
955
+ color:#666666;
956
+ line-height: 5px;
957
+ }
958
+ .operation-group{
959
+ margin-left: 36px;
960
+ margin-top: 20px;
961
+ }
962
+ .photo{
963
+ font-family: PingFang-SC-Medium;
964
+ font-size: 20px;
965
+ color: #ffffff;
966
+ margin-left: 20px;
967
+ border-radius: 4px;
968
+ background-color: #2fadf5;
969
+ height: 32px;
970
+ width: 92px;
971
+ line-height:12px;
972
+ }
973
+ .readIDCard{
974
+ font-family: PingFang-SC-Medium;
975
+ font-size: 20px;
976
+ color: #ffffff;
977
+ border-radius: 4px;
978
+ background-color: #2fadf5;
979
+ margin-left: 20px;
980
+ width: 120px;
981
+ height: 32px;
982
+ line-height: 12px;
983
+ }
984
+ .stop{
985
+ border-radius: 4px;
986
+ border: 1px solid #2fadf5;
987
+ font-family: PingFang-SC-Medium;
988
+ font-size: 20px;
989
+ color: #2fadf5;
990
+ width: 120px;
991
+ height: 32px;
992
+ line-height: 12px;
993
+ }
994
+ .showInfo{
995
+ float: left;
996
+ width: 640px;
997
+ display: inline-block;
998
+ margin-top: 20px;
999
+ margin-left: 36px;
1000
+ }
1001
+ #Console{
1002
+ margin-left: 18px;
1003
+ border-radius: 4px;
1004
+ border: 1px solid #b5b5b5;
1005
+ height:300px;
1006
+ width:322px;
1007
+ resize:none;
1008
+ background-color: #f6f6f6;
1009
+ }
1010
+ .img{
1011
+ height:300px;
1012
+ width:300px;
1013
+ float: left;
1014
+ border-radius: 4px;
1015
+ border: 1px solid #b5b5b5;
1016
+ }
1017
+ #cam{
1018
+ border-radius: 4px;
1019
+ border:1px solid #b5b5b5;
1020
+ display: inline-block
1021
+ }
1022
+ .IdCard{
1023
+ height: 950px;
1024
+ width: 692px;
1025
+ display: inline-block;
1026
+ border-radius: 20px;
1027
+ background-color: #fafafa;
1028
+ border: 1px solid #d8f1ff;
1029
+ margin-left: 40px;
1030
+ margin-top: 20px;
1031
+ }
1032
+ .IdInput{
1033
+ border-radius: 4px;
1034
+ border: 1px solid #939393;
1035
+ width: 400px;
1036
+ height: 38px;
1037
+ margin-left: 20px;
1038
+ }
1039
+ .IdInputDiv{
1040
+ margin-top: 20px;
1041
+ margin-left: 100px;
1042
+ }
1043
+ .IdHint{
1044
+ font-family: PingFang-SC-Medium;
1045
+ font-size: 18px;
1046
+ color: #7e7c81;
1047
+ }
1048
+ #PhotoBuffer,#PhotoDisplay{
1049
+ border-radius: 4px;
1050
+ background-color: #ffffff;
1051
+ border: 1px solid #939393;
1052
+ margin-left: 20px;
1053
+ }
1054
+ </style>
@@ -0,0 +1,9 @@
1
+ // 分公司特殊组件页面注册
2
+ import Vue from 'vue'
3
+
4
+ export default function () {
5
+ // 高拍仪
6
+ Vue.component('high-meter', (resolve) => {
7
+ require(['./HighMeterIdCard'], resolve)
8
+ })
9
+ }