This commit is contained in:
liuye
2022-01-14 10:56:52 +08:00
parent 5959781e15
commit 78c8bd01f8
6 changed files with 230 additions and 252 deletions

View File

@@ -4,21 +4,23 @@
<div class="label">
<span class="tips">*</span>网格名称
</div>
<div class="value">请输入</div>
<div class="value">
<u-input type="text" placeholder="请输入" input-align="right" placeholder-style="color:#999;font-size:16px;" height="48" v-model="form.girdName" maxlength="20" />
</div>
</div>
<div class="item-flex">
<div class="label">
<span class="tips"></span>网格长
</div>
<div class="value">请选择<img src="./components/img/right-icon.png" alt="" /></div>
<div class="value" @click="toAddUser('manage')">请选择<img src="./components/img/right-icon.png" alt="" /></div>
</div>
<div class="item-flex">
<div class="label">
<span class="tips"></span>网格员
</div>
<div class="value">请选择<img src="./components/img/right-icon.png" alt="" /></div>
<div class="value" @click="toAddUser('Member')">请选择<img src="./components/img/right-icon.png" alt="" /></div>
</div>
<div class="footer">确认添加</div>
<div class="footer" @click="confirm">确认添加</div>
</div>
</template>
@@ -26,17 +28,62 @@
export default {
data() {
return {
id: '',
form: {},
detailInfo: {},
fromType: 'add', //add新增 edit编辑,
addUserType: 'manage', //manage网格长 Member管理员
}
},
methods: {
},
onLoad(option) {
this.id = option.id
this.getDetail()
uni.$on('selectUser', res => {
if(this.addUserType == 'manage') {
this.form.girdMemberManageList = res
}else {
this.form.girdMemberList = res
}
})
},
onShow() {
document.title = '添加网格'
},
linkTo(url) {
uni.navigateTo({url})
methods: {
getDetail() {
this.$http.post(`/app/appgirdinfo/queryDetailById?id=${this.id}`).then((res) => {
if (res.code == 0) {
this.detailInfo = res.data
if(this.fromType == 'edit') {
this.form = res.data
}
}
})
},
toAddUser(type) {
this.addUserType = type
var selectUserList = []
if(type == 'manage') {
selectUserList = this.form.girdMemberManageList
}else {
selectUserList = this.form.girdMemberList
}
uni.navigateTo({url: `./SelectUser?selectUserList=${selectUserList}`})
},
confirm() {
if(!this.form.girdName){
return this.$u.toast('请输入网格名称')
}
this.$http.post(`/app/appgirdinfo/addOrUpdate`).then((res) => {
if (res.code == 0) {
this.form = res.data
}
})
}
}
}
</script>