safecheck-client 3.0.34-79 → 3.0.34-80

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