safecheck-client 3.0.34-75 → 3.0.34-77

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