guoyujia 1 سال پیش
والد
کامیت
1e92fe8452
1فایلهای تغییر یافته به همراه19 افزوده شده و 6 حذف شده
  1. 19 6
      components/dialog-turnoverApplication/dialog-turnoverApplication.vue

+ 19 - 6
components/dialog-turnoverApplication/dialog-turnoverApplication.vue

@@ -19,13 +19,13 @@
 			</view>
 			<view class="turnArea uni-row" v-if="curDayworkItem.turnoverType == '1'">
 				<view v-for="(item,index) in turnAreaList" class="btn">
-					<view :class="{ 'middle-btn': true, 'active': item == turnoverDoorChecked }"
+					<view :class="{ 'middle-btn': true, 'active': handleTurnoverDoor(item) }"
 						@click="selectTurnoverDoor(item)"><text class="label">{{item.code}}</text></view>
 				</view>
 			</view>
 			<view class="turnArea uni-row" v-if="curDayworkItem.turnoverType == '2'">
 				<view v-for="(item,index) in turnoverArea" class="btn">
-					<view :class="{ 'middle-btn': true, 'active': item == turnoverDoorChecked }"
+					<view :class="{ 'middle-btn': true, 'active': handleTurnoverDoor(item) }"
 						@click="selectTurnoverDoor(item)"><text class="label">{{item.dictLabel}}</text></view>
 				</view>
 			</view>
@@ -65,9 +65,10 @@
 	} from '@/utils/common.js'
 
 	const baseDialog = ref(null) 
-	const turnoverDoorChecked = ref({})
+	const turnoverDoorChecked = ref([])
 	const turnoverType = ref([])
 	const turnoverArea = ref([])
+	const selection = ref([])
 	const curDayworkItem = ref({
 		turnoverType: 1
 	})
@@ -131,13 +132,24 @@
 
 	function selectTurnoverType(item) {
 		curDayworkItem.value.turnoverType = item.dictValue;
+		selection.value = []
 	}
 
 	function selectTurnoverDoor(item) {
-		turnoverDoorChecked.value = item;
-		curDayworkItem.value.turnoverArea = item.dictValue;
+		// turnoverDoorChecked.value = item;
+		// curDayworkItem.value.turnoverArea = item.dictValue;
+	let index = selection.value.findIndex(selectedItem => selectedItem === item);
+	if (index > -1) {
+		selection.value.splice(index, 1); 
+	} else {
+		selection.value.push(item); 
+	}
+		
+	}
+    
+	function handleTurnoverDoor(item) {
+		return selection.value.includes(item);
 	}
-
 	function handleValidate(data) {
 		console.log(data)
 		if (data.turnoverType === "0" || data.turnoverArea === "" || data.deptId === "0") {
@@ -196,6 +208,7 @@
 
 	function handleChange() {
 		turnAreaList.value = [];
+		selection.value = []
 		getTurnoverListByDeptId({
 			deptId: curDayworkItem.value.deptId,
 		}).then(res => {