修改选择想定

This commit is contained in:
pm 2025-02-19 21:36:13 +08:00
parent 5d536fdcad
commit 4e3e60950d
2 changed files with 57 additions and 34 deletions

View File

@ -8,15 +8,8 @@
<div class="search-area"> <div class="search-area">
<div class="search-item"> <div class="search-item">
<label for="year">年度:</label> <label for="year">年度:</label>
<el-date-picker <el-date-picker v-model="year" type="year" placeholder="选择年" format="yyyy" value-format="yyyy"
v-model="year" @change="handleChangeYear" class="year-picker" />
type="year"
placeholder="选择年"
format="yyyy"
value-format="yyyy"
@change="handleChangeYear"
class="year-picker"
/>
</div> </div>
<div class="search-item"> <div class="search-item">
<label for="taskName">任务名称:</label> <label for="taskName">任务名称:</label>
@ -34,14 +27,14 @@
<thead> <thead>
<tr> <tr>
<th>日期</th> <th>日期</th>
<th>游戏</th> <th>波次</th>
<th>练习</th> <th>演戏</th>
<th>数飞行</th> <th>演飞机</th>
<th>数模</th> <th>演机</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(task, index) in tasks" :key="index"> <tr v-for="(task, index) in tasks" :key="index" @click="getCurrentRow(task)">
<td>{{ task.date || 'N/A' }}</td> <td>{{ task.date || 'N/A' }}</td>
<td>{{ task.gameCount || 0 }}</td> <td>{{ task.gameCount || 0 }}</td>
<td>{{ task.practiceDay || 0 }}</td> <td>{{ task.practiceDay || 0 }}</td>
@ -92,6 +85,8 @@ export default {
label: 'J-11,模型-7' label: 'J-11,模型-7'
}, },
], ],
taskRQ: '',
taskBC: '',
}; };
}, },
watch: { watch: {
@ -121,8 +116,29 @@ export default {
}; };
console.log('Confirmed:', data); console.log('Confirmed:', data);
const currentTaskName = this.taskName;
if (!currentTaskName) {
console.warn('Task name is empty');
return;
}
const currentTaskRQ = this.taskRQ;
if (!currentTaskRQ) {
return;
}
const currentTaskBC = this.taskBC;
if (!currentTaskBC) {
return;
}
try { try {
webrtc.webrtc.emitCommand("TaskSelected", data); webrtc.webrtc.emitUIInter({
command: "LoadScenario",
rwbs: currentTaskName,
rq: currentTaskRQ,
bc: currentTaskBC
});
} catch (error) { } catch (error) {
console.error('Error in emitCommand:', error); console.error('Error in emitCommand:', error);
} }
@ -195,8 +211,8 @@ export default {
date: this.formatTimestamp(Number(item.timestamp)), date: this.formatTimestamp(Number(item.timestamp)),
gameCount: Number(item.bc) || 0, gameCount: Number(item.bc) || 0,
practiceDay: Number(item.yxr) || 0, practiceDay: Number(item.yxr) || 0,
paramFlightCount: 0, paramFlightCount: Number(item.count) || 0,
paramModel: '' paramModel: item.jx
}; };
console.log('Mapped item:', mappedItem); console.log('Mapped item:', mappedItem);
return mappedItem; return mappedItem;
@ -273,6 +289,13 @@ export default {
console.error('Error in emitUIInter:', error); console.error('Error in emitUIInter:', error);
} }
}, },
getCurrentRow(task) {
this.currentRow = task;
console.log('Current Row:', this.currentRow);
this.taskRQ = task.date;
this.taskBC = task.gameCount;
},
}, },
created() { created() {
this.initData(); this.initData();

View File

@ -1865,7 +1865,7 @@ function connect() {
} }
// ws = new WebSocket("ws://localhost/"); // ws = new WebSocket("ws://localhost/");
// ws = new WebSocket(window.location.href.replace('http://', 'ws://').replace('https://', 'wss://')); // ws = new WebSocket(window.location.href.replace('http://', 'ws://').replace('https://', 'wss://'));
let connectionUrl = window.location.href.replace('http://', 'ws://').replace('https://', 'wss://').replace(/:\d+/, ''); let connectionUrl = window.location.href.replace('http://', 'ws://').replace('https://', 'wss://').replace(/:\d+/, ':8000');
console.log(`Creating a websocket connection to: ${connectionUrl}`); console.log(`Creating a websocket connection to: ${connectionUrl}`);
ws = new WebSocket(connectionUrl); ws = new WebSocket(connectionUrl);
ws.attemptStreamReconnection = true; ws.attemptStreamReconnection = true;