From c393f8b721c1e7f6ea65ff0f3ad3a47dce71cfbc Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 21 Jan 2025 10:20:34 +0800
Subject: [PATCH] 格式异常问题解决
---
src/views/securityManage/securityManage.vue | 579 ++++++++++++++++++++++++++++-----------------------------
1 files changed, 286 insertions(+), 293 deletions(-)
diff --git a/src/views/securityManage/securityManage.vue b/src/views/securityManage/securityManage.vue
index be694a7..51a0b33 100644
--- a/src/views/securityManage/securityManage.vue
+++ b/src/views/securityManage/securityManage.vue
@@ -1,45 +1,24 @@
<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.securityManage_delete"
- @click="handleDelete">删 除
+ <el-button size="small" icon="el-icon-delete" plain v-if="permission.securityManage_delete"
+ @click="handleDelete">删 除
</el-button>
</template>
<template slot-scope="{type,size,row,index}" slot="menu">
- <el-button icon="el-icon-view" :size="size" :type="type" @click="handleDetail(row)">地 图</el-button>
- <el-button icon="el-icon-edit" v-if="permission.range_edit" :size="size" :type="type" @click="$refs.crud.rowEdit(row,index)">编 辑</el-button>
- <el-button icon="el-icon-delete" v-if="permission.range_delete" :size="size" :type="type" @click="$refs.crud.rowDel(row,index)">删 除</el-button>
+ <el-button icon="el-icon-view" :size="size" :type="type" @click="handleDetail(row)">地 图</el-button>
+ <!-- <el-button icon="el-icon-edit" v-if="permission.range_edit" :size="size" :type="type"
+ @click="$refs.crud.rowEdit(row, index)">编 辑</el-button> -->
+ <el-button icon="el-icon-delete" v-if="permission.range_delete" :size="size" :type="type"
+ @click="$refs.crud.rowDel(row, index)">删 除</el-button>
</template>
</avue-crud>
- <el-drawer
- title="地图详情"
- :visible.sync="isDetail"
- :append-to-body="true"
- size="60%"
- direction="rtl"
+ <el-drawer title="地图详情" :visible.sync="isDetail" :append-to-body="true" size="60%" direction="rtl"
:before-close="handleClose">
<map-box v-if="isDetail" :is-detail="isDetail" :route-range="routeRange"></map-box>
</el-drawer>
@@ -47,276 +26,290 @@
</template>
<script>
- import {getPage, getDetails, add, update, remove} from "@/api/securityManage/securityManage";
- import {getAll} from "@/api/security/security";
- import {mapGetters} from "vuex";
- import MapBox from "@/components/map/mapBox";
+import { getPage, getDetails, add, update, remove } from "@/api/securityManage/securityManage";
+import { getAll } from "@/api/security/security";
+import { mapGetters } from "vuex";
+import MapBox from "@/components/map/mapBox";
- export default {
- components: {MapBox},
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- height:'auto',
- menuWidth:250,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: false,
- delBtn: false,
- editBtn: false,
- selection: true,
- dialogClickModal: false,
- column: [
- {
- label: "活动",
- prop:"securityId",
- search: true,
- type:"select",
- dicData:[],
- props:{
- label:"name",
- value:"id"
- },
- rules: [{
- required: true,
- message: "请选择所属活动",
- trigger: "blur"
- }],
- searchSpan:6,
+export default {
+ components: { MapBox },
+ props: [
+ 'securityId'
+ ],
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
+ },
+ selectionList: [],
+ option: {
+ height: 'auto',
+ menuWidth: 250,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: true,
+ index: true,
+ viewBtn: false,
+ delBtn: false,
+ editBtn: false,
+ addBtn:false,
+ selection: true,
+ dialogClickModal: false,
+ column: [
+ {
+ label: "活动",
+ prop: "securityId",
+ // search: true,
+ type: "select",
+ dicData: [],
+ props: {
+ label: "name",
+ value: "id"
},
- {
- label: "警员",
- prop: "policemanId",
- type:"select",
- dicUrl:"/api/policeman/policeman/all",
- props:{
- label:"name",
- value:"id"
+ rules: [{
+ required: true,
+ message: "请选择所属活动",
+ trigger: "blur"
+ }],
+ searchSpan: 6,
+ },
+ {
+ label: "警员",
+ prop: "policemanId",
+ type: "select",
+ dicUrl: "/api/policeman/policeman/all",
+ props: {
+ label: "name",
+ value: "id"
+ }
+ },
+ {
+ label: "所属辖区",
+ prop: "deptId",
+ type: "tree",
+ disabled: true,
+ dicUrl: "api/blade-system/dept/getPoliceStationTree",
+ defaultExpandAll:"true",
+ props: {
+ label: 'name',
+ value: 'id',
+ children: 'children'
+ },
+ search: true,
+ searchSpan: 8,
+ },
+ {
+ label: "类型",
+ prop: "type",
+ type: "select",
+ dicData: [
+ {
+ label: "线",
+ value: 1
+ },
+ {
+ label: "面",
+ value: 2
+ },
+ {
+ label: "点",
+ value: 3
}
- },
- {
- label: "所属辖区",
- prop: "deptId",
- type: "tree",
- disabled:true,
- dicUrl: "api/blade-system/dept/lazy-list",
- props:{
- label:'deptName',
- value:'id',
- children:'children'
- },
- search: true,
- searchSpan:8,
- },
- {
- label: "类型",
- prop: "type",
- type:"select",
- dicData:[
- {
- label:"线",
- value:1
- },
- {
- label:"面",
- value:2
- },
- {
- label:"点",
- value:3
- }
- ]
- },
- {
- label: "范围",
- prop: "position",
- hide:true
- },
- ]
- },
- data: [],
- isDetail:false,
- routeRange:"",
- securityList:[],
+ ]
+ },
+ {
+ label: "范围",
+ prop: "position",
+ hide: true
+ },
+ ]
+ },
+ data: [],
+ isDetail: false,
+ routeRange: "",
+ securityList: [],
+ };
+ },
+ computed: {
+ ...mapGetters(["userInfo", "permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.securityManage_add, false),
+ viewBtn: this.vaildData(this.permission.securityManage_view, false),
+ delBtn: this.vaildData(this.permission.securityManage_delete, false),
+ editBtn: this.vaildData(this.permission.securityManage_edit, false)
};
},
- computed: {
- ...mapGetters(["userInfo","permission"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.securityManage_add, false),
- viewBtn: this.vaildData(this.permission.securityManage_view, false),
- delBtn: this.vaildData(this.permission.securityManage_delete, false),
- editBtn: this.vaildData(this.permission.securityManage_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
- },
- created() {
- this.getSecurityList()
- },
- watch:{
- //根据活动回显机构
- 'form.securityId':{
- handler(newVal){
- this.securityList.forEach(e=>{
- if (e.id == newVal){
- this.form.deptId = e.deptId
- }
- })
- }
- }
- },
- methods: {
- rowSave(row, done, loading) {
- add(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
- },
- 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();
- });
- },
- handleDetail(row){
- this.routeRange = row.position
- this.isDetail = true
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getDetails(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();
- });
- },
- //获取所有活动集合
- getSecurityList(){
- getAll().then(res=>{
- if (res.data.code == 200){
- this.securityList = res.data.data
- const securityIdColumn = this.findObject(this.option.column,"securityId")
- securityIdColumn.dicData = this.securityList
+ ids() {
+ let ids = [];
+ this.selectionList.forEach(ele => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ }
+ },
+ created() {
+ this.getSecurityList()
+ },
+ watch: {
+ //根据活动回显机构
+ 'form.securityId': {
+ handler(newVal) {
+ this.securityList.forEach(e => {
+ if (e.id == newVal) {
+ this.form.deptId = e.deptId
}
})
}
}
- };
+ },
+ methods: {
+ rowSave(row, done, loading) {
+ add(row).then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ done();
+ }, error => {
+ loading();
+ window.console.log(error);
+ });
+ },
+ 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();
+ });
+ },
+ handleDetail(row) {
+ this.routeRange = row.position
+ this.isDetail = true
+ },
+ beforeOpen(done, type) {
+ const column = this.findObject(this.option.column, "securityId");
+ column.addDisabled = true;
+ column.editDisabled = true;
+ if (["add"].includes(type)) {
+ this.form['securityId'] = this.securityId
+ }
+ if (["edit", "view"].includes(type)) {
+ getDetails(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;
+ }
+
+ params['securityId'] = this.securityId
+
+ 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();
+ });
+ },
+ //获取所有活动集合
+ getSecurityList() {
+ getAll().then(res => {
+ if (res.data.code == 200) {
+ this.securityList = res.data.data
+ const securityIdColumn = this.findObject(this.option.column, "securityId")
+ securityIdColumn.dicData = this.securityList
+ }
+ })
+ }
+ }
+};
</script>
<style>
+
</style>
--
Gitblit v1.9.3