address-client 3.2.19 → 3.2.20

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