address-client 3.2.92 → 3.2.93

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,351 +1,351 @@
1
- <template>
2
- <div class="span">
3
- <validator name='v'>
4
- <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='add'">添加{{areatype}}</p>
5
- <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='modify'&&areatype=='街道'">修改【{{streetmodel.f_street}}】街道</p>
6
- <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='modify'&&areatype=='省市区'">修改【{{pcdmodel.f_pcd}}】</p>
7
- <div class="auto select-overspread form-horizontal">
8
- <div style="text-align:right;margin-top:6px;" class="col-sm-12">
9
- <!-- 省市区-->
10
- <div v-if="areatype=='省市区'" class="row">
11
- <div class="col-sm-6 form-group "
12
- :class="[$v.f_province.required ? 'has-error' : 'has-success']">
13
- <label class="font_normal_body">省&emsp;&emsp;份</label>
14
- <input type="text" v-model="pcdmodel.f_province"
15
- class="input_search" style="width:60%" placeholder="省份"
16
- v-validate:f_province='{required: true }'>
17
- </div>
18
- <div class="col-sm-6 form-group "
19
- :class="[$v.f_city.required ? 'has-error' : 'has-success']">
20
- <label class="font_normal_body">城&emsp;&emsp;市</label>
21
- <input type="text" v-model="pcdmodel.f_city"
22
- class="input_search" style="width:60%" placeholder="城市"
23
- v-validate:f_city='{required: true }'>
24
- </div>
25
- <div class="col-sm-6 form-group "
26
- :class="[$v.f_district.required ? 'has-error' : 'has-success']">
27
- <label class="font_normal_body">区&ensp;&ensp;/&ensp;县</label>
28
- <input type="text" v-model="pcdmodel.f_district"
29
- class="input_search" style="width:60%" placeholder="区/县"
30
- v-validate:f_district='{required: true }'>
31
- </div>
32
- <div class="col-sm-6 form-group "
33
- :class="[$v.f_pcd_number.required ? 'has-error' : 'has-success']">
34
- <label class="font_normal_body">区域编码</label>
35
- <input type="text" v-model="pcdmodel.f_pcd_number"
36
- class="input_search" style="width:60%" placeholder="区域编码"
37
- @change="numberyanzheng"
38
- v-validate:f_pcd_number='{required: true }'>
39
- </div>
40
- <div class="col-sm-12 form-group">
41
- <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
42
- <textarea class="input_textarea" rows="3" style="margin-top:25px;width:80%;height: auto;" v-model="pcdmodel.f_comments"></textarea>
43
- </div>
44
- </div>
45
- <!-- 街道-->
46
- <div v-if="areatype=='街道'" class="row">
47
- <div class="col-sm-6 form-group "
48
- :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
49
- <label class="font_normal_body">省&ensp;市&ensp;区</label>
50
- <input type="text" v-show="false" v-model="streetmodel.f_pcd_id"
51
- v-validate:f_pcd_id='{required: true }'>
52
- <v-select
53
- :value.sync="streetmodel.f_pcd_id" :value-single="true"
54
- :options='pcdslist' placeholder='请选择'
55
- close-on-select search="true" @change="pcdChange">
56
- </v-select>
57
- </div>
58
- <div class="col-sm-6 form-group ">
59
- <label class="font_normal_body">街&ensp;道&ensp;办</label>
60
- <input type="text" v-show="false" v-model="streetmodel.f_street_manage_id">
61
- <v-select
62
- :value.sync="streetmodel.f_street_manage_id" :value-single="true"
63
- :options='streetmanagelist' placeholder='请选择'
64
- close-on-select search="true" @change="pcdChange">
65
- </v-select>
66
- </div>
67
- <div class="col-sm-6 form-group "
68
- :class="[$v.f_street.required ? 'has-error' : 'has-success']">
69
- <label class="font_normal_body">街道/乡镇</label>
70
- <input type="text" v-model="streetmodel.f_street"
71
- class="input_search" style="width:60%" placeholder="街道/乡镇"
72
- v-validate:f_street='{required: true }'>
73
- </div>
74
- <!-- <div class="col-sm-6 form-group "
75
- :class="[$v.f_iscity.required ? 'has-error' : 'has-success']">
76
- <label class="font_normal_body">地区类型</label>
77
- <input type="text" v-show="false" v-model="streetmodel.f_iscity"
78
- v-validate:f_iscity='{required: true }'>
79
- <v-select
80
- :value.sync="streetmodel.f_iscity" :value-single="true"
81
- :options='iscity' placeholder='请选择'
82
- close-on-select>
83
- </v-select>
84
- </div>-->
85
- <div class="col-sm-12 form-group">
86
- <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
87
- <textarea class="input_textarea" rows="3" style="margin-top:25px;width:80%;height: auto;" v-model="streetmodel.f_comments"></textarea>
88
- </div>
89
- </div>
90
-
91
- <div class="row">
92
- <div style="margin-top:40px;text-align:right;">
93
- <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
94
- <button class="button_clear button_spacing" @click="cancel()">取消</button>
95
- </div>
96
- <div v-if="areatype=='省市区'" class="row" style="margin-top:40px;height: 580px;">
97
- <city-list v-ref:addpcd @select-changed="selected" :f_filialeids.sync="f_filialeids"></city-list>
98
- </div>
99
- </div>
100
- </div>
101
- </validator>
102
- </div>
103
- </template>
104
-
105
- <script>
106
- import {HttpResetClass} from 'vue-client'
107
-
108
- let getAreaConfig = async function (self) {
109
- // 获取气价里面的配置
110
- await self.$getConfig(self, 'UserPcd')
111
- console.log('原地址配置',self.config)
112
- console.log('获取地址配置',self.config)
113
- Object.assign(self.model, self.config)
114
- }
115
- export default {
116
- title: '区域地址添加',
117
- data () {
118
- return {
119
- //初始化省市区数据
120
- config:{
121
- hasnumber: false
122
- },
123
- pcdslist:[],
124
- iscity:[{label:'市区',value:'市区'},{label:'乡镇',value:'乡镇'}],
125
- streetmanagelist: [],
126
- //省市区
127
- pcdmodel: {
128
- f_province:'',
129
- f_city:'',
130
- f_district:'',
131
- f_comments:'',
132
- f_pcd_number: ''
133
- },
134
- //街道
135
- streetmodel: {
136
- f_pcd_id:'',
137
- f_street_id:'',
138
- f_street_manage_id: '',
139
- slice_area: null,
140
- f_slice_area: null,
141
- f_adjustable_id: null,
142
- f_street:'',
143
- f_comments:'',
144
- f_street_number:'',
145
- f_iscity:''
146
- }
147
- }
148
- },
149
- props: ['f_filialeids', 'areatype','row','operation'],
150
- ready(){
151
- this.initdata()
152
- getAreaConfig(this)
153
- },
154
- methods: {
155
- async streetyanzheng(){
156
- let res =await this.$resetpost('rs/sql/address_singleTableOrderBy', {
157
- data: {
158
- items: '*',
159
- tablename: 't_street',
160
- orderitem: 'id',
161
- condition: `f_street_number = '${this.streetmodel.f_street_number}' and f_orgid = '${this.$login.f.orgid}'`
162
- }
163
- }, {resolveMsg: null, rejectMsg: null})
164
- if (res.data.length>0){
165
- if (res.data[0].id != this.streetmodel.id) {
166
- this.$showAlert('当前编号已存在', 'warning', 2000)
167
- this.streetmodel.f_street_number = ''
168
- }
169
- }
170
-
171
- },
172
- //初始化省市区,添加街道
173
- initstreetmanage(pconditon){
174
- try{
175
- console.log("初始化街道办")
176
- let HttpReset = new HttpResetClass()
177
- HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
178
- data: {
179
- items: '*',
180
- tablename: 't_street_manage',
181
- orderitem: 'id',
182
- condition: '1=1'
183
- }
184
- }, {resolveMsg: null, rejectMsg: null}).then((req) => {
185
- let redata = []
186
- req.data.forEach((row, n) => {
187
- redata[n] = {
188
- label: row.f_street_manage_name,
189
- value: row.id,
190
- data:row,
191
- id:row.id
192
- }
193
- })
194
- this.streetmanagelist=redata
195
- })
196
- }catch (e) {
197
- console.log(e)
198
- }
199
- },
200
- async numberyanzheng(){
201
- console.log(this.pcdmodel.f_pcd_number.length)
202
- if (this.pcdmodel.f_pcd_number.length != 1){
203
- this.$showAlert('请输入正确的位数', 'warning', 2000)
204
- this.pcdmodel.f_pcd_number = ''
205
- }else{
206
- let res =await this.$resetpost('rs/sql/address_singleTableOrderBy', {
207
- data: {
208
- items: '*',
209
- tablename: 't_pcd',
210
- orderitem: 'id',
211
- condition: `f_pcd_number = '${this.pcdmodel.f_pcd_number}' and f_orgid = '${this.$login.f.orgid}'`
212
- }
213
- }, {resolveMsg: null, rejectMsg: null})
214
- if (res.data.length>0){
215
- if (res.data[0].id != this.pcdmodel.id) {
216
- this.$showAlert('当前编号已存在', 'warning', 2000)
217
- this.pcdmodel.f_pcd_number = ''
218
- }
219
- }
220
- }
221
- },
222
- //初始化省市区,添加街道
223
- initpcds(pconditon){
224
- console.log("省市区准备")
225
- let HttpReset = new HttpResetClass()
226
- HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
227
- data: {
228
- items: '*',
229
- tablename: 't_pcd',
230
- orderitem: 'id',
231
- condition: pconditon
232
- }
233
- }, {resolveMsg: null, rejectMsg: '获取地址失败!'}).then((req) => {
234
- let redata = []
235
- req.data.forEach((row, n) => {
236
- redata[n] = {
237
- label: row.f_pcd,
238
- value: row.id,
239
- data:row,
240
- id:row.id
241
- }
242
- })
243
- this.pcdslist=redata
244
- })
245
- },
246
- //根据名字找数据
247
- findbyid(list,name){
248
- var result
249
- list.forEach((row, n) => {
250
- if(name==row.id){
251
- result= row.data
252
- }
253
- })
254
- return result
255
- },
256
- //初始化数据
257
- initdata(){
258
- if(this.areatype=='街道'){
259
- this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
260
- this.initstreetmanage(` f_filialeid = '${this.f_filialeids}'`)
261
- }
262
- if(this.areatype=='小区'){
263
- this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
264
- this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
265
- }
266
- },
267
- //省/市/区变化
268
- pcdChange(val){
269
- console.log("省/市/区变化",val)
270
- this.$resetValidation()
271
- },
272
- //保存
273
- async confirm(){
274
- if(this.areatype=='省市区'){
275
- await this.savepcd()
276
- }
277
- if(this.areatype=='街道'){
278
- await this.savestreet()
279
- }
280
- this.cleardara()
281
- this.$dispatch('confirm')
282
- },
283
- //保存省市区
284
- async savepcd(){
285
- this.pcdmodel.f_filialeid = this.f_filialeids
286
- this.pcdmodel.f_operator = this.$login.f.name
287
- this.pcdmodel.f_operatorid = this.$login.f.id
288
- this.pcdmodel.f_orgid = this.$login.f.orgid
289
- this.pcdmodel.f_orgname = this.$login.f.orgs
290
- this.pcdmodel.f_depid = this.$login.f.depids
291
- this.pcdmodel.f_depname = this.$login.f.deps
292
- this.pcdmodel.f_pcd = this.pcdmodel.f_province+this.pcdmodel.f_city+this.pcdmodel.f_district
293
- await this.$resetpost('rs/logic/address_updatepcd', this.pcdmodel)
294
- },
295
- //保存街道
296
- async savestreet(){
297
- this.streetmodel.f_filialeid = this.f_filialeids
298
- this.streetmodel.f_operator= this.$login.f.name
299
- this.streetmodel.f_operatorid = this.$login.f.id
300
- this.streetmodel.f_orgid = this.$login.f.orgid
301
- this.streetmodel.f_orgname = this.$login.f.orgs
302
- this.streetmodel.f_depid = this.$login.f.depids
303
- this.streetmodel.f_depname = this.$login.f.deps
304
- this.streetmodel.f_pcd=this.findbyid(this.pcdslist,this.streetmodel.f_pcd_id).f_pcd
305
- if (this.findbyid(this.streetmanagelist,this.streetmodel.f_street_manage_id)) {
306
- this.streetmodel.f_street_manage_name=this.findbyid(this.streetmanagelist,this.streetmodel.f_street_manage_id).f_street_manage_name
307
- }
308
- console.log('获取街道model', this.streetmodel)
309
- await this.$resetpost('rs/logic/address_updatestreet', this.streetmodel)
310
- },
311
- cancel(){
312
- this.cleardara()
313
- this.$dispatch('cancel')
314
- },
315
- cleardara () {
316
- this.pcdmodel = {
317
- f_province: '',
318
- f_city: '',
319
- f_district: '',
320
- f_comments:''
321
- }
322
- this.streetmodel = {
323
- f_pcd_id: '',
324
- f_slice_area: '',
325
- f_adjustable_id: '',
326
- f_street: '',
327
- f_comments:''
328
- }
329
- }
330
-
331
- },
332
- watch: {
333
- 'areatype'(){
334
- this.initdata()
335
- },
336
- 'f_filialeids'(){
337
- if (this.streetmodel.f_filialeid) {
338
- if (this.streetmodel.f_filialeid != this.f_filialeids) {
339
- this.$dispatch('cancel')
340
- }
341
- }
342
- if (this.pcdmodel.f_filialeid) {
343
- if (this.pcdmodel.f_filialeid != this.f_filialeids) {
344
- this.$dispatch('cancel')
345
- }
346
- }
347
- this.initdata()
348
- }
349
- }
350
- }
351
- </script>
1
+ <template>
2
+ <div class="span">
3
+ <validator name='v'>
4
+ <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='add'">添加{{areatype}}</p>
5
+ <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='modify'&&areatype=='街道'">修改【{{streetmodel.f_street}}】街道</p>
6
+ <p class="bg-info text-center" style="padding: 8px;" v-if="operation=='modify'&&areatype=='省市区'">修改【{{pcdmodel.f_pcd}}】</p>
7
+ <div class="auto select-overspread form-horizontal">
8
+ <div style="text-align:right;margin-top:6px;" class="col-sm-12">
9
+ <!-- 省市区-->
10
+ <div v-if="areatype=='省市区'" class="row">
11
+ <div class="col-sm-6 form-group "
12
+ :class="[$v.f_province.required ? 'has-error' : 'has-success']">
13
+ <label class="font_normal_body">省&emsp;&emsp;份</label>
14
+ <input type="text" v-model="pcdmodel.f_province"
15
+ class="input_search" style="width:60%" placeholder="省份"
16
+ v-validate:f_province='{required: true }'>
17
+ </div>
18
+ <div class="col-sm-6 form-group "
19
+ :class="[$v.f_city.required ? 'has-error' : 'has-success']">
20
+ <label class="font_normal_body">城&emsp;&emsp;市</label>
21
+ <input type="text" v-model="pcdmodel.f_city"
22
+ class="input_search" style="width:60%" placeholder="城市"
23
+ v-validate:f_city='{required: true }'>
24
+ </div>
25
+ <div class="col-sm-6 form-group "
26
+ :class="[$v.f_district.required ? 'has-error' : 'has-success']">
27
+ <label class="font_normal_body">区&ensp;&ensp;/&ensp;县</label>
28
+ <input type="text" v-model="pcdmodel.f_district"
29
+ class="input_search" style="width:60%" placeholder="区/县"
30
+ v-validate:f_district='{required: true }'>
31
+ </div>
32
+ <div class="col-sm-6 form-group "
33
+ :class="[$v.f_pcd_number.required ? 'has-error' : 'has-success']">
34
+ <label class="font_normal_body">区域编码</label>
35
+ <input type="text" v-model="pcdmodel.f_pcd_number"
36
+ class="input_search" style="width:60%" placeholder="区域编码"
37
+ @change="numberyanzheng"
38
+ v-validate:f_pcd_number='{required: true }'>
39
+ </div>
40
+ <div class="col-sm-12 form-group">
41
+ <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
42
+ <textarea class="input_textarea" rows="3" style="margin-top:25px;width:80%;height: auto;" v-model="pcdmodel.f_comments"></textarea>
43
+ </div>
44
+ </div>
45
+ <!-- 街道-->
46
+ <div v-if="areatype=='街道'" class="row">
47
+ <div class="col-sm-6 form-group "
48
+ :class="[$v.f_pcd_id.required ? 'has-error' : 'has-success']">
49
+ <label class="font_normal_body">省&ensp;市&ensp;区</label>
50
+ <input type="text" v-show="false" v-model="streetmodel.f_pcd_id"
51
+ v-validate:f_pcd_id='{required: true }'>
52
+ <v-select
53
+ :value.sync="streetmodel.f_pcd_id" :value-single="true"
54
+ :options='pcdslist' placeholder='请选择'
55
+ close-on-select search="true" @change="pcdChange">
56
+ </v-select>
57
+ </div>
58
+ <div class="col-sm-6 form-group ">
59
+ <label class="font_normal_body">街&ensp;道&ensp;办</label>
60
+ <input type="text" v-show="false" v-model="streetmodel.f_street_manage_id">
61
+ <v-select
62
+ :value.sync="streetmodel.f_street_manage_id" :value-single="true"
63
+ :options='streetmanagelist' placeholder='请选择'
64
+ close-on-select search="true" @change="pcdChange">
65
+ </v-select>
66
+ </div>
67
+ <div class="col-sm-6 form-group "
68
+ :class="[$v.f_street.required ? 'has-error' : 'has-success']">
69
+ <label class="font_normal_body">街道/乡镇</label>
70
+ <input type="text" v-model="streetmodel.f_street"
71
+ class="input_search" style="width:60%" placeholder="街道/乡镇"
72
+ v-validate:f_street='{required: true }'>
73
+ </div>
74
+ <!-- <div class="col-sm-6 form-group "
75
+ :class="[$v.f_iscity.required ? 'has-error' : 'has-success']">
76
+ <label class="font_normal_body">地区类型</label>
77
+ <input type="text" v-show="false" v-model="streetmodel.f_iscity"
78
+ v-validate:f_iscity='{required: true }'>
79
+ <v-select
80
+ :value.sync="streetmodel.f_iscity" :value-single="true"
81
+ :options='iscity' placeholder='请选择'
82
+ close-on-select>
83
+ </v-select>
84
+ </div>-->
85
+ <div class="col-sm-12 form-group">
86
+ <label class="font_normal_body " style="">备&emsp;&emsp;注</label>
87
+ <textarea class="input_textarea" rows="3" style="margin-top:25px;width:80%;height: auto;" v-model="streetmodel.f_comments"></textarea>
88
+ </div>
89
+ </div>
90
+
91
+ <div class="row">
92
+ <div style="margin-top:40px;text-align:right;">
93
+ <button class="button_search button_spacing" @click="confirm()" :disabled='!$v.valid'>保存</button>
94
+ <button class="button_clear button_spacing" @click="cancel()">取消</button>
95
+ </div>
96
+ <div v-if="areatype=='省市区'" class="row" style="margin-top:40px;height: 580px;">
97
+ <city-list v-ref:addpcd @select-changed="selected" :f_filialeids.sync="f_filialeids"></city-list>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </validator>
102
+ </div>
103
+ </template>
104
+
105
+ <script>
106
+ import {HttpResetClass} from 'vue-client'
107
+
108
+ let getAreaConfig = async function (self) {
109
+ // 获取气价里面的配置
110
+ await self.$getConfig(self, 'UserPcd')
111
+ console.log('原地址配置',self.config)
112
+ console.log('获取地址配置',self.config)
113
+ Object.assign(self.model, self.config)
114
+ }
115
+ export default {
116
+ title: '区域地址添加',
117
+ data () {
118
+ return {
119
+ //初始化省市区数据
120
+ config:{
121
+ hasnumber: false
122
+ },
123
+ pcdslist:[],
124
+ iscity:[{label:'市区',value:'市区'},{label:'乡镇',value:'乡镇'}],
125
+ streetmanagelist: [],
126
+ //省市区
127
+ pcdmodel: {
128
+ f_province:'',
129
+ f_city:'',
130
+ f_district:'',
131
+ f_comments:'',
132
+ f_pcd_number: ''
133
+ },
134
+ //街道
135
+ streetmodel: {
136
+ f_pcd_id:'',
137
+ f_street_id:'',
138
+ f_street_manage_id: '',
139
+ slice_area: null,
140
+ f_slice_area: null,
141
+ f_adjustable_id: null,
142
+ f_street:'',
143
+ f_comments:'',
144
+ f_street_number:'',
145
+ f_iscity:''
146
+ }
147
+ }
148
+ },
149
+ props: ['f_filialeids', 'areatype','row','operation'],
150
+ ready(){
151
+ this.initdata()
152
+ getAreaConfig(this)
153
+ },
154
+ methods: {
155
+ async streetyanzheng(){
156
+ let res =await this.$resetpost('rs/sql/address_singleTableOrderBy', {
157
+ data: {
158
+ items: '*',
159
+ tablename: 't_street',
160
+ orderitem: 'id',
161
+ condition: `f_street_number = '${this.streetmodel.f_street_number}' and f_orgid = '${this.$login.f.orgid}'`
162
+ }
163
+ }, {resolveMsg: null, rejectMsg: null})
164
+ if (res.data.length>0){
165
+ if (res.data[0].id != this.streetmodel.id) {
166
+ this.$showAlert('当前编号已存在', 'warning', 2000)
167
+ this.streetmodel.f_street_number = ''
168
+ }
169
+ }
170
+
171
+ },
172
+ //初始化省市区,添加街道
173
+ initstreetmanage(pconditon){
174
+ try{
175
+ console.log("初始化街道办")
176
+ let HttpReset = new HttpResetClass()
177
+ HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
178
+ data: {
179
+ items: '*',
180
+ tablename: 't_street_manage',
181
+ orderitem: 'id',
182
+ condition: '1=1'
183
+ }
184
+ }, {resolveMsg: null, rejectMsg: null}).then((req) => {
185
+ let redata = []
186
+ req.data.forEach((row, n) => {
187
+ redata[n] = {
188
+ label: row.f_street_manage_name,
189
+ value: row.id,
190
+ data:row,
191
+ id:row.id
192
+ }
193
+ })
194
+ this.streetmanagelist=redata
195
+ })
196
+ }catch (e) {
197
+ console.log(e)
198
+ }
199
+ },
200
+ async numberyanzheng(){
201
+ console.log(this.pcdmodel.f_pcd_number.length)
202
+ if (this.pcdmodel.f_pcd_number.length != 1){
203
+ this.$showAlert('请输入正确的位数', 'warning', 2000)
204
+ this.pcdmodel.f_pcd_number = ''
205
+ }else{
206
+ let res =await this.$resetpost('rs/sql/address_singleTableOrderBy', {
207
+ data: {
208
+ items: '*',
209
+ tablename: 't_pcd',
210
+ orderitem: 'id',
211
+ condition: `f_pcd_number = '${this.pcdmodel.f_pcd_number}' and f_orgid = '${this.$login.f.orgid}'`
212
+ }
213
+ }, {resolveMsg: null, rejectMsg: null})
214
+ if (res.data.length>0){
215
+ if (res.data[0].id != this.pcdmodel.id) {
216
+ this.$showAlert('当前编号已存在', 'warning', 2000)
217
+ this.pcdmodel.f_pcd_number = ''
218
+ }
219
+ }
220
+ }
221
+ },
222
+ //初始化省市区,添加街道
223
+ initpcds(pconditon){
224
+ console.log("省市区准备")
225
+ let HttpReset = new HttpResetClass()
226
+ HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
227
+ data: {
228
+ items: '*',
229
+ tablename: 't_pcd',
230
+ orderitem: 'id',
231
+ condition: pconditon
232
+ }
233
+ }, {resolveMsg: null, rejectMsg: '获取地址失败!'}).then((req) => {
234
+ let redata = []
235
+ req.data.forEach((row, n) => {
236
+ redata[n] = {
237
+ label: row.f_pcd,
238
+ value: row.id,
239
+ data:row,
240
+ id:row.id
241
+ }
242
+ })
243
+ this.pcdslist=redata
244
+ })
245
+ },
246
+ //根据名字找数据
247
+ findbyid(list,name){
248
+ var result
249
+ list.forEach((row, n) => {
250
+ if(name==row.id){
251
+ result= row.data
252
+ }
253
+ })
254
+ return result
255
+ },
256
+ //初始化数据
257
+ initdata(){
258
+ if(this.areatype=='街道'){
259
+ this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
260
+ this.initstreetmanage(` f_filialeid = '${this.f_filialeids}'`)
261
+ }
262
+ if(this.areatype=='小区'){
263
+ this.initpcds(` f_filialeid = '${this.f_filialeids}'`)
264
+ this.initstreets(` f_filialeid = '${this.f_filialeids}'`)
265
+ }
266
+ },
267
+ //省/市/区变化
268
+ pcdChange(val){
269
+ console.log("省/市/区变化",val)
270
+ this.$resetValidation()
271
+ },
272
+ //保存
273
+ async confirm(){
274
+ if(this.areatype=='省市区'){
275
+ await this.savepcd()
276
+ }
277
+ if(this.areatype=='街道'){
278
+ await this.savestreet()
279
+ }
280
+ this.cleardara()
281
+ this.$dispatch('confirm')
282
+ },
283
+ //保存省市区
284
+ async savepcd(){
285
+ this.pcdmodel.f_filialeid = this.f_filialeids
286
+ this.pcdmodel.f_operator = this.$login.f.name
287
+ this.pcdmodel.f_operatorid = this.$login.f.id
288
+ this.pcdmodel.f_orgid = this.$login.f.orgid
289
+ this.pcdmodel.f_orgname = this.$login.f.orgs
290
+ this.pcdmodel.f_depid = this.$login.f.depids
291
+ this.pcdmodel.f_depname = this.$login.f.deps
292
+ this.pcdmodel.f_pcd = this.pcdmodel.f_province+this.pcdmodel.f_city+this.pcdmodel.f_district
293
+ await this.$resetpost('rs/logic/address_updatepcd', this.pcdmodel)
294
+ },
295
+ //保存街道
296
+ async savestreet(){
297
+ this.streetmodel.f_filialeid = this.f_filialeids
298
+ this.streetmodel.f_operator= this.$login.f.name
299
+ this.streetmodel.f_operatorid = this.$login.f.id
300
+ this.streetmodel.f_orgid = this.$login.f.orgid
301
+ this.streetmodel.f_orgname = this.$login.f.orgs
302
+ this.streetmodel.f_depid = this.$login.f.depids
303
+ this.streetmodel.f_depname = this.$login.f.deps
304
+ this.streetmodel.f_pcd=this.findbyid(this.pcdslist,this.streetmodel.f_pcd_id).f_pcd
305
+ if (this.findbyid(this.streetmanagelist,this.streetmodel.f_street_manage_id)) {
306
+ this.streetmodel.f_street_manage_name=this.findbyid(this.streetmanagelist,this.streetmodel.f_street_manage_id).f_street_manage_name
307
+ }
308
+ console.log('获取街道model', this.streetmodel)
309
+ await this.$resetpost('rs/logic/address_updatestreet', this.streetmodel)
310
+ },
311
+ cancel(){
312
+ this.cleardara()
313
+ this.$dispatch('cancel')
314
+ },
315
+ cleardara () {
316
+ this.pcdmodel = {
317
+ f_province: '',
318
+ f_city: '',
319
+ f_district: '',
320
+ f_comments:''
321
+ }
322
+ this.streetmodel = {
323
+ f_pcd_id: '',
324
+ f_slice_area: '',
325
+ f_adjustable_id: '',
326
+ f_street: '',
327
+ f_comments:''
328
+ }
329
+ }
330
+
331
+ },
332
+ watch: {
333
+ 'areatype'(){
334
+ this.initdata()
335
+ },
336
+ 'f_filialeids'(){
337
+ if (this.streetmodel.f_filialeid) {
338
+ if (this.streetmodel.f_filialeid != this.f_filialeids) {
339
+ this.$dispatch('cancel')
340
+ }
341
+ }
342
+ if (this.pcdmodel.f_filialeid) {
343
+ if (this.pcdmodel.f_filialeid != this.f_filialeids) {
344
+ this.$dispatch('cancel')
345
+ }
346
+ }
347
+ this.initdata()
348
+ }
349
+ }
350
+ }
351
+ </script>