|
@@ -33,7 +33,7 @@
|
|
|
<uni-easyinput type="text" v-model="baseFormData.jhrlxdh" placeholder="请输入监护人联系电话" :inputBorder="true"></uni-easyinput>
|
|
|
</uni-forms-item>
|
|
|
|
|
|
- <uni-forms-item label="街道社区">
|
|
|
+ <uni-forms-item label="街道社区" v-if="level !== 5" name="diqu" required>
|
|
|
<uni-easyinput type="text" v-model="diqu" @focus="toggle('bottom')" placeholder="请选择街道社区" :clearable="false"></uni-easyinput>
|
|
|
</uni-forms-item>
|
|
|
|
|
@@ -83,10 +83,10 @@
|
|
|
<!-- 普通弹窗 -->
|
|
|
<uni-popup ref="popup" background-color="#fff">
|
|
|
<picker-view :indicator-style="indicatorStyle" @change="bindChange" class="picker-view">
|
|
|
- <picker-view-column>
|
|
|
+ <picker-view-column v-if="jiedaoData.length > 0">
|
|
|
<view class="item" v-for="(item,index) in jiedaoData" :key="index">{{item.label}}</view>
|
|
|
</picker-view-column>
|
|
|
- <picker-view-column>
|
|
|
+ <picker-view-column v-if="shequData.length > 0">
|
|
|
<view class="item" v-for="(item,index) in shequData" :key="index">{{item.label}}</view>
|
|
|
</picker-view-column>
|
|
|
</picker-view>
|
|
@@ -156,6 +156,7 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ level: 3,
|
|
|
id: '',
|
|
|
diqu: '',
|
|
|
item: {},
|
|
@@ -298,6 +299,8 @@
|
|
|
onLoad(o) {
|
|
|
this.userInfo = getUser()
|
|
|
this.userType = this.userInfo.userType
|
|
|
+ let unitFilter = this.userInfo.dept.unitFilter.split(',')
|
|
|
+ this.level = unitFilter.length
|
|
|
// 查询街道和社区
|
|
|
this.getAddressList(this.userInfo.dept.locationCode)
|
|
|
|
|
@@ -388,19 +391,33 @@
|
|
|
code: code
|
|
|
}).then(res => {
|
|
|
if (res.data) {
|
|
|
- this.jiedaoData = res.data
|
|
|
- this.shequData = res.data[0].children
|
|
|
-
|
|
|
-
|
|
|
- this.jiedaoValue = this.jiedaoData[0]
|
|
|
- if (this.shequData.length > 0) {
|
|
|
+ if (this.level === 3) { //区县级用户
|
|
|
+ this.jiedaoData = res.data
|
|
|
+ this.shequData = res.data[0].children
|
|
|
+ this.jiedaoValue = this.jiedaoData[0]
|
|
|
this.shequValue = this.shequData[0]
|
|
|
this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
|
|
|
this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
- } else {
|
|
|
- this.diqu = this.jiedaoValue.label
|
|
|
+ } else if (this.level === 4) { //街道级用户
|
|
|
+ this.shequData = res.data
|
|
|
+ this.shequValue = this.shequData[0]
|
|
|
+ this.diqu = this.shequValue.label
|
|
|
this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
+ } else if (this.level === 5) { //社区级用户
|
|
|
+ this.baseFormData.lrHjdz = this.userInfo.dept.locationCode
|
|
|
}
|
|
|
+
|
|
|
+ // this.jiedaoData = res.data
|
|
|
+ // this.shequData = res.data[0].children
|
|
|
+ // this.jiedaoValue = this.jiedaoData[0]
|
|
|
+ // if (this.shequData.length > 0) {
|
|
|
+ // this.shequValue = this.shequData[0]
|
|
|
+ // this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
|
|
|
+ // this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
+ // } else {
|
|
|
+ // this.diqu = this.jiedaoValue.label
|
|
|
+ // this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
+ // }
|
|
|
if (this.id) this.showInfo(this.id)
|
|
|
}
|
|
|
})
|
|
@@ -449,33 +466,62 @@
|
|
|
},
|
|
|
toggle(type) {
|
|
|
uni.hideKeyboard()
|
|
|
- this.shequData = this.jiedaoData[0].children
|
|
|
+ if (this.level === 3) {
|
|
|
+ this.shequData = this.jiedaoData[0].children
|
|
|
+ }
|
|
|
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
|
|
|
this.$refs.popup.open(type)
|
|
|
},
|
|
|
bindChange(e) {
|
|
|
- if (e.detail.value.length == 1) {
|
|
|
- this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
|
|
|
- this.shequData = this.jiedaoData[e.detail.value[0]].children
|
|
|
- if (this.shequData.length > 0 && this.shequData[0] != null) {
|
|
|
- this.shequValue = this.shequData[0]
|
|
|
+ if (this.level === 3) { // 区县级用户
|
|
|
+ if (e.detail.value.length == 1) {
|
|
|
+ this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
|
|
|
+ this.shequData = this.jiedaoData[e.detail.value[0]].children
|
|
|
+ if (this.shequData.length > 0 && this.shequData[0] != null) {
|
|
|
+ this.shequValue = this.shequData[0]
|
|
|
+ this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
|
|
|
+ this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
+ } else {
|
|
|
+ this.shequData = []
|
|
|
+ this.shequValue = ''
|
|
|
+ this.diqu = this.jiedaoValue.label
|
|
|
+ this.baseFormData.lrHjdz = this.jiedaoValue.code
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let index = e.detail.value[0] ? e.detail.value[0] : 0
|
|
|
+ this.jiedaoValue = this.jiedaoData[index]
|
|
|
+ this.shequValue = this.shequData[e.detail.value[1]]
|
|
|
this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
|
|
|
this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
- } else {
|
|
|
- this.shequData = []
|
|
|
- this.shequValue = ''
|
|
|
- this.diqu = this.jiedaoValue.label
|
|
|
- this.baseFormData.lrHjdz = this.jiedaoValue.code
|
|
|
}
|
|
|
-
|
|
|
- } else {
|
|
|
- let index = e.detail.value[0] ? e.detail.value[0] : 0
|
|
|
- this.jiedaoValue = this.jiedaoData[index]
|
|
|
- this.shequValue = this.shequData[e.detail.value[1]]
|
|
|
- this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
|
|
|
+ } else if (this.level === 4) { // 街道级用户
|
|
|
+ this.shequValue = this.shequData[e.detail.value[0]]
|
|
|
+ this.diqu = this.shequValue.label
|
|
|
this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
}
|
|
|
|
|
|
+ // if (e.detail.value.length == 1) {
|
|
|
+ // this.jiedaoValue = this.jiedaoData[e.detail.value[0]]
|
|
|
+ // this.shequData = this.jiedaoData[e.detail.value[0]].children
|
|
|
+ // if (this.shequData.length > 0 && this.shequData[0] != null) {
|
|
|
+ // this.shequValue = this.shequData[0]
|
|
|
+ // this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
|
|
|
+ // this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
+ // } else {
|
|
|
+ // this.shequData = []
|
|
|
+ // this.shequValue = ''
|
|
|
+ // this.diqu = this.jiedaoValue.label
|
|
|
+ // this.baseFormData.lrHjdz = this.jiedaoValue.code
|
|
|
+ // }
|
|
|
+
|
|
|
+ // } else {
|
|
|
+ // let index = e.detail.value[0] ? e.detail.value[0] : 0
|
|
|
+ // this.jiedaoValue = this.jiedaoData[index]
|
|
|
+ // this.shequValue = this.shequData[e.detail.value[1]]
|
|
|
+ // this.diqu = this.jiedaoValue.label + '/' + this.shequValue.label
|
|
|
+ // this.baseFormData.lrHjdz = this.shequValue.code
|
|
|
+ // }
|
|
|
+
|
|
|
},
|
|
|
buildDataByLevel(data, pid) {
|
|
|
let result = [];
|