address-client 3.0.40-aodeToV4 → 3.0.42-aodeToV4

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,5 +1,6 @@
1
1
  <template>
2
2
  <div class="flex" @keyup.enter="search">
3
+ <work-busy :is-busy="batchSubmitBusy"></work-busy>
3
4
  <criteria-paged :model="model" v-ref:paged>
4
5
  <criteria partial='criteria' @condition-changed='$parent.selfSearch' v-ref:cri>
5
6
  <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
@@ -53,6 +54,8 @@
53
54
  <button v-if="!$parent.$parent.f_special" class="button_new button_spacing" style="width: max-content;" @click="$parent.$parent.add('小区')">添加小区</button>
54
55
  <button v-if="$parent.$parent.f_special"class="button_new button_spacing" style="width: max-content;" @click="$parent.$parent.add('单位')">添加单位</button>
55
56
  <button v-if="$parent.$parent.checkitem.length>=1" class="button_clear button_spacing" @click="$parent.$parent.deleteall()">批量删除</button>
57
+ <button class="button_clear button_spacing" @click="$parent.$parent.batchModify()">批量修改</button>
58
+
56
59
  <button class="button_clear button_spacing" @click="$parent.$parent.clear()">清空</button>
57
60
  <export-excel :data="$parent.$parent.getCondition" :defaultselect="$parent.$parent.getfield"
58
61
  :field="$parent.$parent.getfield"
@@ -86,8 +89,87 @@
86
89
  condition="f_residential_area like '%{}%'" placeholder="小区"
87
90
  :size="model.f_residential_area ? model.f_residential_area.length*2 : 6"/>
88
91
  </div>
89
-
90
- </div>
92
+ </div>
93
+ <div class="row" v-if="$parent.$parent.criteriaShow">
94
+ <div :class="$parent.$parent.style">
95
+ <label class="font_normal_body">安检网格员</label>
96
+ <v-select
97
+ :value.sync="model.f_check_gridman"
98
+ v-model="model.f_check_gridman"
99
+ :options='$parent.$parent.gridmans'
100
+ :value-single="true"
101
+ placeholder='请选择'
102
+ close-on-select
103
+ condition="f_check_gridman = '{}'"
104
+ :search='true'>
105
+ </v-select>
106
+ </div>
107
+ <div :class="$parent.$parent.style">
108
+ <label class="font_normal_body">安检网格员电话</label>
109
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_check_phone"
110
+ condition="f_check_phone like '%{}%'" placeholder="电话"
111
+ :size="model.f_check_phone ? model.f_check_phone.length*2 : 6"/>
112
+ </div>
113
+ <div :class="$parent.$parent.style">
114
+ <label class="font_normal_body">置换网格员</label>
115
+ <v-select
116
+ :value.sync="model.f_replace_gridman"
117
+ v-model="model.f_replace_gridman"
118
+ :options='$parent.$parent.gridmans1'
119
+ :value-single="true"
120
+ placeholder='请选择'
121
+ close-on-select
122
+ condition="f_replace_gridman = '{}'"
123
+ :search='true'>
124
+ </v-select>
125
+ </div>
126
+ <div :class="$parent.$parent.style">
127
+ <label class="font_normal_body">置换网格员电话</label>
128
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_replace_phone"
129
+ condition="f_replace_phone like '%{}%'" placeholder="电话"
130
+ :size="model.f_replace_phone ? model.f_replace_phone.length*2 : 6"/>
131
+ </div>
132
+ </div>
133
+ <div class="row" v-if="$parent.$parent.criteriaShow">
134
+ <div :class="$parent.$parent.style">
135
+ <label class="font_normal_body">维修网格员</label>
136
+ <v-select
137
+ :value.sync="model.f_repair_gridman"
138
+ v-model="model.f_repair_gridman"
139
+ :options='$parent.$parent.gridmans2'
140
+ :value-single="true"
141
+ placeholder='请选择'
142
+ close-on-select
143
+ condition="f_repair_gridman = '{}'"
144
+ :search='true'>
145
+ </v-select>
146
+ </div>
147
+ <div :class="$parent.$parent.style">
148
+ <label class="font_normal_body">维修网格员电话</label>
149
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_repair_phone"
150
+ condition="f_repair_phone like '%{}%'" placeholder="电话"
151
+ :size="model.f_repair_phone ? model.f_repair_phone.length*2 : 6"/>
152
+ </div>
153
+ <div :class="$parent.$parent.style">
154
+ <label class="font_normal_body">工商业网格员</label>
155
+ <v-select
156
+ :value.sync="model.f_industry_gridman"
157
+ v-model="model.f_industry_gridman"
158
+ :options='$parent.$parent.gridmans3'
159
+ :value-single="true"
160
+ placeholder='请选择'
161
+ close-on-select
162
+ condition="f_industry_gridman = '{}'"
163
+ :search='true'>
164
+ </v-select>
165
+ </div>
166
+ <div :class="$parent.$parent.style">
167
+ <label class="font_normal_body">工商业网格员电话</label>
168
+ <input type="text" class="input_search" style="width:60%" v-model="model.f_industry_phone"
169
+ condition="f_industry_phone like '%{}%'" placeholder="电话"
170
+ :size="model.f_industry_phone ? model.f_industry_phone.length*2 : 6"/>
171
+ </div>
172
+ </div>
91
173
  </div>
92
174
 
93
175
 
@@ -96,11 +178,24 @@
96
178
  <template partial='head'>
97
179
  <tr>
98
180
  <th>
99
- <input
100
- type="checkbox"
101
- v-model="$parent.$parent.$parent.checkall"
102
- @change="$parent.$parent.$parent.chooseAll"
103
- />
181
+ <div style="display:flex;align-items:center;gap:5px;">
182
+ <span>删除</span>
183
+ <input
184
+ type="checkbox"
185
+ v-model="$parent.$parent.$parent.checkall"
186
+ @change="$parent.$parent.$parent.chooseAll"
187
+ />
188
+ </div>
189
+ </th>
190
+ <th>
191
+ <div style="display:flex;align-items:center;gap:5px;">
192
+ <span>修改</span>
193
+ <input
194
+ type="checkbox"
195
+ v-model="$parent.$parent.$parent.batchCheckall"
196
+ @change="$parent.$parent.$parent.batchChooseAll"
197
+ />
198
+ </div>
104
199
  </th>
105
200
  <th><nobr>序号</nobr></th>
106
201
  <th v-if="false"><nobr>省份</nobr></th>
@@ -125,6 +220,14 @@
125
220
  <th><nobr>关联地址 </nobr></th>
126
221
  <th><nobr>操作人</nobr></th>
127
222
  <th><nobr>操作日期</nobr></th>
223
+ <th><nobr>安检网格员</nobr></th>
224
+ <th><nobr>安检网格员电话</nobr></th>
225
+ <th><nobr>维修网格员</nobr></th>
226
+ <th><nobr>维修网格员电话</nobr></th>
227
+ <th><nobr>置换网格员</nobr></th>
228
+ <th><nobr>置换网格员电话</nobr></th>
229
+ <th><nobr>工商业网格员</nobr></th>
230
+ <th><nobr>工商业网格员电话</nobr></th>
128
231
  <th><nobr>操作</nobr></th>
129
232
 
130
233
  </tr>
@@ -140,6 +243,13 @@
140
243
  :checked="$parent.$parent.$parent.ischecked(row.id)"
141
244
  />
142
245
  </td>
246
+ <td style="text-align: center">
247
+ <input
248
+ type="checkbox"
249
+ @change="$parent.$parent.$parent.batchChooseOne($event, row, model.rows)"
250
+ :checked="$parent.$parent.$parent.isBatchChecked(row.id)"
251
+ />
252
+ </td>
143
253
  <td style="text-align:center"><nobr>{{$index + 1}}</nobr></td>
144
254
  <td style="text-align:center" v-if="false"><nobr>{{row.f_province}}</nobr></td>
145
255
  <td style="text-align:center" v-if="false"><nobr>{{row.f_city}}</nobr></td>
@@ -159,6 +269,14 @@
159
269
  <td style="text-align:center"><nobr>{{row.addresscount}}</nobr></td>
160
270
  <td style="text-align:center"><nobr>{{row.f_operator}}</nobr></td>
161
271
  <td style="text-align:center"><nobr>{{row.f_operate_date}}</nobr></td>
272
+ <td style="text-align:center"><nobr>{{row.f_check_gridman}}</nobr></td>
273
+ <td style="text-align:center"><nobr>{{row.f_check_phone}}</nobr></td>
274
+ <td style="text-align:center"><nobr>{{row.f_replace_gridman}}</nobr></td>
275
+ <td style="text-align:center"><nobr>{{row.f_replace_phone}}</nobr></td>
276
+ <td style="text-align:center"><nobr>{{row.f_repair_gridman}}</nobr></td>
277
+ <td style="text-align:center"><nobr>{{row.f_repair_phone}}</nobr></td>
278
+ <td style="text-align:center"><nobr>{{row.f_industry_gridman}}</nobr></td>
279
+ <td style="text-align:center"><nobr>{{row.f_industry_phone}}</nobr></td>
162
280
  <td><nobr>
163
281
  <!--<button type="button" name="button" class="btn btn-link"
164
282
  @click.stop="$parent.$parent.$parent.modify(row)">修改</button>-->
@@ -170,11 +288,78 @@
170
288
  <template partial='foot'></template>
171
289
  </data-grid>
172
290
  </criteria-paged>
291
+ <!-- 批量修改:仅网格员下拉;未选择的项不提交、后端不更新 -->
292
+ <modal :show.sync="batchModifyShow" width="520px" backdrop="false">
293
+ <header slot="modal-header" class="modal-header">
294
+ <h4 class="modal-title" style="text-align: center;">
295
+ 批量修改网格员
296
+ <span v-if="batchDisplayCount > 0" class="batch-select-tip">(已选 {{ batchDisplayCount }} 个小区)</span>
297
+ </h4>
298
+ </header>
299
+ <article slot="modal-body" class="modal-body area-batch-gridman-body">
300
+ <p class="area-batch-hint">只填写需要修改的项,未选择的列保持原数据不变。</p>
301
+ <table class="area-batch-gridman-table">
302
+ <colgroup>
303
+ <col class="area-batch-col-label-l">
304
+ <col class="area-batch-col-select">
305
+ </colgroup>
306
+ <tr>
307
+ <th class="area-batch-th">安检网格员</th>
308
+ <td class="area-batch-td-ctrl area-batch-td-select">
309
+ <span v-if="batchGridmanLoading" class="area-batch-loading">加载中…</span>
310
+ <v-select v-else
311
+ :value.sync="batchData.f_check_gridman" :value-single="true"
312
+ :options='gridmans' placeholder='不修改请留空'
313
+ close-on-select @change="onBatchCheckChange">
314
+ </v-select>
315
+ </td>
316
+ </tr>
317
+ <tr>
318
+ <th class="area-batch-th">置换网格员</th>
319
+ <td class="area-batch-td-ctrl area-batch-td-select">
320
+ <span v-if="batchGridmanLoading" class="area-batch-loading">加载中…</span>
321
+ <v-select v-else
322
+ :value.sync="batchData.f_replace_gridman" :value-single="true"
323
+ :options='gridmans1' placeholder='不修改请留空'
324
+ close-on-select @change="onBatchReplaceChange">
325
+ </v-select>
326
+ </td>
327
+ </tr>
328
+ <tr>
329
+ <th class="area-batch-th">维修网格员</th>
330
+ <td class="area-batch-td-ctrl area-batch-td-select">
331
+ <span v-if="batchGridmanLoading" class="area-batch-loading">加载中…</span>
332
+ <v-select v-else
333
+ :value.sync="batchData.f_repair_gridman" :value-single="true"
334
+ :options='gridmans2' placeholder='不修改请留空'
335
+ close-on-select @change="onBatchRepairChange">
336
+ </v-select>
337
+ </td>
338
+ </tr>
339
+ <tr>
340
+ <th class="area-batch-th">工商业网格员</th>
341
+ <td class="area-batch-td-ctrl area-batch-td-select">
342
+ <span v-if="batchGridmanLoading" class="area-batch-loading">加载中…</span>
343
+ <v-select v-else
344
+ :value.sync="batchData.f_industry_gridman" :value-single="true"
345
+ :options='gridmans3' placeholder='不修改请留空'
346
+ close-on-select @change="onBatchIndustryChange">
347
+ </v-select>
348
+ </td>
349
+ </tr>
350
+ </table>
351
+ </article>
352
+ <footer slot="modal-footer" class="modal-footer">
353
+ <button class="button_search" @click="confirmBatchModify()">保存</button>
354
+ <button class="button_clear" @click="batchModifyShow = false">取消</button>
355
+ </footer>
356
+ </modal>
173
357
  </div>
174
358
  </template>
175
359
 
176
360
  <script>
177
361
  import { PagedList } from 'vue-client'
362
+ import { HttpResetClass } from 'vue-client'
178
363
 
179
364
  export default {
180
365
 
@@ -182,6 +367,10 @@
182
367
  return {
183
368
  checkall:false,
184
369
  checkitem:[],
370
+ batchCheckall:false,
371
+ batchCheckitem:[],
372
+ batchSelectAll: false,
373
+ batchTotalCount: 0,
185
374
  criteriaShow: false,
186
375
  model: new PagedList('api/af-revenue/sql/address_getarealist',50),
187
376
  addflag: false,
@@ -189,11 +378,42 @@
189
378
  condition:'',
190
379
  // 公司下拉
191
380
  curorgid: [this.$login.f.orgid],
192
- f_orgid: ''
381
+ f_orgid: '',
382
+ // 批量修改
383
+ batchModifyShow: false,
384
+ batchData: {
385
+ f_check_gridman: '',
386
+ f_replace_gridman: '',
387
+ f_repair_gridman: '',
388
+ f_industry_gridman: '',
389
+ f_check_phone: '',
390
+ f_replace_phone: '',
391
+ f_repair_phone: '',
392
+ f_industry_phone: ''
393
+ },
394
+ gridmans: [],
395
+ gridmans1: [],
396
+ gridmans2: [],
397
+ gridmans3: [],
398
+ // 批量修改弹窗的 name → phone 映射
399
+ batchGridmanPhoneMap: {},
400
+ batchGridmanPhoneMap1: {},
401
+ batchGridmanPhoneMap2: {},
402
+ batchGridmanPhoneMap3: {},
403
+ batchSubmitBusy: false,
404
+ batchGridmanLoading: false
193
405
  }
194
406
  },
195
407
  title: '小区管理',
196
408
  computed:{
409
+ /** 全选时用查询总条数;单选时用已勾选的条数(避免只显示当前页 50 条) */
410
+ batchDisplayCount () {
411
+ if (this.batchSelectAll) {
412
+ const n = this.batchTotalCount || (this.model && this.model.count) || 0
413
+ return n
414
+ }
415
+ return this.batchCheckitem.length
416
+ },
197
417
  getCondition() {
198
418
  return {condition: this.condition}
199
419
  },
@@ -239,6 +459,7 @@
239
459
  },
240
460
  ready(){
241
461
  this.search()
462
+ this.initGridmans()
242
463
  },
243
464
  methods: {
244
465
  chooseAll(){
@@ -267,6 +488,33 @@
267
488
  ischecked(row){
268
489
  return this.checkitem.indexOf(row)>-1
269
490
  },
491
+ batchChooseAll(){
492
+ if(this.batchCheckall){
493
+ this.batchSelectAll = true
494
+ // 立刻把当前页所有 id 勾上,不发请求
495
+ if (this.model && this.model.rows && this.model.rows.length > 0) {
496
+ this.batchCheckitem = this.model.rows.map(r => r.id).filter(id => id != null && id !== '')
497
+ }
498
+ this.batchTotalCount = this.model ? this.model.count : 0
499
+ } else {
500
+ this.batchSelectAll = false
501
+ this.batchTotalCount = 0
502
+ this.batchCheckitem = []
503
+ }
504
+ },
505
+ batchChooseOne(e, row, rows) {
506
+ this.batchCheckall = false
507
+ this.batchSelectAll = false
508
+ let checked = e.target.checked;
509
+ if(checked===false){
510
+ this.batchCheckitem.splice(this.batchCheckitem.indexOf(row.id), 1)
511
+ } else {
512
+ this.batchCheckitem.push(row.id)
513
+ }
514
+ },
515
+ isBatchChecked(row){
516
+ return this.batchCheckitem.indexOf(row)>-1
517
+ },
270
518
  operate (f_residential_area_id,f_residential_area) {
271
519
  this.$parent.areaShow = false;
272
520
  this.$parent.usershow=true
@@ -311,6 +559,292 @@
311
559
  })
312
560
 
313
561
 
562
+ },
563
+ // 批量修改网格员
564
+ async batchModify() {
565
+ if (this.batchCheckitem.length < 1) {
566
+ this.$showAlert('请先选择要修改的小区', 'warning', 2000)
567
+ return
568
+ }
569
+ if (this.batchSelectAll && this.model && this.model.count) {
570
+ this.batchTotalCount = this.model.count
571
+ }
572
+ this.batchData = {
573
+ f_check_gridman: '',
574
+ f_replace_gridman: '',
575
+ f_repair_gridman: '',
576
+ f_industry_gridman: '',
577
+ f_check_phone: '',
578
+ f_replace_phone: '',
579
+ f_repair_phone: '',
580
+ f_industry_phone: ''
581
+ }
582
+ this.batchModifyShow = true
583
+ this.batchGridmanLoading = true
584
+ await this.initGridmans()
585
+ this.batchGridmanLoading = false
586
+ },
587
+ // 获取网格员列表
588
+ async initGridmans() {
589
+ try {
590
+ let http = new HttpResetClass()
591
+ let param = {
592
+ tablename: 'AFV4_System.dbo.system_users',
593
+ condition: `roles like '%安检网格员%' and org_id = '${this.$login.f.orgid}'`
594
+ }
595
+ let param1 = {
596
+ tablename: 'AFV4_System.dbo.system_users',
597
+ condition: `roles like '%置换网格员%' and org_id = '${this.$login.f.orgid}'`
598
+ }
599
+ let param2 = {
600
+ tablename: 'AFV4_System.dbo.system_users',
601
+ condition: `roles like '%维修网格员%' and org_id = '${this.$login.f.orgid}'`
602
+ }
603
+ let param3 = {
604
+ tablename: 'AFV4_System.dbo.system_users',
605
+ condition: `roles like '%工商业网格员%' and org_id = '${this.$login.f.orgid}'`
606
+ }
607
+ let res = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
608
+ data: param
609
+ }, {
610
+ resolveMsg: null,
611
+ rejectMsg: '获取安检网格员失败!'
612
+ })
613
+ let res1 = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
614
+ data: param1
615
+ }, {
616
+ resolveMsg: null,
617
+ rejectMsg: '获取置换网格员失败!'
618
+ })
619
+ let res2 = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
620
+ data: param2
621
+ }, {
622
+ resolveMsg: null,
623
+ rejectMsg: '获取维修网格员失败!'
624
+ })
625
+ let res3 = await http.load('POST', 'api/af-revenue/sql/saleSingleTable', {
626
+ data: param3
627
+ }, {
628
+ resolveMsg: null,
629
+ rejectMsg: '获取工商业网格员失败!'
630
+ })
631
+ let arr = []
632
+ let arr1 = []
633
+ let arr2 = []
634
+ let arr3 = []
635
+ this.batchGridmanPhoneMap = {}
636
+ this.batchGridmanPhoneMap1 = {}
637
+ this.batchGridmanPhoneMap2 = {}
638
+ this.batchGridmanPhoneMap3 = {}
639
+ const pickPhone = (row) => {
640
+ if (!row) return ''
641
+ const p = row.phone != null && row.phone !== '' ? row.phone
642
+ : (row.f_phone != null && row.f_phone !== '' ? row.f_phone
643
+ : (row.mobile != null && row.mobile !== '' ? row.mobile : (row.tel || '')))
644
+ return String(p).trim()
645
+ }
646
+ const rowsFromRes = (res) => {
647
+ if (!res || !res.data) return []
648
+ const d = res.data
649
+ if (Array.isArray(d)) return d
650
+ if (d.rows && Array.isArray(d.rows)) return d.rows
651
+ return []
652
+ }
653
+ const list0 = rowsFromRes(res)
654
+ const list1 = rowsFromRes(res1)
655
+ const list2 = rowsFromRes(res2)
656
+ const list3 = rowsFromRes(res3)
657
+ list0.forEach(row => {
658
+ if (row && row.name != null && String(row.name).trim() !== '') {
659
+ const nm = String(row.name).trim()
660
+ arr.push({label: nm, value: nm})
661
+ const ph = pickPhone(row)
662
+ if (ph) this.batchGridmanPhoneMap[nm] = ph
663
+ }
664
+ })
665
+ list1.forEach(row => {
666
+ if (row && row.name != null && String(row.name).trim() !== '') {
667
+ const nm = String(row.name).trim()
668
+ arr1.push({label: nm, value: nm})
669
+ const ph = pickPhone(row)
670
+ if (ph) this.batchGridmanPhoneMap1[nm] = ph
671
+ }
672
+ })
673
+ list2.forEach(row => {
674
+ if (row && row.name != null && String(row.name).trim() !== '') {
675
+ const nm = String(row.name).trim()
676
+ arr2.push({label: nm, value: nm})
677
+ const ph = pickPhone(row)
678
+ if (ph) this.batchGridmanPhoneMap2[nm] = ph
679
+ }
680
+ })
681
+ list3.forEach(row => {
682
+ if (row && row.name != null && String(row.name).trim() !== '') {
683
+ const nm = String(row.name).trim()
684
+ arr3.push({label: nm, value: nm})
685
+ const ph = pickPhone(row)
686
+ if (ph) this.batchGridmanPhoneMap3[nm] = ph
687
+ }
688
+ })
689
+ this.gridmans = arr
690
+ this.gridmans1 = arr1
691
+ this.gridmans2 = arr2
692
+ this.gridmans3 = arr3
693
+ } catch (e) {
694
+ this.gridmans = []
695
+ this.gridmans1 = []
696
+ this.gridmans2 = []
697
+ this.gridmans3 = []
698
+ this.batchGridmanPhoneMap = {}
699
+ this.batchGridmanPhoneMap1 = {}
700
+ this.batchGridmanPhoneMap2 = {}
701
+ this.batchGridmanPhoneMap3 = {}
702
+ }
703
+ },
704
+ // 规范化网格员名称(change 可能返回字符串/对象/数组)
705
+ normalizeBatchGridmanName (val) {
706
+ if (val == null || val === '') return ''
707
+ if (typeof val === 'object') {
708
+ const v = val.value != null ? val.value : (val.label != null ? val.label : val.name)
709
+ return v != null ? String(v).trim() : ''
710
+ }
711
+ return String(val).trim()
712
+ },
713
+ // 批量弹窗选中网格员后自动填入电话
714
+ onBatchGridmanChange (type, val) {
715
+ const map = { check: 'batchGridmanPhoneMap', replace: 'batchGridmanPhoneMap1', repair: 'batchGridmanPhoneMap2', industry: 'batchGridmanPhoneMap3' }
716
+ const phoneField = { check: 'f_check_phone', replace: 'f_replace_phone', repair: 'f_repair_phone', industry: 'f_industry_phone' }
717
+ const mapKey = map[type]
718
+ const phoneKey = phoneField[type]
719
+ const name = this.normalizeBatchGridmanName(val)
720
+ if (mapKey && this[mapKey] && name) {
721
+ this.batchData[phoneKey] = this[mapKey][name] || ''
722
+ } else {
723
+ this.batchData[phoneKey] = ''
724
+ }
725
+ },
726
+ onBatchCheckChange (val) { this.onBatchGridmanChange('check', val) },
727
+ onBatchReplaceChange (val) { this.onBatchGridmanChange('replace', val) },
728
+ onBatchRepairChange (val) { this.onBatchGridmanChange('repair', val) },
729
+ onBatchIndustryChange (val) { this.onBatchGridmanChange('industry', val) },
730
+ // 从 v-select 取值(可能为字符串、数组、对象)
731
+ normBatchGridmanVal (v) {
732
+ if (v === null || v === undefined) return null
733
+ if (Array.isArray(v)) {
734
+ if (v.length === 0) return null
735
+ const x = v[0]
736
+ if (x == null) return null
737
+ if (typeof x === 'object') {
738
+ const s = x.value != null ? x.value : x.label
739
+ if (s == null || String(s).trim() === '') return null
740
+ return String(s).trim()
741
+ }
742
+ const t = String(x).trim()
743
+ return t === '' ? null : t
744
+ }
745
+ if (typeof v === 'string') {
746
+ const t = v.trim()
747
+ return t === '' ? null : t
748
+ }
749
+ const t = String(v).trim()
750
+ return t === '' ? null : t
751
+ },
752
+ // 确认批量修改:只提交已选择的网格员字段及对应电话(前端拼接 setClause)
753
+ confirmBatchModify() {
754
+ const c = this.normBatchGridmanVal(this.batchData.f_check_gridman)
755
+ const r = this.normBatchGridmanVal(this.batchData.f_replace_gridman)
756
+ const rp = this.normBatchGridmanVal(this.batchData.f_repair_gridman)
757
+ const ind = this.normBatchGridmanVal(this.batchData.f_industry_gridman)
758
+ const parts = []
759
+ const labels = []
760
+ if (c != null) {
761
+ parts.push("f_check_gridman = '" + this.escapeSql(c) + "'")
762
+ parts.push("f_check_phone = '" + this.escapeSql(this.batchData.f_check_phone || '') + "'")
763
+ labels.push('安检网格员')
764
+ }
765
+ if (r != null) {
766
+ parts.push("f_replace_gridman = '" + this.escapeSql(r) + "'")
767
+ parts.push("f_replace_phone = '" + this.escapeSql(this.batchData.f_replace_phone || '') + "'")
768
+ labels.push('置换网格员')
769
+ }
770
+ if (rp != null) {
771
+ parts.push("f_repair_gridman = '" + this.escapeSql(rp) + "'")
772
+ parts.push("f_repair_phone = '" + this.escapeSql(this.batchData.f_repair_phone || '') + "'")
773
+ labels.push('维修网格员')
774
+ }
775
+ if (ind != null) {
776
+ parts.push("f_industry_gridman = '" + this.escapeSql(ind) + "'")
777
+ parts.push("f_industry_phone = '" + this.escapeSql(this.batchData.f_industry_phone || '') + "'")
778
+ labels.push('工商业网格员')
779
+ }
780
+ if (parts.length === 0) {
781
+ this.$showAlert('请至少选择一项要修改的网格员', 'warning', 2000)
782
+ return
783
+ }
784
+ const setClause = parts.join(',')
785
+
786
+ // 全选模式:先请求全量 id,再弹确认
787
+ if (this.batchSelectAll) {
788
+ if (!this.model || this.model.state !== '正确' || !this.model.count) {
789
+ this.$showAlert('查询数据已失效,请重新查询后再试', 'warning', 2000)
790
+ return
791
+ }
792
+ this._doBatchSubmit(setClause, labels, this.model.count, true)
793
+ } else {
794
+ if (this.batchCheckitem.length === 0) {
795
+ this.$showAlert('请先选择要修改的小区', 'warning', 2000)
796
+ return
797
+ }
798
+ this._doBatchSubmit(setClause, labels, this.batchCheckitem.length, false)
799
+ }
800
+ },
801
+ // SQL 字符串转义,防止注入
802
+ escapeSql(val) {
803
+ if (val == null) return ''
804
+ return String(val).replace(/'/g, "''")
805
+ },
806
+ // 统一提交逻辑
807
+ _doBatchSubmit(setClause, labels, count, fromAllSelect) {
808
+ const payload = { ids: null, setClause: setClause }
809
+ const msg = `共计修改${count}个小区,将更新:${labels.join('、')},请确认`
810
+ this.$showMessage(msg, ['confirm', 'cancel']).then(async (res) => {
811
+ if (res === 'confirm') {
812
+ this.batchSubmitBusy = true
813
+ try {
814
+ if (fromAllSelect) {
815
+ // 全选:发请求拉全量 id 用于提交
816
+ try {
817
+ let http = new HttpResetClass()
818
+ const opt = { resolveMsg: null, rejectMsg: null, aoteEncrypt: this.model.aoteEncrypt, encryKey: this.model.encryKey }
819
+ const url = `${this.model.url}?pageNo=1&pageSize=${this.model.count}`
820
+ const res2 = await http.load('POST', url, { data: this.model.params }, opt)
821
+ let list = res2 && res2.data
822
+ if (list && !Array.isArray(list) && list.rows) list = list.rows
823
+ if (Array.isArray(list) && list.length > 0) {
824
+ payload.ids = list.map(r => r.id).filter(id => id != null && id !== '')
825
+ }
826
+ } catch (e) { /* ignore */ }
827
+ if (!payload.ids || payload.ids.length === 0) {
828
+ this.$showAlert('全选数据获取失败,无法提交', 'warning', 2000)
829
+ return
830
+ }
831
+ } else {
832
+ payload.ids = this.batchCheckitem
833
+ }
834
+ await this.$resetpost('api/af-revenue/logic/batchUpdateGridman', payload, {
835
+ resolveMsg: '批量修改成功',
836
+ rejectMsg: '批量修改失败'
837
+ })
838
+ this.batchModifyShow = false
839
+ this.batchCheckitem = []
840
+ this.batchCheckall = false
841
+ this.batchSelectAll = false
842
+ this.search()
843
+ } finally {
844
+ this.batchSubmitBusy = false
845
+ }
846
+ }
847
+ })
314
848
  },
315
849
  add(val){
316
850
  if (this.f_filialeids) {
@@ -326,6 +860,10 @@
326
860
  },
327
861
  selfSearch (args) {
328
862
  this.checkall = false;
863
+ this.batchCheckall = false;
864
+ this.batchCheckitem = [];
865
+ this.batchSelectAll = false;
866
+ this.batchTotalCount = 0;
329
867
  this.$parent.usershow = false;
330
868
  this.$parent.areaShow = false;
331
869
  if (!this.f_orgid) {
@@ -355,3 +893,58 @@
355
893
 
356
894
  }
357
895
  </script>
896
+
897
+ <style>
898
+ .area-batch-gridman-body {
899
+ padding: 12px 20px 18px;
900
+ box-sizing: border-box;
901
+ }
902
+ .area-batch-hint {
903
+ margin: 0 0 12px;
904
+ color: #666;
905
+ font-size: 13px;
906
+ }
907
+ .batch-select-tip {
908
+ font-size: 13px;
909
+ font-weight: normal;
910
+ color: #e6a23c;
911
+ margin-left: 8px;
912
+ }
913
+ .area-batch-gridman-table {
914
+ width: 100%;
915
+ margin: 0;
916
+ table-layout: fixed;
917
+ border-collapse: separate;
918
+ border-spacing: 0 12px;
919
+ }
920
+ .area-batch-gridman-table .area-batch-col-label-l {
921
+ width: 9em;
922
+ }
923
+ .area-batch-gridman-table .area-batch-col-select {
924
+ width: auto;
925
+ }
926
+ .area-batch-loading {
927
+ color: #999;
928
+ font-size: 13px;
929
+ padding: 6px 0;
930
+ display: inline-block;
931
+ }
932
+ .area-batch-gridman-table .area-batch-th {
933
+ font-weight: normal;
934
+ text-align: right;
935
+ vertical-align: middle;
936
+ white-space: nowrap;
937
+ padding: 0 12px 0 0;
938
+ border: none;
939
+ overflow: visible;
940
+ }
941
+ .area-batch-gridman-table .area-batch-td-ctrl {
942
+ vertical-align: middle;
943
+ padding: 0;
944
+ border: none;
945
+ overflow: visible;
946
+ }
947
+ .area-batch-gridman-table .area-batch-td-select {
948
+ padding-right: 0;
949
+ }
950
+ </style>