上饶市警务平台后台管理前端
zhongrj
2023-01-17 1721c1113577a9b3d705814b71773b0bb629f2d9
小区管理修改,登录权限设置修改
7 files modified
1 files added
270 ■■■■ changed files
src/api/system/user.js 9 ●●●●● patch | view | raw | blame | history
src/api/villageInfo/villageInfo.js 79 ●●●●● patch | view | raw | blame | history
src/main.js 32 ●●●● patch | view | raw | blame | history
src/permission.js 85 ●●●●● patch | view | raw | blame | history
src/views/community/community.vue 32 ●●●● patch | view | raw | blame | history
src/views/security/security.vue 9 ●●●●● patch | view | raw | blame | history
src/views/system/user.vue 22 ●●●● patch | view | raw | blame | history
vue.config.js 2 ●●● patch | view | raw | blame | history
src/api/system/user.js
@@ -61,6 +61,15 @@
  })
}
export const getUserInfos = () => {
  return request({
    url: '/api/blade-user/getUserInfo',
    method: 'get',
    params: {
    }
  })
}
export const getUserPlatform = (id) => {
  return request({
    url: '/api/blade-user/platform-detail',
src/api/villageInfo/villageInfo.js
New file
@@ -0,0 +1,79 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
  return request({
    url: '/api/villageInfo/villageInfo/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getPage = (current, size, params) => {
  return request({
    url: '/api/villageInfo/villageInfo/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getAll = () => {
  return request({
    url: '/api/villageInfo/villageInfo/all',
    method: 'get',
  })
}
export const getDetails = (id) => {
  return request({
    url: '/api/villageInfo/villageInfo/details',
    method: 'get',
    params: {
      id
    }
  })
}
export const getDetail = (id) => {
  return request({
    url: '/api/villageInfo/villageInfo/detail',
    method: 'get',
    params: {
      id
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/villageInfo/villageInfo/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const add = (row) => {
  return request({
    url: '/api/villageInfo/villageInfo/save',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/villageInfo/villageInfo/update',
    method: 'post',
    data: row
  })
}
src/main.js
@@ -27,22 +27,7 @@
import tenantPackage from './views/system/tenantpackage';
import Cookies from 'js-cookie'
// 携带token跳转页面设置
const tokenLength = window.location.href.indexOf('=');
if(tokenLength>0){
  //取“=”之后的token
  let z = window.location.href.substring(tokenLength + 1)
  // 把token存进B系统
  let obj = {
    dataType: typeof (z),
    content: z,
    datetime: new Date().getTime()
  }
  window.localStorage.setItem('saber-token', JSON.stringify(obj));
  Cookies.set('saber-access-token', z)
}
// 注册全局crud驱动
window.$crudCommon = crudCommon;
@@ -80,6 +65,23 @@
Vue.config.productionTip = false;
//import Cookies from 'js-cookie'
// 携带token跳转页面设置
//const tokenLength = window.location.href.indexOf('=');
//if(tokenLength>0){
//  //取“=”之后的token
 // let z = window.location.href.substring(tokenLength + 1)
 // // 把token存进B系统
 // let obj = {
 //   dataType: typeof (z),
 //   content: z,
 //   datetime: new Date().getTime()
 // }
 // window.localStorage.setItem('saber-token', JSON.stringify(obj));
 // Cookies.set('saber-access-token', z)
//}
new Vue({
  router,
  store,
src/permission.js
@@ -2,6 +2,10 @@
 * 全站权限配置
 *
 */
import md5 from 'js-md5'
import request from '@/router/axios';
import { Message } from 'element-ui'
import router from './router/router'
import store from './store'
import { validatenull } from '@/util/validate'
@@ -12,9 +16,9 @@
const lockPage = store.getters.website.lockPage; //锁屏页
router.beforeEach((to, from, next) => {
  var tag = false;
  if (to.fullPath.indexOf("token") > 0) {
    tag = true;
  }
  // if (to.fullPath.indexOf("token") > 0) {
  //   tag = true;
  // }
  const meta = to.meta || {};
  const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
  store.commit('SET_IS_MENU', isMenu === undefined);
@@ -25,7 +29,8 @@
      next({ path: '/' })
    } else {
      //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页
      if (store.getters.token.length === 0 && tag==false) {
      // if (store.getters.token.length === 0 && tag==false) {
        if (store.getters.token.length === 0) {
        store.dispatch('FedLogOut').then(() => {
          next({ path: '/login' })
        })
@@ -36,7 +41,8 @@
        const i18n = to.query.i18n;
        if (to.query.target) {
          window.open(value)
        } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label) && tag==false) {
        } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
       // } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label) && tag==false) {
          store.commit('ADD_TAG', {
            label: label,
            value: value,
@@ -61,6 +67,75 @@
    if (meta.isAuth === false) {
      next()
    } else {
      console.log(to.path,66666)
      if (to.path == '/security/security') {
        // console.log('进入首页-----')
        var a = to.query.securitySupervisionSystem;
        if (a == undefined || typeof a != "string") {
          // console.log("无securitySupervisionSystem参数  跳回登入");
          next('/login');
          next('/login');
          return;
        }
        // console.log("有securitySupervisionSystem参数");
        try {
          // console.log("判断securitySupervisionSystem是否能被JSOn解码");
          var obj = JSON.parse(a);
          if (typeof obj == "object" && obj && obj.tokenMY == '987654321S') {
            debugger
            var data = {
              tenantId: obj.data.dip,
              username: obj.data.rese,
              password: md5(obj.data.sap),
              grant_type: 'password',
              scope: 'all',
              type: 'account'
            };
            request({
              url: '/api/blade-auth/oauth/token',
              method: 'post',
              headers: {
                'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0',
                "Tenant-Id": "000000"
              },
              params: data
            }).then(res => {
              const data = res.data;
              if (data.error_description) {
                // console.log("登入失败");
                Message({
                  message: data.error_description,
                  type: 'error'
                })
                next('/login');
                next('/login');
                return;
              } else {
                // console.log("登入成功");
                store.commit('SET_TOKEN', data.access_token);
                store.commit('SET_REFRESH_TOKEN', data.refresh_token);
                store.commit('SET_TENANT_ID', data.tenant_id);
                store.commit('SET_USER_INFO', data);
                store.commit('DEL_ALL_TAG');
                store.commit('CLEAR_LOCK');
                next(to.path);
                return;
              }
            })
            return;
          } else {
            // console.log("成功解码 不是对象");
            next('/login');
            next('/login');
            return;
          }
        } catch {
          // console.log('不是Json对象 跳回登入');
          next('/login');
          next('/login');
          return;
        }
      }
      next('/login')
    }
  }
src/views/community/community.vue
@@ -32,7 +32,7 @@
</template>
<script>
  import {getPage, getDetail, add, update, remove} from "@/api/community/community";
  import {getPage, getDetails, add, update, remove} from "@/api/villageInfo/villageInfo";
  import {mapGetters} from "vuex";
  export default {
@@ -70,7 +70,7 @@
            },
            {
              label: "小区名",
              prop: "name",
              prop: "aoiName",
              type: "input",
              search: true,
              rules: [{
@@ -91,15 +91,27 @@
            },
            {
              label: "责任区",
              prop: "deptId",
              type: "cascader",
              prop: "areaName",
              addDisplay:false,
              editDisplay:false,
              viewDisplay:false,
              rules: [{
                required: true,
                message: "请选择所属责任区",
                trigger: "blur"
              }]
            },
            {
              label: "责任区",
              prop: "areaId",
              type: "tree",
              emitPath:false,
              dicUrl: "api/blade-system/dept/lazy-list",
              hide:true,
              dicUrl: "api/policeStationInfo/policeStationInfo/getPoliceStationTwoTrees",
              parent:false,
              props:{
                label:'deptName',
                value:'id',
                children:'children'
                label:'name',
                value:'id'
              },
              rules: [{
                required: true,
@@ -196,6 +208,7 @@
    },
    methods: {
      rowSave(row, done, loading) {
        console.log(row,22222)
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
@@ -209,6 +222,7 @@
        });
      },
      rowUpdate(row, index, done, loading) {
        console.log(row,22222)
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
@@ -262,7 +276,7 @@
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
          getDetails(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
src/views/security/security.vue
@@ -26,6 +26,7 @@
<script>
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"
@@ -228,9 +229,17 @@
      //取“=”之后的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);
      })
    },
    rowSave(row, done, loading) {
      add(row).then(() => {
        this.onLoad(this.page);
src/views/system/user.vue
@@ -56,28 +56,28 @@
            <el-button
                       size="small"
                       plain
                       v-if="userInfo.role_name.includes('admin')"
                       v-if="userInfo.role_name.indexOf('admin')"
                       icon="el-icon-setting"
                       @click="handlePlatform">平台配置
            </el-button>
            <el-button
                       size="small"
                       plain
                       v-if="userInfo.role_name.includes('admin')"
                       v-if="userInfo.role_name.indexOf('admin')"
                       icon="el-icon-coordinate"
                       @click="handleLock">账号解封
            </el-button>
            <el-button
                       size="small"
                       plain
                       v-if="userInfo.role_name.includes('admin')"
                       v-if="userInfo.role_name.indexOf('admin')"
                       icon="el-icon-upload2"
                       @click="handleImport">导入
            </el-button>
            <el-button
                       size="small"
                       plain
                       v-if="userInfo.role_name.includes('admin')"
                       v-if="userInfo.role_name.indexOf('admin')"
                       icon="el-icon-download"
                       @click="handleExport">导出
            </el-button>
@@ -501,7 +501,7 @@
                    label: "title"
                  },
                  /*control:() =>{
                    if (this.userInfo.role_name.includes("administrator")){
                    if (this.userInfo.role_name.indexOf("administrator")){
                      debugger
                      return{
                        roleId:{
@@ -743,10 +743,10 @@
          const column = this.findObject(this.option.group, "deptId");
          column.dicData = res.data.data;
        });
        getPostList(tenantId).then(res => {
          const column = this.findObject(this.option.group, "postId");
          column.dicData = res.data.data;
        });
        //getPostList(tenantId).then(res => {
        //  const column = this.findObject(this.option.group, "postId");
        //  column.dicData = res.data.data;
        //});
      },
      submitRole() {
        const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
@@ -940,7 +940,7 @@
        })
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
        if (["edit", "view"].indexOf(type)) {
          getUser(this.form.id).then(res => {
            this.form = res.data.data;
            if(this.form.hasOwnProperty("deptId")){
@@ -995,7 +995,7 @@
        });
      },
      platformBeforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
        if (["edit", "view"].indexOf(type)) {
          getUserPlatform(this.platformForm.id).then(res => {
            this.platformForm = res.data.data;
          });
vue.config.js
@@ -26,7 +26,7 @@
    proxy: {
      '/api': {
        //本地服务接口地址
        target: 'http://192.168.0.125:82/',
        target: 'http://localhost:82/',
        //远程演示服务地址,可用于直接启动项目
        //target: 'https://saber.bladex.vip/api',
        ws: true,