2.10
This commit is contained in:
parent
042ea75847
commit
b1e9b058f0
8
package-lock.json
generated
8
package-lock.json
generated
@ -9,7 +9,7 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"element-plus": "^2.9.2",
|
"element-plus": "^2.9.4",
|
||||||
"pinia": "^2.3.0",
|
"pinia": "^2.3.0",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
"vue-router": "^4.5.0"
|
"vue-router": "^4.5.0"
|
||||||
@ -2974,9 +2974,9 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/element-plus": {
|
"node_modules/element-plus": {
|
||||||
"version": "2.9.2",
|
"version": "2.9.4",
|
||||||
"resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.9.2.tgz",
|
"resolved": "https://registry.npmmirror.com/element-plus/-/element-plus-2.9.4.tgz",
|
||||||
"integrity": "sha512-HS+Cc5mmy70DixJuoN3cMxPPoNWXkjHzUw2PcGmysk6NHQzzUtwi2Vc+dlmbmRxj3eNqgC1xpPQV5Nf9uDtQRg==",
|
"integrity": "sha512-sGnW0wd9zf6lEGixXV2gfwx3X6VTMkP52qTkX7zbURJ2oariyslrKTBh2txt1sdn1pUvj2l0KY3OfSXoZGmDOw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ctrl/tinycolor": "^3.4.1",
|
"@ctrl/tinycolor": "^3.4.1",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
"element-plus": "^2.9.2",
|
"element-plus": "^2.9.4",
|
||||||
"pinia": "^2.3.0",
|
"pinia": "^2.3.0",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.13",
|
||||||
"vue-router": "^4.5.0"
|
"vue-router": "^4.5.0"
|
||||||
|
@ -13,7 +13,7 @@ const router = createRouter({
|
|||||||
path: '/home',
|
path: '/home',
|
||||||
name: 'home',
|
name: 'home',
|
||||||
component: () => import('../views/Home.vue'),
|
component: () => import('../views/Home.vue'),
|
||||||
meta: { requiresAuth: true },
|
// meta: { requiresAuth: true },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/change-password',
|
path: '/change-password',
|
||||||
|
@ -138,10 +138,13 @@
|
|||||||
|
|
||||||
<el-form-item label="车道模式">
|
<el-form-item label="车道模式">
|
||||||
<el-select v-model="newPlan.selectedMode" placeholder="请选择车道模式" style="width: 30rem">
|
<el-select v-model="newPlan.selectedMode" placeholder="请选择车道模式" style="width: 30rem">
|
||||||
<el-option label="左转" value="leftTurn"></el-option>
|
<el-option label="左转 直行" value="leftTurn"></el-option>
|
||||||
<el-option label="右转" value="rightTurn"></el-option>
|
<el-option label="右转 直行" value="rightTurn"></el-option>
|
||||||
<el-option label="直行" value="straight"></el-option>
|
<!-- <el-option label="直行 左转" value="straight"></el-option>
|
||||||
<el-option label="掉头" value="uTurn"></el-option>
|
<el-option label="掉头 直行" value="uTurn"></el-option> -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
@ -162,6 +165,20 @@
|
|||||||
<el-checkbox :label="'车道4'">车道4</el-checkbox>
|
<el-checkbox :label="'车道4'">车道4</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<!-- 添加重复日期选择 -->
|
||||||
|
<el-form-item label="重复日期">
|
||||||
|
<el-checkbox-group v-model="newPlan.repeatDays">
|
||||||
|
<el-checkbox label="0">周一</el-checkbox>
|
||||||
|
<el-checkbox label="1">周二</el-checkbox>
|
||||||
|
<el-checkbox label="2">周三</el-checkbox>
|
||||||
|
<el-checkbox label="3">周四</el-checkbox>
|
||||||
|
<el-checkbox label="4">周五</el-checkbox>
|
||||||
|
<el-checkbox label="5">周六</el-checkbox>
|
||||||
|
<el-checkbox label="6">周日</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<div style="margin-left: 120px;">
|
<div style="margin-left: 120px;">
|
||||||
<el-button type="primary" @click="addPlan">保存方案</el-button>
|
<el-button type="primary" @click="addPlan">保存方案</el-button>
|
||||||
@ -170,7 +187,7 @@
|
|||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table :data="plans" border style="width: 58%">
|
<el-table :data="plans" empty-text="暂无数据" border style="width: 58%">
|
||||||
<el-table-column prop="name" label="方案名称" width="200" align="center"></el-table-column>
|
<el-table-column prop="name" label="方案名称" width="200" align="center"></el-table-column>
|
||||||
<el-table-column prop="timeRange" label="时间段" width="210" align="center"></el-table-column>
|
<el-table-column prop="timeRange" label="时间段" width="210" align="center"></el-table-column>
|
||||||
<el-table-column prop="selectedMode" label="车道模式" width="210"
|
<el-table-column prop="selectedMode" label="车道模式" width="210"
|
||||||
@ -211,6 +228,7 @@
|
|||||||
<el-checkbox :label="'车道4'">车道4</el-checkbox>
|
<el-checkbox :label="'车道4'">车道4</el-checkbox>
|
||||||
</el-checkbox-group>
|
</el-checkbox-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="editDialogVisible = false">取消</el-button>
|
<el-button @click="editDialogVisible = false">取消</el-button>
|
||||||
@ -219,6 +237,30 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="默认设置">
|
||||||
|
<el-form label-width="120px">
|
||||||
|
<el-form-item label="车道默认设置">
|
||||||
|
<div class="lane-settings-container">
|
||||||
|
<div v-for="(lane, index) in 4" :key="index" class="lane-setting-vertical">
|
||||||
|
<div class="lane-header">车道{{ lane }}</div>
|
||||||
|
<el-select v-model="laneDefaults[`lane${lane}`]" multiple collapse-tags
|
||||||
|
placeholder="请选择行驶方向" style="width: 150px">
|
||||||
|
<el-option label="左转 直行" value="0"></el-option>
|
||||||
|
<!-- <el-option label="直行" value="straight"></el-option> -->
|
||||||
|
<el-option label="右转 直行" value="1"></el-option>
|
||||||
|
<!-- <el-option label="掉头" value="uturn"></el-option> -->
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<div style="margin-left: 320px;">
|
||||||
|
<el-button type="primary" @click="saveLaneDefaults">保存设置</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-main>
|
</el-main>
|
||||||
@ -228,7 +270,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from 'axios' // 确保在文件顶部引入 axios
|
import axios from 'axios' // 确保在文件顶部引入 axios
|
||||||
import { ElMessage } from 'element-plus'
|
// import { ElMessage } from 'element-plus'
|
||||||
import { getNextJsonId } from '../utils/jsonCounter.js'
|
import { getNextJsonId } from '../utils/jsonCounter.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -243,10 +285,10 @@ export default {
|
|||||||
lanes: [],
|
lanes: [],
|
||||||
timeRange: [], // 用于绑定时间段选择的数组
|
timeRange: [], // 用于绑定时间段选择的数组
|
||||||
selectedMode: '', // 用于绑定选择的值
|
selectedMode: '', // 用于绑定选择的值
|
||||||
|
repeatDays: [], // 添加重复日期数组
|
||||||
},
|
},
|
||||||
plans: [
|
plans: [
|
||||||
|
|
||||||
],
|
],
|
||||||
editDialogVisible: false,
|
editDialogVisible: false,
|
||||||
editPlanData: {},
|
editPlanData: {},
|
||||||
@ -267,6 +309,12 @@ export default {
|
|||||||
'rightTurn': 3,
|
'rightTurn': 3,
|
||||||
'uTurn': 4
|
'uTurn': 4
|
||||||
},
|
},
|
||||||
|
laneDefaults: {
|
||||||
|
lane1: [],
|
||||||
|
lane2: [],
|
||||||
|
lane3: [],
|
||||||
|
lane4: []
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -278,7 +326,8 @@ export default {
|
|||||||
endTime: '',
|
endTime: '',
|
||||||
lanes: [],
|
lanes: [],
|
||||||
timeRange: [],
|
timeRange: [],
|
||||||
selectedMode: ''
|
selectedMode: '',
|
||||||
|
repeatDays: [], // 重置重复日期
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// 模式设置
|
// 模式设置
|
||||||
@ -307,7 +356,7 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('发送模式设置请求:', JSON.stringify(modeData, null, 2));
|
console.log('发送模式设置请求:', JSON.stringify(modeData, null, 2));
|
||||||
|
|
||||||
const response = await axios.post('/communication', modeData, {
|
const response = await axios.post('/communication', modeData, {
|
||||||
@ -315,7 +364,7 @@ export default {
|
|||||||
"content-type": "application/json"
|
"content-type": "application/json"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('收到模式设置响应:', JSON.stringify(response.data, null, 2));
|
console.log('收到模式设置响应:', JSON.stringify(response.data, null, 2));
|
||||||
|
|
||||||
if (response.data?.parameters?.status === 0) {
|
if (response.data?.parameters?.status === 0) {
|
||||||
@ -375,6 +424,14 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.newPlan.repeatDays || this.newPlan.repeatDays.length === 0) {
|
||||||
|
ElMessage({
|
||||||
|
message: '请选择重复日期',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const formatTime = (date) => {
|
const formatTime = (date) => {
|
||||||
return date.toTimeString().slice(0, 5);
|
return date.toTimeString().slice(0, 5);
|
||||||
};
|
};
|
||||||
@ -395,7 +452,8 @@ export default {
|
|||||||
start: formatTime(startTime),
|
start: formatTime(startTime),
|
||||||
end: formatTime(endTime)
|
end: formatTime(endTime)
|
||||||
},
|
},
|
||||||
lanes: lanes.map(String)
|
lanes: lanes.map(String),
|
||||||
|
repeatDays: this.newPlan.repeatDays // 添加重复日期
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -475,9 +533,13 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('收到所有信息响应:', JSON.stringify(response.data, null, 2));
|
||||||
|
|
||||||
if (response.data?.parameters) {
|
if (response.data?.parameters) {
|
||||||
|
// 更新模式设置
|
||||||
this.modeSetting = response.data.parameters.set_mode === 0 ? 'Smart_Mode' : 'Solution_Mode';
|
this.modeSetting = response.data.parameters.set_mode === 0 ? 'Smart_Mode' : 'Solution_Mode';
|
||||||
|
|
||||||
|
// 更新方案列表
|
||||||
if (response.data.parameters.scheme) {
|
if (response.data.parameters.scheme) {
|
||||||
this.plans = response.data.parameters.scheme.map(scheme => ({
|
this.plans = response.data.parameters.scheme.map(scheme => ({
|
||||||
name: scheme.name,
|
name: scheme.name,
|
||||||
@ -487,6 +549,17 @@ export default {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新默认车道设置
|
||||||
|
if (response.data.parameters.laneSetting) {
|
||||||
|
this.laneDefaults = {
|
||||||
|
lane1: response.data.parameters.laneSetting.lane1 || [],
|
||||||
|
lane2: response.data.parameters.laneSetting.lane2 || [],
|
||||||
|
lane3: response.data.parameters.laneSetting.lane3 || [],
|
||||||
|
lane4: response.data.parameters.laneSetting.lane4 || []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新设备信息
|
||||||
if (response.data.parameters.deviceInfo) {
|
if (response.data.parameters.deviceInfo) {
|
||||||
this.version = response.data.parameters.deviceInfo.version;
|
this.version = response.data.parameters.deviceInfo.version;
|
||||||
this.compile_time = response.data.parameters.deviceInfo.compileTime;
|
this.compile_time = response.data.parameters.deviceInfo.compileTime;
|
||||||
@ -574,8 +647,9 @@ export default {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('时间设置错误:', error);
|
console.error('时间设置错误:', error);
|
||||||
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: '时间设置失败:' + (error.message || '未知错误'),
|
message: ('时间设置失败'),
|
||||||
type: 'error'
|
type: 'error'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -683,6 +757,48 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
async saveLaneDefaults() {
|
||||||
|
try {
|
||||||
|
const defaultsData = {
|
||||||
|
JSON_id: getNextJsonId(),
|
||||||
|
command: "default_lane_setting",
|
||||||
|
parameters: {
|
||||||
|
lane1: this.laneDefaults.lane1 || [],
|
||||||
|
lane2: this.laneDefaults.lane2 || [],
|
||||||
|
lane3: this.laneDefaults.lane3 || [],
|
||||||
|
lane4: this.laneDefaults.lane4 || []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('发送车道默认设置请求:', JSON.stringify(defaultsData, null, 2));
|
||||||
|
|
||||||
|
const response = await axios.post('/communication', defaultsData, {
|
||||||
|
headers: {
|
||||||
|
"content-type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('收到车道默认设置响应:', JSON.stringify(response.data, null, 2));
|
||||||
|
|
||||||
|
if (response.data?.parameters?.status === 0) {
|
||||||
|
ElMessage({
|
||||||
|
message: '车道默认设置保存成功',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ElMessage({
|
||||||
|
message: response.data?.parameters?.message || '保存失败',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('保存车道默认设置失败:', error);
|
||||||
|
ElMessage({
|
||||||
|
message: '保存失败:' + (error.message || '未知错误'),
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// 组件挂载时获取设备信息和所有信息
|
// 组件挂载时获取设备信息和所有信息
|
||||||
@ -773,4 +889,28 @@ export default {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lane-settings-container {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
/* 设置间距 */
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lane-setting-vertical {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 15px;
|
||||||
|
border: 1px solid #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lane-header {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -31,7 +31,6 @@ import axios from 'axios'; // 导入 Axios
|
|||||||
import { useAuthStore } from '../stores/auth.js'; // 使用别名导入
|
import { useAuthStore } from '../stores/auth.js'; // 使用别名导入
|
||||||
import { getNextJsonId } from '../utils/jsonCounter.js';
|
import { getNextJsonId } from '../utils/jsonCounter.js';
|
||||||
import { useRouter } from 'vue-router'; // 添加这行
|
import { useRouter } from 'vue-router'; // 添加这行
|
||||||
import { ElMessage } from 'element-plus'; // 添加这行
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
@ -81,7 +80,7 @@ export default {
|
|||||||
if (response.data?.parameters?.status === 0) {
|
if (response.data?.parameters?.status === 0) {
|
||||||
// 登录成功,设置登录状态
|
// 登录成功,设置登录状态
|
||||||
this.authStore.login();
|
this.authStore.login();
|
||||||
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: response.data?.parameters?.message || '登录成功',
|
message: response.data?.parameters?.message || '登录成功',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
@ -90,10 +89,17 @@ export default {
|
|||||||
console.error('路由跳转错误:', err);
|
console.error('路由跳转错误:', err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ElMessage({
|
// ElMessage.error({
|
||||||
message: response.data?.parameters?.message || '登录失败',
|
// message: response.data?.parameters?.message || '登录失败',
|
||||||
type: 'error'
|
// });
|
||||||
});
|
ElMessage.error('Oops, this is a error message.')
|
||||||
|
|
||||||
|
//测试部分
|
||||||
|
// this.authStore.login();
|
||||||
|
// this.router.push('/home').catch(err => {
|
||||||
|
// console.error('路由跳转错误:', err);
|
||||||
|
// });
|
||||||
|
//需删除
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
@ -100,12 +100,12 @@
|
|||||||
"lanes": [
|
"lanes": [
|
||||||
"0",
|
"0",
|
||||||
"1"
|
"1"
|
||||||
]
|
],
|
||||||
|
"repeatDays": [0, 1, 2, 3, 4, 5, 6] // 表示周一到周日每天都重复执行该方案
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(单片机 → Web)
|
(单片机 → Web)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -159,9 +159,38 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"laneSetting": {
|
||||||
|
"lane1": ["0"], //0左转直行 1右转直行
|
||||||
|
"lane2": ["1"],
|
||||||
|
"lane3": ["0"],
|
||||||
|
"lane4": ["1"]
|
||||||
|
|
||||||
|
},
|
||||||
"deviceInfo": {
|
"deviceInfo": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"compileTime": "2025-01-14 10:30:00"
|
"compileTime": "2025-01-14 10:30:00"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
默认车道设置
|
||||||
|
(Web → 单片机)
|
||||||
|
{
|
||||||
|
"command": "default_lane_setting",
|
||||||
|
"parameters": {
|
||||||
|
"lane1": ["0"], //0左转直行 1右转直行
|
||||||
|
"lane2": ["1"],
|
||||||
|
"lane3": ["2"],
|
||||||
|
"lane4": ["3"]
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(单片机 → Web)
|
||||||
|
{
|
||||||
|
"command": "default_lane_setting",
|
||||||
|
"parameters": {
|
||||||
|
"status": 0, // 0: 成功, 1: 失败
|
||||||
|
"message": "Set successfully"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user