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

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

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