东方国信-蔡芳 před 8 měsíci
rodič
revize
63ff46ac71

+ 30 - 44
src/views/resourceCenter/components/ComplexChoices.vue

@@ -17,7 +17,7 @@
 					></MyRadioButtonOffOut>
 				</MyRadioButtonGroup>
 				<div style="height: 10px"></div>
-				<MyRadioButtonGroup ref="Big" v-model="selectedDeptBig" @change="handleSelectedCourses">
+				<MyRadioButtonGroup ref="Big" v-model="selectedDeptBig" @change="handleSelectedCourses11">
 					<MyRadioButton
 						v-for="(item, index) in selectedDeptBigs"
 						:key="index"
@@ -27,7 +27,7 @@
 					></MyRadioButton>
 				</MyRadioButtonGroup>
 				<div style="height: 10px"></div>
-				<MyRadioButtonGroup ref="Smail" v-model="selectedDeptSmail" @change="handleSelectedCourses">
+				<MyRadioButtonGroup ref="Smail" v-model="selectedDeptSmail" @change="handleSelectedCourses1">
 					<MyRadioButton
 						v-for="(item, index) in selectedDeptSmails"
 						:key="index"
@@ -63,30 +63,20 @@
 		<div style="height: 10px"></div>
 		<!-- 课程类型和课件格式(联动单选) -->
 		<div class="filter-group">
-			<span class="filter-group-title">资源类型:</span>
+			<span class="filter-group-title">课程类型:</span>
 			<!-- <a-radio-group v-model:value="selectedType" @change="handleTypeChange">
 				<a-radio-button v-for="dept in selectedTypes" :key="dept" :value="dept">{{ dept }}</a-radio-button>
 			</a-radio-group> -->
-			<div style="display: flex; flex-direction: column">
-				<MyRadioButtonGroup ref="Type" v-model="selectedTypeBig" @change="handleTypeChange">
-					<MyRadioButton
-						v-for="(item, index) in selectedTypesBig"
-						:key="index"
-						:value="item"
-						:label="item"
-						:index="index"
-					></MyRadioButton>
-				</MyRadioButtonGroup>
-				<MyRadioButtonGroup ref="Type" v-model="selectedType" @change="handleTypeChange">
-					<MyRadioButton
-						v-for="(item, index) in selectedTypes"
-						:key="index"
-						:value="item"
-						:label="item"
-						:index="index"
-					></MyRadioButton>
-				</MyRadioButtonGroup>
-			</div>
+
+			<MyRadioButtonGroup ref="Type" v-model="selectedType" @change="handleTypeChange">
+				<MyRadioButton
+					v-for="(item, index) in selectedTypes"
+					:key="index"
+					:value="item"
+					:label="item"
+					:index="index"
+				></MyRadioButton>
+			</MyRadioButtonGroup>
 		</div>
 		<div style="height: 10px"></div>
 		<div class="line"></div>
@@ -141,7 +131,6 @@
 	const selectedDeptBig = ref('')
 	const selectedDeptSmail = ref('')
 	const selectedCourse = ref('')
-	const selectedTypeBig = ref('')
 	const selectedType = ref('')
 	const selectedFormat = ref('')
 	const Dept = ref(null)
@@ -207,18 +196,21 @@
 		'机型改装训练',
 		'应急程序训练'
 	])
-	const selectedTypesBig = ref(['全部大', '热门资源大', '名师资源大', '必修大大', '选修大'])
 	const selectedTypes = ref(['全部', '热门资源', '名师资源', '必修', '选修'])
 	const selectedFormats = ref(['全部', 'ppt', 'word', 'excel', 'pdf', 'mp4', 'zip', 'rar'])
 
 	const handleSelectedDept = (e) => {
+		if(e==0){
+			selectedDeptBigs.value=[]
+			selectedDeptSmails.value=[]
+		}
 		selectedDeptBigs.value=selectedDeptBigsList.value[e]
 		Big.value.setClean(selectedDeptBigs.value[0])
 		Smail.value.setClean(selectedDeptSmails.value[0])
 
 		updateSelectedTags()
 	}
-	const handleSelectedCourses = (e) => {
+	const handleSelectedCourses11 = (e) => {
 		selectedDeptSmails.value=selectedDeptSmailsList.value[e]
 		updateSelectedTags()
 	}
@@ -244,7 +236,7 @@
 		// 	...(selectedType.value !== '全部' ? { key: 'Type', list: [selectedType.value] } : []),
 		// 	...(selectedFormat.value !== '全部' ? { key: 'Format', list: [selectedFormat.value] } : [])
 		// ]
-		if (selectedDept.value !== '不限') {
+		if (selectedDept.value !== '全部') {
 			selectedTags.value.push(...[selectedDept.value])
 			selectedTagKeys.value.push('Dept')
 		}
@@ -252,14 +244,6 @@
 			selectedTags.value.push(...[selectedCourse.value])
 			selectedTagKeys.value.push('Course')
 		}
-		if (selectedDeptBig.value !== '全部') {
-			selectedTags.value.push(...[selectedDeptBig.value])
-			selectedTagKeys.value.push('Course1')
-		}
-		if (selectedDeptSmail.value !== '全部') {
-			selectedTags.value.push(...[selectedDeptSmail.value])
-			selectedTagKeys.value.push('Course2')
-		}
 		if (selectedType.value !== '全部') {
 			selectedTags.value.push(...[selectedType.value])
 			selectedTagKeys.value.push('Type')
@@ -301,18 +285,20 @@
 
 		collegeApi.tree().then((data) => {
 			selectedDepts.value=data;
-			selectedDepts.value.forEach((item)=>{
-				selectedDeptBigsList.value.push(item.children);
-				item.children.forEach((item)=>{
-					selectedDeptSmailsList.value.push(item.children);
-				})
-			})
-			handleSelectedDept(0);
-			handleSelectedCourses(0);
+			selectedDepts.value.splice(0, 0, {name:"全部"})
+			let onelist=selectedDepts.value;
+			for (let i = 1; i <onelist.length; i++) {
+				selectedDeptBigsList.value.push(onelist[i].children);
+				let twoList=onelist[i].children;
+				for(let j=0;j<twoList.length;j++){
+					selectedDeptSmailsList.value.push(twoList[j].children);
+				}
+			}
 		})
+		selectedDeptBigsList.value.splice(0, 0, {name:""})
 
 
-		updateSelectedTags()
+		updateSelectedTags(selectedDepts.value)
 	}
 
 	onMounted(() => {