This commit is contained in:
yanran200730
2022-08-15 18:14:04 +08:00
parent 9aa783671c
commit 02779a6dd6
2 changed files with 82 additions and 23 deletions

View File

@@ -84,7 +84,7 @@
<div class="border">
<span class="label">现住址</span>
<span class="value">
<AiAreaPicker ref="address" class="aiArea" :fullName.sync="form.currentAreaName" :value="form.currentAreaId" mode="custom" all @select="onCurrentAreaChange">
<AiAreaPicker ref="address" :fullName.sync="form.currentAreaName" :value="form.currentAreaId" mode="custom" all @select="onCurrentAreaChange">
<div class="aiArea">
<span class="label" v-if="form.currentAreaName">{{ form.currentAreaName }}</span>
<span v-else class="color-999">请选择</span>
@@ -94,20 +94,6 @@
</span>
</div>
</div>
<div class="item">
<span class="tips">*</span>
<div class="border">
<!-- <div class="border item-right"> -->
<span class="label">居民标签</span>
<span class="value" @click="toChooseTags">
<span class="color-999">请选择</span>
<img src="./components/img/right-icon.png" alt="">
</span>
<!-- <div class="tag-list" @click="toChooseTags">
<div class="tag" v-for="(item, index) in 10" :key="index">残疾人</div>
</div> -->
</div>
</div>
<div class="item mar-b0">
<span class="tips"></span>
<div class="border not-border">
@@ -122,7 +108,7 @@
<div class="border">
<span class="label">户籍地址</span>
<span class="value">
<AiAreaPicker ref="address" class="aiArea" :fullName.sync="form.householdAreaName" :value="form.householdAreaId" mode="custom" all @select="onHouseAreaChange">
<AiAreaPicker ref="address" :fullName.sync="form.householdAreaName" :value="form.householdAreaId" mode="custom" all @select="onHouseAreaChange">
<div class="aiArea">
<span class="label" v-if="form.householdAreaName">{{ form.householdAreaName }}</span>
<span v-else class="color-999">请选择</span>
@@ -141,6 +127,19 @@
<div class="text-area">
<textarea placeholder="请输入" maxlength="30" v-model="form.householdAddress"></textarea>
</div>
<div class="item">
<div class="border">
<!-- <div class="border item-right"> -->
<span class="label">居民标签</span>
<span class="value" @click="toChooseTags">
<span class="color-999">请选择</span>
<img src="./components/img/right-icon.png" alt="">
</span>
<!-- <div class="tag-list" @click="toChooseTags">
<div class="tag" v-for="(item, index) in 10" :key="index">残疾人</div>
</div> -->
</div>
</div>
<div class="pad-b152"></div>
<div class="add-btn" @click="submit">
<div>保存</div>
@@ -174,7 +173,8 @@ export default {
householdAreaName: '',
householdAddress: '',
residentType: '',
age: ''
age: '',
residentLabelList: []
},
showSelect: false,
formName: '',
@@ -191,6 +191,11 @@ export default {
this.form.residentType = options.type
}
this.$dict.load('yesOrNo', 'sex', 'householdRelation', 'nation', 'education', 'maritalStatus', 'politicsStatus', 'militaryStatus', 'faithType')
uni.$on('onChecked', e => {
console.log(e)
this.form.residentLabelList = e
})
},
computed: {
...mapState(['user']),
@@ -246,7 +251,9 @@ export default {
},
toChooseTags () {
uni.navigateTo({url: `./Tags`})
uni.navigateTo({
url: `./Tags?ids=${this.form.residentLabelList.map(v => v).join(',')}`
})
},
confirmSelect(e) {
@@ -302,6 +309,15 @@ export default {
<style scoped lang="scss">
.add {
::v-deep .aiArea {
display: flex;
align-items: center;
justify-content: flex-end;
.label {
width: 100%!important;
}
}
.item{
width: 100%;
padding-left: 14px;

View File

@@ -1,9 +1,15 @@
<template>
<div class="tags">
<div class="tags-group" v-for="(label, i) in 2" :key="i">
<h2>年龄段</h2>
<div class="tags-group">
<h2>标签列表</h2>
<div class="tags-list">
<div class="item" v-for="(item, index) in 20" :class="[currIndex === index ? 'active' : '']" :key="index">婴儿</div>
<div class="item"
v-for="(item, index) in list"
:class="[checked.includes(item.id) ? 'active' : '']"
:key="index"
@click="onClick(item.id)">
{{ item.labelName }}
</div>
</div>
</div>
<div class="add-btn" @click="submit">
@@ -18,16 +24,53 @@
data () {
return {
currIndex: 0
currIndex: 0,
list: [],
checked: []
}
},
onLoad () {
onLoad (query) {
this.getList()
if (query.ids) {
this.checked = query.ids.split(',')
}
},
methods: {
getList() {
this.$loading()
this.$http.post('/app/appresidentlabelinfo/list?size=1000').then((res) => {
if (res.code == 0) {
this.list = res.data.records
}
})
},
onClick (id) {
const index = this.checked.indexOf(id)
if (index === -1) {
this.checked.push(id)
} else {
this.checked.splice(index, 1)
}
},
submit () {
if (!this.checked.length) {
return this.$u.toast('请选择标签')
}
const list = this.list.filter(v => {
return this.checked.includes(v.id)
})
uni.$emit('onChecked', list)
uni.navigateBack()
}
}
}
</script>