Files
dvcp_v2_wxcp_app/components/AiSelectEnterprise/AiSelectEnterprise.vue

145 lines
2.8 KiB
Vue
Raw Normal View History

2021-11-15 10:29:05 +08:00
<template>
<div class="AiSelectEnterprise">
<tree :checkList="checkList" :props="prop" @sendValue="(val)=>checkList = val" :multiple="multiple" :isCheck="true"
:rootId="rootId"/>
<div class="footer">
2022-03-23 11:48:58 +08:00
<div class="fill"/>
2021-11-15 10:29:05 +08:00
<div class="btn" @click="confirm">确定选择</div>
</div>
</div>
</template>
<script>
2024-10-31 16:22:41 +08:00
import tree from "./tree";
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
export default {
name: "AiSelectEnterprise",
2022-03-22 10:07:58 +08:00
components: {tree},
2021-12-15 14:37:20 +08:00
props: {
value: {
type: Array,
default: () => []
2021-11-15 10:29:05 +08:00
},
2021-12-15 14:37:20 +08:00
multiple: {
type: Boolean,
default: true
2021-11-15 10:29:05 +08:00
},
2021-12-15 14:37:20 +08:00
rootId: Object,
},
data() {
return {
tree: [],
checkList: this.value,
prop: {
label: 'name',
multiple: this.multiple,
},
map: {},
}
},
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
created() {
uni.pageScrollTo({
duration: 0,
scrollTop: 0
})
},
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
methods: {
confirm() {
let filter = []
this.map = {}
this.recursion(this.checkList)
Object.keys(this.map).map(e => filter.push(this.map[e]))
this.$emit("change", filter)
this.$emit('update:visible', false)
},
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
recursion(arr) {
if (arr?.length) {
arr.map(e => {
if ((e.type == 0 || e.openId) && e.checked && !this.map[e.id]) {
this.map[e.id] = e
this.recursion(e.childrenUser)
}
if (e.childrenDept?.length) {
this.recursion(e.childrenDept)
}
})
2021-11-15 10:29:05 +08:00
}
2021-12-15 14:37:20 +08:00
}
},
}
2021-11-15 10:29:05 +08:00
</script>
<style lang="scss" scoped>
2021-12-15 14:37:20 +08:00
.AiSelectEnterprise {
min-height: 100%;
background-color: #F5F5F5;
position: relative;
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
.footer {
2022-03-23 10:26:55 +08:00
width: 100vw;
2021-12-15 14:37:20 +08:00
display: flex;
align-items: center;
z-index: 10;
background: #F4F8FB;
position: fixed;
left: 0;
bottom: 0;
box-sizing: border-box;
2022-03-23 11:48:58 +08:00
padding: 0 32px 16px;
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
.scroll {
height: 118px;
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
::v-deep .uni-scroll-view-content {
display: flex;
align-items: center;
.tag {
width: 236px;
height: 72px;
background: #EAEEF1;
border-radius: 8px;
2021-11-15 10:29:05 +08:00
display: flex;
align-items: center;
2021-12-15 14:37:20 +08:00
margin-right: 16px;
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
& > img {
width: 48px;
height: 45px;
margin-right: 8px;
flex-shrink: 0;
}
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
& > label {
width: 148px;
height: 42px;
font-size: 30px;
font-weight: 600;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
2021-11-15 10:29:05 +08:00
}
}
}
2021-12-15 14:37:20 +08:00
}
2021-11-15 10:29:05 +08:00
2021-12-15 14:37:20 +08:00
.btn {
width: 192px;
height: 80px;
2022-03-23 11:48:58 +08:00
line-height: 80px;
2021-12-15 14:37:20 +08:00
background: #1365DD;
border-radius: 4px;
z-index: 10;
2022-03-23 11:48:58 +08:00
text-align: center;
2021-12-15 14:37:20 +08:00
font-size: 32px;
color: #FFFFFF;
margin-left: 8px;
2021-11-15 10:29:05 +08:00
}
}
2021-12-15 14:37:20 +08:00
}
2021-11-15 10:29:05 +08:00
</style>