123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <template>
- <view class="kp-details">
- <!-- 考评项 -->
- <view class="kp-tabsBox">
- <view class="kp-tabs">
- <view @click="onTab(index)" :class="activeIndex == index ? 'active':''" v-for="(item,index) in items" :key="item.id">
- <view>{{item.name}}</view>
- <view>({{item.assessTargetNum}}项)</view>
- </view>
- </view>
- <view class="kp-items">
- <view>
- <checkbox-group @change="checkboxChange" class="checkbox-group">
- <label v-for="item in childItems" :key="item.id" >
- <view class="checkbox-item">
- <view class="item-name">{{item.name}}</view>
- <view>
- <checkbox :value="item.id" :checked="item.checked" />
- </view>
- </view>
- </label>
- </checkbox-group>
- </view>
- </view>
- </view>
- <!-- 选择按钮 -->
- <view class="kp-ok">
- 确定选择
- </view>
- </view>
- </template>
- <script>
- import {findAllItem} from '@/api/assess'
- export default{
- data(){
- return{
- items: [],
- activeIndex:0,
- childItems:[],
- checkedList:[]
- }
- },
- onLoad() {
- findAllItem().then(res=>{
- if(res.status == 200){
- this.items = res.data
- this.onTab(0)
- }
- })
- },
- methods:{
- onTab(index){
- this.activeIndex = index
- this.childItems = this.items[index].assessTargetList
- },
- checkboxChange: function (e) {
- var items = this.items,
- values = e.detail.value;
- this.checkedList = values
- console.log(values,'checkboxChange')
- for (var i = 0, lenI = items.length; i < lenI; ++i) {
- const item = items[i]
- if(values.includes(item.value)){
-
-
- }else{
- this.$set(item,'checked',false)
- }
- }
- }
- }
- }
- </script>
- <style lang="scss">
- page{
- height: 100%;
- background: #F8F8F8;
- }
- .kp-details{
- height: 100%;
- display: flex;
- flex-direction: column;
- .kp-tabsBox{
- flex-grow: 1;
- display: flex;
- .kp-tabs{
- width: 30%;
- text-align: center;
- margin: 15upx;
- overflow: auto;
- > view{
- padding: 15upx;
- background: #fff;
- border-radius: 6upx;
- box-shadow: 1px 2px 3px #eee;
- margin-bottom: 15upx;
- > view{
- &:last-child{
- color: #666;
- }
- }
- }
- > view.active{
- background: #00aaff;
- color: #fff;
- > view{
- &:last-child{
- color: #fff;
- }
- }
- }
- }
- .kp-items{
- width: 70%;
- margin: 15upx 15upx 15upx 6upx;
- overflow: auto;
- > view{
- .checkbox-group{
- .checkbox-item{
- width:100%;
- padding: 15upx;
- border-radius: 6upx;
- box-shadow: 1px 2px 3px #eee;
- background: #fff;
- display: flex;
- justify-content: space-between;
- margin-bottom: 15upx;
- }
- }
- }
- }
- }
- .kp-ok{
- text-align: center;
- padding: 26upx;
- background: #55aaff;
- color: #fff;
- font-size: 18px;
- }
- }
- </style>
|