|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <template>
- <view class="box">
- <!-- 顾问选择 -->
- <view class="nextcon">
- 最多选择五项
- </view>
- <view class="content">
- <scroll-view style="height: 1170rpx;" scroll-y="true" >
- <checkbox-group v-model="value" @change="checkboxChange">
- <view v-for="(item,index) in items" :key="index">
- <view class="content-tips">
- <view class="left">
- {{item.deptName}}
- </view>
- <view class="right">
- <radio :value="item.deptId" style="transform:scale(0.8)" color="#2671E2" :checked="item.checked" @click="addclick(index)"></radio>
- </view>
- </view>
- </view>
- </checkbox-group>
- </scroll-view>
-
- <view class="zhedang"></view>
- <view class="btn" @click="goback">
- 确定
- </view>
- </view>
- </view>
- </template>
-
- <script>
- export default {
- data(){
- return{
- value:[],
- items:[],
- ids:''
- }
- },
- onLoad(e) {
- // 获取项目id
- // console.log(e)
- this.ids=e.ids
- this.houseId = uni.getStorageSync('buildingID').id;
- this.getSectionList()
- },
- methods:{
- checkboxChange (e) {
- // console.log(e)
- },
- // 获取部门列表
- getSectionList(){
- this.$u.post('/cusLvStatistics/findAllDeptIdByHouseId',{houseId:this.houseId})
- .then(res=>{
- console.log(res)
- res.map((item,index)=>{
- if(index<5){
- item.checked=true
- }else{
- item.checked=false
- }
- })
- this.items=res
- if(this.ids){
- let arr=this.ids.split(',')
- this.items.map((item,index)=>{
- let idx=arr.findIndex(item1=>item1==item.deptId)
- if(idx!=-1){
- item.checked=true
- }else{
- item.checked=false
- }
- })
- }
- })
-
- },
- addclick(index){
- this.items[index].checked=!this.items[index].checked
- },
- goback(){
- // 循环遍历所有选定的内容
- let arr=[]
- this.items.map(item=>{
- if(item.checked){
- arr.push(item.deptId)
- }
- })
- uni.$emit('update',{arr})
- uni.navigateBack()
- },
-
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .box{
- background: #F8F8F8;
- width: 100%;
- height: 100%;
- font-size: 30rpx;
- font-weight: 400;
- // line-height: 30px;
- .nextcon{
- height: 78rpx;
- background: #F4F8FD;
- color: #2671E2;
- text-align: center;
- line-height: 78rpx;
- }
- .content-tips{
- display: flex;
- justify-content: space-between;
- background: #fff;
- padding: 0 30rpx;
- height: 92rpx;
- margin-bottom: 20rpx;
- .left{
- display: flex;
- // margin-top: 30rpx;
- font-weight: 500;
- color: #303030;
- line-height: 92rpx;
- font-size: 30rpx;
- }
- .right{
- margin: 24rpx 0;
- }
- }
- .btn{
- width: 690rpx;
- height: 88rpx;
- background: #2671E2;
- border-radius: 8rpx;
- font-size: 32rpx;
- font-weight: 400;
- color: #FFFFFF;
- line-height: 88rpx;
- text-align: center;
- position: fixed;
- left: 30rpx;
- bottom: 80rpx;
- }
- .zhedang{
- height: 168rpx;
- opacity: 0;
- }
- }
- </style>
|