sale-client 4.2.113 → 4.2.115
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/.project +6 -0
- package/build/dev-server.js +7 -7
- package/package.json +1 -1
- package/src/components/charge/business/ServiceEvaluation.vue +498 -0
- package/src/components/revenue/base/leftview/ServiceRepair.vue +33 -13
- package/src/components/revenue/batchDeduction/batchDeductionList.vue +2 -0
- package/src/filiale/jinhuang/ChargeManage.vue +381 -0
- package/src/filiale/jinhuang/ChargeOper.vue +345 -0
- package/src/filiale/jinhuang/sale.js +2 -0
- package/src/main.js +1 -1
- package/src/plugins/QXClient.js +335 -0
- package/src/sale.js +3 -0
- package/.gradle/5.2.1/fileChanges/last-build.bin +0 -0
- package/.gradle/5.2.1/fileHashes/fileHashes.lock +0 -0
- package/.gradle/5.2.1/gc.properties +0 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-inline" style="height: auto">
|
|
3
|
+
<div class="form-group" v-for="btn in operBtns">
|
|
4
|
+
<button :id="btn.name" type="button"
|
|
5
|
+
:style="['其他欠费','调价补差'].includes(btn.name) ?'color:#CA2C16':'color:black'"
|
|
6
|
+
:class="[($index === 0) ? 'btn btn-click' : 'btn btn-un-click']" @click="business(btn)"
|
|
7
|
+
:disabled="noButton"><span
|
|
8
|
+
:style="['其他欠费','调价补差'].includes(btn.name) ?'color:#CA2C16':'color:black'">{{ btn.name }}</span>
|
|
9
|
+
</button>
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
<div v-show="isBusiness" style="height: auto" class="select-overspread">
|
|
14
|
+
<route v-ref:route></route>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
import {HttpResetClass} from 'vue-client'
|
|
20
|
+
import Vue from 'vue'
|
|
21
|
+
|
|
22
|
+
let getNewmetermsg = async function (self, row) {
|
|
23
|
+
self.cardInfo = undefined
|
|
24
|
+
if (row.f_userfiles_id && row.f_userfiles_id.length > 0) {
|
|
25
|
+
// 获取用户信息
|
|
26
|
+
let getUser = await self.$resetpost('api/af-revenue/sql/sale_getUser', {
|
|
27
|
+
data: {
|
|
28
|
+
condition: `u.f_userfiles_id='${row.f_userfiles_id}' `,
|
|
29
|
+
orderitem: `u.f_userfiles_id Desc`
|
|
30
|
+
}
|
|
31
|
+
}, {resolveMsg: '读卡新的用户成功', rejectMsg: '读卡新的用户失败'})
|
|
32
|
+
if (getUser.data.length > 0) {
|
|
33
|
+
await self.$showAlert('换表成功', 'success', 200)
|
|
34
|
+
self.data = getUser.data[0]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let getBtnsGen = async function (self) {
|
|
39
|
+
let http = new HttpResetClass()
|
|
40
|
+
let param = {
|
|
41
|
+
f_userfiles_id: self.data.f_userfiles_id
|
|
42
|
+
}
|
|
43
|
+
if (self.cardInfo) {
|
|
44
|
+
param.cardInfo = self.cardInfo
|
|
45
|
+
}
|
|
46
|
+
let res = await http.load('POST', 'api/af-revenue/logic/getOperBtns', {
|
|
47
|
+
data: param
|
|
48
|
+
}, {
|
|
49
|
+
resolveMsg: null,
|
|
50
|
+
rejectMsg: '获取业务按钮失败!!'
|
|
51
|
+
})
|
|
52
|
+
let http2 = new HttpResetClass()
|
|
53
|
+
let getWriteError = await http2.load('POST', 'api/af-revenue/sql/singleTable_OrderBy', {
|
|
54
|
+
data: {
|
|
55
|
+
condition: `f_state = '有效' and (f_write_card = '写卡失败' and f_operate_date >= DATEADD(HOUR, -3, GETDATE())) and f_userfiles_id = '${self.data.f_userfiles_id}'`,
|
|
56
|
+
tablename: 't_fillcard',
|
|
57
|
+
items: '*',
|
|
58
|
+
orderitem: 'id desc'
|
|
59
|
+
}
|
|
60
|
+
}, {resolveMsg: null, rejectMsg: '获取写卡失败的补卡记录失败'})
|
|
61
|
+
console.log('获取写卡失败的补卡记录', getWriteError)
|
|
62
|
+
let getBtns = res.data
|
|
63
|
+
console.log('获取的业务按钮', getBtns)
|
|
64
|
+
console.log('有没有用户信息', self.data)
|
|
65
|
+
for(let i = 0; i < getBtns.length; i++){
|
|
66
|
+
if(getBtns[i].name === '其他欠费'){
|
|
67
|
+
self.$showMessage('请先完成待缴费的材料费',["confirm","cancel"]).then(res =>{
|
|
68
|
+
if(res === 'confirm'){
|
|
69
|
+
self.business(getBtns[i])
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (self.$login.r.length === 0) {
|
|
75
|
+
self.$showAlert('您没有相关的业务操作权限, 请联系管理员!!', 'warning', 2000)
|
|
76
|
+
} else {
|
|
77
|
+
self.temp = []
|
|
78
|
+
for (let i = 0; i < getBtns.length; i++) {
|
|
79
|
+
// 不需要权限的按钮
|
|
80
|
+
let noInclude = getBtns[i].name === '垃圾费收费'
|
|
81
|
+
if (noInclude || self.$login.r.includes(getBtns[i].name)) {
|
|
82
|
+
// 进行权限验证
|
|
83
|
+
if (getBtns[i].name === '换表&清零') {
|
|
84
|
+
self.temp.push({
|
|
85
|
+
name: '换表',
|
|
86
|
+
value: getBtns[i].value
|
|
87
|
+
})
|
|
88
|
+
if (self.data.f_totalsplit_type !== '总表') {
|
|
89
|
+
self.temp.push({
|
|
90
|
+
name: '清零',
|
|
91
|
+
value: {
|
|
92
|
+
'weight': getBtns[i].value.weight,
|
|
93
|
+
'routeName': 'reset-meter'
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
self.temp.push(getBtns[i])
|
|
99
|
+
}
|
|
100
|
+
console.log(self.temp[i])
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// // 检查是否需要展示限制购气按钮
|
|
104
|
+
// if (self.$login.r.includes('限制购气')) {
|
|
105
|
+
// let limitGasButton = getBtns.find(btn => btn.name === '限制购气')
|
|
106
|
+
// if (limitGasButton) {
|
|
107
|
+
// self.temp.push(limitGasButton)
|
|
108
|
+
// }
|
|
109
|
+
// }
|
|
110
|
+
// 如果有未写卡记录,添加线下写卡按钮
|
|
111
|
+
if (self.data.unWriteSell) {
|
|
112
|
+
if (self.data.unWriteSell.length > 0) {
|
|
113
|
+
self.temp.push({
|
|
114
|
+
name: '线下写卡',
|
|
115
|
+
value: {
|
|
116
|
+
'weight': 0,
|
|
117
|
+
'routeName': 'un-write-card-center'
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (self.data.f_user_nature === '单位') {
|
|
123
|
+
self.temp.push({
|
|
124
|
+
name: '维管收费',
|
|
125
|
+
value: {
|
|
126
|
+
'weight': 5,
|
|
127
|
+
'routeName': 'repair-charge'
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
if (self.data.f_meter_type === '物联网表') {
|
|
132
|
+
if (self.data.f_hascard === '是') {
|
|
133
|
+
if (self.data.f_whether_hairpin === '未发') {
|
|
134
|
+
if (self.data.f_share_times !== '' && self.data.f_share_times === '是' && self.data.f_times > 0) {
|
|
135
|
+
self.temp.push({
|
|
136
|
+
name: '补卡',
|
|
137
|
+
value: {
|
|
138
|
+
'weight': 2,
|
|
139
|
+
'routeName': 'replace-card-manage'
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
} else {
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// 如果卡上有气,添加购气撤销按钮
|
|
148
|
+
if (self.cardInfo && (self.cardInfo.Gas > 0 || self.cardInfo.Money > 0 || (self.cardInfo.TotalMoney > 0 && self.data.f_support_purchase === '是'))) {
|
|
149
|
+
self.temp.push({
|
|
150
|
+
name: '购气撤销',
|
|
151
|
+
value: {
|
|
152
|
+
'weight': 0,
|
|
153
|
+
'routeName': 'card-meter-charge-cancel'
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
if (self.data.unWriteSell && self.data.unWriteSell.length > 0) {
|
|
157
|
+
// 过滤掉线下写卡
|
|
158
|
+
self.temp = self.temp.filter((item) => {
|
|
159
|
+
return item.name !== '线下写卡'
|
|
160
|
+
})
|
|
161
|
+
self.data.unWriteSell.forEach(
|
|
162
|
+
async (item) => {
|
|
163
|
+
let sql = `update t_sellinggas set f_write_card = null where id = '${item.id}' and f_write_card ='写卡失败'`
|
|
164
|
+
await self.$resetpost('api/af-revenue/logic/runSQL', { sql: sql })
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/* // 如果是预备户,删除发卡售气按钮
|
|
170
|
+
if (self.data.f_user_state == '预备') {
|
|
171
|
+
self.temp.splice(self.temp.findIndex(item => item.name === '发卡售气'), 1)
|
|
172
|
+
} */
|
|
173
|
+
// 根据权重将业务按钮排序
|
|
174
|
+
self.operBtns = self.temp.sort((a, b) => {
|
|
175
|
+
return a.value.weight - b.value.weight
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
// 当有调价补差时,只展示调价补差按钮
|
|
179
|
+
let adjustSenders = self.operBtns.find((row) => {
|
|
180
|
+
return row.name == '调价补差'
|
|
181
|
+
})
|
|
182
|
+
if (adjustSenders) {
|
|
183
|
+
self.operBtns = []
|
|
184
|
+
self.operBtns.push(adjustSenders)
|
|
185
|
+
}
|
|
186
|
+
if (getWriteError.data.length > 0) {
|
|
187
|
+
self.operBtns = [{
|
|
188
|
+
name: '补卡',
|
|
189
|
+
value: {
|
|
190
|
+
'weight': 0,
|
|
191
|
+
'routeName': 'replace-card-manage'
|
|
192
|
+
}
|
|
193
|
+
}]
|
|
194
|
+
}
|
|
195
|
+
if (self.operBtns.length > 0) {
|
|
196
|
+
self.operBtns.push({
|
|
197
|
+
name: '评价',
|
|
198
|
+
value: {
|
|
199
|
+
'weight': self.operBtns.length + 1,
|
|
200
|
+
'routeName': 'service-evaluation'
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
}
|
|
204
|
+
if (self.operBtns.length > 0) {
|
|
205
|
+
if (self.$parent.activeBusiness) {
|
|
206
|
+
const targetBtn = self.operBtns.find(btn => btn.name === self.$parent.activeBusiness)
|
|
207
|
+
if (targetBtn) {
|
|
208
|
+
self.$nextTick(() => {
|
|
209
|
+
self.business(targetBtn)
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
self.isBusiness = true
|
|
214
|
+
self.$refs.route.init(self.operBtns[0].value.routeName, {row: self.data, cardData: self.cardInfo, writeError: getWriteError.data})
|
|
215
|
+
self.styleChange(self.operBtns[0].name)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// // 添加“限制购气”按钮
|
|
220
|
+
// self.operBtns.push({
|
|
221
|
+
// name: '限制购气',
|
|
222
|
+
// value: {
|
|
223
|
+
// 'weight': 0,
|
|
224
|
+
// 'routeName': 'limit-gas-manages'
|
|
225
|
+
// }
|
|
226
|
+
// })
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export default {
|
|
230
|
+
title: '业务操作',
|
|
231
|
+
data () {
|
|
232
|
+
return {
|
|
233
|
+
operBtns: [],
|
|
234
|
+
isBusiness: false,
|
|
235
|
+
noButton: false // 业务请求时禁止按钮点击
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
props: ['data', 'cardInfo'],
|
|
239
|
+
ready () {
|
|
240
|
+
getBtnsGen(this)
|
|
241
|
+
console.log('data,cardInfo', this.data, this.cardInfo)
|
|
242
|
+
},
|
|
243
|
+
methods: {
|
|
244
|
+
business (btn) {
|
|
245
|
+
// // 处理按钮样式
|
|
246
|
+
// this.styleChange(btn.name)
|
|
247
|
+
// this.isBusiness = true
|
|
248
|
+
// this.$refs.route.init(btn.value.routeName, {row: this.data, cardData: this.cardInfo})
|
|
249
|
+
if (this.$refs.route.cards.length > 0) {
|
|
250
|
+
if (this.$refs.route.cards[0].title == '增值服务管理') {
|
|
251
|
+
this.$showMessage('切换页面后,当前页面数据会丢失,是否切换?', ['confirm', 'cancel']).then(res => {
|
|
252
|
+
if (res == 'cancel') {
|
|
253
|
+
|
|
254
|
+
} else {
|
|
255
|
+
// 处理按钮样式
|
|
256
|
+
this.styleChange(btn.name)
|
|
257
|
+
this.isBusiness = true
|
|
258
|
+
this.$refs.route.init(btn.value.routeName, {row: this.data, cardData: this.cardInfo})
|
|
259
|
+
}
|
|
260
|
+
})
|
|
261
|
+
} else {
|
|
262
|
+
// 处理按钮样式
|
|
263
|
+
this.styleChange(btn.name)
|
|
264
|
+
this.isBusiness = true
|
|
265
|
+
this.$refs.route.init(btn.value.routeName, {row: this.data, cardData: this.cardInfo})
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
styleChange (name) {
|
|
271
|
+
this.operBtns.forEach((res) => {
|
|
272
|
+
if (res.name === name) {
|
|
273
|
+
if (document.getElementById(res.name)) {
|
|
274
|
+
this.$dispatch('business-changed', res.name)
|
|
275
|
+
document.getElementById(res.name).style.backgroundColor = '#6aa6e2'
|
|
276
|
+
document.getElementById(res.name).style.color = 'white'
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
if (document.getElementById(res.name)) {
|
|
280
|
+
document.getElementById(res.name).style.backgroundColor = 'white'
|
|
281
|
+
document.getElementById(res.name).style.color = 'black'
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
watch: {
|
|
288
|
+
'data' () {
|
|
289
|
+
getBtnsGen(this)
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
events: {
|
|
293
|
+
'no-button' () {
|
|
294
|
+
this.noButton = true
|
|
295
|
+
},
|
|
296
|
+
'has-button' () {
|
|
297
|
+
this.noButton = false
|
|
298
|
+
},
|
|
299
|
+
'get-new-row' (row) {
|
|
300
|
+
console.log('xxxxxx', row)
|
|
301
|
+
// 发生换表成功
|
|
302
|
+
getNewmetermsg(this, row)
|
|
303
|
+
},
|
|
304
|
+
'toroute' (buttonObj, data) {
|
|
305
|
+
console.log('指定按钮。。', buttonObj)
|
|
306
|
+
this.$resetpost('api/af-revenue/sql/sale_getUser', {
|
|
307
|
+
data: {condition: `i.f_userinfo_code='${data.f_userinfo_code}' and u.f_filialeid = '${data.f_filialeid}'`, orderitem: `f_userinfo_id Desc`}
|
|
308
|
+
}, {resolveMsg: null, rejectMsg: '获取用户信息失败'}).then((res) => {
|
|
309
|
+
if (buttonObj) {
|
|
310
|
+
this.$dispatch('resflushdata', res.data[0])
|
|
311
|
+
this.styleChange(buttonObj.name)
|
|
312
|
+
this.$refs.route.init(buttonObj.value, {row: res.data[0]})
|
|
313
|
+
}
|
|
314
|
+
})
|
|
315
|
+
},
|
|
316
|
+
'button-specifies' (buttonObj, data) {
|
|
317
|
+
console.log('指定按钮。。', buttonObj)
|
|
318
|
+
// buttonObj 格式: {name:'机表收费', value: 'machine-meter-center'}
|
|
319
|
+
if (buttonObj) {
|
|
320
|
+
this.styleChange(buttonObj.name)
|
|
321
|
+
this.$refs.route.init(buttonObj.value, {row: data})
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
</script>
|
|
327
|
+
|
|
328
|
+
<style scoped>
|
|
329
|
+
|
|
330
|
+
.btn-click {
|
|
331
|
+
background-color: #6aa6e2;
|
|
332
|
+
border-radius: 5px;
|
|
333
|
+
color: white;
|
|
334
|
+
/*border-color: black;*/
|
|
335
|
+
border: solid 1px #c7c7c7;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.btn-un-click {
|
|
339
|
+
background-color: white;
|
|
340
|
+
border-radius: 5px;
|
|
341
|
+
color: black;
|
|
342
|
+
/*border-color: black;*/
|
|
343
|
+
border: solid 1px #c7c7c7;
|
|
344
|
+
}
|
|
345
|
+
</style>
|
|
@@ -9,4 +9,6 @@ export default function () {
|
|
|
9
9
|
Vue.component('high-meter', (resolve) => { require(['../../components/UserFiles/HighMeterCard.vue'], resolve) })
|
|
10
10
|
// 换表
|
|
11
11
|
Vue.component('change-meter', (resolve) => { require(['./ChangeMeter'], resolve) })
|
|
12
|
+
Vue.component('charge-oper', (resolve) => { require(['./ChargeOper'], resolve) })
|
|
13
|
+
Vue.component('charge-manage', (resolve) => { require(['./ChargeManage'], resolve) })
|
|
12
14
|
}
|
package/src/main.js
CHANGED
|
@@ -2,7 +2,7 @@ import Vue from 'vue'
|
|
|
2
2
|
import all from 'vue-client/src/all'
|
|
3
3
|
import App from './App'
|
|
4
4
|
import system from 'system-clients/src/system'
|
|
5
|
-
import FilialeSale from './filiale/
|
|
5
|
+
import FilialeSale from './filiale/meihekou/sale'
|
|
6
6
|
import sale from './sale'
|
|
7
7
|
import address from 'address-client/src/address'
|
|
8
8
|
import ldap from 'ldap-clients/src/ldap'
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
// 保留原始的 http 函数定义
|
|
4
|
+
function http() {
|
|
5
|
+
'use strict'
|
|
6
|
+
|
|
7
|
+
// 确保 window.jQuery 存在
|
|
8
|
+
if (!window.jQuery) {
|
|
9
|
+
throw new Error('QXClient requires jQuery to be available globally.')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const _a = window.jQuery;
|
|
13
|
+
const ajax = _a.ajax;
|
|
14
|
+
const extend = _a.extend // const support = _a.support (support 通常不需要直接访问)
|
|
15
|
+
const DEFAULT = {
|
|
16
|
+
port: '38088',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// 保留原始的 send 函数
|
|
20
|
+
function send(options) {
|
|
21
|
+
const biz = options.biz;
|
|
22
|
+
const data = options.data;
|
|
23
|
+
const successCallback = options.successCallback;
|
|
24
|
+
const errorCallback = options.errorCallback;
|
|
25
|
+
const port = options.port;
|
|
26
|
+
const method = options.method;
|
|
27
|
+
const dataType = options.dataType
|
|
28
|
+
const url = 'http://127.0.0.1:'.concat(port !== null && port !== void 0 ? port : DEFAULT.port, '/').concat(biz)
|
|
29
|
+
console.log('QXClient sending:', options)
|
|
30
|
+
const config = {
|
|
31
|
+
url: url,
|
|
32
|
+
data: JSON.stringify(data),
|
|
33
|
+
type: method !== null && method !== void 0 ? method : 'POST',
|
|
34
|
+
dataType: dataType !== null && dataType !== void 0 ? dataType : 'json',
|
|
35
|
+
}
|
|
36
|
+
if (typeof successCallback === 'function') {
|
|
37
|
+
config.success = function (res) {
|
|
38
|
+
// 保持原始的成功/失败判断逻辑
|
|
39
|
+
if (res && +res.code === 0) { // 添加 res 存在的检查
|
|
40
|
+
successCallback(res)
|
|
41
|
+
} else {
|
|
42
|
+
// 如果有错误回调,调用错误回调,否则可以考虑在控制台打印错误
|
|
43
|
+
if (typeof errorCallback === 'function') {
|
|
44
|
+
errorCallback(res)
|
|
45
|
+
} else {
|
|
46
|
+
console.error('QXClient Request Business Failed:', res)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// 确保错误回调总是被设置,以便捕获网络错误等
|
|
52
|
+
if (typeof errorCallback === 'function') {
|
|
53
|
+
config.error = errorCallback
|
|
54
|
+
} else {
|
|
55
|
+
// 提供一个默认的错误处理
|
|
56
|
+
config.error = function (jqXHR, textStatus, errorThrown) {
|
|
57
|
+
console.error('QXClient AJAX Error:', textStatus, errorThrown, jqXHR)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
ajax(config)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 返回包含所有方法的对象
|
|
64
|
+
return {
|
|
65
|
+
/**
|
|
66
|
+
* @description 打开屏幕监控,通过成功回调的 imgSrc 设置 img 标签的 src 参数
|
|
67
|
+
* @param {Object} options 选项参数
|
|
68
|
+
* @param {(data:{imgSrc:string}) => void} [options.successCallback] 成功回调
|
|
69
|
+
* @param {(data) => void} [options.errorCallback] 失败回调 (虽然此方法同步,但保持一致性)
|
|
70
|
+
*/
|
|
71
|
+
monitorDevice: function monitorDevice(options = {}) {
|
|
72
|
+
try {
|
|
73
|
+
const imgSrc = 'http://127.0.0.1:38089/sign=stream&time=' + new Date().getTime()
|
|
74
|
+
if (typeof options.successCallback === 'function') {
|
|
75
|
+
options.successCallback({imgSrc: imgSrc})
|
|
76
|
+
} else {
|
|
77
|
+
console.log('Monitor device URL:', imgSrc)
|
|
78
|
+
}
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error('Error in monitorDevice:', error)
|
|
81
|
+
if (typeof options.errorCallback === 'function') {
|
|
82
|
+
options.errorCallback(error)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
stopMonitor: function stopMonitor(options = {}) {
|
|
87
|
+
const biz = 'closewebontablet'
|
|
88
|
+
// 使用 extend 合并对象
|
|
89
|
+
send(extend({biz: biz, port: '38089'}, options))
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* @description 打开签字窗口
|
|
93
|
+
* @param {Object} options 入参
|
|
94
|
+
* @param {Object} options.data 签字数据 { pos: { top, left, width, height } }
|
|
95
|
+
* @param {(data:{image:string}) => void} options.successCallback 成功回调
|
|
96
|
+
*/
|
|
97
|
+
openSign: function openSign(options = {}) {
|
|
98
|
+
const biz = 'sign=start'
|
|
99
|
+
send(extend({biz: biz}, options))
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* @description 关闭签字窗口
|
|
103
|
+
* @param {(data)=>void} [options.successCallback] 成功回调
|
|
104
|
+
*/
|
|
105
|
+
stopSign: function stopSign(options = {}) {
|
|
106
|
+
const biz = 'sign=stop'
|
|
107
|
+
send(extend({biz: biz}, options))
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* @description 打开指纹窗口, 持续返回指纹图像base64编码
|
|
111
|
+
* @param {object} options 入参
|
|
112
|
+
* @param {(data:{FigPic:string}) => void} options.successCallback 成功回调
|
|
113
|
+
*/
|
|
114
|
+
openFinger: function openFinger(options = {}) {
|
|
115
|
+
const biz = 'finger=record'
|
|
116
|
+
send(extend({biz: biz}, options))
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* @description 取消指纹采集
|
|
120
|
+
*/
|
|
121
|
+
stopFinger: function stopFinger(options = {}) {
|
|
122
|
+
const biz = 'finger=stop'
|
|
123
|
+
send(extend({biz: biz}, options))
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* @description 指纹比对
|
|
127
|
+
*/
|
|
128
|
+
compareFinger: function compareFinger(options = {}) {
|
|
129
|
+
const biz = 'finger=compare'
|
|
130
|
+
send(extend({biz: biz}, options))
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* @description 获取摄像头信息
|
|
134
|
+
* @param {Object} options 入参
|
|
135
|
+
* @param {(data: { camera:Array<{ name:string, index:number, resolution:Array<{width:number, height:number}>}> }) =>void } options.successCallback 成功回调
|
|
136
|
+
*/
|
|
137
|
+
getCamera: function getCamera(options = {}) {
|
|
138
|
+
const biz = 'camera=get'
|
|
139
|
+
send(extend({biz: biz}, options))
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* @param {object} options 根据获取的摄像头信息,传入摄像头编号以及分辨率
|
|
143
|
+
* @param {object} options.data { index: number, width?: number, height?: number }
|
|
144
|
+
* @param {(data:{imgSrc:string}) => void} options.successCallback 成功回调, imgSrc直接用于 img 标签的 src 属性持续提供图片流
|
|
145
|
+
*/
|
|
146
|
+
openCamera: function openCamera(options = {}) {
|
|
147
|
+
try {
|
|
148
|
+
const {data = {}} = options
|
|
149
|
+
const biz = 'camera=stream'
|
|
150
|
+
let imgSrc = 'http://127.0.0.1:'.concat(DEFAULT.port, '/').concat(biz, '&index=').concat(data.index)
|
|
151
|
+
if (data.width) {
|
|
152
|
+
imgSrc += '&width='.concat(data.width)
|
|
153
|
+
}
|
|
154
|
+
if (data.height) {
|
|
155
|
+
imgSrc += '&height='.concat(data.height)
|
|
156
|
+
}
|
|
157
|
+
// 先尝试关闭之前的摄像头 (调用实例上的方法)
|
|
158
|
+
this.closeCamera({data: {index: data.index}}); // 使用 this 调用实例方法
|
|
159
|
+
// 直接调用成功回调
|
|
160
|
+
if (typeof options.successCallback === 'function') {
|
|
161
|
+
options.successCallback({imgSrc: imgSrc})
|
|
162
|
+
} else {
|
|
163
|
+
console.log('Camera stream URL:', imgSrc)
|
|
164
|
+
}
|
|
165
|
+
} catch (error) {
|
|
166
|
+
console.error('Error in openCamera:', error)
|
|
167
|
+
if (typeof options.errorCallback === 'function') {
|
|
168
|
+
options.errorCallback(error)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* @description 传入已打开的摄像头编号,获取拍照图片
|
|
174
|
+
* @param {Object} options 入参
|
|
175
|
+
* @param {object} options.data { index: number } 摄像头编号
|
|
176
|
+
* @param {(data:{picture: string, imgSrc: string}) => void} options.successCallback 成功回调
|
|
177
|
+
*/
|
|
178
|
+
takePhoto: function takePhoto(options = {}) {
|
|
179
|
+
const {data = {}} = options
|
|
180
|
+
const biz = 'camera=photo'
|
|
181
|
+
// 构造 URL,注意 index 是 query 参数
|
|
182
|
+
const url = 'http://127.0.0.1:'.concat(DEFAULT.port, '/').concat(biz, '&index=').concat(data.index)
|
|
183
|
+
const originalSuccess = options.successCallback
|
|
184
|
+
|
|
185
|
+
// 修改 options 传递给 send
|
|
186
|
+
const sendOptions = extend({}, options, {
|
|
187
|
+
// 传递完整的 URL 作为 biz,并指定 method 为 GET
|
|
188
|
+
biz: url,
|
|
189
|
+
method: 'GET',
|
|
190
|
+
data: undefined, // GET 请求不应有 body data
|
|
191
|
+
successCallback: function (res) {
|
|
192
|
+
// 添加图片 base64 前缀
|
|
193
|
+
if (res && res.picture) {
|
|
194
|
+
res.imgSrc = 'data:image/jpeg;base64,' + res.picture
|
|
195
|
+
}
|
|
196
|
+
// 调用原始的成功回调
|
|
197
|
+
if (typeof originalSuccess === 'function') {
|
|
198
|
+
originalSuccess(res)
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
// 原始回调已在 successCallback 中处理,无需再次传递
|
|
202
|
+
// successCallback: undefined // 可以保留以覆盖,或直接不传
|
|
203
|
+
})
|
|
204
|
+
console.log('QXClient takePhoto sending GET:', sendOptions.biz)
|
|
205
|
+
ajax({
|
|
206
|
+
url: sendOptions.biz,
|
|
207
|
+
type: 'GET',
|
|
208
|
+
dataType: sendOptions.dataType || 'json',
|
|
209
|
+
success: sendOptions.successCallback,
|
|
210
|
+
error: sendOptions.errorCallback || function (jqXHR, textStatus, errorThrown) {
|
|
211
|
+
console.error('QXClient AJAX Error (takePhoto):', textStatus, errorThrown, jqXHR)
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
// send(sendOptions) // 暂时注释掉,因为 send 可能不支持 GET
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* @description 传入已打开的摄像头编号,关闭摄像头
|
|
218
|
+
* @param {Object} options 参数
|
|
219
|
+
* @param {object} options.data { index: number } 摄像头编号
|
|
220
|
+
*/
|
|
221
|
+
closeCamera: function closeCamera(options = {}) {
|
|
222
|
+
const biz = 'camera=close'
|
|
223
|
+
send(extend({biz: biz}, options))
|
|
224
|
+
},
|
|
225
|
+
/**
|
|
226
|
+
* @description 开始人证比对,返回照片base64和摄像头实时图像base64
|
|
227
|
+
*/
|
|
228
|
+
openFaceVerify: function openFaceVerify(options = {}) {
|
|
229
|
+
const biz = 'method=startPersonVerify'
|
|
230
|
+
send(extend({biz: biz}, options))
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* @description 取消人证比对
|
|
234
|
+
*/
|
|
235
|
+
stopFaceVerify: function stopFaceVerify(options = {}) {
|
|
236
|
+
const biz = 'method=cancelPersonVerify'
|
|
237
|
+
send(extend({biz: biz}, options))
|
|
238
|
+
},
|
|
239
|
+
/**
|
|
240
|
+
* @description 读取身份证
|
|
241
|
+
* @param {(data:{ retData: any, imgSrc: string }) => void} options.successCallback 成功回调
|
|
242
|
+
*/
|
|
243
|
+
openReadIDCard: function openReadIDCard(options = {}) {
|
|
244
|
+
const biz = 'method=startReadChinaIdCard'
|
|
245
|
+
const originalSuccess = options.successCallback
|
|
246
|
+
const sendOptions = extend({}, options, {
|
|
247
|
+
biz: biz,
|
|
248
|
+
successCallback: function (res) {
|
|
249
|
+
if (res && res.retData && res.retData.pic) {
|
|
250
|
+
res.imgSrc = 'data:image/jpeg;base64,' + res.retData.pic
|
|
251
|
+
}
|
|
252
|
+
if (typeof originalSuccess === 'function') {
|
|
253
|
+
originalSuccess(res)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
send(sendOptions)
|
|
258
|
+
},
|
|
259
|
+
/**
|
|
260
|
+
* @description 取消读取身份证
|
|
261
|
+
*/
|
|
262
|
+
stopReadIDCard: function stopReadIDCard(options = {}) {
|
|
263
|
+
const biz = 'method=cancelReadChinaIdCard'
|
|
264
|
+
send(extend({biz: biz}, options))
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* @description 读取银行卡
|
|
268
|
+
*/
|
|
269
|
+
openReadBankCard: function openReadBankCard(options = {}) {
|
|
270
|
+
const biz = 'method=startReadBankCard'
|
|
271
|
+
send(extend({biz: biz}, options))
|
|
272
|
+
},
|
|
273
|
+
/**
|
|
274
|
+
* @description 服务评价
|
|
275
|
+
*/
|
|
276
|
+
evaluation: function evaluation(options = {}) {
|
|
277
|
+
const biz = 'evaluation'
|
|
278
|
+
send(extend({biz: biz}, options))
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
* @description 开始签名
|
|
282
|
+
* @param {Object} options 参数
|
|
283
|
+
* @param {string} options.data.pdfdata pdf文件base64编码 签名内容
|
|
284
|
+
*/
|
|
285
|
+
openPDFSign: function openPDFSign(options = {}) {
|
|
286
|
+
// 保持原始逻辑,对 data 进行 stringify
|
|
287
|
+
const sendOptions = extend({}, options, {
|
|
288
|
+
// 确保只有在 options.data 存在时才 stringify
|
|
289
|
+
data: options.data ? JSON.stringify(options.data) : undefined,
|
|
290
|
+
biz: 'pdfsign=start'
|
|
291
|
+
})
|
|
292
|
+
send(sendOptions)
|
|
293
|
+
},
|
|
294
|
+
stopPDFSign: function stopPDFSign(options = {}) {
|
|
295
|
+
const biz = 'pdfsign=stop'
|
|
296
|
+
send(extend({biz: biz}, options))
|
|
297
|
+
},
|
|
298
|
+
/**
|
|
299
|
+
* @description 打开网页
|
|
300
|
+
* @param {Object} options 参数
|
|
301
|
+
* @param {string} options.data.url 要打开的网页地址
|
|
302
|
+
*/
|
|
303
|
+
openwebontablet: function openwebontablet(options = {}) {
|
|
304
|
+
const biz = 'openwebontablet'
|
|
305
|
+
// 使用 extend 合并
|
|
306
|
+
send(extend({biz: biz}, options))
|
|
307
|
+
},
|
|
308
|
+
/**
|
|
309
|
+
* @description 关闭网页
|
|
310
|
+
*/
|
|
311
|
+
closewebontablet: function closewebontablet(options = {}) {
|
|
312
|
+
const biz = 'sign=closebrowser'
|
|
313
|
+
send(extend({biz: biz}, options))
|
|
314
|
+
},
|
|
315
|
+
/**
|
|
316
|
+
* 打开密码键盘
|
|
317
|
+
*/
|
|
318
|
+
openKB: function openKB(options = {}) {
|
|
319
|
+
const biz = 'kb=open'
|
|
320
|
+
send(extend({biz: biz}, options))
|
|
321
|
+
},
|
|
322
|
+
/**
|
|
323
|
+
* 关闭密码键盘
|
|
324
|
+
*/
|
|
325
|
+
closeKB: function closeKB(options = {}) {
|
|
326
|
+
const biz = 'kb=close'
|
|
327
|
+
send(extend({biz: biz}, options))
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// 创建实例并导出
|
|
333
|
+
const QXClient = http();
|
|
334
|
+
|
|
335
|
+
export default QXClient;
|