Browse Source

增加组态图列表页面

yanglzh 3 years ago
parent
commit
08909bdd3b
4 changed files with 64 additions and 1 deletions
  1. 1 0
      .env.development
  2. 2 1
      .env.production
  3. 8 0
      src/api/configuration/index.ts
  4. 53 0
      src/views/configuration/list.vue

+ 1 - 0
.env.development

@@ -6,5 +6,6 @@ VITE_API_URL = 'http://zhgy.sagoo.cn:8899/api/v1'
 VITE_IMG_URL = 'http://zhgy.sagoo.cn:8899/'
 VITE_ASSESS_URL = 'http://zhgy.sagoo.cn/base-api/assess/v1'
 VITE_SCREEN_URL = 'http://home.yanglizhi.cn:10003'
+VITE_TOPO_URL = 'http://home.yanglizhi.cn:10001'
 # VITE_API_URL = 'http://sgadserver.wdeveloperw.xyz/api/v1'
 # VITE_IMG_URL = 'http://sgadserver.wdeveloperw.xyz/'

+ 2 - 1
.env.production

@@ -8,4 +8,5 @@ VITE_PUBLIC_PATH = /
 VITE_API_URL = 'http://zhgy.sagoo.cn:8899/api/v1'
 VITE_IMG_URL = 'http://zhgy.sagoo.cn:8899/'
 VITE_ASSESS_URL = 'http://zhgy.sagoo.cn/base-api/assess/v1'
-VITE_SCREEN_URL = 'http://home.yanglizhi.cn:10003'
+VITE_SCREEN_URL = 'http://home.yanglizhi.cn:10003'
+VITE_TOPO_URL = 'http://home.yanglizhi.cn:10001'

+ 8 - 0
src/api/configuration/index.ts

@@ -0,0 +1,8 @@
+import { get, del, post } from '/@/utils/request';
+
+export default {
+  getFolder: () => get('/configure/folder/list'),
+  getList: (folderId: number) => get('/configure/diagram/getInfoByFolderId', { folderId }),
+  del: (ids: string[]) => del('/screen/project/delProjectById', { ids }),
+  add: (data: any) => post('/screen/project/add', data),
+}

+ 53 - 0
src/views/configuration/list.vue

@@ -0,0 +1,53 @@
+<template>
+	<div class="page">
+		<el-card shadow="hover">
+			<el-table :data="tableData" style="width: 100%" row-key="id" lazy :load="load" :tree-props="{ children: 'children', hasChildren: 'types' }">
+				<!-- <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="folderName" label="文件夹名称" show-overflow-tooltip></el-table-column>
+				<el-table-column prop="name" label="组态图名称" show-overflow-tooltip></el-table-column>
+				<el-table-column prop="createdAt" label="创建时间" min-width="100" align="center"></el-table-column>
+				<el-table-column prop="updatedAt" label="更新时间" min-width="100" align="center"></el-table-column>
+				<el-table-column label="操作" width="100" align="center">
+					<template #default="scope">
+						<el-button size="small" text type="primary" v-if="!scope.row.folderName" @click="view(scope.row)">预览</el-button>
+						<!-- <el-button size="small" text type="warning" @click="edit(scope.row)">编辑</el-button>
+						<el-button size="small" text type="danger" @click="onDel(scope.row)">删除</el-button> -->
+					</template>
+				</el-table-column>
+			</el-table>
+		</el-card>
+	</div>
+</template>
+
+<script lang="ts" setup>
+import { ref } from 'vue';
+import api from '/@/api/configuration';
+
+const tableData = ref<any[]>([]);
+
+api.getFolder().then((res: any) => {
+	tableData.value = (res.topology || []).map((item: any) => {
+		return {
+			...item,
+			name: '',
+			folderName: item.name,
+		};
+	});
+});
+
+const load = (row: any, treeNode: unknown, resolve: any) => {
+	api
+		.getList(row.id)
+		.then((res: any) => {
+			resolve(res.data || []);
+		})
+		.catch(() => {
+			resolve([]);
+		});
+};
+
+const view = (row: any) => {
+	window.open(import.meta.env.VITE_TOPO_URL + '#/show/' + row.id);
+};
+</script>