*
lsh
2025-08-18 c77ffe54bbd49bfe8f60a592d9729cea86150bf9
src/main/webapp/views/index.html
@@ -35,7 +35,7 @@
        .map {
            position: relative;
            width: 52vw;
            height: 80vh;
            height: 72vh;
            border-radius: 50%;
            display: flex;
            justify-content: center;
@@ -100,6 +100,19 @@
            z-index: 1000; /* 确保在其他元素之上 */
        }
        .task-bar-left1 {
            position: fixed;
            top: 8%;
            /*transform: translateY(-50%);*/
            width: 25%; /* 设置宽度 */
            background-color: rgba(255, 255, 255, 0); /* 半透明背景 */
            border-radius: 5px;
            padding: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0);
            z-index: 1000; /* 确保在其他元素之上 */
        }
        .task-bar-right {
            position: fixed;
            top: 1%;
@@ -150,7 +163,7 @@
            background: #f0f9eb;
        }
        .container {
            width: 100vh;
            width: 52vw;
            height: 72vh;
            position: absolute;
            /*background: #8c939d;*/
@@ -191,7 +204,7 @@
        }
    </style>
</head>
<body>
<body id="app1">
    <!--<header>-->
    <!--    环形穿梭车智能系统-->
    <!--</header>-->
@@ -204,19 +217,9 @@
            <!--        <div class="outer-ring"></div>-->
<!--            <div v-for="track in energyGatheringRing" class="inner-ring" :style="{  borderColor: track.trackColor , boxShadow :  'inset 0 0 30px '+track.radiationColor+', 0 0 20px '+track.radiationColor}"></div>-->
<!--            <div v-for="track in energyGatheringRing" class="outer-ring" :style="{  borderColor: track.trackColor , boxShadow :  'inset 0 0 30px '+track.radiationColor+', 0 0 20px '+track.radiationColor}"></div>-->
            <svg class="container">
<!--                <path d="M 100,250-->
<!--                        L 100,800-->
<!--                        C 100,800 100,850 150,850-->
<!--                        C 150,850 200,850 200,800-->
<!--                        L 200,250-->
<!--                        C 200,250 200,200 250,200-->
<!--                        L 1100,200-->
<!--                        C 1100,200 1150,200 1150,150-->
<!--                        C 1150,150 1150,100 1100,100-->
<!--                        L 250,100-->
<!--                        C 250,100 90,90 100,250 z"-->
<!--                      style="fill:none; stroke:blue; stroke-width:4;" />-->
            <svg class="container"
                 viewBox="0 0 1200 850"
                 preserveAspectRatio="xMidYMid meet">
                <path d="M 1200,750
                        L 1200,100
                        C 1200,100 1200,50 1150,50
@@ -229,19 +232,13 @@
                        L 1100,850
                        C 1100,850 1200,850 1200,750
"
                      style="fill:none; stroke:blue; stroke-width:4;" />
                      style="fill:none; stroke:blue; stroke-width:2;" />
            </svg>
<!--            <div class="bus-station">-->
<!--                <div v-for="(item,i) in devpPos1" class="bus-item-top" :style="'left:' + (75 + i * 15) + 'px'">{{item.dev_no}}</div>-->
<!--            </div>-->
<!--            <div class="bus-station" style="flex-direction: column">-->
<!--                <div v-for="(item,i) in devpPos2" class="bus-item-left" :style="'top:' + (200 + i * 50) + 'px'">{{item.dev_no}}</div>-->
<!--            </div>-->
<!--            <div class="bus-station" style="flex-direction: column">-->
<!--                <div v-for="(item,i) in devpPos3" class="bus-item-left2" :style="'top:' + (100 + i * 10) + 'px'">{{item.dev_no}}</div>-->
<!--            </div>-->
<!--             Stations on outer ring-->
            <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueY + 'px', left: station.valueX + 'px' }">{{ station.index }}</div>
<!--            <div v-for="station in tableDataDev" class="station" :style="{ top: station.valueY + 'px', left: station.valueX + 'px' , backgroundColor: station.modeColor}">{{ station.index }}</div>-->
            <div v-for="station in tableDataDev" class="station" :style="{
                top: convertToCSSPosition(station.valueX, station.valueY).y + 'px',
                left: convertToCSSPosition(station.valueX, station.valueY).x + 'px',
                backgroundColor: station.modeColor}">{{ station.index }}</div>
            <div>
                <el-switch
                        style="display: block"
@@ -254,7 +251,11 @@
                </el-switch>
            </div>
            <!-- Buses -->
            <div v-for="bus in tableDataRgv" class="bus" :style="{ top: bus.valueY + 'px', left: bus.valueX + 'px' , borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>
<!--            <div v-for="bus in tableDataRgv" class="bus" :style="{ top: bus.valueY + 'px', left: bus.valueX + 'px' , borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>-->
            <div v-for="bus in tableDataRgv" class="bus" :style="{
                top: convertToCSSPositionWithOffset(bus.valueX, bus.valueY).y + 'px',
                left: convertToCSSPositionWithOffset(bus.valueX, bus.valueY).x + 'px',
                borderColor: bus.modeColor, backgroundColor: bus.statusColor}">{{ bus.index }}</div>
        </div>
        <!-- Left Task Bar -->
@@ -326,6 +327,50 @@
                                删除
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
        </div>
        <div class="task-bar-left1 left-task-bar" >
            <div>
                <el-tooltip :content="'Switch value: ' + valueLeft1" placement="top">
                    <el-switch
                            v-model="valueLeft1"
                            active-color="#13ce66"
                            inactive-color="#ff4949"
                            active-value="100"
                            inactive-value="0">
                    </el-switch>
                </el-tooltip>
            </div>
            <div v-if="valueLeft1 === '100' " class="task-bar-div1">
                <el-table
                        :data="tableDataLeft1"
                        style="width: 100%"
                        :row-class-name="tableRowClassName">
                    <el-table-column
                            prop="wrkNo1"
                            label="工作号">
                    </el-table-column>
                    <el-table-column
                            prop="rgvNo"
                            label="RGV号">
                    </el-table-column>
                    <el-table-column
                            prop="sendTime"
                            label="下发时间">
                    </el-table-column>
                    <el-table-column
                            prop="mode"
                            label="类型">
                    </el-table-column>
                    <el-table-column
                            prop="sourceSta"
                            label="起点">
                    </el-table-column>
                    <el-table-column
                            prop="posSta"
                            label="终点">
                    </el-table-column>
                </el-table>
            </div>
@@ -420,11 +465,21 @@
    </div>
    <script>
        // 在Vue实例外获取body尺寸
        function getBodySize() {
            return {
                width: document.body.clientWidth,
                height: document.body.clientHeight
            };
        }
        var app = new Vue({
            el: '#app',
            data: {
                containerSize: { width: 0, height: 0},
                bodySize: { width: 0, height: 0 },
                activeNames: ['1'],
                valueLeft: '0',
                valueLeft1: '0',
                valueRight: '0',
                valueRight1: '0',
                licenseDay: '已过期',
@@ -434,6 +489,7 @@
                tableDataDev: [],
                energyGatheringRing: [],
                tableDataLeft: [],
                tableDataLeft1: [],
                tableDataRight: [],
                tableDataRight1: [],
                devpPos1:[
@@ -484,12 +540,31 @@
            watch: {
            },
            // 在 mounted 中初始化尺寸和监听
            mounted() {
                this.updateContainerSize();
                this.updateBodySize();
                window.addEventListener('resize', this.handleResize);
            },
            beforeDestroy() {
                window.removeEventListener('resize', this.handleResize);
            },
            computed: {
                mappedStations() {
                    return this.tableDataDev.map(station => ({
                        ...station,
                        position: this.convertToCSSPosition(station.valueX, station.valueY)
                    }));
                }
            },
            methods: {
                init(){
                    this.getTableDataRgv()
                    this.getTableDataDev()
                    this.getTableDataTrack()
                    this.getTableDataLeft()
                    this.getTableDataLeft1()
                    this.getTableDataRight()
                    this.getTableDataRight1()
                    this.getValueSystem()
@@ -500,6 +575,7 @@
                        this.getTableDataDev()
                        this.getTableDataTrack()
                        this.getTableDataLeft()
                        this.getTableDataLeft1()
                        this.getTableDataRight()
                        this.getTableDataRight1()
                        this.getValueSystem()
@@ -508,6 +584,59 @@
                    }, 1000)
                },
                // 获取容器实际尺寸
                updateContainerSize() {
                    const mapEl = this.$el.querySelector('.map');
                    this.containerSize = {
                        width: mapEl.clientWidth,
                        height: mapEl.clientHeight
                    };
                },
                convertToCSSPositionWithOffset(svgX, svgY, radius) {
                    const basePos = this.convertToCSSPosition(svgX, svgY);
                    // 示例:向右偏移半径的距离(可根据需求调整偏移方向)
                    return {
                        x: basePos.x -14,
                        y: basePos.y -14
                    };
                },
                // 更新body尺寸
                updateBodySize() {
                    this.bodySize = getBodySize();
                },
                // 坐标转换函数
                convertToCSSPosition(svgX, svgY) {
                    const svgWidth = 1200;  // SVG 原始宽度
                    let svgWidthR = 0;  //
                    const svgHeight = 850; // SVG 原始高度
                    let svgHeightR = 0; //
                    if (svgX>svgWidth/2){
                        svgWidthR = (((svgX-svgWidth/2)/svgWidth) * this.containerSize.width) + this.bodySize.width/2 - this.bodySize.width*((1-0.52)/2);
                    } else {
                        svgWidthR = this.bodySize.width/2 - (((svgWidth/2 - svgX)/svgWidth) * this.containerSize.width)  - this.bodySize.width*((1-0.52)/2);
                    }
                    if (svgY>svgHeight/2){
                        svgHeightR = (((svgY-svgHeight/2)/svgHeight) * this.containerSize.height) + this.bodySize.height/2 - this.bodySize.height*((1-0.72)/2);
                    } else {
                        svgHeightR = this.bodySize.height/2 - (((svgHeight/2 - svgY)/svgHeight) * this.containerSize.height)  - this.bodySize.height*((1-0.72)/2);
                    }
                    return {
                        x: svgWidthR,
                        y: svgHeightR
                    };
                },
                handleZoom(e) {
                    const scaleDelta = e.deltaY > 0 ? 0.9 : 1.1;
                    const currentScale = this.scale || 1;
                    const newScale = Math.max(0.5, Math.min(2, currentScale * scaleDelta));
                    // 应用缩放
                    const svgEl = this.$el.querySelector('.container');
                    svgEl.style.transform = `scale(${newScale})`;
                    this.scale = newScale;
                },
                verifyPassword(callback) {
                    this.$prompt('请输入管理员密码: root', '验证', {
                        confirmButtonText: '确定',
@@ -663,7 +792,9 @@
                            }
                        }
                    });
                    // setTimeout(function() {
                    //
                    // }, 1000);
                },
                getValueSystem() {
                    let that = this;
@@ -683,11 +814,11 @@
                },
                upDateValueSystem(){
                    let that = this;
                    let operatorTypeI = 0;
                    if (that.valueSystem){
                        operatorTypeI = 1;
                    }
                    this.verifyPassword(() => {
                        let operatorTypeI = 0;
                        if (that.valueSystem){
                            operatorTypeI = 1;
                        }
                        $.ajax({
                            url: baseUrl + "/console/system/switch",
                            headers: {'token': localStorage.getItem('token')},
@@ -714,6 +845,22 @@
                        method: 'post',
                        success: function (res) {
                            that.tableDataLeft = res.data
                        }
                    });
                },
                getTableDataLeft1() {
                    let that = this;
                    $.ajax({
                        url: baseUrl + "/rgv/ring/through/task/wrk/mast/position/data/v1",
                        headers: {
                            'token': localStorage.getItem('token')
                        },
                        data: {},
                        dataType: 'json',
                        contentType: 'application/json;charset=UTF-8',
                        method: 'post',
                        success: function (res) {
                            that.tableDataLeft1 = res.data
                        }
                    });
                },
@@ -798,7 +945,12 @@
                            that.energyGatheringRing = res.data
                        }
                    });
                }
                },
                // 处理窗口大小变化
                handleResize: _.debounce(function() {
                    this.updateContainerSize();
                    this.updateBodySize();
                }, 100)
            }
        })