Commit 6a92257f authored by 康振飞's avatar 康振飞

Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product

parents a612eb0f b774c29f
<template>
<div class="checkbox-list">
<Row class="check-title">
<Col span="20">
<div>
<!-- :indeterminate="indeterminate" -->
<!-- :label="resourcesType==0?singleList.shop_name:resourcesType==2?singleList.equip_name:''" -->
<Checkbox
:label="singleList.equip_name"
v-model="checkAll"
@click.prevent.native="handleCheckAll(singleList.shop_id)"
>{{singleList.equip_name}}</Checkbox>
<!-- {{resourcesType==0?singleList.shop_name:resourcesType==2?singleList.equip_name:''}} -->
</div>
</Col>
<Col span="4">
<div class="icon-down">
<Icon type="ios-arrow-down" v-if="!singleList.isClick" @click="upDown(singleList)"></Icon>
<Icon type="ios-arrow-up" v-if="singleList.isClick" @click="upDown(singleList)"></Icon>
</div>
</Col>
</Row>
<ul v-show="singleList.isClick">
<li
ref="liId"
v-for="(item,index) in list"
:key="index"
@click="onclick(index)"
>{{item.name}}&nbsp&nbsp{{item.class}}</li>
</ul>
<!-- <CheckboxGroup
v-model="checkAllGroup"
@on-change="checkAllGroupChange"
v-if="singleList.isClick"
>-->
<!-- :label="resourcesType==0?item.user_name:resourcesType==2?item.equip_name:''" -->
<!-- <Checkbox v-for="(item,index) in list" :key="index" :label="item.name">{{item.name}}</Checkbox>
</CheckboxGroup>-->
</div>
</template>
<script>
import Api from "./api";
export default {
name: "CheckboxList",
props: ["singleList"],
data() {
return {
chooseNum: null,
indeterminate: true,
checkAll: false,
checkAllGroup: [],
typeIcon: "ios-arrow-down",
show: -1,
list: [
{
name: "张芳",
class: "1级"
},
{
name: "张芳",
class: "1级"
},
{
name: "张芳",
class: "1级"
},
{
name: "张芳",
class: "1级"
}
],
taglistData: []
};
},
mounted() {
// this.checkList()
},
methods: {
onclick(index) {
if (this.$refs.liId[index].className.length <= 0) {
this.$refs.liId[index].className = "li-focus"; // 添加类
let list = [];
this.$refs.liId.forEach((element, index) => {
if (this.$refs.liId[index].className) {
list.push(this.$refs.liId[index].className);
}
});
if (list.length == this.list.length) {
this.checkAll = true;
}
} else {
this.$refs.liId[index].className = ""; // 选中再取消的情况
this.checkAll = false;
}
},
handleCheckAll(id) {
this.checkAll = !this.checkAll;
if (this.checkAll) {
this.$refs.liId.forEach((element, index) => {
this.$refs.liId[index].className = "li-focus"; // 添加类
});
} else {
this.$refs.liId.forEach((element, index) => {
this.$refs.liId[index].className = ""; // 选中再取消的情况
});
}
// // console.log(this.list)
// // this.list.map((u) => {
// // console.log(u)
// // })
// // this.checkList(id)
// this.checkAll = !this.checkAll;
// if (this.checkAll) {
// let listNew = [];
// this.list.map(u => {
// if (this.resourcesType == 0) {
// listNew.push(u.user_name);
// } else if (this.resourcesType == 2) {
// listNew.push(u.equip_name);
// }
// });
// this.checkAllGroup = listNew;
// this.$emit("changeData", this.checkAllGroup);
// } else {
// this.checkAllGroup = [];
// }
},
// checkAllGroupChange(data) {
// console.log(data);
// console.log(this.list);
// this.checkAllGroup = data;
// this.$emit("changeData", this.checkAllGroup);
// if (data.length === this.list.length) {
// this.indeterminate = false;
// this.checkAll = true;
// } else if (data.length > 0) {
// this.indeterminate = true;
// this.checkAll = false;
// } else {
// this.indeterminate = false;
// this.checkAll = false;
// }
// },
checkList(id) {
if (this.resourcesType == 0) {
//班组
Api.getbyshopid({ shop_id: id }).then(r => {
// console.log(r)
if (r.success) {
r.result.forEach(e => {
e.ischeckBox = false;
});
this.list = r.result;
}
});
} else if (this.resourcesType == 2) {
//设备
Api.getbyequippk({ equip_pk: 91 }).then(r => {
// console.log(r)
if (r.success) {
r.result.forEach(e => {
e.ischeckBox = false;
});
this.list = r.result;
}
});
}
},
upDown(post) {
if (!post.isClick) {
this.$set(post, "isClick", true);
this.checkList(post.shop_id);
} else {
this.$set(post, "isClick", false);
}
}
}
// watch: {
// list: {
// handler(newVal, oldVal) {
// console.log('深度监听', newVal, oldVal)
// },
// deep: true
// }
// }
};
</script>
<style lang="less" scoped>
.checkbox-list {
.icon-down {
text-align: right;
cursor: pointer;
}
.check-title {
height: 40px;
line-height: 40px;
padding: 0 10px;
background: rgba(38, 128, 235, 0.5);
}
ul {
min-height: 60px;
padding: 10px 5px;
display: flex;
li {
list-style-type: none;
text-align: center;
width: 100px;
height: 30px;
line-height: 30px;
border-radius: 20px;
margin: 0 5px;
cursor: pointer;
background: rgba(38, 128, 235, 0.1);
}
li:hover {
border: 1px solid rgba(38, 128, 235, 0.5);
}
.li-focus {
border: 1px solid rgba(38, 128, 235, 0.5);
}
}
}
</style>
\ No newline at end of file
......@@ -73,27 +73,6 @@
<Tree key="mytree" :data="workShop" ref="mytree" :render="renderContent"></Tree>
</Select>
</FormItem>
<!-- <FormItem v-if="formItem.radio==0">
<div class="list-check">
<Checkbox-List
:single-list="li"
ref="groups"
@changeData="setData"
v-for="(li,index) in listGroup"
:key="index"
></Checkbox-List>
</div>
</FormItem>-->
<!-- v-if="tagGroup.lenght>0" -->
<!-- <FormItem label="已选择" v-if="formItem.radio==0">
<div class="tag-list">
<div v-for="(item,index) in tagGroup" :key="index" class="tag-group">
<span>{{item.name}}&nbsp&nbsp{{item.class}}</span>
<Icon type="md-close" @click="closeTag" />
</div>
</div>
</FormItem>-->
<FormItem label="备注">
<Input
v-model="formItem.remark "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment