From febb0babbb08e2ad0eaa8a28ec4591d922da1065 Mon Sep 17 00:00:00 2001
From: zhongrj <123456>
Date: Wed, 28 Dec 2022 16:53:47 +0800
Subject: [PATCH] 安保活动备案新增活动人员,车辆按钮页面
---
src/views/security/security.vue | 650 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 334 insertions(+), 316 deletions(-)
diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index 27d5f51..482afc7 100644
--- a/src/views/security/security.vue
+++ b/src/views/security/security.vue
@@ -1,335 +1,353 @@
<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"
- @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>
+ </template>
</avue-crud>
+
+ <el-drawer title="活动人员区域" :visible.sync="personBox" :append-to-body="true" size="50%">
+ <securityManage />
+ </el-drawer>
+
+ <el-drawer title="活动车辆区域" :visible.sync="carBox" :append-to-body="true" size="50%">
+ <securityManageCar />
+ </el-drawer>
</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 AvueMap from 'avue-plugin-map';
+import { mapGetters } from "vuex";
+import securityManage from "@/views/securityManage/securityManage"
+import securityManageCar from "@/views/securityManageCar/securityManageCar"
- export default {
- data() {
+export default {
+ components: {
+ securityManage,
+ securityManageCar
+ },
+ data() {
+ return {
+ carBox: false,
+ personBox: false,
+ 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,
+ menuWidth: 370,
+ column: [
+ {
+ label: "活动名称",
+ prop: "name",
+ search: true,
+ searchSpan: 4,
+ },
+ {
+ label: "负责单位",
+ prop: "company",
+ },
+ {
+ label: "负责人",
+ prop: "person",
+ width: 80
+ },
+ {
+ label: "联系方式",
+ prop: "contact",
+ width: 100
+ },
+ {
+ 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,
+ 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: "content",
+ },
+ {
+ label: "经纬度",
+ prop: "position",
+ type: "input",
+ span: 12,
+ hide: true
+ },
+ // {
+ // label: "",
+ // prop: "map",
+ // labelWidth: 10,
+ // searchSpan: 0,
+ // // maxlength: 5,
+ // hide: true,
+ // span: 3,
+ // // display:false,
+ // component: "AvueMap",
+ // },
+ {
+ label: "人数",
+ prop: "number",
+ width: 60,
+ },
+ {
+ 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,
+ },
+ ]
+ },
+ 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 {
- 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: []
+ 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)
};
},
- // 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(",");
- }
- },
- 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();
- });
- },
- 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();
- });
- }
+ 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);
+ });
+ },
+ 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();
+ });
+ },
+ //活动人员区域点击按钮事件
+ handlePersonList() {
+ this.personBox = true;
+ },
+ //活动车辆区域点击按钮事件
+ handleCarList() {
+ this.carBox = true;
+ }
+ }
+};
</script>
<style>
+
</style>
--
Gitblit v1.9.3