From f02caef2e782b578b2a29b84b59b15e2f43648f2 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Mon, 20 Feb 2023 17:29:18 +0800
Subject: [PATCH] 警员,值班新增导入
---
src/views/security/security.vue | 799 ++++++++++++++++++++++++++++++++++----------------------
1 files changed, 483 insertions(+), 316 deletions(-)
diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index 27d5f51..80a4ea3 100644
--- a/src/views/security/security.vue
+++ b/src/views/security/security.vue
@@ -1,335 +1,502 @@
<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">
+ <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">
<template slot="menuLeft">
- <el-button
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.security_delete"
+ <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>
+ </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">
+ <securityManage ref="securityManage" :securityId="securityId"/>
+ </el-drawer>
+
+ <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 AvueMap from 'avue-plugin-map';
- import {mapGetters} from "vuex";
+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 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 {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- height: 'auto',
- calcHeight: 30,
- labelWidth: "100",
- dialogWidth: 950,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- selection: true,
- excelBtn: true,
- dialogClickModal: false,
- column: [
- {
- label: "活动名称",
- prop: "name",
- search: true,
- searchSpan:4,
- },
- {
- label: "负责单位",
- prop: "company",
- },
- {
- label: "负责人",
- prop: "person",
- },
- {
- label: "联系方式",
- prop: "contact",
- },
- {
- label: "活动地点",
- prop: "place",
- // addDisplay: false,
- // editDisplay: false,
- // viewDisplay: false,
- },
- {
- label: "所属辖区",
- prop: "deptId",
- type: "tree",
- dicUrl: "api/blade-system/dept/lazy-list",
- props:{
- label:'deptName',
- value:'id',
- children:'children'
- },
- search: true,
- searchSpan:4,
- rules: [{
- required: true,
- message: "请选择所属辖区",
- trigger: "blur"
- }]
- },
- // {
- // label: "地址",
- // prop: "avueMap",
- // type: "map",
- // },
- {
- label: "开始时间",
- prop: "startTime",
- type: "datetime",
- defaultTime: '00:00:00',
- format: "yyyy-MM-dd HH:mm",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- rules: [{
- required: true,
- message: "请输入开始时间",
- trigger: "blur"
- }],
- },
- {
- label: "结束时间",
- prop: "endTime",
- type: "datetime",
- defaultTime: '23:59:59',
- format: "yyyy-MM-dd HH:mm",
- valueFormat: "yyyy-MM-dd HH:mm",
- rules: [{
- required: true,
- message: "请输入结束时间",
- trigger: "blur"
- }],
- },
- {
- label: "活动内容",
- prop: "content",
- },
- {
- label: "经纬度",
- prop: "position",
- type: "input",
- span: 9,
- hide:true
- },
- {
- label: "",
- prop: "map",
- labelWidth: 10,
- searchSpan: 0,
- // maxlength: 5,
- hide: true,
- span: 3,
- // display:false,
- component: "AvueMap",
- },
- {
- label: "人数",
- prop: "number",
- },
- {
- label: "活动类型",
- prop: "type",
- type:"select",
- dicUrl:"/api/blade-system/dict-biz/dictionary?code=securityType",
- props:{
- label:"dictValue",
- value:"dictKey"
- },
- rules: [{
- required: true,
- message: "请选择活动类型",
- trigger: "blur"
- }]
- },
- ]
- },
- data: []
- };
- },
- // watch: {
- // //latitude longitude formattedAddress
- // "form.avueMap":{
- // handler (newObj) {
- // if (newObj.length>0) {
- // this.form.place = newObj[2]
- // this.form.position = newObj[0]+","+newObj[1]
- // }
- // }
- // }
- // },
- computed: {
- ...mapGetters(["userInfo","permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.security_add, false),
- viewBtn: this.vaildData(this.permission.security_view, false),
- delBtn: this.vaildData(this.permission.security_delete, false),
- editBtn: this.vaildData(this.permission.security_edit, false)
- };
+export default {
+ components: {
+ DcMap,
+ SearchMap,
+ MapBox,
+ securityManage,
+ securityManageCar
+ },
+ data() {
+ return {
+ securityId: "",
+ carBox: false,
+ personBox: false,
+ placeBox: false,
+ point:"",
+ chosePoint:{},
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
},
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
- },
- methods: {
- rowSave(row, done, loading) {
- add(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
+ selectionList: [],
+ option: {
+ height: 'auto',
+ calcHeight: 30,
+ labelWidth: "100",
+ dialogWidth: 950,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ excelBtn: true,
+ dialogClickModal: false,
+ menuWidth: 370,
+ column: [
+ {
+ label: "活动名称",
+ prop: "name",
+ search: true,
+ searchSpan: 4,
+ rules: [{
+ required: true,
+ message: "请输入活动名称",
+ trigger: "blur"
+ }],
+ overHidden:true,
+ },
+ {
+ label: "负责单位",
+ prop: "company",
+ hide:true,
+ },
+ {
+ label: "负责人",
+ prop: "person",
+ width: 80,
+ rules: [{
+ required: true,
+ message: "请输入负责人",
+ trigger: "blur"
+ }],
+ },
+ {
+ label: "联系方式",
+ prop: "contact",
+ width: 100,
+ rules: [{
+ required: true,
+ message: "请输入联系方式",
+ trigger: "blur"
+ }],
+ },
+ {
+ label: "活动地点",
+ prop: "place",
+ 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/getPoliceStationTree",
+ props: {
+ label: 'name',
+ value: 'id',
+ children: 'children'
+ },
+ search: true,
+ searchSpan: 4,
+ span: 24,
+ defaultExpandAll:"true",
+ width: 110,
+ rules: [{
+ required: true,
+ message: "请选择所属辖区",
+ trigger: "blur"
+ }]
+ },
+ // {
+ // label: "地址",
+ // prop: "avueMap",
+ // type: "map",
+ // },
+ {
+ label: "开始时间",
+ prop: "startTime",
+ type: "datetime",
+ defaultTime: '00:00:00',
+ format: "yyyy-MM-dd HH:mm",
+ valueFormat: "yyyy-MM-dd HH:mm:ss",
+ rules: [{
+ required: true,
+ message: "请输入开始时间",
+ trigger: "blur"
+ }],
+ width: 120,
+ },
+ {
+ label: "结束时间",
+ prop: "endTime",
+ type: "datetime",
+ defaultTime: '23:59:59',
+ format: "yyyy-MM-dd HH:mm",
+ valueFormat: "yyyy-MM-dd HH:mm",
+ rules: [{
+ required: true,
+ message: "请输入结束时间",
+ trigger: "blur"
+ }],
+ width: 120,
+ },
+ // {
+ // label: "",
+ // prop: "map",
+ // labelWidth: 10,
+ // searchSpan: 0,
+ // // maxlength: 5,
+ // hide: true,
+ // span: 3,
+ // // display:false,
+ // component: "AvueMap",
+ // },
+ {
+ label: "活动类型",
+ prop: "type",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=securityType",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ rules: [{
+ required: true,
+ message: "请选择活动类型",
+ trigger: "blur"
+ }],
+ width: 90,
+ },
+ {
+ label: "人数",
+ prop: "number",
+ width: 60,
+ rules: [{
+ required: true,
+ message: "请输入人数",
+ trigger: "blur"
+ }],
+ },
+ {
+ label: "活动内容",
+ prop: "content",
+ type: "textarea",
+ span: 24,
+ hide:true,
+ },
+ ]
},
- rowUpdate(row, index, done, loading) {
- update(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- console.log(error);
- });
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
-
- if (this.userInfo.role_name != "admin" && this.userInfo.role_name != "administrator"){
- 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();
- });
- }
+ data: []
}
- };
+ },
+ // watch: {
+ // //latitude longitude formattedAddress
+ // "form.avueMap":{
+ // handler (newObj) {
+ // if (newObj.length>0) {
+ // this.form.place = newObj[2]
+ // this.form.position = newObj[0]+","+newObj[1]
+ // }
+ // }
+ // }
+ // },
+ computed: {
+ ...mapGetters(["userInfo", "permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.security_add, false),
+ 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 = []
+ this.selectionList.forEach(ele => {
+ ids.push(ele.id)
+ })
+ return ids.join(",")
+ }
+ },
+ created() {
+ const tokenLength = window.location.href.indexOf('=')
+ if (tokenLength > 0) {
+ //取“=”之后的token
+ this.getUserInfo()
+ }
+ },
+ methods: {
+ 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.$message({
+ type: "success",
+ message: "操作成功!"
+ })
+ done()
+ }, 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.$message({
+ type: "success",
+ message: "操作成功!"
+ })
+ done()
+ }, error => {
+ loading()
+ console.log(error)
+ })
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(row.id)
+ })
+ .then(() => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ })
+ })
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据")
+ return
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(this.ids)
+ })
+ .then(() => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ })
+ this.$refs.crud.toggleSelection()
+ })
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then(res => {
+ 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()
+ },
+ searchReset() {
+ this.query = {}
+ this.onLoad(this.page)
+ },
+ searchChange(params, done) {
+ this.query = params
+ this.page.currentPage = 1
+ this.onLoad(this.page, params)
+ done()
+ },
+ selectionChange(list) {
+ this.selectionList = list
+ },
+ selectionClear() {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
+ },
+ currentChange(currentPage) {
+ this.page.currentPage = currentPage
+ },
+ sizeChange(pageSize) {
+ this.page.pageSize = pageSize
+ },
+ refreshChange() {
+ this.onLoad(this.page, this.query)
+ },
+ onLoad(page, params = {}) {
+ this.loading = true
+
+ if (this.userInfo.role_name != "admin" && this.userInfo.role_name != "administrator") {
+ 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()
+ })
+ },
+ //活动人员区域点击按钮事件
+ handlePersonList(row) {
+ this.personBox = true
+ this.securityId = row.id
+ },
+ //活动车辆区域点击按钮事件
+ handleCarList(row) {
+ 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>
+
</style>
--
Gitblit v1.9.3