From 2e41623f7fd7fd4f01b08cda81012edc9c573d91 Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Tue, 28 Feb 2023 14:18:49 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/srs-police-web
---
src/views/security/security.vue | 325 +++++++++++++++++++++++++++++++++++++----------------
1 files changed, 227 insertions(+), 98 deletions(-)
diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index a043517..80a4ea3 100644
--- a/src/views/security/security.vue
+++ b/src/views/security/security.vue
@@ -1,17 +1,28 @@
<template>
<basic-container>
<avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
- :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
- @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
- @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
+ :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave"
+ @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset"
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+ @refresh-change="refreshChange" @on-load="onLoad">
<template slot="menuLeft">
- <el-button size="small" icon="el-icon-delete" plain v-if="permission.security_delete" @click="handleDelete">删 除
+ <el-button size="small" icon="el-icon-delete" plain v-if="permission.security_delete"
+ @click="handleDelete">删 除
</el-button>
</template>
<template slot-scope="{type,size,row,index}" slot="menu">
- <el-button icon="el-icon-coordinate" :size="size" :type="type" @click="handlePersonList(row)">活动人员</el-button>
- <el-button icon="el-icon-data-line" :size="size" :type="type" @click="handleCarList(row)">活动车辆</el-button>
+ <el-button icon="el-icon-coordinate" :size="size" :type="type"
+ @click="handlePersonList(row)">活动人员
+ </el-button>
+ <el-button icon="el-icon-data-line" :size="size" :type="type"
+ @click="handleCarList(row)">活动车辆
+ </el-button>
</template>
+ <template slot="activityAreaForm">
+<!-- <map-box ref="OpenLayersMap" @toData="toData" :routeRange="form.activityArea"></map-box>-->
+ <dc-map ref="dcMap" @toData="toData" :range="form.activityArea"></dc-map>
+ </template>
+
</avue-crud>
<el-drawer title="活动人员区域" :visible.sync="personBox" :append-to-body="true" size="50%" :destroy-on-close="true">
@@ -21,27 +32,48 @@
<el-drawer title="活动车辆区域" :visible.sync="carBox" :append-to-body="true" size="50%" :destroy-on-close="true">
<securityManageCar ref="car" :securityId="securityId"/>
</el-drawer>
+
+ <el-dialog
+ title="提示"
+ :visible.sync="placeBox"
+ append-to-body
+ destroy-on-close
+ width="70%">
+ <search-map @getLonLat="getLonLat" @getAddress="getAddress" :point-lon-lat="point"></search-map>
+ <span slot="footer" class="dialog-footer">
+ <el-button type="primary" @click="confirmLonLat">确 定</el-button>
+ </span>
+ </el-dialog>
</basic-container>
</template>
<script>
-import { getPage, getDetail, add, update, remove } from "@/api/security/security";
-import { getUserInfos } from "@/api/system/user";
+import {getPage, getDetail, add, update, remove} from "@/api/security/security"
+import {getUserInfos} from "@/api/system/user"
// import AvueMap from 'avue-plugin-map';
-import { mapGetters } from "vuex";
+import {mapGetters} from "vuex"
import securityManage from "@/views/securityManage/securityManage"
import securityManageCar from "@/views/securityManageCar/securityManageCar"
+import MapBox from "@/components/map/mapBox";
+import SearchMap from "@/components/map/searchMap";
+import DcMap from "@/components/map/dcMap";
export default {
components: {
+ DcMap,
+ SearchMap,
+ MapBox,
securityManage,
securityManageCar
},
data() {
return {
- securityId:"",
+ securityId: "",
carBox: false,
personBox: false,
+ placeBox: false,
+ point:"",
+ chosePoint:{},
form: {},
query: {},
loading: true,
@@ -72,40 +104,94 @@
prop: "name",
search: true,
searchSpan: 4,
+ rules: [{
+ required: true,
+ message: "请输入活动名称",
+ trigger: "blur"
+ }],
+ overHidden:true,
},
{
label: "负责单位",
prop: "company",
+ hide:true,
},
{
label: "负责人",
prop: "person",
- width: 80
+ width: 80,
+ rules: [{
+ required: true,
+ message: "请输入负责人",
+ trigger: "blur"
+ }],
},
{
label: "联系方式",
prop: "contact",
- width: 100
+ width: 100,
+ rules: [{
+ required: true,
+ message: "请输入联系方式",
+ trigger: "blur"
+ }],
},
{
label: "活动地点",
prop: "place",
- // addDisplay: false,
- // editDisplay: false,
- // viewDisplay: false,
+ span: 24,
+ click: () => {
+ this.placeBox = !this.placeBox
+ },
+ overHidden:true,
+ },
+ {
+ label: "经度",
+ prop: "longitude",
+ span: 12,
+ hide: true,
+ disabled:true,
+ rules: [{
+ required: true,
+ message: "请输入纬度",
+ trigger: "blur"
+ }],
+ },
+ {
+ label: "纬度",
+ prop: "latitude",
+ span: 12,
+ hide: true,
+ disabled: true,
+ rules: [{
+ required: true,
+ message: "请输入纬度",
+ trigger: "blur"
+ }],
+ },
+ {
+ label: "活动区域",
+ prop: "activityArea",
+ type: "input",
+ hide: true,
+ span: 24,
+ display: true,
+ addDisplay: true
},
{
label: "所属辖区",
prop: "deptId",
type: "tree",
- dicUrl: "api/blade-system/dept/lazy-list",
+ dicUrl: "api/blade-system/dept/getPoliceStationTree",
props: {
- label: 'deptName',
+ label: 'name',
value: 'id',
children: 'children'
},
search: true,
searchSpan: 4,
+ span: 24,
+ defaultExpandAll:"true",
width: 110,
rules: [{
required: true,
@@ -146,17 +232,6 @@
}],
width: 120,
},
- {
- label: "活动内容",
- prop: "content",
- },
- {
- label: "经纬度",
- prop: "position",
- type: "input",
- span: 12,
- hide: true
- },
// {
// label: "",
// prop: "map",
@@ -168,11 +243,6 @@
// // display:false,
// component: "AvueMap",
// },
- {
- label: "人数",
- prop: "number",
- width: 60,
- },
{
label: "活动类型",
prop: "type",
@@ -189,10 +259,27 @@
}],
width: 90,
},
+ {
+ label: "人数",
+ prop: "number",
+ width: 60,
+ rules: [{
+ required: true,
+ message: "请输入人数",
+ trigger: "blur"
+ }],
+ },
+ {
+ label: "活动内容",
+ prop: "content",
+ type: "textarea",
+ span: 24,
+ hide:true,
+ },
]
},
data: []
- };
+ }
},
// watch: {
// //latitude longitude formattedAddress
@@ -213,58 +300,70 @@
viewBtn: this.vaildData(this.permission.security_view, false),
delBtn: this.vaildData(this.permission.security_delete, false),
editBtn: this.vaildData(this.permission.security_edit, false)
- };
+ }
},
ids() {
- let ids = [];
+ let ids = []
this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
+ ids.push(ele.id)
+ })
+ return ids.join(",")
}
},
- created(){
- const tokenLength = window.location.href.indexOf('=');
- if(tokenLength>0){
+ created() {
+ const tokenLength = window.location.href.indexOf('=')
+ if (tokenLength > 0) {
//取“=”之后的token
- let z = window.location.href.substring(tokenLength + 1)
- this.$store.commit('SET_TOKEN', z);
- this.$store.commit('DEL_ALL_TAG');
- this.$store.commit('CLEAR_LOCK');
this.getUserInfo()
}
},
methods: {
- getUserInfo(){
- getUserInfos().then(res=>{
- this.$store.commit('SET_USER_INFO', res.data.data);
+ getUserInfo() {
+ getUserInfos().then(res => {
+ const data = res.data
+ this.$store.commit('SET_TOKEN', data.access_token)
+ this.$store.commit('SET_REFRESH_TOKEN', data.refresh_token)
+ this.$store.commit('SET_TENANT_ID', data.tenant_id)
+ this.$store.commit('SET_USER_INFO', data)
+ this.$store.commit('DEL_ALL_TAG')
+ this.$store.commit('CLEAR_LOCK')
})
},
rowSave(row, done, loading) {
+ row.position = row.longitude + " " + row.latitude
add(row).then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: "success",
message: "操作成功!"
- });
- done();
+ })
+ done()
}, error => {
- loading();
- window.console.log(error);
- });
+ loading()
+ window.console.log(error)
+ })
},
rowUpdate(row, index, done, loading) {
+ if (!row.activityArea) {
+ this.$message.warning("请绘制活动区域")
+ loading()
+ return
+ }
+ if (!row.activityArea.startsWith("'LINESTRING")){
+ row.activityArea = "'LINESTRING("+row.activityArea+")'"
+ }
+ row.position = row.longitude + " " + row.latitude
update(row).then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: "success",
message: "操作成功!"
- });
- done();
+ })
+ done()
}, error => {
- loading();
- console.log(error);
- });
+ loading()
+ console.log(error)
+ })
},
rowDel(row) {
this.$confirm("确定将选择数据删除?", {
@@ -273,20 +372,20 @@
type: "warning"
})
.then(() => {
- return remove(row.id);
+ return remove(row.id)
})
.then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: "success",
message: "操作成功!"
- });
- });
+ })
+ })
},
handleDelete() {
if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
+ this.$message.warning("请选择至少一条数据")
+ return
}
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
@@ -294,78 +393,108 @@
type: "warning"
})
.then(() => {
- return remove(this.ids);
+ return remove(this.ids)
})
.then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: "success",
message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
+ })
+ this.$refs.crud.toggleSelection()
+ })
},
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
+ var data = res.data.data
+ this.form = data
+ this.form['longitude'] = data.position.split(" ")[0]
+ this.form['latitude'] = data.position.split(" ")[1]
+ this.point = "POINT("+this.form.longitude +" "+this.form.latitude+")"
+ this.$refs.dcMap.showPolygon(this.form.activityArea)
+ })
}
- done();
+ done()
},
searchReset() {
- this.query = {};
- this.onLoad(this.page);
+ this.query = {}
+ this.onLoad(this.page)
},
searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
+ this.query = params
+ this.page.currentPage = 1
+ this.onLoad(this.page, params)
+ done()
},
selectionChange(list) {
- this.selectionList = list;
+ this.selectionList = list
},
selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
},
currentChange(currentPage) {
- this.page.currentPage = currentPage;
+ this.page.currentPage = currentPage
},
sizeChange(pageSize) {
- this.page.pageSize = pageSize;
+ this.page.pageSize = pageSize
},
refreshChange() {
- this.onLoad(this.page, this.query);
+ this.onLoad(this.page, this.query)
},
onLoad(page, params = {}) {
- this.loading = true;
+ this.loading = true
if (this.userInfo.role_name != "admin" && this.userInfo.role_name != "administrator") {
- params["jurisdiction"] = this.userInfo.dept_id;
+ params["jurisdiction"] = this.userInfo.dept_id
}
getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
+ const data = res.data.data
+ this.page.total = data.total
+ this.data = data.records
+ this.loading = false
+ this.selectionClear()
+ })
},
//活动人员区域点击按钮事件
handlePersonList(row) {
- this.personBox = true;
+ this.personBox = true
this.securityId = row.id
},
//活动车辆区域点击按钮事件
handleCarList(row) {
- this.carBox = true;
+ this.carBox = true
this.securityId = row.id
+ },
+ //地图传回的polygon坐标
+ toData(data) {
+ this.form.activityArea = data
+ },
+ getLonLat(data){
+ this.chosePoint.longitude = data[0]
+ this.chosePoint.latitude = data[1]
+ },
+ getAddress(data){
+ this.chosePoint.address = data
+ },
+ confirmLonLat(){
+ if(this.chosePoint.longitude){
+ this.form.longitude = this.chosePoint.longitude
+ this.form.latitude = this.chosePoint.latitude
+ this.form.place = this.chosePoint.address
+ this.point = "POINT("+this.form.longitude +" "+this.form.latitude+")"
+ this.placeBox = false
+ }else {
+ this.$alert('该点没有位置信息,请重新选点!', '提示', {
+ confirmButtonText: '确定',
+ });
+ }
+
}
}
-};
+}
</script>
<style>
--
Gitblit v1.9.3