Prechádzať zdrojové kódy

首页修改及电桩列表

zuy 2 rokov pred
rodič
commit
8f0362faf4

+ 1 - 1
admin-web/src/layout/navMenu/subItem.vue

@@ -7,7 +7,7 @@
 			</template>
 			<sub-item :chil="val.children" />
 		</el-sub-menu>
-		<template v-else>
+		<template v-else-if="!val.isHide">
 			<el-menu-item :index="val.path" :key="val.path">
 				<template v-if="!val.meta.isLink || (val.meta.isLink && val.meta.isIframe)">
 					<SvgIcon :name="val.meta.icon" />

+ 17 - 17
admin-web/src/router/route.ts

@@ -134,14 +134,14 @@ export const adminRoutes: Array<RouteRecordRaw> = [
                             icon: 'ele-OfficeBuilding',
                         },
                     },
-                /*    {
-                        path: '/station/endpoint',
+                  {
+                        path: '/station/endpoint/:id',
                         name: 'adminStationEndpoint',
                         component: () => import('/@/views/admin/station/endpoint/index.vue'),
                         meta: {
                             title: '电桩监控',
                             isLink: '',
-                            isHide: false,
+                            isHide: true,
                             isKeepAlive: true,
                             isAffix: false,
                             isIframe: false,
@@ -149,21 +149,21 @@ export const adminRoutes: Array<RouteRecordRaw> = [
                             icon: 'ele-User',
                         },
                     },
-                    {
-                        path: '/station/stat',
-                        name: 'adminStationStat',
-                        component: () => import('/@/views/admin/station/stat/index.vue'),
-                        meta: {
-                            title: '营收概览',
-                            isLink: '',
-                            isHide: false,
-                            isKeepAlive: true,
-                            isAffix: false,
-                            isIframe: false,
+                    /*         {
+                               path: '/station/stat',
+                               name: 'adminStationStat',
+                               component: () => import('/@/views/admin/station/stat/index.vue'),
+                               meta: {
+                                   title: '营收概览',
+                                   isLink: '',
+                                   isHide: false,
+                                   isKeepAlive: true,
+                                   isAffix: false,
+                                   isIframe: false,
 
-                            icon: 'ele-Compass',
-                        },
-                    },*/
+                                   icon: 'ele-Compass',
+                               },
+                           },*/
                 ]
             },
          /*   {

+ 245 - 6
admin-web/src/views/admin/station/endpoint/index.vue

@@ -1,13 +1,252 @@
+<style scoped lang="scss">
+.system-container {
+
+  :deep(.el-card__body) {
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+    flex: 1;
+    overflow: auto;
+
+    .el-table {
+      flex: 1;
+    }
+
+  }
+}
+
+.page-content {
+  margin-bottom: 20px;
+}
+
+.page-pager {
+  background-color: #fff;
+  height: 24px;
+}
+</style>
 <template>
+  <div class="system-container layout-padding">
+    <el-card shadow="hover" class="layout-padding-auto">
+
+
+      <el-form
+          :model="state.formQuery"
+          ref="queryRef"
+          size="default" label-width="0px" class="mt5 mb5">
 
+        <ext-d-select
+            type="Equipment.netStatus"
+            v-model="state.formQuery.status"
+            placeholder="网络状态"
+            clearable
+            @change="loadData(true)"
+            class="wd150 mr10"/>
+<!--        <el-input
+            v-model="state.formQuery.stationId"
+            placeholder="站点id"
+            clearable
+            @blur="loadData(true)"
+            class="wd150 mr10">
+        </el-input>-->
+
+
+        <el-button class="ml10" plain size="default" type="success" @click="loadData(true)">
+          <SvgIcon name="ele-Search"/>
+          查询
+        </el-button>
+      </el-form>
+
+      <el-table
+          border
+          stripe="stripe"
+          :height="state.tableData.height"
+          highlight-current-row
+          current-row-key="id"
+          row-key="id"
+          :data="state.tableData.data"
+          v-loading="state.tableData.loading"
+          @selection-change="handleTableSelectionChange"
+          @sort-change="handleTableSortChange">
+        <template #empty>
+          <el-empty></el-empty>
+        </template>
+        <el-table-column
+            v-for="field in state.tableData.columns"
+            :key="field.prop"
+            :label="field.label"
+            :column-key="field.prop"
+            :width="field.width"
+            :min-width="field.minWidth"
+            :fixed="field.fixed"
+            :sortable="field.sortable"
+            :show-overflow-tooltip="!field.fixed&&field.width>150"
+        >
+          <template #default="{row}">
+            <template v-if="field.prop==='expand'">
+              <p style="padding-left: 2em;" v-html="row[field.prop]"></p>
+            </template>
+            <template v-else-if="'equipmentType'===field.prop">
+              <ext-d-label type="Equipment.type" v-model="row[field.prop]"/>
+            </template>
+            <template v-else-if="'serviceStatus'===field.prop">
+              <ext-d-label type="Equipment.serviceStatus" v-model="row[field.prop]"/>
+            </template>
+            <template v-else-if="'netStatus'===field.prop">
+              <ext-d-label type="Equipment.netStatus" v-model="row[field.prop]"/>
+            </template>
+            <template v-else>
+              <div>{{ row[field.prop] }}</div>
+            </template>
+
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <ext-page class="page-pager" v-model:value="state.pageQuery" @change="loadData(false)"/>
+    </el-card>
+  </div>
+  <EquipmentInfoDialog ref="equipmentInfoDialogRef" @refresh="loadData(true)"/>
 </template>
 
-<script>
-export default {
-  name: "index"
+<script setup lang="ts" name="EquipmentInfoList">
+import {defineAsyncComponent, reactive, onMounted, onBeforeMount, ref, getCurrentInstance, nextTick, onBeforeUnmount} from 'vue';
+import {$body, $get} from "/@/utils/request";
+import {Msg} from "/@/utils/message";
+
+import {useRoute} from "vue-router";
+
+const route = useRoute();
+import ExtPage from '/@/components/form/ExtPage.vue'
+
+import mittBus from '/@/utils/mitt';
+import ExtDLabel from "/@/components/form/ExtDLabel.vue";
+import ExtDSelect from "/@/components/form/ExtDSelect.vue";
+
+const EquipmentInfoDialog = defineAsyncComponent(() => import("/@/views/page/EquipmentInfoDialog.vue"));
+
+//定义引用
+const queryRef = ref();
+const equipmentInfoDialogRef = ref();
+
+//定义变量
+const state = reactive({
+  formQuery: {
+    stationId: 0
+  },
+  pageQuery: {
+    pageNum: 1,
+    pageSize: 10,
+    total: 0
+  },
+  tableData: {
+    height: 500,
+    data: [] as Array<any>,
+    loading: false,
+    columns: [
+      {label: '站点ID', prop: 'stationId', resizable: true,width: 100,fixed:'left'},
+      {label: '充电桩序列号', prop: 'equipmentId', width: 180, resizable: true},
+      {label: '设备型号', prop: 'equipmentModel', width: 150, resizable: true},
+      {label: '服务状态', prop: 'serviceStatus', resizable: true, width: 130},
+      {label: '设备类型', prop: 'equipmentType', resizable: true, width: 130},
+      // {label: '位置坐标', prop: 'location', resizable: true, width: 150},
+      {label: '网络状态', prop: 'netStatus', resizable: true, width: 130},
+      {label: '设备生产商组织机构代码', prop: 'manufacturerId', width: 200, resizable: true},
+      {label: '设备生产商名称', prop: 'manufacturerName', width: 160, resizable: true},
+      {label: '设备生产日期', prop: 'productionDate', width: 160, resizable: true},
+      {label: '更新时间', prop: 'updateTime', sortable: 'custom', resizable: true, width: 180},
+      /*{
+        label: '操作', prop: 'action', width: 180, align: 'center', fixed: 'right',
+      }*/
+    ],
+  },
+})
+
+
+// 监听双向绑定 modelValue 的变化
+// watch(
+//         () => state.pageIndex,
+//         () => {
+//
+//         }
+// );
+
+//生命周期钩子
+onBeforeMount(() => {
+})
+
+onMounted(() => {
+  var params = route.params;
+  console.log(route.params, route.query)
+  let {id} = route.params;
+  state.formQuery.stationId = id;
+  loadData();
+
+  nextTick(() => {
+    let bodyHeight = document.body.clientHeight;
+    let queryHeight = queryRef.value.$el.clientHeight;
+    state.tableData.height = bodyHeight - queryHeight - 220
+  })
+
+  mittBus.on("equipmentInfo.refresh", () => {
+    loadData();
+  })
+});
+
+onBeforeUnmount(() => {
+  mittBus.off("equipmentInfo.refresh")
+})
+
+
+//region 方法区
+// 初始化表格数据
+const loadData = (refresh: boolean = false) => {
+  if (refresh) {
+    state.pageQuery.pageNum = 1;
+  }
+  state.tableData.loading = true;
+  $get(`/equipment/listEquipment`, {...state.formQuery, ...state.pageQuery}).then((res: any) => {
+    let {list, total} = res;
+    state.tableData.data = list;
+    state.pageQuery.total = total;
+    state.tableData.loading = false;
+  }).catch(e => {
+    console.error(e)
+    state.tableData.loading = false;
+  })
+};
+
+// 打开修改用户弹窗
+const onRowClick = (type: string, row: any) => {
+  equipmentInfoDialogRef.value.open(type, row);
+};
+
+// 删除用户
+const onRowDel = (row: any) => {
+  Msg.confirm(`此操作将永久删除:『${row.name}』,是否继续?`).then(() => {
+    $get(`/equipmentInfo/delete/${row.id}`).then(() => {
+      Msg.message("删除成功", 'success')
+    }).catch(() => {
+      Msg.message("删除失败", 'error')
+    })
+  });
+};
+
+const handleTableSelectionChange = (selection: any) => {
+  console.log("handleTableSelectionChange>>", selection)
+  // emit("on-check-change", selection)
 }
-</script>
 
-<style scoped>
+const handleTableSortChange = (column, prop, order) => {
+  console.log("handleTableSortChange>>", column, prop, order)
+  // emit("on-sort-change", column)
+}
+
+
+//endregion
+
 
-</style>
+// 暴露变量
+// defineExpose({
+//     loadData,
+// });
+</script>

+ 16 - 2
admin-web/src/views/admin/station/list/index.vue

@@ -86,6 +86,9 @@
             <template v-else-if="'construction'===field.prop">
               <ext-d-label type="Station.construction" v-model="row[field.prop]"/>
             </template>
+            <template v-else-if="'action'===field.prop">
+             <el-button link type="primary" @click="handleGotoEndpoint(row)">查看电桩</el-button>
+            </template>
             <template v-else>
               <div>{{row[field.prop]}}</div>
             </template>
@@ -105,12 +108,12 @@ import {defineAsyncComponent, reactive, onMounted, onBeforeMount, ref, getCurren
 import {$body,$get} from "/@/utils/request";
 import {Msg} from "/@/utils/message";
 
-
 import ExtPage from '/@/components/form/ExtPage.vue'
 
 import mittBus from '/@/utils/mitt';
 import ExtDLabel from "/@/components/form/ExtDLabel.vue";
-
+import {useRouter} from "vue-router";
+const router = useRouter();
 // const StationDialog = defineAsyncComponent(() => import("/@/views/page/StationDialog.vue"));
 
 //定义引用
@@ -193,7 +196,18 @@ onBeforeUnmount(() => {
 })
 
 
+
+
 //region 方法区
+const handleGotoEndpoint = (row:any)=>{
+  let {stationId} = row;
+  if(!stationId){
+    return;
+  }
+  router.push(`/station/endpoint/${stationId}`)
+}
+
+
 // 初始化表格数据
 const loadData = (refresh: boolean = false) => {
   if (refresh) {

+ 12 - 8
admin-web/src/views/login/index.vue

@@ -1,5 +1,5 @@
 <template>
-	<div class="login-container flex">
+	<div class="login-container flex" style="justify-content: space-between">
 		<div class="login-left">
 			<div class="login-left-logo">
 				<img :src="logoMini" />
@@ -8,9 +8,9 @@
 					<span class="login-left-logo-text-msg">{{ getThemeConfig.globalViceTitleMsg }}</span>
 				</div>
 			</div>
-			<div class="login-left-img">
-				<img :src="loginMain" />
-			</div>
+<!--			<div class="login-left-img">
+				<img :src="loginMain"  style="width: 100%;height: 100%;object-fit: fill"/>
+			</div>-->
 <!--			<img :src="loginBg" class="login-left-waves" />-->
 		</div>
 		<div class="login-right flex">
@@ -50,7 +50,7 @@ import { NextLoading } from '/@/utils/loading';
 import logoMini from '/logo.png';
 import loginMain from '/@/assets/shenzhen.webp';
 import loginBg from '/@/assets/login-bg.svg';
-
+``
 // 引入组件
 const Account = defineAsyncComponent(() => import('/@/views/login/component/account.vue'));
 
@@ -75,13 +75,16 @@ onMounted(() => {
 <style scoped lang="scss">
 .login-container {
 	height: 100%;
-	background: var(--el-color-white);
+  text-align: right;
+	//background: var(--el-color-white);
+  background-image: url("/@/assets/shenzhen.webp");
 	.login-left {
-		flex: 1;
-		position: relative;
+    position: relative;
 		background-color: rgba(211, 239, 255, 1);
 		margin-right: 100px;
+    display: inline-flex;
 		.login-left-logo {
+      width: 350px;
 			display: flex;
 			align-items: center;
 			position: absolute;
@@ -127,6 +130,7 @@ onMounted(() => {
 		}
 	}
 	.login-right {
+    opacity: .9;
 		width: 700px;
 		.login-right-warp {
 			border: 1px solid var(--el-color-primary-light-3);