修改选择想定
This commit is contained in:
parent
5d536fdcad
commit
4e3e60950d
@ -8,15 +8,8 @@
|
||||
<div class="search-area">
|
||||
<div class="search-item">
|
||||
<label for="year">年度:</label>
|
||||
<el-date-picker
|
||||
v-model="year"
|
||||
type="year"
|
||||
placeholder="选择年"
|
||||
format="yyyy"
|
||||
value-format="yyyy"
|
||||
@change="handleChangeYear"
|
||||
class="year-picker"
|
||||
/>
|
||||
<el-date-picker v-model="year" type="year" placeholder="选择年" format="yyyy" value-format="yyyy"
|
||||
@change="handleChangeYear" class="year-picker" />
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<label for="taskName">任务名称:</label>
|
||||
@ -34,14 +27,14 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>日期</th>
|
||||
<th>游戏数</th>
|
||||
<th>练习日</th>
|
||||
<th>参数飞行数</th>
|
||||
<th>参数模型</th>
|
||||
<th>波次数</th>
|
||||
<th>演戏日</th>
|
||||
<th>参演飞机数</th>
|
||||
<th>参演机型</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<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.gameCount || 0 }}</td>
|
||||
<td>{{ task.practiceDay || 0 }}</td>
|
||||
@ -86,12 +79,14 @@ export default {
|
||||
tasks: [],
|
||||
originalTasks: [],
|
||||
taskList: [
|
||||
{
|
||||
id: 1,
|
||||
value: 'J-11,模型-7',
|
||||
label: 'J-11,模型-7'
|
||||
{
|
||||
id: 1,
|
||||
value: 'J-11,模型-7',
|
||||
label: 'J-11,模型-7'
|
||||
},
|
||||
],
|
||||
taskRQ: '',
|
||||
taskBC: '',
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -121,8 +116,29 @@ export default {
|
||||
};
|
||||
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 {
|
||||
webrtc.webrtc.emitCommand("TaskSelected", data);
|
||||
webrtc.webrtc.emitUIInter({
|
||||
command: "LoadScenario",
|
||||
rwbs: currentTaskName,
|
||||
rq: currentTaskRQ,
|
||||
bc: currentTaskBC
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error in emitCommand:', error);
|
||||
}
|
||||
@ -149,13 +165,13 @@ export default {
|
||||
console.warn('Invalid timestamp:', timestamp);
|
||||
return 'Invalid Date';
|
||||
}
|
||||
|
||||
|
||||
const date = new Date(ts * 1000); // 转换为毫秒
|
||||
if (date.toString() === 'Invalid Date') {
|
||||
console.warn('Invalid date from timestamp:', ts);
|
||||
return 'Invalid Date';
|
||||
}
|
||||
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
@ -167,7 +183,7 @@ export default {
|
||||
},
|
||||
handleSearch() {
|
||||
const currentTaskName = this.taskName;
|
||||
|
||||
|
||||
if (!currentTaskName) {
|
||||
console.warn('Task name is empty');
|
||||
return;
|
||||
@ -178,13 +194,13 @@ export default {
|
||||
command: "SelectScenarioTask",
|
||||
task: currentTaskName
|
||||
});
|
||||
|
||||
|
||||
// 添加调试日志
|
||||
console.log('Sending request with task:', currentTaskName);
|
||||
|
||||
|
||||
webrtc.webrtc.addResponseEventListener('SelectScenarioTask', (response) => {
|
||||
console.log('SelectScenarioTask response1111:', response);
|
||||
|
||||
|
||||
try {
|
||||
const parsedResponse = JSON.parse(response);
|
||||
console.log('Parsed response:', parsedResponse, Array.isArray(parsedResponse.data));
|
||||
@ -195,15 +211,15 @@ export default {
|
||||
date: this.formatTimestamp(Number(item.timestamp)),
|
||||
gameCount: Number(item.bc) || 0,
|
||||
practiceDay: Number(item.yxr) || 0,
|
||||
paramFlightCount: 0,
|
||||
paramModel: ''
|
||||
paramFlightCount: Number(item.count) || 0,
|
||||
paramModel: item.jx
|
||||
};
|
||||
console.log('Mapped item:', mappedItem);
|
||||
return mappedItem;
|
||||
});
|
||||
|
||||
|
||||
console.log('Updated tasks array:', this.tasks);
|
||||
|
||||
|
||||
// 强制更新视图
|
||||
this.$forceUpdate();
|
||||
} else {
|
||||
@ -214,7 +230,7 @@ export default {
|
||||
console.error('Error parsing response:', parseError);
|
||||
this.tasks = [];
|
||||
}
|
||||
|
||||
|
||||
webrtc.webrtc.removeResponseEventListener('SelectScenarioTask');
|
||||
});
|
||||
} catch (error) {
|
||||
@ -226,7 +242,7 @@ export default {
|
||||
this.year = String(new Date().getFullYear());
|
||||
this.taskName = '';
|
||||
this.tasks = [...this.originalTasks];
|
||||
|
||||
|
||||
try {
|
||||
webrtc.webrtc.emitUIInter({
|
||||
ResetTask: true
|
||||
@ -238,7 +254,7 @@ export default {
|
||||
handleChangeYear() {
|
||||
// 清空表格数据
|
||||
this.tasks = [];
|
||||
|
||||
|
||||
try {
|
||||
webrtc.webrtc.emitUIInter({
|
||||
command: "LoadScenarioTask",
|
||||
@ -254,7 +270,7 @@ export default {
|
||||
value: task,
|
||||
label: task
|
||||
}));
|
||||
|
||||
|
||||
// 设置默认选中的任务名称
|
||||
if (this.taskList.length > 0) {
|
||||
this.taskName = this.taskList[0].value;
|
||||
@ -273,6 +289,13 @@ export default {
|
||||
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() {
|
||||
this.initData();
|
||||
|
@ -1865,7 +1865,7 @@ function connect() {
|
||||
}
|
||||
// ws = new WebSocket("ws://localhost/");
|
||||
// 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}`);
|
||||
ws = new WebSocket(connectionUrl);
|
||||
ws.attemptStreamReconnection = true;
|
||||
|
Loading…
Reference in New Issue
Block a user