address-client 3.0.42-aodeToV4 → 3.0.43-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "address-client",
3
- "version": "3.0.42-aodeToV4",
3
+ "version": "3.0.43-aodeToV4",
4
4
  "description": "地址管理前台组件",
5
5
  "author": "wanbochao",
6
6
  "license": "ISC",
@@ -105,10 +105,17 @@
105
105
  </v-select>
106
106
  </div>
107
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"/>
108
+ <label class="font_normal_body">上次安检网格员</label>
109
+ <v-select
110
+ :value.sync="model.f_old_check_gridman"
111
+ v-model="model.f_old_check_gridman"
112
+ :options='$parent.$parent.gridmans'
113
+ :value-single="true"
114
+ placeholder='请选择'
115
+ close-on-select
116
+ condition="f_old_check_gridman = '{}'"
117
+ :search='true'>
118
+ </v-select>
112
119
  </div>
113
120
  <div :class="$parent.$parent.style">
114
121
  <label class="font_normal_body">置换网格员</label>
@@ -124,10 +131,17 @@
124
131
  </v-select>
125
132
  </div>
126
133
  <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"/>
134
+ <label class="font_normal_body">上次置换网格员</label>
135
+ <v-select
136
+ :value.sync="model.f_old_replace_gridman"
137
+ v-model="model.f_old_replace_gridman"
138
+ :options='$parent.$parent.gridmans1'
139
+ :value-single="true"
140
+ placeholder='请选择'
141
+ close-on-select
142
+ condition="f_old_replace_gridman = '{}'"
143
+ :search='true'>
144
+ </v-select>
131
145
  </div>
132
146
  </div>
133
147
  <div class="row" v-if="$parent.$parent.criteriaShow">
@@ -145,10 +159,17 @@
145
159
  </v-select>
146
160
  </div>
147
161
  <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"/>
162
+ <label class="font_normal_body">上次维修网格员</label>
163
+ <v-select
164
+ :value.sync="model.f_old_repair_gridman"
165
+ v-model="model.f_old_repair_gridman"
166
+ :options='$parent.$parent.gridmans2'
167
+ :value-single="true"
168
+ placeholder='请选择'
169
+ close-on-select
170
+ condition="f_old_repair_gridman = '{}'"
171
+ :search='true'>
172
+ </v-select>
152
173
  </div>
153
174
  <div :class="$parent.$parent.style">
154
175
  <label class="font_normal_body">工商业网格员</label>
@@ -164,10 +185,17 @@
164
185
  </v-select>
165
186
  </div>
166
187
  <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"/>
188
+ <label class="font_normal_body">上次工商业网格员</label>
189
+ <v-select
190
+ :value.sync="model.f_old_industry_gridman"
191
+ v-model="model.f_old_industry_gridman"
192
+ :options='$parent.$parent.gridmans3'
193
+ :value-single="true"
194
+ placeholder='请选择'
195
+ close-on-select
196
+ condition="f_old_industry_gridman = '{}'"
197
+ :search='true'>
198
+ </v-select>
171
199
  </div>
172
200
  </div>
173
201
  </div>
@@ -221,12 +249,16 @@
221
249
  <th><nobr>操作人</nobr></th>
222
250
  <th><nobr>操作日期</nobr></th>
223
251
  <th><nobr>安检网格员</nobr></th>
252
+ <th><nobr>上次安检网格员</nobr></th>
224
253
  <th><nobr>安检网格员电话</nobr></th>
225
- <th><nobr>维修网格员</nobr></th>
226
- <th><nobr>维修网格员电话</nobr></th>
227
254
  <th><nobr>置换网格员</nobr></th>
255
+ <th><nobr>上次置换网格员</nobr></th>
228
256
  <th><nobr>置换网格员电话</nobr></th>
257
+ <th><nobr>维修网格员</nobr></th>
258
+ <th><nobr>上次维修网格员</nobr></th>
259
+ <th><nobr>维修网格员电话</nobr></th>
229
260
  <th><nobr>工商业网格员</nobr></th>
261
+ <th><nobr>上次工商业网格员</nobr></th>
230
262
  <th><nobr>工商业网格员电话</nobr></th>
231
263
  <th><nobr>操作</nobr></th>
232
264
 
@@ -270,12 +302,16 @@
270
302
  <td style="text-align:center"><nobr>{{row.f_operator}}</nobr></td>
271
303
  <td style="text-align:center"><nobr>{{row.f_operate_date}}</nobr></td>
272
304
  <td style="text-align:center"><nobr>{{row.f_check_gridman}}</nobr></td>
305
+ <td style="text-align:center"><nobr>{{row.f_old_check_gridman}}</nobr></td>
273
306
  <td style="text-align:center"><nobr>{{row.f_check_phone}}</nobr></td>
274
307
  <td style="text-align:center"><nobr>{{row.f_replace_gridman}}</nobr></td>
308
+ <td style="text-align:center"><nobr>{{row.f_old_replace_gridman}}</nobr></td>
275
309
  <td style="text-align:center"><nobr>{{row.f_replace_phone}}</nobr></td>
276
310
  <td style="text-align:center"><nobr>{{row.f_repair_gridman}}</nobr></td>
311
+ <td style="text-align:center"><nobr>{{row.f_old_repair_gridman}}</nobr></td>
277
312
  <td style="text-align:center"><nobr>{{row.f_repair_phone}}</nobr></td>
278
313
  <td style="text-align:center"><nobr>{{row.f_industry_gridman}}</nobr></td>
314
+ <td style="text-align:center"><nobr>{{row.f_old_industry_gridman}}</nobr></td>
279
315
  <td style="text-align:center"><nobr>{{row.f_industry_phone}}</nobr></td>
280
316
  <td><nobr>
281
317
  <!--<button type="button" name="button" class="btn btn-link"
@@ -297,7 +333,7 @@
297
333
  </h4>
298
334
  </header>
299
335
  <article slot="modal-body" class="modal-body area-batch-gridman-body">
300
- <p class="area-batch-hint">只填写需要修改的项,未选择的列保持原数据不变。</p>
336
+ <p class="area-batch-hint">只填写需要修改的项,未选择的列保持原数据不变。选错后可点第一项「不修改」恢复为不提交该列。</p>
301
337
  <table class="area-batch-gridman-table">
302
338
  <colgroup>
303
339
  <col class="area-batch-col-label-l">
@@ -309,7 +345,7 @@
309
345
  <span v-if="batchGridmanLoading" class="area-batch-loading">加载中…</span>
310
346
  <v-select v-else
311
347
  :value.sync="batchData.f_check_gridman" :value-single="true"
312
- :options='gridmans' placeholder='不修改请留空'
348
+ :options='batchGridmanOptions' placeholder='不修改请留空'
313
349
  close-on-select @change="onBatchCheckChange">
314
350
  </v-select>
315
351
  </td>
@@ -320,7 +356,7 @@
320
356
  <span v-if="batchGridmanLoading" class="area-batch-loading">加载中…</span>
321
357
  <v-select v-else
322
358
  :value.sync="batchData.f_replace_gridman" :value-single="true"
323
- :options='gridmans1' placeholder='不修改请留空'
359
+ :options='batchGridmanOptions1' placeholder='不修改请留空'
324
360
  close-on-select @change="onBatchReplaceChange">
325
361
  </v-select>
326
362
  </td>
@@ -331,7 +367,7 @@
331
367
  <span v-if="batchGridmanLoading" class="area-batch-loading">加载中…</span>
332
368
  <v-select v-else
333
369
  :value.sync="batchData.f_repair_gridman" :value-single="true"
334
- :options='gridmans2' placeholder='不修改请留空'
370
+ :options='batchGridmanOptions2' placeholder='不修改请留空'
335
371
  close-on-select @change="onBatchRepairChange">
336
372
  </v-select>
337
373
  </td>
@@ -342,7 +378,7 @@
342
378
  <span v-if="batchGridmanLoading" class="area-batch-loading">加载中…</span>
343
379
  <v-select v-else
344
380
  :value.sync="batchData.f_industry_gridman" :value-single="true"
345
- :options='gridmans3' placeholder='不修改请留空'
381
+ :options='batchGridmanOptions3' placeholder='不修改请留空'
346
382
  close-on-select @change="onBatchIndustryChange">
347
383
  </v-select>
348
384
  </td>
@@ -414,6 +450,28 @@
414
450
  }
415
451
  return this.batchCheckitem.length
416
452
  },
453
+ /** 批量弹窗专用:首项 value 为空,选后等同「本列不参与修改」,不影响表格行内编辑的 gridmans */
454
+ // 批量弹窗:去掉 gridmans 里的「全部」首项,只保留「不修改」选项
455
+ batchGridmanOptions () {
456
+ const none = { label: '— 不修改(保持原数据)—', value: '' }
457
+ const src = this.gridmans[0] && this.gridmans[0].value === '' ? this.gridmans.slice(1) : this.gridmans
458
+ return [none, ...src]
459
+ },
460
+ batchGridmanOptions1 () {
461
+ const none = { label: '— 不修改(保持原数据)—', value: '' }
462
+ const src = this.gridmans1[0] && this.gridmans1[0].value === '' ? this.gridmans1.slice(1) : this.gridmans1
463
+ return [none, ...src]
464
+ },
465
+ batchGridmanOptions2 () {
466
+ const none = { label: '— 不修改(保持原数据)—', value: '' }
467
+ const src = this.gridmans2[0] && this.gridmans2[0].value === '' ? this.gridmans2.slice(1) : this.gridmans2
468
+ return [none, ...src]
469
+ },
470
+ batchGridmanOptions3 () {
471
+ const none = { label: '— 不修改(保持原数据)—', value: '' }
472
+ const src = this.gridmans3[0] && this.gridmans3[0].value === '' ? this.gridmans3.slice(1) : this.gridmans3
473
+ return [none, ...src]
474
+ },
417
475
  getCondition() {
418
476
  return {condition: this.condition}
419
477
  },
@@ -686,15 +744,15 @@
686
744
  if (ph) this.batchGridmanPhoneMap3[nm] = ph
687
745
  }
688
746
  })
689
- this.gridmans = arr
690
- this.gridmans1 = arr1
691
- this.gridmans2 = arr2
692
- this.gridmans3 = arr3
747
+ this.gridmans = [{ label: '全部', value: '' }, ...arr]
748
+ this.gridmans1 = [{ label: '全部', value: '' }, ...arr1]
749
+ this.gridmans2 = [{ label: '全部', value: '' }, ...arr2]
750
+ this.gridmans3 = [{ label: '全部', value: '' }, ...arr3]
693
751
  } catch (e) {
694
- this.gridmans = []
695
- this.gridmans1 = []
696
- this.gridmans2 = []
697
- this.gridmans3 = []
752
+ this.gridmans = [{ label: '全部', value: '' }]
753
+ this.gridmans1 = [{ label: '全部', value: '' }]
754
+ this.gridmans2 = [{ label: '全部', value: '' }]
755
+ this.gridmans3 = [{ label: '全部', value: '' }]
698
756
  this.batchGridmanPhoneMap = {}
699
757
  this.batchGridmanPhoneMap1 = {}
700
758
  this.batchGridmanPhoneMap2 = {}
@@ -727,6 +785,64 @@
727
785
  onBatchReplaceChange (val) { this.onBatchGridmanChange('replace', val) },
728
786
  onBatchRepairChange (val) { this.onBatchGridmanChange('repair', val) },
729
787
  onBatchIndustryChange (val) { this.onBatchGridmanChange('industry', val) },
788
+ // 判断 rowId 是否在 ids 里(统一字符串比较,防止 11434 vs "11434" 不匹配)
789
+ idInList (ids, rowId) {
790
+ return ids.some(id => String(id) === String(rowId))
791
+ },
792
+ // 按 ids 顺序从行列表中取出对应行(id 可能为数字或字符串)
793
+ pickRowsByIds (rows, ids) {
794
+ if (!rows || !ids || ids.length === 0) return []
795
+ const m = {}
796
+ rows.forEach(r => {
797
+ if (r && r.id != null) m[String(r.id)] = r
798
+ })
799
+ return ids.map(id => m[String(id)]).filter(Boolean)
800
+ },
801
+ // 批量修改前:拉取选中行的原始行(含 f_check_gridman 等)。列表接口分页,不能只用 pageSize=ids.length(会拿到前 N 条而非选中 id)
802
+ async collectOldGridmanRows (ids) {
803
+ if (!ids || ids.length === 0) return []
804
+ let got = this.model && this.model.rows ? this.pickRowsByIds(this.model.rows, ids) : []
805
+ if (got.length === ids.length) return got
806
+ try {
807
+ let http = new HttpResetClass()
808
+ const opt = { resolveMsg: null, rejectMsg: null, aoteEncrypt: this.model.aoteEncrypt, encryKey: this.model.encryKey }
809
+ const n = Math.max((this.model && this.model.count) || 0, ids.length, 50)
810
+ const url = `${this.model.url}?pageNo=1&pageSize=${n}`
811
+ const res = await http.load('POST', url, { data: this.model.params }, opt)
812
+ let list = res && res.data
813
+ if (list && !Array.isArray(list) && list.rows) list = list.rows
814
+ if (!Array.isArray(list)) return got
815
+ const full = this.pickRowsByIds(list, ids)
816
+ return full.length >= got.length ? full : got
817
+ } catch (e) {
818
+ return got
819
+ }
820
+ },
821
+ // 把「改前网格员」写入 setClause(只写 changedTypes 里的列)
822
+ appendBatchOldGridmanParts (setClause, rows, changedTypes) {
823
+ if (!changedTypes || changedTypes.length === 0) return
824
+ const typeToPair = {
825
+ check: ['f_old_check_gridman', 'f_check_gridman'],
826
+ replace: ['f_old_replace_gridman', 'f_replace_gridman'],
827
+ repair: ['f_old_repair_gridman', 'f_repair_gridman'],
828
+ industry:['f_old_industry_gridman', 'f_industry_gridman']
829
+ }
830
+ const valOf = (row, src) => (row[src] != null && row[src] !== '' ? String(row[src]) : '')
831
+ if (!rows || rows.length === 0) return
832
+ changedTypes.forEach(type => {
833
+ const pair = typeToPair[type]
834
+ if (!pair) return
835
+ const [oldCol, srcCol] = pair
836
+ if (rows.length === 1) {
837
+ setClause.push(oldCol + " = '" + this.escapeSql(valOf(rows[0], srcCol)) + "'")
838
+ } else {
839
+ const first = valOf(rows[0], srcCol)
840
+ if (rows.every(r => valOf(r, srcCol) === first)) {
841
+ setClause.push(oldCol + " = '" + this.escapeSql(first) + "'")
842
+ }
843
+ }
844
+ })
845
+ },
730
846
  // 从 v-select 取值(可能为字符串、数组、对象)
731
847
  normBatchGridmanVal (v) {
732
848
  if (v === null || v === undefined) return null
@@ -750,38 +866,44 @@
750
866
  return t === '' ? null : t
751
867
  },
752
868
  // 确认批量修改:只提交已选择的网格员字段及对应电话(前端拼接 setClause)
753
- confirmBatchModify() {
869
+ async confirmBatchModify() {
754
870
  const c = this.normBatchGridmanVal(this.batchData.f_check_gridman)
755
871
  const r = this.normBatchGridmanVal(this.batchData.f_replace_gridman)
756
872
  const rp = this.normBatchGridmanVal(this.batchData.f_repair_gridman)
757
873
  const ind = this.normBatchGridmanVal(this.batchData.f_industry_gridman)
758
874
  const parts = []
759
875
  const labels = []
876
+ // changedTypes 标记实际修改了哪几列,只对这些列写入 f_old_*
877
+ const changedTypes = []
760
878
  if (c != null) {
761
879
  parts.push("f_check_gridman = '" + this.escapeSql(c) + "'")
762
880
  parts.push("f_check_phone = '" + this.escapeSql(this.batchData.f_check_phone || '') + "'")
763
881
  labels.push('安检网格员')
882
+ changedTypes.push('check')
764
883
  }
765
884
  if (r != null) {
766
885
  parts.push("f_replace_gridman = '" + this.escapeSql(r) + "'")
767
886
  parts.push("f_replace_phone = '" + this.escapeSql(this.batchData.f_replace_phone || '') + "'")
768
887
  labels.push('置换网格员')
888
+ changedTypes.push('replace')
769
889
  }
770
890
  if (rp != null) {
771
891
  parts.push("f_repair_gridman = '" + this.escapeSql(rp) + "'")
772
892
  parts.push("f_repair_phone = '" + this.escapeSql(this.batchData.f_repair_phone || '') + "'")
773
893
  labels.push('维修网格员')
894
+ changedTypes.push('repair')
774
895
  }
775
896
  if (ind != null) {
776
897
  parts.push("f_industry_gridman = '" + this.escapeSql(ind) + "'")
777
898
  parts.push("f_industry_phone = '" + this.escapeSql(this.batchData.f_industry_phone || '') + "'")
778
899
  labels.push('工商业网格员')
900
+ changedTypes.push('industry')
779
901
  }
780
902
  if (parts.length === 0) {
781
903
  this.$showAlert('请至少选择一项要修改的网格员', 'warning', 2000)
782
904
  return
783
905
  }
784
- const setClause = parts.join(',')
906
+ const setClause = parts
785
907
 
786
908
  // 全选模式:先请求全量 id,再弹确认
787
909
  if (this.batchSelectAll) {
@@ -789,13 +911,13 @@
789
911
  this.$showAlert('查询数据已失效,请重新查询后再试', 'warning', 2000)
790
912
  return
791
913
  }
792
- this._doBatchSubmit(setClause, labels, this.model.count, true)
914
+ this._doBatchSubmit(setClause, labels, this.model.count, true, changedTypes)
793
915
  } else {
794
916
  if (this.batchCheckitem.length === 0) {
795
917
  this.$showAlert('请先选择要修改的小区', 'warning', 2000)
796
918
  return
797
919
  }
798
- this._doBatchSubmit(setClause, labels, this.batchCheckitem.length, false)
920
+ this._doBatchSubmit(setClause, labels, this.batchCheckitem.length, false, changedTypes)
799
921
  }
800
922
  },
801
923
  // SQL 字符串转义,防止注入
@@ -804,47 +926,56 @@
804
926
  return String(val).replace(/'/g, "''")
805
927
  },
806
928
  // 统一提交逻辑
807
- _doBatchSubmit(setClause, labels, count, fromAllSelect) {
808
- const payload = { ids: null, setClause: setClause }
929
+ // setClause: string[] 待更新的字段 parts,函数内部追加 f_old_* 字段后再 join
930
+ // fromAllSelect: bool 是否全选模式(需要自行拉 id + 旧数据)
931
+ // changedTypes: string[] 实际修改了哪些列(如 ['check']),只对这些列写入 f_old_*
932
+ async _doBatchSubmit(setClause, labels, count, fromAllSelect, changedTypes) {
933
+ const payload = { ids: null, setClause: '' }
809
934
  const msg = `共计修改${count}个小区,将更新:${labels.join('、')},请确认`
810
- this.$showMessage(msg, ['confirm', 'cancel']).then(async (res) => {
811
- if (res === 'confirm') {
812
- this.batchSubmitBusy = true
935
+ const confirmed = await this.$showMessage(msg, ['confirm', 'cancel'])
936
+ if (confirmed !== 'confirm') return
937
+ this.batchSubmitBusy = true
938
+ try {
939
+ if (fromAllSelect) {
940
+ if (!this.model || this.model.state !== '正确' || !this.model.count) {
941
+ this.$showAlert('查询数据已失效,请重新查询后再试', 'warning', 2000)
942
+ return
943
+ }
813
944
  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
945
+ let http = new HttpResetClass()
946
+ const opt = { resolveMsg: null, rejectMsg: null, aoteEncrypt: this.model.aoteEncrypt, encryKey: this.model.encryKey }
947
+ const url = `${this.model.url}?pageNo=1&pageSize=${this.model.count}`
948
+ const res2 = await http.load('POST', url, { data: this.model.params }, opt)
949
+ let list = res2 && res2.data
950
+ if (list && !Array.isArray(list) && list.rows) list = list.rows
951
+ if (Array.isArray(list) && list.length > 0) {
952
+ payload.ids = list.map(r => r.id).filter(id => id != null && id !== '')
953
+ const targetRows = list.filter(r => this.idInList(payload.ids, r.id))
954
+ this.appendBatchOldGridmanParts(setClause, targetRows, changedTypes)
833
955
  }
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
956
+ } catch (e) { /* ignore */ }
957
+ if (!payload.ids || payload.ids.length === 0) {
958
+ this.$showAlert('全选数据获取失败,无法提交', 'warning', 2000)
959
+ return
845
960
  }
961
+ } else {
962
+ payload.ids = this.batchCheckitem
963
+ const targetRows = await this.collectOldGridmanRows(this.batchCheckitem)
964
+ this.appendBatchOldGridmanParts(setClause, targetRows, changedTypes)
846
965
  }
847
- })
966
+ payload.setClause = setClause.join(',')
967
+ await this.$resetpost('api/af-revenue/logic/batchUpdateGridman', payload, {
968
+ resolveMsg: '批量修改成功',
969
+ rejectMsg: '批量修改失败'
970
+ })
971
+ this.batchModifyShow = false
972
+ this.batchCheckitem = []
973
+ this.batchCheckall = false
974
+ this.batchSelectAll = false
975
+ this.search()
976
+ } finally {
977
+ this.batchSubmitBusy = false
978
+ }
848
979
  },
849
980
  add(val){
850
981
  if (this.f_filialeids) {