safecheck-client 4.0.0-52 → 4.0.0-53

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