上饶市警务平台后台管理前端
zhongrj
2022-12-28 febb0babbb08e2ad0eaa8a28ec4591d922da1065
src/views/securityManage/securityManage.vue
@@ -19,7 +19,7 @@
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
        <el-button
                   size="small"
                   icon="el-icon-delete"
                   plain
@@ -28,7 +28,7 @@
        </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-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>
@@ -48,6 +48,7 @@
<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";
@@ -66,7 +67,7 @@
        selectionList: [],
        option: {
          height:'auto',
          calcHeight: 30,
          menuWidth:250,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
@@ -83,11 +84,17 @@
              prop:"securityId",
              search: true,
              type:"select",
              dicUrl:"/api/security/security/all",
              dicData:[],
              props:{
                label:"name",
                value:"id"
              }
              },
              rules: [{
                required: true,
                message: "请选择所属活动",
                trigger: "blur"
              }],
              searchSpan:6,
            },
            {
              label: "警员",
@@ -100,9 +107,10 @@
              }
            },
            {
              label: "所属机构",
              label: "所属辖区",
              prop: "deptId",
              type: "tree",
              disabled:true,
              dicUrl: "api/blade-system/dept/lazy-list",
              props:{
                label:'deptName',
@@ -110,12 +118,7 @@
                children:'children'
              },
              search: true,
              searchSpan:4,
              rules: [{
                required: true,
                message: "请选择所属机构",
                trigger: "blur"
              }]
              searchSpan:8,
            },
            {
              label: "类型",
@@ -146,10 +149,11 @@
        data: [],
        isDetail:false,
        routeRange:"",
        securityList:[],
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      ...mapGetters(["userInfo","permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.securityManage_add, false),
@@ -164,6 +168,21 @@
          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: {
@@ -272,6 +291,11 @@
      },
      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;
@@ -279,6 +303,16 @@
          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
          }
        })
      }
    }
  };