safecheck-client 3.0.30-62-t9 → 3.0.30-62-t11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,743 +1,743 @@
1
- <template>
2
- <div class="row">
3
- <work-busy :is-busy="isbusy"></work-busy>
4
- <criteria-paged :model="model" v-ref:paged>
5
- <criteria partial='criteria' class="search_area" @condition-changed='$parent.search' v-ref:criteria>
6
- <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
7
- <div class="row" v-show="!$parent.$parent.$parent.showItem">
8
- <div :class="$parent.$parent.style">
9
- <label class="font_normal_body">用户编号</label>
10
- <input type="text" class="input_search" v-model="model.f_userinfo_code" condition="f_userinfo_code = '{}'"
11
- style="width: 60%" placeholder="用户编号">
12
- </div>
13
- <div :class="$parent.$parent.style2" style="margin: 0">
14
- <label class="control-label">安检员</label>
15
- <v-select :value.sync="model.f_handlercheck_name" v-model="model.f_handlercheck_name"
16
- :value-single="false" clear-button :options='$parent.$parent.checkers' placeholder='安检员'
17
- condition="f_handlercheck_name = '{}'"></v-select>
18
- </div>
19
- <div class=" col-sm-4 form-group button-range">
20
- <div class="span" style="float: right;margin-top: 8px">
21
- <button style="float: right" class="button_search button_spacing" @click="search">查询</button>
22
- <button style="float: right" class="button_search button_spacing"
23
- @click="$parent.$parent.yyChange(1)">转单</button>
24
- <button style="float: right" class="button_search button_spacing"
25
- @click="$parent.$parent.yyChange(2)">取消预约</button>
26
- </div>
27
- </div>
28
- </div>
29
- </div>
30
- </criteria>
31
- <data-grid :model="model" partial='list' v-ref:grid class="list_area table_sy">
32
- <template partial='head'>
33
- <tr>
34
- <th>
35
- <nobr><input type="checkbox" onClick="event.cancelBubble = true"
36
- :checked="$parent.$parent.$parent.checkAll" @change="$parent.$parent.$parent.setCheckAll()" />全选
37
- </nobr>
38
- </th>
39
- <th>
40
- <nobr>用户编号</nobr>
41
- </th>
42
- <th>
43
- <nobr>用户名</nobr>
44
- </th>
45
- <th>
46
- <nobr>预约时间</nobr>
47
- </th>
48
- <th>
49
- <nobr>安检员</nobr>
50
- </th>
51
- <th>
52
- <nobr>备注</nobr>
53
- </th>
54
- </tr>
55
- </template>
56
- <template partial='body'>
57
- <td style="text-align: center;white-space:nowrap;"><input type="checkbox" @click="$event.cancelBubble = true"
58
- :checked="$parent.$parent.$parent.isChecked(row.f_userinfo_id)"
59
- @change="$parent.$parent.$parent.setCheckes(row.f_userinfo_id)"></input></td>
60
- <td style="text-align: center;white-space:nowrap;">{{ row.f_userinfo_code }}</td>
61
- <td style="text-align: center;white-space:nowrap;">{{ row.f_user_name }}</td>
62
- <td style="text-align: center;white-space:nowrap;">{{ row.f_handler_time }}</td>
63
- <td style="text-align: center;white-space:nowrap;">{{ row.f_handlercheck_name }}</td>
64
- <td style="text-align: center;white-space:nowrap;">{{ row.f_safe_remark }}</td>
65
- </template>
66
- </data-grid>
67
- </criteria-paged>
68
- <modal :show.sync="selecetChecker" :backdrop="false">
69
- <div slot="modal-header" class="modal-header">
70
- </div>
71
- <div slot="modal-body" class="modal-body">
72
- <div class="row">
73
- <div style="margin: 0">
74
- <label class="control-label">安&nbsp;&nbsp;检&nbsp;&nbsp;员</label>
75
- <v-select :value.sync="changeData.f_handlercheck_name" v-model="changeData.f_handlercheck_name"
76
- :value-single="false" clear-button :options='checkers' placeholder='安检员'></v-select>
77
- </div>
78
- <div style="margin: 0">
79
- <label class="control-label" >备&emsp;&emsp;注</label>
80
- <input class="input_search" type="text" style="margin-left: 5px;width: 60%" v-model="changeData.f_safe_remark" placeholder="备注">
81
- </div>
82
- </div>
83
- </div>
84
- <div slot="modal-footer" class="modal-footer" style="text-align: center">
85
- <button class="button_search" style="margin-right: 20px" @click="ok">确认</button>
86
- <button class="button_search" @click="selecetChecker = false">取消</button>
87
- </div>
88
- </modal>
89
- </div>
90
- </template>
91
- <script>
92
- import { PagedList } from 'vue-client'
93
- import HttpResetClass from "vue-client/src/plugins/HttpResetClass";
94
- import co from 'co'
95
- import Vue from 'vue'
96
- import * as Util from '../../components/Util'
97
-
98
- let select = function* (self) {
99
- let http = new HttpResetClass()
100
- let getGasman = yield http.load('POST', '/rs/search', {
101
- source: 'this.getParentByType($organization$).getChildByName($安检员$).getUsers()',
102
- userid: self.$login.f.id
103
- }, { resolveMsg: null, rejectMsg: null })
104
- //tag
105
- self.checkers.push({ label: '全部', value: '' })
106
- getGasman.data.forEach((checker) => {
107
- self.checkers.push({ label: checker.name, value: checker })
108
- })
109
- }
110
- export default {
111
- title: '隐患查询',
112
- data() {
113
- let model = new PagedList('api/af-safecheck/sql/safe_singleTable_OrderBy', 20, {
114
- items: "'*'",
115
- tablename: "'t_userinfo'",
116
- orderitem: "'f_handler_time desc'"
117
- })
118
- return {
119
- f: this.$login.f,
120
- model: model,
121
- changeData: {},
122
- criteriaShow: false,
123
- selecetChecker: false,
124
- checkAll: false,
125
- timercount: 0,
126
- showModal2: false,
127
- repairTypeOptions: this.$appdata.getParam('报修类型'),
128
- dispatchTypeOptions: [{ label: '派发给站点', value: '派发给站点' }, { label: '派发给维修员', value: '派发给维修员' }],
129
- checkes: [],
130
- showModal: false,
131
- f_check_plan: { f_plan_name: '', id: '' },
132
- sumsmodel: {},
133
- resids: {},
134
- all: false,
135
- fields: {},
136
-
137
- selectData: {
138
- dispatchType: '',
139
- f_repairman: '',
140
- f_remarks: '',
141
- f_repairtype: ''
142
- },
143
- progressbarWidth: '0',
144
- modelval: [],
145
- isbusy: false,
146
- transfer: null,
147
- checkers: [],
148
- showModal3: false,
149
- toRepairCount: 0,
150
- sliceArea: [],
151
- callSends: [],
152
- cbc: [],
153
- repairedOptions: [{ label: '全部', value: '' }, { label: '已修', value: '已修' }, { label: '未修', value: '未修' }],
154
- repairers: [],
155
- cbcs: [],
156
- thead: '',
157
- headData: ['入户状态', '用户编号', '用户名', '用户电话', '用户小区', '用户地址', '安检时间', '安检员', '计划名', '是否有隐患', '隐患数', '隐患明细', '处理数', '完成数', '处理情况', '完成情况', '维修员'],
158
- bodyData: ['f_entry_status', 'f_userinfo_code', 'f_user_name', 'f_user_phone', 'f_residential_area', 'f_address', 'f_offsite_time', 'f_checker_name', 'f_plan_name', 'f_has_defect', 'f_defect_count', 'defecttext', 'f_deal_count', 'f_repair_count', 'f_is_deal', 'f_is_repair', 'f_repairman'],
159
- }
160
- },
161
- props: {
162
- style: {
163
- type: String,
164
- default: 'col-sm-2 form-group'
165
- },
166
- style2: {
167
- type: String,
168
- default: 'col-sm-4 form-group'
169
- }
170
-
171
- },
172
-
173
- methods: {
174
- yyChange(type) {
175
- if (!this.checkAll && this.checkes.length === 0) {
176
- this.$showMessage('请选择用户')
177
- return
178
- }
179
- if (type == 1) {
180
- this.selecetChecker = true
181
- } else {
182
- let userinfoIds = []
183
- if (this.checkAll) {
184
- userinfoIds = this.model.rows.map(row => {
185
- return `'${row.f_userinfo_id}'`
186
- })
187
- } else if (this.checkes.length > 0) {
188
- userinfoIds = this.checkes
189
- }
190
- let sql = `update t_userinfo set f_handler_time = null,f_handler_state= null,f_handlercheck_id=null,f_handlercheck_name=null,f_safe_remark=null,f_contact_phone=null,f_safe_urgency=null,f_safe_isUrgent=null,f_service_id=null where f_userinfo_id in (${userinfoIds.join()})`
191
- new HttpResetClass().load('POST', 'api/af-safecheck/logic/runSQL', { data: { sql: sql } }, { resolveMsg: null, rejectMsg: '取消预约失败' }).then(() => {
192
- this.$refs.paged.$refs.criteria.search()
193
- }).catch(()=>{
194
- this.$showMessage('取消预约失败')
195
- })
196
- }
197
- },
198
- getSiteRes(obj) {
199
- console.log('siteRes ---> ')
200
- console.log(obj)
201
- if (obj.resids[0]) {
202
- this.selectData.f_meetunit = obj.res.join('.')
203
- this.selectData.f_reciever = obj.resids.join('.')
204
- this.selectData.f_outlets = obj.res[obj.res.length - 1]
205
- } else {
206
- this.selectData.f_meetunit = ''
207
- this.selectData.f_reciever = ''
208
- this.selectData.f_outlets = ''
209
- }
210
- },
211
- trouble(val) {
212
- // return val.replaceAll("'",'')
213
- // .replaceAll("\"",'')
214
- // .replaceAll("{",'')
215
- // .replaceAll("}",'')
216
- // .replaceAll("]",'')
217
- // .replaceAll("[",'')
218
- // .replaceAll("result:",'')
219
- // .replaceAll("data:",'')
220
- // .replaceAll("有隐患",'')
221
- // .replaceAll(",",'')
222
-
223
-
224
- const defect_content = JSON.parse(val)
225
- let result = ''
226
- if (defect_content.data) {
227
- const jsonData = defect_content.data
228
- for (const itemdata of jsonData) {
229
- const keys = Object.keys(itemdata)
230
- for (const itm of keys) {
231
- const value = itemdata[itm]
232
- result += itm + ':' + value
233
- }
234
- }
235
- }
236
- return result
237
- },
238
- getEmp() {
239
- let val = { source: 'this.getParentByType($organization$).getSpecialResByType($user$).where(row.getAttributes().get($rolestr$)!=null ).where(row.getAttributes().get($rolestr$).indexOf($维修员$) != -1))', userid: `${this.$login.f.id}` }
240
- let http = new HttpResetClass()
241
- http.load('POST', '/rs/search', { data: val }, { resolveMsg: null, rejectMsg: null }).then((res) => {
242
- let str = `'`
243
- res.data.forEach((item, idx, arr) => {
244
- //tag
245
- if (idx + 1 == arr.length) {
246
- str += item.id + `'`
247
- } else {
248
- str += item.id + `','`
249
- }
250
-
251
- })
252
- let http1 = new HttpResetClass()
253
- http1.load('POST', 'api/af-safecheck/sql/tel_singleTable_OrderBy', {
254
- data: {
255
- items: 'id,f_user_telephone',
256
- tablename: 't_user',
257
- condition: `id in (${str})`,
258
- orderitem: 'id'
259
- }
260
- }, { resolveMsg: null, rejectMsg: null }).then((ress) => {
261
-
262
- res.data.forEach((user) => {
263
- try {
264
- ress.data.forEach((tel, tidx, arr) => {
265
- //tag
266
- if (user.id == tel.id) {
267
- this.repairers.push({ label: `${user.name}:${tel.f_user_telephone}`, value: user.name })
268
- ress.data.splice(tidx, 1)
269
- //tag
270
- throw new Error("跳出循环");
271
- }
272
- })
273
- } catch (e) {
274
- //tag
275
- }
276
- })
277
- })
278
-
279
- })
280
- },
281
- toRepair() {
282
- if (this.checkes.length == 0) {
283
- return this.$showMessage('请先选择需要转维修的用户!')
284
- }
285
- this.showModal2 = true
286
- },
287
- async rectification() {
288
-
289
- if (this.selectData.dispatchType) {
290
- if (this.selectData.dispatchType == '派发给站点') {
291
- if (!this.selectData.f_reciever) {
292
- this.$showMessage('请选择部门!')
293
- return
294
- }
295
- } else {
296
- if (!this.selectData.f_repairman) {
297
- this.$showMessage('请选择维修员!')
298
- return
299
- }
300
- }
301
- } else {
302
- this.$showMessage('请选择派发类型!')
303
- return
304
- }
305
-
306
- if (!this.selectData.f_repairtype) {
307
- this.$showMessage('请选择报修类型!')
308
- return
309
- }
310
- this.showModal3 = true
311
- let act = {}
312
- let toRepair = ''
313
- let successCount = 0
314
- if (this.selectData.dispatchType == '派发给站点') {
315
- act = { f_meetunit: this.selectData.f_meetunit, f_reciever: this.selectData.f_reciever, f_service_acitivity_type: '派单' }
316
- toRepair = null
317
- } else {
318
- console.log('派发给维修员---------' + this.selectData.f_repairman)
319
- act = { f_meetunit: '', f_reciever: this.selectData.f_repairman, f_service_acitivity_type: '派单' }
320
- toRepair = '一级派单'
321
- }
322
- let rep = {
323
- loginUser: {
324
- name: this.$login.f.name,
325
- ename: this.$login.f.ename
326
- },
327
- f_meetunit: this.$login.f.deps,
328
- f_attendant: this.$login.f.name,
329
- f_outlets: this.$login.f.deps,
330
- f_remarks: this.selectData.f_remarks,
331
- f_repairtype: this.selectData.f_repairtype,
332
- toRepair: toRepair,
333
- activity: act
334
- }
335
- for (let i = 0; i < this.checkes.length; i++) {
336
- try {
337
- let result = await new HttpResetClass().load('post', '/api/af-safecheck/logic/phoneUploadRectification', {
338
- id: this.checkes[i],
339
- repData: rep,
340
- source: 'pc'
341
- }, { resolveMsg: null, rejectMsg: null })
342
- if (result.data.code == 200) {
343
- successCount += result.data.successcon
344
- this.progressbarWidth = Math.ceil((i + 1) * 100 / (this.checkes.length))
345
- }
346
- } catch (e) {
347
- this.showModal3 = false
348
- this.$showMessage('网络异常,请稍后再试!')
349
- return
350
- }
351
- }
352
- this.showModal3 = false
353
- this.cancel1()
354
- this.$showMessage('本次转维修成功' + successCount + '单')
355
- },
356
- /*async rectification(){
357
- this.isbusy =true
358
- console.log("----this.checkes",this.checkes.toString())
359
- console.log("----this.getcon()",this.getcon())
360
- if(this.checkes.length==0){
361
- return this.$showMessage('请先选择需要转维修的用户!')
362
- }
363
- // if (this.checkAll){
364
- let data={
365
- f_filialeids: this.model.params.f_filialeids,
366
- f_defect_content: this.model.params.f_defect_content,
367
- condition: `${this.model.params.condition} and id in(${this.getcon()})`
368
- }
369
- let res1= await new HttpResetClass().load('post','api/af-safecheck/sql/GetCheckPaperByDefectNew',{data: data })
370
- for (let i = 0; i < res1.data.length; i++) {
371
- let data1={
372
- f_paper_id: res1.data[i].id,
373
- condition:`f_repaire_type = '隐患未处理'`
374
- }
375
- let res2 = await new HttpResetClass().load('POST' , 'api/af-safecheck/sql/GetDefectByPaperIdNew' , {data: data1 } )
376
- //tag
377
- if(res2.data.length==0){
378
- continue
379
- }
380
- const uploadData = {
381
- model: {
382
- serviceacitivity: [{
383
- f_service_acitivity_type: '派单'
384
- }],
385
- f_repairitems: {},
386
- failure: '',
387
- f_source: '安检',
388
- f_service_id: '',
389
- f_contact_phone: res1.data[i].f_user_phone,
390
- f_meetunit: this.$login.f.deps,
391
- f_phone: '',
392
- f_user_name: res1.data[i].f_user_name,
393
- f_address: res1.data[i].f_address,
394
- f_repair_date: Util.getNowDate(),
395
- f_reciever: '',
396
- f_remarks: this.selectData.f_remarks,
397
- f_user_type: res1.data[i].f_check_type,
398
- f_area: '',
399
- f_unit_name: '',
400
- f_street: res1.data[i].f_street,
401
- f_residential_area: res1.data[i].f_residential_area,
402
- f_building: res1.data[i].f_building,
403
- f_unit: res1.data[i].f_unit,
404
- f_floor: res1.data[i].f_floor,
405
- f_room: res1.data[i].f_room,
406
- aState: '',
407
- f_repairtype: this.selectData.f_repairtype,
408
- f_userinfo_id: res1.data[i].f_userinfo_id,
409
- f_userinfo_code: res1.data[i].f_userinfo_code,
410
- f_orgstr: res1.data[i].f_filialeid,
411
- f_outlets: '',
412
- f_attendant: this.$login.f.name
413
- },
414
- loginUser: {
415
- name: this.$login.f.name,
416
- ename: this.$login.f.ename
417
- },
418
- user: {
419
- f_userinfo_id: res1.data[i].f_userinfo_id
420
- },
421
- callObj: null
422
- }
423
- uploadData.model.serviceacitivity[0].f_reciever = this.selectData.f_repairman
424
- // uploadData.model.f_meetunit = self.$login.f.orgpathnames
425
- // uploadData.model.f_orgstr = self.$login.f.orgpathstr
426
- // uploadData.model.f_outlets = self.$login.f.f_parentname
427
- uploadData.model.f_orgid = this.$login.f.orgid
428
- uploadData.model.f_filiale = this.$login.f.org
429
- uploadData.model.f_outlets = this.$login.f.deps
430
- uploadData.model.f_filiale_id = this.$login.f.orgid
431
- uploadData.toRepair = '一级派单'
432
- // let res3 = await new HttpResetClass().load('post','/api/af-safecheck/sql/GetUserForRepaireNew', {data: {f_userinfo_id: res1.data[i].f_userinfo_id}})
433
- // uploadData.model = Object.assign(uploadData.model, res3.data[0])
434
- let failure = []
435
- res2.data.forEach(row => {
436
- console.log('row.f_item_value',row.f_item_value)
437
- failure.push({
438
- f_failure_type: row.f_item_name,
439
- failurecase: row.f_item_value?row.f_item_value.split(','):''
440
- })
441
- })
442
- uploadData.model.failure = failure
443
- // 拼接repairitems
444
- let rows = JSON.parse(JSON.stringify(res2.data))
445
- let repairitems = {
446
- data: []
447
- }
448
- let safecheckOptions = [{"data": "已处理"}, {"data": "未处理"}]
449
- // 取隐患未处理的
450
- rows = rows.filter(row => row.f_repaire_type == '隐患未处理')
451
- //tag)
452
- // 开始拼接
453
- rows.forEach(row => {
454
- let existIndex = -1
455
- // 判断该设备是否已经存在
456
- for (let i = 0; i < repairitems.data.length; i++) {
457
- if (repairitems.data[i].f_type == row.f_device_type) {
458
- existIndex = i
459
- break
460
- }
461
- }
462
- if (existIndex == -1) {
463
- // 不存在则新建
464
- let newItem = {
465
- f_type: row.f_device_type,
466
- details: [{
467
- f_defect_id: row.id,
468
- f_project: `${row.f_item_name}:${row.f_item_value}`,
469
- type: 'selector',
470
- options: safecheckOptions
471
- }]
472
- }
473
- repairitems.data.push(newItem)
474
- } else {
475
- // 存在则追加
476
- repairitems.data[existIndex].details.push({
477
- f_defect_id: row.id,
478
- f_project: `${row.f_item_name}:${row.f_item_value}`,
479
- type: 'selector',
480
- options: safecheckOptions
481
- })
482
- }
483
- })
484
- uploadData.model.f_repairitems = repairitems
485
- uploadData.rows=rows
486
- //tag)
487
- //tag
488
- console.log('uploadData---', uploadData)
489
- if (uploadData.model.f_repairitems.data.length>0){
490
- this.callSends.push(uploadData)
491
- }else{
492
- //tag
493
- }
494
- }
495
- //tag)
496
- let timer = setInterval(async ()=>{
497
- this.showModal3=true
498
- this.isbusy=false
499
- if (this.timercount<this.callSends.length){
500
- //tag)
501
- let rows=this.callSends[this.timercount].rows
502
- //tag)
503
- let result = await this.$resetpost('/rs/logic/callerSend1', this.callSends[this.timercount])
504
- //tag)
505
- if (result.data.f_service_id) {
506
- const data = {
507
- f_paper_id: rows[0].f_paper_id,
508
- f_service_id: result.data.f_service_id,
509
- itemsId: this.$login.convertToIn(rows.map(row => row.id))
510
- }
511
- //tag
512
- let updateRes = await this.$resetpost('/rs/logic/updateDefectStateNew', data)
513
- }
514
- this.toRepairCount++
515
- //tag
516
- this.timercount++
517
- }else{
518
- clearInterval(timer)
519
- //tag
520
- this.callSends=[]
521
- this.timercount=0
522
- this.showModal3=false
523
- this.cancel1()
524
- this.$showMessage('本次转维修成功'+this.toRepairCount+'单')
525
- this.toRepairCount=0
526
- }
527
- }, 3000)
528
- },*/
529
- cancel1() {
530
- this.showModal2 = false
531
- this.selectData = {
532
- dispatchType: '',
533
- f_repairman: '',
534
- f_remarks: '',
535
- f_repairtype: ''
536
- }
537
- },
538
- sleep(d) {
539
- //tag)
540
- var t = Date.now()
541
- while (Date.now - t <= d) {
542
-
543
- }
544
- //tag)
545
- },
546
- isChecked(v) {
547
- // 如果全选,不在的按选中算,否则,在的按选中算
548
- if (this.checkAll) {
549
- return this.checkes.indexOf(v) == -1
550
- } else {
551
- return this.checkes.indexOf(v) != -1
552
- }
553
- },
554
- setCheckAll() {
555
- this.checkAll = this.checkAll ? false : true;
556
- // 全选改变后,清空选中数据
557
- this.checkes = []
558
- },
559
- setCheckes(id) {
560
- let index = this.checkes.indexOf(id)
561
- if (index < 0) {
562
- this.checkes.push(id)
563
- } else {
564
- this.checkes.splice(index, 1)
565
- }
566
- },
567
-
568
- getmeterbook(val) {
569
- this.cbc = []
570
- this.cbc.push({
571
- label: '全部',
572
- value: ''
573
- })
574
- if (val == '') {
575
-
576
- this.cbcs.forEach(res => {
577
- this.cbc.push({
578
- label: res.f_book_name,
579
- value: res.id
580
- })
581
- })
582
- } else {
583
- this.cbcs.forEach(res => {
584
- if (res.f_book_slice_area == val) {
585
- this.cbc.push({
586
- label: res.f_book_name,
587
- value: res.id
588
- })
589
- }
590
- })
591
- }
592
- },
593
-
594
- // Mreadibook(val){
595
- // //tag
596
- // //tag
597
- // this.sliceArea=[]
598
- // if (val){
599
- // new HttpResetClass().load('POST',`/api/af-safecheck/sql/tel_singleTable_OrderBy`, {data: {
600
- // items: 'name',
601
- // tablename: 't_zone',
602
- // condition: `parentid in ${val}`,
603
- // orderitem: 'id'
604
- // }}, {resolveMsg: null, rejectMsg: null}).then((res) => {
605
- // this.sliceArea.push({
606
- // label:'全部',
607
- // value:''
608
- // })
609
- // res.data.forEach(ress=>{
610
- // this.sliceArea.push({
611
- // label:ress.name,
612
- // value:ress.name
613
- // })
614
- // })
615
- //
616
- // })
617
- // }
618
- // },
619
- // getAllMeterBook(val){
620
- // //tag
621
- // //tag
622
- // this.cbcs=[]
623
- // if (val){
624
- // new HttpResetClass().load('POST',`/api/af-safecheck/sql/tel_singleTable_OrderBy`, {data: {
625
- // items: 'f_book_name,f_book_slice_area,id',
626
- // tablename: 't_meter_book',
627
- // condition: `f_filiale_id in ${val}`,
628
- // orderitem: 'id'
629
- // }}, {resolveMsg: null, rejectMsg: null}).then((res) => {
630
- // res.data.forEach(ress=>{
631
- // this.cbcs.push({
632
- // id:ress.id,
633
- // f_book_name:ress.f_book_name,
634
- // f_book_slice_area:ress.f_book_slice_area
635
- // })
636
- // })
637
- // this.cbc=[]
638
- // this.cbc.push({
639
- // label:'全部',
640
- // value:''
641
- // })
642
- // this.cbcs.forEach(res=>{
643
- // this.cbc.push({
644
- // label:res.f_book_name,
645
- // value:res.id
646
- // })
647
- // })
648
- // })
649
- // }
650
- // },
651
- hiddenr() {
652
- this.$parent.showItem = !this.$parent.showItem
653
- },
654
- hidden() {
655
- this.criteriaShow = !this.criteriaShow
656
- },
657
- search(args) {
658
- args.condition += ` and f_handler_state = '已预约'`
659
- this.model.search(args.condition, args.model)
660
- },
661
- getRes(obj) {
662
- //tag
663
- this.resids = { res: obj.res[0], resids: obj.resids[0] }
664
- this.model.f_filialeids = this.$login.convertToIn(obj.resids);
665
- // this.Mreadibook(this.model.f_filialeids)
666
- // this.getAllMeterBook(this.model.f_filialeids)
667
- },
668
- showChooser() {
669
- this.showModal = true
670
- },
671
- ok() {
672
- if (!this.changeData.f_handlercheck_name || this.changeData.f_handlercheck_name.length == 0) {
673
- this.$showMessage('请选择安检员')
674
- return
675
- }
676
- let userinfoIds = []
677
- if (this.checkAll) {
678
- userinfoIds = this.model.rows.map(row => {
679
- return `'${row.f_userinfo_id}'`
680
- })
681
- } else if (this.checkes.length > 0) {
682
- userinfoIds = this.checkes
683
- }
684
- let sql = `update t_userinfo set f_handler_time = '${Util.toStandardTimeString()}',f_handlercheck_id='${this.changeData.f_handlercheck_name[0].id}',f_handlercheck_name='${this.changeData.f_handlercheck_name[0].name}',f_safe_remark='${this.changeData.f_safe_remark}' where f_userinfo_id in (${userinfoIds.join()})`
685
- new HttpResetClass().load('POST', 'api/af-safecheck/logic/runSQL', { data: { sql: sql } }, { resolveMsg: null, rejectMsg: '预约转单失败' }).then(() => {
686
- this.$refs.paged.$refs.criteria.search()
687
- this.changeData = {}
688
- this.selecetChecker = false
689
- }).catch(()=>{
690
- this.$showMessage('转单失败')
691
- })
692
- },
693
- cancel() {
694
- this.showModal = false
695
- this.f_check_plan = { f_plan_name: '', id: '' }
696
- }
697
- },
698
- ready() {
699
- //tag
700
- this.transfer = Vue.$appdata.getSingleValue('安检转工单')
701
- this.$refs.paged.$refs.criteria.model.f_has_defect = '有隐患'
702
- this.getEmp()
703
- let gen = select(this)
704
- // this.Mreadibook(`('${this.$login.f.orgid}')`)
705
- co(gen)
706
- },
707
- watch: {
708
- 'timercount'() {
709
- if (this.timercount === 0) {
710
- this.progressbarWidth = '0'
711
- } else {
712
- //tag
713
- //tag
714
- this.progressbarWidth = parseInt(this.timercount * 100 / (this.callSends.length + 1))
715
- }
716
-
717
- }
718
- },
719
- computed: {
720
- selected() {
721
- return this.$refs.paged.$refs.grid.selected
722
- },
723
- getfield() {
724
- //tag
725
- let data = {}
726
- this.bodyData.forEach((value, index) => {
727
- data[this.bodyData[index]] = this.headData[index]
728
- })
729
- //合计字段打印
730
- this.tfoot = `<tr><th colspan=${this.modelval.length}>全表汇总信息: `
731
- if (this.sumsmodel) {
732
- Object.keys(this.sumsmodel).forEach((key) => {
733
- this.tfoot += this.fields[key] + '合计: ' + `<font color="blue">${this.sumsmodel[key]} </font>`
734
- })
735
- } else {
736
- this.tfoot += '暂无'
737
- }
738
- this.tfoot += '</th></tr>'
739
- return data
740
- }
741
- }
742
- }
743
- </script>
1
+ <template>
2
+ <div class="row">
3
+ <work-busy :is-busy="isbusy"></work-busy>
4
+ <criteria-paged :model="model" v-ref:paged>
5
+ <criteria partial='criteria' class="search_area" @condition-changed='$parent.search' v-ref:criteria>
6
+ <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
7
+ <div class="row" v-show="!$parent.$parent.$parent.showItem">
8
+ <div :class="$parent.$parent.style">
9
+ <label class="font_normal_body">用户编号</label>
10
+ <input type="text" class="input_search" v-model="model.f_userinfo_code" condition="f_userinfo_code = '{}'"
11
+ style="width: 60%" placeholder="用户编号">
12
+ </div>
13
+ <div :class="$parent.$parent.style2" style="margin: 0">
14
+ <label class="control-label">安检员</label>
15
+ <v-select :value.sync="model.f_handlercheck_name" v-model="model.f_handlercheck_name"
16
+ :value-single="false" clear-button :options='$parent.$parent.checkers' placeholder='安检员'
17
+ condition="f_handlercheck_name = '{}'"></v-select>
18
+ </div>
19
+ <div class=" col-sm-4 form-group button-range">
20
+ <div class="span" style="float: right;margin-top: 8px">
21
+ <button style="float: right" class="button_search button_spacing" @click="search">查询</button>
22
+ <button style="float: right" class="button_search button_spacing"
23
+ @click="$parent.$parent.yyChange(1)">转单</button>
24
+ <button style="float: right" class="button_search button_spacing"
25
+ @click="$parent.$parent.yyChange(2)">取消预约</button>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </criteria>
31
+ <data-grid :model="model" partial='list' v-ref:grid class="list_area table_sy">
32
+ <template partial='head'>
33
+ <tr>
34
+ <th>
35
+ <nobr><input type="checkbox" onClick="event.cancelBubble = true"
36
+ :checked="$parent.$parent.$parent.checkAll" @change="$parent.$parent.$parent.setCheckAll()" />全选
37
+ </nobr>
38
+ </th>
39
+ <th>
40
+ <nobr>用户编号</nobr>
41
+ </th>
42
+ <th>
43
+ <nobr>用户名</nobr>
44
+ </th>
45
+ <th>
46
+ <nobr>预约时间</nobr>
47
+ </th>
48
+ <th>
49
+ <nobr>安检员</nobr>
50
+ </th>
51
+ <th>
52
+ <nobr>备注</nobr>
53
+ </th>
54
+ </tr>
55
+ </template>
56
+ <template partial='body'>
57
+ <td style="text-align: center;white-space:nowrap;"><input type="checkbox" @click="$event.cancelBubble = true"
58
+ :checked="$parent.$parent.$parent.isChecked(row.f_userinfo_id)"
59
+ @change="$parent.$parent.$parent.setCheckes(row.f_userinfo_id)"></input></td>
60
+ <td style="text-align: center;white-space:nowrap;">{{ row.f_userinfo_code }}</td>
61
+ <td style="text-align: center;white-space:nowrap;">{{ row.f_user_name }}</td>
62
+ <td style="text-align: center;white-space:nowrap;">{{ row.f_handler_time }}</td>
63
+ <td style="text-align: center;white-space:nowrap;">{{ row.f_handlercheck_name }}</td>
64
+ <td style="text-align: center;white-space:nowrap;">{{ row.f_safe_remark }}</td>
65
+ </template>
66
+ </data-grid>
67
+ </criteria-paged>
68
+ <modal :show.sync="selecetChecker" :backdrop="false">
69
+ <div slot="modal-header" class="modal-header">
70
+ </div>
71
+ <div slot="modal-body" class="modal-body">
72
+ <div class="row">
73
+ <div style="margin: 0">
74
+ <label class="control-label">安&nbsp;&nbsp;检&nbsp;&nbsp;员</label>
75
+ <v-select :value.sync="changeData.f_handlercheck_name" v-model="changeData.f_handlercheck_name"
76
+ :value-single="false" clear-button :options='checkers' placeholder='安检员'></v-select>
77
+ </div>
78
+ <div style="margin: 0">
79
+ <label class="control-label" >备&emsp;&emsp;注</label>
80
+ <input class="input_search" type="text" style="margin-left: 5px;width: 60%" v-model="changeData.f_safe_remark" placeholder="备注">
81
+ </div>
82
+ </div>
83
+ </div>
84
+ <div slot="modal-footer" class="modal-footer" style="text-align: center">
85
+ <button class="button_search" style="margin-right: 20px" @click="ok">确认</button>
86
+ <button class="button_search" @click="selecetChecker = false">取消</button>
87
+ </div>
88
+ </modal>
89
+ </div>
90
+ </template>
91
+ <script>
92
+ import { PagedList } from 'vue-client'
93
+ import HttpResetClass from "vue-client/src/plugins/HttpResetClass";
94
+ import co from 'co'
95
+ import Vue from 'vue'
96
+ import * as Util from '../../components/Util'
97
+
98
+ let select = function* (self) {
99
+ let http = new HttpResetClass()
100
+ let getGasman = yield http.load('POST', '/rs/search', {
101
+ source: 'this.getParentByType($organization$).getChildByName($安检员$).getUsers()',
102
+ userid: self.$login.f.id
103
+ }, { resolveMsg: null, rejectMsg: null })
104
+ //tag
105
+ self.checkers.push({ label: '全部', value: '' })
106
+ getGasman.data.forEach((checker) => {
107
+ self.checkers.push({ label: checker.name, value: checker })
108
+ })
109
+ }
110
+ export default {
111
+ title: '隐患查询',
112
+ data() {
113
+ let model = new PagedList('api/af-safecheck/sql/safe_singleTable_OrderBy', 20, {
114
+ items: "'*'",
115
+ tablename: "'t_userinfo'",
116
+ orderitem: "'f_handler_time desc'"
117
+ })
118
+ return {
119
+ f: this.$login.f,
120
+ model: model,
121
+ changeData: {},
122
+ criteriaShow: false,
123
+ selecetChecker: false,
124
+ checkAll: false,
125
+ timercount: 0,
126
+ showModal2: false,
127
+ repairTypeOptions: this.$appdata.getParam('报修类型'),
128
+ dispatchTypeOptions: [{ label: '派发给站点', value: '派发给站点' }, { label: '派发给维修员', value: '派发给维修员' }],
129
+ checkes: [],
130
+ showModal: false,
131
+ f_check_plan: { f_plan_name: '', id: '' },
132
+ sumsmodel: {},
133
+ resids: {},
134
+ all: false,
135
+ fields: {},
136
+
137
+ selectData: {
138
+ dispatchType: '',
139
+ f_repairman: '',
140
+ f_remarks: '',
141
+ f_repairtype: ''
142
+ },
143
+ progressbarWidth: '0',
144
+ modelval: [],
145
+ isbusy: false,
146
+ transfer: null,
147
+ checkers: [],
148
+ showModal3: false,
149
+ toRepairCount: 0,
150
+ sliceArea: [],
151
+ callSends: [],
152
+ cbc: [],
153
+ repairedOptions: [{ label: '全部', value: '' }, { label: '已修', value: '已修' }, { label: '未修', value: '未修' }],
154
+ repairers: [],
155
+ cbcs: [],
156
+ thead: '',
157
+ headData: ['入户状态', '用户编号', '用户名', '用户电话', '用户小区', '用户地址', '安检时间', '安检员', '计划名', '是否有隐患', '隐患数', '隐患明细', '处理数', '完成数', '处理情况', '完成情况', '维修员'],
158
+ bodyData: ['f_entry_status', 'f_userinfo_code', 'f_user_name', 'f_user_phone', 'f_residential_area', 'f_address', 'f_offsite_time', 'f_checker_name', 'f_plan_name', 'f_has_defect', 'f_defect_count', 'defecttext', 'f_deal_count', 'f_repair_count', 'f_is_deal', 'f_is_repair', 'f_repairman'],
159
+ }
160
+ },
161
+ props: {
162
+ style: {
163
+ type: String,
164
+ default: 'col-sm-2 form-group'
165
+ },
166
+ style2: {
167
+ type: String,
168
+ default: 'col-sm-4 form-group'
169
+ }
170
+
171
+ },
172
+
173
+ methods: {
174
+ yyChange(type) {
175
+ if (!this.checkAll && this.checkes.length === 0) {
176
+ this.$showMessage('请选择用户')
177
+ return
178
+ }
179
+ if (type == 1) {
180
+ this.selecetChecker = true
181
+ } else {
182
+ let userinfoIds = []
183
+ if (this.checkAll) {
184
+ userinfoIds = this.model.rows.map(row => {
185
+ return `'${row.f_userinfo_id}'`
186
+ })
187
+ } else if (this.checkes.length > 0) {
188
+ userinfoIds = this.checkes
189
+ }
190
+ let sql = `update t_userinfo set f_handler_time = null,f_handler_state= null,f_handlercheck_id=null,f_handlercheck_name=null,f_safe_remark=null,f_contact_phone=null,f_safe_urgency=null,f_safe_isUrgent=null,f_service_id=null where f_userinfo_id in (${userinfoIds.join()})`
191
+ new HttpResetClass().load('POST', 'api/af-safecheck/logic/runSQL', { data: { sql: sql } }, { resolveMsg: null, rejectMsg: '取消预约失败' }).then(() => {
192
+ this.$refs.paged.$refs.criteria.search()
193
+ }).catch(()=>{
194
+ this.$showMessage('取消预约失败')
195
+ })
196
+ }
197
+ },
198
+ getSiteRes(obj) {
199
+ console.log('siteRes ---> ')
200
+ console.log(obj)
201
+ if (obj.resids[0]) {
202
+ this.selectData.f_meetunit = obj.res.join('.')
203
+ this.selectData.f_reciever = obj.resids.join('.')
204
+ this.selectData.f_outlets = obj.res[obj.res.length - 1]
205
+ } else {
206
+ this.selectData.f_meetunit = ''
207
+ this.selectData.f_reciever = ''
208
+ this.selectData.f_outlets = ''
209
+ }
210
+ },
211
+ trouble(val) {
212
+ // return val.replaceAll("'",'')
213
+ // .replaceAll("\"",'')
214
+ // .replaceAll("{",'')
215
+ // .replaceAll("}",'')
216
+ // .replaceAll("]",'')
217
+ // .replaceAll("[",'')
218
+ // .replaceAll("result:",'')
219
+ // .replaceAll("data:",'')
220
+ // .replaceAll("有隐患",'')
221
+ // .replaceAll(",",'')
222
+
223
+
224
+ const defect_content = JSON.parse(val)
225
+ let result = ''
226
+ if (defect_content.data) {
227
+ const jsonData = defect_content.data
228
+ for (const itemdata of jsonData) {
229
+ const keys = Object.keys(itemdata)
230
+ for (const itm of keys) {
231
+ const value = itemdata[itm]
232
+ result += itm + ':' + value
233
+ }
234
+ }
235
+ }
236
+ return result
237
+ },
238
+ getEmp() {
239
+ let val = { source: 'this.getParentByType($organization$).getSpecialResByType($user$).where(row.getAttributes().get($rolestr$)!=null ).where(row.getAttributes().get($rolestr$).indexOf($维修员$) != -1))', userid: `${this.$login.f.id}` }
240
+ let http = new HttpResetClass()
241
+ http.load('POST', '/rs/search', { data: val }, { resolveMsg: null, rejectMsg: null }).then((res) => {
242
+ let str = `'`
243
+ res.data.forEach((item, idx, arr) => {
244
+ //tag
245
+ if (idx + 1 == arr.length) {
246
+ str += item.id + `'`
247
+ } else {
248
+ str += item.id + `','`
249
+ }
250
+
251
+ })
252
+ let http1 = new HttpResetClass()
253
+ http1.load('POST', 'api/af-safecheck/sql/tel_singleTable_OrderBy', {
254
+ data: {
255
+ items: 'id,f_user_telephone',
256
+ tablename: 't_user',
257
+ condition: `id in (${str})`,
258
+ orderitem: 'id'
259
+ }
260
+ }, { resolveMsg: null, rejectMsg: null }).then((ress) => {
261
+
262
+ res.data.forEach((user) => {
263
+ try {
264
+ ress.data.forEach((tel, tidx, arr) => {
265
+ //tag
266
+ if (user.id == tel.id) {
267
+ this.repairers.push({ label: `${user.name}:${tel.f_user_telephone}`, value: user.name })
268
+ ress.data.splice(tidx, 1)
269
+ //tag
270
+ throw new Error("跳出循环");
271
+ }
272
+ })
273
+ } catch (e) {
274
+ //tag
275
+ }
276
+ })
277
+ })
278
+
279
+ })
280
+ },
281
+ toRepair() {
282
+ if (this.checkes.length == 0) {
283
+ return this.$showMessage('请先选择需要转维修的用户!')
284
+ }
285
+ this.showModal2 = true
286
+ },
287
+ async rectification() {
288
+
289
+ if (this.selectData.dispatchType) {
290
+ if (this.selectData.dispatchType == '派发给站点') {
291
+ if (!this.selectData.f_reciever) {
292
+ this.$showMessage('请选择部门!')
293
+ return
294
+ }
295
+ } else {
296
+ if (!this.selectData.f_repairman) {
297
+ this.$showMessage('请选择维修员!')
298
+ return
299
+ }
300
+ }
301
+ } else {
302
+ this.$showMessage('请选择派发类型!')
303
+ return
304
+ }
305
+
306
+ if (!this.selectData.f_repairtype) {
307
+ this.$showMessage('请选择报修类型!')
308
+ return
309
+ }
310
+ this.showModal3 = true
311
+ let act = {}
312
+ let toRepair = ''
313
+ let successCount = 0
314
+ if (this.selectData.dispatchType == '派发给站点') {
315
+ act = { f_meetunit: this.selectData.f_meetunit, f_reciever: this.selectData.f_reciever, f_service_acitivity_type: '派单' }
316
+ toRepair = null
317
+ } else {
318
+ console.log('派发给维修员---------' + this.selectData.f_repairman)
319
+ act = { f_meetunit: '', f_reciever: this.selectData.f_repairman, f_service_acitivity_type: '派单' }
320
+ toRepair = '一级派单'
321
+ }
322
+ let rep = {
323
+ loginUser: {
324
+ name: this.$login.f.name,
325
+ ename: this.$login.f.ename
326
+ },
327
+ f_meetunit: this.$login.f.deps,
328
+ f_attendant: this.$login.f.name,
329
+ f_outlets: this.$login.f.deps,
330
+ f_remarks: this.selectData.f_remarks,
331
+ f_repairtype: this.selectData.f_repairtype,
332
+ toRepair: toRepair,
333
+ activity: act
334
+ }
335
+ for (let i = 0; i < this.checkes.length; i++) {
336
+ try {
337
+ let result = await new HttpResetClass().load('post', '/api/af-safecheck/logic/phoneUploadRectification', {
338
+ id: this.checkes[i],
339
+ repData: rep,
340
+ source: 'pc'
341
+ }, { resolveMsg: null, rejectMsg: null })
342
+ if (result.data.code == 200) {
343
+ successCount += result.data.successcon
344
+ this.progressbarWidth = Math.ceil((i + 1) * 100 / (this.checkes.length))
345
+ }
346
+ } catch (e) {
347
+ this.showModal3 = false
348
+ this.$showMessage('网络异常,请稍后再试!')
349
+ return
350
+ }
351
+ }
352
+ this.showModal3 = false
353
+ this.cancel1()
354
+ this.$showMessage('本次转维修成功' + successCount + '单')
355
+ },
356
+ /*async rectification(){
357
+ this.isbusy =true
358
+ console.log("----this.checkes",this.checkes.toString())
359
+ console.log("----this.getcon()",this.getcon())
360
+ if(this.checkes.length==0){
361
+ return this.$showMessage('请先选择需要转维修的用户!')
362
+ }
363
+ // if (this.checkAll){
364
+ let data={
365
+ f_filialeids: this.model.params.f_filialeids,
366
+ f_defect_content: this.model.params.f_defect_content,
367
+ condition: `${this.model.params.condition} and id in(${this.getcon()})`
368
+ }
369
+ let res1= await new HttpResetClass().load('post','api/af-safecheck/sql/GetCheckPaperByDefectNew',{data: data })
370
+ for (let i = 0; i < res1.data.length; i++) {
371
+ let data1={
372
+ f_paper_id: res1.data[i].id,
373
+ condition:`f_repaire_type = '隐患未处理'`
374
+ }
375
+ let res2 = await new HttpResetClass().load('POST' , 'api/af-safecheck/sql/GetDefectByPaperIdNew' , {data: data1 } )
376
+ //tag
377
+ if(res2.data.length==0){
378
+ continue
379
+ }
380
+ const uploadData = {
381
+ model: {
382
+ serviceacitivity: [{
383
+ f_service_acitivity_type: '派单'
384
+ }],
385
+ f_repairitems: {},
386
+ failure: '',
387
+ f_source: '安检',
388
+ f_service_id: '',
389
+ f_contact_phone: res1.data[i].f_user_phone,
390
+ f_meetunit: this.$login.f.deps,
391
+ f_phone: '',
392
+ f_user_name: res1.data[i].f_user_name,
393
+ f_address: res1.data[i].f_address,
394
+ f_repair_date: Util.getNowDate(),
395
+ f_reciever: '',
396
+ f_remarks: this.selectData.f_remarks,
397
+ f_user_type: res1.data[i].f_check_type,
398
+ f_area: '',
399
+ f_unit_name: '',
400
+ f_street: res1.data[i].f_street,
401
+ f_residential_area: res1.data[i].f_residential_area,
402
+ f_building: res1.data[i].f_building,
403
+ f_unit: res1.data[i].f_unit,
404
+ f_floor: res1.data[i].f_floor,
405
+ f_room: res1.data[i].f_room,
406
+ aState: '',
407
+ f_repairtype: this.selectData.f_repairtype,
408
+ f_userinfo_id: res1.data[i].f_userinfo_id,
409
+ f_userinfo_code: res1.data[i].f_userinfo_code,
410
+ f_orgstr: res1.data[i].f_filialeid,
411
+ f_outlets: '',
412
+ f_attendant: this.$login.f.name
413
+ },
414
+ loginUser: {
415
+ name: this.$login.f.name,
416
+ ename: this.$login.f.ename
417
+ },
418
+ user: {
419
+ f_userinfo_id: res1.data[i].f_userinfo_id
420
+ },
421
+ callObj: null
422
+ }
423
+ uploadData.model.serviceacitivity[0].f_reciever = this.selectData.f_repairman
424
+ // uploadData.model.f_meetunit = self.$login.f.orgpathnames
425
+ // uploadData.model.f_orgstr = self.$login.f.orgpathstr
426
+ // uploadData.model.f_outlets = self.$login.f.f_parentname
427
+ uploadData.model.f_orgid = this.$login.f.orgid
428
+ uploadData.model.f_filiale = this.$login.f.org
429
+ uploadData.model.f_outlets = this.$login.f.deps
430
+ uploadData.model.f_filiale_id = this.$login.f.orgid
431
+ uploadData.toRepair = '一级派单'
432
+ // let res3 = await new HttpResetClass().load('post','/api/af-safecheck/sql/GetUserForRepaireNew', {data: {f_userinfo_id: res1.data[i].f_userinfo_id}})
433
+ // uploadData.model = Object.assign(uploadData.model, res3.data[0])
434
+ let failure = []
435
+ res2.data.forEach(row => {
436
+ console.log('row.f_item_value',row.f_item_value)
437
+ failure.push({
438
+ f_failure_type: row.f_item_name,
439
+ failurecase: row.f_item_value?row.f_item_value.split(','):''
440
+ })
441
+ })
442
+ uploadData.model.failure = failure
443
+ // 拼接repairitems
444
+ let rows = JSON.parse(JSON.stringify(res2.data))
445
+ let repairitems = {
446
+ data: []
447
+ }
448
+ let safecheckOptions = [{"data": "已处理"}, {"data": "未处理"}]
449
+ // 取隐患未处理的
450
+ rows = rows.filter(row => row.f_repaire_type == '隐患未处理')
451
+ //tag)
452
+ // 开始拼接
453
+ rows.forEach(row => {
454
+ let existIndex = -1
455
+ // 判断该设备是否已经存在
456
+ for (let i = 0; i < repairitems.data.length; i++) {
457
+ if (repairitems.data[i].f_type == row.f_device_type) {
458
+ existIndex = i
459
+ break
460
+ }
461
+ }
462
+ if (existIndex == -1) {
463
+ // 不存在则新建
464
+ let newItem = {
465
+ f_type: row.f_device_type,
466
+ details: [{
467
+ f_defect_id: row.id,
468
+ f_project: `${row.f_item_name}:${row.f_item_value}`,
469
+ type: 'selector',
470
+ options: safecheckOptions
471
+ }]
472
+ }
473
+ repairitems.data.push(newItem)
474
+ } else {
475
+ // 存在则追加
476
+ repairitems.data[existIndex].details.push({
477
+ f_defect_id: row.id,
478
+ f_project: `${row.f_item_name}:${row.f_item_value}`,
479
+ type: 'selector',
480
+ options: safecheckOptions
481
+ })
482
+ }
483
+ })
484
+ uploadData.model.f_repairitems = repairitems
485
+ uploadData.rows=rows
486
+ //tag)
487
+ //tag
488
+ console.log('uploadData---', uploadData)
489
+ if (uploadData.model.f_repairitems.data.length>0){
490
+ this.callSends.push(uploadData)
491
+ }else{
492
+ //tag
493
+ }
494
+ }
495
+ //tag)
496
+ let timer = setInterval(async ()=>{
497
+ this.showModal3=true
498
+ this.isbusy=false
499
+ if (this.timercount<this.callSends.length){
500
+ //tag)
501
+ let rows=this.callSends[this.timercount].rows
502
+ //tag)
503
+ let result = await this.$resetpost('/rs/logic/callerSend1', this.callSends[this.timercount])
504
+ //tag)
505
+ if (result.data.f_service_id) {
506
+ const data = {
507
+ f_paper_id: rows[0].f_paper_id,
508
+ f_service_id: result.data.f_service_id,
509
+ itemsId: this.$login.convertToIn(rows.map(row => row.id))
510
+ }
511
+ //tag
512
+ let updateRes = await this.$resetpost('/rs/logic/updateDefectStateNew', data)
513
+ }
514
+ this.toRepairCount++
515
+ //tag
516
+ this.timercount++
517
+ }else{
518
+ clearInterval(timer)
519
+ //tag
520
+ this.callSends=[]
521
+ this.timercount=0
522
+ this.showModal3=false
523
+ this.cancel1()
524
+ this.$showMessage('本次转维修成功'+this.toRepairCount+'单')
525
+ this.toRepairCount=0
526
+ }
527
+ }, 3000)
528
+ },*/
529
+ cancel1() {
530
+ this.showModal2 = false
531
+ this.selectData = {
532
+ dispatchType: '',
533
+ f_repairman: '',
534
+ f_remarks: '',
535
+ f_repairtype: ''
536
+ }
537
+ },
538
+ sleep(d) {
539
+ //tag)
540
+ var t = Date.now()
541
+ while (Date.now - t <= d) {
542
+
543
+ }
544
+ //tag)
545
+ },
546
+ isChecked(v) {
547
+ // 如果全选,不在的按选中算,否则,在的按选中算
548
+ if (this.checkAll) {
549
+ return this.checkes.indexOf(v) == -1
550
+ } else {
551
+ return this.checkes.indexOf(v) != -1
552
+ }
553
+ },
554
+ setCheckAll() {
555
+ this.checkAll = this.checkAll ? false : true;
556
+ // 全选改变后,清空选中数据
557
+ this.checkes = []
558
+ },
559
+ setCheckes(id) {
560
+ let index = this.checkes.indexOf(id)
561
+ if (index < 0) {
562
+ this.checkes.push(id)
563
+ } else {
564
+ this.checkes.splice(index, 1)
565
+ }
566
+ },
567
+
568
+ getmeterbook(val) {
569
+ this.cbc = []
570
+ this.cbc.push({
571
+ label: '全部',
572
+ value: ''
573
+ })
574
+ if (val == '') {
575
+
576
+ this.cbcs.forEach(res => {
577
+ this.cbc.push({
578
+ label: res.f_book_name,
579
+ value: res.id
580
+ })
581
+ })
582
+ } else {
583
+ this.cbcs.forEach(res => {
584
+ if (res.f_book_slice_area == val) {
585
+ this.cbc.push({
586
+ label: res.f_book_name,
587
+ value: res.id
588
+ })
589
+ }
590
+ })
591
+ }
592
+ },
593
+
594
+ // Mreadibook(val){
595
+ // //tag
596
+ // //tag
597
+ // this.sliceArea=[]
598
+ // if (val){
599
+ // new HttpResetClass().load('POST',`/api/af-safecheck/sql/tel_singleTable_OrderBy`, {data: {
600
+ // items: 'name',
601
+ // tablename: 't_zone',
602
+ // condition: `parentid in ${val}`,
603
+ // orderitem: 'id'
604
+ // }}, {resolveMsg: null, rejectMsg: null}).then((res) => {
605
+ // this.sliceArea.push({
606
+ // label:'全部',
607
+ // value:''
608
+ // })
609
+ // res.data.forEach(ress=>{
610
+ // this.sliceArea.push({
611
+ // label:ress.name,
612
+ // value:ress.name
613
+ // })
614
+ // })
615
+ //
616
+ // })
617
+ // }
618
+ // },
619
+ // getAllMeterBook(val){
620
+ // //tag
621
+ // //tag
622
+ // this.cbcs=[]
623
+ // if (val){
624
+ // new HttpResetClass().load('POST',`/api/af-safecheck/sql/tel_singleTable_OrderBy`, {data: {
625
+ // items: 'f_book_name,f_book_slice_area,id',
626
+ // tablename: 't_meter_book',
627
+ // condition: `f_filiale_id in ${val}`,
628
+ // orderitem: 'id'
629
+ // }}, {resolveMsg: null, rejectMsg: null}).then((res) => {
630
+ // res.data.forEach(ress=>{
631
+ // this.cbcs.push({
632
+ // id:ress.id,
633
+ // f_book_name:ress.f_book_name,
634
+ // f_book_slice_area:ress.f_book_slice_area
635
+ // })
636
+ // })
637
+ // this.cbc=[]
638
+ // this.cbc.push({
639
+ // label:'全部',
640
+ // value:''
641
+ // })
642
+ // this.cbcs.forEach(res=>{
643
+ // this.cbc.push({
644
+ // label:res.f_book_name,
645
+ // value:res.id
646
+ // })
647
+ // })
648
+ // })
649
+ // }
650
+ // },
651
+ hiddenr() {
652
+ this.$parent.showItem = !this.$parent.showItem
653
+ },
654
+ hidden() {
655
+ this.criteriaShow = !this.criteriaShow
656
+ },
657
+ search(args) {
658
+ args.condition += ` and f_handler_state = '已预约'`
659
+ this.model.search(args.condition, args.model)
660
+ },
661
+ getRes(obj) {
662
+ //tag
663
+ this.resids = { res: obj.res[0], resids: obj.resids[0] }
664
+ this.model.f_filialeids = this.$login.convertToIn(obj.resids);
665
+ // this.Mreadibook(this.model.f_filialeids)
666
+ // this.getAllMeterBook(this.model.f_filialeids)
667
+ },
668
+ showChooser() {
669
+ this.showModal = true
670
+ },
671
+ ok() {
672
+ if (!this.changeData.f_handlercheck_name || this.changeData.f_handlercheck_name.length == 0) {
673
+ this.$showMessage('请选择安检员')
674
+ return
675
+ }
676
+ let userinfoIds = []
677
+ if (this.checkAll) {
678
+ userinfoIds = this.model.rows.map(row => {
679
+ return `'${row.f_userinfo_id}'`
680
+ })
681
+ } else if (this.checkes.length > 0) {
682
+ userinfoIds = this.checkes
683
+ }
684
+ let sql = `update t_userinfo set f_handler_time = '${Util.toStandardTimeString()}',f_handlercheck_id='${this.changeData.f_handlercheck_name[0].id}',f_handlercheck_name='${this.changeData.f_handlercheck_name[0].name}',f_safe_remark='${this.changeData.f_safe_remark}' where f_userinfo_id in (${userinfoIds.join()})`
685
+ new HttpResetClass().load('POST', 'api/af-safecheck/logic/runSQL', { data: { sql: sql } }, { resolveMsg: null, rejectMsg: '预约转单失败' }).then(() => {
686
+ this.$refs.paged.$refs.criteria.search()
687
+ this.changeData = {}
688
+ this.selecetChecker = false
689
+ }).catch(()=>{
690
+ this.$showMessage('转单失败')
691
+ })
692
+ },
693
+ cancel() {
694
+ this.showModal = false
695
+ this.f_check_plan = { f_plan_name: '', id: '' }
696
+ }
697
+ },
698
+ ready() {
699
+ //tag
700
+ this.transfer = Vue.$appdata.getSingleValue('安检转工单')
701
+ this.$refs.paged.$refs.criteria.model.f_has_defect = '有隐患'
702
+ this.getEmp()
703
+ let gen = select(this)
704
+ // this.Mreadibook(`('${this.$login.f.orgid}')`)
705
+ co(gen)
706
+ },
707
+ watch: {
708
+ 'timercount'() {
709
+ if (this.timercount === 0) {
710
+ this.progressbarWidth = '0'
711
+ } else {
712
+ //tag
713
+ //tag
714
+ this.progressbarWidth = parseInt(this.timercount * 100 / (this.callSends.length + 1))
715
+ }
716
+
717
+ }
718
+ },
719
+ computed: {
720
+ selected() {
721
+ return this.$refs.paged.$refs.grid.selected
722
+ },
723
+ getfield() {
724
+ //tag
725
+ let data = {}
726
+ this.bodyData.forEach((value, index) => {
727
+ data[this.bodyData[index]] = this.headData[index]
728
+ })
729
+ //合计字段打印
730
+ this.tfoot = `<tr><th colspan=${this.modelval.length}>全表汇总信息: `
731
+ if (this.sumsmodel) {
732
+ Object.keys(this.sumsmodel).forEach((key) => {
733
+ this.tfoot += this.fields[key] + '合计: ' + `<font color="blue">${this.sumsmodel[key]} </font>`
734
+ })
735
+ } else {
736
+ this.tfoot += '暂无'
737
+ }
738
+ this.tfoot += '</th></tr>'
739
+ return data
740
+ }
741
+ }
742
+ }
743
+ </script>