From bcfb05f5e7782ef23e4deb1b38a1ca4b4085181a Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期六, 11 十月 2025 17:09:47 +0800
Subject: [PATCH] test
---
pages/map/index.vue | 483 +++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 351 insertions(+), 132 deletions(-)
diff --git a/pages/map/index.vue b/pages/map/index.vue
index b76665c..1c35489 100644
--- a/pages/map/index.vue
+++ b/pages/map/index.vue
@@ -10,22 +10,22 @@
alt="SVG 鍥剧墖" @click="clickShowMenu" />
</view>
<template v-slot:left>
- <view>
- <uni-icons type="left" size="24" @click="clickBack"></uni-icons>
+ <view @click="clickBack">
+ <uni-icons type="left" size="24"></uni-icons>
</view>
</template>
- <template v-slot:right>
+ <!-- <template v-slot:right>
<view v-if="sceneList.length > 0 && !mapOperationType">
<a @click="clickMore">
<uni-icons class="uni-panel-bar-icon" type="more-filled" size="24"></uni-icons>
</a>
</view>
- </template>
+ </template> -->
</uni-nav-bar>
<view class="no-content" v-if="unlinked">
- <image class="img" src="/images/image 25.png" alt=" 鍥剧墖" mode="aspectFit" />
+ <image class="img" src="/images/image_25.png" alt=" 鍥剧墖" mode="aspectFit" />
<view class="title">杞﹁締杩炴帴澶辫触</view>
<view class="space">璇锋鏌ヤ綘鐨勭綉缁滆缃垨閲嶆柊鍔犺浇</view>
</view>
@@ -89,7 +89,7 @@
<view class="tip">璇疯緭鍏ュ満鏅悕绉�/view>
<view class="name-input">
<input ref="refInputName" :focus="true" placeholder="璇疯緭鍏ュ満鏅悕绉� :value="sceneInputName"
- @input="onInputName"></input>
+ @input="onInputName" />
<uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="sceneInputName"
@click="clickClearName"></uni-icons>
</view>
@@ -108,14 +108,14 @@
<view class="coordinate">
<text class="name">妯潗鏍�</text>
<input ref="refInputX" class="number-input" type="number" :value="stationEdit.x"
- @input="onInputStationX" :maxlength="4"></input>
+ @input="onInputStationX" :maxlength="4" />
<uni-icons class="clear" color="#ccc" type="clear" size="20"
v-if="stationEdit.x && stationEdit.x!='0'" @click="clickClearStationX"></uni-icons>
</view>
<view class="coordinate">
<text class="name">绔栧潗鏍�</text>
<input ref="refInputX" class="number-input" type="number" :value="stationEdit.y"
- @input="onInputStationY" :maxlength="4"></input>
+ @input="onInputStationY" :maxlength="4" />
<uni-icons class="clear" color="#ccc" type="clear" size="20"
v-if="stationEdit.y&& stationEdit.y!='0'" @click="clickClearStationY"></uni-icons>
</view>
@@ -124,7 +124,7 @@
<view class="tip">璋冭妭鏈濆悜</view>
<view class="angle-group">
<image class="img-angle" :src="angleSvg" alt="SVG 鍥剧墖" />
- <image class="img-angle-pos" src="/images/Frame 153.svg" alt="SVG 鍥剧墖"
+ <image class="img-angle-pos" src="/images/Frame_153.svg" alt="SVG 鍥剧墖"
@touchstart="handleAngleTouchStart" @touchmove="handleAngleTouchMove" />
</view>
</view>
@@ -132,7 +132,7 @@
<view class="tip">璇疯緭鍏ョ珯鐐瑰悕绉�/view>
<view class="name-input">
<input ref="refInputName" :focus="true" placeholder="杈撳叆绔欑偣鍚嶇О" :value="stationEdit.name"
- @input="onInputStationName"></input>
+ @input="onInputStationName" />
<uni-icons class="clear" color="#ccc" type="clear" size="20" v-if="stationEdit.name"
@click="clickClearStationName"></uni-icons>
</view>
@@ -211,15 +211,19 @@
<view class="bottom-content" v-if="mapOperationStatus =='teaching'">
<view class="tip">璺緞璁板綍涓�..</view>
<view v-if="mapOperationType =='public_teaching'">
- <view>姝e湪璁板綍鎼繍杞﹁杩涜矾寰勶紝鍙殢鏃跺垏鎹富璺�鏀矾绀烘暀锛屽畬鎴愬悗鐐规寜閽互缁撴潫绀烘暀銆傚湪绀烘暀杩囩▼涓彲浠ユ坊鍔犵珯鐐广�</view>
- <view class="switch-type">
+ <!-- 涓昏矾/鏀矾 -->
+ <view>姝e湪璁板綍鎼繍杞﹁杩涜矾寰勶紝瀹屾垚鍚庣偣鎸夐挳浠ョ粨鏉熺ず鏁欍�鍦ㄧず鏁欒繃绋嬩腑鍙互娣诲姞绔欑偣銆�/view>
+ <view class="switch-type">鍙殢鏃跺垏鎹㈢ず鏁欐ā寮� <view class="switch-button-group">
<view class="switch-button"
- :class="teachingModeCur.main_road ==1?'switch-button-checked':''"
- @click="onTeachingModeMainRoad(1)">涓昏矾绀烘暀</view>
+ :class="teachingModeCur.mode_type ==0?'switch-button-checked':''"
+ @click="onTeachingModeType(0)">榛樿</view>
<view class="switch-button "
- :class="teachingModeCur.main_road ==0?'switch-button-checked':''"
- @click="onTeachingModeMainRoad(0)">鏀矾绀烘暀</view>
+ :class="teachingModeCur.mode_type ==1?'switch-button-checked':''"
+ @click="onTeachingModeType(1)">鍙屽悜</view>
+ <view class="switch-button "
+ :class="teachingModeCur.mode_type ==2?'switch-button-checked':''"
+ @click="onTeachingModeType(2)">鏅鸿兘</view>
</view>
</view>
</view>
@@ -258,17 +262,20 @@
<view class="bottom-content" v-else>
<view class="tip">鍗冲皢寮�鍏叡绀烘暀</view>
<view>
- 璇烽�鎷╄杩涜涓昏矾杩樻槸鏀矾绀烘暀锛岀偣銆愬紑濮嬭褰曘�鍚庡皢璁板綍鎼繍杞︾殑琛岃繘璺嚎浣滀负鍏叡绀烘暀璺嚎銆傚紑濮嬭褰曞悗鍙殢鏃跺垏鎹富璺�鏀矾绀烘暀銆�+ 璇烽�鎷╄杩涜涓昏矾杩樻槸鏀矾绀烘暀锛岀偣銆愬紑濮嬭褰曘�鍚庡皢璁板綍鎼繍杞︾殑琛岃繘璺嚎浣滀负鍏叡绀烘暀璺嚎銆傚紑濮嬭褰曞悗鍙殢鏃跺垏鎹㈢ず鏁欐ā寮忋�
</view>
<view class="text-button-group">
<view class="switch-type">
<view class="switch-button-group">
<view class="switch-button"
- :class="teachingModeCur.main_road ==1?'switch-button-checked':''"
- @click="onTeachingModeMainRoad(1)">涓昏矾绀烘暀</view>
+ :class="teachingModeCur.mode_type ==0?'switch-button-checked':''"
+ @click="onTeachingModeType(0)">榛樿</view>
<view class="switch-button "
- :class="teachingModeCur.main_road ==0?'switch-button-checked':''"
- @click="onTeachingModeMainRoad(0)">鏀矾绀烘暀</view>
+ :class="teachingModeCur.mode_type ==1?'switch-button-checked':''"
+ @click="onTeachingModeType(1)">鍙屽悜</view>
+ <view class="switch-button "
+ :class="teachingModeCur.mode_type ==2?'switch-button-checked':''"
+ @click="onTeachingModeType(2)">鏅鸿兘</view>
</view>
</view>
<a-button type="primary" class="button" :disabled="loading"
@@ -347,7 +354,7 @@
<view class="img-button-group">
<view fill="none" class="button" @click.stop="clickStationDelete">
<text class="ico delete-outline"></text>
- <view class="text"> 鍒犻櫎绔欑偣</view>
+ <view class="text"> 鎵归噺鍒犻櫎</view>
</view>
<view type="text" class="button" @click.stop="clickStationPostion">
<text class="ico edit-line"></text>
@@ -383,6 +390,39 @@
</view>
</uni-popup>
+ <uni-popup ref="refPopupTeachingUpdate" type="dialog">
+ <uni-popup-dialog type="info" cancelText="鍙栨秷" confirmText="纭畾" title="绀烘暀鏇存柊"
+ @confirm="dialogTeachingUpdateConfirm" @close="dialogTeachingUpdateClose">
+
+ <view>
+
+ <radio-group @change="radioTeachinMainRoadChange">
+ <label class="radio">
+ <radio :value="1" :checked="selectTeachingMode.main_road == 1" />涓昏矾
+ </label>
+ <label class="radio">
+ <radio :value="0" :checked="selectTeachingMode.main_road != 1" />鏀矾
+ </label>
+ </radio-group>
+
+
+ </view>
+ <view>
+ <radio-group @change="radioTeachinBidirectionChange">
+ <label class="radio">
+ <radio :value="1" :checked="selectTeachingMode.bidirection == 1" />鍙屽悜
+ </label>
+ <label class="radio">
+ <radio :value="0" :checked="selectTeachingMode.bidirection != 1" />鍗曞悜
+ </label>
+ </radio-group>
+
+ </view>
+
+ </uni-popup-dialog>
+ </uni-popup>
+
+
</view>
</view>
@@ -423,6 +463,9 @@
delTeachingMode,
delTeachingModeData,
checkAgvLocationDistanceError,
+ splitTeachingMode,
+ updateSplitTeachingData,
+ deleteSplitTeachingData
} from "@/api/vehicle.js"
export default {
name: "PagesMap",
@@ -475,7 +518,8 @@
wallList: [],
regionList: [],
unlinked: false,
- showTeachingPathFlag: false,
+ showTeachingPathFlag: true,
+ curTeachingPathFlag: false,
curMapInfo: {
proportion: 1,
img_proportion: 1,
@@ -556,7 +600,7 @@
},
onBackPress() {
- this.isPageVisible = false
+ this.isPageVisible = false
if (this.destroyFlag)
return false
else {
@@ -597,6 +641,10 @@
this.mapOperationType = ''
const scene = this.sceneList[0]
this.changeMap(scene)
+ } else {
+ uni.navigateBack({
+ delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
+ })
}
this.refreshAgvPosition()
} catch (ex) {
@@ -751,19 +799,29 @@
showModal("宸茶褰曠殑璺緞灏嗕細琚垹闄ゃ�", "鏄惁瑕侀�鍑虹ず鏁欙紵").then(async (res) => {
if (res) {
+ const listDataStr = []
if (this.mapOperationStatus == 'end' || this.mapOperationStatus ==
'save') {
try {
- await delTeachingMode(this.vehicleIp, [this.teachingModeCur])
+ // await delTeachingMode(this.vehicleIp, [this.teachingModeCur])
+ await deleteSplitTeachingData(this.vehicleIp, this.teachingModeCur
+ .edge_name, this.teachingModeCur.name)
+
+ listDataStr.push({
+ method: "remove_teaching_path",
+ param: {
+ name: this.teachingModeCur.name,
+ mode: "Public"
+ },
+ })
} catch (ex) {
showError(ex)
}
-
}
- this.ctxDataStr = JSON.stringify([{
+ listDataStr.push({
method: "teaching_finish",
- }])
-
+ })
+ this.ctxDataStr = JSON.stringify(listDataStr)
this.mapOperationType = ""
}
})
@@ -776,11 +834,7 @@
}
} else {
- // const eventChannel = this.getOpenerEventChannel();
- // eventChannel.emit('udapte_station', this.unlinked);
- // uni.navigateBack({
- // delta: 1
- // })
+
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit('check_connect', !this.unlinked);
uni.navigateBack({
@@ -815,7 +869,7 @@
// this.mapOperationType = 'scene_create'
// this.opSceneType = 'add_name'
uni.navigateTo({
- url: `/pages/map/scene?ip=${_this.vehicleIp}`,
+ url: `/pages/map/scene?ip=${_this.vehicleIp}&opType=create`,
events: {
// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
create_finish: function(data) {
@@ -831,15 +885,13 @@
this.clickDelete()
}
}
-
-
},
async loadAgvState() {
try {
const info = await getAgvState(this.vehicleIp)
return info
} catch (ex) {
- showError(ex)
+ showToast(ex)
return {}
}
},
@@ -848,7 +900,7 @@
const paths = await getCurrentTeachingData(this.vehicleIp) || []
return paths
} catch (ex) {
- showError(ex)
+ showToast(ex)
return []
}
},
@@ -913,7 +965,6 @@
img_x: parseInt(infoMap.img_x) || 1,
img_y: parseInt(infoMap.img_y) || 1
}
- // getApp().globalData.curScene = infoMap
this.setData({
bgProgressPercent: 30,
bgLoading: infoMap.filedata ? true : false
@@ -936,6 +987,12 @@
{
method: "add_station",
param: stationLst
+ },
+ {
+ method: "show_teaching_path",
+ param: {
+ show: this.showTeachingPathFlag
+ }
},
{
method: "public_teaching_path",
@@ -1017,6 +1074,9 @@
width: param.view?.width || 0,
height: param.view?.height || 0,
}
+ const angle = this.getStantardAngle(this.stationEdit.angle * 180 / Math.PI)
+
+ this.angleSvg = `/static/images/angle${angle}.svg`
this.mapOperationType = ""
this.$refs.refPopupOperateStation.open("bottom")
@@ -1043,6 +1103,9 @@
const angle = this.getStantardAngle(this.stationEdit.angle * 180 / Math.PI)
this.angleSvg = `/static/images/angle${angle}.svg`
+ if (this.mapOperationType == "teaching_add_station") {
+ this.positioningAgv = true
+ }
this.clickStationPositonOk()
} else if (param.type == "edit_teaching") {
// console.log(param.type,JSON.stringify(param.data))
@@ -1090,7 +1153,7 @@
this.stationEdit.stationID = ""
this.mapOperationType = "public_teaching"
this.mapOperationStatus = "teaching"
-
+ this.positioningAgv = true
} else if (this.mapOperationType == "edit_station") {
this.mapOperationType = ""
this.mapOperationStatus = ""
@@ -1112,12 +1175,10 @@
param: true
}])
}
-
}
} else if (param.method == "select_teaching_path") {
console.log("point", param.point)
if (param.type == "station") {
-
this.selectTeachingMode = {
mode: "Stations",
name: param.data?.name || "",
@@ -1128,21 +1189,25 @@
} else if (param.type == "public") {
this.selectTeachingMode = {
mode: "Public",
+ edge_name: param.data?.edge_name || "",
name: param.data?.name || "",
- point: param.point
+ point: param.point,
+ main_road: param.data?.main_road || 0,
+ bidirection: param.data?.name || 0,
}
}
-
this.$refs.refPopupOperateTeaching.open("bottom")
} else if (param.method == "cancel_positioning_agv") {
- this.positioningAgv = false
+ if (this.mapOperationType == "public_teaching" &&
+ this.mapOperationStatus == "teaching") {
+ this.positioningAgv = true
+ } else
+ this.positioningAgv = false
} else if (param.method == "show_log") {
const listLog = session.getValue("request_log") || []
listLog.unshift(param.data)
session.setValue("request_log", listLog)
}
-
-
},
clickMapStation() {
this.stationEdit = {
@@ -1192,7 +1257,7 @@
this.mapOperationStatus = ""
this.teachingModeCur = {
mode: "Public",
- main_road: 1,
+ mode_type: 0,
}
this.positioningAgv = true
this.mapOperationType = "public_teaching"
@@ -1214,9 +1279,7 @@
async loadSceneList() {
try {
- uni.showLoading({
- title: "鍔犺浇鍦烘櫙涓�
- })
+
const _this = this
const res = await getAllScene(this.vehicleIp) || []
const list = res?.sceneList || []
@@ -1232,25 +1295,27 @@
// sceneId: "",
// navigationBarTitle: "鍦板浘"
// })
- uni.navigateTo({
- url: `/pages/map/scene?ip=${this.vehicleIp}&opType=create`,
- events: {
- // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
- create_finish: function(data) {
- _this.onCreateSceneOk(data)
- },
- }
+ // uni.navigateTo({
+ // url: `/pages/map/scene?ip=${this.vehicleIp}`,
+ // events: {
+ // // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
+ // create_finish: function(data) {
+ // _this.onCreateSceneOk(data)
+ // },
+ // }
+ // })
+ uni.navigateBack({
+ delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
})
return
}
} catch (ex) {
showError(ex)
- } finally {
- uni.hideLoading()
}
},
clickDelete() {
+ const _this = this
showModal(`鍒犻櫎鍦烘櫙[${this.sceneId}]浼氭妸鍦烘櫙瀵瑰簲鐨勫湴鍥句换鍔′俊鎭兘浼氬垹闄わ紝鏄惁纭鍒犻櫎锛焋, "鍒犻櫎鍦烘櫙").then(async (res) => {
if (res) {
try {
@@ -1262,6 +1327,15 @@
await this.loadSceneList()
if (this.sceneList.length > 0)
this.changeMap(this.sceneList[0])
+ // else {
+ // _this.mapOperationType = ""
+ // setTimeout(() => {
+ // uni.navigateBack({
+ // delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
+ // })
+ // }, 500)
+
+ // }
} catch (ex) {
showError(ex)
} finally {
@@ -1431,14 +1505,23 @@
showToast("鍦烘櫙鍚嶇О涓嶈兘涓虹┖锛�)
return
}
- console.log(name, this.sceneId)
+ // console.log(name, this.sceneId)
if (name == this.sceneId) {
showToast("鍦烘櫙鍚嶇О鏈彉鍖栵紒")
return
}
+ const curIndex = this.sceneList.findIndex((param) => param == this.sceneId)
this.mapOperationType = ""
await updateScene(this.vehicleIp, this.sceneId, name)
+
+
this.sceneId = name
+ if (curIndex > -1) {
+ this.sceneList[curIndex] = name
+ }
+ this.setData({
+ navigationBarTitle: name
+ })
showToast("鍦烘櫙閲嶅懡鍚嶆垚鍔燂紒")
} catch (ex) {
this.mapOperationType = "edit_scene_name"
@@ -1471,7 +1554,27 @@
this.mapOperationType = ""
},
clickStationDelete() {
- this.stationDelete(this.stationEdit)
+ const _this = this
+ uni.navigateTo({
+ url: `/pages/station/delete?ip=${ this.vehicleIp}`,
+ events: {
+ // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
+ delete_finish: function(data) {
+ console.log(data)
+ const list = data.map((a) => {
+ return {
+ stationID: a
+ }
+
+ })
+ _this.ctxDataStr = JSON.stringify([{
+ method: "remove_station",
+ param: list
+ }])
+ }
+ }
+ })
+ //this.stationDelete(this.stationEdit)
// const _this = this
// showModal("璇ョ珯鐐瑰凡缁戝畾浠诲姟锛屽垹闄ょ珯鐐瑰悗缁戝畾鐨勪换鍔′細鍋滄骞跺垹闄�, "鏄惁纭鍒犻櫎锛�).then((res) => {
// if (res) {
@@ -1770,10 +1873,8 @@
return resAngle
},
-
touchAngleChange(e) {
let angle = 0
-
const ptX = e.touches[0].clientX
const offX = ptX // ptX - e.target.offsetLeft
@@ -1876,7 +1977,7 @@
try {
const {
data
- } = await getTeachingMode(this.vehicleIp)
+ } = await splitTeachingMode(this.vehicleIp)
return data || {
Public: [],
Stations: []
@@ -1911,12 +2012,7 @@
show: this.showTeachingPathFlag
}
}
- // , {
- // method: "show_teaching_path",
- // param: {
- // show: this.showTeachingPathFlag
- // }
- // }
+
]
if (finish) {
list.push({
@@ -1979,40 +2075,110 @@
method: "update_agv_state",
param: agv
}]
+ // if (this.mapOperationType === "public_teaching" && this.mapOperationStatus ===
+ // "teaching") {
+ const list = await this.loadCurrentTeachingData()
- if (this.mapOperationType === "public_teaching" && this.mapOperationStatus ===
- "teaching") {
- const list = await this.loadCurrentTeachingData()
- listCtrData.push({
- method: "update_current_teaching",
- param: {
- main_road: this.teachingModeCur.main_road,
- pos_list: list
+ listCtrData.push({
+ method: "update_current_teaching",
+ param: {
+ main_road: 1, //this.teachingModeCur.main_road,
+ pos_list: list
+ }
+ })
+ if (list.length > 0) {
+ this.curTeachingPathFlag = true
+ } else {
+ if (this.curTeachingPathFlag) {
+ this.curTeachingPathFlag = false
+ const teaching = await this.loadTeachingMode()
+
+ const publicOld = this.teachingMode.Public || []
+ const stationOld = this.teachingMode.Stations || []
+ const publicNew = teaching.Public || []
+ const stationNew = teaching.Stations || []
+ const publicAdd = []
+ const stationAdd = []
+ for (let i in publicNew) {
+ const item = publicNew[i]
+ const curIndex = publicOld.findIndex((a) => a.name == item.name)
+ console.log(curIndex, item)
+ if (curIndex < 0) {
+ publicAdd.push(item)
+ publicOld.push(item)
+ }
+
}
- })
+ for (let i in stationNew) {
+ const item = stationNew[i]
+ const curIndex = stationOld.findIndex((a) => a.name == item.name)
+ if (curIndex < 0) {
+ stationAdd.push(item)
+ stationOld.push(item)
+ }
+
+ }
+ this.teachingMode.Public = publicOld
+ this.teachingMode.Stations = stationOld
+
+ if (publicAdd.length > 0) {
+ listCtrData.push({
+ method: "public_teaching_path",
+ param: {
+ list: publicAdd,
+ show: this.showTeachingPathFlag
+ }
+ })
+ }
+ if (stationAdd.length > 0) {
+ listCtrData.push({
+ method: "station_teaching_path",
+ param: {
+ list: stationAdd,
+ show: this.showTeachingPathFlag
+ }
+ })
+ }
+ }
}
+
+ // }
+
if (this.positioningAgv) {
- listCtrData.push({
- method: "move_pt_visible",
- param: {
- x: agv.x,
- y: agv.y,
- width: 80,
- height: 80,
- }
- })
+ if (this.curTeachingPathFlag) {
+ listCtrData.push({
+ method: "move_pt_center",
+ param: {
+ x: agv.x,
+ y: agv.y,
+ }
+ })
+ } else {
+ listCtrData.push({
+ method: "move_pt_visible",
+ param: {
+ x: agv.x,
+ y: agv.y,
+ width: 80,
+ height: 80,
+ }
+ })
+
+ }
}
+
this.ctxDataStr = JSON.stringify(listCtrData)
}
- setTimeout(this.refreshAgvPosition, 1000);
+ //setTimeout(this.refreshAgvPosition, 1000);
} catch (ex) {
- showError(ex).then((res) => {
- setTimeout(this.refreshAgvPosition, 1000);
- })
+ // showError(ex).then((res) => {
+
+ // })
+ showToast(ex)
} finally {
// 鏃犺鎴愬姛澶辫触锛� 绉掑悗鍐嶆潵
-
+ setTimeout(this.refreshAgvPosition, 1000);
}
},
@@ -2044,7 +2210,6 @@
uni.hideLoading()
}
},
-
async clickTeachingStart() {
const _this = this
@@ -2080,8 +2245,20 @@
if (res) {
try {
this.loading = true
- await delTeachingMode(_this.vehicleIp, [_this.teachingModeCur])
+ //await delTeachingMode(_this.vehicleIp, [_this.teachingModeCur])
+ await deleteSplitTeachingData(_this.vehicleIp, _this.teachingModeCur.edge_name,
+ _this.teachingModeCur.name)
_this.mapOperationStatus = ""
+ const listDataStr = []
+ listDataStr.push({
+ method: "remove_teaching_path",
+ param: {
+ name: _this.teachingModeCur.name,
+ mode: "Public"
+ },
+ })
+ _this.ctxDataStr = JSON.stringify(listDataStr)
+
} catch (ex) {
showError(ex)
@@ -2090,8 +2267,7 @@
}
} else {
- _this.mapOperationStatus =
- "save"
+ _this.mapOperationStatus = "save"
}
})
@@ -2108,7 +2284,7 @@
clickTeachingFinish() {
this.mapOperationType = ""
- this.reloadTeachingMode(true)
+ //this.reloadTeachingMode(true)
},
async teachingStart(mode) {
@@ -2138,15 +2314,15 @@
}
} else {*/
- const main_road = this
+ const mode_type = this
.teachingModeCur
- .main_road
+ .mode_type
this.teachingModeCur = {
mode: "Public",
src_dst: ``,
name: "",
teaching_flag: 1,
- main_road
+ mode_type
}
const res2 =
await teachingModeFlag(
@@ -2175,10 +2351,12 @@
// } else {
// this.askTeachingBiDirection(this.teachingModeCur)
// }
- this.askTeachingBiDirection(
- this
- .teachingModeCur
- )
+ // this.askTeachingBiDirection(
+ // this
+ // .teachingModeCur
+ // )
+ this.teachingModeCur.teaching_flag = 0
+ await this.finishTeaching(this.teachingModeCur)
} catch (ex) {
showError(ex)
} finally {
@@ -2186,22 +2364,28 @@
}
},
- async onTeachingModeMainRoad(val) {
+ async onTeachingModeType(val) {
try {
if (this.mapOperationStatus) {
- if (this.teachingModeCur.main_road == val) {
+ if (this.teachingModeCur.mode_type == val) {
return
}
this.teachingModeCur.teaching_flag = 0
const oldName = this.teachingModeCur.name
await teachingModeFlag(this.vehicleIp, this.teachingModeCur)
- this.teachingModeCur.main_road = val
+ this.teachingModeCur.mode_type = val
this.teachingModeCur.teaching_flag = 1
this.teachingModeCur.mode = "Public"
this.teachingModeCur.name = ""
const res = await teachingModeFlag(this.vehicleIp, this.teachingModeCur)
- if (val == 0)
+ if (val == 1)
+ showToast("宸插皢绀烘暀鍒囨崲鎴愬弻鍚戞ā寮�)
+ else if (val == 2)
+ showToast("宸插皢绀烘暀鍒囨崲鎴愭櫤鑳芥ā寮�)
+ else
+ showToast("宸插皢绀烘暀鍒囨崲鎴愰粯璁ゆā寮�)
+ /*if (val == 0)
showToast(
"宸插皢璇ヨ矾娈佃矾寰勪繚瀛樹负涓昏矾绀烘暀璺嚎"
)
@@ -2214,7 +2398,7 @@
const {
data
- } = await getTeachingMode(this.vehicleIp)
+ } = await splitTeachingMode(this.vehicleIp)
const publicList = data.Public || []
const curIndex = publicList.findIndex((a) => a.name == oldName)
@@ -2229,12 +2413,10 @@
}])
}
-
+*/
} else {
- this.teachingModeCur
- .main_road =
- val
+ this.teachingModeCur.mode_type = val
}
} catch (ex) {
@@ -2252,30 +2434,64 @@
},
clickTeachingEdit() {
- this.$refs
- .refPopupOperateTeaching
- .close()
- this.mapOperationType =
- "edit_teaching"
- this.ctxDataStr = JSON
- .stringify([{
- method: "edit_teaching",
- param: this.selectTeachingMode,
- }])
+ this.$refs.refPopupOperateTeaching.close()
+ this.$refs.refPopupTeachingUpdate.open("")
+
+ // this.mapOperationType =
+ // "edit_teaching"
+ // this.ctxDataStr = JSON
+ // .stringify([{
+ // method: "edit_teaching",
+ // param: this.selectTeachingMode,
+ // }])
+ },
+ radioTeachinMainRoadChange(e) {
+ this.selectTeachingMode.main_road = evt.detail.value
+ },
+ radioTeachinBidirectionChange(evt) {
+ this.selectTeachingMode.bidirection = evt.detail.value
+ },
+ async dialogTeachingUpdateConfirm() {
+ try {
+ uni.showLoading({
+ title: "鏇存柊绀烘暀涓�
+ })
+ const item = this.selectTeachingMode
+ await updateSplitTeachingData(this.vehicleIp, item)
+ this.ctxDataStr =
+ JSON.stringify(
+ [{
+ method: "update_teaching",
+ param: item,
+ }])
+ this.selectTeachingMode = {}
+ showToast("鏇存柊绀烘暀鎴愬姛")
+ } catch (ex) {
+ showError(
+ ex)
+ } finally {
+ uni.hideLoading()
+ }
+ },
+ dialogTeachingUpdateClose() {
+ this.$refs.refPopupTeachingUpdate.close()
+
},
async removeTeachingMode(item) {
try {
uni.showLoading({
- title: "鍒犻櫎鍦烘櫙涓�
+ title: "鍒犻櫎绀烘暀涓�
})
- await delTeachingMode(this.vehicleIp, [item])
+ await deleteSplitTeachingData(this.vehicleIp, item.edge_name, item.name)
+ //await delTeachingMode(this.vehicleIp, [item])
this.ctxDataStr =
JSON.stringify(
[{
method: "remove_teaching_path",
param: item,
}])
+ showToast("鍒犻櫎绀烘暀鎴愬姛")
} catch (ex) {
showError(
ex)
@@ -2286,9 +2502,11 @@
async removeTeachingModeData(data) {
try {
uni.showLoading({
- title: "鍒犻櫎鍦烘櫙鏁版嵁涓�
+ title: "鍒犻櫎绀烘暀鏁版嵁涓�
})
- await delTeachingModeData(this.vehicleIp, data)
+ await deleteSplitTeachingData(this.vehicleIp, data.edge_name, data.name)
+ //await delTeachingModeData(this.vehicleIp, data)
+ showToast("鍒犻櫎绀烘暀鎴愬姛")
this.reloadTeachingMode()
} catch (ex) {
showError(ex)
@@ -2737,7 +2955,8 @@
.switch-button-checked {
box-shadow: 0px 2px 8px 0px #0000000C;
background-color: #fff;
- color: #262626;
+ color: #1890FF;
+
}
}
--
Gitblit v1.9.1