safecheck-client 3.0.34-26 → 3.0.34-27

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,647 +1,649 @@
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-4">
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="f_userinfo_code='{}'">
12
- </div>
13
- <div class="form-group col-sm-4">
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="f_user_name like '%{}%'">
17
- </div>
18
- <div class="form-group col-sm-4">
19
- <button class="button_spacing button_search" @click="search()">查询</button>
20
- <div style="float: right" class="button_spacing"
21
- :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"
22
- @click="$parent.$parent.hidden()"></div>
23
- </div>
24
- </div>
25
- <div class="row">
26
- <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
27
- <label class="font_normal_body">地&emsp;&emsp;址</label>
28
- <input type="text" class="input_search" v-model="model.f_address"
29
- style="width: 60%" placeholder="地址" condition="f_address like '%{}%'">
30
- </div>
31
- <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
32
- <label class="font_normal_body">小区名称</label>
33
- <input type="text" class="input_search" v-model="model.f_residential_area"
34
- style="width: 60%" placeholder="小区名称" condition="f_residential_area like '%{}%'">
35
- </div>
36
- <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
37
- <label class="font_normal_body">客户类型</label>
38
- <v-select :value.sync="model.f_user_type" v-model='model.f_user_type'
39
- :value-single="true" style="width: 60%"
40
- class="select_list select"
41
- :options='$parent.$parent.userTypes' placeholder='客户类型'
42
- close-on-select
43
- condition="f_user_type ='{}'"></v-select>
44
- </div>
45
- <div class="col-sm-4 form-group" style="margin-bottom: 0px" v-show="$parent.$parent.criteriaShow">
46
- <label class="font_normal_body">公&emsp;&emsp;司</label>
47
- <right-tree-safe @re-res="$parent.$parent.getResm" v-model="model.f_orgid" condition="ui.f_orgid in {}"></right-tree-safe>
48
- </div>
49
- <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
50
- <label class="font_normal_body">安&ensp;检&ensp;册</label>
51
- <v-select :value.sync="model.f_check_book_id" v-model='model.f_check_book_id'
52
- :value-single="true" style="width: 60%"
53
- class="select_list select"
54
- :options='$parent.$parent.checkBooks' placeholder='安检册名称'
55
- close-on-select
56
- condition="f_check_book_id ='{}'"></v-select>
57
- </div>
58
- <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
59
- <label class="font_normal_body">是否在册</label>
60
- <v-select :value.sync="model.f_is_checkbook" v-model='model.f_is_checkbook'
61
- :value-single="true" style="width: 60%"
62
- class="select_list select"
63
- @change="$parent.$parent.changeState"
64
- :options='$parent.$parent.isCheckBook' placeholder='有无所属安检册'
65
- close-on-select
66
- condition="{}"></v-select>
67
- </div>
68
- </div>
69
- <div class="row">
70
- <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
71
- <label class="font_normal_body">通气开始</label>
72
- <datepicker
73
- :value.sync="model.f_gas_date_str"
74
- style="width: 60%"
75
- :format="'yyyy-MM-dd 00:00:00'"
76
- v-model="model.f_gas_date_str"
77
- condition="f_uservent_date > '{}'"
78
- >
79
- </datepicker>
80
- </div>
81
- <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
82
- <label class="font_normal_body">通气结束</label>
83
- <datepicker
84
- :value.sync="model.f_gas_date_end"
85
- style="width: 60%"
86
- :format="'yyyy-MM-dd 23:59:59'"
87
- v-model="model.f_gas_date_end"
88
- condition="f_uservent_date < '{}'"
89
- >
90
- </datepicker>
91
- </div>
92
- <div class="form-group col-sm-2" v-show="$parent.$parent.criteriaShow" >
93
- <label class="font_normal_body">开始时间</label>
94
- <datepicker
95
- :value.sync="model.f_check_start"
96
- placeholder='首次通气时间' style="width: 60%"
97
- :disabled-days-of-week="[]"
98
- :format="'yyyy-MM-dd'"
99
- :show-rest-button="reset"
100
- v-model="model.f_check_start"
101
- condition="f_uservent_date > ='{} 00:00:00'">
102
- </datepicker>
103
- </div>
104
- <div class="form-group col-sm-2" v-show="$parent.$parent.criteriaShow" >
105
- <label class="font_normal_body">结束时间</label>
106
- <datepicker
107
- :value.sync="model.f_check_end"
108
- placeholder='首次通气时间' style="width: 60%"
109
- :disabled-days-of-week="[]"
110
- :format="'yyyy-MM-dd'"
111
- :show-rest-button="reset"
112
- v-model="model.f_check_end"
113
- condition="f_uservent_date <= '{} 23:59:59'">
114
- </datepicker>
115
- </div>
116
- </div>
117
- </div>
118
- </criteria>
119
- <data-grid class="list_area table_sy" style="overflow: hidden" :model="model" partial='list' v-ref:grid>
120
- <template partial='head'>
121
- <tr @dblclick.stop="">
122
- <th>
123
- <nobr><input type="checkbox" v-model="$parent.$parent.$parent.bookAll"></input>全选</nobr>
124
- </th>
125
- <th>
126
- <nobr>客户姓名</nobr>
127
- </th>
128
- <th>
129
- <nobr>客户编号</nobr>
130
- </th>
131
- <th>
132
- <nobr>客户类型</nobr>
133
- </th>
134
- <th>
135
- <nobr>客户电话</nobr>
136
- </th>
137
- <th>
138
- <nobr>用户单位</nobr>
139
- </th>
140
- <th>
141
- <nobr>客户地址</nobr>
142
- </th>
143
- <th>
144
- <nobr>首次通气时间</nobr>
145
- </th>
146
- <th>
147
- <nobr>所属安检册</nobr>
148
- </th>
149
- </tr>
150
- </template>
151
- <template partial='body'>
152
- <td style="text-align: center">
153
- <nobr><input type="checkbox" :checked="$parent.$parent.$parent.checkModel(row)"
154
- @change="$parent.$parent.$parent.checkChange(row, $event)"></input>
155
- </nobr>
156
- </td>
157
- <td style="text-align: center">{{ row.f_user_name }}</td>
158
- <td style="text-align: center">{{ row.f_userinfo_code }}</td>
159
- <td style="text-align: center">{{ row.f_user_type }}</td>
160
- <td style="text-align: center">{{ row.f_user_phone }}</td>
161
- <td style="text-align: center">{{ row.f_residential_area }}</td>
162
- <td style="text-align: center">{{ row.f_address }}</td>
163
- <td style="text-align: center">{{ row.f_uservent_date }}</td>
164
- <td style="text-align: center">{{ row.f_check_book_name }}</td>
165
- </template>
166
- </data-grid>
167
- </criteria-paged>
168
- </div>
169
- <modal :show.sync="showModal" :backdrop="false">
170
- <div slot="modal-header" class="modal-header">
171
- <h4 class="modal-title">
172
- 创建片区
173
- </h4>
174
- </div>
175
- <div slot="modal-body" class="modal-body">
176
- <div v-if="true">
177
- <div class="row" style="margin-top: 10px">
178
- <div class="col-sm-12 form-group" style="margin: 0">
179
- <role-selector-safe
180
- @re-res="getRes"
181
- role-name="安检员"
182
- role-lable="安&nbsp;检&nbsp;员&nbsp;"
183
- :value.sync="checkBook.f_checker_name"
184
- v-model="checkBook.f_checker_name">
185
- </role-selector-safe>
186
- </div>
187
- <div class="form-group col-sm-6" style="margin-top: 20px">
188
- <label class="font_normal_body">片区名</label>
189
- <input type="text" class="input_search" v-model="checkBook.f_check_book_name"
190
- style="width: 60%" >
191
- </div>
192
- <div class="form-group col-sm-6" style="margin-top: 20px">
193
- <label class="font_normal_body">执行日期</label>
194
- <datepicker
195
- :value.sync="checkBook.f_run_date"
196
- style="width: 60%"
197
- :format="'yyyy-MM-dd'"
198
- v-model="checkBook.f_run_date"
199
- >
200
- </datepicker>
201
- </div>
202
- <div class="form-group col-sm-6" style="margin-top: 20px">
203
- <label class="font_normal_body">执行周期</label>
204
- <input type="number" class="input_search" v-model="checkBook.f_around_time"
205
- style="width: 60%" >
206
- </div>
207
- <div class="form-group col-sm-6" style="margin-top: 20px">
208
- <label class="font_normal_body">周期单位</label>
209
- <v-select :value.sync="checkBook.f_around_unit" v-model='checkBook.f_around_unit'
210
- :value-single="true" style="width: 60%"
211
- class="select_list select"
212
- :options='aroundUnit' placeholder=''
213
- close-on-select></v-select>
214
- </div>
215
- </div>
216
- </div>
217
- </div>
218
- <div slot="modal-footer" class="modal-footer" style="text-align: center">
219
- <button class="button_search" style="margin-right: 20px" @click="ok">确认</button>
220
- <button class="button_search" @click="cancel">取消</button>
221
- </div>
222
- </modal>
223
- <modal :show.sync="showModal2" :backdrop="false">
224
- <div slot="modal-header" class="modal-header">
225
- <h4 class="modal-title">
226
- 添加用户
227
- </h4>
228
- </div>
229
- <div slot="modal-body" class="modal-body">
230
- <div v-if="true">
231
- <div class="row" style="margin-top: 10px">
232
- <div class="form-group col-sm-12" style="margin-top: 20px">
233
- <label class="font_normal_body">片&ensp;区&ensp;名</label>
234
- <v-select :value.sync="selectBook" v-model='selectBook'
235
- :value-single="true" style="width: 80%"
236
- class="select_list select"
237
- :options='checkBooks' placeholder=''
238
- close-on-select></v-select>
239
- </div>
240
- </div>
241
- </div>
242
- </div>
243
- <div slot="modal-footer" class="modal-footer" style="text-align: center">
244
- <button class="button_search" style="margin-right: 20px" @click="ok2">确认</button>
245
- <button class="button_search" @click="cancel2">取消</button>
246
- </div>
247
- </modal>
248
- <modal :show.sync="showModal3" :backdrop="false">
249
- <div slot="modal-header" class="modal-header">
250
- <h4 class="modal-title">
251
- 调整用户
252
- </h4>
253
- </div>
254
- <div slot="modal-body" class="modal-body">
255
- <div v-if="true">
256
- <div class="row" style="margin-top: 10px;text-align: center">
257
- <div class="form-group col-sm-12" style="margin-top: 20px">
258
- <label class="font_normal_body">安&ensp;检&ensp;册</label>
259
- <v-select :value.sync="selectBook" v-model='selectBook'
260
- :value-single="true" style="width: 80%"
261
- class="select_list select"
262
- :options='checkBooks' placeholder=''
263
- close-on-select></v-select>
264
- </div>
265
- </div>
266
- </div>
267
- </div>
268
- <div slot="modal-footer" class="modal-footer" style="text-align: center">
269
- <button class="button_search" style="margin-right: 20px" @click="ok3">确认</button>
270
- <button class="button_search" @click="cancel3">取消</button>
271
- </div>
272
- </modal>
273
-
274
- </div>
275
- </template>
276
-
277
- <script>
278
- import {PagedList, HttpResetClass} from 'vue-client'
279
- import * as Util from "../../../components/Util";
280
- import bus from "../../../bus";
281
-
282
- export default {
283
- title: '片区管理',
284
- data () {
285
- let model = new PagedList('rs/sql/getUserByCheckBookuser', 20)
286
- return {
287
- model: model,
288
- criteriaShow: false,
289
- excelHeaders: {},
290
- checkBooks: [],
291
- f_orgid: '',
292
- bookAll: false,
293
- bookList: [],
294
- selectBook:'',
295
- userTypes: [{label: '全部', value: ''},{label: '民用', value: '民用'}, {label: '非民用', value: '非民用'}],
296
- // init:false,
297
- aroundUnit: [{label: '', value: ''}, {label: '', value: ''}, {label: '', value: ''}],
298
- isCheckBook: [{label: '全部', value: ''}, {label: '是', value: 'f_check_book_name is not null'}, {label: '否', value: 'f_check_book_name is null'}],
299
- isSearch: false,
300
- checkBook: {
301
- f_check_book_name: '',
302
- f_run_date: '',
303
- f_around_time: '',
304
- f_around_unit: '',
305
- f_create_date: Util.toStandardDateString(),
306
- f_create_person: this.$login.f.name,
307
- f_orgid: '',
308
- f_checker_name: ''
309
- },
310
- showModal: false,
311
- showModal2: false,
312
- showModal3: false
313
- }
314
- },
315
- computed: {
316
- searchData () {
317
- return {condition: this.model.condition}
318
- },
319
- bookCondition () {
320
- return this.model.condition
321
- },
322
- isCreateBook () {
323
- return this.$refs.paged.$refs.criteria.model.f_is_checkbook === 'f_check_book_name is null'
324
- },
325
- isChangeBook () {
326
- return this.$refs.paged.$refs.criteria.model.f_is_checkbook === 'f_check_book_name is not null'
327
- }
328
- },
329
- watch:{
330
- 'bookList'(){
331
- this.$emit('book-list',this.bookList)
332
- },
333
- 'bookAll'(val){
334
- if(!val){
335
- this.bookList=[]
336
- }
337
- this.bookList=[]
338
- for (let row of this.model.rows){
339
- this.bookList.push({f_userinfo_id:row.f_userinfo_id,f_plan_id:row.f_plan_id})
340
- }
341
- // this.$emit('book-all',this.bookAll)
342
- }
343
- },
344
- methods: {
345
- async ok2() {
346
- if (!this.selectBook) {
347
- this.$showMessage('请选择片区')
348
- return
349
- }
350
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
351
- let userCondition = ''
352
- if (this.bookList.length < 1) {
353
- //tag
354
- userCondition = this.bookCondition
355
- } else {
356
- userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
357
- userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
358
- }
359
- let addUser = `update t_user_address set f_check_book_id ='${this.selectBook}'
360
- FROM
361
- t_userinfo tui
362
- LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
363
- LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
364
- LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
365
- WHERE
366
- tui.f_user_state = '正常'
367
- AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
368
- AND ${userCondition}`
369
- await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: addUser}},
370
- {resolveMsg: null, rejectMsg: '添加用户失败'})
371
- this.$showMessage('添加用户成功')
372
- this.selectBook = ''
373
- this.bookAll = false
374
- this.bookList = []
375
- this.showModal2 = false
376
- this.$refs.paged.$refs.criteria.search()
377
- }
378
- },
379
- async ok3() {
380
- if (!this.selectBook) {
381
- this.$showMessage('请选择片区')
382
- return
383
- }
384
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
385
- let userCondition = ''
386
- if (this.bookList.length < 1) {
387
- //tag
388
- userCondition = this.bookCondition
389
- } else {
390
- //tag)
391
-
392
- userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
393
- userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
394
- //tag
395
- }
396
- let upUser = `update t_user_address set f_check_book_id ='${this.selectBook}'
397
- FROM
398
- t_userinfo tui
399
- LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
400
- LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
401
- LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
402
- WHERE
403
- tui.f_user_state = '正常'
404
- AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
405
- AND ${userCondition}`
406
- await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: upUser}},
407
- {resolveMsg: null, rejectMsg: '调整用户失败'})
408
- this.$showMessage('调整用户成功')
409
- this.selectBook = ''
410
- this.bookAll = false
411
- this.bookList = []
412
- this.showModal3 = false
413
- this.$refs.paged.$refs.criteria.search()
414
- }
415
- },
416
- cancel2(){
417
- this.selectBook = ''
418
- this.bookAll = false
419
- this.bookList = []
420
- this.showModal2 = false
421
- this.$refs.paged.$refs.criteria.search()
422
- },
423
- cancel3(){
424
- this.selectBook = ''
425
- this.bookAll = false
426
- this.bookList = []
427
- this.showModal3 = false
428
- this.$refs.paged.$refs.criteria.search()
429
- },
430
- addUser () {
431
- if (!this.isCreateBook) {
432
- this.$showMessage('请选择查询未划分片区的用户')
433
- return
434
- }
435
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
436
- this.showModal2 = true
437
- this.freshCheckBook()
438
- return
439
- }
440
- this.$showMessage('请选择用户')
441
- },
442
- upUser () {
443
- if (!this.isChangeBook) {
444
- this.$showMessage('请选择查询已划分片区的用户')
445
- return
446
- }
447
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
448
- this.showModal3 = true
449
- this.freshCheckBook()
450
- return
451
- }
452
- this.$showMessage('请选择用户')
453
- },
454
- async delUser () {
455
- if (!this.isChangeBook) {
456
- this.$showMessage('请选择查询已划分片区的用户')
457
- return
458
- }
459
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
460
- let userCondition= ''
461
- if (this.bookList.length < 1) {
462
- //tag
463
- userCondition = this.bookCondition
464
- } else {
465
- //tag)
466
-
467
- userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
468
- userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
469
- //tag
470
- }
471
- let delUser= `update t_user_address set f_check_book_id =null
472
- FROM
473
- t_userinfo tui
474
- LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
475
- LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
476
- LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
477
- WHERE
478
- tui.f_user_state = '正常'
479
- AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
480
- AND ${userCondition}`
481
- await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: delUser}},
482
- {resolveMsg: null, rejectMsg: '删除片区失败'})
483
- this.$showMessage('从片区删除所选用户成功')
484
- this.selectBook = ''
485
- this.bookAll = false
486
- this.bookList = []
487
- this.showModal3 = false
488
- this.$refs.paged.$refs.criteria.search()
489
- return
490
- }
491
- this.$showMessage('请选择用户')
492
- },
493
- beforeCreateBook () {
494
- if (!this.isCreateBook) {
495
- this.$showMessage('请选择查询未划分片区的用户')
496
- return
497
- }
498
- if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
499
- this.showModal = true
500
- return
501
- }
502
- this.$showMessage('请选择用户')
503
- },
504
- ok () {
505
- //tag)
506
- let condition = ''
507
- if (!this.checkBook.f_check_book_name) {
508
- return this.$showMessage('请填写册名')
509
- }
510
- if (!this.checkBook.f_checker_name) {
511
- return this.$showMessage('请选择安检员')
512
- }
513
- if (!this.checkBook.f_around_time || !this.checkBook.f_around_unit) {
514
- return this.$showMessage('请选填写周期信息')
515
- }
516
- if (!this.checkBook.f_run_date) {
517
- return this.$showMessage('执行日期')
518
- }
519
- if (this.bookList.length < 1) {
520
- //tag
521
- condition = this.bookCondition
522
- } else {
523
- //tag)
524
-
525
- condition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
526
- condition = 'tui.f_userinfo_id in (' + condition + ')'
527
- //tag
528
- }
529
- let data = {
530
- checkBook: this.checkBook,
531
- sqlStr: condition
532
- }
533
- new HttpResetClass().load('post', 'rs/logic/AddCheckBook', {data}).then(res => {
534
- //tag)
535
- if (res.data.id) {
536
- this.$showMessage('创建成功')
537
- this.showModal = false
538
- this.isSearch = false
539
- this.bookList = []
540
- this.bookAll = false
541
- this.freshCheckBook()
542
- this.$refs.paged.$refs.criteria.search()
543
- }
544
- })
545
- },
546
- changeState (val) {
547
- //tag
548
- //tag
549
- this.bookAll = false
550
- this.bookList = []
551
- if (this.$refs.paged.$refs.criteria.model.f_orgid){
552
- this.$refs.paged.$refs.criteria.search()
553
- }
554
- },
555
- cancel () {
556
- this.bookAll = false
557
- this.bookList = []
558
- this.showModal = false
559
- this.$refs.paged.$refs.criteria.search()
560
- },
561
- checkModel (row) {
562
- if (this.bookAll) {
563
- return true
564
- } else {
565
- if (this.bookList.findIndex(res => res === row.f_userinfo_id) !== -1) {
566
- return true
567
- } else {
568
- return false
569
- }
570
- }
571
- },
572
- checkChange (row, e) {
573
- if (e.target.checked) {
574
- this.bookList.push({f_userinfo_id:row.f_userinfo_id,f_plan_id:row.f_plan_id})
575
- } else {
576
- this.bookList.splice(this.bookList.findIndex(res => res.f_userinfo_id === row.f_userinfo_id), 1)
577
- }
578
- },
579
- getRes (obj) {
580
- this.checkBook.f_orgid = obj.resids[0]
581
- },
582
- getResm (obj) {
583
- this.$refs.paged.$refs.criteria.model.f_orgid = this.$login.convertToIn(obj.resids)
584
- },
585
- hidden () {
586
- this.criteriaShow = !this.criteriaShow
587
- },
588
- selfSearch (args) {
589
- this.isSearch = true
590
- this.bookAll = false
591
- this.bookList = []
592
-
593
- console.log("查询66666666666666666")
594
- this.$emit('book-condition',args.condition)
595
- // if (this.$refs.paged.$refs.criteria.model.f_orgid){
596
- // args.condition += `f_orgid in ${this.$refs.paged.$refs.criteria.model.f_orgid}`
597
- // }
598
- this.model.search(args.condition, args.model)
599
- },
600
- freshCheckBook () {
601
- this.checkBooks = []
602
- new HttpResetClass().load('POST', `/rs/sql/safe_singleTable_OrderBy`, {
603
- data: {
604
- items: 'id,f_check_book_name,f_check_book_type',
605
- tablename: 't_check_book',
606
- condition: this.$refs.paged.$refs.criteria.model.f_orgid?`f_orgid in ${this.$refs.paged.$refs.criteria.model.f_orgid}`:'1=1',
607
- orderitem: 'id desc'
608
- }
609
- }, {resolveMsg: null, rejectMsg: null}).then(res => {
610
- this.checkBooks.push({label: '全部', value: ''})
611
- res.data.forEach(ress => {
612
- console.log("片区类型",ress)
613
- if(ress.f_check_book_type ==='用户'){
614
- this.checkBooks.push({
615
- label: ress.f_check_book_name,
616
- value: ress.id
617
- })
618
- }
619
-
620
- })
621
- })
622
- }
623
- },
624
- beforeDestroy() {
625
- //tag
626
- bus.$off('fresh-user')
627
- },
628
- ready () {
629
- // bus.$on('fresh-user',()=>{
630
- // console.log("进入方法")
631
- // this.bookAll = false
632
- // this.bookList = []
633
- // this.$refs.paged.$refs.criteria.search()
634
- // })
635
- // this.$refs.paged.$refs.criteria.model.f_is_checkbook = 'f_check_book_name is null'
636
- // //tag
637
- // // this.init=true
638
- // this.freshCheckBook()
639
- }
640
- }
641
- </script>
642
- <style scoped>
643
- /*.btn-group > .btn:first-child {*/
644
- /* margin-left: 0;*/
645
- /* width: 100%;*/
646
- /*}*/
647
- </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-4">
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="f_userinfo_code='{}'">
12
+ </div>
13
+ <div class="form-group col-sm-4">
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="f_user_name like '%{}%'">
17
+ </div>
18
+ <div class="form-group col-sm-4">
19
+ <button class="button_spacing button_search" @click="search()">查询</button>
20
+ <div style="float: right" class="button_spacing"
21
+ :class="{'button_shrink_top':$parent.$parent.criteriaShow,'button_shrink_bottom':!$parent.$parent.criteriaShow}"
22
+ @click="$parent.$parent.hidden()"></div>
23
+ </div>
24
+ </div>
25
+ <div class="row">
26
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
27
+ <label class="font_normal_body">地&emsp;&emsp;址</label>
28
+ <input type="text" class="input_search" v-model="model.f_address"
29
+ style="width: 60%" placeholder="地址" condition="f_address like '%{}%'">
30
+ </div>
31
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
32
+ <label class="font_normal_body">小区名称</label>
33
+ <input type="text" class="input_search" v-model="model.f_residential_area"
34
+ style="width: 60%" placeholder="小区名称" condition="f_residential_area like '%{}%'">
35
+ </div>
36
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
37
+ <label class="font_normal_body">客户类型</label>
38
+ <v-select :value.sync="model.f_user_type" v-model='model.f_user_type'
39
+ :value-single="true" style="width: 60%"
40
+ class="select_list select"
41
+ :options='$parent.$parent.userTypes' placeholder='客户类型'
42
+ close-on-select
43
+ condition="f_user_type ='{}'"></v-select>
44
+ </div>
45
+ <div class="col-sm-4 form-group" style="margin-bottom: 0px" v-show="$parent.$parent.criteriaShow">
46
+ <label class="font_normal_body">公&emsp;&emsp;司</label>
47
+ <right-tree-safe @re-res="$parent.$parent.getResm" v-model="model.f_orgid" condition="ui.f_orgid in {}"></right-tree-safe>
48
+ </div>
49
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
50
+ <label class="font_normal_body">安&ensp;检&ensp;册</label>
51
+ <v-select :value.sync="model.f_check_book_id" v-model='model.f_check_book_id'
52
+ :value-single="true" style="width: 60%"
53
+ class="select_list select"
54
+ :options='$parent.$parent.checkBooks' placeholder='安检册名称'
55
+ close-on-select
56
+ condition="f_check_book_id ='{}'"></v-select>
57
+ </div>
58
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
59
+ <label class="font_normal_body">是否在册</label>
60
+ <v-select :value.sync="model.f_is_checkbook" v-model='model.f_is_checkbook'
61
+ :value-single="true" style="width: 60%"
62
+ class="select_list select"
63
+ @change="$parent.$parent.changeState"
64
+ :options='$parent.$parent.isCheckBook' placeholder='有无所属安检册'
65
+ close-on-select
66
+ condition="{}"></v-select>
67
+ </div>
68
+ </div>
69
+ <div class="row">
70
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
71
+ <label class="font_normal_body">通气开始</label>
72
+ <datepicker
73
+ :value.sync="model.f_gas_date_str"
74
+ style="width: 60%"
75
+ placeholder='用户首次通气'
76
+ :format="'yyyy-MM-dd 00:00:00'"
77
+ v-model="model.f_gas_date_str"
78
+ condition="f_uservent_date > '{}'"
79
+ >
80
+ </datepicker>
81
+ </div>
82
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow">
83
+ <label class="font_normal_body">通气结束</label>
84
+ <datepicker
85
+ :value.sync="model.f_gas_date_end"
86
+ style="width: 60%"
87
+ placeholder='用户首次通气'
88
+ :format="'yyyy-MM-dd 23:59:59'"
89
+ v-model="model.f_gas_date_end"
90
+ condition="f_uservent_date < '{}'"
91
+ >
92
+ </datepicker>
93
+ </div>
94
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow" >
95
+ <label class="font_normal_body">开始时间</label>
96
+ <datepicker
97
+ :value.sync="model.f_check_start"
98
+ placeholder='表具通气时间' style="width: 60%"
99
+ :disabled-days-of-week="[]"
100
+ :format="'yyyy-MM-dd'"
101
+ :show-rest-button="reset"
102
+ v-model="model.f_check_start"
103
+ condition="f_gas_date > ='{} 00:00:00'">
104
+ </datepicker>
105
+ </div>
106
+ <div class="form-group col-sm-4" v-show="$parent.$parent.criteriaShow" >
107
+ <label class="font_normal_body">结束时间</label>
108
+ <datepicker
109
+ :value.sync="model.f_check_end"
110
+ placeholder='表具通气时间' style="width: 60%"
111
+ :disabled-days-of-week="[]"
112
+ :format="'yyyy-MM-dd'"
113
+ :show-rest-button="reset"
114
+ v-model="model.f_check_end"
115
+ condition="f_gas_date <= '{} 23:59:59'">
116
+ </datepicker>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </criteria>
121
+ <data-grid class="list_area table_sy" style="overflow: hidden" :model="model" partial='list' v-ref:grid>
122
+ <template partial='head'>
123
+ <tr @dblclick.stop="">
124
+ <th>
125
+ <nobr><input type="checkbox" v-model="$parent.$parent.$parent.bookAll"></input>全选</nobr>
126
+ </th>
127
+ <th>
128
+ <nobr>客户姓名</nobr>
129
+ </th>
130
+ <th>
131
+ <nobr>客户编号</nobr>
132
+ </th>
133
+ <th>
134
+ <nobr>客户类型</nobr>
135
+ </th>
136
+ <th>
137
+ <nobr>客户电话</nobr>
138
+ </th>
139
+ <th>
140
+ <nobr>用户单位</nobr>
141
+ </th>
142
+ <th>
143
+ <nobr>客户地址</nobr>
144
+ </th>
145
+ <th>
146
+ <nobr>首次通气时间</nobr>
147
+ </th>
148
+ <th>
149
+ <nobr>所属安检册</nobr>
150
+ </th>
151
+ </tr>
152
+ </template>
153
+ <template partial='body'>
154
+ <td style="text-align: center">
155
+ <nobr><input type="checkbox" :checked="$parent.$parent.$parent.checkModel(row)"
156
+ @change="$parent.$parent.$parent.checkChange(row, $event)"></input>
157
+ </nobr>
158
+ </td>
159
+ <td style="text-align: center">{{ row.f_user_name }}</td>
160
+ <td style="text-align: center">{{ row.f_userinfo_code }}</td>
161
+ <td style="text-align: center">{{ row.f_user_type }}</td>
162
+ <td style="text-align: center">{{ row.f_user_phone }}</td>
163
+ <td style="text-align: center">{{ row.f_residential_area }}</td>
164
+ <td style="text-align: center">{{ row.f_address }}</td>
165
+ <td style="text-align: center">{{ row.f_uservent_date }}</td>
166
+ <td style="text-align: center">{{ row.f_check_book_name }}</td>
167
+ </template>
168
+ </data-grid>
169
+ </criteria-paged>
170
+ </div>
171
+ <modal :show.sync="showModal" :backdrop="false">
172
+ <div slot="modal-header" class="modal-header">
173
+ <h4 class="modal-title">
174
+ 创建片区
175
+ </h4>
176
+ </div>
177
+ <div slot="modal-body" class="modal-body">
178
+ <div v-if="true">
179
+ <div class="row" style="margin-top: 10px">
180
+ <div class="col-sm-12 form-group" style="margin: 0">
181
+ <role-selector-safe
182
+ @re-res="getRes"
183
+ role-name="安检员"
184
+ role-lable="安&nbsp;检&nbsp;员&nbsp;"
185
+ :value.sync="checkBook.f_checker_name"
186
+ v-model="checkBook.f_checker_name">
187
+ </role-selector-safe>
188
+ </div>
189
+ <div class="form-group col-sm-6" style="margin-top: 20px">
190
+ <label class="font_normal_body">片区名</label>
191
+ <input type="text" class="input_search" v-model="checkBook.f_check_book_name"
192
+ style="width: 60%" >
193
+ </div>
194
+ <div class="form-group col-sm-6" style="margin-top: 20px">
195
+ <label class="font_normal_body">执行日期</label>
196
+ <datepicker
197
+ :value.sync="checkBook.f_run_date"
198
+ style="width: 60%"
199
+ :format="'yyyy-MM-dd'"
200
+ v-model="checkBook.f_run_date"
201
+ >
202
+ </datepicker>
203
+ </div>
204
+ <div class="form-group col-sm-6" style="margin-top: 20px">
205
+ <label class="font_normal_body">执行周期</label>
206
+ <input type="number" class="input_search" v-model="checkBook.f_around_time"
207
+ style="width: 60%" >
208
+ </div>
209
+ <div class="form-group col-sm-6" style="margin-top: 20px">
210
+ <label class="font_normal_body">周期单位</label>
211
+ <v-select :value.sync="checkBook.f_around_unit" v-model='checkBook.f_around_unit'
212
+ :value-single="true" style="width: 60%"
213
+ class="select_list select"
214
+ :options='aroundUnit' placeholder=''
215
+ close-on-select></v-select>
216
+ </div>
217
+ </div>
218
+ </div>
219
+ </div>
220
+ <div slot="modal-footer" class="modal-footer" style="text-align: center">
221
+ <button class="button_search" style="margin-right: 20px" @click="ok">确认</button>
222
+ <button class="button_search" @click="cancel">取消</button>
223
+ </div>
224
+ </modal>
225
+ <modal :show.sync="showModal2" :backdrop="false">
226
+ <div slot="modal-header" class="modal-header">
227
+ <h4 class="modal-title">
228
+ 添加用户
229
+ </h4>
230
+ </div>
231
+ <div slot="modal-body" class="modal-body">
232
+ <div v-if="true">
233
+ <div class="row" style="margin-top: 10px">
234
+ <div class="form-group col-sm-12" style="margin-top: 20px">
235
+ <label class="font_normal_body">片&ensp;区&ensp;名</label>
236
+ <v-select :value.sync="selectBook" v-model='selectBook'
237
+ :value-single="true" style="width: 80%"
238
+ class="select_list select"
239
+ :options='checkBooks' placeholder=''
240
+ close-on-select></v-select>
241
+ </div>
242
+ </div>
243
+ </div>
244
+ </div>
245
+ <div slot="modal-footer" class="modal-footer" style="text-align: center">
246
+ <button class="button_search" style="margin-right: 20px" @click="ok2">确认</button>
247
+ <button class="button_search" @click="cancel2">取消</button>
248
+ </div>
249
+ </modal>
250
+ <modal :show.sync="showModal3" :backdrop="false">
251
+ <div slot="modal-header" class="modal-header">
252
+ <h4 class="modal-title">
253
+ 调整用户
254
+ </h4>
255
+ </div>
256
+ <div slot="modal-body" class="modal-body">
257
+ <div v-if="true">
258
+ <div class="row" style="margin-top: 10px;text-align: center">
259
+ <div class="form-group col-sm-12" style="margin-top: 20px">
260
+ <label class="font_normal_body">安&ensp;检&ensp;册</label>
261
+ <v-select :value.sync="selectBook" v-model='selectBook'
262
+ :value-single="true" style="width: 80%"
263
+ class="select_list select"
264
+ :options='checkBooks' placeholder=''
265
+ close-on-select></v-select>
266
+ </div>
267
+ </div>
268
+ </div>
269
+ </div>
270
+ <div slot="modal-footer" class="modal-footer" style="text-align: center">
271
+ <button class="button_search" style="margin-right: 20px" @click="ok3">确认</button>
272
+ <button class="button_search" @click="cancel3">取消</button>
273
+ </div>
274
+ </modal>
275
+
276
+ </div>
277
+ </template>
278
+
279
+ <script>
280
+ import {PagedList, HttpResetClass} from 'vue-client'
281
+ import * as Util from "../../../components/Util";
282
+ import bus from "../../../bus";
283
+
284
+ export default {
285
+ title: '片区管理',
286
+ data () {
287
+ let model = new PagedList('rs/sql/getUserByCheckBookuser', 20)
288
+ return {
289
+ model: model,
290
+ criteriaShow: false,
291
+ excelHeaders: {},
292
+ checkBooks: [],
293
+ f_orgid: '',
294
+ bookAll: false,
295
+ bookList: [],
296
+ selectBook:'',
297
+ userTypes: [{label: '全部', value: ''},{label: '民用', value: '民用'}, {label: '非民用', value: '非民用'}],
298
+ // init:false,
299
+ aroundUnit: [{label: '年', value: '年'}, {label: '月', value: '月'}, {label: '日', value: '月'}],
300
+ isCheckBook: [{label: '全部', value: ''}, {label: '是', value: 'f_check_book_name is not null'}, {label: '否', value: 'f_check_book_name is null'}],
301
+ isSearch: false,
302
+ checkBook: {
303
+ f_check_book_name: '',
304
+ f_run_date: '',
305
+ f_around_time: '',
306
+ f_around_unit: '',
307
+ f_create_date: Util.toStandardDateString(),
308
+ f_create_person: this.$login.f.name,
309
+ f_orgid: '',
310
+ f_checker_name: ''
311
+ },
312
+ showModal: false,
313
+ showModal2: false,
314
+ showModal3: false
315
+ }
316
+ },
317
+ computed: {
318
+ searchData () {
319
+ return {condition: this.model.condition}
320
+ },
321
+ bookCondition () {
322
+ return this.model.condition
323
+ },
324
+ isCreateBook () {
325
+ return this.$refs.paged.$refs.criteria.model.f_is_checkbook === 'f_check_book_name is null'
326
+ },
327
+ isChangeBook () {
328
+ return this.$refs.paged.$refs.criteria.model.f_is_checkbook === 'f_check_book_name is not null'
329
+ }
330
+ },
331
+ watch:{
332
+ 'bookList'(){
333
+ this.$emit('book-list',this.bookList)
334
+ },
335
+ 'bookAll'(val){
336
+ if(!val){
337
+ this.bookList=[]
338
+ }
339
+ this.bookList=[]
340
+ for (let row of this.model.rows){
341
+ this.bookList.push({f_userinfo_id:row.f_userinfo_id,f_plan_id:row.f_plan_id})
342
+ }
343
+ // this.$emit('book-all',this.bookAll)
344
+ }
345
+ },
346
+ methods: {
347
+ async ok2() {
348
+ if (!this.selectBook) {
349
+ this.$showMessage('请选择片区')
350
+ return
351
+ }
352
+ if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
353
+ let userCondition = ''
354
+ if (this.bookList.length < 1) {
355
+ //tag
356
+ userCondition = this.bookCondition
357
+ } else {
358
+ userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
359
+ userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
360
+ }
361
+ let addUser = `update t_user_address set f_check_book_id ='${this.selectBook}'
362
+ FROM
363
+ t_userinfo tui
364
+ LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
365
+ LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
366
+ LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
367
+ WHERE
368
+ tui.f_user_state = '正常'
369
+ AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
370
+ AND ${userCondition}`
371
+ await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: addUser}},
372
+ {resolveMsg: null, rejectMsg: '添加用户失败'})
373
+ this.$showMessage('添加用户成功')
374
+ this.selectBook = ''
375
+ this.bookAll = false
376
+ this.bookList = []
377
+ this.showModal2 = false
378
+ this.$refs.paged.$refs.criteria.search()
379
+ }
380
+ },
381
+ async ok3() {
382
+ if (!this.selectBook) {
383
+ this.$showMessage('请选择片区')
384
+ return
385
+ }
386
+ if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
387
+ let userCondition = ''
388
+ if (this.bookList.length < 1) {
389
+ //tag
390
+ userCondition = this.bookCondition
391
+ } else {
392
+ //tag)
393
+
394
+ userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
395
+ userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
396
+ //tag
397
+ }
398
+ let upUser = `update t_user_address set f_check_book_id ='${this.selectBook}'
399
+ FROM
400
+ t_userinfo tui
401
+ LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
402
+ LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
403
+ LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
404
+ WHERE
405
+ tui.f_user_state = '正常'
406
+ AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
407
+ AND ${userCondition}`
408
+ await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: upUser}},
409
+ {resolveMsg: null, rejectMsg: '调整用户失败'})
410
+ this.$showMessage('调整用户成功')
411
+ this.selectBook = ''
412
+ this.bookAll = false
413
+ this.bookList = []
414
+ this.showModal3 = false
415
+ this.$refs.paged.$refs.criteria.search()
416
+ }
417
+ },
418
+ cancel2(){
419
+ this.selectBook = ''
420
+ this.bookAll = false
421
+ this.bookList = []
422
+ this.showModal2 = false
423
+ this.$refs.paged.$refs.criteria.search()
424
+ },
425
+ cancel3(){
426
+ this.selectBook = ''
427
+ this.bookAll = false
428
+ this.bookList = []
429
+ this.showModal3 = false
430
+ this.$refs.paged.$refs.criteria.search()
431
+ },
432
+ addUser () {
433
+ if (!this.isCreateBook) {
434
+ this.$showMessage('请选择查询未划分片区的用户')
435
+ return
436
+ }
437
+ if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
438
+ this.showModal2 = true
439
+ this.freshCheckBook()
440
+ return
441
+ }
442
+ this.$showMessage('请选择用户')
443
+ },
444
+ upUser () {
445
+ if (!this.isChangeBook) {
446
+ this.$showMessage('请选择查询已划分片区的用户')
447
+ return
448
+ }
449
+ if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
450
+ this.showModal3 = true
451
+ this.freshCheckBook()
452
+ return
453
+ }
454
+ this.$showMessage('请选择用户')
455
+ },
456
+ async delUser () {
457
+ if (!this.isChangeBook) {
458
+ this.$showMessage('请选择查询已划分片区的用户')
459
+ return
460
+ }
461
+ if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
462
+ let userCondition= ''
463
+ if (this.bookList.length < 1) {
464
+ //tag
465
+ userCondition = this.bookCondition
466
+ } else {
467
+ //tag)
468
+
469
+ userCondition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
470
+ userCondition = 'tui.f_userinfo_id in (' + userCondition + ')'
471
+ //tag
472
+ }
473
+ let delUser= `update t_user_address set f_check_book_id =null
474
+ FROM
475
+ t_userinfo tui
476
+ LEFT JOIN t_userfiles tuf ON tui.f_userinfo_id= tuf.f_userinfo_id
477
+ LEFT JOIN t_user_address tua ON tuf.f_userinfo_id = tua.f_userinfo_id
478
+ LEFT JOIN t_check_book tcb ON tua.f_check_book_id= tcb.id
479
+ WHERE
480
+ tui.f_user_state = '正常'
481
+ AND ( tuf.f_table_state= '正常' OR tuf.f_table_state= '停用' )
482
+ AND ${userCondition}`
483
+ await new HttpResetClass().load('POST', 'rs/logic/runSQL', {data: {sql: delUser}},
484
+ {resolveMsg: null, rejectMsg: '删除片区失败'})
485
+ this.$showMessage('从片区删除所选用户成功')
486
+ this.selectBook = ''
487
+ this.bookAll = false
488
+ this.bookList = []
489
+ this.showModal3 = false
490
+ this.$refs.paged.$refs.criteria.search()
491
+ return
492
+ }
493
+ this.$showMessage('请选择用户')
494
+ },
495
+ beforeCreateBook () {
496
+ if (!this.isCreateBook) {
497
+ this.$showMessage('请选择查询未划分片区的用户')
498
+ return
499
+ }
500
+ if (this.isSearch && (this.bookAll || this.bookList.length > 0) && this.model.rows.length > 0) {
501
+ this.showModal = true
502
+ return
503
+ }
504
+ this.$showMessage('请选择用户')
505
+ },
506
+ ok () {
507
+ //tag)
508
+ let condition = ''
509
+ if (!this.checkBook.f_check_book_name) {
510
+ return this.$showMessage('请填写册名')
511
+ }
512
+ if (!this.checkBook.f_checker_name) {
513
+ return this.$showMessage('请选择安检员')
514
+ }
515
+ if (!this.checkBook.f_around_time || !this.checkBook.f_around_unit) {
516
+ return this.$showMessage('请选填写周期信息')
517
+ }
518
+ if (!this.checkBook.f_run_date) {
519
+ return this.$showMessage('执行日期')
520
+ }
521
+ if (this.bookList.length < 1) {
522
+ //tag
523
+ condition = this.bookCondition
524
+ } else {
525
+ //tag)
526
+
527
+ condition = JSON.stringify(this.bookList).substring(JSON.stringify(this.bookList).indexOf('[') + 1, JSON.stringify(this.bookList).indexOf(']'))
528
+ condition = 'tui.f_userinfo_id in (' + condition + ')'
529
+ //tag
530
+ }
531
+ let data = {
532
+ checkBook: this.checkBook,
533
+ sqlStr: condition
534
+ }
535
+ new HttpResetClass().load('post', 'rs/logic/AddCheckBook', {data}).then(res => {
536
+ //tag)
537
+ if (res.data.id) {
538
+ this.$showMessage('创建成功')
539
+ this.showModal = false
540
+ this.isSearch = false
541
+ this.bookList = []
542
+ this.bookAll = false
543
+ this.freshCheckBook()
544
+ this.$refs.paged.$refs.criteria.search()
545
+ }
546
+ })
547
+ },
548
+ changeState (val) {
549
+ //tag
550
+ //tag
551
+ this.bookAll = false
552
+ this.bookList = []
553
+ if (this.$refs.paged.$refs.criteria.model.f_orgid){
554
+ this.$refs.paged.$refs.criteria.search()
555
+ }
556
+ },
557
+ cancel () {
558
+ this.bookAll = false
559
+ this.bookList = []
560
+ this.showModal = false
561
+ this.$refs.paged.$refs.criteria.search()
562
+ },
563
+ checkModel (row) {
564
+ if (this.bookAll) {
565
+ return true
566
+ } else {
567
+ if (this.bookList.findIndex(res => res === row.f_userinfo_id) !== -1) {
568
+ return true
569
+ } else {
570
+ return false
571
+ }
572
+ }
573
+ },
574
+ checkChange (row, e) {
575
+ if (e.target.checked) {
576
+ this.bookList.push({f_userinfo_id:row.f_userinfo_id,f_plan_id:row.f_plan_id})
577
+ } else {
578
+ this.bookList.splice(this.bookList.findIndex(res => res.f_userinfo_id === row.f_userinfo_id), 1)
579
+ }
580
+ },
581
+ getRes (obj) {
582
+ this.checkBook.f_orgid = obj.resids[0]
583
+ },
584
+ getResm (obj) {
585
+ this.$refs.paged.$refs.criteria.model.f_orgid = this.$login.convertToIn(obj.resids)
586
+ },
587
+ hidden () {
588
+ this.criteriaShow = !this.criteriaShow
589
+ },
590
+ selfSearch (args) {
591
+ this.isSearch = true
592
+ this.bookAll = false
593
+ this.bookList = []
594
+
595
+ console.log("查询66666666666666666")
596
+ this.$emit('book-condition',args.condition)
597
+ // if (this.$refs.paged.$refs.criteria.model.f_orgid){
598
+ // args.condition += `f_orgid in ${this.$refs.paged.$refs.criteria.model.f_orgid}`
599
+ // }
600
+ this.model.search(args.condition, args.model)
601
+ },
602
+ freshCheckBook () {
603
+ this.checkBooks = []
604
+ new HttpResetClass().load('POST', `/rs/sql/safe_singleTable_OrderBy`, {
605
+ data: {
606
+ items: 'id,f_check_book_name,f_check_book_type',
607
+ tablename: 't_check_book',
608
+ condition: this.$refs.paged.$refs.criteria.model.f_orgid?`f_orgid in ${this.$refs.paged.$refs.criteria.model.f_orgid}`:'1=1',
609
+ orderitem: 'id desc'
610
+ }
611
+ }, {resolveMsg: null, rejectMsg: null}).then(res => {
612
+ this.checkBooks.push({label: '全部', value: ''})
613
+ res.data.forEach(ress => {
614
+ console.log("片区类型",ress)
615
+ if(ress.f_check_book_type ==='用户'){
616
+ this.checkBooks.push({
617
+ label: ress.f_check_book_name,
618
+ value: ress.id
619
+ })
620
+ }
621
+
622
+ })
623
+ })
624
+ }
625
+ },
626
+ beforeDestroy() {
627
+ //tag
628
+ bus.$off('fresh-user')
629
+ },
630
+ ready () {
631
+ // bus.$on('fresh-user',()=>{
632
+ // console.log("进入方法")
633
+ // this.bookAll = false
634
+ // this.bookList = []
635
+ // this.$refs.paged.$refs.criteria.search()
636
+ // })
637
+ // this.$refs.paged.$refs.criteria.model.f_is_checkbook = 'f_check_book_name is null'
638
+ // //tag
639
+ // // this.init=true
640
+ // this.freshCheckBook()
641
+ }
642
+ }
643
+ </script>
644
+ <style scoped>
645
+ /*.btn-group > .btn:first-child {*/
646
+ /* margin-left: 0;*/
647
+ /* width: 100%;*/
648
+ /*}*/
649
+ </style>