address-client 4.0.17 → 4.0.19

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": "4.0.17",
3
+ "version": "4.0.19",
4
4
  "description": "地址管理前台组件",
5
5
  "author": "wanbochao",
6
6
  "license": "ISC",
@@ -127,7 +127,7 @@
127
127
  <th v-show="!$parent.$parent.$parent.$parent.areaShow"><nobr>抄表员</nobr></th>
128
128
  <th v-show="!$parent.$parent.$parent.$parent.areaShow"><nobr>房屋类型</nobr></th>
129
129
  <th v-show="!$parent.$parent.$parent.$parent.areaShow"><nobr>安装位置</nobr></th>
130
- <th v-show="!$parent.$parent.$parent.$parent.areaShow"><nobr>片区/管理站 </nobr></th>
130
+ <th v-show="!$parent.$parent.$parent.$parent.areaShow"><nobr>维修片区</nobr></th>
131
131
  <th><nobr>操作人</nobr></th>
132
132
  <th><nobr>操作日期</nobr></th>
133
133
  <th title="该小区下现有的地址数"><nobr>地址数</nobr></th>
@@ -254,7 +254,7 @@ export default {
254
254
  'f_inputtor':'抄表员',
255
255
  'f_house_type':'房屋类型',
256
256
  'f_position':'安装位置',
257
- 'f_slice_area':'片区/管理站',
257
+ 'f_slice_area':'维修片区',
258
258
  'f_operator':'操作人',
259
259
  'f_operate_date':'操作日期',
260
260
  'addressnum':'地址数'
@@ -107,9 +107,14 @@
107
107
  </div>
108
108
  <div :class="$parent.$parent.style" v-if="!$parent.$parent.$parent.showrightchange">
109
109
  <label class="font_normal_body">街&emsp;&emsp;道</label>
110
- <input type="text" class="input_search" style="width:60%" v-model="model.f_street"
111
- condition="f_street like '%{}%'" placeholder="街道/乡镇"
112
- :size="model.f_street ? model.f_street.length*2 : 6"/>
110
+ <v-select
111
+ :value.sync="$parent.$parent.selectedStreets"
112
+ multiple
113
+ :options="$parent.$parent.streetslist"
114
+ placeholder="请选择"
115
+ close-on-select
116
+ search="true">
117
+ </v-select>
113
118
  </div>
114
119
  <div :class="$parent.$parent.style" >
115
120
  <label class="font_normal_body">地址状态</label>
@@ -246,6 +251,9 @@
246
251
  // 公司下拉
247
252
  curorgid: [this.$login.f.orgid],
248
253
  f_orgid: '',
254
+ // 街道下拉
255
+ streetslist: [],
256
+ selectedStreets: [],
249
257
  getstate:[{label:'全部',value:''},{label:'有效',value:" = '有效' or a.f_state is null"},{label:'作废',value:" = '作废'"}],
250
258
  //文件上传弹框
251
259
  showFile: false,
@@ -264,6 +272,10 @@
264
272
  },
265
273
  ready(){
266
274
  readyGen(this)
275
+ // 初始化组织并加载街道
276
+ this.f_orgid = this.$login.convertToIn(this.curorgid)
277
+ this.f_filialeids = this.curorgid[0]
278
+ this.initstreets(` f_filialeid in ${this.f_orgid} `)
267
279
  this.search()
268
280
  },
269
281
  methods: {
@@ -328,21 +340,62 @@
328
340
  search () {
329
341
  this.$refs.paged.$refs.cri.search()
330
342
  },
343
+ // 初始化街道下拉
344
+ async initstreets (condition) {
345
+ try {
346
+ this.streetslist = []
347
+ const req = await this.$resetpost('rs/sql/address_singleTableOrderBy', {
348
+ data: {
349
+ items: '*',
350
+ tablename: 't_street',
351
+ orderitem: 'id',
352
+ condition
353
+ }
354
+ }, { resolveMsg: null, rejectMsg: '获取街道失败!' })
355
+ if (req && req.data) {
356
+ const seen = new Set()
357
+ this.streetslist = req.data.reduce((acc, row) => {
358
+ const key = row.f_street
359
+ if (key && !seen.has(key)) {
360
+ seen.add(key)
361
+ acc.push({
362
+ label: row.f_street,
363
+ value: row.f_street
364
+ })
365
+ }
366
+ return acc
367
+ }, [])
368
+ }
369
+ } catch (e) {
370
+ // ignore errors
371
+ }
372
+ },
331
373
  selfSearch (args) {
332
374
  if (!this.f_orgid) {
333
375
  this.getorg([this.$login.f.orgid])
334
376
  }
335
377
  args.condition = `${args.condition} and a.f_filialeid = '${this.f_filialeids}'`
378
+ if (Array.isArray(this.selectedStreets) && this.selectedStreets.length > 0) {
379
+ const streetConds = this.selectedStreets
380
+ .filter(s => !!s)
381
+ .map(s => `a.f_street = '${s.replace(/'/g, "''")}'`)
382
+ .join(' or ')
383
+ if (streetConds) {
384
+ args.condition = `${args.condition} and (${streetConds})`
385
+ }
386
+ }
336
387
  this.model.search(args.condition, args.model)
337
388
  },
338
389
 
339
390
  //清空
340
391
  clear(){
341
392
  this.$refs.paged.$refs.cri.model = {}
393
+ this.selectedStreets = []
342
394
  },
343
395
  getorg (val) {
344
396
  this.f_orgid = this.$login.convertToIn(val)
345
397
  this.f_filialeids = val[0]
398
+ this.initstreets(` f_filialeid in ${this.f_orgid} `)
346
399
  }
347
400
  },
348
401
  events: {
@@ -35,8 +35,14 @@
35
35
  </div>
36
36
  <div :class="$parent.$parent.style" v-if="!$parent.$parent.$parent.areaShow">
37
37
  <label class="font_normal_body">街道乡镇</label>
38
- <input type="text" class="input_search" style="width:60%" v-model="model.f_street"
39
- condition="f_street like '%{}%'" placeholder="街道/乡镇"/>
38
+ <v-select
39
+ :value.sync="$parent.$parent.selectedStreets"
40
+ multiple
41
+ :options="$parent.$parent.streetslist"
42
+ placeholder="请选择"
43
+ close-on-select
44
+ search="true">
45
+ </v-select>
40
46
  </div>
41
47
  <div class="col-sm-4 form-group button-range">
42
48
  <button class="button_search button_spacing" @click="search()" >查询</button>
@@ -67,9 +73,14 @@
67
73
  </div>
68
74
  <div :class="$parent.$parent.style" v-if="$parent.$parent.$parent.areaShow">
69
75
  <label class="font_normal_body">街道乡镇</label>
70
- <input type="text" class="input_search" style="width:60%" v-model="model.f_street"
71
- condition="f_street like '%{}%'" placeholder="街道/乡镇"
72
- :size="model.f_street ? model.f_street.length*2 : 6"/>
76
+ <v-select
77
+ :value.sync="$parent.$parent.selectedStreets"
78
+ multiple
79
+ :options="$parent.$parent.streetslist"
80
+ placeholder="请选择"
81
+ close-on-select
82
+ search="true">
83
+ </v-select>
73
84
  </div>
74
85
  <div :class="$parent.$parent.style">
75
86
  <label class="font_normal_body">小区名称</label>
@@ -179,6 +190,10 @@
179
190
  addflag: false,
180
191
  addtitle:'',
181
192
  getfield: {},
193
+ // 下拉:街道选项
194
+ streetslist: [],
195
+ // 已选街道(多选)
196
+ selectedStreets: [],
182
197
  // 公司下拉
183
198
  curorgid: [this.$login.f.orgid],
184
199
  f_orgid: '',
@@ -218,6 +233,9 @@
218
233
  },
219
234
  ready(){
220
235
  readyGen(this)
236
+ // 初始化组织 IN 条件,并加载默认街道
237
+ this.f_orgid = this.$login.convertToIn([this.$login.f.orgid])
238
+ this.initstreets(` f_orgid in ${this.f_orgid} `)
221
239
 
222
240
  },
223
241
  methods: {
@@ -227,6 +245,36 @@
227
245
  search() {
228
246
  this.$refs.paged.$refs.cri.search()
229
247
  },
248
+ // 初始化街道下拉数据
249
+ async initstreets (pconditon) {
250
+ try {
251
+ this.streetslist = []
252
+ const req = await this.$resetpost('rs/sql/address_singleTableOrderBy', {
253
+ data: {
254
+ items: '*',
255
+ tablename: 't_street',
256
+ orderitem: 'id',
257
+ condition: pconditon
258
+ }
259
+ }, { resolveMsg: null, rejectMsg: '获取街道失败!' })
260
+ if (req && req.data) {
261
+ const seen = new Set()
262
+ this.streetslist = req.data.reduce((acc, row) => {
263
+ const key = row.f_street
264
+ if (key && !seen.has(key)) {
265
+ seen.add(key)
266
+ acc.push({
267
+ label: row.f_street,
268
+ value: row.f_street
269
+ })
270
+ }
271
+ return acc
272
+ }, [])
273
+ }
274
+ } catch (e) {
275
+ // 忽略异常,保持为空列表
276
+ }
277
+ },
230
278
 
231
279
  async delete(row){
232
280
  if(row.id >= 0){
@@ -269,15 +317,28 @@
269
317
  }else{
270
318
  args.condition = `${args.condition} and s.f_filialeid = ${this.f_orgid}`
271
319
  }
320
+ // 街道多选条件
321
+ if (Array.isArray(this.selectedStreets) && this.selectedStreets.length > 0) {
322
+ const streetConds = this.selectedStreets
323
+ .filter(s => !!s)
324
+ .map(s => `s.f_street = '${s.replace(/'/g, "''")}'`)
325
+ .join(' or ')
326
+ if (streetConds) {
327
+ args.condition = `${args.condition} and (${streetConds})`
328
+ }
329
+ }
272
330
  this.model.search(args.condition, args.model)
273
331
  },
274
332
  //清空
275
333
  clear(){
276
334
  this.$refs.paged.$refs.cri.model = {}
335
+ this.selectedStreets = []
277
336
  },
278
337
  getorg (val) {
279
338
  this.f_orgid = this.$login.convertToIn(val)
280
339
  this.f_filialeids = val[0]
340
+ // 根据分公司刷新街道下拉
341
+ this.initstreets(` f_orgid in ${this.f_orgid} `)
281
342
  }
282
343
  },
283
344
  watch:{
@@ -13,8 +13,15 @@
13
13
  </div>
14
14
  <div class="form-group" :class="{'col-sm-3':$parent.$parent.$parent.areaShow,'col-sm-2':!$parent.$parent.$parent.areaShow}">
15
15
  <label class="font_normal_body">街道名称</label>
16
- <input type="text" class="input_search" style="width:60%" v-model="model.f_street"
17
- condition="f_street like '%{}%'" placeholder="街道名称"/>
16
+ <input type="text" v-show="false" v-model="model.f_street" condition="f_street like '%{}%'" />
17
+ <v-select
18
+ :value.sync="$parent.$parent.selectedStreets"
19
+ multiple
20
+ :options="$parent.$parent.streetslist"
21
+ placeholder="请选择"
22
+ close-on-select
23
+ search="true">
24
+ </v-select>
18
25
  </div>
19
26
  <div class="col-sm-4 form-group button-range">
20
27
  <button class="button_search button_spacing" @click="search()" >查询</button>
@@ -119,6 +126,10 @@
119
126
  model: new PagedList('api/af-revenue/sql/address_getstreetlist',20,{orderitem: this.orderitem?'"' + this.orderitem + ' "':`'f_city,f_district,f_iscity,f_street desc'`}),
120
127
  addflag: false,
121
128
  getfield: {},
129
+ // 下拉:街道选项
130
+ streetslist: [],
131
+ // 已选街道(多选)
132
+ selectedStreets: [],
122
133
  addtitle:'',
123
134
  // 公司下拉
124
135
  curorgid: [this.$login.f.orgid],
@@ -147,6 +158,9 @@
147
158
  },
148
159
  ready(){
149
160
  readyGen(this)
161
+ // 初始化组织 IN 条件,并加载默认街道
162
+ this.f_orgid = this.$login.convertToIn([this.$login.f.orgid])
163
+ this.initstreets(` f_orgid in ${this.f_orgid} `)
150
164
  this.search()
151
165
  },
152
166
  methods: {
@@ -156,6 +170,40 @@
156
170
  search () {
157
171
  this.$refs.paged.$refs.cri.search()
158
172
  },
173
+ // 初始化街道下拉数据
174
+ async initstreets (pconditon) {
175
+ try {
176
+ this.streetslist = []
177
+ const req = await this.$resetpost('rs/sql/address_singleTableOrderBy', {
178
+ data: {
179
+ items: '*',
180
+ tablename: 't_street',
181
+ orderitem: 'id',
182
+ condition: pconditon
183
+ }
184
+ }, { resolveMsg: null, rejectMsg: '获取街道失败!' })
185
+ if (req && req.data) {
186
+ const seen = new Set()
187
+ this.streetslist = req.data.reduce((acc, row) => {
188
+ const key = row.f_street
189
+ if (key && !seen.has(key)) {
190
+ seen.add(key)
191
+ acc.push({
192
+ label: row.f_street,
193
+ value: row.f_street
194
+ })
195
+ }
196
+ return acc
197
+ }, [])
198
+ // 若父容器使用其 streetslist,则同步去重后的结果
199
+ if (this.$parent && this.$parent.$parent && Array.isArray(this.$parent.$parent.streetslist)) {
200
+ this.$parent.$parent.streetslist = this.streetslist
201
+ }
202
+ }
203
+ } catch (e) {
204
+ // 忽略异常,保持为空列表
205
+ }
206
+ },
159
207
  async delete(row){
160
208
  if(row.id >= 0 ){
161
209
  var id = row.id
@@ -191,22 +239,36 @@
191
239
  if (!this.f_orgid) {
192
240
  this.getorg([this.$login.f.orgid])
193
241
  }
242
+ // 分公司多选条件
194
243
  args.condition = `${args.condition} and s.f_filialeid in ${this.f_orgid}`
244
+ // 街道多选条件
245
+ if (Array.isArray(this.selectedStreets) && this.selectedStreets.length > 0) {
246
+ const streetConds = this.selectedStreets
247
+ .filter(s => !!s)
248
+ .map(s => `s.f_street = '${s.replace(/'/g, "''")}'`)
249
+ .join(' or ')
250
+ if (streetConds) {
251
+ args.condition = `${args.condition} and (${streetConds})`
252
+ }
253
+ }
195
254
  this.model.search(args.condition, args.model)
196
255
  },
197
256
  //清空
198
257
  clear(){
199
258
  this.$refs.paged.$refs.cri.model = {}
259
+ this.selectedStreets = []
200
260
  },
201
261
  getorg (val) {
202
262
  this.f_orgid = this.$login.convertToIn(val)
203
- this.f_filialeids = val[0]
263
+ this.f_filialeids = Array.isArray(val) && val.length ? val[0] : ''
264
+ // 根据分公司(多选)刷新街道下拉
265
+ this.initstreets(` f_orgid in ${this.f_orgid} `)
204
266
  }
205
267
  },
206
268
  computed: {
207
269
  getCondition() {
208
270
  return {
209
- condition: `${this.$refs.paged.$refs.cri.condition}` + `and s.f_filialeid = '${this.f_filialeids}'`,
271
+ condition: `${this.$refs.paged.$refs.cri.condition}` + ` and s.f_filialeid in ${this.f_orgid}`,
210
272
  orderitem: this.orderitem ? `${this.orderitem}` : " id desc"
211
273
  }
212
274
  }