cuiqian2004
2025-09-19 d8743368ffda9bc0fb2c6818f695a9a6b1079e57
laster
2个文件已删除
27个文件已修改
2325 ■■■■■ 已修改文件
api/request.js 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
comm/utils.js 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/backup.vue 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/connect.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/detail.vue 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.vue 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/edit.vue 345 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/index.vue 242 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/index2.vue 383 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/infos/scene-create.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/js/ctx-mini.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/js/ctx.js 443 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/scene.vue 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/task.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/map/teaching.vue 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/my/log-detail.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/station/index.vue 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/task/add.vue 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/task/infos/task-item.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/task/infos/task-log-item.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/task/list.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/task/log-list.vue 253 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/task/update.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/teaching/index.vue 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/teaching/list.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/request.js
@@ -8,7 +8,8 @@
        //     "Content-Type": "application/json;charset=UTF-8"
        // },
        method: "GET",
        dataType: "json"
        dataType: "json",
    },
    addLog(item) {
        const list = session.getValue("request_log") || []
@@ -28,7 +29,7 @@
            return
        }
        list.unshift(item)
        if (list.length > 1000) {
        if (list.length > 512) {
            const oldItem = list.pop()
            if (oldItem.data_key) {
                const maxData = session.getValue("request_log_max_data") || {}
@@ -47,7 +48,7 @@
        options.method = options.method || this.common.method;
        options.dataType = options.dataType || this.common.dataType;
        
        if(options.url.indexOf("get_agv_state") < 0)
        if(options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0)
        {
            console.log("url", options.url, options.data)
        }
@@ -60,7 +61,7 @@
                method: options.method,
                dataType: options.dataType,
                success: (result) => {
                    if(options.url.indexOf("get_agv_state") < 0)
                    if(options.url.indexOf("get_agv_state") < 0 && options.url.indexOf("laser_data") < 0)
                    {
                        console.log("result", result)
                    }
@@ -121,7 +122,7 @@
                    } else {
                        reject({
                            msg: ret.msg || ""
                            msg: ret.msg || ret.message|| ""
                        });
                    }
                },
comm/utils.js
@@ -18,35 +18,77 @@
    })
}
export function showToast(title, icon) {
    uni.showToast({
        title: title,
        icon: icon ? icon : 'none'
    })
}
export function showInfo(ex){
    if( !ex)
export function showToast(ex) {
    if (!ex)
        return
     let tip =ex
     console.log(ex);
    if( typeof ex !== "string" )
    {
    let tip = ex
    // console.log(ex);
    if (typeof ex !== "string") {
        let exStr = JSON.stringify(ex)
        if (exStr == "{}")
            exStr = ex
        tip = typeof ex.errMsg == "string" ? ex.errMsg :typeof ex.message == "string" ? ex.message: exStr
        tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message ==
            "string" ? ex.message : exStr
    }
    plus.nativeUI.toast(tip , {duration:"short"});
    plus.nativeUI.toast(tip, {
        duration: "short",
        verticalAlign: "center"
    });
    // uni.showToast({
    //     title: title,
    //     icon: icon ? icon : 'none'
    // })
}
export function showInfo(ex) {
    if (!ex)
        return
    let tip = ex
    // console.log(ex);
    if (typeof ex !== "string") {
        let exStr = JSON.stringify(ex)
        if (exStr == "{}")
            exStr = ex
        tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message ==
            "string" ? ex.message : exStr
    }
    // plus.nativeUI.toast(tip, {
    //     duration: "short",
    //     verticalAlign:"center"
    // });
    return uni.showModal({
        title: "提示",
        content: tip,
        showCancel: false
    });
}
export function showError(ex, title = "错误") {
    if (!ex)
        return
    let tip = ex
    console.log(ex);
    if (typeof ex !== "string") {
        let exStr = JSON.stringify(ex)
        if (exStr == "{}")
            exStr = ex
        tip = typeof ex.errMsg == "string" ? ex.errMsg : typeof ex.msg == "string" ? ex.msg : typeof ex.message ==
            "string" ? ex.message : exStr
    }
    //plus.nativeUI.alert(tip,title);
    return uni.showModal({
        title: title || "",
        content: tip,
        showCancel: false
    });
}
export function showLoading(title) {
    uni.showLoading({
        title: title,
        mask: true
    })
}
export function hexToRGBA(hex, alpha) {
    const r = parseInt(hex.slice(1, 3), 16);
    const g = parseInt(hex.slice(3, 5), 16);
manifest.json
@@ -2,8 +2,8 @@
    "name" : "ES-GO",
    "appid" : "__UNI__C988375",
    "description" : "",
    "versionName" : "1.2.6",
    "versionCode" : 126,
    "versionName" : "1.2.9",
    "versionCode" : 129,
    "transformPx" : false,
    /* 5+App特有相关 */
    "app-plus" : {
package-lock.json
@@ -7,7 +7,6 @@
      "dependencies": {
        "ant-design-vue": "^4.0.0-rc.6",
        "antd-mobile-vue-next": "^0.1.0-16",
        "dayjs": "^1.11.13",
        "fabric": "^6.6.7",
        "rxjs": "^7.8.2",
        "uuid": "^11.1.0"
@@ -1338,9 +1337,9 @@
      }
    },
    "node_modules/dayjs": {
      "version": "1.11.13",
      "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
      "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==",
      "version": "1.11.18",
      "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.18.tgz",
      "integrity": "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA==",
      "license": "MIT"
    },
    "node_modules/debounce": {
package.json
@@ -2,7 +2,6 @@
  "dependencies": {
    "ant-design-vue": "^4.0.0-rc.6",
    "antd-mobile-vue-next": "^0.1.0-16",
    "dayjs": "^1.11.13",
    "fabric": "^6.6.7",
    "rxjs": "^7.8.2",
    "uuid": "^11.1.0"
pages.json
@@ -108,12 +108,7 @@
                "navigationBarTitleText": "地图"
            }
        },
        {
            "path": "pages/map/edit",
            "style": {
                "navigationBarTitleText": "编辑地图"
            }
        },
        {
            "path": "pages/map/teaching",
            "style": {
pages/index/backup.vue
@@ -72,7 +72,8 @@
        session,
        showToast,
        showModal,
        showInfo
        showInfo,
        showError
    } from "@/comm/utils.js"
    import {
        getAllScene,
@@ -139,7 +140,7 @@
                    
                    console.log(this.pageList[1].list)
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async loadScene() {
@@ -148,7 +149,7 @@
                    const list = res?.sceneList || []
                    return list
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -157,7 +158,7 @@
                    const list = session.getValue("scene_db") || []
                    return list
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -211,6 +212,9 @@
                    this.setData({
                        loading: true
                    })
                    uni.showLoading({
                        title:"正在上传场景"
                    })
                    const scene = this.pageList[0].list[index]
                    await handoffScene(this.ip, "", scene)
                    session.setValue("scene_db", [])
@@ -222,15 +226,16 @@
                    session.setValue("scene_db", list)
                    this.pageList[1].list = list
                    this.sceneIndex2 = -1
                    this.setData({
                        loading: false
                    })
                    showToast(`上传场景[${scene}]成功`)
                } catch (ex) {
                    showInfo(ex)
                    showError(ex)
                }
                finally {
                    this.setData({
                        loading: false
                    })
                    uni.hideLoading()
                }
            },
@@ -256,30 +261,29 @@
                    this.setData({
                        loading: true
                    })
                    console.log(this.pageList[1].list[index])
                    uni.showLoading({
                        title:"正在下载场景"
                    })
                    const data = this.pageList[1].list[index].data
                    const scene = this.pageList[1].list[index].name
                    await saveDBData(this.ip, data)
                    this.pageList[0].list.push(scene)
                    this.setData({
                        loading: false
                    })
                    showToast(`下载场景[${scene}]成功`)
                } catch (ex) {
                    showInfo(ex)
                    showError(ex)
                }
                finally {
                    this.setData({
                        loading: false
                    })
                    uni.hideLoading()
                }
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false, "确定")
            },
        }
    }
</script>
pages/index/connect.vue
@@ -56,7 +56,9 @@
    import {
        session,
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -143,7 +145,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            checkConnectStatus() {
@@ -181,11 +183,11 @@
                            const result = res.result || ""
                            const arCode = result.split(";")
                            if (arCode.length != 3) {
                                this.showError("无效的二维码!")
                                showInfo("无效的二维码!")
                                return
                            }
                            if (!arCode[0].trim() || !arCode[0].trim()) {
                        this.showError("无效的二维码!")
                        showInfo("无效的二维码!")
                                return
                            }
                            that.ip = arCode[0]
@@ -291,7 +293,7 @@
                } catch (ex) {
                    console.log("connectVehicle faile",this.ip,ex)
                    this.connectState = 3
                    // this.showError(ex)
                    // showError(ex)
                }
            },
@@ -360,14 +362,6 @@
                    }, 2000)
                })
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false,"确定")
            },
        }
    }
</script>
pages/index/detail.vue
@@ -71,7 +71,9 @@
<script>
    import {
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -129,7 +131,7 @@
                    const info = await shellVersion(this.vehicleIp)
                    this.car_version = info.software_version
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickDelete() {
@@ -164,13 +166,7 @@
                    delta: 1
                })
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false,"确定")
            },
        }
    }
pages/index/index.vue
@@ -123,7 +123,9 @@
    import {
        session,
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        getAllScene,
@@ -280,7 +282,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -304,7 +306,7 @@
                    this.pageList = [...list]
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -409,7 +411,7 @@
                        }
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async checkConnectSuccess(ip) {
@@ -532,7 +534,7 @@
                        }
                    })
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -618,13 +620,6 @@
                        url: `/pages/index/backup?ip=${page.ip}`
                    })
                }
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false, "确定")
            },
            closeMenu() {
                this.$refs.refPopupMenu.close()
pages/map/edit.vue
File was deleted
pages/map/index.vue
@@ -393,6 +393,8 @@
        showToast,
        showModal,
        session,
        showError,
        showInfo
    } from "@/comm/utils.js"
    // import OIFabric from "@/components/oi-fabric/index.vue"
    import {
@@ -480,6 +482,7 @@
                    img_x: 1,
                    img_y: 1
                },
                positioningAgv: false
            }
        },
        computed: {
@@ -575,7 +578,7 @@
                    this.setData({
                        unlinked: true
                    })
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -719,11 +722,12 @@
                        showModal("已记录的路径将会被删除。", "是否要退出示教?").then(async (res) => {
                            if (res) {
                                if (mapOperationStatus == 'end' || mapOperationStatus == 'save') {
                                if (this.mapOperationStatus == 'end' || this.mapOperationStatus ==
                                    'save') {
                                    try {
                                        await delTeachingMode(this.vehicleIp, [_this.teachingModeCur])
                                        await delTeachingMode(this.vehicleIp, [this.teachingModeCur])
                                    } catch (ex) {
                                        this.showError(ex)
                                        showError(ex)
                                    }
                                }
@@ -806,7 +810,7 @@
                    const info = await getAgvState(this.vehicleIp)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -815,7 +819,7 @@
                    const paths = await getCurrentTeachingData(this.vehicleIp) || []
                    return paths
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -825,7 +829,7 @@
                    const info = await stations(this.vehicleIp)
                    return info.station_list || []
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -834,7 +838,7 @@
                    const info = await getMapUrl(this.vehicleIp, id)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -864,20 +868,21 @@
                try {
                    this.setData({
                        bgProgressPercent: 0,
                        bgLoading: true
                    })
                    const infoAgv = await this.loadAgvState()
                    const stationLst = await this.loadStations()
                    const infoMap = await this.loadMapInfo(id)
                    this.curMapInfo = {
                        proportion: infoMap.proportion || 1,
                        img_proportion: infoMap.img_proportion || 1,
                        max_x: infoMap.max_x || 1,
                        max_y: infoMap.max_y || 1,
                        min_x: infoMap.min_x || 0,
                        min_y: infoMap.min_y || 0,
                        img_x: infoMap.img_x || 1,
                        img_y: infoMap.img_y || 1
                        proportion: parseInt(infoMap.proportion) || 1,
                        img_proportion: parseInt(infoMap.img_proportion) || 1,
                        max_x: parseInt(infoMap.max_x) || 1,
                        max_y: parseInt(infoMap.max_y) || 1,
                        min_x: parseInt(infoMap.min_x) || 0,
                        min_y: parseInt(infoMap.min_y) || 0,
                        img_x: parseInt(infoMap.img_x) || 1,
                        img_y: parseInt(infoMap.img_y) || 1
                    }
                    // getApp().globalData.curScene = infoMap
                    this.setData({
@@ -914,20 +919,21 @@
                        },
                        {
                            method: "move_canvas",
                            method: "move_pt_center",
                            param: {
                                x: infoAgv.x,
                                y: infoAgv.y
                            }
                        }
                    ])
                    this.positioningAgv = true
                    this.mapShowAgv = true
                } catch (ex) {
                    this.setData({
                        bgProgressPercent: 0,
                        bgLoading: false
                    })
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -1086,7 +1092,14 @@
                    }
                    this.$refs.refPopupOperateTeaching.open("bottom")
                } else if (param.method == "cancel_positioning_agv") {
                    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() {
@@ -1138,11 +1151,9 @@
                    mode: "Public",
                    main_road: 1,
                }
                this.positioningAgv = true
                this.mapOperationType = "public_teaching"
                this.ctxDataStr = JSON.stringify([{
                    method: "set_selectable",
                    param: false,
                }, {
                    method: "public_teaching",
                }])
@@ -1190,7 +1201,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    uni.hideLoading()
                }
@@ -1208,7 +1219,7 @@
                            if (this.sceneList.length > 0)
                                this.changeMap(this.sceneList[0])
                        } catch (ex) {
                            this.showError(ex)
                            showError(ex)
                        } finally {
                            uni.hideLoading()
                        }
@@ -1263,7 +1274,7 @@
                                param: [this.regionEdit]
                            },
                            {
                                method: "move_canvas",
                                method: "move_pt_center",
                                param: {
                                    x: agv.x,
                                    y: agv.y
@@ -1272,7 +1283,7 @@
                        ])
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async clickPlanProhibitionRegion() {
@@ -1309,7 +1320,7 @@
                                param: [this.regionEdit]
                            },
                            {
                                method: "move_canvas",
                                method: "move_pt_center",
                                param: {
                                    x: agv.x,
                                    y: agv.y
@@ -1318,7 +1329,7 @@
                        ])
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -1350,7 +1361,7 @@
                            param: [this.wallEdit]
                        },
                        {
                            method: "move_canvas",
                            method: "move_pt_center",
                            param: {
                                x: agv.x,
                                y: agv.y
@@ -1358,7 +1369,7 @@
                        }
                    ])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -1387,7 +1398,7 @@
                    showToast("场景重命名成功!")
                } catch (ex) {
                    this.mapOperationType = "edit_scene_name"
                    this.showError(ex)
                    showError(ex)
                } finally {
                    uni.hideLoading()
                    this.loading = false
@@ -1416,12 +1427,13 @@
                this.mapOperationType = ""
            },
            clickStationDelete() {
                const _this = this
                showModal("该站点已绑定任务,删除站点后绑定的任务会停止并删除", "是否确认删除?").then((res) => {
                    if (res) {
                        this.stationDelete(this.stationEdit)
                    }
                })
                this.stationDelete(this.stationEdit)
                // const _this = this
                // showModal("该站点已绑定任务,删除站点后绑定的任务会停止并删除", "是否确认删除?").then((res) => {
                //     if (res) {
                //     }
                // })
            },
            async stationAdd(item) {
                try {
@@ -1440,7 +1452,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    uni.hideLoading()
                }
@@ -1463,7 +1475,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    uni.hideLoading()
                }
@@ -1477,6 +1489,7 @@
                        this.stationAdd(this.stationEdit)
                        this.mapOperationType = "public_teaching"
                        this.mapOperationStatus = "teaching"
                        this.positioningAgv = true
                        return
                    } else if (this.mapOperationType == "edit_station") {
                        this.stationUpdate(this.stationEdit)
@@ -1487,7 +1500,7 @@
                    }])
                    this.mapOperationType = ''
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async stationDelete(item) {
@@ -1514,7 +1527,7 @@
                    }])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    uni.hideLoading()
                }
@@ -1559,14 +1572,14 @@
            },
            async clickStationNameOK() {
                try {
                    this.loading = true
                    const name = this.stationEdit.name.trim()
                    if (!name) {
                        showToast("站点名称还未输入")
                        return
                    }
                    if (this.mapOperationType == 'add_station' || this
                        .mapOperationType == "teaching_add_station") {
                    this.loading = true
                    if (this.mapOperationType == 'add_station' || this.mapOperationType == "teaching_add_station") {
                        const agv = await this.loadAgvState()
                        this.stationEdit = {
                            stationID: this.getMaxStationNo + 1,
@@ -1589,7 +1602,7 @@
                            method: "edit_station_pos",
                            param: this.stationEdit
                        }, {
                            method: "move_canvas",
                            method: "move_pt_center",
                            param: {
                                x: agv.x,
                                y: agv.y
@@ -1613,7 +1626,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    this.loading = false
                }
@@ -1639,7 +1652,7 @@
                    method: "update_station",
                    param: [this.stationEdit]
                }, {
                    method: "move_canvas",
                    method: "move_pt_center",
                    param: {
                        x: this.stationEdit.x,
                        y: this.stationEdit.y
@@ -1654,7 +1667,7 @@
                    method: "update_station",
                    param: [this.stationEdit]
                }, {
                    method: "move_canvas",
                    method: "move_pt_center",
                    param: {
                        x: this.stationEdit.x,
                        y: this.stationEdit.y
@@ -1667,7 +1680,7 @@
                    method: "update_station",
                    param: [this.stationEdit]
                }, {
                    method: "move_canvas",
                    method: "move_pt_center",
                    param: {
                        x: this.stationEdit.x,
                        y: this.stationEdit.y
@@ -1680,7 +1693,7 @@
                    method: "update_station",
                    param: [this.stationEdit]
                }, {
                    method: "move_canvas",
                    method: "move_pt_center",
                    param: {
                        x: this.stationEdit.x,
                        y: this.stationEdit.y
@@ -1766,19 +1779,20 @@
            async clickVehiclePosition() {
                try {
                    this.positioningAgv = true
                    const infoAgv = await this.loadAgvState()
                    this.ctxDataStr = JSON.stringify([{
                        method: "update_agv_state",
                        param: infoAgv
                    }, {
                        method: "move_canvas",
                        method: "move_pt_center",
                        param: {
                            x: infoAgv.x,
                            y: infoAgv.y
                        }
                    }])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async clickPositionStation() {
@@ -1801,7 +1815,7 @@
                            param: [this.stationEdit]
                        },
                        {
                            method: "move_canvas",
                            method: "move_pt_center",
                            param: {
                                x: infoAgv.x,
                                y: infoAgv.y
@@ -1811,7 +1825,7 @@
                    ])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async loadTeachingMode() {
@@ -1825,7 +1839,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {
                        Public: [],
                        Stations: []
@@ -1836,6 +1850,9 @@
                try {
                    this.teachingMode = await this.loadTeachingMode()
                    this.ctxDataStr = JSON.stringify([{
                            method: "clear_teaching_path",
                        },
                        {
                            method: "public_teaching_path",
                            param: this.teachingMode.Public || []
                        },
@@ -1851,7 +1868,7 @@
                    ])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -1893,14 +1910,13 @@
                        }
                    ])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async refreshAgvPosition() {
                try {
                    if (this.isPageVisible && this.mapShowAgv) {
                        const agv = await this.loadAgvState()
                        const listCtrData = [{
                            method: "update_agv_state",
                            param: agv
@@ -1917,13 +1933,28 @@
                                }
                            })
                        }
                        if (this.positioningAgv) {
                            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);
                } catch (ex) {
                    this.showError(ex)
                    showError(ex).then((res) => {
                        setTimeout(this.refreshAgvPosition, 1000);
                    })
                } finally {
                    // 无论成功失败,1 秒后再来
                    setTimeout(this.refreshAgvPosition, 1000);
                }
            },
@@ -1946,12 +1977,11 @@
                    uni.showLoading({
                        title: "示教结束"
                    })
                    await teachingModeFlag(this.vehicleIp,
                        teachingMode)
                    await teachingModeFlag(this.vehicleIp, teachingMode)
                    this.mapOperationStatus = "end"
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    uni.hideLoading()
                }
@@ -1969,7 +1999,7 @@
                    await _this.teachingStart("Public")
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    this.loading = false
                    uni.hideLoading()
@@ -1996,7 +2026,7 @@
                                _this.mapOperationStatus = ""
                            } catch (ex) {
                                this.showError(ex)
                                showError(ex)
                            } finally {
                                this.loading = false
                            }
@@ -2013,7 +2043,7 @@
                this.mapOperationStatus = "save"
                try {} catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -2071,7 +2101,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -2094,41 +2124,27 @@
                        .teachingModeCur
                    )
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    this.loading = false
                }
            },
            async onTeachingModeMainRoad(
                val) {
            async onTeachingModeMainRoad(val) {
                try {
                    if (this
                        .mapOperationStatus
                    ) {
                    if (this.mapOperationStatus) {
                        if (this
                            .teachingModeCur
                            .main_road ==
                            val) {
                        if (this.teachingModeCur.main_road == val) {
                            return
                        }
                        this.teachingModeCur
                            .main_road =
                            val
                        this.teachingModeCur
                            .teaching_flag =
                            1
                        this.teachingModeCur
                            .mode =
                            "Public"
                        const res =
                            await teachingModeFlag(
                                this
                                .vehicleIp,
                                this
                                .teachingModeCur
                            )
                        this.teachingModeCur.teaching_flag = 0
                        const oldName = this.teachingModeCur.name
                        await teachingModeFlag(this.vehicleIp, this.teachingModeCur)
                        this.teachingModeCur.main_road = val
                        this.teachingModeCur.teaching_flag = 1
                        this.teachingModeCur.mode = "Public"
                        this.teachingModeCur.name = ""
                        const res = await teachingModeFlag(this.vehicleIp, this.teachingModeCur)
                        if (val == 0)
                            showToast(
                                "已将该路段路径保存为主路示教路线"
@@ -2138,10 +2154,25 @@
                                "已将该路段路径保存为支路示教路线"
                            )
                        if (res?.name)
                            this
                            .teachingModeCur
                            .name = res
                            .name
                            this.teachingModeCur.name = res.name
                            const {
                                data
                            } = await getTeachingMode(this.vehicleIp)
                            const publicList = data.Public || []
                            const curIndex = publicList.findIndex((a)=>a.name == oldName)
                            if(curIndex > -1)
                            {
                                this.ctxDataStr = JSON.stringify([{
                                    method: "public_teaching_path",
                                    param: [publicList[curIndex]]
                                } ])
                            }
                    } else {
                        this.teachingModeCur
                            .main_road =
@@ -2149,7 +2180,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickTeachingDelete() {
@@ -2188,7 +2219,7 @@
                                param: item,
                            }])
                } catch (ex) {
                    this.showError(
                    showError(
                        ex)
                } finally {
                    uni.hideLoading()
@@ -2202,24 +2233,11 @@
                    await delTeachingModeData(this.vehicleIp, data)
                    this.reloadTeachingMode()
                } catch (ex) {
                    this.showError(
                        ex)
                    showError(ex)
                } finally {
                    uni.hideLoading()
                }
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : typeof ex.errMsg == "string" ? ex.errMsg : exStr
                showModal(tip,
                    "错误",
                    false,
                    "确定")
            },
        }
    }
pages/map/index2.vue
File was deleted
pages/map/infos/scene-create.vue
@@ -57,6 +57,8 @@
        showToast,
        showModal,
        session,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -139,7 +141,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async loadMapLaserData() {
@@ -147,7 +149,7 @@
                    const info = await getMapLaserData(this.ip)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -177,7 +179,7 @@
                    await createScene(this.ip, name, 1)
                    this.$emit('update:opSceneType', "scan");
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
pages/map/js/ctx-mini.js
@@ -2349,10 +2349,10 @@
                    deltaY = this.workSpace.height - eleHeight
                if (oldX + this.eleWidth >= info.x * zoom && info.x * zoom >= oldX) {
                    deltaX = -oldX
                    //console.log("move_canvas X", oldX)
                    //console.log("move_pt_center X", oldX)
                }
                if (oldY + eleHeight >= info.y * zoom && info.y * zoom >= oldY) {
                    //    console.log("move_canvas Y", oldY)
                    //    console.log("move_pt_center Y", oldY)
                    deltaY = -oldY
                }
                this.canvas.absolutePan(new fabric.Point(deltaX, deltaY));*/
@@ -3082,7 +3082,7 @@
                    } else if (item.method == "update_current_teaching") {
                        const info = item.param || []
                        await _this.updateCurrentTeaching(info)
                    } else if (item.method == "move_canvas") {
                    } else if (item.method == "move_pt_center") {
                        const info2 = item.param || {}
                        const pt = {
pages/map/js/ctx.js
@@ -21,6 +21,10 @@
    Result
} from "ant-design-vue";
import {
    session,
} from "../../../comm/utils.js"
// import okIcon from '../../../static/images/confirm.svg';
// import cancelIcon from '../../../static/images/remove.svg';
@@ -59,8 +63,7 @@
                img_x: 1,
                img_y: 1
            },
            pressObjTimer: 0
            pressObjTimer: 0,
        }
    },
    mounted() {
@@ -353,7 +356,9 @@
                mainObj: obj
            });
            this.canvas.add(objGroup)
            this.$ownerInstance.callMethod('receiveRenderData', {
                method: "cancel_positioning_agv",
            });
        },
        canvasEventListener() {
@@ -375,7 +380,7 @@
                _this.canvas.requestRenderAll();
                _this.onSelectionChanage()
                //_this.selectionChangeCanvas();
            });
            _this.canvas.on("selection:updated", function(e) {
                console.log("selection:updated", e);
@@ -409,9 +414,6 @@
            _this.canvas.on("object:modified", function(e) {
                // console.log("object:modified", e.target);
                // _this.resizetCanvas();
            });
            _this.canvas.on("object:moving", function(e) {
                console.log("object:moving", e.target);
@@ -497,41 +499,57 @@
                                const data = activeObj.mainObj?.data
                                data.path.push({
                                    x: _this.getActualXFromImg(activeObj.left),
                                    y: _this.getActualYFromImg(activeObj.top)
                                    x: _this.getActualXFromImg(activeObj.left) || 0,
                                    y: _this.getActualYFromImg(activeObj.top) || 0
                                })
                                _this.updateRegion(activeObj.mainObj, data)
                            } else if (activeObj.eleType == "cmd") {
                                let data = activeObj.mainObj.data
                                if (activeObj.mainObj.eleType == "edit_teaching") {
                                const objCmdMain = activeObj.mainObj
                                if (objCmdMain.eleType == "edit_teaching") {
                                    let left = _this.getActualXFromImg(activeObj.left)
                                    let top = _this.getActualYFromImg(activeObj.top)
                                    let right = _this.getActualXFromImg(activeObj.left + activeObj.width)
                                    let bottom = _this.getActualYFromImg(activeObj.top + activeObj.height)
                                    data = [
                                        [left, top],
                                        [left, bottom],
                                        [right, bottom],
                                        [right, top]
                                    ]
                                    const left = _this.getActualXFromImg(objCmdMain.left)
                                    const top = _this.getActualYFromImg(objCmdMain.top)
                                    const right = _this.getActualXFromImg(objCmdMain.left + objCmdMain.width)
                                    const bottom = _this.getActualYFromImg(objCmdMain.top + objCmdMain.height)
                                    data = []
                                    if (Number.isNaN(left) || Number.isNaN(top) || Number.isNaN(right) || Number
                                        .isNaN(bottom)) {
                                        const now = new Date()
                                        const date = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`
                                        _this.$ownerInstance.callMethod('receiveRenderData', {
                                            method: "show_log",
                                            data: {
                                                date,
                                                method: `POST`,
                                                url: "app/log/edit_teaching",
                                                param: objCmdMain,
                                                statusCode: 100,
                                                data: _this.mapInfo
                                            },
                                        });
                                    }
                                    data.push([left, top])
                                    data.push([left, bottom])
                                    data.push([right, bottom])
                                    data.push([right, top])
                                    console.log(data)
                                }
                                _this.$ownerInstance.callMethod('receiveRenderData', {
                                    method: "edit_finish",
                                    cmd: activeObj.id,
                                    type: activeObj.mainObj.eleType,
                                    type: objCmdMain.eleType,
                                    data: data,
                                });
                                if (activeObj.id == "ok") {
                                    if (activeObj.mainObj.eleType == "region") {
                                    if (objCmdMain.eleType == "region") {
                                        _this.addRegionFinish(activeObj.mainObj)
                                    } else if (activeObj.mainObj.eleType == "virtual_wall") {
                                        _this.addVirtualWallFinish(activeObj.mainObj)
                                    }
                                }
                                if (activeObj.mainObj.eleType == "edit_teaching") {
                                if (objCmdMain.eleType == "edit_teaching") {
                                    let list = _this.canvas.getObjects() || []
                                    for (let i2 in list) {
                                        const obj = list[i2]
@@ -539,29 +557,28 @@
                                            opacity: 1
                                        })
                                    }
                                    if (activeObj.mainObj?.mainObj) {
                                        activeObj.mainObj.mainObj.set({
                                    if (objCmdMain?.mainObj) {
                                        objCmdMain.mainObj.set({
                                            selectable: true
                                        })
                                    }
                                    const ptObjs = activeObj.mainObj.ptObjs || []
                                    _this.canvas.remove(activeObj.mainObj)
                                    const ptObjs = objCmdMain.ptObjs || []
                                    _this.canvas.remove(objCmdMain)
                                    for (let i2 in ptObjs) {
                                        const obj = ptObjs[i2]
                                        _this.canvas.remove(obj)
                                    }
                                }
                                if (activeObj.mainObj.eleType == "station") {
                                if (objCmdMain.eleType == "station") {
                                    _this.setAllObjectSelectable(true)
                                    activeObj.mainObj.tipObj.set({
                                        left: activeObj.mainObj.left,
                                        top: activeObj.mainObj.top - activeObj.mainObj.height / 2 -
                                            activeObj.mainObj
                                            .tipObj.height / 2,
                                    objCmdMain.tipObj.set({
                                        left: objCmdMain.left,
                                        top: objCmdMain.top - objCmdMain.height / 2 -
                                            objCmdMain.tipObj.height / 2,
                                        visible: true
                                    })
                                    activeObj.mainObj.tipObj.setCoords()
                                    objCmdMain.tipObj.setCoords()
                                }
                                _this.closeOkCancelControl()
@@ -735,7 +752,7 @@
            const objects = this.canvas.getObjects();
            objects.splice(0, 1);
            this.canvas.discardActiveObject()
            const objActive = this.canvas.getActiveObject()
            let pointerList = []
            let pointerList2 = []
@@ -745,14 +762,14 @@
                if (obj.selectable && obj.opacity > 0) {
                    if (obj instanceof fabric.Path || obj instanceof fabric.Line) {
                        if (this.isPointOnStroke(obj, pointer)) {
                            console.log(i, obj.eleType)
                            //    console.log(i, obj.eleType)
                            pointerList.unshift(obj)
                        }
                    } else {
                        const isHit = obj.containsPoint(pointer);
                        if (isHit) {
                            console.log(i, obj.eleType)
                            //    console.log(i, obj.eleType)
                            pointerList.unshift(obj)
                        }
@@ -764,26 +781,35 @@
                const obj = pointerList[i];
                if (obj instanceof fabric.Path || obj instanceof fabric.Line) {
                    if (this.isPointOnStroke(obj, pointer, 1)) {
                        this.canvas.discardActiveObject()
                        this.canvas.setActiveObject(obj);
                        this.canvas.requestRenderAll();
                        if (objActive != obj) {
                            this.canvas.discardActiveObject()
                            this.canvas.setActiveObject(obj);
                            this.canvas.requestRenderAll();
                        }
                        return
                    }
                    pointerList2.unshift(obj)
                } else {
                    this.canvas.discardActiveObject()
                    this.canvas.setActiveObject(obj);
                    this.canvas.requestRenderAll();
                    if (objActive != obj) {
                        this.canvas.discardActiveObject()
                        this.canvas.setActiveObject(obj);
                        this.canvas.requestRenderAll();
                    }
                    return
                }
            }
            if (pointerList2.length > 0) {
                if (pointerList2.length == 1) {
                    const obj = pointerList2[i];
                    this.canvas.discardActiveObject()
                    this.canvas.setActiveObject(obj);
                    this.canvas.requestRenderAll();
                    const obj = pointerList2[0];
                    if (objActive != obj) {
                        this.canvas.discardActiveObject()
                        this.canvas.setActiveObject(obj);
                        this.canvas.requestRenderAll();
                    }
                    return
                }
                pointerList = pointerList2
@@ -791,9 +817,12 @@
                for (let i = pointerList.length - 1; i >= 0; i--) {
                    const obj = pointerList[i];
                    if (this.isPointOnStroke(obj, pointer, 2)) {
                        this.canvas.discardActiveObject()
                        this.canvas.setActiveObject(obj);
                        this.canvas.requestRenderAll();
                        if (objActive != obj) {
                            this.canvas.discardActiveObject()
                            this.canvas.setActiveObject(obj);
                            this.canvas.requestRenderAll();
                        }
                        return
                    }
                    pointerList2.unshift(obj)
@@ -801,10 +830,13 @@
            }
            if (pointerList2.length > 0) {
                if (pointerList2.length == 1) {
                    const obj = pointerList2[i];
                    this.canvas.discardActiveObject()
                    this.canvas.setActiveObject(obj);
                    this.canvas.requestRenderAll();
                    const obj = pointerList2[0];
                    if (objActive != obj) {
                        this.canvas.discardActiveObject()
                        this.canvas.setActiveObject(obj);
                        this.canvas.requestRenderAll();
                    }
                    return
                }
                pointerList = pointerList2
@@ -812,9 +844,12 @@
                for (let i = pointerList.length - 1; i >= 0; i--) {
                    const obj = pointerList[i];
                    if (this.isPointOnStroke(obj, pointer, 3)) {
                        this.canvas.discardActiveObject()
                        this.canvas.setActiveObject(obj);
                        this.canvas.requestRenderAll();
                        if (objActive != obj) {
                            this.canvas.discardActiveObject()
                            this.canvas.setActiveObject(obj);
                            this.canvas.requestRenderAll();
                        }
                        return
                    }
                    pointerList2.unshift(obj)
@@ -822,10 +857,13 @@
            }
            if (pointerList2.length > 0) {
                if (pointerList2.length == 1) {
                    const obj = pointerList2[i];
                    this.canvas.discardActiveObject()
                    this.canvas.setActiveObject(obj);
                    this.canvas.requestRenderAll();
                    const obj = pointerList2[0];
                    if (objActive != obj) {
                        this.canvas.discardActiveObject()
                        this.canvas.setActiveObject(obj);
                        this.canvas.requestRenderAll();
                    }
                    return
                }
                pointerList = pointerList2
@@ -833,9 +871,12 @@
                for (let i = pointerList.length - 1; i >= 0; i--) {
                    const obj = pointerList[i];
                    if (this.isPointOnStroke(obj, pointer, 4)) {
                        this.canvas.discardActiveObject()
                        this.canvas.setActiveObject(obj);
                        this.canvas.requestRenderAll();
                        if (objActive != obj) {
                            this.canvas.discardActiveObject()
                            this.canvas.setActiveObject(obj);
                            this.canvas.requestRenderAll();
                        }
                        return
                    }
                    pointerList2.unshift(obj)
@@ -844,9 +885,12 @@
            if (pointerList2.length > 0) {
                const obj = pointerList2[pointerList2.length - 1];
                this.canvas.discardActiveObject()
                this.canvas.setActiveObject(obj);
                this.canvas.requestRenderAll();
                if (objActive != obj) {
                    this.canvas.discardActiveObject()
                    this.canvas.setActiveObject(obj);
                    this.canvas.requestRenderAll();
                }
                return
            }
            // objects.forEach(obj => {
@@ -1081,40 +1125,7 @@
        },
        onSelectionChanage() {
            const _this = this
            // const list = _this.canvas.getActiveObjects()
            // if (list.length === 1) {
            //     if (list[0].eleType == "station") {
            //         _this.$ownerInstance.callMethod('receiveRenderData', {
            //             method: "selected_change",
            //             type: list[0].eleType,
            //             param: list[0].data
            //         });
            //     } else if (list[0].eleType == "agv") {
            //         _this.$ownerInstance.callMethod('receiveRenderData', {
            //             method: "selected_change",
            //             type: list[0].eleType,
            //             param: list[0].data
            //         });
            //     } else if (list[0].eleType == "agv_line") {
            //         _this.$ownerInstance.callMethod('receiveRenderData', {
            //             method: "selected_change",
            //             type: list[0].eleType,
            //             param: list[0].data
            //         });
            //     } else {
            //         _this.$ownerInstance.callMethod('receiveRenderData', {
            //             method: "selected_change",
            //             type: ""
            //         });
            //     }
            // } else {
            //     _this.$ownerInstance.callMethod('receiveRenderData', {
            //         method: "selected_change",
            //         type: ""
            //     });
            // }
        },
        safeLoadImage(url, maxSize = 2048) {
            console.log(url)
@@ -1136,49 +1147,6 @@
                    resolve(null);
                };
                img.src = url;
            });
        },
        safeLoadImageData(data, maxSize = 2048) {
            //console.log("safeLoadImageData")
            const _this = this
            return new Promise((resolve) => {
                let base64Image = data
                if (base64Image.indexOf("data:image/png;base64,") < 0) {
                    base64Image = "data:image/png;base64," + data
                }
                // var img = new fabric.Image();
                // img.setSrc(base64Image, function() {
                //     console.log("img", JSON.stringify(img))
                //     const scale = Math.min(
                //         maxSize / Math.max(img.width, img.height),
                //         1
                //     );
                //     img.set({
                //         scaleX: scale,
                //         scaleY: scale
                //     })
                //     resolve(img)
                // });
                fabric.Image.fromURL(base64Image, {
                    crossOrigin: 'anonymous' // 重要:设置跨域
                }).then((img) => {
                    //console.log("img",JSON.stringify(img))
                    const scale = Math.min(
                        maxSize / Math.max(img.width, img.height),
                        1
                    );
                    img.set({
                        scaleX: scale,
                        scaleY: scale,
                    })
                    resolve(img)
                }).catch((err) => {
                    console.error("图片加载失败", err)
                    _this.showError("图片加载失败")
                    resolve(null);
                })
            });
        },
        // 将 Base64 转为 Blob,再生成 URL
@@ -1313,19 +1281,19 @@
            const cantainerEl = document.getElementById("canvasMap")
            this.eleWidth = cantainerEl.clientWidth
            this.eleHeight = cantainerEl.clientHeight
            console.log("client", this.eleWidth, this.eleHeight)
            this.canvas.setWidth(this.eleWidth);
            this.canvas.setHeight(this.eleHeight);
            this.mapInfo = {
                proportion: info.proportion || 1,
                img_proportion: info.img_proportion || 1,
                max_x: info.max_x || 1,
                max_y: info.max_y || 1,
                min_x: info.min_x || 0,
                min_y: info.min_y || 0,
                img_x: info.img_x || 1,
                img_y: info.img_y || 1,
                proportion: parseInt(info.proportion) || 1,
                img_proportion: parseInt(info.img_proportion) || 1,
                max_x: parseInt(info.max_x) || 1,
                max_y: parseInt(info.max_y) || 1,
                min_x: parseInt(info.min_x) || 0,
                min_y: parseInt(info.min_y) || 0,
                img_x: parseInt(info.img_x) || 1,
                img_y: parseInt(info.img_y) || 1,
            }
            return new Promise((resolve, reject) => {
                if (info.filedata) {
@@ -1426,13 +1394,15 @@
            const eleWidth = this.eleWidth - 20
            const eleHeight = this.eleHeight - 200
            if (!this.workSpace)
                return 1
                return 0.8
            const width = this.workSpace.width
            const height = this.workSpace.height
            if (eleWidth / eleHeight < width / height) {
                return eleWidth / width;
                let scale = eleWidth / width;
                return scale - scale / 10
            } // 按照宽度缩放
            return eleHeight / height;
            let scale = eleHeight / height;
            return scale - scale / 10
        },
        auto() {
@@ -1544,7 +1514,11 @@
                        clearTimeout(this.pressObjTimer);
                        this.pressObjTimer = null
                    }
                    this.$ownerInstance.callMethod('receiveRenderData', {
                        method: "cancel_positioning_agv",
                    });
                }
                // 移动视口
                //    console.log('relativePan', deltaX, deltaY);
                const vpt = this.canvas.viewportTransform;
@@ -1775,7 +1749,9 @@
            }
            //console.log(scale, scaleAuto)
            this.setZoomAuto(scale, center)
            this.$ownerInstance.callMethod('receiveRenderData', {
                method: "cancel_positioning_agv",
            });
            //    console.log('多点移动 - 距离:', distance, '角度:', angle);
            // 多点移动逻辑
        },
@@ -2112,8 +2088,6 @@
                    pos_list.push(item)
                }
            })
            console.log(posArr.length, pos_list.length)
            let path2 = ""
            const theta = 20;
@@ -2212,7 +2186,8 @@
            }
            //console.log(path2)
            // console.log("addTeachingPath",path2)
            // path2 += " Z"
            let strokeWidth = 1
            let stroke = "#95DE64"
@@ -2248,22 +2223,12 @@
                    lockMovementX: true,
                    lockMovementY: true,
                    selectable: false,
                    opacity: 0,
                    opacity: 1,
                    mainRoad: main_road,
                    data: teachingData
                })
            this.canvas.add(objPath)
            // this.canvas.sendObjectToBack(objPath);
            // lenTeaching = 0
            // for (let i = list.length - 1; i >= 0; i--) {
            //     const obj = list[i]
            //     if (this.compareOverlap(obj, objPath)) {
            //         lenTeaching = i + 1
            //         break
            //     }
            // }
            this.canvas.sendObjectToBack(objPath);
            this.canvas.moveObjectTo(objPath, lenTeaching + 1);
            return objPath
@@ -2298,7 +2263,8 @@
        },
        showTeachingPath(show) {
            if (!show)
                this.canvas.discardActiveObject();
            let list = this.canvas.getObjects() || []
            list = list.filter((a) => a.eleType == "station_teaching" || a.eleType == "public_teaching")
            for (let i2 in list) {
@@ -2366,10 +2332,6 @@
                    left = pt.x - width / 2
                    top = pt.y - height / 2
                }
                console.log(left,
                    top,
                    width,
                    height, scale2)
                const rect = new fabric.Rect({
                    id: `edit_teaching`,
                    eleType: "edit_teaching",
@@ -2434,30 +2396,6 @@
                    oldLeft: rect.left,
                    oldTop: rect.top,
                })
                /*const zoom = this.canvas.getZoom();
                const eleHeight = this.eleHeight - 150
                const info = {
                    x: rect.left + rect.width / 2,
                    y: rect.top + rect.height / 2
                }
                let deltaX = info.x * zoom - this.eleWidth / 2 // * scale;
                let deltaY = info.y * zoom - eleHeight / 2 //* scale;
                const vpt = this.canvas.viewportTransform;
                const oldX = vpt[4]
                const oldY = vpt[5]
                if (deltaX + this.eleWidth > this.workSpace.width)
                    deltaX = this.workSpace.width - this.eleWidth
                if (deltaY + eleHeight > this.workSpace.height)
                    deltaY = this.workSpace.height - eleHeight
                if (oldX + this.eleWidth >= info.x * zoom && info.x * zoom >= oldX) {
                    deltaX = -oldX
                    //console.log("move_canvas X", oldX)
                }
                if (oldY + eleHeight >= info.y * zoom && info.y * zoom >= oldY) {
                    //    console.log("move_canvas Y", oldY)
                    deltaY = -oldY
                }
                this.canvas.absolutePan(new fabric.Point(deltaX, deltaY));*/
            } else {
                for (let i2 in list) {
@@ -3122,7 +3060,7 @@
            this.canvas.add(ellipse)
            const offX = 20 * Math.cos(angle)
            const offY = 20 * Math.sin(angle)
            console.log("angle", param.angle, offX, offY)
            if (this.objAgvLaser) {
                this.canvas.remove(this.objAgvLaser)
            }
@@ -3205,38 +3143,54 @@
        ensurePointVisible(pt) {
            var zoom = this.canvas.getZoom();
            var vpt = this.canvas.viewportTransform; // 当前变换矩阵
            var newPanX = vpt[4];
            var newPanY = vpt[5];
            if (pt.x * zoom < vpt[4] + 80 || pt.x * zoom > vpt[4] + this.eleWidth - 80) {
                if (pt.x * zoom - this.eleWidth / 2 < 80) {
                    newPanX = -80
                } else if (pt.x * zoom > this.mapInfo.img_x * zoom - 80) {
                    newPanX = this.mapInfo.img_x * zoom - this.eleWidth + 80
                } else {
            var newPanX = -vpt[4];
            var newPanY = -vpt[5];
            const  offWidth = pt.width || 20
            const  offHeight = pt.height || 20
        //    console.log("ensurePointVisible",pt.x,pt.y,newPanX,newPanY, this.eleWidth,this.eleHeight)
            if (pt.x * zoom < -vpt[4] + offWidth || pt.x * zoom > -vpt[4] + this.eleWidth - offWidth) {
                if (pt.x * zoom - this.eleWidth / 2 <offWidth) {
                    newPanX = -offWidth
                }
                // else if (pt.x * zoom > this.mapInfo.img_x * zoom - 20) {
                //     newPanX = this.mapInfo.img_x * zoom - this.eleWidth + 20
                // }
                else {
                    newPanX = pt.x * zoom - this.eleWidth / 2
                }
            }
            if (pt.y * zoom < vpt[5] + 80 || pt.y * zoom > vpt[5] + this.eleHeight - 200) {
            if (pt.y * zoom < -vpt[5] +offHeight || pt.y * zoom > -vpt[5] + this.eleHeight - (120+offHeight)) {
                if (pt.y * zoom - this.eleHeight / 2 < 80) {
                    newPanY = -80
                } else if (pt.y * zoom > this.mapInfo.img_y * zoom - 200) {
                    newPanY = this.mapInfo.img_y * zoom - this.eleHeight + 200
                } else {
                    newPanY = pt.y * zoom - this.eleHeight / 2
                if (pt.y * zoom - this.eleHeight / 2 <offHeight) {
                    newPanY = -offHeight
                }
                // else if (pt.y * zoom > this.mapInfo.img_y * zoom - 180) {
                //     newPanY = this.mapInfo.img_y * zoom - this.eleHeight + 180
                // }
                 else {
                    newPanY = pt.y * zoom -(this.eleHeight - 120) / 2
                }
            }
        //    console.log("ensurePointVisible2",newPanX,newPanY)
            // 只有在需要时才平移
            if (newPanX !== vpt[4] || newPanY !== vpt[5]) {
            if (newPanX !== -vpt[4] || newPanY !== -vpt[5]) {
                this.canvas.absolutePan({
                    x: newPanX,
                    y: newPanY
                });
            }
        },
        ensurePointCenter(pt){
            var zoom = this.canvas.getZoom();
            var newPanX = newPanX = pt.x * zoom - this.eleWidth / 2
            var newPanY =  pt.y * zoom -(this.eleHeight - 150) / 2
            this.canvas.absolutePan({
                x: newPanX,
                y: newPanY
            });
        },
        setAllObjectSelectable(selectable) {
            let flag = false
            this.canvas.forEachObject(function(obj) {
@@ -3293,18 +3247,27 @@
                    } else if (item.method == "update_current_teaching") {
                        const info = item.param || []
                        await _this.updateCurrentTeaching(info)
                    } else if (item.method == "move_canvas") {
                    } else if (item.method == "move_pt_visible") {
                        const info2 = item.param || {}
                        const pt = {
                            x: this.getXOnImg(info2.x),
                            y: this.getYOnImg(info2.y)
                            y: this.getYOnImg(info2.y),
                            width: 20,
                            height: 20
                        }
                        this.ensurePointVisible(pt)
                    } else if (item.method == "add_station") {
                    }
                    else if (item.method == "move_pt_center") {
                        const info2 = item.param || {}
                        const pt = {
                            x: this.getXOnImg(info2.x),
                            y: this.getYOnImg(info2.y)
                        }
                        this.ensurePointCenter(pt)
                    }
                    else if (item.method == "add_station") {
                        const stationList = item.param || []
                        let list = _this.canvas.getObjects() || []
                        for (let i2 in stationList) {
@@ -3509,14 +3472,17 @@
                            }
                        })
                    } else if (item.method == "public_teaching") {
                        _this.setAllObjectSelectable(false)
                        let list = _this.canvas.getObjects() || []
                        list.forEach((obj) => {
                            if (obj.eleType == "public_teaching" || obj.eleType ==
                                "station_teaching") {
                            if (obj.eleType == "public_teaching" || obj.eleType == "station_teaching") {
                                obj.set({
                                    hasControls: false,
                                    selectable: false,
                                    opacity: 1
                                })
                                // obj.set({
                                //     hasControls: false,
                                //     selectable: false,
                                // })
                            } else if (obj.eleType == "agv")
                                obj.set({
                                    opacity: 1
@@ -3535,34 +3501,31 @@
                        for (let i2 in list) {
                            const obj = list[i2]
                            obj.set({
                                selectable: false,
                                selectable: obj?.canSelect ?true:false,
                                opacity: 1
                            })
                            // if (obj.eleType == "station") {
                            //     await _this.setMarkStation(obj, false)
                            // }
                        }
                        _this.showTeachingPath(_this.showTeachPathFlag ? true : false)
                    } else if (item.method == "public_teaching_path") {
                    }
                    else if (item.method == "clear_teaching_path") {
                        let list = _this.canvas.getObjects() || []
                        list = list.filter((a) => a.eleType == "public_teaching")
                        list = list.filter((a) => a.eleType == "public_teaching" || a.eleType == "station_teaching")
                        for (let i2 in list) {
                            this.canvas.remove(list[i2])
                        }
                    }
                    else if (item.method == "public_teaching_path") {
                        const teachingPathList = item.param || []
                        for (let i2 in teachingPathList) {
                            const teachingPath = teachingPathList[i2]
                            const id = `public_teaching_${teachingPath.name}`
                            await this.addTeachingPath(teachingPath, id, "public_teaching")
                        }
                    } else if (item.method == "station_teaching_path") {
                        let list = _this.canvas.getObjects() || []
                        list = list.filter((a) => a.eleType == "station_teaching")
                        for (let i2 in list) {
                            this.canvas.remove(list[i2])
                        }
                        const teachingPathList = item.param || []
                        for (let i2 in teachingPathList) {
                            const teachingPath = teachingPathList[i2]
pages/map/scene.vue
@@ -17,6 +17,9 @@
        </view>
        <view class="content" v-show="opSceneType =='scan'">
            <view class="fabric" :message="ctxDataStr" :change:message="ctx.receiveMsg" id="canvasMap"></view>
            <view class="position" @click="clickVehiclePosition">
                <text class="ico my-location-rounded"></text>
            </view>
        </view>
        <view class="bottom">
            <view class="bottom-content" v-if="opSceneType =='add_name' ">
@@ -64,6 +67,8 @@
        showToast,
        showModal,
        session,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -94,7 +99,9 @@
                showClearName: false,
                mapId: "",
                ctxDataStr: "[]",
                localSceneList: []
                localSceneList: [],
                positioningAgv: true,
                robotPos: {}
            }
        },
@@ -139,6 +146,10 @@
                })
                return true
            } else if (this.opSceneType == "finish") {
                const eventChannel = this.getOpenerEventChannel();
                eventChannel.emit('create_finish', this.sceneName);
                return false
            } else {
                return false
            }
@@ -186,7 +197,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            receiveRenderData(param) {
@@ -219,6 +230,8 @@
                        })
                    }
                } else if (param.method == "cancel_positioning_agv") {
                    this.positioningAgv = false
                }
            },
@@ -227,7 +240,7 @@
                    const list = session.getValue("scene_db") || []
                    return list
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -250,7 +263,7 @@
                        delta: 1, //返回层数,2则上上页
                    })
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                } finally {
                    this.loading = false
                    uni.hideLoading()
@@ -286,7 +299,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    this.opSceneType = 'add_name'
                } finally {
                    this.loading = false
@@ -349,7 +362,6 @@
                        title: "结束场景构建"
                    })
                    this.opSceneType = ""
                    await createScene(this.ip, this.sceneName, 0)
                    const eventChannel = this.getOpenerEventChannel();
                    eventChannel.emit('create_finish', this.sceneName);
                    uni.navigateBack({
@@ -376,7 +388,7 @@
                    const info = await getMapLaserData(this.ip, this.mapId)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -388,7 +400,7 @@
                        const listCtrData = []
                        if (data.base_map?.image_base64) {
                            this.robotPos = {}
                            this.mapId = data.base_map.map_id
                            listCtrData.push({
                                method: "background",
@@ -404,49 +416,56 @@
                                    filedata: data.base_map.image_base64
                                }
                            })
                        }
                        listCtrData.push({
                            method: "agv_laser",
                            param: data.robot_pose
                        })
                        listCtrData.push({
                            method: "point_cloud",
                            param: data.point_cloud
                        })
                        if (this.positioningAgv) {
                            listCtrData.push({
                                method: "agv_laser",
                                param: data.robot_pose
                            })
                            listCtrData.push({
                                method: "point_cloud",
                                param: data.point_cloud
                            })
                            listCtrData.push({
                                method: "move_canvas",
                                method: "move_pt_visible",
                                param: {
                                    x: data.robot_pose.x,
                                    y: data.robot_pose.y
                                    y: data.robot_pose.y,
                                    width:50,
                                    height:50,
                                }
                            })
                        } else {
                            listCtrData.push({
                                method: "agv_laser",
                                param: data.robot_pose
                            })
                            listCtrData.push({
                                method: "point_cloud",
                                param: data.point_cloud
                            })
                        }
                        this.ctxDataStr = JSON.stringify(listCtrData)
                        this.robotPos = {
                            x: data.robot_pose.x,
                            y: data.robot_pose.y
                        }
                    }
                } catch (ex) {
                    this.showError(ex)
                } finally {
                    // 无论成功失败,1 秒后再来
                    setTimeout(this.refreshMapLaserData, 1000);
                } catch (ex) {
                    showError(ex).then((res) => {
                        setTimeout(this.refreshMapLaserData, 1000);
                    })
                }
            },
            async clickVehiclePosition() {
                this.positioningAgv = true
            showError(ex) {
                console.log(ex)
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false, "确定")
                if (this.robotPos.x) {
                    this.ctxDataStr = JSON.stringify([{
                        method: "move_pt_center",
                        param: {
                            x: this.robotPos.x,
                            y: this.robotPos.y
                        }
                    }])
                }
            },
@@ -475,6 +494,16 @@
                background-color: #fff;
            }
            .position {
                position: absolute;
                right: 50rpx;
                bottom: 500rpx;
                .ico {
                    font-size: 65rpx;
                    color: #1890FF;
                }
            }
        }
pages/map/task.vue
@@ -33,7 +33,9 @@
<script>
    import {
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -115,7 +117,7 @@
                    const info = await getAgvState(this.vehicleIp)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -124,7 +126,7 @@
                    const info = await stations(this.vehicleIp)
                    return info.station_list || []
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -137,13 +139,6 @@
                uni.navigateTo({
                    url: `/pages/task/log-list?ip=${this.vehicleIp}`
                })
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false,"确定")
            },
pages/map/teaching.vue
@@ -234,7 +234,9 @@
<script>
    import {
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    // import OIFabric from "@/components/oi-fabric/index.vue"
    import {
@@ -463,7 +465,7 @@
                        },
                        {
                            method: "move_canvas",
                            method: "move_pt_center",
                            param: {
                                x: infoAgv.x,
                                y: infoAgv.y
@@ -478,7 +480,7 @@
                        bgProgressPercent: 0,
                        bgLoading: false
                    })
                    this.showError(ex)
                    showError(ex)
                }
            },
            async loadAgvState() {
@@ -486,7 +488,7 @@
                    const info = await getAgvState(this.vehicleIp)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -495,7 +497,7 @@
                    const info = await stations(this.vehicleIp)
                    return info.station_list || []
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -504,7 +506,7 @@
                    const info = await getMapUrl(this.vehicleIp, id)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -519,7 +521,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {
                        Public: [],
                        Stations: []
@@ -540,7 +542,7 @@
                    ])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -701,7 +703,7 @@
                        param: item,
                    }])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async removeTeachingModeData(data) {
@@ -709,7 +711,7 @@
                    await delTeachingModeData(this.vehicleIp, data)
                    this.reloadTeachingMode()
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickPublicTeaching() {
@@ -751,7 +753,7 @@
                    }])
                    this.mapOperationType = 'public_teaching'
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async stationAdd(item) {
@@ -768,7 +770,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async teachingStart(mode) {
@@ -812,7 +814,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -830,7 +832,7 @@
                        this.askTeachingBiDirection(this.teachingModeCur)
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -856,7 +858,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -870,7 +872,7 @@
                    }])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -900,7 +902,7 @@
                                        stationTeaching.splice(curIndex, 1)
                                        _this.teachingStart("Stations")
                                    } catch (ex) {
                                        this.showError(ex)
                                        showError(ex)
                                    }
                                } else {
@@ -925,7 +927,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickTeachingEnd() {
@@ -948,7 +950,7 @@
                            _this.reloadTeachingMode()
                        } catch (ex) {
                            this.showError(ex)
                            showError(ex)
                        }
                    } else {
                        _this.teachingStatus = "save"
@@ -960,7 +962,7 @@
                this.teachingStatus = "save"
                try {} catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -1145,7 +1147,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -1172,7 +1174,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            askTeachingBiDirection(teachingMode) {
@@ -1193,7 +1195,7 @@
                    this.reloadTeachingMode()
                    this.teachingStatus = "end"
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickBackTeaching() {
@@ -1233,7 +1235,7 @@
                            method: "edit_station_pos",
                            param: this.stationEdit
                        }, {
                            method: "move_canvas",
                            method: "move_pt_center",
                            param: {
                                x: agv.x,
                                y: agv.y
@@ -1243,7 +1245,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -1267,7 +1269,7 @@
                    method: "update_station",
                    param: [this.stationEdit]
                }, {
                    method: "move_canvas",
                    method: "move_pt_center",
                    param: {
                        x: this.stationEdit.x,
                        y: this.stationEdit.y
@@ -1282,7 +1284,7 @@
                    method: "update_station",
                    param: [this.stationEdit]
                }, {
                    method: "move_canvas",
                    method: "move_pt_center",
                    param: {
                        x: this.stationEdit.x,
                        y: this.stationEdit.y
@@ -1295,7 +1297,7 @@
                    method: "update_station",
                    param: [this.stationEdit]
                }, {
                    method: "move_canvas",
                    method: "move_pt_center",
                    param: {
                        x: this.stationEdit.x,
                        y: this.stationEdit.y
@@ -1308,7 +1310,7 @@
                    method: "update_station",
                    param: [this.stationEdit]
                }, {
                    method: "move_canvas",
                    method: "move_pt_center",
                    param: {
                        x: this.stationEdit.x,
                        y: this.stationEdit.y
@@ -1399,14 +1401,14 @@
                        method: "update_agv_state",
                        param: infoAgv
                    }, {
                        method: "move_canvas",
                        method: "move_pt_center",
                        param: {
                            x: infoAgv.x,
                            y: infoAgv.y
                        }
                    }])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async clickShowTeachingPath() {
@@ -1439,7 +1441,7 @@
                    ])
                    console.log(this.ctxDataStr)
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async clickPositionStation() {
@@ -1459,7 +1461,7 @@
                            param: [this.stationEdit]
                        },
                        {
                            method: "move_canvas",
                            method: "move_pt_center",
                            param: {
                                x: infoAgv.x,
                                y: infoAgv.y
@@ -1469,16 +1471,8 @@
                    ])
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false, "确定")
            },
pages/my/log-detail.vue
@@ -16,8 +16,8 @@
            </view>
            <view class="title">错误信息
            </view>
            <view class="content error">{{info.msg}}
            </view>
            <textarea class="content error" disabled :value="result"></textarea>
        </template>
        <template v-else>
            <view class="title">结果
@@ -42,6 +42,7 @@
        },
        onLoad(option) {
            this.info = JSON.parse(option.info) || {}
            console.log(    this.info)
            if(this.info.data_key)
            {
                const maxData = session.getValue("request_log_max_data") || {}
pages/station/index.vue
@@ -110,6 +110,8 @@
        showToast,
        showModal,
        session,
        showError,
        showInfo
    } from "@/comm/utils.js"
    // import OIFabric from "@/components/oi-fabric/index.vue"
    import {
@@ -258,7 +260,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async loadAgvState() {
@@ -266,7 +268,7 @@
                    const info = await getAgvState(this.ip)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -275,7 +277,7 @@
                    const info = await stations(this.ip)
                    return info.station_list || []
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -386,7 +388,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -433,7 +435,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async stationUpdate(item) {
@@ -449,7 +451,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -497,7 +499,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -527,7 +529,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickClearName() {
@@ -664,17 +666,10 @@
                    this.angleSvg = `/static/images/angle${angle}.svg`
                    this.stationEdit.angle = angle * 3.14 / 180
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false,"确定")
            },
        }
    }
pages/task/add.vue
@@ -103,7 +103,9 @@
<script>
    import {
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -131,6 +133,7 @@
                    taskGroupName: "",
                    cycleTime: 1,
                    taskButton: 0,
                    tasktype:1
                },
                pathwayList: [{}],
                pickerView: {
@@ -203,7 +206,7 @@
                    const info = await stations(this.ip)
                    this.stationList = info.station_list || []
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async clickSave() {
@@ -217,6 +220,9 @@
                        showToast("未选择任务属性!")
                        return
                    }
                    uni.showLoading({
                        title:"任务新增中"
                    })
                    const taskList = []
                    const task = {
                        taskGroupID: uuidv4(),
@@ -251,6 +257,7 @@
                        return
                    }
                    await addTask(this.ip, task)
                    task.taskList = taskList
                    const eventChannel = this.getOpenerEventChannel();
                    eventChannel.emit('add_task', task);
@@ -258,7 +265,10 @@
                        delta: 1, //返回层数,2则上上页
                    })
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
                finally {
                    uni.hideLoading()
                }
            },
            clickCancel() {
@@ -468,13 +478,7 @@
            closeMenu() {
                this.$refs.refPopupMenu.close()
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false,"确定")
            },
        }
    }
pages/task/infos/task-item.vue
@@ -216,7 +216,7 @@
            getDestText(item) {
                const index = this.taskData.taskList.findIndex((a) => a.taskID == item.taskID)
                if (index > -1) {
                    return this.taskData.taskList[index]?.dest?.name || ""
                    return this.taskData.taskList[index].dest?.name || ""
                }
                return ""
            },
@@ -230,7 +230,7 @@
                    } else if (task.actionType === 2) {
                        actionText = "取货"
                    } else if (task.actionType === 3) {
                        actionText = `卸货 等待${taskData.taskList[index]?.wait || 0}秒`
                        actionText = `卸货 等待${task.wait || 0}秒`
                    } else if (task.actionType === 4) {
                        actionText = "人工"
                    }
pages/task/infos/task-log-item.vue
@@ -1,20 +1,20 @@
<template>
    <view class="pages-task-log-item vert-line">
        <view class="btn-no "> {{taskData.taskButton}}
        <view class="btn-no "> {{taskData.task_button}}
        </view>
        <view class="content">
            <view class="line">
                <view class="title"> {{taskData.taskGroupName}}</view>
                <view class="status" :style="{'background-color':taskStatusColor+ '20','color':taskStatusColor}">
                <view class="title"> {{taskData.task_group_name}}</view>
                <view class="status" :style="{'background-color':taskStatusColor+ '10','color':taskStatusColor}">
                    {{taskStatusText}}
                </view>
            </view>
            <view class="line"><text class="text">{{taskData.startTime}}-{{taskData.endTime}} </text>
                <text class="text">{{taskData.duration}}min</text>
                <text class="text">{{taskData.cycleNumber}}次</text>
            <view class="line"><text class="text">{{ startTime}} - {{endTime}} </text>
                <text class="text">{{Math.ceil((taskData.end_time- taskData.start_time) / (60* 1000)) }}min</text>
            </view>
        </view>
    </view>
</template>
@@ -39,36 +39,43 @@
            }
        },
        computed: {
            startTime() {
                const date = new Date(Number(this.taskData.start_time))
                return`${date.getHours()}:${date.getMinutes()}`;
            },
            endTime() {
                const date = new Date(Number(this.taskData.end_time))
                return `${date.getHours()}:${date.getMinutes()}`;
            },
            taskStatusText() {
                let statusText = ""
                if (this.taskData.status == 1) {
                    statusText = "任务执行中"
                } else if (this.taskData.status == 2) {
                if (this.taskData.task_status == "finish") {
                    statusText = "任务完成"
                } else if (this.taskData.status == 3) {
                    statusText = "任务取消"
                } else if (this.taskData.status == 4) {
                } else if (this.taskData.task_status == "cancel") {
                    statusText = "任务异常"
                } else if (this.taskData.status == 5) {
                    statusText = "任务强制完成"
                } else {
                    statusText = ""
                    statusText = this.taskData.task_status
                }
                return statusText
            },
            taskStatusText() {
                let statusText = ""
                if (this.taskData.task_status == "finish") {
                    statusText = "任务完成"
                } else if (this.taskData.task_status == "cancel") {
                    statusText = "任务异常"
                } else {
                    statusText = this.taskData.task_status
                }
                return statusText
            },
            taskStatusColor() {
                let statusColor = ""
                if (this.taskData.status == 1) {
                    statusColor = "#0055ff"
                } else if (this.taskData.status == 2) {
                    statusColor = "#237804"
                } else if (this.taskData.status == 3) {
                    statusColor = "#787277"
                } else if (this.taskData.status == 4) {
                    statusColor = "#D4380D"
                } else if (this.taskData.status == 5) {
                    statusColor = "#55aa00"
                } else if (this.taskData.status == 5) {
                if (this.taskData.task_status == "finish") {
                    statusColor = "#38861a"
                } else if (this.taskData.task_status == "cancel") {
                    statusColor = "#d64017"
                } else if (this.taskData.task_status == 5) {
                    statusColor = "#000000"
                }
                return statusColor
pages/task/list.vue
@@ -33,7 +33,7 @@
            <uni-icons color="#ccc" type="info" size="128"></uni-icons>
            <view class="space">没有找到符合条件的任务</view>
        </view>
        <view class="position-add" @click="clickAddTask()" @touchstart='btnAddTouchStart' @touchmove='btnAddTouchMove'
        <view class="position-add" @click="clickAddTask"  @touchstart='btnAddTouchStart' @touchmove='btnAddTouchMove'
            :style="{transform:`translate(${btnAddInfo.x}px,${btnAddInfo.y}px) scale(1)`}">
            <uni-icons class="img" type="plus-filled" size="80" color="#1890FF"></uni-icons>
        </view>
@@ -45,6 +45,8 @@
        showToast,
        showModal,
        session,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import TaskItemView from "./infos/task-item.vue"
    import {
@@ -68,6 +70,7 @@
        },
        data() {
            return {
                loading:false,
                ip: "",
                sceneId: "",
                list: [],
@@ -104,8 +107,10 @@
            this.ip = option.ip || ""
            this.sceneId = option.sceneId || ""
            this.isPageVisible = true
            this.loadData()
            this.$nextTick(()=>{
                this.loadData()
            })
        },
        onShow() {
            this.isPageVisible = true
@@ -159,7 +164,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async loadTaskList() {
@@ -167,20 +172,25 @@
                    const res = await tasks(this.ip)
                    const list = res?.data || []
                    this.list = list
                    showToast(`装载了${list.length}任务`)
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async timerCheckTaskGroupStatus() {
                try {
                    if (this.isPageVisible)
                        await this.checkTaskGroupStatus()
                        setTimeout(this.timerCheckTaskGroupStatus, 1000);
                } catch (ex) {
                    this.showError(ex)
                    showError(ex).then((res)=>{
                        setTimeout(this.timerCheckTaskGroupStatus, 1000);
                    })
                } finally {
                    setTimeout(this.timerCheckTaskGroupStatus, 1000);
                }
            },
            async checkTaskGroupStatus() {
@@ -210,7 +220,7 @@
                } catch (ex) {
                    this.taskStatus = {}
                    this.showError(ex)
                    showError(ex)
                }
            },
            setTaskGroupStatus(cmdID) {
@@ -220,6 +230,7 @@
            },
            clickAddTask() {
                const _this = this
                uni.navigateTo({
                    url: `/pages/task/add?ip=${this.ip}&title=新增任务`,
                    events: {
@@ -305,7 +316,7 @@
                    this.setTaskGroupStatus(cmdID)
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -314,7 +325,7 @@
                    await addTaskGroupCmd(this.ip, item.taskGroupID, this.taskStatus.taskGroupCmdID, 2)
                    showToast("终止任务成功")
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -345,7 +356,7 @@
                        showToast("未找到未开始或正在执行的子任务")
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -379,19 +390,12 @@
                    this.list = [...list]
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : typeof ex.errMsg == "string" ? ex.errMsg : exStr
                showModal(tip, "错误", false, "确定")
            },
        }
    }
</script>
pages/task/log-list.vue
@@ -3,36 +3,35 @@
        <view class="list-content" v-if="list.length > 0">
            <view class="header">
                <view class="item">
                    <view class="title">{{accumulatedDuration}}<text class="text">min</text></view>
                    <view class="title">{{totalDuration}}<text class="text">min</text></view>
                    <view class="text">累计时长</view>
                </view>
                <!--         <view class="item">
                    <view class="title">{{accumulatedMileage}}<text class="text">m</text></view>
                    <view class="text">累计里程</view>
                </view> -->
                <view class="item">
                    <view class="title">{{cumulativeCount}}</view>
                    <view class="title">{{totalCount}}</view>
                    <view class="text">累计次数</view>
                </view>
            </view>
            <view class="list">
                <view class="task-header" v-if="fixedList.length > 0">固定任务</view>
                <template v-for="(group) in fixedList" :key="group.date">
                <!-- <view class="task-header" v-if="fixedList.length > 0">固定任务</view> -->
                <template v-for="(group) in taskList" :key="group.date">
                    <view class="task-header">{{group.date}}</view>
                    <view class="task-list-view">
                        <TaskLogItemView class="list-item" v-for="(item,index) in group.list" :key="index" :taskData="item">
                        <TaskLogItemView class="list-item" v-for="(item,index) in group.list" :key="index"
                            :taskData="item">
                        </TaskLogItemView>
                    </view>
                </template>
                <view class="task-header" v-if="tempList.length > 0">临时任务</view>
                <!-- <view class="task-header" v-if="tempList.length > 0">临时任务</view>
                <template v-for="(group) in tempList" :key="group.date">
                    <view class="task-header">{{group.date}}</view>
                    <view class="task-list-view">
                        <TaskLogItemView class="list-item" v-for="(item,index) in group.list" :key="index" :taskData="item">
                        <TaskLogItemView class="list-item" v-for="(item,index) in group.list" :key="index"
                            :taskData="item">
                        </TaskLogItemView>
                    </view>
                </template>
                </template> -->
            </view>
        </view>
        <view class="list-no-content" v-else>
@@ -46,7 +45,9 @@
<script>
    import {
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import TaskLogItemView from "./infos/task-log-item.vue"
    import {
@@ -59,12 +60,35 @@
        },
        data() {
            return {
                ip:"",
                ip: "",
                sceneId: "",
                list: [],
            }
        },
        computed: {
            taskList() {
                const listRes = []
                this.list.forEach((ele) => {
                    const dateStart = new Date(Number(ele.start_time))
                    const date = `${dateStart.getMonth()}-${dateStart.getDay()}`;
                    const curIndex = listRes.findIndex((a) => a.date == date)
                    if (curIndex < 0) {
                        let group = {
                            date,
                            list: [ele]
                        }
                        listRes.push(group)
                    } else {
                        let group = listRes[curIndex]
                        group.list.push(ele)
                    }
                })
                listRes.sort((a, b) => {
                    return a.date < b.date ? 1 : -1
                });
                return listRes
            },
            fixedList() {
                let list = this.list.filter((a) => a.tasktype == 1)
                let group
@@ -92,53 +116,22 @@
                })
                return listRes
            },
            tempList() {
                let list = this.list.filter((a) => a.tasktype == 2)
                let group
                const listRes = []
                list.sort((a, b) => {
                    return a.date > b.date
                });
                list.forEach((item) => {
                    if (group) {
                        if (item.date != group.date) {
                            group = {
                                date: item.date,
                                list: []
                            }
                            listRes.push(group)
                        }
                    } else {
                        group = {
                            date: item.date,
                            list: []
                        }
                        listRes.push(group)
                    }
                    group.list.push(item)
                })
                return listRes
            },
            accumulatedDuration() {
                let res = 0
            totalDuration() {
                let d = 0
                // this.list.forEach((item) => {
                //     d += item.duration || 0
                // })
                this.list.forEach((item) => {
                    res += item.duration || 0
                    d +=( item.end_time -  item.start_time)
                })
                return res
                return Math.ceil(d / (60 * 1000))
            },
            accumulatedMileage() {
                let res = 0
                this.list.forEach((item) => {
                    res += item.accumulated_mileage || 0
                })
                return res
            },
            cumulativeCount() {
                let res = 0
                this.list.forEach((item) => {
                    res += item.cycleNumber || 0
                })
                return res
            totalCount() {
                 let cnt =this.list.length
                // this.list.forEach((item) => {
                //     cnt += item.list.length
                // })
                return cnt
            },
        },
        onLoad(option) {
@@ -170,87 +163,14 @@
            },
            async loadData() {
                try {
                    /*this.list = [{
                        type: 0,
                        taskButton: 1,
                        name: "1号站点到2号站点",
                        date: "5-18",
                        accumulated_duration: 5693,
                        accumulated_mileage: 6421,
                        cumulative_number: 55,
                        status: 1,
                    }, {
                        type: 0,
                        taskButton: 2,
                        name: "2号站点到1号站点",
                        date: "5-08",
                        accumulated_duration: 888,
                        accumulated_mileage: 642,
                        cumulative_number: 31,
                        status: 2,
                    }, {
                        type: 0,
                        taskButton: 1,
                        name: "1号站点到2号站点",
                        date: "4-28",
                        accumulated_duration: 998,
                        accumulated_mileage: 2421,
                        cumulative_number: 85,
                        status: 2,
                    }, {
                        type: 0,
                        taskButton: 2,
                        name: "2号站点到1号站点",
                        date: "4-28",
                        accumulated_duration: 688,
                        accumulated_mileage: 1421,
                        cumulative_number: 65,
                        status: 4,
                    }, {
                        type: 1,
                        taskButton: 3,
                        name: "1号站点到2号站点",
                        date: "5-18",
                        accumulated_duration: 5693,
                        accumulated_mileage: 6421,
                        cumulative_number: 55,
                        status: 2,
                    }, {
                        type: 1,
                        taskButton: 4,
                        name: "2号站点到1号站点",
                        date: "5-08",
                        accumulated_duration: 888,
                        accumulated_mileage: 642,
                        cumulative_number: 31,
                        status: 2,
                    }, {
                        type: 1,
                        taskButton: 3,
                        name: "1号站点到2号站点",
                        date: "4-28",
                        accumulated_duration: 998,
                        accumulated_mileage: 2421,
                        cumulative_number: 85,
                        status: 2,
                    }, {
                        type: 1,
                        taskButton: 4,
                        name: "2号站点到1号站点",
                        date: "4-28",
                        accumulated_duration: 688,
                        accumulated_mileage: 1421,
                        cumulative_number: 65,
                        status: 2,
                    }]*/
                    this.list = await this.loadTaskLog()
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async loadTaskLog() {
                try {
                    const now = new Date();
                    const oneWeekAgo = new Date();
                    const endTimeStamp = `${now.getTime()}`
@@ -259,53 +179,16 @@
                    const res = await getTaskLog(this.ip, startTimeStamp, endTimeStamp)
                    const list = res?.task_info || []
                    console.log(list)
                    list.forEach((ele) => {
                        console.log(ele)
                        const dateStart = new Date()
                        dateStart.setTime(Number(ele.taskStartTimeStamp))
                        ele.date = `${dateStart.getMonth()}-${dateStart.getDay()}`;
                        let taskList = ele.taskList || []
                        taskList.sort((a, b) => {
                            return a.lastUpdateTimeStamp > b.lastUpdateTimeStamp
                        });
                        console.log(taskList)
                        ele.startTime = `${dateStart.getHours()}:${dateStart.getMinutes()}`;
                        ele.endTime = ele.startTime
                        ele.duration = 0;
                        ele.status = 0
                    //    console.log(ele)
                        if (taskList.length > 0) {
                            const dateEnd = new Date()
                            dateEnd.setTime(Number(taskList[taskList.length - 1].lastUpdateTimeStamp))
                            for (let i in taskList) {
                                const ele2 = taskList[i]
                                if (ele2.status == 1) {
                                    ele.status = 1
                                    break;
                                } else if (ele2.status == 2 || ele2.status == 4 || ele2.status == 5) {
                                    ele.status = 2
                                    break;
                                }
                            }
                            if (!ele.status) {
                                if (taskList.filter((a) => a.status != 3).length == 0) {
                                    ele.status = 3
                                }
                            }
                            const diffInMs = dateEnd - dateStart; // 或者 Math.abs(date1 - date2)
                            ele.endTime = `${dateEnd.getHours()}:${dateEnd.getMinutes()}`;
                            ele.duration = Math.round(diffInMs / (1000 * 60))
                            console.log(ele)
                        }
                    })
                    console.log(list)
                    list.sort((a, b) => {
                        return a.end_time < b.end_time ? 1 : -1
                    });
                    showToast(`装载了${list.length}记录`)
                    return list
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
                }
            },
            clickTask(item) {
@@ -313,13 +196,7 @@
                //     url: "/pages/task/index"
                // })
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false,"确定")
            },
        }
    }
</script>
@@ -377,20 +254,22 @@
                overflow: auto;
                .task-header {
                    width: 100% ;
                    width: 100%;
                    padding: 10rpx;
                    font-size: 32rpx;
                }
                .task-list-view {
                    width: 100% ;
                    width: 100%;
                    border-radius: 10rpx;
                    // padding: 0 10rpx;
                    background-color: #fff;
                    .list-item {
                        border-bottom: 1px solid #ddd;
                    }
                    .list-item:last-child {
                        border-bottom: 0;
                        /* 右下角 */
pages/task/update.vue
@@ -95,7 +95,9 @@
<script>
    import {
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -229,7 +231,7 @@
                    const info = await stations(this.ip)
                    this.stationList = info.station_list || []
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async clickSave() {
@@ -243,6 +245,9 @@
                        showToast("未选择任务属性!")
                        return
                    }
                    uni.showLoading({
                        title:"任务更新中"
                    })
                    const task = {
                        taskGroupID: this.form.taskGroupID,
                        taskGroupName: name,
@@ -298,7 +303,10 @@
                        delta: 1, //返回层数,2则上上页
                    })
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
                finally {
                    uni.hideLoading()
                }
            },
            clickCancel() {
@@ -519,7 +527,7 @@
                    })
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -550,13 +558,7 @@
            closeMenu() {
                this.$refs.refPopupMenu.close()
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false,"确定")
            },
        }
    }
pages/teaching/index.vue
@@ -150,7 +150,9 @@
<script>
    import {
        showToast,
        showModal
        showModal,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -284,7 +286,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async loadAgvState() {
@@ -292,7 +294,7 @@
                    const info = await getAgvState(this.ip)
                    return info
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return {}
                }
            },
@@ -301,7 +303,7 @@
                    const info = await stations(this.ip)
                    return info.station_list || []
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                    return []
                }
            },
@@ -367,7 +369,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -386,7 +388,7 @@
                        this.askTeachingBiDirection(this.teachingModeCur)
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -405,7 +407,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async clickTeachingStart() {
@@ -433,7 +435,7 @@
                                        stationTeaching.splice(curIndex, 1)
                                        _this.teachingStart("Stations")
                                    } catch (ex) {
                                        this.showError(ex)
                                        showError(ex)
                                    }
                                } else {
@@ -452,7 +454,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickTeachingEnd() {
@@ -473,7 +475,7 @@
                            _this.teachingMode = await getTeachingMode(_this.ip)
                        } catch (ex) {
                            this.showError(ex)
                            showError(ex)
                        }
                    } else {
                        _this.teachingStatus = "save"
@@ -485,7 +487,7 @@
                this.teachingStatus = "save"
                try {} catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -637,7 +639,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            async clickNoCalibration() {
@@ -662,7 +664,7 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            askTeachingBiDirection(teachingMode) {
@@ -683,21 +685,13 @@
                    this.teachingMode = await getTeachingMode(this.ip)
                    this.teachingStatus = "end"
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickBackTeaching() {
                this.$refs.refPopupCalibration.close()
                this.teachingStatus = ""
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false, "确定")
            },
        }
    }
pages/teaching/list.vue
@@ -44,6 +44,8 @@
        showToast,
        showModal,
        session,
        showError,
        showInfo
    } from "@/comm/utils.js"
    import {
        Button
@@ -129,7 +131,7 @@
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
@@ -141,7 +143,7 @@
                    this.teachingPublic = data?.Public || []
                    this.teachingStation = data?.Stations || []
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            clickAddTeaching() {
@@ -259,18 +261,11 @@
                    }
                } catch (ex) {
                    this.showError(ex)
                    showError(ex)
                }
            },
            showError(ex) {
                let exStr = JSON.stringify(ex)
                if (exStr == "{}")
                    exStr = ex
                let tip = typeof ex.msg == "string" ? ex.msg : exStr
                showModal(tip, "错误", false,"确定")
            },
        }