address-client 3.2.84 → 3.2.86

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