Selaa lähdekoodia

增加预览按钮

yanglzh 3 vuotta sitten
vanhempi
sitoutus
5d57d84c9b
2 muutettua tiedostoa jossa 13 lisäystä ja 3 poistoa
  1. 3 1
      src/views/configuration/list.vue
  2. 10 2
      src/views/screen/index.vue

+ 3 - 1
src/views/configuration/list.vue

@@ -23,6 +23,7 @@
 <script lang="ts" setup>
 import { ref } from 'vue';
 import api from '/@/api/configuration';
+import { Session } from '/@/utils/storage';
 
 const tableData = ref<any[]>([]);
 
@@ -48,6 +49,7 @@ const load = (row: any, treeNode: unknown, resolve: any) => {
 };
 
 const view = (row: any) => {
-	window.open(import.meta.env.VITE_TOPO_URL + '#/show/' + row.id);
+	const url = import.meta.env.VITE_TOPO_URL + '/?token=' + encodeURIComponent(Session.get('token')) + '#/show/' + row.id;
+	window.open(url);
 };
 </script>

+ 10 - 2
src/views/screen/index.vue

@@ -25,8 +25,9 @@
 				<el-table-column prop="projectName" 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">
+				<el-table-column label="操作" width="150" align="center">
 					<template #default="scope">
+						<el-button size="small" text type="primary" @click="preview(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>
@@ -41,6 +42,7 @@
 import api from '/@/api/screen';
 import { ElMessageBox, ElMessage } from 'element-plus';
 import { useSearch } from '/@/hooks/useCommon';
+import { Session } from '/@/utils/storage';
 
 const { params, tableData, getList } = useSearch<any[]>(api.getList, 'Data', { name: '', address: '' });
 
@@ -70,7 +72,13 @@ const add = async () => {
 };
 
 const edit = async (row: any) => {
-	window.open(import.meta.env.VITE_SCREEN_URL + '#/chart/home/' + row.id);
+	const url = import.meta.env.VITE_SCREEN_URL + '/?token=' + encodeURIComponent(Session.get('token')) + '#/chart/home/' + row.id;
+	window.open(url);
+};
+
+const preview = async (row: any) => {
+	const url = import.meta.env.VITE_SCREEN_URL + '/?token=' + encodeURIComponent(Session.get('token')) + '#/chart/preview/' + row.id;
+	window.open(url);
 };
 
 const onDel = (row: any) => {