From cd448f774cfd4837a969d01ebea03530608c6839 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 07 四月 2026 16:55:55 +0800
Subject: [PATCH] #websocket连接管理页面
---
src/main/webapp/views/tvDevice/tvDevice.html | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 152 insertions(+), 10 deletions(-)
diff --git a/src/main/webapp/views/tvDevice/tvDevice.html b/src/main/webapp/views/tvDevice/tvDevice.html
index 9b1ae73..a3db0eb 100644
--- a/src/main/webapp/views/tvDevice/tvDevice.html
+++ b/src/main/webapp/views/tvDevice/tvDevice.html
@@ -157,6 +157,24 @@
</div>
</div>
+ <div style="margin-bottom: 15px;">
+ <el-card shadow="hover">
+ <div slot="header">
+ <span>鎵嬪姩寮傚父淇℃伅</span>
+ </div>
+ <el-form label-position="top" size="small">
+ <el-form-item label="寮傚父淇℃伅">
+ <el-input type="textarea" v-model="manualError" :rows="3"
+ placeholder="杈撳叆闇�瑕佷笅鍙戝埌璁惧鐨勫紓甯镐俊鎭�"></el-input>
+ </el-form-item>
+ <el-button type="primary" size="small" @click="saveManualError"
+ :loading="manualErrorSaving">淇濆瓨</el-button>
+ <el-button size="small" @click="clearManualError"
+ :disabled="manualErrorSaving">娓呯┖</el-button>
+ </el-form>
+ </el-card>
+ </div>
+
<!-- 琛ㄦ牸鍖哄煙 -->
<div class="table-section">
<el-table :data="tableData" border stripe @selection-change="handleSelectionChange" style="width: 100%;"
@@ -181,13 +199,15 @@
</template>
</el-table-column>
<el-table-column prop="remark" label="澶囨敞" min-width="100" show-overflow-tooltip></el-table-column>
- <el-table-column label="鎿嶄綔" width="300" align="center" fixed="right">
+ <el-table-column label="鎿嶄綔" width="350" align="center" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="small" @click="showEditDialog(scope.row)">缂栬緫</el-button>
<el-button type="text" size="small" @click="testConnection(scope.row)"
- :loading="scope.row.testing">娴嬭瘯杩炴帴</el-button>
+ :loading="scope.row.testing">娴嬭瘯</el-button>
<el-button type="text" size="small" style="color: #67c23a;" @click="launchApp(scope.row)"
:loading="scope.row.launching">鍚姩</el-button>
+ <el-button type="text" size="small" style="color: #e6a23c;" @click="restartApp(scope.row)"
+ :loading="scope.row.restarting">閲嶅惎</el-button>
<el-button type="text" size="small" style="color: #409eff;"
@click="captureScreen(scope.row)" :loading="scope.row.capturing">鎴浘</el-button>
<el-button type="text" size="small" style="color: #f56c6c;"
@@ -220,12 +240,9 @@
<el-select v-model="installForm.taskId" placeholder="璇烽�夋嫨宸插畬鎴愮殑鎵撳寘浠诲姟"
style="width: 100%;" filterable>
<el-option v-for="task in completedTasks" :key="task.id"
- :label="task.projectName || task.taskId" :value="task.id"
+ :label="buildTaskLabel(task)" :value="task.id"
:disabled="!task.apkPath">
- <span>{{ task.projectName || task.repoAlias }}</span>
- <span style="float: right; color: #909399; font-size: 12px;">
- {{ task.apkPath ? '宸蹭笅杞�' : '鏈笅杞�' }}
- </span>
+ <span>{{ buildTaskLabel(task) }}</span>
</el-option>
</el-select>
</el-form-item>
@@ -302,7 +319,11 @@
<el-form-item>
<el-button type="success" @click="batchLaunchApp" :loading="launching"
:disabled="launchForm.deviceIds.length === 0">
- <i class="el-icon-video-play"></i> 鎵归噺鍚姩搴旂敤
+ <i class="el-icon-video-play"></i> 鎵归噺鍚姩
+ </el-button>
+ <el-button type="warning" @click="batchRestartApp" :loading="launching"
+ :disabled="launchForm.deviceIds.length === 0">
+ <i class="el-icon-refresh"></i> 鎵归噺閲嶅惎
</el-button>
</el-form-item>
</el-form>
@@ -424,7 +445,10 @@
screenshotImage: '',
screenshotLoading: false,
autoRefreshScreenshot: false,
- screenshotTimer: null
+ screenshotTimer: null,
+
+ manualError: '',
+ manualErrorSaving: false
},
computed: {
@@ -443,12 +467,60 @@
this.loadData();
this.loadAllDevices();
this.loadCompletedTasks();
+ this.loadManualError();
},
methods: {
// 鑾峰彇璇锋眰澶�
getHeaders() {
return { 'token': localStorage.getItem('token') };
+ },
+ loadManualError() {
+ $.ajax({
+ url: baseUrl + '/openapi/manualError/auth',
+ headers: this.getHeaders(),
+ method: 'GET',
+ success: (res) => {
+ if (res.code === 200) {
+ this.manualError = (res.data && res.data.manualError) ? res.data.manualError : '';
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + '/';
+ } else {
+ this.$message.error(res.msg || '鍔犺浇澶辫触');
+ }
+ },
+ error: () => {
+ this.$message.error('璇锋眰澶辫触');
+ }
+ });
+ },
+ saveManualError() {
+ this.manualErrorSaving = true;
+ $.ajax({
+ url: baseUrl + '/openapi/manualError/auth',
+ headers: this.getHeaders(),
+ method: 'POST',
+ contentType: 'application/json;charset=UTF-8',
+ data: JSON.stringify({ manualError: this.manualError }),
+ success: (res) => {
+ this.manualErrorSaving = false;
+ if (res.code === 200) {
+ this.$message.success('淇濆瓨鎴愬姛');
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + '/';
+ } else {
+ this.$message.error(res.msg || '淇濆瓨澶辫触');
+ }
+ },
+ error: () => {
+ this.manualErrorSaving = false;
+ this.$message.error('璇锋眰澶辫触');
+ }
+ });
+ },
+ clearManualError() {
+ this.manualError = '';
+ this.saveManualError();
},
// 鍔犺浇鏁版嵁
@@ -679,6 +751,68 @@
});
},
+ // 鍗曚釜璁惧閲嶅惎搴旂敤
+ restartApp(row) {
+ this.$set(row, 'restarting', true);
+ $.ajax({
+ url: baseUrl + '/tvDevice/restartApp/' + row.id + '/auth',
+ headers: this.getHeaders(),
+ method: 'POST',
+ contentType: 'application/json;charset=UTF-8',
+ data: JSON.stringify({ packageName: this.launchForm.packageName }),
+ success: (res) => {
+ this.$set(row, 'restarting', false);
+ if (res.code === 200) {
+ Object.assign(row, res.data.device);
+ this.$message.success('閲嶅惎鎴愬姛');
+ this.installResult = res.data.result;
+ } else {
+ this.$message.error(res.msg || '閲嶅惎澶辫触');
+ }
+ },
+ error: () => {
+ this.$set(row, 'restarting', false);
+ this.$message.error('璇锋眰澶辫触');
+ }
+ });
+ },
+
+ // 鎵归噺閲嶅惎搴旂敤
+ batchRestartApp() {
+ if (this.launchForm.deviceIds.length === 0) {
+ this.$message.warning('璇烽�夋嫨璁惧');
+ return;
+ }
+
+ this.launching = true;
+ this.installResult = '';
+
+ $.ajax({
+ url: baseUrl + '/tvDevice/batchRestartApp/auth',
+ headers: this.getHeaders(),
+ method: 'POST',
+ contentType: 'application/json;charset=UTF-8',
+ data: JSON.stringify({
+ deviceIds: this.launchForm.deviceIds,
+ packageName: this.launchForm.packageName
+ }),
+ success: (res) => {
+ this.launching = false;
+ if (res.code === 200) {
+ this.installResult = res.data.join('\n');
+ this.$message.success('閲嶅惎瀹屾垚');
+ this.loadData();
+ } else {
+ this.$message.error(res.msg || '閲嶅惎澶辫触');
+ }
+ },
+ error: () => {
+ this.launching = false;
+ this.$message.error('璇锋眰澶辫触');
+ }
+ });
+ },
+
// 鎼滅储
handleSearch() {
this.currentPage = 1;
@@ -883,6 +1017,14 @@
this.$message.error('涓婁紶澶辫触');
},
+ buildTaskLabel(task) {
+ const name = task.projectName || task.repoAlias || task.taskId || '';
+ const time = this.formatDate(task.createdAt) || '-';
+ const id = task.id != null ? task.id : '';
+ const status = task.apkPath ? '宸蹭笅杞�' : '鏈笅杞�';
+ return `${name} | ID: ${id} | ${time} | ${status}`;
+ },
+
// 鏍煎紡鍖栨棩鏈�
formatDate(timestamp) {
if (!timestamp) return '';
@@ -900,4 +1042,4 @@
</script>
</body>
-</html>
\ No newline at end of file
+</html>
--
Gitblit v1.9.1