safecheck-client 3.0.33-3 → 3.0.33-5

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