Quellcode durchsuchen

fix: 优化设备树管理,网络组件,组态管理页面显示效果。优化设备页面上来就请求phonelimit等系统参数

yanglzh vor 1 Jahr
Ursprung
Commit
abbc1d717c

+ 4 - 0
src/theme/element.scss

@@ -22,6 +22,10 @@
 	margin-right: 5px;
 }
 
+.el-image{
+	vertical-align: top;
+}
+
 .image-slot {
   display: flex;
 	flex-direction: column;

+ 2 - 0
src/theme/media/pagination.scss

@@ -12,4 +12,6 @@
 // 默认居中对齐
 .el-pagination {
 	text-align: center !important;
+	display: flex;
+	justify-content: flex-end;
 }

+ 2 - 2
src/views/iot/configuration/list/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-card shadow="nover">
+  <el-card shadow="nover" class="page-full">
     <div class="search">
       <el-form :inline="true">
         <el-form-item>
@@ -22,7 +22,7 @@
         </el-form-item>
       </el-form>
     </div>
-    <el-table :data="tableData" style="width: 100%" row-key="id" v-loading="loading">
+    <el-table :data="tableData" style="width: 100%" row-key="id" v-loading="loading" max-height="calc(100vh - 255px)">
       <!-- <el-table-column type="index" label="序号" width="60" align="center" /> -->
       <el-table-column prop="id" label="ID" width="100" show-overflow-tooltip></el-table-column>
       <el-table-column prop="name" label="组态图名称" show-overflow-tooltip></el-table-column>

+ 2 - 2
src/views/iot/configuration/screen/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-card shadow="nover">
+  <el-card shadow="nover" class="page-full">
     <div class="search">
       <el-form :inline="true">
         <el-form-item>
@@ -12,7 +12,7 @@
         </el-form-item>
       </el-form>
     </div>
-    <el-table :data="tableData" style="width: 100%" v-loading="loading">
+    <el-table :data="tableData" style="width: 100%" v-loading="loading" max-height="calc(100vh - 255px)">
       <el-table-column type="index" label="序号" width="60" align="center" />
       <el-table-column prop="id" label="ID" show-overflow-tooltip></el-table-column>
       <el-table-column prop="projectName" label="大屏名称" show-overflow-tooltip></el-table-column>

+ 88 - 66
src/views/iot/device-tree/tree/index.vue

@@ -52,53 +52,75 @@
       </el-col>
       <el-col :span="18" class="h-full">
         <el-card shadow="nover" class="h-full" v-if="treeDetail.name">
-          <el-tabs v-model="tabName" @tab-click="onTabClick">
-            <el-tab-pane label="设备树信息" name="1">
-              <table>
-                <tbody>
-                  <tr class="ant-descriptions-row">
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">名称</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.name }}</td>
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">地址</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.address }}</td>
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">经度</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.lng }}</td>
-                  </tr>
-                  <tr class="ant-descriptions-row">
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">纬度</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.lat }}</td>
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">联系人</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.contact }}</td>
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">联系电话</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.phone }}</td>
-                  </tr>
-                  <tr class="ant-descriptions-row">
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">服务周期:开始日期</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.startDate }}</td>
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">服务周期:截止日期</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.endDate }}</td>
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">图片</th>
-                    <td class="ant-descriptions-item-content" colspan="1">
-                      <el-image :src="treeDetail.image" v-if="treeDetail.image" />
-                    </td>
-                  </tr>
-                  <tr class="ant-descriptions-row">
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">设备标识</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.deviceKey }}</td>
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">设备所属区域</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.area }}</td>
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">所属公司</th>
-                    <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.company }}</td>
-                  </tr>
-                  <tr class="ant-descriptions-row">
-                    <th class="ant-descriptions-item-label ant-descriptions-item-colon">类型</th>
-                    <td class="ant-descriptions-item-content" colspan="5">{{ treeDetail.types }}</td>
-                  </tr>
-                </tbody>
-              </table>
-            </el-tab-pane>
-            <el-tab-pane label="时间周期" name="2">
-              <el-form :model="ruleForm" ref="formRef" size="default" label-width="80px">
+          <el-form :model="ruleForm" ref="formRef" size="default" label-width="80px">
+            <el-tabs v-model="tabName" @tab-click="onTabClick">
+              <el-tab-pane label="设备树信息" name="1">
+                <el-descriptions class="margin-top" :column="3" size="default" border>
+                  <el-descriptions-item label="名称">{{ treeDetail.name }}</el-descriptions-item>
+                  <el-descriptions-item label="设备标识">{{ treeDetail.deviceKey }}</el-descriptions-item>
+                  <el-descriptions-item label="联系人">{{ treeDetail.contact }}</el-descriptions-item>
+                  <el-descriptions-item label="经纬度">{{ treeDetail.lng }}, {{ treeDetail.lat }}</el-descriptions-item>
+                  <el-descriptions-item label="联系电话">{{ treeDetail.phone }}</el-descriptions-item>
+                  <el-descriptions-item label="类型">{{ treeDetail.types }}</el-descriptions-item>
+                  <el-descriptions-item label="服务周期" span="2">{{ treeDetail.startDate }} - {{ treeDetail.endDate }}</el-descriptions-item>
+                  <el-descriptions-item label="图片">
+                    <el-image :src="treeDetail.image" :previewSrcList="[treeDetail.image]" style="width: 60px;height: 60px;">
+                      <template #error>
+                        <div class="image-slot">
+                          <ele-Picture style="width: 30px;" />
+                          加载失败
+                        </div>
+                      </template>
+                    </el-image>
+                  </el-descriptions-item>
+                  <el-descriptions-item label="地址">{{ treeDetail.address }}</el-descriptions-item>
+                  <el-descriptions-item label="所属公司">{{ treeDetail.company }}</el-descriptions-item>
+                  <el-descriptions-item label="设备所属区域">{{ treeDetail.area }}</el-descriptions-item>
+                </el-descriptions>
+                <!-- <table>
+                  <tbody>
+                    <tr class="ant-descriptions-row">
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">名称</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.name }}</td>
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">地址</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.address }}</td>
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">经度</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.lng }}</td>
+                    </tr>
+                    <tr class="ant-descriptions-row">
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">纬度</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.lat }}</td>
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">联系人</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.contact }}</td>
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">联系电话</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.phone }}</td>
+                    </tr>
+                    <tr class="ant-descriptions-row">
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">服务周期:开始日期</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.startDate }}</td>
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">服务周期:截止日期</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.endDate }}</td>
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">图片</th>
+                      <td class="ant-descriptions-item-content" colspan="1">
+                        <el-image :src="treeDetail.image" v-if="treeDetail.image" />
+                      </td>
+                    </tr>
+                    <tr class="ant-descriptions-row">
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">设备标识</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.deviceKey }}</td>
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">设备所属区域</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.area }}</td>
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">所属公司</th>
+                      <td class="ant-descriptions-item-content" colspan="1">{{ treeDetail.company }}</td>
+                    </tr>
+                    <tr class="ant-descriptions-row">
+                      <th class="ant-descriptions-item-label ant-descriptions-item-colon">类型</th>
+                      <td class="ant-descriptions-item-content" colspan="5">{{ treeDetail.types }}</td>
+                    </tr>
+                  </tbody>
+                </table> -->
+              </el-tab-pane>
+              <el-tab-pane label="时间周期" name="2">
                 <el-form-item label="开始日期" prop="startDate">
                   <el-date-picker v-model="ruleForm.startDate" type="date" placeholder="选择开始日期" class="w-35" :size="'default'" />
                 </el-form-item>
@@ -118,22 +140,22 @@
                 <el-form-item label=" " prop="category">
                   <el-button type="primary" v-auth="'save'" @click="onSaveTime">保存</el-button>
                 </el-form-item>
-              </el-form>
-            </el-tab-pane>
-            <el-tab-pane label="绑定实际设备" name="3">
-              <el-form-item label="选择设备" prop="deviceKey">
-                <el-select v-model="ruleForm.deviceKey" filterable placeholder="请选择设备">
-                  <el-option v-for="item in deviceList" :key="item.key" :label="item.name" :value="item.key">
-                    <span style="float: left">{{ item.name }}</span>
-                    <!-- <span style="float: right; font-size: 13px">{{ item.key }}</span> -->
-                  </el-option>
-                </el-select>
-              </el-form-item>
-              <el-form-item label=" " prop="category">
-                <el-button type="primary" v-auth="'save'" @click="onSaveTime">保存</el-button>
-              </el-form-item>
-            </el-tab-pane>
-          </el-tabs>
+              </el-tab-pane>
+              <el-tab-pane label="绑定实际设备" name="3">
+                <el-form-item label="选择设备" prop="deviceKey">
+                  <el-select v-model="ruleForm.deviceKey" filterable placeholder="请选择设备">
+                    <el-option v-for="item in deviceList" :key="item.key" :label="item.name" :value="item.key">
+                      <span style="float: left">{{ item.name }}</span>
+                      <!-- <span style="float: right; font-size: 13px">{{ item.key }}</span> -->
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+                <el-form-item label=" " prop="category">
+                  <el-button type="primary" v-auth="'save'" @click="onSaveTime">保存</el-button>
+                </el-form-item>
+              </el-tab-pane>
+            </el-tabs>
+          </el-form>
         </el-card>
       </el-col>
     </el-row>
@@ -281,9 +303,9 @@ export default defineComponent({
       getTreeDetail(state.currentTree)
     }
     const onTabClick = () => {
-      ruleForm.value.startDate = ''
-      ruleForm.value.endDate = ''
-      ruleForm.value.deviceKey = ''
+      // ruleForm.value.startDate = ''
+      // ruleForm.value.endDate = ''
+      // ruleForm.value.deviceKey = ''
     }
     const onSaveTime = () => {
       if (!state.treeDetail.id) {

+ 7 - 9
src/views/iot/device/instance/component/edit.vue

@@ -193,6 +193,13 @@ export default defineComponent({
     const openDialog = (row: RuleFormState | null) => {
       resetForm();
 
+      apiSystem.getInfoByKey('sys.device.phone.limit').then((res: any) => {
+        state.deviceImgLimit = parseInt(res.data.configValue);
+      });
+      apiSystem.getInfoByKey('sys.device.certificate.limit').then((res: any) => {
+        state.certificateLimit = parseInt(res.data.configValue);
+      });
+
       // 证书列表
       certApi.certificateManagement.getAll().then((res: any) => {
         certList.value = res.Info || []
@@ -305,15 +312,6 @@ export default defineComponent({
       state.ruleForm.address = data.address;
     }
 
-    onMounted(() => {
-      apiSystem.getInfoByKey('sys.device.phone.limit').then((res: any) => {
-        state.deviceImgLimit = parseInt(res.data.configValue);
-      });
-      apiSystem.getInfoByKey('sys.device.certificate.limit').then((res: any) => {
-        state.certificateLimit = parseInt(res.data.configValue);
-      });
-    })
-
     return {
       certList,
       productIdChange,

+ 1 - 1
src/views/iot/network/server/component/list.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-table v-loading="loading" :data="data" style="width: 100%">
+    <el-table v-loading="loading" :data="data" style="width: 100%" max-height="calc(100vh - 255px)">
       <el-table-column align="center" prop="id" label="ID" width="100" v-col="'id'" />
       <!-- <el-table-column align="center" prop="server" label="服务器"/> -->
       <el-table-column align="center" prop="name" label="名称" v-col="'name'" />

+ 29 - 29
src/views/iot/network/server/index.vue

@@ -1,30 +1,30 @@
 <template>
-    <el-card shadow="nover">
-        <el-form :inline="true" label-width="82px" @keyup.enter="searchData">
-            <el-form-item label="服务器名称">
-                <el-input size="default" style="width: 200px;margin-left: 20px;" class="search-input" v-model="key" placeholder="请输入搜索关键字" clearable>
-            </el-input>
-            </el-form-item>
-            <el-form-item>
-                <el-button size="default" type="primary" class="ml10" v-auth="'query'" @click="searchData">
-                    <el-icon>
-                        <ele-Search />
-                    </el-icon>
-                    查询
-                </el-button>
-                <el-button @click="toPage" size="default" type="primary" v-auth="'add'" class="ml10">
-                    <el-icon>
-                        <ele-FolderAdd />
-                    </el-icon>
-                    新建
-                </el-button>
-            </el-form-item>
-        </el-form>
-        <!-- 页面主要内容 -->
-        <tempalte>
-            <list-server ref="listRef" :keyWord="keyWord" />
-        </tempalte>
-    </el-card>
+  <el-card shadow="nover" class="page-full">
+    <el-form :inline="true" label-width="82px" @keyup.enter="searchData">
+      <el-form-item label="服务器名称">
+        <el-input size="default" style="width: 200px;margin-left: 20px;" class="search-input" v-model="key" placeholder="请输入搜索关键字" clearable>
+        </el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button size="default" type="primary" class="ml10" v-auth="'query'" @click="searchData">
+          <el-icon>
+            <ele-Search />
+          </el-icon>
+          查询
+        </el-button>
+        <el-button @click="toPage" size="default" type="primary" v-auth="'add'" class="ml10">
+          <el-icon>
+            <ele-FolderAdd />
+          </el-icon>
+          新建
+        </el-button>
+      </el-form-item>
+    </el-form>
+    <!-- 页面主要内容 -->
+    <tempalte>
+      <list-server ref="listRef" :keyWord="keyWord" />
+    </tempalte>
+  </el-card>
 </template>
 
 <script lang="ts" setup>
@@ -43,11 +43,11 @@ const router = useRouter();
 
 // 按照通道名称进行搜索
 const searchData = () => {
-    keyWord.value = key.value
-    listRef.value && listRef.value.fetchList()
+  keyWord.value = key.value
+  listRef.value && listRef.value.fetchList()
 };
 
 const toPage = () => {
-    router.push('/iotmanager/network/server/create')
+  router.push('/iotmanager/network/server/create')
 };
 </script>

+ 151 - 151
src/views/iot/network/tunnel/component/list.vue

@@ -1,42 +1,42 @@
 <template>
-    <div>
-        <el-table v-loading="loading" :data="data" style="width: 100%">
-            <el-table-column align="center" prop="id" v-col="'id'" label="ID" width="100" />
-            <el-table-column align="center" prop="name" v-col="'name'" label="名称" />
-            <el-table-column align="center" prop="types" v-col="'type'" label="类型" :formatter="(a: any) => typesFormat(a.types)" />
-            <el-table-column align="center" prop="addr" v-col="'address'" min-width="120" label="地址" />
-            <el-table-column show-overflow-tooltip align="center" v-col="'createTime'" prop="createdAt" label="创建时间" width="170" />
-            <el-table-column align="center" prop="types" v-col="'status'" label="状态">
-                <template #default="scope">
-                    <el-tag size="medium" v-if="!scope.row.status" class="ml-2" type="info">未启动</el-tag>
-                    <el-tag size="medium" v-else class="ml-2" type="success">启动</el-tag>
-                </template>
-            </el-table-column>
-            <el-table-column align="center" label="操作" v-col="'auth'" width="160">
-                <template #default="scope">
-                    <el-button @click="toDetail(scope.row.id)" size="small" v-auth="'detail'" type="text">详情</el-button>
-                    <el-button size="small" link key="info" type="info" v-auth="'edit'" @click="toEdit(scope.row.id)">编辑</el-button>
-                    <el-popover placement="bottom" :width="160" trigger="click">
-                        <template #reference>
-                            <el-button size="small" type="text" v-auth="'more'" class="more-btn" @click="isShowMore = !isShowMore">更多
-                                <i style="margin-left: 2px;" :class="isShowMore ? 'fa fa-angle-down' : 'fa fa-angle-up'"></i>
-                            </el-button>
-                        </template>
-                        <div class="more-opearte-wrap">
-                            <el-button @click="onChangeStatus(scope.row.id, 1)" :disabled="scope.row.status" v-auth="'on'" link size="small" key="success" type="success">启 用</el-button>
-                            <el-divider direction="vertical" />
-                            <el-button @click="onChangeStatus(scope.row.id, 0)" :disabled="!scope.row.status" v-auth="'off'" link size="small" key="warning" type="warning">禁 用</el-button>
-                            <el-divider direction="vertical" />
-                            <el-button @click="onRowDel(scope.row)" link size="small" key="danger" v-auth="'off'" type="danger">删 除</el-button>
-                        </div>
-                    </el-popover>
-                </template>
-            </el-table-column>
-        </el-table>
-        <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15" :pager-count="5" :page-sizes="[10, 20, 30, 50, 100, 200, 300, 500]" v-model:current-page="param.page" background v-model:page-size="param.pageSize"
-            layout="total, sizes, prev, pager, next, jumper" :total="total">
-        </el-pagination>
-    </div>
+  <div>
+    <el-table v-loading="loading" :data="data" style="width: 100%" max-height="calc(100vh - 255px)">
+      <el-table-column align="center" prop="id" v-col="'id'" label="ID" width="100" />
+      <el-table-column align="center" prop="name" v-col="'name'" label="名称" />
+      <el-table-column align="center" prop="types" v-col="'type'" label="类型" :formatter="(a: any) => typesFormat(a.types)" />
+      <el-table-column align="center" prop="addr" v-col="'address'" min-width="120" label="地址" />
+      <el-table-column show-overflow-tooltip align="center" v-col="'createTime'" prop="createdAt" label="创建时间" width="170" />
+      <el-table-column align="center" prop="types" v-col="'status'" label="状态">
+        <template #default="scope">
+          <el-tag size="medium" v-if="!scope.row.status" class="ml-2" type="info">未启动</el-tag>
+          <el-tag size="medium" v-else class="ml-2" type="success">启动</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column align="center" label="操作" v-col="'auth'" width="160">
+        <template #default="scope">
+          <el-button @click="toDetail(scope.row.id)" size="small" v-auth="'detail'" type="text">详情</el-button>
+          <el-button size="small" link key="info" type="info" v-auth="'edit'" @click="toEdit(scope.row.id)">编辑</el-button>
+          <el-popover placement="bottom" :width="160" trigger="click">
+            <template #reference>
+              <el-button size="small" type="text" v-auth="'more'" class="more-btn" @click="isShowMore = !isShowMore">更多
+                <i style="margin-left: 2px;" :class="isShowMore ? 'fa fa-angle-down' : 'fa fa-angle-up'"></i>
+              </el-button>
+            </template>
+            <div class="more-opearte-wrap">
+              <el-button @click="onChangeStatus(scope.row.id, 1)" :disabled="scope.row.status" v-auth="'on'" link size="small" key="success" type="success">启 用</el-button>
+              <el-divider direction="vertical" />
+              <el-button @click="onChangeStatus(scope.row.id, 0)" :disabled="!scope.row.status" v-auth="'off'" link size="small" key="warning" type="warning">禁 用</el-button>
+              <el-divider direction="vertical" />
+              <el-button @click="onRowDel(scope.row)" link size="small" key="danger" v-auth="'off'" type="danger">删 除</el-button>
+            </div>
+          </el-popover>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15" :pager-count="5" :page-sizes="[10, 20, 30, 50, 100, 200, 300, 500]" v-model:current-page="param.page" background v-model:page-size="param.pageSize"
+      layout="total, sizes, prev, pager, next, jumper" :total="total">
+    </el-pagination>
+  </div>
 </template>
 
 <script lang="ts">
@@ -48,138 +48,138 @@ import api from '/@/api/network';
 
 // 定义接口来定义对象的类型
 interface TableDataForm {
-    id: number;
-    server: string;
-    name: string;
+  id: number;
+  server: string;
+  name: string;
 
 }
 interface TableData {
-    data: Array<TableDataForm>;
-    total: number;
-    loading: boolean;
-    param: {
-        page: number;
-        pageSize: number;
-    };
-    isShowMore: boolean
+  data: Array<TableDataForm>;
+  total: number;
+  loading: boolean;
+  param: {
+    page: number;
+    pageSize: number;
+  };
+  isShowMore: boolean
 }
 
 export default defineComponent({
-    name: 'tunnel',
-    props: {
-        // 输入框前置内容
-        keyWord: {
-            type: String,
-            default: '',
-        },
+  name: 'tunnel',
+  props: {
+    // 输入框前置内容
+    keyWord: {
+      type: String,
+      default: '',
     },
-    setup(props, { emit }) {
+  },
+  setup(props, { emit }) {
 
-        const { proxy } = getCurrentInstance() as any;
+    const { proxy } = getCurrentInstance() as any;
 
-        const { network_tunnel_type } = proxy.useDict('network_tunnel_type');
+    const { network_tunnel_type } = proxy.useDict('network_tunnel_type');
 
-        const typesFormat = (types: string) => {
-            return proxy.selectDictLabel(unref(network_tunnel_type), types);
-        };
+    const typesFormat = (types: string) => {
+      return proxy.selectDictLabel(unref(network_tunnel_type), types);
+    };
 
-        const router = useRouter();
-        const state = reactive<TableData>({
-            data: [],
-            total: 0,
-            loading: false,
-            param: {
-                page: 1,
-                pageSize: 10,
-            },
-            isShowMore: true
-        });
-        // 改变状态
-        const onChangeStatus = (id: number, status: number) => {
-            api.tunnel.changeTunnelStatus({ id: id, status: status }).then((res: any) => {
-                ElMessage.success(status ? '已开启' : '已关闭');
-                fetchList();
-            })
-        };
-        // 分页改变
-        const onHandleSizeChange = (val: number) => {
-            state.param.pageSize = val;
-            fetchList()
-        };
-        // 分页改变
-        const onHandleCurrentChange = (val: number) => {
-            state.param.page = val;
-            fetchList()
-        };
-        // 初始化表格数据
-        const initTableData = () => {
-            fetchList()
-        };
-        // 获取数据
-        const fetchList = () => {
-            state.loading = true
-            let params = {
-                keyWord: props.keyWord,
-                pageNum: state.param.page,
-                PageSize: state.param.pageSize
-            }
-            api.tunnel.getList(params).then((res: any) => {
-                const { list, total, page } = res
-                state.data = list
-                state.total = total
-                state.param.page = page
-                state.loading = false
-            });
+    const router = useRouter();
+    const state = reactive<TableData>({
+      data: [],
+      total: 0,
+      loading: false,
+      param: {
+        page: 1,
+        pageSize: 10,
+      },
+      isShowMore: true
+    });
+    // 改变状态
+    const onChangeStatus = (id: number, status: number) => {
+      api.tunnel.changeTunnelStatus({ id: id, status: status }).then((res: any) => {
+        ElMessage.success(status ? '已开启' : '已关闭');
+        fetchList();
+      })
+    };
+    // 分页改变
+    const onHandleSizeChange = (val: number) => {
+      state.param.pageSize = val;
+      fetchList()
+    };
+    // 分页改变
+    const onHandleCurrentChange = (val: number) => {
+      state.param.page = val;
+      fetchList()
+    };
+    // 初始化表格数据
+    const initTableData = () => {
+      fetchList()
+    };
+    // 获取数据
+    const fetchList = () => {
+      state.loading = true
+      let params = {
+        keyWord: props.keyWord,
+        pageNum: state.param.page,
+        PageSize: state.param.pageSize
+      }
+      api.tunnel.getList(params).then((res: any) => {
+        const { list, total, page } = res
+        state.data = list
+        state.total = total
+        state.param.page = page
+        state.loading = false
+      });
 
 
-        };
-        // 删除
-        const onRowDel = (row: TableDataForm) => {
-            ElMessageBox.confirm(`此操作将永久删除“${row.name}”,是否继续?`, '提示', {
-                confirmButtonText: '确认',
-                cancelButtonText: '取消',
-                type: 'warning',
-            })
-                .then(() => {
-                    api.tunnel.deleteItem({ ids: [row.id] }).then((res: any) => {
-                        fetchList()
-                        ElMessage.success('删除成功');
-                    });
-                })
-                .catch(() => { });
-        };
-        const toDetail = (id: number) => {
-            router.push(`/iotmanager/network/tunnel/detail/${id}`)
-        };
-        const toEdit = (id: number) => {
-            router.push(`/iotmanager/network/tunnel/edit/${id}`)
-        };
-        // 页面加载时
-        onMounted(() => {
-            initTableData();
-        });
-        return {
-            fetchList,
-            toDetail,
-            toEdit,
-            onChangeStatus,
-            onRowDel,
-            onHandleSizeChange,
-            onHandleCurrentChange,
-            typesFormat,
-            ...toRefs(state),
-        };
-    }
+    };
+    // 删除
+    const onRowDel = (row: TableDataForm) => {
+      ElMessageBox.confirm(`此操作将永久删除“${row.name}”,是否继续?`, '提示', {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(() => {
+          api.tunnel.deleteItem({ ids: [row.id] }).then((res: any) => {
+            fetchList()
+            ElMessage.success('删除成功');
+          });
+        })
+        .catch(() => { });
+    };
+    const toDetail = (id: number) => {
+      router.push(`/iotmanager/network/tunnel/detail/${id}`)
+    };
+    const toEdit = (id: number) => {
+      router.push(`/iotmanager/network/tunnel/edit/${id}`)
+    };
+    // 页面加载时
+    onMounted(() => {
+      initTableData();
+    });
+    return {
+      fetchList,
+      toDetail,
+      toEdit,
+      onChangeStatus,
+      onRowDel,
+      onHandleSizeChange,
+      onHandleCurrentChange,
+      typesFormat,
+      ...toRefs(state),
+    };
+  }
 });
 </script>
 
 <style lang="scss" scoped>
 ::v-deep div.more-opearte-wrap {
-    flex-direction: row;
-    background-color: pink;
+  flex-direction: row;
+  background-color: pink;
 
-    // padding: 4px!important;
-    div {}
+  // padding: 4px!important;
+  div {}
 
 }
 </style>

+ 29 - 29
src/views/iot/network/tunnel/index.vue

@@ -1,30 +1,30 @@
 <template>
-    <el-card shadow="nover">
-        <el-form :inline="true" label-width="68px">
-            <el-form-item label="通道名称" @keyup.enter.native="searchData()">
-                <el-input size="default" style="width: 200px;margin-left: 20px;" class="search-input" v-model="key" placeholder="请输入搜索关键字" clearable>
-                </el-input>
-            </el-form-item>
-            <el-form-item>
-                <el-button size="default" v-auth="'query'" type="primary" class="ml10" @click="searchData">
-                    <el-icon>
-                        <ele-Search />
-                    </el-icon>
-                    查询
-                </el-button>
-                <el-button @click="toPage" v-auth="'add'" size="default" type="primary" class="ml10">
-                    <el-icon>
-                        <ele-FolderAdd />
-                    </el-icon>
-                    新建
-                </el-button>
-            </el-form-item>
-        </el-form>
-        <!-- 页面主要内容 -->
-        <tempalte>
-            <list-tunnel ref="listRef" :keyWord="keyWord" />
-        </tempalte>
-    </el-card>
+  <el-card shadow="nover" class="page-full">
+    <el-form :inline="true" label-width="68px">
+      <el-form-item label="通道名称" @keyup.enter.native="searchData()">
+        <el-input size="default" style="width: 200px;margin-left: 20px;" class="search-input" v-model="key" placeholder="请输入搜索关键字" clearable>
+        </el-input>
+      </el-form-item>
+      <el-form-item>
+        <el-button size="default" v-auth="'query'" type="primary" class="ml10" @click="searchData">
+          <el-icon>
+            <ele-Search />
+          </el-icon>
+          查询
+        </el-button>
+        <el-button @click="toPage" v-auth="'add'" size="default" type="primary" class="ml10">
+          <el-icon>
+            <ele-FolderAdd />
+          </el-icon>
+          新建
+        </el-button>
+      </el-form-item>
+    </el-form>
+    <!-- 页面主要内容 -->
+    <tempalte>
+      <list-tunnel ref="listRef" :keyWord="keyWord" />
+    </tempalte>
+  </el-card>
 </template>
 
 <script lang="ts" setup>
@@ -43,11 +43,11 @@ const router = useRouter();
 
 // 按照通道名称进行搜索
 const searchData = () => {
-    keyWord.value = key.value
-    listRef.value && listRef.value.fetchList()
+  keyWord.value = key.value
+  listRef.value && listRef.value.fetchList()
 };
 // 去往新增页面
 const toPage = () => {
-    router.push('/iotmanager/network/tunnel/create')
+  router.push('/iotmanager/network/tunnel/create')
 };
 </script>