safecheck-client 3.0.35-gongyi → 3.0.35-gongyi-3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,910 +1,964 @@
1
- <template>
2
- <div class="flex-row">
3
- <div class="basic-main">
4
- <criteria-paged :model="model" v-ref:paged>
5
- <criteria partial='criteria' class="search_area" @condition-changed='$parent.selfSearch' v-ref:criteria>
6
- <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
7
- <div class="row">
8
- <div class="form-group col-sm-2">
9
- <label class="font_normal_body">客户编号</label>
10
- <input type="text" class="input_search" v-model="model.f_userinfo_code"
11
- style="width: 60%" placeholder="客户编号" condition="tui.f_userinfo_code='{}'">
12
- </div>
13
- <div class="form-group col-sm-2">
14
- <label class="font_normal_body">客户名称</label>
15
- <input type="text" class="input_search" v-model="model.f_user_name"
16
- style="width: 60%" placeholder="客户名称" condition="tui.f_user_name like '{}%'">
17
- </div>
18
- <div class="form-group col-sm-2">
19
- <label class="font_normal_body">客户电话</label>
20
- <input type="text" class="input_search" v-model="model.f_user_phone"
21
- style="width: 60%" placeholder="客户电话" condition="tui.f_user_phone like '{}%'">
22
- </div>
23
- <div class="form-group col-sm-2">
24
- <label class="font_normal_body">客户地址</label>
25
- <input type="text" class="input_search" v-model="model.f_address"
26
- style="width: 60%" placeholder="客户地址" condition="tua.f_address like '%{}%'">
27
- </div>
28
-
29
- <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right">
30
-
31
- <export-excel-safe :data="$parent.$parent.searchData"
32
- :field="$parent.$parent.excelHeaders"
33
- progress="safeGetExportProgress"
34
- sqlurl="rs/logic/SafeExportExcel" sql-name="defectDetails"
35
- template-name='安检隐患明细'></export-excel-safe>
36
-
37
-
38
- <button class="button_spacing button_search" @click="search()">查询</button>
39
- <!-- <div style="float: right" class="button_spacing"-->
40
- <!-- :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"-->
41
- <!-- @click="$parent.$parent.hidden()"></div>-->
42
- </div>
43
- <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right" v-if="$parent.$parent.permission === 'c1'">
44
-
45
-
46
- <button class="button_spacing button_search" @click="$parent.$parent.beforeCreateBook">创建安检册</button>
47
-
48
- </div>
49
- </div>
50
- <div class="row">
51
- <div class="col-sm-2 form-group" style="margin-top: 0px">
52
- <label class="font_normal_body">公&emsp;&emsp;司</label>
53
- <right-tree-safe @re-res="$parent.$parent.getResm" v-model="model.f_orgid" condition="tua.f_orgid in {}"></right-tree-safe>
54
- </div>
55
- <div class="form-group col-sm-2" style="margin-top: 0px">
56
- <label class="font_normal_body">小&emsp;&emsp;区</label>
57
- <input type="text" class="input_search" v-model="model.f_residential_area"
58
- style="width: 60%" placeholder="小区" condition="tua.f_residential_area like '%{}%'">
59
- </div>
60
- <div class="col-sm-2 form-group" style="margin-top: 0px">
61
-
62
- <label class="font_normal_body" title="用户类型">用户类型</label>
63
- <v-select :value.sync="model.f_user_type" v-model='model.f_user_type'
64
- :value-single="true" style="width: 60%"
65
- class="select_list select"
66
- :options='$parent.$parent.usertypes' placeholder='用户类型'
67
- close-on-select
68
- condition="tuf.f_user_type ='{}'"></v-select>
69
-
70
- </div>
71
- <!-- <div class="col-sm-2 form-group" style="margin: 0">
72
-
73
- <label class="font_normal_body" title="安检用户状态">用户状态</label>
74
- <v-select :value.sync="model.f_user_state" v-model='model.f_user_state'
75
- :value-single="true" style="width: 60%"
76
- class="select_list select"
77
- :options='$parent.$parent.userstates' placeholder='用户状态'
78
- close-on-select
79
- condition="tui.f_user_state ='{}'"></v-select>
80
-
81
- </div> -->
82
- <div class="col-sm-2 form-group" style="margin-top: 0px">
83
-
84
- <label class="font_normal_body" title="用气性质">用气性质</label>
85
- <v-select :value.sync="model.f_gasproperties" v-model='model.f_gasproperties'
86
- :value-single="true" style="width: 60%"
87
- class="select_list select"
88
- :options='$parent.$parent.gasproperties' placeholder='用气性质'
89
- close-on-select
90
- condition="tuf.f_gasproperties ='{}'"></v-select>
91
-
92
- </div>
93
- <div class="col-sm-2 form-group" style="margin-top: 0px">
94
-
95
- <label class="font_normal_body" title="气表类型">气表类型</label>
96
- <v-select
97
- class="select select_list"
98
- :value.sync="model.f_meter_classify"
99
- v-model="model.f_meter_classify"
100
- :options='$parent.$parent.meter_classifys'
101
- placeholder='请选择'
102
- condition="tuf.f_meter_classify='{}'"
103
- :search="false"
104
- style="width: 60%"
105
- close-on-select
106
- value-single
107
- ></v-select>
108
- </div>
109
- <div class="col-sm-2 form-group" style="margin-top: 0px">
110
-
111
- <label class="font_normal_body">气表品牌</label>
112
- <v-select :value.sync="model.gasbrand" v-model='model.gasbrand'
113
- :value-single="true" style="width: 60%"
114
- class="select_list select"
115
- :options='$parent.$parent.getgasbrand' placeholder='气表品牌'
116
- close-on-select
117
- ></v-select>
118
- </div>
119
- <div class="col-sm-2 form-group" style="margin-top: 0px">
120
-
121
- <label class="font_normal_body">气表型号</label>
122
- <v-select :value.sync="model.gasmodel" v-model='model.gasmodel'
123
- :value-single="true" style="width: 60%"
124
- class="select_list select"
125
- :options='$parent.$parent.getgasmodel' placeholder='气表型号'
126
- close-on-select
127
- condition="tuf.f_gasmodel_id = {}"></v-select>
128
-
129
- </div>
130
- <div class="col-sm-2 form-group" style="margin-top: 0px">
131
-
132
- <label class="font_normal_body" title="房屋类型">房屋类型</label>
133
- <v-select :value.sync="model.f_house_type" v-model='model.f_house_type'
134
- :value-single="true" style="width: 60%"
135
- class="select_list select"
136
- :options='$parent.$parent.housetypes' placeholder='房屋类型'
137
- close-on-select
138
- condition="tui.f_house_type = {}"></v-select>
139
-
140
- </div>
141
- <div class="col-sm-2 form-group" style="margin-top: 0px">
142
-
143
- <label class="font_normal_body" title="安装位置">安装位置</label>
144
- <v-select :value.sync="model.f_position" v-model='model.f_position'
145
- :value-single="true" style="width: 60%"
146
- class="select_list select"
147
- :options='$parent.$parent.positions' placeholder='安装位置'
148
- close-on-select
149
- condition="tuf.f_position = {}"></v-select>
150
-
151
- </div>
152
- <div class="col-sm-2 form-group" style="margin-top: 0px">
153
-
154
- <label class="font_normal_body" title="使用类型">使用类型</label>
155
- <v-select :value.sync="model.f_usetype" v-model='model.f_usetype'
156
- :value-single="true" style="width: 60%"
157
- class="select_list select"
158
- :options='$parent.$parent.usetypes' placeholder='使用类型'
159
- close-on-select
160
- condition="tuf.f_usetype = {}"></v-select>
161
-
162
- </div>
163
- <div class="form-group col-sm-2" style="margin-top: 0px">
164
- <label class="font_normal_body">开户起始</label>
165
- <datepicker
166
- placeholder='开户起始'
167
- style="width:60%"
168
- :disabled-days-of-week="[]"
169
- :format="'yyyy-MM-dd'"
170
- :show-rest-button="reset"
171
- :value.sync="model.f_startfile_time"
172
- v-model="model.f_startfile_time"
173
- condition="tui.f_createfile_date >= '{} 00:00:00'">
174
- </datepicker>
175
- </div>
176
- <div class="form-group col-sm-2"style="margin-top: 0px" >
177
- <label class="font_normal_body">开户截止</label>
178
- <datepicker
179
- placeholder='开户截止'
180
- :disabled-days-of-week="[]"
181
- style="width:60%"
182
- :format="'yyyy-MM-dd'"
183
- :show-rest-button="reset"
184
- :value.sync="model.f_endfile_time"
185
- v-model="model.f_endfile_time"
186
- condition="tui.f_createfile_date <= '{} 00:00:00'">
187
- </datepicker>
188
- </div>
189
- <div class="form-group col-sm-2" style="margin-top: 0px">
190
- <label class="font_normal_body">片&ensp;&ensp;&ensp;&ensp;区</label>
191
- <v-select
192
- class="select select_list"
193
- style="width:60%"
194
- :value.sync="model.f_book_slice_area"
195
- v-model="model.f_book_slice_area"
196
- :options='$parent.$parent.sliceArea'
197
- placeholder='片区'
198
- condition="tua.f_slice_area ='{}'"
199
- close-on-select
200
- value-single
201
- >
202
- </v-select>
203
- </div>
204
- <div class="form-group col-sm-2" style="margin-top: 0px">
205
- <label class="font_normal_body" title="安检状态">安检状态</label>
206
- <v-select
207
- class="select select_list"
208
- style="width:60%"
209
- :value.sync="model.f_last_check_state"
210
- v-model="model.f_last_check_state"
211
- :options='$parent.$parent.check_states'
212
- placeholder='安检状态'
213
- condition="tua.f_last_check_state ='{}'"
214
- close-on-select
215
- value-single
216
- >
217
- </v-select>
218
- </div>
219
- <div class="col-sm-2 form-group" style="margin-top: 0px">
220
-
221
- <label class="font_normal_body">安&ensp;检&ensp;册</label>
222
- <v-select :value.sync="model.f_check_book_id" v-model='model.f_check_book_id'
223
- :value-single="true" style="width: 60%"
224
- class="select_list select"
225
- :options='$parent.$parent.checkBooks' placeholder='安&ensp;检&ensp;册'
226
- close-on-select
227
- condition="f_check_book_id ='{}'"></v-select>
228
-
229
- </div>
230
- <div class="col-sm-2 form-group" style="margin-top: 0px">
231
-
232
- <label class="font_normal_body">是否划分</label>
233
- <v-select :value.sync="model.f_is_checkbook" v-model='model.f_is_checkbook'
234
- :value-single="true" style="width: 60%"
235
- class="select_list select"
236
- @change="$parent.$parent.changeState"
237
- :options='$parent.$parent.isCheckBook' placeholder='有无所属安检册'
238
- close-on-select
239
- condition="{}"></v-select>
240
-
241
- </div>
242
- <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right" v-if="$parent.$parent.permission === 'c1'">
243
-
244
-
245
- <button class="button_spacing button_search" @click="$parent.$parent.addUser">添加用户</button>
246
-
247
- </div>
248
- <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right">
249
-
250
-
251
- <button class="button_spacing button_search" @click="$parent.$parent.upUser">调整用户</button>
252
-
253
- </div>
254
- <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right" v-if="$parent.$parent.permission === 'c1'">
255
-
256
-
257
- <button class="button_spacing button_search" @click="$parent.$parent.delUser">移除用户</button>
258
-
259
- </div>
260
- </div>
261
- </div>
262
- </criteria>
263
- <data-grid class="list_area table_sy" style="overflow: hidden" :model="model" partial='list' v-ref:grid>
264
- <template partial='head'>
265
- <tr @dblclick.stop="">
266
- <th>
267
- <nobr><input type="checkbox" v-model="$parent.$parent.$parent.bookAll"></input>全选</nobr>
268
- </th>
269
- <th>
270
- <nobr>客户姓名</nobr>
271
- </th>
272
- <th>
273
- <nobr>客户编号</nobr>
274
- </th>
275
- <th>
276
- <nobr>客户类型</nobr>
277
- </th>
278
- <th>
279
- <nobr>客户电话</nobr>
280
- </th>
281
- <th>
282
- <nobr>客户地址</nobr>
283
- </th>
284
- <th>
285
- <nobr>所属安检册</nobr>
286
- </th>
287
- </tr>
288
- </template>
289
- <template partial='body'>
290
- <td style="text-align: center">
291
- <nobr><input type="checkbox" :checked="$parent.$parent.$parent.checkModel(row)"
292
- @change="$parent.$parent.$parent.checkChange(row, $event)"></input>
293
- </nobr>
294
- </td>
295
- <td style="text-align: center">{{ row.f_user_name }}</td>
296
- <td style="text-align: center">{{ row.f_userinfo_code }}</td>
297
- <td style="text-align: center">{{ row.f_user_type }}</td>
298
- <td style="text-align: center">{{ row.f_user_phone }}</td>
299
- <td style="text-align: center">{{ row.f_address }}</td>
300
- <td style="text-align: center">{{ row.f_check_book_name }}</td>
301
- </template>
302
- </data-grid>
303
- </criteria-paged>
304
- </div>
305
- <modal :show.sync="showModal" :backdrop="false">
306
- <div slot="modal-header" class="modal-header">
307
- <h4 class="modal-title">
308
- 创建安检册
309
- </h4>
310
- </div>
311
- <div slot="modal-body" class="modal-body">
312
- <div v-if="true">
313
- <div class="row" style="margin-top: 10px">
314
- <!-- <label class="control-label font text-left" style="float:left;margin-left:10%;margin-top:5px">安检册名称</label>-->
315
- <!-- <div class="col-xs-8 col-md-8">-->
316
- <!-- <input type="text" class="input_search" style="width: 70%;" v-model="checkBook.f_check_book_name"/>-->
317
- <!-- </div>-->
318
- <div class="col-sm-6 form-group" style="margin-top: 20px" v-if="permission === 'c1' && showModal ">
319
- <label class="font_normal_body">安检科室</label>
320
- <right-tree islist :userid="userid" :source="source" v-on:re-res="reres" :textContent="选择科室" :selectData="" v-ref:f_reciever>
321
- </right-tree>
322
- </div>
323
- <div class="col-sm-6 form-group" style="margin-top: 20px" v-if="permission === 'c2' ">
324
- <label class="font_normal_body">安&ensp;检&ensp;员</label>
325
- <v-select :value.sync="checkBook.f_checker_name" v-model='checkBook.f_checker_name'
326
- :value-single="true" style="width: 60%"
327
- class="select_list select"
328
- :options='checkers' placeholder='安检员'
329
- close-on-select></v-select>
330
- </div>
331
- <div class="form-group col-sm-6" style="margin-top: 20px">
332
- <label class="font_normal_body">安检册名</label>
333
- <input type="text" class="input_search" v-model="checkBook.f_check_book_name"
334
- style="width: 60%" >
335
- </div>
336
- <div class="form-group col-sm-6" style="margin-top: 20px">
337
- <label class="font_normal_body">执行日期</label>
338
- <datepicker
339
- :value.sync="checkBook.f_run_date"
340
- style="width: 60%"
341
- :format="'yyyy-MM-dd'"
342
- v-model="checkBook.f_run_date"
343
- >
344
- </datepicker>
345
- </div>
346
- <div class="form-group col-sm-6" style="margin-top: 20px">
347
- <label class="font_normal_body">执行周期</label>
348
- <input type="number" class="input_search" v-model="checkBook.f_around_time"
349
- style="width: 60%" >
350
- </div>
351
- <div class="form-group col-sm-6" style="margin-top: 20px">
352
- <label class="font_normal_body">周期单位</label>
353
- <v-select :value.sync="checkBook.f_around_unit" v-model='checkBook.f_around_unit'
354
- :value-single="true" style="width: 60%"
355
- class="select_list select"
356
- :options='aroundUnit' placeholder=''
357
- close-on-select></v-select>
358
- </div>
359
- </div>
360
- </div>
361
- </div>
362
- <div slot="modal-footer" class="modal-footer" style="text-align: center">
363
- <button class="button_search" style="margin-right: 20px" @click="ok">确认</button>
364
- <button class="button_search" @click="cancel">取消</button>
365
- </div>
366
- </modal>
367
- <modal :show.sync="showModal2" :backdrop="false">
368
- <div slot="modal-header" class="modal-header">
369
- <h4 class="modal-title">
370
- 添加用户
371
- </h4>
372
- </div>
373
- <div slot="modal-body" class="modal-body">
374
- <div v-if="true">
375
- <div class="row" style="margin-top: 10px">
376
- <div class="form-group col-sm-12" style="margin-top: 20px">
377
- <label class="font_normal_body">安&ensp;检&ensp;册</label>
378
- <v-select :value.sync="selectBook" v-model='selectBook'
379
- :value-single="true" style="width: 80%"
380
- class="select_list select"
381
- :options='checkBooks' placeholder=''
382
- close-on-select></v-select>
383
- </div>
384
- </div>
385
- </div>
386
- </div>
387
- <div slot="modal-footer" class="modal-footer" style="text-align: center">
388
- <button class="button_search" style="margin-right: 20px" @click="ok2">确认</button>
389
- <button class="button_search" @click="cancel2">取消</button>
390
- </div>
391
- </modal>
392
- <modal :show.sync="showModal3" :backdrop="false">
393
- <div slot="modal-header" class="modal-header">
394
- <h4 class="modal-title">
395
- 调整用户
396
- </h4>
397
- </div>
398
- <div slot="modal-body" class="modal-body">
399
- <div v-if="true">
400
- <div class="row" style="margin-top: 10px;text-align: center">
401
- <div class="form-group col-sm-12" style="margin-top: 20px">
402
- <label class="font_normal_body">安&ensp;检&ensp;册</label>
403
- <v-select :value.sync="selectBook" v-model='selectBook'
404
- :value-single="true" style="width: 80%"
405
- class="select_list select"
406
- :options='checkBooks' placeholder=''
407
- close-on-select></v-select>
408
- </div>
409
- </div>
410
- </div>
411
- </div>
412
- <div slot="modal-footer" class="modal-footer" style="text-align: center">
413
- <button class="button_search" style="margin-right: 20px" @click="ok3">确认</button>
414
- <button class="button_search" @click="cancel3">取消</button>
415
- </div>
416
- </modal>
417
-
418
- </div>
419
- </template>
420
-
421
- <script>
422
- import {PagedList, HttpResetClass} from 'vue-client'
423
- import * as Util from '../../components/Util'
424
-
425
- export default {
426
- title: '安检册管理',
427
- data () {
428
- let model = new PagedList('rs/sql/getUserByCheckBook', 20)
429
- return {
430
- model: model,
431
- criteriaShow: false,
432
- excelHeaders: {},
433
- checkBooks: [],
434
- f_orgid: '',
435
- bookAll: false,
436
- bookList: [],
437
- selectBook:'',
438
- // init:false,
439
- aroundUnit: [{label: '年', value: '年'}, {label: '月', value: '月'}, {label: '日', value: '月'}],
440
- isCheckBook: [{label: '全部', value: ''}, {label: '是', value: 'f_check_book_name is not null'}, {label: '否', value: 'f_check_book_name is null'}],
441
- isSearch: false,
442
- checkers:[],
443
- source:
444
- 'dep=this.getParentByType($organization$).getSpecialResByType($department$),' +
445
- 'tool.getFullTree(dep.where(row.hasSpecialRole($安检册二次分配$)))',
446
- userid: this.$login.f.id,
447
- checkBook: {
448
- f_check_book_name: '',
449
- f_run_date: '',
450
- f_around_time: '',
451
- f_around_unit: '',
452
- f_create_date: Util.toStandardDateString(),
453
- f_create_person: this.$login.f.name,
454
- f_orgid: this.$login.f.orgid,
455
- f_depid:'',
456
- f_dep:'',
457
- f_checker_name: '',
458
- f_checker_id:''
459
- },
460
- showModal: false,
461
- showModal2: false,
462
- showModal3: false,
463
- userstates:this.$appdata.getParam('安检用户状态')?[{label: '全部', value: ''}, ...this.$appdata.getParam('安检用户状态')]:[{label: '全部', value: ''}],
464
- usertypes:this.$appdata.getParam('用户类型')?[{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')]:[{label: '全部', value: ''}],
465
- gasproperties:this.$appdata.getParam('用气性质')?[{label: '全部', value: ''}, ...this.$appdata.getParam('用气性质')]:[{label: '全部', value: ''}],
466
- meter_classifys:this.$appdata.getParam('气表类型')?[{label: '全部', value: ''}, ...this.$appdata.getParam('气表类型')]:[{label: '全部', value: ''}],
467
- housetypes:this.$appdata.getParam('房屋类型')?[{label: '全部', value: ''}, ...this.$appdata.getParam('房屋类型')]:[{label: '全部', value: ''}],
468
- positions:this.$appdata.getParam('安装位置')?[{label: '全部', value: ''}, ...this.$appdata.getParam('安装位置')]:[{label: '全部', value: ''}],
469
- usetypes:this.$appdata.getParam('使用类型')?[{label: '全部', value: ''}, ...this.$appdata.getParam('使用类型')]:[{label: '全部', value: ''}],
470
- check_states:this.$appdata.getParam('安检状态')?[{label: '全部', value: ''}, ...this.$appdata.getParam('安检状态')]:[{label: '全部', value: ''}],
471
- meterbrands:[],
472
- sliceArea:[]
473
-
474
- }
475
- },
476
- props:['permission'],
477
- computed: {
478
- getgasbrand(){
479
- let ops=[{label:'全部',value:''}]
480
- this.meterbrands.forEach(b =>{
481
- ops.push({label:b.f_meter_brand,value:b})
482
- })
483
- return ops
484
- },
485
- getgasmodel(){
486
- let ops=[{label:'全部',value:''}]
487
- this.$refs.paged.$refs.criteria.model.gasmodel=''
488
- if(this.$refs.paged.$refs.criteria.model && this.$refs.paged.$refs.criteria.model.gasbrand){
489
- this.$refs.paged.$refs.criteria.model.gasbrand.gasmodel.forEach(b =>{
490
- ops.push({label:b.f_meter_style,value:b.id})
491
- })
492
- }
493
- return ops
494
- },
495
- searchData () {
496
- return {condition: this.model.condition}
497
- },
498
- bookCondition () {
499
- return this.model.condition
500
- },
501
- isCreateBook () {
502
- return this.$refs.paged.$refs.criteria.model.f_is_checkbook === 'f_check_book_name is null'
503
- },
504
- isChangeBook () {
505
- return this.$refs.paged.$refs.criteria.model.f_is_checkbook === 'f_check_book_name is not null'
506
- }
507
- },
508
- methods: {
509
- //片区获取
510
- async getSliceArea() {
511
- let http = new HttpResetClass()
512
- let getAllArea = await http.load('POST', '/rs/search', {
513
- source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
514
- userid: this.userlogin.id
515
- }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
516
- this.sliceArea = [{label: '全部', value: ''}]
517
- getAllArea.data.forEach((res) => {
518
- if(res.parentid==this.userlogin.orgid){
519
- this.sliceArea.push({label:res.name,value:res.name})
520
- }
521
- })
522
- console.log('片区' + this.sliceArea)
523
- },
524
- //片区改变-对应抄表册下拉重新赋值
525
- slice_areaChange(value) {
526
- console.log("下拉改变--"+value)
527
- if(!value){
528
- this.cbc=[]
529
- this.meterbooks.forEach((res) => {
530
- this.cbc.push({label: res.f_book_name, value: res.id})
531
- })
532
- }else{
533
- this.cbc=[]
534
- this.meterbooks.forEach((res) => {
535
- if(res.f_book_slice_area==value){
536
- this.cbc.push({label: res.f_book_name, value: res.id})
537
- }
538
- })
539
- }
540
- },
541
- // 获取气表品牌
542
- setConList(){
543
- new HttpResetClass().load("POST", `/rs/logic/getSaleInitData`, {data:{f_orgid:`${this.$login.f.orgid}`}}, {resolveMsg: null, rejectMsg: null}).then((res)=>{
544
- this.meterbrands=res.data.gasbrands
545
- })
546
- },
547
- reres(val){
548
- if (!val.resids || val.resids.length === 0 || val.resids[0] ==='undefined' || val.resids.length>1){
549
- return
550
- }
551
- console.log('val2',val)
552
- const resids = val.orgobj.filter(res=>res.resourcetype==='department')
553
- console.log('val2',resids)
554
- if (resids.length>0){
555
- this.checkBook.f_depid = resids[0].id
556
- this.checkBook.f_dep = resids[0].name
557
- }
558
- },
559
- clearBook(){
560
- this.checkBook ={
561
- f_check_book_name: '',
562
- f_run_date: '',
563
- f_around_time: '',
564
- f_around_unit: '',
565
- f_create_date: Util.toStandardDateString(),
566
- f_create_person: this.$login.f.name,
567
- f_orgid: this.$login.f.orgid,
568
- f_depid:'',
569
- f_dep:'',
570
- f_checker_name: '',
571
- f_checker_id:''
572
- }
573
- },
574
- async ok2() {
575
- if (!this.selectBook) {
576
- this.$showMessage('请选择安检册')
577
- return
578
- }
579
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
580
- let userCondition = ''
581
- if (this.bookList.length < 1) {
582
- console.log('bookCondition', this.bookCondition)
583
- userCondition = this.bookCondition
584
- } else {
585
- console.log('this.bookList', JSON.stringify(this.bookList))
586
-
587
- userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
588
- userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
589
- console.log('condition', userCondition)
590
- }
591
- let addUser = `update t_user_address set f_check_book_id ='${this.selectBook}'
592
- FROM
593
- t_userinfo tui
594
- LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
595
- LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
596
- LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
597
- WHERE
598
- tui.f_user_state = '正常'
599
- AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
600
- AND ${userCondition}`
601
- await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: addUser}},
602
- {resolveMsg: null, rejectMsg: '添加用户失败'})
603
- this.$showMessage('添加用户成功')
604
- this.selectBook = ''
605
- this.clearBook()
606
- this.bookAll = false
607
- this.bookList = []
608
- this.showModal2 = false
609
- this.$refs.paged.$refs.criteria.search()
610
- }
611
- },
612
- async ok3() {
613
- if (!this.selectBook) {
614
- this.$showMessage('请选择安检册')
615
- return
616
- }
617
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
618
- let userCondition = ''
619
- if (this.bookList.length < 1) {
620
- console.log('bookCondition', this.bookCondition)
621
- userCondition = this.bookCondition
622
- } else {
623
- console.log('this.bookList', JSON.stringify(this.bookList))
624
-
625
- userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
626
- userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
627
- console.log('condition', userCondition)
628
- }
629
- let upUser = `update t_user_address set f_check_book_id ='${this.selectBook}'
630
- FROM
631
- t_userinfo tui
632
- LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
633
- LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
634
- LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
635
- WHERE
636
- tui.f_user_state = '正常'
637
- AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
638
- AND ${userCondition}`
639
- await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: upUser}},
640
- {resolveMsg: null, rejectMsg: '调整用户失败'})
641
- this.$showMessage('调整用户成功')
642
- this.selectBook = ''
643
- this.clearBook()
644
- this.bookAll = false
645
- this.bookList = []
646
- this.showModal3 = false
647
- this.$refs.paged.$refs.criteria.search()
648
- }
649
- },
650
- cancel2(){
651
- this.selectBook = ''
652
- this.clearBook()
653
- this.bookAll = false
654
- this.bookList = []
655
- this.showModal2 = false
656
- this.$refs.paged.$refs.criteria.search()
657
- },
658
- cancel3(){
659
- this.selectBook = ''
660
- this.clearBook()
661
- this.bookAll = false
662
- this.bookList = []
663
- this.showModal3 = false
664
- this.$refs.paged.$refs.criteria.search()
665
- },
666
- addUser () {
667
- if (!this.isCreateBook) {
668
- this.$showMessage('请选择查询未划分安检册的用户')
669
- return
670
- }
671
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
672
- this.showModal2 = true
673
- this.freshCheckBook()
674
- return
675
- }
676
- this.$showMessage('请选择用户')
677
- },
678
- upUser () {
679
- if (!this.isChangeBook) {
680
- this.$showMessage('请选择查询已划分安检册的用户')
681
- return
682
- }
683
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
684
- this.showModal3 = true
685
- this.freshCheckBook()
686
- return
687
- }
688
- this.$showMessage('请选择用户')
689
- },
690
- async delUser () {
691
- if (!this.isChangeBook) {
692
- this.$showMessage('请选择查询已划分安检册的用户')
693
- return
694
- }
695
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
696
- let userCondition= ''
697
- if (this.bookList.length < 1) {
698
- console.log('bookCondition', this.bookCondition)
699
- userCondition = this.bookCondition
700
- } else {
701
- console.log('this.bookList', JSON.stringify(this.bookList))
702
-
703
- userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
704
- userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
705
- console.log('condition', userCondition)
706
- }
707
- let delUser= `update t_user_address set f_check_book_id =null
708
- FROM
709
- t_userinfo tui
710
- LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
711
- LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
712
- LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
713
- WHERE
714
- tui.f_user_state = '正常'
715
- AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
716
- AND ${userCondition}`
717
- await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: delUser}},
718
- {resolveMsg: null, rejectMsg: '删除安检册失败'})
719
- this.$showMessage('从安检册删除所选用户成功')
720
- this.selectBook = ''
721
- this.bookAll = false
722
- this.clearBook()
723
- this.bookList = []
724
- this.showModal3 = false
725
- this.$refs.paged.$refs.criteria.search()
726
- return
727
- }
728
- this.$showMessage('请选择用户')
729
- },
730
- beforeCreateBook () {
731
- if (!this.isCreateBook) {
732
- this.$showMessage('请选择查询未划分安检册的用户')
733
- return
734
- }
735
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
736
- this.showModal = true
737
- return
738
- }
739
- this.$showMessage('请选择用户')
740
- },
741
- ok () {
742
- console.log('checkbook', JSON.stringify(this.checkBook))
743
- let condition = ''
744
- if (!this.checkBook.f_check_book_name) {
745
- this.$showMessage('请填写册名')
746
- return
747
- }
748
- if (!this.checkBook.f_checker_name && this.permission === 'c2') {
749
- this.$showMessage('请选择安检员')
750
- return
751
- }
752
- if (!this.checkBook.f_around_time || !this.checkBook.f_around_unit) {
753
- this.$showMessage('请选填写周期信息')
754
- return
755
- }
756
- if (!this.checkBook.f_run_date) {
757
- this.$showMessage('执行日期')
758
- return
759
- }
760
- if(this.checkBook.f_run_date < Util.toStandardDateString()){
761
- this.$showMessage('执行日期应大于当前日期')
762
- return
763
- }
764
- if (this.bookList.length < 1) {
765
- console.log('bookCondition', this.bookCondition)
766
- condition = this.bookCondition
767
- } else {
768
- console.log('this.bookList', JSON.stringify(this.bookList))
769
-
770
- condition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
771
- condition = 'tui.f_userinfo_id in (' + condition + ')'
772
- console.log('condition', condition)
773
- }
774
- let data = {
775
- checkBook: this.checkBook,
776
- sqlStr: condition
777
- }
778
- new HttpResetClass().load('post', 'rs/logic/AddCheckBook', {data}).then(res => {
779
- console.log('res=>', JSON.stringify(res))
780
- if (res.data.id) {
781
- this.$showMessage('创建成功')
782
- this.showModal = false
783
- this.isSearch = false
784
- this.clearBook()
785
- this.bookList = []
786
- this.bookAll = false
787
- this.freshCheckBook()
788
- this.$refs.paged.$refs.criteria.search()
789
- }
790
- })
791
- },
792
- changeState (val) {
793
- console.log('66666666666', val)
794
- console.log(this.model.rows)
795
- this.bookAll = false
796
- this.bookList = []
797
- if (this.$refs.paged.$refs.criteria.model.f_orgid){
798
- this.$refs.paged.$refs.criteria.search()
799
- }
800
- },
801
- cancel () {
802
- this.bookAll = false
803
- this.bookList = []
804
- this.clearBook()
805
- this.showModal = false
806
- this.$refs.paged.$refs.criteria.search()
807
- },
808
- checkModel (row) {
809
- if (this.bookAll) {
810
- console.log('row', this.bookAll, JSON.stringify(row))
811
- return true
812
- } else {
813
- if (this.bookList.findIndex(res => res === row.f_userinfo_id) !== -1) {
814
- console.log('row1111', JSON.stringify(row))
815
- return true
816
- } else {
817
- return false
818
- }
819
- }
820
- },
821
- checkChange (row, e) {
822
- console.log('e', e.target.checked)
823
- if (e.target.checked) {
824
- this.bookList.push(row.f_userinfo_id)
825
- } else {
826
- this.bookList.splice(this.bookList.findIndex(res => res === row.f_userinfo_id), 1)
827
- }
828
- // console.log('aaaaa', JSON.stringify(this.bookList))
829
- },
830
- getRes (obj) {
831
- this.checkBook.f_orgid = obj.resids[0]
832
- },
833
- getResm (obj) {
834
- this.$refs.paged.$refs.criteria.model.f_orgid = this.$login.convertToIn(obj.resids)
835
- },
836
- hidden () {
837
- this.criteriaShow = !this.criteriaShow
838
- },
839
- selfSearch (args) {
840
- this.isSearch = true
841
- this.bookAll = false
842
- this.bookList = []
843
- // if (this.$refs.paged.$refs.criteria.model.f_orgid){
844
- // args.condition += `f_orgid in ${this.$refs.paged.$refs.criteria.model.f_orgid}`
845
- // }
846
- if (this.permission === 'c2'){
847
- args.condition +=` and tcb.f_depid = '${this.$login.f.depids}'`
848
- }
849
- if(args.model.gasbrand){
850
- args.condition +=` and tuf.f_gasbrand_id=${args.model.gasbrand.id}`
851
- }
852
- this.model.search(args.condition, args.model)
853
- },
854
- getChecker(){
855
- let http = new HttpResetClass()
856
- http.load('POST', '/rs/search', {data: {source: 'this.getParentByType($department$).getAllChildrens().where(row.getAttributes().get($rolestr$).indexOf($安检员$) != -1))', userid: this.$login.f.id}}, {resolveMsg: null, rejectMsg: null})
857
- .then(res => {
858
- console.log('res666-->' + JSON.stringify(res))
859
- this.checkers = res.data.map(res=>{
860
- return {label:res.name,value:res.name}
861
- })
862
- })
863
- },
864
- freshCheckBook () {
865
- this.checkBooks = []
866
- new HttpResetClass().load('POST', `/rs/sql/safe_singleTable_OrderBy`, {
867
- data: {
868
- items: 'id,f_check_book_name',
869
- tablename: 't_check_book',
870
- condition: (this.$refs.paged.$refs.criteria.model.f_orgid?`f_orgid in ${this.$refs.paged.$refs.criteria.model.f_orgid}`:'1=1')+(this.permission === 'c2' ? ` and f_depid='${this.$login.f.depids}'`:'') ,
871
- orderitem: 'id desc'
872
- }
873
- }, {resolveMsg: null, rejectMsg: null}).then(res => {
874
- this.checkBooks.push({label: '全部', value: ''})
875
- res.data.forEach(ress => {
876
- this.checkBooks.push({
877
- label: ress.f_check_book_name,
878
- value: ress.id
879
- })
880
- })
881
- })
882
- }
883
- },
884
-
885
- ready () {
886
- // 获取片区
887
- this.getSliceArea()
888
- // 获取营收气表参数
889
- this.setConList()
890
- if (this.permission === 'c1'){
891
- this.$refs.paged.$refs.criteria.model.f_is_checkbook = 'f_check_book_name is null'
892
- }else if(this.permission === 'c2'){
893
- this.$refs.paged.$refs.criteria.model.f_is_checkbook = 'f_check_book_name is not null'
894
- }
895
-
896
- console.log('checkbook', this.$login.f)
897
- this.checkBook.f_orgid = this.$login.f.orgid
898
- console.log('permission2',this.permission)
899
- // this.init=true
900
- this.freshCheckBook()
901
- this.getChecker()
902
- }
903
- }
904
- </script>
905
- <style scoped>
906
- /*.btn-group > .btn:first-child {*/
907
- /* margin-left: 0;*/
908
- /* width: 100%;*/
909
- /*}*/
910
- </style>
1
+ <template>
2
+ <div class="flex-row">
3
+ <div class="basic-main">
4
+ <criteria-paged :model="model" v-ref:paged>
5
+ <criteria partial='criteria' class="search_area" @condition-changed='$parent.selfSearch' v-ref:criteria>
6
+ <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
7
+ <div class="row">
8
+ <div class="form-group col-sm-2">
9
+ <label class="font_normal_body">客户编号</label>
10
+ <input type="text" class="input_search" v-model="model.f_userinfo_code"
11
+ style="width: 60%" placeholder="客户编号" condition="tui.f_userinfo_code='{}'">
12
+ </div>
13
+ <div class="form-group col-sm-2">
14
+ <label class="font_normal_body">客户名称</label>
15
+ <input type="text" class="input_search" v-model="model.f_user_name"
16
+ style="width: 60%" placeholder="客户名称" condition="tui.f_user_name like '{}%'">
17
+ </div>
18
+ <div class="form-group col-sm-2">
19
+ <label class="font_normal_body">客户电话</label>
20
+ <input type="text" class="input_search" v-model="model.f_user_phone"
21
+ style="width: 60%" placeholder="客户电话" condition="tui.f_user_phone like '{}%'">
22
+ </div>
23
+ <div class="form-group col-sm-2">
24
+ <label class="font_normal_body">客户地址</label>
25
+ <input type="text" class="input_search" v-model="model.f_address"
26
+ style="width: 60%" placeholder="客户地址" condition="tua.f_address like '%{}%'">
27
+ </div>
28
+
29
+ <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right">
30
+
31
+ <export-excel-safe :data="$parent.$parent.searchData"
32
+ :field="$parent.$parent.excelHeaders"
33
+ progress="safeGetExportProgress"
34
+ sqlurl="rs/logic/SafeExportExcel" sql-name="defectDetails"
35
+ template-name='安检隐患明细'></export-excel-safe>
36
+
37
+
38
+ <button class="button_spacing button_search" @click="search()">查询</button>
39
+ <!-- <div style="float: right" class="button_spacing"-->
40
+ <!-- :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"-->
41
+ <!-- @click="$parent.$parent.hidden()"></div>-->
42
+ </div>
43
+ <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right" v-if="$parent.$parent.permission === 'c1'">
44
+
45
+
46
+ <button class="button_spacing button_search" @click="$parent.$parent.beforeCreateBook">创建安检册</button>
47
+
48
+ </div>
49
+ </div>
50
+ <div class="row">
51
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
52
+ <label class="font_normal_body">公&emsp;&emsp;司</label>
53
+ <right-tree-safe @re-res="$parent.$parent.getResm" v-model="model.f_orgid" condition="tua.f_orgid in {}"></right-tree-safe>
54
+ </div>
55
+ <div class="form-group col-sm-2" style="margin-top: 0px">
56
+ <label class="font_normal_body">小&emsp;&emsp;区</label>
57
+ <input type="text" class="input_search" v-model="model.f_residential_area"
58
+ style="width: 60%" placeholder="小区" condition="tua.f_residential_area like '%{}%'">
59
+ </div>
60
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
61
+
62
+ <label class="font_normal_body" title="用户类型">用户类型</label>
63
+ <v-select :value.sync="model.f_user_type" v-model='model.f_user_type'
64
+ :value-single="true" style="width: 60%"
65
+ class="select_list select"
66
+ :options='$parent.$parent.usertypes' placeholder='用户类型'
67
+ close-on-select
68
+ condition="tuf.f_user_type ='{}'"></v-select>
69
+
70
+ </div>
71
+ <!-- <div class="col-sm-2 form-group" style="margin: 0">
72
+
73
+ <label class="font_normal_body" title="安检用户状态">用户状态</label>
74
+ <v-select :value.sync="model.f_user_state" v-model='model.f_user_state'
75
+ :value-single="true" style="width: 60%"
76
+ class="select_list select"
77
+ :options='$parent.$parent.userstates' placeholder='用户状态'
78
+ close-on-select
79
+ condition="tui.f_user_state ='{}'"></v-select>
80
+
81
+ </div> -->
82
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
83
+
84
+ <label class="font_normal_body" title="用气性质">用气性质</label>
85
+ <v-select :value.sync="model.f_gasproperties" v-model='model.f_gasproperties'
86
+ :value-single="true" style="width: 60%"
87
+ class="select_list select"
88
+ :options='$parent.$parent.gasproperties' placeholder='用气性质'
89
+ close-on-select
90
+ condition="tuf.f_gasproperties ='{}'"></v-select>
91
+
92
+ </div>
93
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
94
+
95
+ <label class="font_normal_body" title="气表类型">气表类型</label>
96
+ <v-select
97
+ class="select select_list"
98
+ :value.sync="model.f_meter_classify"
99
+ v-model="model.f_meter_classify"
100
+ :options='$parent.$parent.meter_classifys'
101
+ placeholder='请选择'
102
+ condition="tuf.f_meter_classify='{}'"
103
+ :search="false"
104
+ style="width: 60%"
105
+ close-on-select
106
+ value-single
107
+ ></v-select>
108
+ </div>
109
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
110
+
111
+ <label class="font_normal_body">气表品牌</label>
112
+ <v-select :value.sync="model.gasbrand" v-model='model.gasbrand'
113
+ :value-single="true" style="width: 60%"
114
+ class="select_list select"
115
+ :options='$parent.$parent.getgasbrand' placeholder='气表品牌'
116
+ close-on-select
117
+ ></v-select>
118
+ </div>
119
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
120
+
121
+ <label class="font_normal_body">气表型号</label>
122
+ <v-select :value.sync="model.gasmodel" v-model='model.gasmodel'
123
+ :value-single="true" style="width: 60%"
124
+ class="select_list select"
125
+ :options='$parent.$parent.getgasmodel' placeholder='气表型号'
126
+ close-on-select
127
+ condition="tuf.f_gasmodel_id = '{}'"></v-select>
128
+
129
+ </div>
130
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
131
+
132
+ <label class="font_normal_body" title="房屋类型">房屋类型</label>
133
+ <v-select :value.sync="model.f_house_type" v-model='model.f_house_type'
134
+ :value-single="true" style="width: 60%"
135
+ class="select_list select"
136
+ :options='$parent.$parent.housetypes' placeholder='房屋类型'
137
+ close-on-select
138
+ condition="tui.f_house_type = '{}'"></v-select>
139
+
140
+ </div>
141
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
142
+
143
+ <label class="font_normal_body" title="安装位置">安装位置</label>
144
+ <v-select :value.sync="model.f_position" v-model='model.f_position'
145
+ :value-single="true" style="width: 60%"
146
+ class="select_list select"
147
+ :options='$parent.$parent.positions' placeholder='安装位置'
148
+ close-on-select
149
+ condition="tuf.f_position = '{}'"></v-select>
150
+
151
+ </div>
152
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
153
+
154
+ <label class="font_normal_body" title="使用类型">使用类型</label>
155
+ <v-select :value.sync="model.f_usetype" v-model='model.f_usetype'
156
+ :value-single="true" style="width: 60%"
157
+ class="select_list select"
158
+ :options='$parent.$parent.usetypes' placeholder='使用类型'
159
+ close-on-select
160
+ condition="tuf.f_usetype = '{}'"></v-select>
161
+
162
+ </div>
163
+ <div class="form-group col-sm-2" style="margin-top: 0px">
164
+ <label class="font_normal_body">开户起始</label>
165
+ <datepicker
166
+ placeholder='开户起始'
167
+ style="width:60%"
168
+ :disabled-days-of-week="[]"
169
+ :format="'yyyy-MM-dd'"
170
+ :show-rest-button="reset"
171
+ :value.sync="model.f_startfile_time"
172
+ v-model="model.f_startfile_time"
173
+ condition="tui.f_createfile_date >= '{} 00:00:00'">
174
+ </datepicker>
175
+ </div>
176
+ <div class="form-group col-sm-2"style="margin-top: 0px" >
177
+ <label class="font_normal_body">开户截止</label>
178
+ <datepicker
179
+ placeholder='开户截止'
180
+ :disabled-days-of-week="[]"
181
+ style="width:60%"
182
+ :format="'yyyy-MM-dd'"
183
+ :show-rest-button="reset"
184
+ :value.sync="model.f_endfile_time"
185
+ v-model="model.f_endfile_time"
186
+ condition="tui.f_createfile_date <= '{} 00:00:00'">
187
+ </datepicker>
188
+ </div>
189
+ <div class="form-group col-sm-2" style="margin-top: 0px">
190
+ <label class="font_normal_body">片&ensp;&ensp;&ensp;&ensp;区</label>
191
+ <v-select
192
+ class="select select_list"
193
+ style="width:60%"
194
+ :value.sync="model.f_book_slice_area"
195
+ v-model="model.f_book_slice_area"
196
+ :options='$parent.$parent.sliceArea'
197
+ placeholder='片区'
198
+ condition="tua.f_slice_area ='{}'"
199
+ close-on-select
200
+ value-single
201
+ >
202
+ </v-select>
203
+ </div>
204
+ <div class="form-group col-sm-2" style="margin-top: 0px">
205
+ <label class="font_normal_body" title="安检状态">安检状态</label>
206
+ <v-select
207
+ class="select select_list"
208
+ style="width:60%"
209
+ :value.sync="model.f_last_check_state"
210
+ v-model="model.f_last_check_state"
211
+ :options='$parent.$parent.check_states'
212
+ placeholder='安检状态'
213
+ condition="tua.f_last_check_state ='{}'"
214
+ close-on-select
215
+ value-single
216
+ >
217
+ </v-select>
218
+ </div>
219
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
220
+
221
+ <label class="font_normal_body">安&ensp;检&ensp;册</label>
222
+ <v-select :value.sync="model.f_check_book_id" v-model='model.f_check_book_id'
223
+ :value-single="true" style="width: 60%"
224
+ class="select_list select"
225
+ :options='$parent.$parent.checkBooks' placeholder='安&ensp;检&ensp;册'
226
+ close-on-select
227
+ condition="f_check_book_id ='{}'"></v-select>
228
+
229
+ </div>
230
+ <div class="col-sm-2 form-group" style="margin-top: 0px">
231
+
232
+ <label class="font_normal_body">是否划分</label>
233
+ <v-select :value.sync="model.f_is_checkbook" v-model='model.f_is_checkbook'
234
+ :value-single="true" style="width: 60%"
235
+ class="select_list select"
236
+ @change="$parent.$parent.changeState"
237
+ :options='$parent.$parent.isCheckBook' placeholder='有无所属安检册'
238
+ close-on-select
239
+ condition="{}"></v-select>
240
+
241
+ </div>
242
+ <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right" v-if="$parent.$parent.permission === 'c1'">
243
+
244
+
245
+ <button class="button_spacing button_search" @click="$parent.$parent.addUser">添加用户</button>
246
+
247
+ </div>
248
+ <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right">
249
+
250
+
251
+ <button class="button_spacing button_search" @click="$parent.$parent.upUser">调整用户</button>
252
+
253
+ </div>
254
+ <div class="form-group col-sm-2" style="width: auto;margin-top:8px;float: right" v-if="$parent.$parent.permission === 'c1'">
255
+
256
+
257
+ <button class="button_spacing button_search" @click="$parent.$parent.delUser">移除用户</button>
258
+
259
+ </div>
260
+ </div>
261
+ </div>
262
+ </criteria>
263
+ <data-grid class="list_area table_sy" style="overflow: hidden" :model="model" partial='list' v-ref:grid>
264
+ <template partial='head'>
265
+ <tr @dblclick.stop="">
266
+ <th>
267
+ <nobr><input type="checkbox" v-model="$parent.$parent.$parent.bookAll"></input>全选</nobr>
268
+ </th>
269
+ <th>
270
+ <nobr><input type="checkbox" v-model="$parent.$parent.$parent.isallchecked"/>全选本页</nobr>
271
+ </th>
272
+ <th>
273
+ <nobr>客户姓名</nobr>
274
+ </th>
275
+ <th>
276
+ <nobr>客户编号</nobr>
277
+ </th>
278
+ <th>
279
+ <nobr>客户类型</nobr>
280
+ </th>
281
+ <th>
282
+ <nobr>客户电话</nobr>
283
+ </th>
284
+ <th>
285
+ <nobr>客户地址</nobr>
286
+ </th>
287
+ <th>
288
+ <nobr>所属安检册</nobr>
289
+ </th>
290
+ </tr>
291
+ </template>
292
+ <template partial='body'>
293
+ <td style="text-align: center">
294
+ <nobr><input type="checkbox" :checked="$parent.$parent.$parent.checkModel(row)"
295
+ @change="$parent.$parent.$parent.checkChange(row, $event)"></input>
296
+ </nobr>
297
+ </td>
298
+ <td style="text-align: center">
299
+ <nobr>
300
+ <input type="checkbox" :checked="$parent.$parent.$parent.pageCheckModel(row)"
301
+ @change="$parent.$parent.$parent.pageCheckChange(row, $event)"></input>
302
+ </nobr>
303
+ </td>
304
+ <td style="text-align: center">{{ row.f_user_name }}</td>
305
+ <td style="text-align: center">{{ row.f_userinfo_code }}</td>
306
+ <td style="text-align: center">{{ row.f_user_type }}</td>
307
+ <td style="text-align: center">{{ row.f_user_phone }}</td>
308
+ <td style="text-align: center">{{ row.f_address }}</td>
309
+ <td style="text-align: center">{{ row.f_check_book_name }}</td>
310
+ </template>
311
+ </data-grid>
312
+ </criteria-paged>
313
+ </div>
314
+ <modal :show.sync="showModal" :backdrop="false">
315
+ <div slot="modal-header" class="modal-header">
316
+ <h4 class="modal-title">
317
+ 创建安检册
318
+ </h4>
319
+ </div>
320
+ <div slot="modal-body" class="modal-body">
321
+ <div v-if="true">
322
+ <div class="row" style="margin-top: 10px">
323
+ <!-- <label class="control-label font text-left" style="float:left;margin-left:10%;margin-top:5px">安检册名称</label>-->
324
+ <!-- <div class="col-xs-8 col-md-8">-->
325
+ <!-- <input type="text" class="input_search" style="width: 70%;" v-model="checkBook.f_check_book_name"/>-->
326
+ <!-- </div>-->
327
+ <div class="col-sm-6 form-group" style="margin-top: 20px" v-if="permission === 'c1' && showModal ">
328
+ <label class="font_normal_body">安检科室</label>
329
+ <right-tree islist :userid="userid" :source="source" v-on:re-res="reres" :textContent="选择科室" :selectData="" v-ref:f_reciever>
330
+ </right-tree>
331
+ </div>
332
+ <div class="col-sm-6 form-group" style="margin-top: 20px" v-if="permission === 'c2' ">
333
+ <label class="font_normal_body">安&ensp;检&ensp;员</label>
334
+ <v-select :value.sync="checkBook.f_checker_name" v-model='checkBook.f_checker_name'
335
+ :value-single="true" style="width: 60%"
336
+ class="select_list select"
337
+ :options='checkers' placeholder='安检员'
338
+ close-on-select></v-select>
339
+ </div>
340
+ <div class="form-group col-sm-6" style="margin-top: 20px">
341
+ <label class="font_normal_body">安检册名</label>
342
+ <input type="text" class="input_search" v-model="checkBook.f_check_book_name"
343
+ style="width: 60%" >
344
+ </div>
345
+ <div class="form-group col-sm-6" style="margin-top: 20px">
346
+ <label class="font_normal_body">执行日期</label>
347
+ <datepicker
348
+ :value.sync="checkBook.f_run_date"
349
+ style="width: 60%"
350
+ :format="'yyyy-MM-dd'"
351
+ v-model="checkBook.f_run_date"
352
+ >
353
+ </datepicker>
354
+ </div>
355
+ <div class="form-group col-sm-6" style="margin-top: 20px">
356
+ <label class="font_normal_body">执行周期</label>
357
+ <input type="number" class="input_search" v-model="checkBook.f_around_time"
358
+ style="width: 60%" >
359
+ </div>
360
+ <div class="form-group col-sm-6" style="margin-top: 20px">
361
+ <label class="font_normal_body">周期单位</label>
362
+ <v-select :value.sync="checkBook.f_around_unit" v-model='checkBook.f_around_unit'
363
+ :value-single="true" style="width: 60%"
364
+ class="select_list select"
365
+ :options='aroundUnit' placeholder=''
366
+ close-on-select></v-select>
367
+ </div>
368
+ </div>
369
+ </div>
370
+ </div>
371
+ <div slot="modal-footer" class="modal-footer" style="text-align: center">
372
+ <button class="button_search" style="margin-right: 20px" @click="ok">确认</button>
373
+ <button class="button_search" @click="cancel">取消</button>
374
+ </div>
375
+ </modal>
376
+ <modal :show.sync="showModal2" :backdrop="false">
377
+ <div slot="modal-header" class="modal-header">
378
+ <h4 class="modal-title">
379
+ 添加用户
380
+ </h4>
381
+ </div>
382
+ <div slot="modal-body" class="modal-body">
383
+ <div v-if="true">
384
+ <div class="row" style="margin-top: 10px">
385
+ <div class="form-group col-sm-12" style="margin-top: 20px">
386
+ <label class="font_normal_body">安&ensp;检&ensp;册</label>
387
+ <v-select :value.sync="selectBook" v-model='selectBook'
388
+ :value-single="true" style="width: 80%"
389
+ class="select_list select"
390
+ :options='checkBooks' placeholder=''
391
+ close-on-select></v-select>
392
+ </div>
393
+ </div>
394
+ </div>
395
+ </div>
396
+ <div slot="modal-footer" class="modal-footer" style="text-align: center">
397
+ <button class="button_search" style="margin-right: 20px" @click="ok2">确认</button>
398
+ <button class="button_search" @click="cancel2">取消</button>
399
+ </div>
400
+ </modal>
401
+ <modal :show.sync="showModal3" :backdrop="false">
402
+ <div slot="modal-header" class="modal-header">
403
+ <h4 class="modal-title">
404
+ 调整用户
405
+ </h4>
406
+ </div>
407
+ <div slot="modal-body" class="modal-body">
408
+ <div v-if="true">
409
+ <div class="row" style="margin-top: 10px;text-align: center">
410
+ <div class="form-group col-sm-12" style="margin-top: 20px">
411
+ <label class="font_normal_body">安&ensp;检&ensp;册</label>
412
+ <v-select :value.sync="selectBook" v-model='selectBook'
413
+ :value-single="true" style="width: 80%"
414
+ class="select_list select"
415
+ :options='checkBooks' placeholder=''
416
+ close-on-select></v-select>
417
+ </div>
418
+ </div>
419
+ </div>
420
+ </div>
421
+ <div slot="modal-footer" class="modal-footer" style="text-align: center">
422
+ <button class="button_search" style="margin-right: 20px" @click="ok3">确认</button>
423
+ <button class="button_search" @click="cancel3">取消</button>
424
+ </div>
425
+ </modal>
426
+
427
+ </div>
428
+ </template>
429
+
430
+ <script>
431
+ import {PagedList, HttpResetClass} from 'vue-client'
432
+ import * as Util from '../../components/Util'
433
+
434
+ export default {
435
+ title: '安检册管理',
436
+ data () {
437
+ let model = new PagedList('rs/sql/getUserByCheckBook', 20)
438
+ return {
439
+ model: model,
440
+ criteriaShow: false,
441
+ excelHeaders: {},
442
+ checkBooks: [],
443
+ f_orgid: '',
444
+ bookAll: false,
445
+ isallchecked:false,//本页全选
446
+ bookList: [],
447
+ selectBook:'',
448
+ // init:false,
449
+ aroundUnit: [{label: '', value: '年'}, {label: '月', value: '月'}, {label: '日', value: '月'}],
450
+ isCheckBook: [{label: '全部', value: ''}, {label: '是', value: 'f_check_book_name is not null'}, {label: '否', value: 'f_check_book_name is null'}],
451
+ isSearch: false,
452
+ checkers:[],
453
+ source:
454
+ 'dep=this.getParentByType($organization$).getSpecialResByType($department$),' +
455
+ 'tool.getFullTree(dep.where(row.hasSpecialRole($安检册二次分配$)))',
456
+ userid: this.$login.f.id,
457
+ checkBook: {
458
+ f_check_book_name: '',
459
+ f_run_date: '',
460
+ f_around_time: '',
461
+ f_around_unit: '',
462
+ f_create_date: Util.toStandardDateString(),
463
+ f_create_person: this.$login.f.name,
464
+ f_orgid: this.$login.f.orgid,
465
+ f_depid:'',
466
+ f_dep:'',
467
+ f_checker_name: '',
468
+ f_checker_id:''
469
+ },
470
+ showModal: false,
471
+ showModal2: false,
472
+ showModal3: false,
473
+ userstates:this.$appdata.getParam('安检用户状态')?[{label: '全部', value: ''}, ...this.$appdata.getParam('安检用户状态')]:[{label: '全部', value: ''}],
474
+ usertypes:this.$appdata.getParam('用户类型')?[{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')]:[{label: '全部', value: ''}],
475
+ gasproperties:this.$appdata.getParam('用气性质')?[{label: '全部', value: ''}, ...this.$appdata.getParam('用气性质')]:[{label: '全部', value: ''}],
476
+ meter_classifys:this.$appdata.getParam('气表类型')?[{label: '全部', value: ''}, ...this.$appdata.getParam('气表类型')]:[{label: '全部', value: ''}],
477
+ housetypes:this.$appdata.getParam('房屋类型')?[{label: '全部', value: ''}, ...this.$appdata.getParam('房屋类型')]:[{label: '全部', value: ''}],
478
+ positions:this.$appdata.getParam('安装位置')?[{label: '全部', value: ''}, ...this.$appdata.getParam('安装位置')]:[{label: '全部', value: ''}],
479
+ usetypes:this.$appdata.getParam('使用类型')?[{label: '全部', value: ''}, ...this.$appdata.getParam('使用类型')]:[{label: '全部', value: ''}],
480
+ check_states:this.$appdata.getParam('安检状态')?[{label: '全部', value: ''}, ...this.$appdata.getParam('安检状态')]:[{label: '全部', value: ''}],
481
+ meterbrands:[],
482
+ sliceArea:[]
483
+
484
+ }
485
+ },
486
+ props:['permission'],
487
+ computed: {
488
+ getgasbrand(){
489
+ let ops=[{label:'全部',value:''}]
490
+ this.meterbrands.forEach(b =>{
491
+ ops.push({label:b.f_meter_brand,value:b})
492
+ })
493
+ return ops
494
+ },
495
+ getgasmodel(){
496
+ let ops=[{label:'全部',value:''}]
497
+ this.$refs.paged.$refs.criteria.model.gasmodel=''
498
+ if(this.$refs.paged.$refs.criteria.model && this.$refs.paged.$refs.criteria.model.gasbrand){
499
+ this.$refs.paged.$refs.criteria.model.gasbrand.gasmodel.forEach(b =>{
500
+ ops.push({label:b.f_meter_style,value:b.id})
501
+ })
502
+ }
503
+ return ops
504
+ },
505
+ searchData () {
506
+ return {condition: this.model.condition}
507
+ },
508
+ bookCondition () {
509
+ return this.model.condition
510
+ },
511
+ isCreateBook () {
512
+ return this.$refs.paged.$refs.criteria.model.f_is_checkbook === 'f_check_book_name is null'
513
+ },
514
+ isChangeBook () {
515
+ return this.$refs.paged.$refs.criteria.model.f_is_checkbook === 'f_check_book_name is not null'
516
+ }
517
+ },
518
+ methods: {
519
+ //片区获取
520
+ async getSliceArea() {
521
+ let http = new HttpResetClass()
522
+ let getAllArea = await http.load('POST', '/rs/search', {
523
+ source: 'this.getParentByType($organization$).getAllChildrens().where(row.getType() == $zone$)',
524
+ userid: this.userlogin.id
525
+ }, {resolveMsg: null, rejectMsg: '获取片区出错!!!'})
526
+ this.sliceArea = [{label: '全部', value: ''}]
527
+ getAllArea.data.forEach((res) => {
528
+ if(res.parentid==this.userlogin.orgid){
529
+ this.sliceArea.push({label:res.name,value:res.name})
530
+ }
531
+ })
532
+ console.log('片区' + this.sliceArea)
533
+ },
534
+ //片区改变-对应抄表册下拉重新赋值
535
+ slice_areaChange(value) {
536
+ console.log("下拉改变--"+value)
537
+ if(!value){
538
+ this.cbc=[]
539
+ this.meterbooks.forEach((res) => {
540
+ this.cbc.push({label: res.f_book_name, value: res.id})
541
+ })
542
+ }else{
543
+ this.cbc=[]
544
+ this.meterbooks.forEach((res) => {
545
+ if(res.f_book_slice_area==value){
546
+ this.cbc.push({label: res.f_book_name, value: res.id})
547
+ }
548
+ })
549
+ }
550
+ },
551
+ // 获取气表品牌
552
+ setConList(){
553
+ new HttpResetClass().load("POST", `/rs/logic/getSaleInitData`, {data:{f_orgid:`${this.$login.f.orgid}`}}, {resolveMsg: null, rejectMsg: null}).then((res)=>{
554
+ this.meterbrands=res.data.gasbrands
555
+ })
556
+ },
557
+ reres(val){
558
+ if (!val.resids || val.resids.length === 0 || val.resids[0] ==='undefined' || val.resids.length>1){
559
+ return
560
+ }
561
+ console.log('val2',val)
562
+ const resids = val.orgobj.filter(res=>res.resourcetype==='department')
563
+ console.log('val2',resids)
564
+ if (resids.length>0){
565
+ this.checkBook.f_depid = resids[0].id
566
+ this.checkBook.f_dep = resids[0].name
567
+ }
568
+ },
569
+ clearBook(){
570
+ this.checkBook ={
571
+ f_check_book_name: '',
572
+ f_run_date: '',
573
+ f_around_time: '',
574
+ f_around_unit: '',
575
+ f_create_date: Util.toStandardDateString(),
576
+ f_create_person: this.$login.f.name,
577
+ f_orgid: this.$login.f.orgid,
578
+ f_depid:'',
579
+ f_dep:'',
580
+ f_checker_name: '',
581
+ f_checker_id:''
582
+ }
583
+ },
584
+ async ok2() {
585
+ if (!this.selectBook) {
586
+ this.$showMessage('请选择安检册')
587
+ return
588
+ }
589
+ if (this.isSearch && (this.isallchecked || this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
590
+ let userCondition = ''
591
+ if (this.bookList.length < 1) {
592
+ console.log('bookCondition', this.bookCondition)
593
+ userCondition = this.bookCondition
594
+ } else {
595
+ console.log('this.bookList', JSON.stringify(this.bookList))
596
+
597
+ userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
598
+ userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
599
+ console.log('condition', userCondition)
600
+ }
601
+ let addUser = `update t_user_address set f_check_book_id ='${this.selectBook}'
602
+ FROM
603
+ t_userinfo tui
604
+ LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
605
+ LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
606
+ LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
607
+ WHERE
608
+ tui.f_user_state = '正常'
609
+ AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
610
+ AND ${userCondition}`
611
+ await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: addUser}},
612
+ {resolveMsg: null, rejectMsg: '添加用户失败'})
613
+ this.$showMessage('添加用户成功')
614
+ this.selectBook = ''
615
+ this.clearBook()
616
+ this.bookAll = false
617
+ this.isallchecked = false
618
+ this.bookList = []
619
+ this.showModal2 = false
620
+ this.$refs.paged.$refs.criteria.search()
621
+ }
622
+ },
623
+ async ok3() {
624
+ if (!this.selectBook) {
625
+ this.$showMessage('请选择安检册')
626
+ return
627
+ }
628
+ if (this.isSearch && (this.isallchecked || this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
629
+ let userCondition = ''
630
+ if (this.bookList.length < 1) {
631
+ console.log('bookCondition', this.bookCondition)
632
+ userCondition = this.bookCondition
633
+ } else {
634
+ console.log('this.bookList', JSON.stringify(this.bookList))
635
+
636
+ userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
637
+ userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
638
+ console.log('condition', userCondition)
639
+ }
640
+ let upUser = `update t_user_address set f_check_book_id ='${this.selectBook}'
641
+ FROM
642
+ t_userinfo tui
643
+ LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
644
+ LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
645
+ LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
646
+ WHERE
647
+ tui.f_user_state = '正常'
648
+ AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
649
+ AND ${userCondition}`
650
+ await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: upUser}},
651
+ {resolveMsg: null, rejectMsg: '调整用户失败'})
652
+ this.$showMessage('调整用户成功')
653
+ this.selectBook = ''
654
+ this.clearBook()
655
+ this.bookAll = false
656
+ this.isallchecked = false
657
+ this.bookList = []
658
+ this.showModal3 = false
659
+ this.$refs.paged.$refs.criteria.search()
660
+ }
661
+ },
662
+ cancel2(){
663
+ this.selectBook = ''
664
+ this.clearBook()
665
+ this.bookAll = false
666
+ this.isallchecked = false
667
+ this.bookList = []
668
+ this.showModal2 = false
669
+ this.$refs.paged.$refs.criteria.search()
670
+ },
671
+ cancel3(){
672
+ this.selectBook = ''
673
+ this.clearBook()
674
+ this.bookAll = false
675
+ this.isallchecked = false
676
+ this.bookList = []
677
+ this.showModal3 = false
678
+ this.$refs.paged.$refs.criteria.search()
679
+ },
680
+ addUser () {
681
+ if (!this.isCreateBook) {
682
+ this.$showMessage('请选择查询未划分安检册的用户')
683
+ return
684
+ }
685
+ if (this.isSearch && (this.isallchecked || this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
686
+ this.showModal2 = true
687
+ this.freshCheckBook()
688
+ return
689
+ }
690
+ this.$showMessage('请选择用户')
691
+ },
692
+ upUser () {
693
+ if (!this.isChangeBook) {
694
+ this.$showMessage('请选择查询已划分安检册的用户')
695
+ return
696
+ }
697
+ if (this.isSearch && (this.isallchecked || this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
698
+ this.showModal3 = true
699
+ this.freshCheckBook()
700
+ return
701
+ }
702
+ this.$showMessage('请选择用户')
703
+ },
704
+ async delUser () {
705
+ if (!this.isChangeBook) {
706
+ this.$showMessage('请选择查询已划分安检册的用户')
707
+ return
708
+ }
709
+ if (this.isSearch && (this.isallchecked || this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
710
+ let userCondition= ''
711
+ if (this.bookList.length < 1) {
712
+ console.log('bookCondition', this.bookCondition)
713
+ userCondition = this.bookCondition
714
+ } else {
715
+ console.log('this.bookList', JSON.stringify(this.bookList))
716
+
717
+ userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
718
+ userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
719
+ console.log('condition', userCondition)
720
+ }
721
+ let delUser= `update t_user_address set f_check_book_id =null
722
+ FROM
723
+ t_userinfo tui
724
+ LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
725
+ LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
726
+ LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
727
+ WHERE
728
+ tui.f_user_state = '正常'
729
+ AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
730
+ AND ${userCondition}`
731
+ await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: delUser}},
732
+ {resolveMsg: null, rejectMsg: '删除安检册失败'})
733
+ this.$showMessage('从安检册删除所选用户成功')
734
+ this.selectBook = ''
735
+ this.bookAll = false
736
+ this.isallchecked = false
737
+ this.clearBook()
738
+ this.bookList = []
739
+ this.showModal3 = false
740
+ this.$refs.paged.$refs.criteria.search()
741
+ return
742
+ }
743
+ this.$showMessage('请选择用户')
744
+ },
745
+ beforeCreateBook () {
746
+ if (!this.isCreateBook) {
747
+ this.$showMessage('请选择查询未划分安检册的用户')
748
+ return
749
+ }
750
+ if (this.isSearch && (this.isallchecked || this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
751
+ this.showModal = true
752
+ return
753
+ }
754
+ this.$showMessage('请选择用户')
755
+ },
756
+ ok () {
757
+ console.log('checkbook', JSON.stringify(this.checkBook))
758
+ let condition = ''
759
+ if (!this.checkBook.f_check_book_name) {
760
+ this.$showMessage('请填写册名')
761
+ return
762
+ }
763
+ if (!this.checkBook.f_checker_name && this.permission === 'c2') {
764
+ this.$showMessage('请选择安检员')
765
+ return
766
+ }
767
+ if (!this.checkBook.f_around_time || !this.checkBook.f_around_unit) {
768
+ this.$showMessage('请选填写周期信息')
769
+ return
770
+ }
771
+ if (!this.checkBook.f_run_date) {
772
+ this.$showMessage('执行日期')
773
+ return
774
+ }
775
+ if(this.checkBook.f_run_date < Util.toStandardDateString()){
776
+ this.$showMessage('执行日期应大于当前日期')
777
+ return
778
+ }
779
+ if (this.bookList.length < 1) {
780
+ console.log('bookCondition', this.bookCondition)
781
+ condition = this.bookCondition
782
+ } else {
783
+ console.log('this.bookList', JSON.stringify(this.bookList))
784
+
785
+ condition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
786
+ condition = 'tui.f_userinfo_id in (' + condition + ')'
787
+ console.log('condition', condition)
788
+ }
789
+ let data = {
790
+ checkBook: this.checkBook,
791
+ sqlStr: condition
792
+ }
793
+ new HttpResetClass().load('post', 'rs/logic/AddCheckBook', {data}).then(res => {
794
+ console.log('res=>', JSON.stringify(res))
795
+ if (res.data.id) {
796
+ this.$showMessage('创建成功')
797
+ this.showModal = false
798
+ this.isSearch = false
799
+ this.clearBook()
800
+ this.bookList = []
801
+ this.bookAll = false
802
+ this.isallchecked = false
803
+ this.freshCheckBook()
804
+ this.$refs.paged.$refs.criteria.search()
805
+ }
806
+ })
807
+ },
808
+ changeState (val) {
809
+ console.log('66666666666', val)
810
+ console.log(this.model.rows)
811
+ this.bookAll = false
812
+ this.isallchecked = false
813
+ this.bookList = []
814
+ if (this.$refs.paged.$refs.criteria.model.f_orgid){
815
+ this.$refs.paged.$refs.criteria.search()
816
+ }
817
+ },
818
+ cancel () {
819
+ this.bookAll = false
820
+ this.isallchecked = false
821
+ this.bookList = []
822
+ this.clearBook()
823
+ this.showModal = false
824
+ this.$refs.paged.$refs.criteria.search()
825
+ },
826
+ checkModel (row) {
827
+ if (this.bookAll) {
828
+ console.log('row', this.bookAll, JSON.stringify(row))
829
+ return true
830
+ } else {
831
+ if (this.bookList.findIndex(res => res === row.f_userinfo_id) !== -1) {
832
+ console.log('row1111', JSON.stringify(row))
833
+ return true
834
+ } else {
835
+ return false
836
+ }
837
+ }
838
+ },
839
+ pageCheckModel (row) {
840
+ //全选
841
+ if (this.isallchecked) {
842
+ console.log('row', this.isallchecked, JSON.stringify(row))
843
+ return true
844
+ } else {
845
+ if (this.bookList.findIndex(res => res === row.f_userinfo_id) !== -1) {
846
+ console.log('row1111', JSON.stringify(row))
847
+ return true
848
+ } else {
849
+ return false
850
+ }
851
+ }
852
+ },
853
+ checkChange (row, e) {
854
+ console.log('e', e.target.checked)
855
+ if (e.target.checked) {
856
+ this.bookList.push(row.f_userinfo_id)
857
+ } else {
858
+ this.bookList.splice(this.bookList.findIndex(res => res === row.f_userinfo_id), 1)
859
+ }
860
+ // console.log('aaaaa', JSON.stringify(this.bookList))
861
+ },
862
+ pageCheckChange (row, e) {
863
+ console.log('e', e.target.checked)
864
+ if (e.target.checked) {
865
+ this.bookList.push(row.f_userinfo_id)
866
+ } else {
867
+ this.bookList.splice(this.bookList.findIndex(res => res === row.f_userinfo_id), 1)
868
+ }
869
+ },
870
+ getRes (obj) {
871
+ this.checkBook.f_orgid = obj.resids[0]
872
+ },
873
+ getResm (obj) {
874
+ this.$refs.paged.$refs.criteria.model.f_orgid = this.$login.convertToIn(obj.resids)
875
+ },
876
+ hidden () {
877
+ this.criteriaShow = !this.criteriaShow
878
+ },
879
+ selfSearch (args) {
880
+ this.isSearch = true
881
+ this.bookAll = false
882
+ this.isallchecked = false
883
+ this.bookList = []
884
+ // if (this.$refs.paged.$refs.criteria.model.f_orgid){
885
+ // args.condition += `f_orgid in ${this.$refs.paged.$refs.criteria.model.f_orgid}`
886
+ // }
887
+ if (this.permission === 'c2'){
888
+ args.condition +=` and tcb.f_depid = '${this.$login.f.depids}'`
889
+ }
890
+ if(args.model.gasbrand){
891
+ args.condition +=` and tuf.f_gasbrand_id=${args.model.gasbrand.id}`
892
+ }
893
+ this.model.search(args.condition, args.model)
894
+ },
895
+ getChecker(){
896
+ let http = new HttpResetClass()
897
+ http.load('POST', '/rs/search', {data: {source: 'this.getParentByType($department$).getAllChildrens().where(row.getAttributes().get($rolestr$).indexOf($安检员$) != -1))', userid: this.$login.f.id}}, {resolveMsg: null, rejectMsg: null})
898
+ .then(res => {
899
+ console.log('res666-->' + JSON.stringify(res))
900
+ this.checkers = res.data.map(res=>{
901
+ return {label:res.name,value:res.name}
902
+ })
903
+ })
904
+ },
905
+ freshCheckBook () {
906
+ this.checkBooks = []
907
+ new HttpResetClass().load('POST', `/rs/sql/safe_singleTable_OrderBy`, {
908
+ data: {
909
+ items: 'id,f_check_book_name',
910
+ tablename: 't_check_book',
911
+ condition: (this.$refs.paged.$refs.criteria.model.f_orgid?`f_orgid in ${this.$refs.paged.$refs.criteria.model.f_orgid}`:'1=1')+(this.permission === 'c2' ? ` and f_depid='${this.$login.f.depids}'`:'') ,
912
+ orderitem: 'id desc'
913
+ }
914
+ }, {resolveMsg: null, rejectMsg: null}).then(res => {
915
+ this.checkBooks.push({label: '全部', value: ''})
916
+ res.data.forEach(ress => {
917
+ this.checkBooks.push({
918
+ label: ress.f_check_book_name,
919
+ value: ress.id
920
+ })
921
+ })
922
+ })
923
+ }
924
+ },
925
+ watch: {
926
+ "isallchecked"(val){
927
+ if (val) {
928
+ // 全选
929
+ this.$refs.grid.model.rows.forEach((row=>{
930
+ this.bookList.push(row.f_userinfo_id)
931
+ }))
932
+ } else {
933
+ // 取消全选
934
+ this.isallchecked = false
935
+ this.bookList = []
936
+ }
937
+ }
938
+ },
939
+ ready () {
940
+ // 获取片区
941
+ this.getSliceArea()
942
+ // 获取营收气表参数
943
+ this.setConList()
944
+ if (this.permission === 'c1'){
945
+ this.$refs.paged.$refs.criteria.model.f_is_checkbook = 'f_check_book_name is null'
946
+ }else if(this.permission === 'c2'){
947
+ this.$refs.paged.$refs.criteria.model.f_is_checkbook = 'f_check_book_name is not null'
948
+ }
949
+
950
+ console.log('checkbook', this.$login.f)
951
+ this.checkBook.f_orgid = this.$login.f.orgid
952
+ console.log('permission2',this.permission)
953
+ // this.init=true
954
+ this.freshCheckBook()
955
+ this.getChecker()
956
+ }
957
+ }
958
+ </script>
959
+ <style scoped>
960
+ /*.btn-group > .btn:first-child {*/
961
+ /* margin-left: 0;*/
962
+ /* width: 100%;*/
963
+ /*}*/
964
+ </style>