修改选择想定
This commit is contained in:
parent
5d536fdcad
commit
4e3e60950d
@ -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>
|
||||||
@ -86,12 +79,14 @@ export default {
|
|||||||
tasks: [],
|
tasks: [],
|
||||||
originalTasks: [],
|
originalTasks: [],
|
||||||
taskList: [
|
taskList: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
value: 'J-11,模型-7',
|
value: 'J-11,模型-7',
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -149,13 +165,13 @@ export default {
|
|||||||
console.warn('Invalid timestamp:', timestamp);
|
console.warn('Invalid timestamp:', timestamp);
|
||||||
return 'Invalid Date';
|
return 'Invalid Date';
|
||||||
}
|
}
|
||||||
|
|
||||||
const date = new Date(ts * 1000); // 转换为毫秒
|
const date = new Date(ts * 1000); // 转换为毫秒
|
||||||
if (date.toString() === 'Invalid Date') {
|
if (date.toString() === 'Invalid Date') {
|
||||||
console.warn('Invalid date from timestamp:', ts);
|
console.warn('Invalid date from timestamp:', ts);
|
||||||
return 'Invalid Date';
|
return 'Invalid Date';
|
||||||
}
|
}
|
||||||
|
|
||||||
const year = date.getFullYear();
|
const year = date.getFullYear();
|
||||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
@ -167,7 +183,7 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
const currentTaskName = this.taskName;
|
const currentTaskName = this.taskName;
|
||||||
|
|
||||||
if (!currentTaskName) {
|
if (!currentTaskName) {
|
||||||
console.warn('Task name is empty');
|
console.warn('Task name is empty');
|
||||||
return;
|
return;
|
||||||
@ -178,13 +194,13 @@ export default {
|
|||||||
command: "SelectScenarioTask",
|
command: "SelectScenarioTask",
|
||||||
task: currentTaskName
|
task: currentTaskName
|
||||||
});
|
});
|
||||||
|
|
||||||
// 添加调试日志
|
// 添加调试日志
|
||||||
console.log('Sending request with task:', currentTaskName);
|
console.log('Sending request with task:', currentTaskName);
|
||||||
|
|
||||||
webrtc.webrtc.addResponseEventListener('SelectScenarioTask', (response) => {
|
webrtc.webrtc.addResponseEventListener('SelectScenarioTask', (response) => {
|
||||||
console.log('SelectScenarioTask response1111:', response);
|
console.log('SelectScenarioTask response1111:', response);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const parsedResponse = JSON.parse(response);
|
const parsedResponse = JSON.parse(response);
|
||||||
console.log('Parsed response:', parsedResponse, Array.isArray(parsedResponse.data));
|
console.log('Parsed response:', parsedResponse, Array.isArray(parsedResponse.data));
|
||||||
@ -195,15 +211,15 @@ 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;
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('Updated tasks array:', this.tasks);
|
console.log('Updated tasks array:', this.tasks);
|
||||||
|
|
||||||
// 强制更新视图
|
// 强制更新视图
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
} else {
|
} else {
|
||||||
@ -214,7 +230,7 @@ export default {
|
|||||||
console.error('Error parsing response:', parseError);
|
console.error('Error parsing response:', parseError);
|
||||||
this.tasks = [];
|
this.tasks = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
webrtc.webrtc.removeResponseEventListener('SelectScenarioTask');
|
webrtc.webrtc.removeResponseEventListener('SelectScenarioTask');
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -226,7 +242,7 @@ export default {
|
|||||||
this.year = String(new Date().getFullYear());
|
this.year = String(new Date().getFullYear());
|
||||||
this.taskName = '';
|
this.taskName = '';
|
||||||
this.tasks = [...this.originalTasks];
|
this.tasks = [...this.originalTasks];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
webrtc.webrtc.emitUIInter({
|
webrtc.webrtc.emitUIInter({
|
||||||
ResetTask: true
|
ResetTask: true
|
||||||
@ -238,7 +254,7 @@ export default {
|
|||||||
handleChangeYear() {
|
handleChangeYear() {
|
||||||
// 清空表格数据
|
// 清空表格数据
|
||||||
this.tasks = [];
|
this.tasks = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
webrtc.webrtc.emitUIInter({
|
webrtc.webrtc.emitUIInter({
|
||||||
command: "LoadScenarioTask",
|
command: "LoadScenarioTask",
|
||||||
@ -254,7 +270,7 @@ export default {
|
|||||||
value: task,
|
value: task,
|
||||||
label: task
|
label: task
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 设置默认选中的任务名称
|
// 设置默认选中的任务名称
|
||||||
if (this.taskList.length > 0) {
|
if (this.taskList.length > 0) {
|
||||||
this.taskName = this.taskList[0].value;
|
this.taskName = this.taskList[0].value;
|
||||||
@ -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();
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user