Commit 341a4ad4 authored by 王晓倩's avatar 王晓倩

非admin账号:只能查看本部门账户,交易项目维护、账户维护里部门下拉框默认显示本部门且不可用

parent 12266064
package com.zehong.web.controller.account;
import java.util.List;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.framework.web.service.TokenService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -32,6 +37,8 @@ public class TAccountController extends BaseController
{
@Autowired
private ITAccountService tAccountService;
@Autowired
private TokenService tokenService;
/**
* 查询账户列表
......@@ -41,6 +48,11 @@ public class TAccountController extends BaseController
public TableDataInfo list(TAccount tAccount)
{
startPage();
// 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) {
tAccount.setDeptId(user.getDeptId());
}
List<TAccount> list = tAccountService.selectTAccountList(tAccount);
return getDataTable(list);
}
......
......@@ -72,6 +72,11 @@ public class TTransactionProjectController extends BaseController
@GetMapping("/export")
public AjaxResult export(TTransactionProject tTransactionProject)
{
// 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) {
tTransactionProject.setDeptId(user.getDeptId());
}
List<TTransactionProject> list = tTransactionProjectService.selectTTransactionProjectList(tTransactionProject);
ExcelUtil<TTransactionProject> util = new ExcelUtil<TTransactionProject>(TTransactionProject.class);
return util.exportExcel(list, "交易项目数据");
......
......@@ -8,6 +8,8 @@ const getters = {
avatar: state => state.user.avatar,
name: state => state.user.name,
deptName:state => state.user.deptName,
deptId:state => state.user.deptId,
userId:state => state.user.userId,
introduction: state => state.user.introduction,
roles: state => state.user.roles,
permissions: state => state.user.permissions,
......
......@@ -10,6 +10,7 @@ const user = {
permissions: [],
systemSetting:{},
deptName:'',
userId: '',
deptId: '',
},
......@@ -35,6 +36,9 @@ const user = {
SET_DEPTID: (state,deptId) =>{
state.deptId = deptId;
},
SET_USERID: (state,userId) =>{
state.userId = userId;
},
SET_DEPTNAME: (state,deptName) =>{
state.deptName = deptName;
},
......@@ -76,6 +80,7 @@ const user = {
// 默认配置
commit('SET_SYSTEMSETTING', res.systemSetting)
commit('SET_DEPTID', user.deptId);
commit('SET_USERID', user.userId);
commit('SET_DEPTNAME', user.dept.deptName);
console.log(res.systemSetting)
resolve(res)
......
......@@ -3,7 +3,7 @@
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="部门" prop="deptId">
<div style="width: 200px">
<treeselect v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
<treeselect v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" :disabled="disabled"/>
</div>
</el-form-item>
<el-form-item>
......@@ -192,12 +192,19 @@ export default {
},
// 部门树选项
deptOptions: [],
disabled: false,
operateOpen: false,
cashOperateList: [],
operateListTotal: 0
};
},
created() {
console.log("userId===",this.$store.state.user.userId);
console.log("deptId===",this.$store.state.user.deptId);
if(this.$store.state.user.userId != 1){
this.queryParams.deptId = this.$store.state.user.deptId;
this.disabled = true;
}
this.getList();
this.getTreeselect();
},
......
......@@ -13,7 +13,7 @@
<el-form-item label="部门" prop="deptId">
<div style="width: 200px">
<treeselect v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
<treeselect v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" :disabled="disabled"/>
</div>
</el-form-item>
......@@ -231,10 +231,18 @@ export default {
},
// 部门树选项
deptOptions: [],
disabled:false,
priceShow: true
};
},
created() {
console.log("userId===",this.$store.state.user.userId);
console.log("deptId===",this.$store.state.user.deptId);
if(this.$store.state.user.userId != 1){
this.queryParams.deptId = this.$store.state.user.deptId;
this.disabled = true;
}
this.getList();
this.getTreeselect();
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment