shuishen
2023-02-11 6830420ded2f404da6ef57fd0bb982a4b64a08da
Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/srs-police-affairs
3 files modified
177 ■■■■ changed files
src/api/activity/index.js 9 ●●●●● patch | view | raw | blame | history
src/styles/base/index.scss 38 ●●●●● patch | view | raw | blame | history
src/views/activity/index.vue 130 ●●●● patch | view | raw | blame | history
src/api/activity/index.js
@@ -6,7 +6,7 @@
 * @param {*}
 * @returns
 */
export const getSecurityList = (current, size, type, name, startTime, endTime,deptId) => {
export const getSecurityList = (current, size, type, name, startTime, endTime, deptId) => {
    return request({
        url: `/api/security/security/page`,
        method: 'get',
@@ -184,14 +184,15 @@
 * @param {*} type  箭头类型
 * @returns
 */
export const addSecurityPlot = (securityId, position, type) => {
export const addSecurityPlot = (securityId, position, type, name) => {
    return request({
        url: `/api/securityPlot/securityPlot/save`,
        method: 'post',
        data: {
            securityId,
            position,
            type
            type,
            name
        }
    })
}
@@ -212,7 +213,7 @@
}
/**
 * 获得活动标绘箭头列表
 * 更新活动标绘箭头
 * @param {*} securityId  活动ID
 * @returns
 */
src/styles/base/index.scss
@@ -769,8 +769,8 @@
        margin: 0 !important;
        display: flex;
        flex-direction: column;
        width: 340px;
        height: 200px;
        width: 300px;
        height: 170px;
        top: 50%;
        left: 50% !important;
        transform: translate(-50%, -50%);
@@ -783,11 +783,43 @@
                width: 60px;
                height: 30px;
                text-align: center;
                margin-top: 10px;
            }
            &>div {
                display: flex;
                justify-content: space-around;
                justify-content: center;
                margin-bottom: 10px;
            }
        }
    }
}
.add-polygon-box {
    .el-dialog {
        margin: 0 !important;
        display: flex;
        flex-direction: column;
        width: 300px;
        height: 140px;
        top: 50%;
        left: 50% !important;
        transform: translate(-50%, -50%);
        .el-dialog__body {
            .el-button {
                padding: 0;
                background-color: #409eff;
                color: #fff;
                width: 60px;
                height: 30px;
                text-align: center;
                margin-top: 10px;
            }
            &>div {
                display: flex;
                justify-content: center;
                margin-bottom: 10px;
            }
        }
src/views/activity/index.vue
@@ -484,7 +484,6 @@
            :title="lineEditTitle"
            :modal="false"
            :visible.sync="lineEditVisible"
            :before-close="lineEditBeforeClose"
            :close-on-click-modal="true"
            class="edit-line-box"
        >
@@ -501,8 +500,26 @@
                </div>
            </div>
            <div>
                <el-button>查看视频</el-button>
                <el-button>保存</el-button>
                <el-button @click="watchVideo">查看视频</el-button>
                <el-button @click="saveLineInfo">保存</el-button>
            </div>
        </el-dialog>
        <el-dialog
            :title="polygonAddTitle"
            :modal="false"
            :visible.sync="polygonAddVisible"
            :close-on-click-modal="true"
            class="add-polygon-box"
        >
            <div>
                <div>设置名称:</div>
                <div>
                    <input type="text" placeholder="请输入区域名称" v-model="polygonName" />
                </div>
            </div>
            <div>
                <el-button @click="savePolygonInfo">保存</el-button>
            </div>
        </el-dialog>
    </div>
@@ -728,6 +745,10 @@
            videoShow: false,
            lineEditVisible: false,
            lineEditTitle: '弹窗',
            polygonAddTitle: '新增活动区域',
            polygonAddVisible: false,
            polygonName: '',
            polygonPositionStr: '',
        }
    },
    created () {
@@ -745,8 +766,6 @@
        this.getCarList()
        this.getSecurityList(this.currentPage, this.pagesize)
    },
    mounted () {
@@ -902,7 +921,7 @@
                                id: item.id,
                                policemanId: item.policemanId
                            },
                            incident: this.overlayTypeClick
                            // incident: this.overlayTypeClick
                        })
                    } else if (item.type == 3 && pointShow) {
@@ -1313,10 +1332,27 @@
        drawArrow (type) {
            if (type == 'polygon') {
                const that = this
                let flag = false
                plot && plot.draw(type, overlay => {
                    if (overlay) {
                        drawArrowLayers.addOverlay(overlay)
                        plot.edit(overlay)
                        plot.edit(overlay, (e) => {
                            flag = true
                            let positionStr = ''
                            overlay._positions.forEach(item => {
                                positionStr += item._lng + ' ' + item._lat + ','
                            })
                            positionStr = positionStr.slice(0, positionStr.length - 1)
                            this.polygonPositionStr = positionStr
                            // overlay.on(global.DC.MouseEventType.CLICK, this.polygonClick)
                            document.oncontextmenu = function () {
                                if (flag) {
                                    that.polygonAddVisible = true
                                    flag = false
                                }
                            }
                        })
                    }
                })
            } else {
@@ -1457,7 +1493,6 @@
        // 地图绘制元素点击事件
        overlayTypeClick (e) {
            console.log(e)
            this.policeIconIsCreated = true
            if ('policemanId' in e.overlay.attrParams) {
                this.policeChooseTitle = '选择警员'
@@ -1466,23 +1501,27 @@
                this.policeType = e.overlay.attrParams.policemanId
                this.policeChooseVisible = true
            } else if ('carId' in e.overlay.attrParams) {
                if (e.overlay.attrParams.carId) {
                    this.policeChooseTitle = '选择警车'
                    this.policeOption = this.policecarOption
                    this.policeIconId = e.overlay.attrParams.id
                    this.policeType = e.overlay.attrParams.carId
                    this.policeChooseVisible = true
                } else {
                    console.log(111)
                    this.lineEditVisible = true
                }
                this.policeChooseTitle = '选择警车'
                this.policeOption = this.policecarOption
                this.policeIconId = e.overlay.attrParams.id
                this.policeType = e.overlay.attrParams.carId
                this.policeChooseVisible = true
            }
        },
        // 保存活动标绘箭头
        addSecurityPlot (securityId, position, type) {
            addSecurityPlot(securityId, position, type).then(res => {
        addSecurityPlot (securityId, position, type, name) {
            addSecurityPlot(securityId, position, type, name).then(res => {
                if (res.data.success) {
                    this.$message({
                        message: '保存成功',
                        type: 'warning'
                    })
                } else {
                    this.$message({
                        message: '保存失败'
                    })
                }
                this.getSecurityPlotList(securityId, this.arrowBtnSwitch)
            })
        },
@@ -1499,6 +1538,7 @@
                res.data.data.forEach(item => {
                    let position = item.position.slice(11, item.position.length - 1).replace(/,/g, ';').replace(/ /g, ',')
                    let chooseArrow = null
                    let nameLabel = null
                    if (item.type == 1) {
                        chooseArrow = new global.DC.AttackArrow(position)
                    } else if (item.type == 2) {
@@ -1507,6 +1547,15 @@
                        chooseArrow = new global.DC.FineArrow(position)
                    } else if (item.type == 4) {
                        chooseArrow = new global.DC.TailedAttackArrow(position)
                    } else if (item.type == 5) {
                        chooseArrow = new global.DC.Polygon(position)
                        let center = this.getCenter(item.position)
                        let centerPosition = new global.DC.Position(center[0], center[1])
                        nameLabel = new global.DC.Label(centerPosition, item.name)
                        arrowsListLayer.addOverlay(nameLabel)
                        // nameLabel.setStyle({
                        //     "font": "30px",
                        // })
                    }
                    chooseArrow.attrParams = { 'id': item.id }
                    arrowsListLayer.addOverlay(chooseArrow)
@@ -1532,8 +1581,8 @@
            })
        },
        updateSecurityPlot (id, position) {
            updateSecurityPlot(id, position).then(res => {
        updateSecurityPlot (id, position, name) {
            updateSecurityPlot(id, position, name).then(res => {
                this.getSecurityPlotList(this.showingSecurityId, this.arrowBtnSwitch)
            })
        },
@@ -1692,6 +1741,41 @@
            }
        },
        // 观看视频
        watchVideo () {
            this.videoShow = true
        },
        // 保存巡逻路线信息
        saveLineInfo () {
            console.log('保存')
        },
        // 点击区域
        // polygonClick () {
        //     console.log('polygonClick')
        // },
        // 保存绘制区域
        savePolygonInfo () {
            this.addSecurityPlot(this.showingSecurityId, this.polygonPositionStr, 5, this.polygonName)
            this.polygonAddVisible = false
        },
        // 获取面的中心点
        getCenter (str) {
            let itPositionStr = str.slice(11, str.length - 1)
            let positionArr = itPositionStr.split(',')
            let positionNewArr = []
            positionArr.forEach(item => {
                positionNewArr.push([Number(item.split(' ')[0]), Number(item.split(' ')[1])])
            })
            positionNewArr.push([Number(positionArr[0].split(' ')[0]), Number(positionArr[0].split(' ')[1])])
            let polygon = this.$turf.polygon([positionNewArr])
            let center = this.$turf.centroid(polygon)
            return [center.geometry.coordinates[0], center.geometry.coordinates[1]]
        },
    },
    computed: {