浏览代码

feat: 设备群组ui调整

lvkun 3 年之前
父节点
当前提交
329473ffff
共有 1 个文件被更改,包括 8 次插入17 次删除
  1. 8 17
      src/pages/Iot/device/group.vue

+ 8 - 17
src/pages/Iot/device/group.vue

@@ -84,14 +84,10 @@
         </template>
         </a-table>
       </span>
-      <span v-else >
+      <span v-else  :key="selectGroup?.id">
         <a-row  >
         <a-col :span="24" >
-          <a-descriptions title="基本信息" :column="{lg: 2, md: 1, xs: 1}" >
-          <a-descriptions-item label="群组名称">{{selectGroup?.groupLabel}}</a-descriptions-item>
-          <a-descriptions-item label="群组ID">{{selectGroup?.id}}</a-descriptions-item>
-          <a-descriptions-item label="群组描述">我是假的群组描述</a-descriptions-item>
-        </a-descriptions>
+          <div style="font-size: 18px;font-weight: 500" >群组名称:{{state.selectGroup?.groupLabel}}</div>
         </a-col>
       </a-row>
       <a-card
@@ -351,15 +347,6 @@ function buildTree (data: TreeNode[], upperGroupId: string): TreeNode[] {
 const expandedKeys = ref<string[]>([])
 const selectedKeys = ref<string[]>([''])
 
-watch(
-  selectedKeys,
-  () => {
-    console.log('selectedKeys', selectedKeys.value[0])
-    state.treeActiveKey = selectedKeys.value[0]
-    // selectedKeys.value = [state.treeActiveKey]
-    getDeviceByGroup()
-  })
-
 const selectGroup = computed(() => state.groupData.find(item => item.id === state.treeActiveKey))
 
 const deviceState = reactive({
@@ -389,7 +376,8 @@ const state = reactive<{
   drawerVisible: boolean
   selectedRowKeys: string[],
   groupModalVisible: boolean,
-  groupOpra: 'add' | 'del'
+  groupOpra: 'add' | 'del',
+  selectGroup: Partial<IOT.API.DEVICE.Device>
 }>({
   groupTreeData: [],
   groupData: [],
@@ -402,7 +390,7 @@ const state = reactive<{
   loading: false,
   tableLoading: false,
   groupModalVisible: false,
-
+  selectGroup: {},
   drawerVisible: false,
   modelList: [],
   selectedRowKeys: [],
@@ -495,6 +483,9 @@ const changeTreeActiveKey = (id: string, e?: TouchEvent) => {
   state.treeActiveKey = id
   console.log(state.treeActiveKey)
   getDeviceByGroup()
+  state.selectGroup = state.groupData.find(item => item.id === state.treeActiveKey)
+
+  console.log(state.selectGroup)
 }
 
 const addDevicegroup = (e: TouchEvent) => {