Commit aeea6d6b authored by 耿迪迪's avatar 耿迪迪
parents 4bb3b2c0 87cd2402
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);
}
......
......@@ -3,9 +3,14 @@ package com.zehong.web.controller.transaction;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.framework.web.service.TokenService;
import com.zehong.system.domain.TTransactionProject;
import com.zehong.system.service.ITTransactionProjectService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -26,6 +31,8 @@ public class TTransactionProjectController extends BaseController
{
@Autowired
private ITTransactionProjectService tTransactionProjectService;
@Autowired
private TokenService tokenService;
/**
* 查询交易项目列表
......@@ -35,8 +42,14 @@ public class TTransactionProjectController extends BaseController
public TableDataInfo list(TTransactionProject tTransactionProject)
{
startPage();
// 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) {
tTransactionProject.setDeptId(user.getDeptId());
}
List<TTransactionProject> list = tTransactionProjectService.selectTTransactionProjectList(tTransactionProject);
return getDataTable(list);
}
......@@ -59,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, "交易项目数据");
......@@ -82,6 +100,11 @@ public class TTransactionProjectController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody TTransactionProject tTransactionProject)
{
// 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) {
tTransactionProject.setDeptId(user.getDeptId());
}
return toAjax(tTransactionProjectService.insertTTransactionProject(tTransactionProject));
}
......
......@@ -13,6 +13,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
<result property="deptName" column="dept_name"/>
<result property="payableTotalAmount" column="payableTotalAmount"/>
<result property="incomeAbleTotalAmount" column="incomeAbleTotalAmount"/>
<result property="totalAmount" column="totalAmount"/>
</resultMap>
<sql id="selectTAccountVo">
......@@ -20,12 +23,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectTAccountList" parameterType="TAccount" resultMap="TAccountResult">
<include refid="selectTAccountVo"/>
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="ableAmount != null "> and able_amount = #{ableAmount}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
select tt.*,(able_amount+incomeAbleTotalAmount- payableTotalAmount) as totalAmount from(
select account_id, dept_id AS deptId , able_amount, IFNULL((select sum(pending_payment) from t_trade_project where trade_status=5 and apply_dept_id =t.dept_id ),0)incomeAbleTotalAmount,IFNULL((select sum(pending_payment) from t_trade_project where trade_status=5 and trade_dept_id =t.dept_id ),0)payableTotalAmount, create_time, update_time, is_del, remark,(SELECT dept.dept_name FROM sys_dept dept WHERE dept.dept_id = deptId)AS dept_name from t_account t
<where>
<if test="deptId != null "> and t.dept_id = #{deptId}</if>
<if test="ableAmount != null "> and t.able_amount = #{ableAmount}</if>
<if test="isDel != null and isDel != ''"> and t.is_del = #{isDel}</if>
</where>
) tt
</select>
<select id="selectTAccountById" parameterType="Long" resultMap="TAccountResult">
......
......@@ -7,19 +7,21 @@
<div class="right-menu">
<template v-if="device!=='mobile'">
<search id="header-search" class="right-menu-item" />
<!-- <search id="header-search" class="right-menu-item" />-->
<screenfull id="screenfull" class="right-menu-item hover-effect" />
<!-- <screenfull id="screenfull" class="right-menu-item hover-effect" />-->
<el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select id="size-select" class="right-menu-item hover-effect" />
</el-tooltip>
<!-- <el-tooltip content="布局大小" effect="dark" placement="bottom">-->
<!-- <size-select id="size-select" class="right-menu-item hover-effect" />-->
<!-- </el-tooltip>-->
</template>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="avatar" class="user-avatar">
<!-- <img :src="avatar" class="user-avatar">-->
<div >{{this.name+'/'+this.deptName}}</div>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
......@@ -60,7 +62,9 @@ export default {
...mapGetters([
'sidebar',
'avatar',
'device'
'device',
'name',
'deptName'
]),
setting: {
get() {
......
......@@ -7,6 +7,9 @@ const getters = {
token: state => state.user.token,
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,
......
......@@ -9,6 +9,8 @@ const user = {
roles: [],
permissions: [],
systemSetting:{},
deptName:'',
userId: '',
deptId: '',
userId: ''
},
......@@ -38,6 +40,12 @@ const user = {
SET_DEPTID: (state,deptId) =>{
state.deptId = deptId;
},
SET_USERID: (state,userId) =>{
state.userId = userId;
},
SET_DEPTNAME: (state,deptName) =>{
state.deptName = deptName;
},
},
actions: {
......@@ -64,7 +72,7 @@ const user = {
getInfo().then(res => {
const user = res.user
const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
console.log("getInfo",)
console.log("getInfo",user)
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions)
......@@ -77,6 +85,8 @@ 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)
}).catch(error => {
......
......@@ -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();
},
......
This diff is collapsed.
......@@ -48,7 +48,7 @@
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
<span></span>
</div>
</div>
</template>
......
......@@ -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