78 lines
1.7 KiB
Vue
78 lines
1.7 KiB
Vue
<template>
|
|
<div>
|
|
<a-button type="text" @click="show = true">分类</a-button>
|
|
<a-modal v-model:visible="show" @before-ok="submit">
|
|
<div>
|
|
<a-tag v-for="item in list" type="primary" class="mr-15" @click="select(item)">
|
|
{{ item.tag }}
|
|
</a-tag>
|
|
</div>
|
|
</a-modal>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
id: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
watch: {
|
|
show: {
|
|
handler(val) {
|
|
if (val) {
|
|
this.fetchList()
|
|
}
|
|
},
|
|
immediate: true
|
|
}
|
|
},
|
|
|
|
data() {
|
|
return {
|
|
list: [],
|
|
show: false,
|
|
timer: null,
|
|
name: ''
|
|
}
|
|
},
|
|
methods: {
|
|
|
|
fetchList() {
|
|
const data = { current: 1, pageSize: 999, }
|
|
this.$api.flower.listCategory(data).then((res) => {
|
|
if (res.code === 200) {
|
|
this.list = res.data.list.map(e => {
|
|
e.checked = false
|
|
return e
|
|
})
|
|
}
|
|
})
|
|
},
|
|
|
|
select(item) {
|
|
const data = { id: this.id, ids: [item.id] }
|
|
this.$api.flower.linkClass(data).then(res => {
|
|
if (res.code === 200) {
|
|
this.$message.success(res.msg)
|
|
this.show = false
|
|
this.$emit('ok')
|
|
} else {
|
|
this.$message.error(res.msg)
|
|
}
|
|
})
|
|
},
|
|
|
|
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped></style>
|