Commit a4610c7a authored by Mac's avatar Mac

标签选择

parent d2491f31
<style lang="scss"> <style scoped>
.q-pt-none .unchecked {
margin-right: 10px;
margin-top: 5px;
cursor: pointer;
padding: 0 10px;
font-size: 14px;
font-weight: 400;
height: 28px;
line-height: 28px;
border-radius: 4px;
background: #f6f6f6;
}
.q-pt-none .select {
color: #3c66ee;
background-color: #edf2fd;
}
</style> </style>
<template> <template>
<div class="labelgroup"> <div class="labelgroup">
...@@ -12,9 +26,22 @@ ...@@ -12,9 +26,22 @@
</q-card-section> </q-card-section>
<q-card-section class="q-pt-none"> <q-card-section class="q-pt-none">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum repellendus sit voluptate voluptas eveniet <div style='max-height: 378px;overflow-y: auto;border-bottom: 1px solid #d7d7d7;'>
porro. Rerum blanditiis perferendis totam, ea at omnis vel numquam exercitationem aut, natus minima, porro <div v-for="(x,y) in LableList" :key="y" style='padding-bottom: 15px;'>
labore. <div style="color: #606266;font-size: 14px;font-weight: 700;">{{x.Name}}</div>
<div style="display: flex;flex-wrap: wrap;">
<div v-for='(item,index) in x.ChildList' :key='index' class="unchecked"
:class="{ 'select': item.chek == true }" @click='changechek(y,index)'>{{item.Name}}</div>
</div>
</div>
</div>
<div style="display: flex;flex-wrap: wrap;max-height: 110px;overflow-y: auto;margin: 10px 0;">
<q-chip v-for="(tag,tagindex) in selectList" :key="tagindex" removable @remove="getclose(tag,tagindex)"
color="orange" text-color="white" size='sm'>
{{tag.Name}}
</q-chip>
</div>
</q-card-section> </q-card-section>
<q-card-actions align="right" class="bg-white"> <q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="goclose" /> <q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="goclose" />
...@@ -40,15 +67,43 @@ ...@@ -40,15 +67,43 @@
setup(props, ctx) { setup(props, ctx) {
let selectList = ref(props.list) let selectList = ref(props.list)
let LableList = ref([]) let LableList = ref([])
const goclose = () => { const goclose = () => {//关闭弹窗
ctx.emit('close') ctx.emit('close')
} }
const determine = () => { const determine = () => {//确定并返回数据
ctx.emit('submit', selectList.value) ctx.emit('submit', selectList.value)
} }
const getclose = (tag, index) => {
let Id = tag.Id
for (let i = 0; i < LableList.value.length; i++) {
let ChildList = LableList.value[i].ChildList
if (ChildList.length > 0) {
for (let j = 0; j < ChildList.length; j++) {
if (Id == ChildList[j].Id) {
LableList.value[i].ChildList[j].chek = false
selectList.value.splice(index, 1)
return
}
}
}
}
}
const changechek = (y, index) => {
LableList.value[y].ChildList[index].chek = !LableList.value[y].ChildList[index].chek;
selectList.value = [];
LableList.value.forEach(x => {
if (x.ChildList.length > 0) {
x.ChildList.forEach(j => {
if (j.chek == true) {
selectList.value.push(j)
}
})
}
})
}
const getLabelList = () => { const getLabelList = () => {
customerService.getLabelList({}).then((res) => { customerService.getLabelList({}).then((res) => {
console.log(res)
if (res.data.Code == 1) { if (res.data.Code == 1) {
LableList.value = res.data.Data LableList.value = res.data.Data
LableList.value.forEach(x => { LableList.value.forEach(x => {
...@@ -72,12 +127,16 @@ ...@@ -72,12 +127,16 @@
getLabelList() getLabelList()
}) })
return { return {
alert: ref(true), alert: ref(true),
goclose, goclose,
determine, determine,
selectList, selectList,
getLabelList getLabelList,
LableList,
changechek,
getclose
} }
} }
......
...@@ -55,6 +55,12 @@ ...@@ -55,6 +55,12 @@
background: #333 !important; background: #333 !important;
color: #fff !important; color: #fff !important;
} }
.tag-select-input {
padding: 4px 10px;
border-radius: 5px;
background-color: #f6f6f6;
font-size: 14px;
}
</style> </style>
<template> <template>
<div class="requestgroup"> <div class="requestgroup">
......
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