|
@ -81,9 +81,10 @@ |
|
|
</div> |
|
|
</div> |
|
|
<!-- 控制模式按钮部分 --> |
|
|
<!-- 控制模式按钮部分 --> |
|
|
<div class="control-mode-btn-area" v-show="showControlMode"> |
|
|
<div class="control-mode-btn-area" v-show="showControlMode"> |
|
|
<button v-for="(button3, index) in controlType" :key="index" |
|
|
<button v-for="(button3, index) in controlMode" :key="index" |
|
|
:class="{ btn: true, selected: button3.type == thisButton.type }" @click="selectButton3(button3)"> |
|
|
class="btn" |
|
|
{{ button3.name }} |
|
|
:class="{ selected: thisButton.mode.value == button3.value }" @click="selectButton3(button3)"> |
|
|
|
|
|
{{ button3.label }} |
|
|
</button> |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -212,7 +213,6 @@ |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import { ref, computed, onMounted, watch } from 'vue'; |
|
|
import { ref, computed, onMounted, watch } from 'vue'; |
|
|
import { controlType } from './treeData' |
|
|
|
|
|
import { |
|
|
import { |
|
|
DownOutlined, |
|
|
DownOutlined, |
|
|
UpOutlined, |
|
|
UpOutlined, |
|
@ -222,11 +222,15 @@ import { message } from 'ant-design-vue'; |
|
|
// 请求 |
|
|
// 请求 |
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
import { http } from '/nerv-lib/util/http'; |
|
|
import { lightingManage } from '/@/api/IlluminationInfo'; |
|
|
import { lightingManage } from '/@/api/IlluminationInfo'; |
|
|
|
|
|
import { getAllEnum } from '/@/api/index' |
|
|
|
|
|
|
|
|
// 初始化 ========================================================================= |
|
|
// 初始化 ========================================================================= |
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
onMounted(() => { |
|
|
|
|
|
// 设置分区 |
|
|
setArea() |
|
|
setArea() |
|
|
|
|
|
// 获得枚举 |
|
|
|
|
|
getEnum(['IlluminationMode', 'IlluminationScene']) |
|
|
}) |
|
|
}) |
|
|
// 父组件点击俯视图切换分区时,子组件切换线路 |
|
|
// 父组件点击俯视图切换分区时,子组件切换线路 |
|
|
const setArea = () => { |
|
|
const setArea = () => { |
|
@ -402,8 +406,13 @@ const toggleSelection = (button: any) => { |
|
|
} else { |
|
|
} else { |
|
|
// 未发生选中 或 多选被取消 |
|
|
// 未发生选中 或 多选被取消 |
|
|
showControlMode.value = false |
|
|
showControlMode.value = false |
|
|
thisButton.value = { type: '0' } |
|
|
thisButton.value = { |
|
|
|
|
|
mode: { |
|
|
|
|
|
value: '0' |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
console.log(thisButton,'button') |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 照明回路所有按钮 |
|
|
// 照明回路所有按钮 |
|
@ -417,16 +426,31 @@ const limitedButtons2 = computed(() => buttons2.value.slice(0, 8)); |
|
|
|
|
|
|
|
|
// 决定该区域是否显示 |
|
|
// 决定该区域是否显示 |
|
|
const showControlMode = ref(false); |
|
|
const showControlMode = ref(false); |
|
|
const thisButton = ref({ type: 0 }) |
|
|
const thisButton = ref({ |
|
|
|
|
|
mode: { |
|
|
|
|
|
value: '0' |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
// 控制模式 - 按钮切换 |
|
|
// 控制模式 - 按钮切换 |
|
|
const selectButton3 = (button3) => { |
|
|
const selectButton3 = (button3) => { |
|
|
thisButton.value.type = button3.type |
|
|
let checked = thisButton.value.mode.value |
|
|
showControlScene.value = button3.name === '手动'; |
|
|
console.log(button3.value,'---', checked) |
|
|
|
|
|
// 如果点击了相同的按钮,未作出修改 |
|
|
|
|
|
if (checked === button3.value) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
checked = button3.value |
|
|
|
|
|
// 如果当前选项是手动模式 |
|
|
|
|
|
showControlScene.value = button3.label === '手动模式'; |
|
|
selectedButton4.value = null; // 清空选中的控制场景按钮 |
|
|
selectedButton4.value = null; // 清空选中的控制场景按钮 |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 控制场景业务 ===================================================================== |
|
|
// 控制场景业务 ===================================================================== |
|
|
|
|
|
|
|
|
|
|
|
// 控制模式枚举 |
|
|
|
|
|
const controlMode = ref([]) |
|
|
|
|
|
// 场景枚举 |
|
|
|
|
|
const controlScene = ref([]) |
|
|
// 决定该区域是否显示 |
|
|
// 决定该区域是否显示 |
|
|
const showControlScene = ref(false); |
|
|
const showControlScene = ref(false); |
|
|
// 控制场景 - 所有按钮 |
|
|
// 控制场景 - 所有按钮 |
|
@ -458,6 +482,8 @@ const handleRowClick = (index: any) => { |
|
|
|
|
|
|
|
|
// 内侧弹窗 ======================================================================== |
|
|
// 内侧弹窗 ======================================================================== |
|
|
|
|
|
|
|
|
|
|
|
// 需要向后端提交的修改内容 |
|
|
|
|
|
const submitArray = ref([]) |
|
|
const cxList = ref([ |
|
|
const cxList = ref([ |
|
|
{ |
|
|
{ |
|
|
id: '1', |
|
|
id: '1', |
|
@ -498,7 +524,7 @@ const cxList = ref([ |
|
|
]); |
|
|
]); |
|
|
//撤销 |
|
|
//撤销 |
|
|
const delBtn = (id: any) => { |
|
|
const delBtn = (id: any) => { |
|
|
cxList.value.pop(id); |
|
|
cxList.value.pop(); |
|
|
console.log(cxList.value.length); |
|
|
console.log(cxList.value.length); |
|
|
|
|
|
|
|
|
if (cxList.value.length === 0) { |
|
|
if (cxList.value.length === 0) { |
|
@ -514,14 +540,6 @@ const isLoading = ref(false) |
|
|
const initMenu = (tier: number) => { |
|
|
const initMenu = (tier: number) => { |
|
|
// 1 = 照明区域 - 切换时,重置以下所有菜单 |
|
|
// 1 = 照明区域 - 切换时,重置以下所有菜单 |
|
|
if (tier == 1) { |
|
|
if (tier == 1) { |
|
|
// 切换前,清除照明回路的选中状态 |
|
|
|
|
|
// buttons2.value.forEach(item => { |
|
|
|
|
|
// item.selected = false |
|
|
|
|
|
// }) |
|
|
|
|
|
// // 切换后,清空所有选中状态 |
|
|
|
|
|
// props.treeData.forEach(item => { |
|
|
|
|
|
// item.selected = false |
|
|
|
|
|
// }) |
|
|
|
|
|
emit('reset') |
|
|
emit('reset') |
|
|
// 控制模式 隐藏 |
|
|
// 控制模式 隐藏 |
|
|
showControlMode.value = false; |
|
|
showControlMode.value = false; |
|
@ -568,6 +586,15 @@ const changeConfirm = () => { |
|
|
const changeCancel = () => { |
|
|
const changeCancel = () => { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
// 获得枚举,初始化 |
|
|
|
|
|
const getEnum = (arr: any) => { |
|
|
|
|
|
getAllEnum({ params: arr }).then(res => { |
|
|
|
|
|
const data = res.data |
|
|
|
|
|
controlMode.value = data.IlluminationMode |
|
|
|
|
|
controlScene.value = data.IlluminationScene |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(controlMode, controlScene, '001') |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
<style lang="less" scoped> |
|
|
<style lang="less" scoped> |
|
|