safecheck-client 3.0.33-1 → 3.0.33-3

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