2023-11-07 09:30:25 +08:00
|
|
|
<template>
|
|
|
|
|
<a-modal class="library_setLabel"
|
|
|
|
|
v-model:visible="setLabelShow"
|
|
|
|
|
:footer="null"
|
|
|
|
|
title="Edit tag"
|
|
|
|
|
width="65%"
|
|
|
|
|
:maskClosable="false"
|
|
|
|
|
:centered="true"
|
|
|
|
|
@onCancel="clearSetLabel"
|
|
|
|
|
>
|
2023-11-08 13:01:45 +08:00
|
|
|
<div class="setLabel_centent">
|
|
|
|
|
<ul class="setLabel_label1" v-for="item1 in options" :key="item1.id">
|
|
|
|
|
<li class="label1_title">
|
|
|
|
|
<a-checkbox
|
|
|
|
|
v-model:checked="item1.checkAll"
|
|
|
|
|
:indeterminate="indeterminate"
|
|
|
|
|
@change="onCheckAllChange(item1.children,$event)"
|
|
|
|
|
>
|
|
|
|
|
{{ item1.label }}
|
|
|
|
|
</a-checkbox>
|
|
|
|
|
<ul class="setLabel_label2" >
|
|
|
|
|
<a-checkbox-group v-model:value="checkedList" :options="item1.children" />
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
2023-11-08 09:31:40 +08:00
|
|
|
</ul>
|
|
|
|
|
</div>
|
2023-11-07 09:30:25 +08:00
|
|
|
</a-modal>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts">
|
2023-11-08 13:01:45 +08:00
|
|
|
import { defineComponent,ref,createVNode,watch,reactive} from 'vue'
|
2023-11-07 09:30:25 +08:00
|
|
|
import { Https } from "@/tool/https";
|
|
|
|
|
import {dataURLtoFile,base64toFile} from "@/tool/util"
|
|
|
|
|
import { getCookie } from "@/tool/cookie";
|
|
|
|
|
import 'vue-cropper/dist/index.css'
|
|
|
|
|
import { VueCropper } from "vue-cropper";
|
|
|
|
|
import { useStore } from "vuex";
|
|
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
import { Modal,message,Upload,CascaderProps } from 'ant-design-vue';
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
components:{
|
|
|
|
|
VueCropper,
|
|
|
|
|
},
|
|
|
|
|
setup() {
|
|
|
|
|
let cropperTime:any = ref()
|
|
|
|
|
let multiple = ref(false)
|
2023-11-08 13:01:45 +08:00
|
|
|
let indeterminate = ref(true)
|
2023-11-07 09:30:25 +08:00
|
|
|
const options: CascaderProps['options'] = [
|
|
|
|
|
{
|
|
|
|
|
label: 'Light',
|
|
|
|
|
value: 'light',
|
2023-11-08 13:01:45 +08:00
|
|
|
checkAll:false,
|
2023-11-07 09:30:25 +08:00
|
|
|
children: new Array(20)
|
|
|
|
|
.fill(null)
|
|
|
|
|
.map((_, index) => ({ label: `Number ${index}`, value: index })),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Bamboo',
|
|
|
|
|
value: 'bamboo',
|
2023-11-08 13:01:45 +08:00
|
|
|
checkAll:false,
|
2023-11-07 09:30:25 +08:00
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Little',
|
2023-11-08 13:01:45 +08:00
|
|
|
checkAll:false,
|
2023-11-07 09:30:25 +08:00
|
|
|
value: 'little',
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
label: `'Toy Fish'`,
|
|
|
|
|
value: 'fish',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Toy Cards',
|
|
|
|
|
value: 'cards',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Toy Bird',
|
|
|
|
|
value: 'bird',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
];
|
2023-11-08 13:01:45 +08:00
|
|
|
let checkedList = ref([])
|
|
|
|
|
|
2023-11-07 09:30:25 +08:00
|
|
|
let {t} = useI18n()
|
|
|
|
|
return {
|
|
|
|
|
multiple,
|
2023-11-08 13:01:45 +08:00
|
|
|
indeterminate,
|
2023-11-07 09:30:25 +08:00
|
|
|
value: ref<string[]>([]),
|
|
|
|
|
options,
|
2023-11-08 13:01:45 +08:00
|
|
|
checkedList,
|
2023-11-07 09:30:25 +08:00
|
|
|
t
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data(){
|
|
|
|
|
return{
|
|
|
|
|
setLabelShow:false,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted(){
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
2023-11-08 13:01:45 +08:00
|
|
|
|
2023-11-07 09:30:25 +08:00
|
|
|
},
|
|
|
|
|
methods:{
|
|
|
|
|
init(str:any){
|
|
|
|
|
this.setLabelShow = true
|
|
|
|
|
if(str === 'add'){
|
|
|
|
|
this.multiple = false
|
|
|
|
|
}else{
|
|
|
|
|
this.multiple = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
clearSetLabel(){
|
|
|
|
|
this.setLabelShow = false
|
2023-11-08 13:01:45 +08:00
|
|
|
},
|
|
|
|
|
onCheckAllChange(item:any,e:any){
|
|
|
|
|
console.log(this.checkedList);
|
|
|
|
|
this.checkedList = item
|
|
|
|
|
// this.checkedList.forEach((item)=>{
|
|
|
|
|
// item.
|
|
|
|
|
// })
|
|
|
|
|
this.checkedList= e.target.checked ? item : [];
|
|
|
|
|
this.indeterminate= false;
|
2023-11-07 09:30:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less">
|
|
|
|
|
.library_setLabel{
|
2023-11-08 13:01:45 +08:00
|
|
|
.setLabel_centent{
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
ul{
|
|
|
|
|
display: flex;
|
|
|
|
|
li{
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-07 09:30:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|