地区选择器增加组

This commit is contained in:
aixianling
2022-06-16 15:52:44 +08:00
parent 393e780440
commit aea629e58a
2 changed files with 70 additions and 40 deletions

View File

@@ -49,7 +49,8 @@ export default {
}, },
valueLevel() { valueLevel() {
return this.$route.query.valueLevel || 5 return this.$route.query.valueLevel || 5
} },
extra: v => v.$route.query.extra
}, },
methods: { methods: {
getOptionsByRoot() { getOptionsByRoot() {
@@ -77,8 +78,17 @@ export default {
this.selectList.push(row) this.selectList.push(row)
this.options = res.data.map(e => ({...e, isChecked: !!this.selected[e.id]})) this.options = res.data.map(e => ({...e, isChecked: !!this.selected[e.id]}))
} }
row.locked = false }).finally(() => row.locked = false)
}) } else if (this.extra && !row.locked) {
row.locked = true
this.$http.post("/admin/appresident/queryAreaIdGroup", null, {
params: {currentAreaId: id}
}).then(res => {
if (res?.data) {
this.selectList.push(row)
this.options = res.data.map(id => ({id, name: id, isChecked: !!this.selected[id]}))
}
}).finally(() => row.locked = false)
} }
}, },
selectListClick(row, index) { selectListClick(row, index) {

View File

@@ -3,17 +3,17 @@
<div class="select-content"> <div class="select-content">
<div class="area-flex"> <div class="area-flex">
<p class="title">地区</p> <p class="title">地区</p>
<AiAreaPicker v-model="areaList" multiple class="value"> <AiAreaPicker v-model="areaList" multiple class="value" extra>
<span class="label" v-if="areaList.length">已选择</span> <span class="label" v-if="areaList.length">已选择</span>
<span v-else style="color:#999;">请选择</span> <span v-else style="color:#999;">请选择</span>
<u-icon name="arrow-right" color="#999" size="24" style="margin-left:8px;" /> <u-icon name="arrow-right" color="#999" size="24" style="margin-left:8px;"/>
</AiAreaPicker> </AiAreaPicker>
</div> </div>
<div class="area-flex"> <div class="area-flex">
<p class="title">部门</p> <p class="title">部门</p>
<div class="value"> <div class="value">
<AiPagePicker type="dept" :selected.sync="deptList" nodeKey="id" :isRequire="0"> <AiPagePicker type="dept" :selected.sync="deptList" nodeKey="id" :isRequire="0">
<AiMore v-model="moreTextDept" /> <AiMore v-model="moreTextDept"/>
</AiPagePicker> </AiPagePicker>
</div> </div>
</div> </div>
@@ -21,16 +21,18 @@
<p class="title">人员</p> <p class="title">人员</p>
<div class="value"> <div class="value">
<AiPagePicker type="sysUser" :selected.sync="userList" action="/app/wxcp/wxuser/list?status=1" nodeKey="id" :isRequire="0"> <AiPagePicker type="sysUser" :selected.sync="userList" action="/app/wxcp/wxuser/list?status=1" nodeKey="id" :isRequire="0">
<AiMore v-model="moreText" /> <AiMore v-model="moreText"/>
</AiPagePicker> </AiPagePicker>
</div> </div>
</div> </div>
<div class="type-content"> <div class="type-content">
<div class="type-list" v-for="(item, index) in tagList" :key="index"> <div class="type-list" v-for="(item, index) in tagList" :key="index">
<p>{{item.name}}</p> <p>{{ item.name }}</p>
<div class="list"> <div class="list">
<div class="item" :class="items.isCheck ? 'active' : ''" v-for="(items, indexs) in item.tagList" :key="indexs" @click="typeClick(index, indexs)">{{items.name}}</div> <div class="item" :class="items.isCheck ? 'active' : ''" v-for="(items, indexs) in item.tagList" :key="indexs" @click="typeClick(index, indexs)">
{{ items.name }}
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -61,10 +63,10 @@ export default {
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
moreText() { moreText() {
if(this.userList.length) return '已选择' if (this.userList.length) return '已选择'
}, },
moreTextDept() { moreTextDept() {
if(this.deptList.length) return '已选择' if (this.deptList.length) return '已选择'
}, },
}, },
methods: { methods: {
@@ -74,7 +76,7 @@ export default {
res.data.records.map((item) => { res.data.records.map((item) => {
item.tagList.map((items) => { item.tagList.map((items) => {
items.isCheck = false items.isCheck = false
if(this.tagIdList.includes(items.id)) { if (this.tagIdList.includes(items.id)) {
items.isCheck = true items.isCheck = true
} }
}) })
@@ -93,7 +95,7 @@ export default {
this.tagIdList = [] this.tagIdList = []
this.tagList.map((item) => { this.tagList.map((item) => {
item.tagList.map((items) => { item.tagList.map((items) => {
if(items.isCheck) { if (items.isCheck) {
this.tagIdList.push(items.id) this.tagIdList.push(items.id)
} }
}) })
@@ -117,7 +119,7 @@ export default {
uni.navigateBack({}) uni.navigateBack({})
}, },
toSelectDept() { toSelectDept() {
uni.navigateTo({ url: `./selectDept` }) uni.navigateTo({url: `./selectDept`})
}, },
}, },
onShow() { onShow() {
@@ -127,13 +129,13 @@ export default {
console.log(option) console.log(option)
this.areaId = this.user.areaId this.areaId = this.user.areaId
this.areaName = this.user.areaName this.areaName = this.user.areaName
if(option.areaList) { if (option.areaList) {
this.areaList = option.areaList.split(',') this.areaList = option.areaList.split(',')
} }
if(option.tagIdList) { if (option.tagIdList) {
this.tagIdList = option.tagIdList.split(',') this.tagIdList = option.tagIdList.split(',')
} }
if(option.userList) { if (option.userList) {
var list = option.userList.split(',') var list = option.userList.split(',')
list.map(item => { list.map(item => {
var info = { var info = {
@@ -143,7 +145,7 @@ export default {
}) })
} }
if(option.deptList) { if (option.deptList) {
var list = option.deptList.split(',') var list = option.deptList.split(',')
list.map(item => { list.map(item => {
var info = { var info = {
@@ -158,64 +160,76 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.chooseUser { .chooseUser {
.select-content{ .select-content {
.area-flex{ .area-flex {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 32px; padding: 32px;
line-height: 44px; line-height: 44px;
margin-bottom: 16px; margin-bottom: 16px;
background-color: #fff; background-color: #fff;
.title{
.title {
width: 150px; width: 150px;
margin-bottom: 0; margin-bottom: 0;
} }
.value{
.value {
width: calc(100% - 150px); width: calc(100% - 150px);
text-align: right; text-align: right;
} }
} }
.area-content{
.area-content {
padding: 16px 32px 32px; padding: 16px 32px 32px;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
.area-item{
.area-item {
display: inline-block; display: inline-block;
margin-right: 16px; margin-right: 16px;
.u-icon{
.u-icon {
margin-left: 4px; margin-left: 4px;
} }
} }
} }
.title{
.title {
line-height: 44px; line-height: 44px;
margin-bottom: 16px; margin-bottom: 16px;
font-size: 32px; font-size: 32px;
color: #666; color: #666;
.tips{
.tips {
font-size: 34px; font-size: 34px;
color: #f46; color: #f46;
vertical-align: middle; vertical-align: middle;
} }
} }
.local-icon{
.local-icon {
width: 32px; width: 32px;
height: 32px; height: 32px;
margin-right: 4px; margin-right: 4px;
} }
.type-list{
.type-list {
padding-left: 16px; padding-left: 16px;
margin-bottom: 16px; margin-bottom: 16px;
padding: 34px 32px 32px; padding: 34px 32px 32px;
background-color: #fff; background-color: #fff;
p{
p {
line-height: 44px; line-height: 44px;
margin-bottom: 24px; margin-bottom: 24px;
font-size: 30px; font-size: 30px;
color: #666; color: #666;
} }
.list{
.list {
overflow: hidden; overflow: hidden;
.item{
.item {
padding: 12px 32px; padding: 12px 32px;
float: left; float: left;
font-size: 28px; font-size: 28px;
@@ -226,16 +240,19 @@ export default {
border-radius: 4px; border-radius: 4px;
margin: 0 16px 16px 0; margin: 0 16px 16px 0;
} }
.active{
.active {
background-color: #3192F4; background-color: #3192F4;
color: #fff; color: #fff;
} }
} }
} }
} }
.bg-144{
.bg-144 {
height: 144px; height: 144px;
} }
.footer { .footer {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
@@ -247,18 +264,21 @@ export default {
display: flex; display: flex;
font-size: 36px; font-size: 36px;
font-family: PingFangSC-Regular, PingFang SC; font-family: PingFangSC-Regular, PingFang SC;
.confirm { .confirm {
color: #fff; color: #fff;
background: #1365dd; background: #1365dd;
} }
div { div {
flex: 1; flex: 1;
text-align: center; text-align: center;
color: #333; color: #333;
} }
} }
::v-deep .u-icon__label{
font-size: 28px!important; ::v-deep .u-icon__label {
font-size: 28px !important;
} }
} }