sale-client 3.7.2 → 3.7.4

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.
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sale-client",
3
- "version": "3.7.2",
3
+ "version": "3.7.4",
4
4
  "description": "收费模块前台组件",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,14 +1,5 @@
1
1
  <template>
2
2
  <div class="evaluation-panel">
3
- <!-- <div class="response" v-if="response">-->
4
- <!-- <h4>响应结果:</h4>-->
5
- <!-- <pre>{{ response }}</pre>-->
6
- <!-- </div>-->
7
-
8
- <!-- <div class="error" v-if="error">-->
9
- <!-- <h4>错误信息:</h4>-->
10
- <!-- <pre>{{ error }}</pre>-->
11
- <!-- </div>-->
12
3
  <div class="status-bar">
13
4
  <div class="status-item">
14
5
  <span :class="['status-badge', deviceStatusClass]"></span>
@@ -31,15 +22,9 @@
31
22
  <p>{{ autoProcessMessage }}</p>
32
23
  </div>
33
24
  <div class="section">
34
- <!-- <button v-on:click="handleSignIn" v-bind:disabled="loading">登录评价器</button>-->
35
25
  <button v-on:click="handleEvaluate" v-bind:disabled="loading">发起评价</button>
36
- <!-- <button v-on:click="getEvaluationResult" v-bind:disabled="loading">获取结果</button>-->
37
26
  <button v-on:click="checkStatus" v-bind:disabled="loading">检查在线状态</button>
38
27
  <button v-on:click="getLoginInfo" v-bind:disabled="loading">检查登录状态</button>
39
- <!-- <button v-on:click="pauseService" v-bind:disabled="loading">暂停服务</button>-->
40
- <!-- <button v-on:click="playWelcome" v-bind:disabled="loading">播放欢迎词</button>-->
41
- <!-- <button v-on:click="playWaitTip" v-bind:disabled="loading">播放等待提醒</button>-->
42
- <!-- <button v-on:click="signOut" v-bind:disabled="loading">退出评价器</button>-->
43
28
  </div>
44
29
  </div>
45
30
  </template>
@@ -71,7 +56,10 @@ module.exports = {
71
56
  deviceCheckInterval: 10000,
72
57
  loginCheckTimer: null,
73
58
  loginCheckInterval: 1000,
74
- evaluationStatus: '未发起'
59
+ evaluationStatus: '未发起',
60
+ // 新增:组件销毁标志和请求跟踪
61
+ isComponentDestroyed: false,
62
+ pendingRequests: new Set()
75
63
  }
76
64
  },
77
65
  props: {
@@ -80,9 +68,11 @@ module.exports = {
80
68
  default: undefined
81
69
  }
82
70
  },
83
- destroyed () {
84
- this.stopDeviceStatusMonitoring()
85
- this.stopLoginStatusMonitoring()
71
+ beforeDestroy() {
72
+ this.cleanup();
73
+ },
74
+ destroyed() {
75
+ this.cleanup();
86
76
  },
87
77
  async ready() {
88
78
  console.log('row', this.row)
@@ -90,23 +80,54 @@ module.exports = {
90
80
  this.startDeviceStatusMonitoring()
91
81
  },
92
82
  methods: {
83
+ // 新增:统一的清理方法
84
+ cleanup() {
85
+ console.log('开始清理组件资源');
86
+ this.isComponentDestroyed = true;
87
+
88
+ // 清理所有定时器
89
+ this.stopDeviceStatusMonitoring();
90
+ this.stopLoginStatusMonitoring();
91
+
92
+ // 取消所有进行中的请求
93
+ this.pendingRequests.clear();
94
+
95
+ // 重置状态
96
+ this.loading = false;
97
+ },
98
+
99
+ // 新增:安全执行方法,检查组件状态
100
+ safeExecute(callback) {
101
+ if (this.isComponentDestroyed) {
102
+ console.log('组件已销毁,停止执行');
103
+ return false;
104
+ }
105
+ return true;
106
+ },
107
+
93
108
  async initSystem () {
94
- // 1. 检查设备状态
109
+ if (!this.safeExecute()) return;
110
+
95
111
  console.log('检查设备状态')
96
112
  await this.checkStatus()
97
- // 2. 如果设备在线,检查登录状态
113
+ if (!this.safeExecute()) return;
114
+
98
115
  console.log('设备在线,检查登录状态')
99
116
  if (this.deviceOnline) {
100
117
  await this.getLoginInfo()
101
118
  }
102
- // 3. 如果设备在线但未登录,自动登录
119
+ if (!this.safeExecute()) return;
120
+
103
121
  if (this.deviceOnline && !this.userLogin) {
104
- console.log('备在线但未登录,自动登录')
122
+ console.log('设备在线但未登录,自动登录')
105
123
  await this.handleSignIn()
106
124
  }
107
125
  },
126
+
108
127
  // 提交评价
109
128
  async submitEvaluation(value) {
129
+ if (!this.safeExecute()) return;
130
+
110
131
  this.evaluationStatus = '未发起'
111
132
  console.log('用户评价值:', value)
112
133
  let req = await this.$resetpost('api/af-revenue/logic/saveEvaluationBussiness', {
@@ -118,14 +139,23 @@ module.exports = {
118
139
  }, {resolveMsg: '提交评价成功', rejectMsg: '提交评价失败!'})
119
140
  this.$dispatch('success', '评价')
120
141
  },
142
+
121
143
  handleSignIn () {
144
+ if (!this.safeExecute()) return;
145
+
122
146
  let self = this;
123
147
  self.loading = true;
124
148
  self.error = null;
125
149
  self.response = null;
150
+
151
+ const requestId = 'signIn_' + Date.now();
152
+ this.pendingRequests.add(requestId);
153
+
126
154
  return co(
127
155
  this.$CEVEvaluator.signIn(this.signInParams)
128
156
  .then(function(result) {
157
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
158
+
129
159
  self.response = JSON.stringify(result.data, null, 2);
130
160
  console.log('登录result.data', result.data)
131
161
  if (result.data.code === '0' && result.data.text) {
@@ -135,23 +165,36 @@ module.exports = {
135
165
  }
136
166
  })
137
167
  .catch(function(err) {
168
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
169
+
138
170
  self.error = err.message || '签到失败';
139
171
  self.showCeAlert('签到失败: ' + (err.message || '未知错误'), 'error');
140
172
  })
141
173
  .finally(function() {
142
- self.loading = false;
174
+ self.pendingRequests.delete(requestId);
175
+ if (self.safeExecute()) {
176
+ self.loading = false;
177
+ }
143
178
  })
144
179
  )
145
180
  },
146
181
 
147
182
  handleEvaluate () {
183
+ if (!this.safeExecute()) return;
184
+
148
185
  let self = this;
149
186
  self.loading = true;
150
187
  self.error = null;
151
188
  self.response = null;
152
189
  self.evaluationStatus = '等待用户评价'
190
+
191
+ const requestId = 'evaluate_' + Date.now();
192
+ this.pendingRequests.add(requestId);
193
+
153
194
  this.$CEVEvaluator.startEvaluateDirect()
154
195
  .then(async function (result) {
196
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
197
+
155
198
  self.response = JSON.stringify(result.data, null, 2);
156
199
  if (result.data.code === '0') {
157
200
  console.log('result.data.data', result.data.data)
@@ -160,27 +203,45 @@ module.exports = {
160
203
  if (res !== 'confirm') return
161
204
  self.submitEvaluation(result.data.data)
162
205
  }
163
- //self.showCeAlert('', 'success');
164
206
  })
165
207
  .catch(function(err) {
208
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
209
+
166
210
  self.error = err.message || '评价启动失败';
167
211
  self.showCeAlert('用户评价失败: ' + (err.message || '未知错误'), 'error');
168
212
  self.evaluationStatus = '未发起'
169
213
  })
170
214
  .finally(function() {
171
- self.loading = false;
215
+ self.pendingRequests.delete(requestId);
216
+ if (self.safeExecute()) {
217
+ self.loading = false;
218
+ }
172
219
  });
173
220
  },
221
+
174
222
  // 启动设备状态定时监测
175
223
  startDeviceStatusMonitoring() {
224
+ if (!this.safeExecute()) return;
225
+
226
+ // 先停止可能存在的旧定时器
227
+ this.stopDeviceStatusMonitoring();
228
+
176
229
  this.deviceCheckTimer = setInterval(async () => {
230
+ if (!this.safeExecute()) {
231
+ this.stopDeviceStatusMonitoring();
232
+ return;
233
+ }
234
+
177
235
  await this.checkStatus();
178
- // 如果设备状态变化,更新登录状态
236
+ if (!this.safeExecute()) return;
237
+
179
238
  if (this.deviceOnline) {
180
239
  await this.getLoginInfo();
181
240
  }
241
+ if (!this.safeExecute()) return;
242
+
182
243
  if (this.deviceOnline && !this.userLogin) {
183
- console.log('备在线但未登录,自动登录')
244
+ console.log('设备在线但未登录,自动登录')
184
245
  await this.handleSignIn()
185
246
  }
186
247
  }, this.deviceCheckInterval);
@@ -193,15 +254,26 @@ module.exports = {
193
254
  this.deviceCheckTimer = null;
194
255
  }
195
256
  },
257
+
196
258
  // 启动登录定时监测
197
259
  startLoginStatusMonitoring() {
260
+ if (!this.safeExecute()) return;
261
+
262
+ this.stopLoginStatusMonitoring();
263
+
198
264
  this.loginCheckTimer = setInterval(async () => {
199
- let self = this
265
+ if (!this.safeExecute()) {
266
+ this.stopLoginStatusMonitoring();
267
+ return;
268
+ }
269
+
270
+ let self = this;
200
271
  try {
201
272
  const result = await this.$CEVEvaluator.getProgress();
273
+ if (!self.safeExecute()) return;
274
+
202
275
  console.log('progress', result.data)
203
276
  if (result.data.code === '0') {
204
- // 如果进度达到100%,停止检测
205
277
  if (result.data.progress >= 100) {
206
278
  self.stopLoginStatusMonitoring();
207
279
  self.loginIng = false
@@ -209,6 +281,7 @@ module.exports = {
209
281
  }
210
282
  }
211
283
  } catch (error) {
284
+ if (!self.safeExecute()) return;
212
285
  console.error('评价进度检测失败:', error);
213
286
  }
214
287
  }, this.loginCheckInterval);
@@ -221,79 +294,62 @@ module.exports = {
221
294
  this.loginCheckTimer = null;
222
295
  }
223
296
  },
224
- getEvaluationResult () {
225
- let self = this;
226
- self.loading = true;
227
- self.error = null;
228
-
229
- this.$CEVEvaluator.getEvaluateResult()
230
- .then(function(result) {
231
- self.response = JSON.stringify(result.data, null, 2);
232
- })
233
- .catch(function(err) {
234
- self.error = err.message || '获取评价结果失败';
235
- self.showCeAlert('获取评价结果失败', 'error');
236
- })
237
- .finally(function() {
238
- self.loading = false;
239
- });
240
- },
241
297
 
242
298
  checkStatus () {
299
+ if (!this.safeExecute()) return;
300
+
243
301
  let self = this;
244
302
  self.loading = true;
245
303
  self.error = null;
246
304
  self.response = null;
305
+
306
+ const requestId = 'checkStatus_' + Date.now();
307
+ this.pendingRequests.add(requestId);
308
+
247
309
  return co(
248
310
  this.$CEVEvaluator.checkOnline()
249
311
  .then(function(result) {
312
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
313
+
250
314
  self.response = JSON.stringify(result.data, null, 2);
251
315
  if (result.data.code === '0' && result.data.online === '1') {
252
316
  self.deviceOnline = true
253
- //self.showCeAlert('状态检查完成', 'success');
254
317
  } else {
255
318
  self.deviceOnline = false
256
319
  self.showCeAlert('状态检查完成', 'success');
257
320
  }
258
-
259
321
  })
260
322
  .catch(function(err) {
323
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
324
+
261
325
  self.error = err.message || '状态检查失败';
262
326
  self.showCeAlert('状态检查失败', 'error');
263
327
  })
264
328
  .finally(function() {
265
- self.loading = false;
329
+ self.pendingRequests.delete(requestId);
330
+ if (self.safeExecute()) {
331
+ self.loading = false;
332
+ }
266
333
  })
267
334
  )
268
335
  },
269
336
 
270
- getVersionInfo () {
337
+ getLoginInfo () {
338
+ if (!this.safeExecute()) return;
339
+
271
340
  let self = this;
272
341
  self.loading = true;
273
342
  self.error = null;
274
343
  self.response = null;
275
344
 
276
- this.$CEVEvaluator.getVersion()
277
- .then(function(result) {
278
- self.response = JSON.stringify(result.data, null, 2);
279
- })
280
- .catch(function(err) {
281
- self.error = err.message || '获取版本信息失败';
282
- self.showCeAlert('获取版本信息失败', 'error');
283
- })
284
- .finally(function() {
285
- self.loading = false;
286
- });
287
- },
345
+ const requestId = 'getLoginInfo_' + Date.now();
346
+ this.pendingRequests.add(requestId);
288
347
 
289
- getLoginInfo () {
290
- let self = this;
291
- self.loading = true;
292
- self.error = null;
293
- self.response = null;
294
348
  return co(
295
349
  this.$CEVEvaluator.getLoginInfo()
296
350
  .then(async function (result) {
351
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
352
+
297
353
  self.response = JSON.stringify(result.data, null, 2);
298
354
  console.log('result.data', result.data)
299
355
  if (result.data.code === '0' && result.data.info.name) {
@@ -303,105 +359,62 @@ module.exports = {
303
359
  } else {
304
360
  await self.signOut()
305
361
  }
306
- //self.showCeAlert('当前用户已登录评价器', 'success');
307
362
  } else {
308
363
  self.userLogin = false
309
364
  self.showCeAlert('当前用户未登录评价器', 'error');
310
365
  }
311
366
  })
312
367
  .catch(function(err) {
368
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
369
+
313
370
  self.error = err.message || '获取登录信息失败';
314
371
  self.showCeAlert('获取登录信息失败', 'error');
315
372
  })
316
373
  .finally(function() {
317
- self.loading = false;
374
+ self.pendingRequests.delete(requestId);
375
+ if (self.safeExecute()) {
376
+ self.loading = false;
377
+ }
318
378
  })
319
379
  )
320
380
  },
321
381
 
322
- pauseService () {
323
- let self = this;
324
- self.loading = true;
325
- self.error = null;
326
- self.response = null;
327
-
328
- this.$CEVEvaluator.pauseService()
329
- .then(function(result) {
330
- self.response = JSON.stringify(result.data, null, 2);
331
- self.showCeAlert('暂停服务成功', 'success');
332
- })
333
- .catch(function(err) {
334
- self.error = err.message || '暂停服务失败';
335
- self.showCeAlert('暂停服务失败', 'error');
336
- })
337
- .finally(function() {
338
- self.loading = false;
339
- });
340
- },
341
-
342
- playWelcome () {
343
- let self = this;
344
- self.loading = true;
345
- self.error = null;
346
- self.response = null;
347
-
348
- this.$CEVEvaluator.playWelcome()
349
- .then(function(result) {
350
- self.response = JSON.stringify(result.data, null, 2);
351
- self.showCeAlert('播放欢迎词成功', 'success');
352
- })
353
- .catch(function(err) {
354
- self.error = err.message || '播放欢迎词失败';
355
- self.showCeAlert('播放欢迎词失败', 'error');
356
- })
357
- .finally(function() {
358
- self.loading = false;
359
- });
360
- },
382
+ signOut () {
383
+ if (!this.safeExecute()) return;
361
384
 
362
- playWaitTip () {
363
385
  let self = this;
364
386
  self.loading = true;
365
387
  self.error = null;
366
388
  self.response = null;
367
389
 
368
- this.$CEVEvaluator.playWaitTip()
369
- .then(function(result) {
370
- self.response = JSON.stringify(result.data, null, 2);
371
- self.showCeAlert('播放等待提醒成功', 'success');
372
- })
373
- .catch(function(err) {
374
- self.error = err.message || '播放等待提醒失败';
375
- self.showCeAlert('播放等待提醒失败', 'error');
376
- })
377
- .finally(function() {
378
- self.loading = false;
379
- });
380
- },
381
-
382
- signOut () {
383
- let self = this;
384
- self.loading = true;
385
- self.error = null;
386
- self.response = null;
390
+ const requestId = 'signOut_' + Date.now();
391
+ this.pendingRequests.add(requestId);
387
392
 
388
393
  return co(
389
394
  this.$CEVEvaluator.signOut()
390
395
  .then(function(result) {
396
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
397
+
391
398
  self.response = JSON.stringify(result.data, null, 2);
392
- //self.showCeAlert('签退成功', 'success');
393
399
  })
394
400
  .catch(function(err) {
401
+ if (!self.safeExecute() || !self.pendingRequests.has(requestId)) return;
402
+
395
403
  self.error = err.message || '签退失败';
396
404
  self.showCeAlert('签退失败', 'error');
397
405
  })
398
406
  .finally(function() {
399
- self.loading = false;
407
+ self.pendingRequests.delete(requestId);
408
+ if (self.safeExecute()) {
409
+ self.loading = false;
410
+ }
400
411
  })
401
412
  )
402
413
  },
403
414
 
404
415
  showCeAlert (message, type) {
416
+ if (!this.safeExecute()) return;
417
+
405
418
  if (type === 'error') {
406
419
  console.error(message);
407
420
  this.$showAlert(message, 'danger', 2000);
@@ -74,7 +74,7 @@ import { HttpResetClass } from 'vue-client'
74
74
  let getHiddenDangerGen = async function (self) {
75
75
  try {
76
76
  let http = new HttpResetClass()
77
- let condition = `f_userinfoid = ${self.data.f_userinfo_id} and f_is_repaired = '隐患未处理'`
77
+ let condition = `f_userinfoid = ${self.data.f_userinfo_id} and f_is_repaired in ('隐患未处理','用户自行整改','转维修')`
78
78
  let getHiddenDanger = await http.load('POST', 'rs/sql/defectDetails', {
79
79
  data: {
80
80
  condition: condition,
@@ -213,13 +213,13 @@
213
213
  }
214
214
  } else if (self.model.f_print[0] === '国税发票') {
215
215
  // TODO
216
- self.$dispatch('success')
216
+ self.$dispatch('success', '过户')
217
217
  } else if (self.model.f_print[0] === '电子发票') {
218
218
  // TODO
219
- self.$dispatch('success')
219
+ self.$dispatch('success', '过户')
220
220
  }
221
221
  } else {
222
- self.$dispatch('success')
222
+ self.$dispatch('success', '过户')
223
223
  }
224
224
  } catch (error) {
225
225
  self.$showAlert(error, 'danger', 0)
@@ -403,7 +403,7 @@
403
403
  this.billData.bill = val.bill
404
404
  },
405
405
  printok () {
406
- this.$dispatch('success')
406
+ this.$dispatch('success', '过户')
407
407
  },
408
408
 
409
409
  // 过户表及操作表信息
@@ -407,7 +407,7 @@
407
407
  this.print = true
408
408
  }
409
409
  } else {
410
- this.$dispatch('success')
410
+ this.$dispatch('success', '其他补气')
411
411
  }
412
412
  },
413
413
  pregas () {
@@ -481,7 +481,7 @@
481
481
  this.$dispatch('cancelclean', this.row)
482
482
  },
483
483
  printok () {
484
- this.$dispatch('success')
484
+ this.$dispatch('success', '其他补气')
485
485
  }
486
486
  },
487
487
  events: {
@@ -279,7 +279,7 @@
279
279
  },
280
280
  eticket_toggle () {
281
281
  this.eticket_show = false
282
- this.$dispatch('success')
282
+ this.$dispatch('success', '补卡')
283
283
  },
284
284
  confirm () {
285
285
  this.eticket_msg = false
@@ -385,7 +385,7 @@
385
385
  },
386
386
  printok () {
387
387
  // 收据打完,判断是否还有其他票据进行请求 TODO
388
- this.$dispatch('success')
388
+ this.$dispatch('success', '补卡')
389
389
  },
390
390
  fillcardChange (val) {
391
391
  if (val === 'IC卡丢失或损坏') {
@@ -563,7 +563,7 @@ export default {
563
563
  if (msg == 'confirm') {
564
564
  this.$dispatch('get-new-row', this.row)
565
565
  } else {
566
- this.$dispatch('success')
566
+ this.$dispatch('success', '换表')
567
567
  }
568
568
  },
569
569
  flowmetermodels (label) {
@@ -598,7 +598,7 @@ export default {
598
598
  if (msg == 'confirm') {
599
599
  this.$dispatch('get-new-row', this.row)
600
600
  } else {
601
- this.$dispatch('success')
601
+ this.$dispatch('success', '换表')
602
602
  }
603
603
  },
604
604
  flowmetermodels (label) {
@@ -209,6 +209,16 @@
209
209
  暂无图片
210
210
  </td>
211
211
  </tr>
212
+ <tr v-for="checkitem in model.safecheckitem">
213
+ <td style="text-align: center;border: #E9E9E9 solid 1px;width: 33%" >处理后图片</td>
214
+ <td style="text-align: center;border: #E9E9E9 solid 1px;width: 66%" colspan="2" v-if="checkitem.f_repair_path">
215
+ <img-self :src="'rs/image/file/'+checkitem.f_repair_path" width="150" height="150"></img-self>
216
+ </td>
217
+ <td style="text-align: center;border: #E9E9E9 solid 1px;width: 66%" colspan="2"
218
+ v-if="!checkitem.f_repair_path">
219
+ 暂无处理后图片
220
+ </td>
221
+ </tr>
212
222
  </table>
213
223
  <table class="table table-striped table-bordered" v-if="model.f_notified_path=='' && model.f_notified_path==null">
214
224
  <thead>
@@ -254,6 +254,14 @@ export default {
254
254
  this.$refs.oper.business({name: '评价', value: {routeName: 'service-evaluation'}})
255
255
  }
256
256
  },
257
+ hasEvaluatePermission (name) {
258
+ if (!this.$login.r || !Array.isArray(this.$login.r)) {
259
+ console.warn('权限列表不存在或不是数组')
260
+ return false
261
+ }
262
+ const permissionName = `${name}评价权限`
263
+ return this.$login.r.includes(permissionName)
264
+ }
257
265
  },
258
266
  events: {
259
267
  'error' (name, row, res) {
@@ -279,7 +287,7 @@ export default {
279
287
  this.serRow(row)
280
288
  return
281
289
  }
282
- if (name !== '评价' && this.reSearchShowBusiness) {
290
+ if (this.hasEvaluatePermission(name) && this.reSearchShowBusiness) {
283
291
  console.log('row', row)
284
292
  this.$refs.oper.noButton = false
285
293
  this.$showMessage('要进行业务评价吗?', ['confirm', 'cancel']).then((res) => {
@@ -238,7 +238,7 @@ export default {
238
238
  this.row.f_bill_style = '普通收据'
239
239
  this.print = true
240
240
  } else {
241
- this.$dispatch('success')
241
+ this.$dispatch('success', '卡表赠费')
242
242
  }
243
243
  })
244
244
  },
@@ -308,7 +308,7 @@ export default {
308
308
  this.$dispatch('cancelclean', this.row)
309
309
  },
310
310
  printok () {
311
- this.$dispatch('success')
311
+ this.$dispatch('success', '卡表赠费')
312
312
  }
313
313
  },
314
314
  computed: {
@@ -219,7 +219,7 @@ export default {
219
219
  })
220
220
  },
221
221
  printok () {
222
- this.$dispatch('success')
222
+ this.$dispatch('success', '物联网赠费')
223
223
  },
224
224
  clean () {
225
225
  this.$dispatch('refresh')
@@ -0,0 +1,582 @@
1
+ <template>
2
+ <div class="evaluation-panel">
3
+ <!-- <div class="response" v-if="response">-->
4
+ <!-- <h4>响应结果:</h4>-->
5
+ <!-- <pre>{{ response }}</pre>-->
6
+ <!-- </div>-->
7
+
8
+ <!-- <div class="error" v-if="error">-->
9
+ <!-- <h4>错误信息:</h4>-->
10
+ <!-- <pre>{{ error }}</pre>-->
11
+ <!-- </div>-->
12
+ <div class="status-bar">
13
+ <div class="status-item" >
14
+ <span :class="['status-badge', deviceStatusClass]" v-if="isScanDevice"></span>
15
+ <span>设备状态: {{ deviceStatusText }}</span>
16
+ </div>
17
+ <div class="status-item">
18
+ <span :class="['status-badge', loginStatusClass]"></span>
19
+ <span>登录状态: {{ loginStatusText }}</span>
20
+ </div>
21
+ <div class="status-item">
22
+ <i class="fas fa-user"></i>
23
+ <span>用户: {{ signInParams.name }} (工号: {{ signInParams.num }})</span>
24
+ </div>
25
+ <div class="status-item">
26
+ <span>评价状态: {{ evaluationStatus }}</span>
27
+ </div>
28
+ </div>
29
+ <div class="auto-process" v-if="autoProcessMessage && isScanDevice">
30
+ <h4>评价器状态</h4>
31
+ <p>{{ autoProcessMessage }}</p>
32
+ </div>
33
+ <div class="section">
34
+ <!-- <button v-on:click="handleSignIn" v-bind:disabled="loading">登录评价器</button>-->
35
+ <button v-on:click="handleEvaluate" v-bind:disabled="loading">发起评价</button>
36
+ <!-- <button v-on:click="getEvaluationResult" v-bind:disabled="loading">获取结果</button>-->
37
+ <button v-on:click="checkStatus" v-bind:disabled="loading">检查在线状态</button>
38
+ <button v-on:click="getLoginInfo" v-bind:disabled="loading">检查登录状态</button>
39
+ <!-- <button v-on:click="pauseService" v-bind:disabled="loading">暂停服务</button>-->
40
+ <!-- <button v-on:click="playWelcome" v-bind:disabled="loading">播放欢迎词</button>-->
41
+ <!-- <button v-on:click="playWaitTip" v-bind:disabled="loading">播放等待提醒</button>-->
42
+ <!-- <button v-on:click="signOut" v-bind:disabled="loading">退出评价器</button>-->
43
+ </div>
44
+ </div>
45
+ </template>
46
+
47
+ <script>
48
+ import co from "co";
49
+
50
+ module.exports = {
51
+ title: 'EvaluationPanel',
52
+ data () {
53
+ return {
54
+ signInParams: {
55
+ num: this.$login.f.id,
56
+ name: this.$login.f.name,
57
+ pos: this.$login.f.f_show_rolestr,
58
+ org: this.$login.f.f_show_department_name,
59
+ equ: this.$login.f.f_show_department_name,
60
+ star: '5',
61
+ inf: `工号:${this.$login.f.id}`,
62
+ photo: '127.0.0.1:8068/photo.jpg'
63
+ },
64
+ loading: false,
65
+ response: null,
66
+ error: null,
67
+ userLogin: false,
68
+ loginIng: false,
69
+ deviceOnline: false,
70
+ deviceCheckTimer: null,
71
+ deviceCheckInterval: 10000,
72
+ loginCheckTimer: null,
73
+ loginCheckInterval: 1000,
74
+ evaluationStatus: '未发起',
75
+ // 是否扫描设备
76
+ isScanDevice: false
77
+
78
+ }
79
+ },
80
+ props: {
81
+ row: {
82
+ type: Object,
83
+ default: undefined
84
+ }
85
+ },
86
+ destroyed () {
87
+ this.stopDeviceStatusMonitoring()
88
+ this.stopLoginStatusMonitoring()
89
+ },
90
+ async ready() {
91
+ console.log('row', this.row)
92
+ console.log('这是登录信息', this.$login)
93
+ let roleList = this.$login.f.f_role_name.spilt(' ')
94
+ if (roleList.includes('收费员')){
95
+ this.isScanDevice = true
96
+ await this.initSystem()
97
+ }
98
+ this.startDeviceStatusMonitoring()
99
+ },
100
+ methods: {
101
+ async initSystem () {
102
+ // 1. 检查设备状态
103
+ console.log('检查设备状态')
104
+ await this.checkStatus()
105
+ // 2. 如果设备在线,检查登录状态
106
+ console.log('设备在线,检查登录状态')
107
+ if (this.deviceOnline) {
108
+ await this.getLoginInfo()
109
+ }
110
+ // 3. 如果设备在线但未登录,自动登录
111
+ if (this.deviceOnline && !this.userLogin) {
112
+ console.log('备在线但未登录,自动登录')
113
+ await this.handleSignIn()
114
+ }
115
+ },
116
+ // 提交评价
117
+ async submitEvaluation(value) {
118
+ this.evaluationStatus = '未发起'
119
+ console.log('用户评价值:', value)
120
+ let req = await this.$resetpost('api/af-revenue/logic/saveEvaluationBussiness', {
121
+ f_orgid: this.$login.f.orgid,
122
+ f_userinfo_id: this.row.f_userinfo_id,
123
+ f_operatorid: this.$login.f.id,
124
+ f_satisfaction: 5 - value,
125
+ f_user_type: this.row.f_user_type
126
+ }, {resolveMsg: '提交评价成功', rejectMsg: '提交评价失败!'})
127
+ this.$dispatch('success', '评价')
128
+ },
129
+ handleSignIn () {
130
+ let self = this;
131
+ self.loading = true;
132
+ self.error = null;
133
+ self.response = null;
134
+ return co(
135
+ this.$CEVEvaluator.signIn(this.signInParams)
136
+ .then(function(result) {
137
+ self.response = JSON.stringify(result.data, null, 2);
138
+ console.log('登录result.data', result.data)
139
+ if (result.data.code === '0' && result.data.text) {
140
+ self.showCeAlert(result.data.text, 'success');
141
+ self.loginIng = true
142
+ self.startLoginStatusMonitoring()
143
+ }
144
+ })
145
+ .catch(function(err) {
146
+ self.error = err.message || '签到失败';
147
+ self.showCeAlert('签到失败: ' + (err.message || '未知错误'), 'error');
148
+ })
149
+ .finally(function() {
150
+ self.loading = false;
151
+ })
152
+ )
153
+ },
154
+
155
+ handleEvaluate () {
156
+ let self = this;
157
+ self.loading = true;
158
+ self.error = null;
159
+ self.response = null;
160
+ self.evaluationStatus = '等待用户评价'
161
+ this.$CEVEvaluator.startEvaluateDirect()
162
+ .then(async function (result) {
163
+ self.response = JSON.stringify(result.data, null, 2);
164
+ if (result.data.code === '0') {
165
+ console.log('result.data.data', result.data.data)
166
+ self.evaluationStatus = '用户已评价'
167
+ let res = await self.$showMessage(`用户已评价,请提交`, ['confirm', 'cancel'])
168
+ if (res !== 'confirm') return
169
+ self.submitEvaluation(result.data.data)
170
+ }
171
+ //self.showCeAlert('', 'success');
172
+ })
173
+ .catch(function(err) {
174
+ self.error = err.message || '评价启动失败';
175
+ self.showCeAlert('用户评价失败: ' + (err.message || '未知错误'), 'error');
176
+ self.evaluationStatus = '未发起'
177
+ })
178
+ .finally(function() {
179
+ self.loading = false;
180
+ });
181
+ },
182
+ // 启动设备状态定时监测
183
+ startDeviceStatusMonitoring() {
184
+ this.deviceCheckTimer = setInterval(async () => {
185
+ await this.checkStatus();
186
+ // 如果设备状态变化,更新登录状态
187
+ if (this.deviceOnline) {
188
+ await this.getLoginInfo();
189
+ }
190
+ if (this.deviceOnline && !this.userLogin) {
191
+ console.log('备在线但未登录,自动登录')
192
+ await this.handleSignIn()
193
+ }
194
+ }, this.deviceCheckInterval);
195
+ },
196
+
197
+ // 停止设备状态监测
198
+ stopDeviceStatusMonitoring() {
199
+ if (this.deviceCheckTimer) {
200
+ clearInterval(this.deviceCheckTimer);
201
+ this.deviceCheckTimer = null;
202
+ }
203
+ },
204
+ // 启动登录定时监测
205
+ startLoginStatusMonitoring() {
206
+ this.loginCheckTimer = setInterval(async () => {
207
+ let self = this
208
+ try {
209
+ const result = await this.$CEVEvaluator.getProgress();
210
+ console.log('progress', result.data)
211
+ if (result.data.code === '0') {
212
+ // 如果进度达到100%,停止检测
213
+ if (result.data.progress >= 100) {
214
+ self.stopLoginStatusMonitoring();
215
+ self.loginIng = false
216
+ await self.getLoginInfo()
217
+ }
218
+ }
219
+ } catch (error) {
220
+ console.error('评价进度检测失败:', error);
221
+ }
222
+ }, this.loginCheckInterval);
223
+ },
224
+
225
+ // 停止评价状态监测
226
+ stopLoginStatusMonitoring() {
227
+ if (this.loginCheckTimer) {
228
+ clearInterval(this.loginCheckTimer);
229
+ this.loginCheckTimer = null;
230
+ }
231
+ },
232
+ getEvaluationResult () {
233
+ let self = this;
234
+ self.loading = true;
235
+ self.error = null;
236
+
237
+ this.$CEVEvaluator.getEvaluateResult()
238
+ .then(function(result) {
239
+ self.response = JSON.stringify(result.data, null, 2);
240
+ })
241
+ .catch(function(err) {
242
+ self.error = err.message || '获取评价结果失败';
243
+ self.showCeAlert('获取评价结果失败', 'error');
244
+ })
245
+ .finally(function() {
246
+ self.loading = false;
247
+ });
248
+ },
249
+
250
+ checkStatus () {
251
+ let self = this;
252
+ self.loading = true;
253
+ self.error = null;
254
+ self.response = null;
255
+ return co(
256
+ this.$CEVEvaluator.checkOnline()
257
+ .then(function(result) {
258
+ self.response = JSON.stringify(result.data, null, 2);
259
+ if (result.data.code === '0' && result.data.online === '1') {
260
+ self.deviceOnline = true
261
+ //self.showCeAlert('状态检查完成', 'success');
262
+ } else {
263
+ self.deviceOnline = false
264
+ self.showCeAlert('状态检查完成', 'success');
265
+ }
266
+
267
+ })
268
+ .catch(function(err) {
269
+ self.error = err.message || '状态检查失败';
270
+ self.showCeAlert('状态检查失败', 'error');
271
+ })
272
+ .finally(function() {
273
+ self.loading = false;
274
+ })
275
+ )
276
+ },
277
+
278
+ getVersionInfo () {
279
+ let self = this;
280
+ self.loading = true;
281
+ self.error = null;
282
+ self.response = null;
283
+
284
+ this.$CEVEvaluator.getVersion()
285
+ .then(function(result) {
286
+ self.response = JSON.stringify(result.data, null, 2);
287
+ })
288
+ .catch(function(err) {
289
+ self.error = err.message || '获取版本信息失败';
290
+ self.showCeAlert('获取版本信息失败', 'error');
291
+ })
292
+ .finally(function() {
293
+ self.loading = false;
294
+ });
295
+ },
296
+
297
+ getLoginInfo () {
298
+ let self = this;
299
+ self.loading = true;
300
+ self.error = null;
301
+ self.response = null;
302
+ return co(
303
+ this.$CEVEvaluator.getLoginInfo()
304
+ .then(async function (result) {
305
+ self.response = JSON.stringify(result.data, null, 2);
306
+ console.log('result.data', result.data)
307
+ if (result.data.code === '0' && result.data.info.name) {
308
+ if (result.data.info.name === self.signInParams.name) {
309
+ self.userLogin = true
310
+ self.stopLoginStatusMonitoring();
311
+ } else {
312
+ await self.signOut()
313
+ }
314
+ //self.showCeAlert('当前用户已登录评价器', 'success');
315
+ } else {
316
+ self.userLogin = false
317
+ self.showCeAlert('当前用户未登录评价器', 'error');
318
+ }
319
+ })
320
+ .catch(function(err) {
321
+ self.error = err.message || '获取登录信息失败';
322
+ self.showCeAlert('获取登录信息失败', 'error');
323
+ })
324
+ .finally(function() {
325
+ self.loading = false;
326
+ })
327
+ )
328
+ },
329
+
330
+ pauseService () {
331
+ let self = this;
332
+ self.loading = true;
333
+ self.error = null;
334
+ self.response = null;
335
+
336
+ this.$CEVEvaluator.pauseService()
337
+ .then(function(result) {
338
+ self.response = JSON.stringify(result.data, null, 2);
339
+ self.showCeAlert('暂停服务成功', 'success');
340
+ })
341
+ .catch(function(err) {
342
+ self.error = err.message || '暂停服务失败';
343
+ self.showCeAlert('暂停服务失败', 'error');
344
+ })
345
+ .finally(function() {
346
+ self.loading = false;
347
+ });
348
+ },
349
+
350
+ playWelcome () {
351
+ let self = this;
352
+ self.loading = true;
353
+ self.error = null;
354
+ self.response = null;
355
+
356
+ this.$CEVEvaluator.playWelcome()
357
+ .then(function(result) {
358
+ self.response = JSON.stringify(result.data, null, 2);
359
+ self.showCeAlert('播放欢迎词成功', 'success');
360
+ })
361
+ .catch(function(err) {
362
+ self.error = err.message || '播放欢迎词失败';
363
+ self.showCeAlert('播放欢迎词失败', 'error');
364
+ })
365
+ .finally(function() {
366
+ self.loading = false;
367
+ });
368
+ },
369
+
370
+ playWaitTip () {
371
+ let self = this;
372
+ self.loading = true;
373
+ self.error = null;
374
+ self.response = null;
375
+
376
+ this.$CEVEvaluator.playWaitTip()
377
+ .then(function(result) {
378
+ self.response = JSON.stringify(result.data, null, 2);
379
+ self.showCeAlert('播放等待提醒成功', 'success');
380
+ })
381
+ .catch(function(err) {
382
+ self.error = err.message || '播放等待提醒失败';
383
+ self.showCeAlert('播放等待提醒失败', 'error');
384
+ })
385
+ .finally(function() {
386
+ self.loading = false;
387
+ });
388
+ },
389
+
390
+ signOut () {
391
+ let self = this;
392
+ self.loading = true;
393
+ self.error = null;
394
+ self.response = null;
395
+
396
+ return co(
397
+ this.$CEVEvaluator.signOut()
398
+ .then(function(result) {
399
+ self.response = JSON.stringify(result.data, null, 2);
400
+ //self.showCeAlert('签退成功', 'success');
401
+ })
402
+ .catch(function(err) {
403
+ self.error = err.message || '签退失败';
404
+ self.showCeAlert('签退失败', 'error');
405
+ })
406
+ .finally(function() {
407
+ self.loading = false;
408
+ })
409
+ )
410
+ },
411
+
412
+ showCeAlert (message, type) {
413
+ if (type === 'error') {
414
+ console.error(message);
415
+ this.$showAlert(message, 'danger', 2000);
416
+ } else {
417
+ console.log(message);
418
+ this.$showAlert(message, 'success', 2000);
419
+ }
420
+ }
421
+ },
422
+ computed: {
423
+ deviceStatusClass() {
424
+ if (this.loading) return 'loading';
425
+ return this.deviceOnline ? 'online' : 'offline';
426
+ },
427
+ deviceStatusText() {
428
+ if (this.loading) return '检测中...';
429
+ return this.deviceOnline ? '在线' : '离线';
430
+ },
431
+ loginStatusClass() {
432
+ if (this.loading) return 'loading';
433
+ return this.userLogin ? 'online' : 'offline';
434
+ },
435
+ loginStatusText() {
436
+ if (this.loading) return '验证中...';
437
+ return this.userLogin ? '已登录' : this.loginIng ? '登录中' : '未登录'
438
+ },
439
+ autoProcessMessage () {
440
+ if (!this.deviceOnline) return '系统启动中,正在检查设备状态...'
441
+ return this.deviceOnline && this.userLogin ? '系统已就绪,可以开始评价' : this.loginIng ? '系统初始化中正在登录..' : '系统初始化失败,请检查设备连接'
442
+ }
443
+ },
444
+ };
445
+ </script>
446
+
447
+ <style scoped>
448
+ .section {
449
+ margin-bottom: 20px;
450
+ padding: 15px;
451
+ border: 1px solid #e0e0e0;
452
+ border-radius: 5px;
453
+ }
454
+
455
+ .section h3 {
456
+ margin-top: 0;
457
+ color: #333;
458
+ border-bottom: 1px solid #ddd;
459
+ padding-bottom: 8px;
460
+ }
461
+
462
+ .input-group {
463
+ margin-bottom: 10px;
464
+ display: flex;
465
+ align-items: center;
466
+ }
467
+
468
+ .input-group label {
469
+ display: inline-block;
470
+ width: 80px;
471
+ font-weight: bold;
472
+ margin-right: 10px;
473
+ }
474
+
475
+ .input-group input {
476
+ flex: 1;
477
+ padding: 8px;
478
+ border: 1px solid #ccc;
479
+ border-radius: 3px;
480
+ max-width: 300px;
481
+ }
482
+
483
+ button {
484
+ margin-right: 10px;
485
+ margin-bottom: 10px;
486
+ padding: 10px 15px;
487
+ background-color: #4CAF50;
488
+ color: white;
489
+ border: none;
490
+ border-radius: 4px;
491
+ cursor: pointer;
492
+ font-size: 14px;
493
+ }
494
+
495
+ button:disabled {
496
+ background-color: #cccccc;
497
+ cursor: not-allowed;
498
+ }
499
+
500
+ button:hover:not(:disabled) {
501
+ background-color: #45a049;
502
+ }
503
+
504
+ .response, .error {
505
+ margin-top: 20px;
506
+ padding: 15px;
507
+ border-radius: 5px;
508
+ font-size: 14px;
509
+ }
510
+
511
+ .response {
512
+ background-color: #f0f9f0;
513
+ border-left: 4px solid #4CAF50;
514
+ }
515
+
516
+ .error {
517
+ background-color: #fef0f0;
518
+ border-left: 4px solid #f56c6c;
519
+ }
520
+
521
+ pre {
522
+ white-space: pre-wrap;
523
+ word-wrap: break-word;
524
+ margin: 0;
525
+ font-family: 'Courier New', monospace;
526
+ font-size: 13px;
527
+ }
528
+
529
+ h2 {
530
+ text-align: center;
531
+ color: #333;
532
+ margin-bottom: 30px;
533
+ }
534
+ .auto-process {
535
+ background: #fff3cd;
536
+ border-left: 4px solid #ffc107;
537
+ padding: 10px 15px;
538
+ margin: 15px 0;
539
+ border-radius: 4px;
540
+ }
541
+
542
+ .auto-process h4 {
543
+ color: #856404;
544
+ margin-bottom: 5px;
545
+ }
546
+ .status-item {
547
+ display: flex;
548
+ align-items: center;
549
+ gap: 8px;
550
+ margin: 5px 0;
551
+ }
552
+
553
+ .status-badge {
554
+ display: inline-block;
555
+ width: 12px;
556
+ height: 12px;
557
+ border-radius: 50%;
558
+ margin-right: 5px;
559
+ }
560
+
561
+ .online {
562
+ background: #2ecc71;
563
+ }
564
+
565
+ .offline {
566
+ background: #e74c3c;
567
+ }
568
+
569
+ .loading {
570
+ background: #f39c12;
571
+ animation: pulse 1.5s infinite;
572
+ }
573
+ .timer-badge {
574
+ display: inline-block;
575
+ padding: 3px 8px;
576
+ border-radius: 12px;
577
+ background: #3498db;
578
+ color: white;
579
+ font-size: 12px;
580
+ margin-left: 8px;
581
+ }
582
+ </style>
@@ -426,7 +426,7 @@ let initCardGen = async function (self) {
426
426
  }
427
427
  } else {
428
428
  self.$showAlert('发卡售气成功', 'success', 2000)
429
- self.$dispatch('success')
429
+ self.$dispatch('success', '发卡售气')
430
430
  }
431
431
  self.clickConfirm = false
432
432
  } catch (error) {
@@ -713,7 +713,7 @@ export default {
713
713
  },
714
714
  eticket_toggle () {
715
715
  this.eticket_show = false
716
- this.$dispatch('success')
716
+ this.$dispatch('success', '发卡售气')
717
717
  },
718
718
  async confirm () {
719
719
  this.eticket_msg = false
@@ -805,7 +805,7 @@ export default {
805
805
  this.billData.bill = val.bill
806
806
  },
807
807
  printok () {
808
- this.$dispatch('success')
808
+ this.$dispatch('success', '发卡售气')
809
809
  },
810
810
  calText (val) {
811
811
  let str = ''
@@ -43,4 +43,7 @@ export default function () {
43
43
  Vue.component('charge-manage', (resolve) => { require(['./ChargeManage'], resolve) })
44
44
  // 业务操作组件
45
45
  Vue.component('charge-oper', (resolve) => { require(['./ChargeOper'], resolve) })
46
+
47
+ Vue.component('service-evaluation', (resolve) => { require(['./ServiceEvaluation'], resolve) })
48
+
46
49
  }
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/rongchuang/sale'
5
+ import FilialeSale from './filiale/bayan/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'