safecheck-client 3.0.39-48 → 3.0.39-49

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