From 9f5a191f0baae991052cd0c9045cf1d4076dec40 Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期三, 23 四月 2025 13:46:39 +0800 Subject: [PATCH] D 删除开发中的临时文件 --- /dev/null | 177 ----------------------------------------------------------- 1 files changed, 0 insertions(+), 177 deletions(-) diff --git a/src/views/device/realtime/settings0.vue b/src/views/device/realtime/settings0.vue deleted file mode 100644 index fa4c539..0000000 --- a/src/views/device/realtime/settings0.vue +++ /dev/null @@ -1,149 +0,0 @@ -<template> - <div class="lock-configurator"> - <h3>閿侀厤缃紙鍏� {{ lockCount }} 鎶婇攣锛�</h3> - <div v-for="(lock, index) in lockConfigs" :key="index" class="lock-item"> - <label>閿� {{ index + 1 }}锛�</label> - <select v-model="lock.cabinetIdx" @change="updateDoors(index)"> - <option :value="null">閫夋嫨鏈烘煖</option> - <option - v-for="cab in availableCabinets" - :key="cab.idx" - :value="cab.idx" - :disabled="isCabinetUsed(cab.idx)" - > - 鏈烘煖 {{ cab.idx }} - </option> - </select> - <select v-model="lock.doorIdx" :disabled="!lock.cabinetIdx"> - <option :value="null">閫夋嫨闂�</option> - <option - v-for="door in availableDoors(lock.cabinetIdx)" - :key="door" - :value="door" - :disabled="isDoorUsed(lock.cabinetIdx, door)" - > - 闂� {{ door }} - </option> - </select> - </div> - <button @click="submitConfig">鎻愪氦閰嶇疆</button> - </div> -</template> - -<script setup> -import { ref, reactive, computed, watch } from 'vue'; - -// 鎺ユ敹鐖剁粍浠朵紶鍏ョ殑閿佹暟閲� -const props = defineProps({ - lockCount: { - type: Number, - required: true - } -}); - -// 鍒濆鍖栨墍鏈夋満鏌滐紙1-20鍙凤紝鍚�2涓棬锛� -const allCabinets = ref( - Array.from({ length: 20 }, (_, i) => ({ - idx: i + 1, - doors: [1, 2] - })) -); - -// 閿佺殑閰嶇疆鏁扮粍锛堝搷搴斿紡锛� -const lockConfigs = reactive( - Array.from({ length: props.lockCount }, () => ({ - cabinetIdx: null, - doorIdx: null - })) -); - -// 鍏佽鍚屼竴鏈烘煖閫変笉鍚岄棬锛屼絾闇�閰嶅悎闂ㄩ�夋嫨鏃剁殑鍘婚噸閫昏緫 -const availableCabinets = computed(() => - allCabinets.value.filter(cab => - !lockConfigs.some(lock => lock.cabinetIdx === cab.idx) - ) -); - -// 璁$畻鍙敤鏈烘煖锛堣繃婊ゅ凡浣跨敤鐨勬満鏌滐級 -const usedCabinets = computed(() => - lockConfigs.filter(lock => lock.cabinetIdx !== null) -); - -// 璁$畻鍙敤闂紙鏍规嵁褰撳墠鏈烘煖杩囨护宸蹭娇鐢ㄧ殑闂級 -const usedDoors = computed(() => - lockConfigs.filter(lock => lock.doorIdx !== null) -); - -// 闃查噸澶嶉�夋嫨閫昏緫 -const isCabinetUsed = (cabIdx) => { - return lockConfigs.some(lock => - lock.cabinetIdx === cabIdx && lock.doorIdx !== null - ); -}; - -const isDoorUsed = (cabIdx, door) => { - return lockConfigs.some(lock => - lock.cabinetIdx === cabIdx && lock.doorIdx === door - ); -}; - -// 鏇存柊鍙敤闂ㄩ�夐」 -const availableDoors = (cabIdx) => { - if (!cabIdx) return []; - return allCabinets.value.find(cab => cab.idx === cabIdx)?.doors.filter(door => - !isDoorUsed(cabIdx, door) - ) || []; -}; - -// 鎻愪氦閰嶇疆锛堟牴鎹渶姹傚彲鏇挎崲涓篈PI璋冪敤锛� -const submitConfig = () => { - const valid = lockConfigs.every(lock => - lock.cabinetIdx !== null && lock.doorIdx !== null - ); - - if (valid) { - console.log(' 閰嶇疆鎻愪氦鎴愬姛:', lockConfigs); - } else { - alert('璇峰畬鎴愭墍鏈夐攣鐨勯厤缃�'); - } -}; - -// 鐩戝惉閿佹暟閲忓彉鍖栵紙鍔ㄦ�佽皟鏁撮厤缃暟缁勶級 -watch(() => props.lockCount, (newVal) => { - lockConfigs.length = newVal; - lockConfigs.forEach((lock, index) => { - if (index >= newVal) { - lock.cabinetIdx = null; - lock.doorIdx = null; - } - }); -}); -</script> - -<style scoped> -.lock-item { - margin: 10px 0; - display: flex; - align-items: center; -} - -.lock-item label { - margin-right: 15px; - width: 60px; -} - -.lock-item select { - margin-right: 15px; - padding: 5px; - width: 120px; -} - -button { - margin-top: 20px; - padding: 10px 20px; - background: #4CAF50; - color: white; - border: none; - cursor: pointer; -} -</style> \ No newline at end of file diff --git a/src/views/device/realtime/settings2.vue b/src/views/device/realtime/settings2.vue deleted file mode 100644 index 628d67a..0000000 --- a/src/views/device/realtime/settings2.vue +++ /dev/null @@ -1,177 +0,0 @@ -<!-- LockConfigurator.vue --> -<template> - <div class="lock-configurator"> - <h3>閿侀厤缃紙鍏� {{ lockCount }} 鎶婇攣锛�</h3> - <div v-for="(lock, index) in lockConfigs" :key="index" class="lock-item"> - <label>閿� {{ index + 1 }}锛�</label> - <select - v-model="lock.cabinetIdx" - @change="updateDoors(index)" - class="select-input" - > - <option :value="null">閫夋嫨鏈烘煖</option> - <option - v-for="cab in availableCabinets" - :key="cab.idx" - :value="cab.idx" - :disabled="isCabinetUsed(cab.idx)" - > - 鏈烘煖 {{ cab.idx }} - </option> - </select> - <select - v-model="lock.doorIdx" - :disabled="!lock.cabinetIdx" - class="select-input" - > - <option :value="null">閫夋嫨闂�</option> - <option - v-for="door in availableDoors(lock.cabinetIdx)" - :key="door" - :value="door" - :disabled="isDoorUsed(lock.cabinetIdx, door)" - > - 闂� {{ door }} - </option> - </select> - </div> - <button @click="submitConfig" class="submit-btn"> - 鎻愪氦閰嶇疆 - </button> - </div> -</template> - -<script setup> -import { ref, reactive, computed, watch } from 'vue'; - -// 鎺ユ敹鐖剁粍浠朵紶鍏ョ殑閿佹暟閲� -const props = defineProps({ - lockCount: { - type: Number, - required: true - } -}); - -// 鍒濆鍖栨墍鏈夋満鏌滐紙1-20鍙凤紝鍚�2涓棬锛� -const allCabinets = ref( - Array.from({ length: 20 }, (_, i) => ({ - idx: i + 1, - doors: [1, 2] - })) -); - -// 閿佺殑閰嶇疆鏁扮粍锛堝搷搴斿紡锛� -const lockConfigs = reactive( - Array.from({ length: props.lockCount }, () => ({ - cabinetIdx: null, - doorIdx: null - })) -); - -// 璁$畻鍙敤鏈烘煖锛堣繃婊ゅ凡浣跨敤鐨勬満鏌滐級 -const usedCabinets = computed(() => - lockConfigs.filter(lock => lock.cabinetIdx !== null) -); - -// 闃查噸澶嶉�夋嫨閫昏緫 -const isCabinetUsed = (cabIdx) => { - return lockConfigs.some(lock => - lock.cabinetIdx === cabIdx && lock.doorIdx !== null - ); -}; - -const isDoorUsed = (cabIdx, door) => { - return lockConfigs.some(lock => - lock.cabinetIdx === cabIdx && lock.doorIdx === door - ); -}; - -// 鍏佽鍚屼竴鏈烘煖閫変笉鍚岄棬锛屼絾闇�閰嶅悎闂ㄩ�夋嫨鏃剁殑鍘婚噸閫昏緫 -const availableCabinets = computed(() => - allCabinets.value.filter(cab => - !lockConfigs.some(lock => lock.cabinetIdx === cab.idx) - ) -); - -// 鏇存柊鍙敤闂ㄩ�夐」 -const availableDoors = (cabIdx) => { - if (!cabIdx) return []; - return allCabinets.value.find(cab => cab.idx === cabIdx)?.doors.filter(door => - !isDoorUsed(cabIdx, door) - ) || []; -}; - -// 鎻愪氦閰嶇疆锛堟牴鎹渶姹傚彲鏇挎崲涓篈PI璋冪敤锛� -const submitConfig = () => { - const valid = lockConfigs.every(lock => - lock.cabinetIdx !== null && lock.doorIdx !== null - ); - - if (valid) { - console.log(' 閰嶇疆鎻愪氦鎴愬姛:', lockConfigs); - } else { - alert('璇峰畬鎴愭墍鏈夐攣鐨勯厤缃�'); - } -}; - -// 鐩戝惉閿佹暟閲忓彉鍖栵紙鍔ㄦ�佽皟鏁撮厤缃暟缁勶級 -watch(() => props.lockCount, (newVal) => { - lockConfigs.length = newVal; - lockConfigs.forEach((lock, index) => { - if (index >= newVal) { - lock.cabinetIdx = null; - lock.doorIdx = null; - } - }); -}); -</script> - -<style scoped> -.lock-configurator { - max-width: 600px; - margin: 20px auto; - padding: 20px; - background: #f5f5f5; - border-radius: 8px; -} - -.lock-item { - margin: 15px 0; - display: flex; - align-items: center; -} - -.lock-item label { - margin-right: 20px; - width: 80px; - font-weight: bold; -} - -.select-input { - margin-right: 15px; - padding: 8px 12px; - width: 150px; - border: 1px solid #ddd; - border-radius: 4px; -} - -.select-input:disabled { - background: #f0f0f0; -} - -.submit-btn { - display: block; - margin: 20px auto; - padding: 12px 30px; - background: #4CAF50; - color: white; - border: none; - border-radius: 6px; - cursor: pointer; - transition: all 0.3s; -} - -.submit-btn:hover { - background: #45a049; -} -</style> \ No newline at end of file -- Gitblit v1.9.1