Browse Source

add:照明系统 增加接口 / 枚举 / 逻辑补充

temp
chenpingsen 4 months ago
parent
commit
842c1e94e0
  1. 24
      hx-ai-intelligent/src/api/index.ts
  2. 8
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue
  3. 61
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue
  4. 10
      hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue

24
hx-ai-intelligent/src/api/index.ts

@ -45,19 +45,9 @@ export const dict = async ({
export const getAllEnum = async ({ export const getAllEnum = async ({
api = `${BASE_URL}/operation/enum/getAllEnum`, api = `${BASE_URL}/operation/enum/getAllEnum`,
params = {}, params = {},
keyField = 'dicKey',
transform = (res: any) => res,
}: dictHttpConfig) => { }: dictHttpConfig) => {
const dictMap = JSON.parse(sessionStorage.getItem('dictMap') || '{}') as Object;
const key = get(params, keyField) as keyof typeof dictMap;
if (!dictMap.hasOwnProperty(key)) {
const res = await http.post(api, params); const res = await http.post(api, params);
const options = get(transform(res), `data.${key}`); return Promise.resolve(res);
dictMap[key] = options;
sessionStorage.setItem('dictMap', JSON.stringify(dictMap));
}
return Promise.resolve({ data: { data: get(dictMap, key) } });
}; };
@ -67,17 +57,7 @@ export const getAllEnum = async ({
export const getEnum = async ({ export const getEnum = async ({
api = `${BASE_URL}/operation/enum/getEnum`, api = `${BASE_URL}/operation/enum/getEnum`,
params = {}, params = {},
keyField = 'dicKey',
transform = (res: any) => res,
}: dictHttpConfig) => { }: dictHttpConfig) => {
const dictMap = JSON.parse(sessionStorage.getItem('dictMap') || '{}') as Object;
const key = get(params, keyField) as keyof typeof dictMap;
if (!dictMap.hasOwnProperty(key)) {
const res = await http.post(api, params); const res = await http.post(api, params);
const options = get(transform(res), `data.${key}`); return Promise.resolve(res);
dictMap[key] = options;
sessionStorage.setItem('dictMap', JSON.stringify(dictMap));
}
return Promise.resolve({ data: { data: get(dictMap, key) } });
}; };

8
hx-ai-intelligent/src/view/equipmentControl/lightingManage/indexs.vue

@ -49,7 +49,12 @@
:maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }"> :maskStyle="{ 'background-color': 'rgba(0, 0, 0, 0)' }">
<a-tabs v-model:activeKey="activeKey"> <a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="控制面板"> <a-tab-pane key="1" tab="控制面板">
<tabs1 @changeArea="changeArea" @reset="reset" :treeData="treeData" :nowArea="nowArea"></tabs1> <tabs1
@changeArea="changeArea"
@reset="reset"
:treeData="treeData"
:nowArea="nowArea"
></tabs1>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="2" tab="计划列表" force-render> <a-tab-pane key="2" tab="计划列表" force-render>
<tabs2></tabs2> <tabs2></tabs2>
@ -83,6 +88,7 @@ import {
// ======================================================= // =======================================================
onMounted(() => { onMounted(() => {
// 线
http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then(res => { http.get(lightingManage.getArea, { projectId: 'HLlmTZp8' }).then(res => {
const data = res.data const data = res.data
floorData.value = data floorData.value = data

61
hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs1.vue

@ -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>

10
hx-ai-intelligent/src/view/equipmentControl/lightingManage/tabs2.vue

@ -41,7 +41,14 @@
</td> </td>
<td> <td>
<div class="tabReboot" @click="restartPlan(row.id)">重启</div> <div class="tabReboot" @click="restartPlan(row.id)">重启</div>
<div class="tabDelete" @click="deletePlan(row.id)">删除</div> <a-popconfirm
title="此操作将永久删除该条数据"
ok-text="确定"
cancel-text="取消"
@confirm="deletePlan(row.id)"
>
<div class="tabDelete">删除</div>
</a-popconfirm>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -121,6 +128,7 @@ const addModal = () => {
addVisible.value = true; addVisible.value = true;
}; };
// 穿 ======================================================= // 穿 =======================================================
// 穿 // 穿

Loading…
Cancel
Save