提交代码
parent
a1fadd65a4
commit
dd04c1adf5
|
@ -39,9 +39,9 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_project?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
url: jdbc:mysql://62.234.3.186:3306/yanzhu_project?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: Sxyanzhu@cf
|
password: Sxyanzhu@cf123
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
|
|
@ -19,7 +19,7 @@ spring:
|
||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
basename: i18n/messages
|
basename: i18n/messages
|
||||||
profiles:
|
profiles:
|
||||||
active: test
|
active: prod
|
||||||
# 文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
|
|
|
@ -166,6 +166,24 @@ public class TokenService
|
||||||
redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
|
redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新用户信息
|
||||||
|
*
|
||||||
|
* @param token 登录token
|
||||||
|
*/
|
||||||
|
public void refreshUserInfo(String token,LoginUser user)
|
||||||
|
{
|
||||||
|
Claims claims = parseToken(token);
|
||||||
|
// 解析对应的权限以及用户信息
|
||||||
|
String uuid = (String) claims.get(Constants.LOGIN_USER_KEY);
|
||||||
|
String userKey = getTokenKey(uuid);
|
||||||
|
user.setLoginTime(System.currentTimeMillis());
|
||||||
|
int mobileExpireTime = expireTime * 3650 * 60 ;
|
||||||
|
user.setExpireTime(user.getLoginTime() + mobileExpireTime * MILLIS_MINUTE);
|
||||||
|
// 根据uuid将loginUser缓存
|
||||||
|
redisCache.setCacheObject(userKey, user, mobileExpireTime, TimeUnit.MINUTES);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移动端主动刷新令牌有效期
|
* 移动端主动刷新令牌有效期
|
||||||
*
|
*
|
||||||
|
@ -247,7 +265,7 @@ public class TokenService
|
||||||
* @param request
|
* @param request
|
||||||
* @return token
|
* @return token
|
||||||
*/
|
*/
|
||||||
private String getToken(HttpServletRequest request)
|
public String getToken(HttpServletRequest request)
|
||||||
{
|
{
|
||||||
String token = request.getHeader(header);
|
String token = request.getHeader(header);
|
||||||
if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
|
if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.yanzhu.web;
|
package com.yanzhu.web;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
@ -8,6 +9,7 @@ import com.yanzhu.common.constant.Constants;
|
||||||
import com.yanzhu.common.core.domain.entity.SysDept;
|
import com.yanzhu.common.core.domain.entity.SysDept;
|
||||||
import com.yanzhu.common.core.domain.entity.SysUser;
|
import com.yanzhu.common.core.domain.entity.SysUser;
|
||||||
import com.yanzhu.common.core.redis.RedisCache;
|
import com.yanzhu.common.core.redis.RedisCache;
|
||||||
|
import com.yanzhu.common.utils.StringUtils;
|
||||||
import com.yanzhu.system.service.ISysDeptService;
|
import com.yanzhu.system.service.ISysDeptService;
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,11 +43,13 @@ import com.yanzhu.common.core.page.TableDataInfo;
|
||||||
public class BaseAssetsTypeController extends BaseController
|
public class BaseAssetsTypeController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBaseAssetsTypeService baseAssetsTypeService;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysDeptService sysDeptService;
|
private ISysDeptService sysDeptService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private IBaseAssetsTypeService baseAssetsTypeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询物资类型列表
|
* 查询物资类型列表
|
||||||
|
@ -107,17 +111,20 @@ public class BaseAssetsTypeController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateDeptUnit(BaseAssetsType baseAssetsType){
|
void updateDeptUnit(BaseAssetsType baseAssetsType){
|
||||||
long deptId= baseAssetsType.getDeptId();
|
Long deptId= baseAssetsType.getDeptId();
|
||||||
String unit=baseAssetsType.getUnit();
|
String unit=baseAssetsType.getUnit();
|
||||||
if(unit==null || unit.trim().length()==0){
|
if(unit==null || unit.trim().length()==0){
|
||||||
unit="";
|
unit="";
|
||||||
}
|
}
|
||||||
String[] tmps= unit.split("[|]");
|
String[] tmps= unit.split("[|]");
|
||||||
baseAssetsType.setUnit("");
|
baseAssetsType.setUnit(null);
|
||||||
if(tmps.length>0){
|
if(tmps.length>0){
|
||||||
|
if(StringUtils.isNotEmpty(tmps[0]) && !Objects.equals(tmps[0],"null")){
|
||||||
baseAssetsType.setUnit(tmps[0]);
|
baseAssetsType.setUnit(tmps[0]);
|
||||||
}
|
}
|
||||||
if(tmps.length>1){
|
}
|
||||||
|
if(tmps.length>1 && Objects.nonNull(deptId)){
|
||||||
|
if(StringUtils.isNotEmpty(tmps[1]) && !Objects.equals(tmps[1],"null")){
|
||||||
SysDept dept= sysDeptService.selectDeptById(deptId);
|
SysDept dept= sysDeptService.selectDeptById(deptId);
|
||||||
if(dept!=null){
|
if(dept!=null){
|
||||||
dept.setUnit(tmps[1]);
|
dept.setUnit(tmps[1]);
|
||||||
|
@ -125,6 +132,7 @@ public class BaseAssetsTypeController extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改物资类型
|
* 修改物资类型
|
||||||
|
@ -149,6 +157,22 @@ public class BaseAssetsTypeController extends BaseController
|
||||||
return toAjax(baseAssetsTypeService.deleteBaseAssetsTypeByIds(ids));
|
return toAjax(baseAssetsTypeService.deleteBaseAssetsTypeByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询二级分类物资类型
|
||||||
|
*/
|
||||||
|
@GetMapping("/findParentTypesByCategory/{category}")
|
||||||
|
public AjaxResult findParentTypesByCategory(@PathVariable String category)
|
||||||
|
{
|
||||||
|
SysUser sysUser = super.getLoginUser().getUser();
|
||||||
|
String key = "YANZHU.BASE.ASSETSTYPE.findParentTypesByCategory." + sysUser.getParDeptId() + "." + category;
|
||||||
|
Object object = redisCache.getCacheObject(key);
|
||||||
|
if (object != null) {
|
||||||
|
return success(object);
|
||||||
|
}
|
||||||
|
List<BaseAssetsType> list = baseAssetsTypeService.findParentTypesByCategory(category);
|
||||||
|
redisCache.setCacheObject(key, list, Constants.BASE_DATA_EXPIRATION, TimeUnit.MINUTES);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询物资类型
|
* 查询物资类型
|
||||||
|
|
|
@ -6,22 +6,32 @@ import com.yanzhu.common.annotation.RateLimiter;
|
||||||
import com.yanzhu.common.constant.Constants;
|
import com.yanzhu.common.constant.Constants;
|
||||||
import com.yanzhu.common.core.controller.BaseController;
|
import com.yanzhu.common.core.controller.BaseController;
|
||||||
import com.yanzhu.common.core.domain.AjaxResult;
|
import com.yanzhu.common.core.domain.AjaxResult;
|
||||||
|
import com.yanzhu.common.core.domain.entity.SysDept;
|
||||||
|
import com.yanzhu.common.core.domain.entity.SysUser;
|
||||||
import com.yanzhu.common.core.domain.model.LoginBody;
|
import com.yanzhu.common.core.domain.model.LoginBody;
|
||||||
|
import com.yanzhu.common.core.domain.model.LoginUser;
|
||||||
import com.yanzhu.common.core.redis.RedisCache;
|
import com.yanzhu.common.core.redis.RedisCache;
|
||||||
|
import com.yanzhu.common.core.text.Convert;
|
||||||
import com.yanzhu.common.enums.BusinessType;
|
import com.yanzhu.common.enums.BusinessType;
|
||||||
import com.yanzhu.common.enums.LimitType;
|
import com.yanzhu.common.enums.LimitType;
|
||||||
import com.yanzhu.common.enums.OperatorType;
|
import com.yanzhu.common.enums.OperatorType;
|
||||||
|
import com.yanzhu.common.exception.ServiceException;
|
||||||
import com.yanzhu.framework.web.service.SysLoginService;
|
import com.yanzhu.framework.web.service.SysLoginService;
|
||||||
|
import com.yanzhu.framework.web.service.SysPermissionService;
|
||||||
import com.yanzhu.framework.web.service.TokenService;
|
import com.yanzhu.framework.web.service.TokenService;
|
||||||
import com.yanzhu.system.domain.vo.UpdatePwdVo;
|
import com.yanzhu.system.domain.vo.UpdatePwdVo;
|
||||||
|
import com.yanzhu.system.service.ISysDeptService;
|
||||||
import com.yanzhu.system.service.ISysUserService;
|
import com.yanzhu.system.service.ISysUserService;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version : V1.0
|
* @version : V1.0
|
||||||
|
@ -46,6 +56,12 @@ public class WxLoginController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService sysDeptService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPermissionService permissionService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录方法
|
* 登录方法
|
||||||
*
|
*
|
||||||
|
@ -97,4 +113,37 @@ public class WxLoginController extends BaseController {
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷线用户信息
|
||||||
|
*
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "刷线用户信息")
|
||||||
|
@RateLimiter(count = 10, limitType = LimitType.IP)
|
||||||
|
@GetMapping("/refreshUserInfo")
|
||||||
|
public AjaxResult refreshUserInfo(HttpServletRequest request)
|
||||||
|
{
|
||||||
|
SysUser user = sysUserService.selectUserByUserName(super.getUsername());
|
||||||
|
if(Objects.isNull(user)){
|
||||||
|
throw new ServiceException("用户信息异常...");
|
||||||
|
}
|
||||||
|
//设置项目单位信息
|
||||||
|
if(!user.isAdmin()){
|
||||||
|
//判断是否是段队管理员
|
||||||
|
String[] ancestors = user.getDept().getAncestors().split(",");
|
||||||
|
Long deptId = Convert.toLong(ancestors[ancestors.length-1]);
|
||||||
|
if(deptId != null){
|
||||||
|
SysDept sysDept = sysDeptService.selectDeptById(deptId);
|
||||||
|
user.setParDeptId(sysDept.getDeptId());
|
||||||
|
user.setParDeptName(sysDept.getDeptName());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
user.setParDeptId(100L);
|
||||||
|
user.setParDeptName("中铁建设集团有限公司");
|
||||||
|
}
|
||||||
|
LoginUser loginUser = new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
|
||||||
|
tokenService.refreshUserInfo(tokenService.getToken(request),loginUser);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,12 @@ public class BaseAssetsType extends BaseEntity
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 父级分类 */
|
/** 父级分类 */
|
||||||
@Excel(name = "父级分类")
|
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
/** 父级分类 */
|
||||||
|
@Excel(name = "父级分类")
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
/** 单位主键 */
|
/** 单位主键 */
|
||||||
@Excel(name = "单位主键")
|
@Excel(name = "单位主键")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
@ -130,6 +133,14 @@ public class BaseAssetsType extends BaseEntity
|
||||||
this.defaultDeptId = defaultDeptId;
|
this.defaultDeptId = defaultDeptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getParentName() {
|
||||||
|
return parentName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentName(String parentName) {
|
||||||
|
this.parentName = parentName;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
|
@ -60,6 +60,14 @@ public interface IBaseAssetsTypeService
|
||||||
*/
|
*/
|
||||||
public int deleteBaseAssetsTypeById(Long id);
|
public int deleteBaseAssetsTypeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询二级分类物资类型
|
||||||
|
*
|
||||||
|
* @param category 物资类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public List<BaseAssetsType> findParentTypesByCategory(String category);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询物资类型
|
* 查询物资类型
|
||||||
*
|
*
|
||||||
|
|
|
@ -132,17 +132,34 @@ public class BaseAssetsTypeServiceImpl implements IBaseAssetsTypeService
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询二级分类物资类型
|
||||||
|
*
|
||||||
|
* @param category 物资类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BaseAssetsType> findParentTypesByCategory(String category){
|
||||||
|
BaseAssetsType baseAssetsType = new BaseAssetsType();
|
||||||
|
baseAssetsType.setParentId(0L);
|
||||||
|
baseAssetsType.setType(category);
|
||||||
|
baseAssetsType.setIsDel("0");
|
||||||
|
baseAssetsType.setDefaultDeptId(SecurityUtils.getLoginUser().getUser().getParDeptId());
|
||||||
|
return baseAssetsTypeMapper.selectBaseAssetsTypeList(baseAssetsType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询物资类型
|
* 查询物资类型
|
||||||
*
|
*
|
||||||
* @param category 物资类型
|
* @param category 物资类型
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List<BaseAssetsType> findAllByCategory(String category){
|
public List<BaseAssetsType> findAllByCategory(String category){
|
||||||
//boolean isAdmin = SysUser.isAdmin(SecurityUtils.getUserId());
|
|
||||||
BaseAssetsType baseAssetsType = new BaseAssetsType();
|
BaseAssetsType baseAssetsType = new BaseAssetsType();
|
||||||
baseAssetsType.setParentId(0L);
|
baseAssetsType.setParentId(0L);
|
||||||
baseAssetsType.setType(category);
|
baseAssetsType.setType(category);
|
||||||
|
baseAssetsType.setIsDel("0");
|
||||||
List<BaseAssetsType> list = baseAssetsTypeMapper.selectBaseAssetsTypeList(baseAssetsType);
|
List<BaseAssetsType> list = baseAssetsTypeMapper.selectBaseAssetsTypeList(baseAssetsType);
|
||||||
if(CollectionUtils.isNotEmpty(list)){
|
if(CollectionUtils.isNotEmpty(list)){
|
||||||
for(BaseAssetsType entity:list){
|
for(BaseAssetsType entity:list){
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
<resultMap type="BaseAssetsType" id="BaseAssetsTypeResult">
|
<resultMap type="BaseAssetsType" id="BaseAssetsTypeResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="parentId" column="parent_id" />
|
<result property="parentId" column="parent_id" />
|
||||||
|
<result property="parentName" column="parent_name" />
|
||||||
<result property="deptId" column="dept_id" />
|
<result property="deptId" column="dept_id" />
|
||||||
<result property="type" column="type" />
|
<result property="type" column="type" />
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name" />
|
||||||
|
@ -20,7 +21,8 @@
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectBaseAssetsTypeVo">
|
<sql id="selectBaseAssetsTypeVo">
|
||||||
select id, parent_id, dept_id, type, name, unit, is_del, create_by, create_time, update_by, update_time, remark from base_assets_type
|
select t.id, t.parent_id, pt.name as parent_name, t.dept_id, t.type, t.name, t.unit, t.is_del, t.create_by, t.create_time, t.update_by, t.update_time, t.remark from base_assets_type t
|
||||||
|
left join base_assets_type pt on pt.id = t.parent_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectBaseAssetsTypeList" parameterType="BaseAssetsType" resultMap="BaseAssetsTypeResult">
|
<select id="selectBaseAssetsTypeList" parameterType="BaseAssetsType" resultMap="BaseAssetsTypeResult">
|
||||||
|
@ -28,27 +30,27 @@
|
||||||
<where>
|
<where>
|
||||||
<if test="parentId != null ">
|
<if test="parentId != null ">
|
||||||
<if test="parentId == 0 ">
|
<if test="parentId == 0 ">
|
||||||
and parent_id is null
|
and t.parent_id is null
|
||||||
</if>
|
</if>
|
||||||
<if test="parentId == -1 ">
|
<if test="parentId == -1 ">
|
||||||
and parent_id is not null
|
and t.parent_id is not null
|
||||||
</if>
|
</if>
|
||||||
<if test="parentId > 0 ">
|
<if test="parentId > 0 ">
|
||||||
and parent_id = #{parentId}
|
and t.parent_id = #{parentId}
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
<if test="deptId != null "> and t.dept_id = #{deptId}</if>
|
||||||
<if test="type != null and type != ''"> and type = #{type}</if>
|
<if test="type != null and type != ''"> and t.type = #{type}</if>
|
||||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
<if test="name != null and name != ''"> and t.name like concat('%', #{name}, '%')</if>
|
||||||
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
|
<if test="unit != null and unit != ''"> and t.unit = #{unit}</if>
|
||||||
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
|
<if test="isDel != null and isDel != ''"> and t.is_del = #{isDel}</if>
|
||||||
<if test="defaultDeptId != null"> and (dept_id is null or dept_id = #{defaultDeptId})</if>
|
<if test="defaultDeptId != null"> and (t.dept_id is null or t.dept_id = #{defaultDeptId})</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectBaseAssetsTypeById" parameterType="Long" resultMap="BaseAssetsTypeResult">
|
<select id="selectBaseAssetsTypeById" parameterType="Long" resultMap="BaseAssetsTypeResult">
|
||||||
<include refid="selectBaseAssetsTypeVo"/>
|
<include refid="selectBaseAssetsTypeVo"/>
|
||||||
where id = #{id}
|
where t.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertBaseAssetsType" parameterType="BaseAssetsType" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertBaseAssetsType" parameterType="BaseAssetsType" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
@ -111,6 +113,6 @@
|
||||||
</delete>
|
</delete>
|
||||||
<select id="selectBaseAssetsTypeLevel2" resultMap="BaseAssetsTypeResult">
|
<select id="selectBaseAssetsTypeLevel2" resultMap="BaseAssetsTypeResult">
|
||||||
<include refid="selectBaseAssetsTypeVo"/>
|
<include refid="selectBaseAssetsTypeVo"/>
|
||||||
where parent_id is null and is_del=0
|
where t.parent_id is null and t.is_del=0
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -1,10 +1,10 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 研筑临时项目管理系统
|
VUE_APP_TITLE = 临建管家
|
||||||
|
|
||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
# 研筑临时项目管理系统/开发环境
|
# 临建管家/开发环境
|
||||||
VUE_APP_BASE_API = '/yanZhuProject'
|
VUE_APP_BASE_API = '/yanZhuProject'
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 研筑临时项目管理系统
|
VUE_APP_TITLE = 临建管家
|
||||||
|
|
||||||
# 生产环境配置
|
# 生产环境配置
|
||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
|
|
||||||
# 研筑临时项目管理系统/生产环境
|
# 临建管家/生产环境
|
||||||
VUE_APP_BASE_API = '/yanZhuProject'
|
VUE_APP_BASE_API = '/yanZhuProject'
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 研筑临时项目管理系统
|
VUE_APP_TITLE = 临建管家
|
||||||
|
|
||||||
NODE_ENV = production
|
NODE_ENV = production
|
||||||
|
|
||||||
# 测试环境配置
|
# 测试环境配置
|
||||||
ENV = 'staging'
|
ENV = 'staging'
|
||||||
|
|
||||||
# 研筑临时项目管理系统/测试环境
|
# 临建管家/测试环境
|
||||||
VUE_APP_BASE_API = '/stage-api'
|
VUE_APP_BASE_API = '/stage-api'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "yanZhu",
|
"name": "yanZhu",
|
||||||
"version": "3.8.7",
|
"version": "3.8.7",
|
||||||
"description": "研筑临时项目管理系统",
|
"description": "临建管家",
|
||||||
"author": "研筑科技",
|
"author": "研筑科技",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -50,6 +50,14 @@ export function listLevel2(){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询二级分类物资类型
|
||||||
|
export function findParentTypesByCategory(category) {
|
||||||
|
return request({
|
||||||
|
url: '/base/assetsType/findParentTypesByCategory/' + category,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 根据分类查询物资
|
// 根据分类查询物资
|
||||||
export function findAllByCategory(category) {
|
export function findAllByCategory(category) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
@ -62,18 +62,27 @@
|
||||||
<el-table-column label="资产名称" align="left" prop="name">
|
<el-table-column label="资产名称" align="left" prop="name">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="!scope.row.deptId" effect="dark" type="danger">系统</el-tag>
|
<el-tag v-if="!scope.row.deptId" effect="dark" type="danger">系统</el-tag>
|
||||||
{{ scope.row.name }}
|
<span style="margin-left:10px;"><span v-if="scope.row.parentId">{{scope.row.parentName +' > '}}</span>{{scope.row.name }}<span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="资产单位" align="center" prop="unit" />
|
<el-table-column label="资产单位" align="center" prop="unit" />
|
||||||
|
<el-table-column label="是否启用" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch v-if="scope.row.deptId || !nonAdmin" v-model="scope.row.isDel" active-value="0" inactive-value="1"
|
||||||
|
@change="setStatus(scope.row, $event)"></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<template v-if="scope.row.deptId">
|
<template v-if="scope.row.deptId || !nonAdmin">
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['base:assetsType:edit']">修改</el-button>
|
v-hasPermi="['base:assetsType:edit']">修改</el-button>
|
||||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['base:assetsType:remove']">删除</el-button>
|
v-hasPermi="['base:assetsType:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<el-button type="danger" link disabled>系统级不能修改</el-button>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -85,30 +94,30 @@
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body custom-class="assets-type-dialog" :close-on-click-modal="false"
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body custom-class="assets-type-dialog" :close-on-click-modal="false"
|
||||||
:close-on-press-escape="false">
|
:close-on-press-escape="false">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="公司名称">
|
<el-form-item label="公司名称" v-if="nonAdmin">
|
||||||
<el-input v-model="form.compName" disabled />
|
<el-input v-model="form.compName" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="项目名称">
|
<el-form-item label="项目名称" v-if="nonAdmin">
|
||||||
<el-input v-model="form.deptName" disabled />
|
<el-input v-model="form.deptName" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="一级分类" prop="type">
|
<el-form-item label="资产类型" prop="type">
|
||||||
<el-select v-model="form.type" placeholder="请选择资产类型" @change="doLvl1Change">
|
<el-select v-model="form.type" placeholder="请选择资产类型" @change="doLvl1Change" style="width:100%">
|
||||||
<el-option v-for="dict in dict.type.sys_process_category" :key="dict.value" :label="dict.label"
|
<el-option v-for="dict in dict.type.sys_process_category" :key="dict.value" :label="dict.label"
|
||||||
:value="dict.value"></el-option>
|
:value="dict.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="二级分类" prop="parentId">
|
<el-form-item label="父级分类" prop="parentId">
|
||||||
<el-select v-model="form.parentId" placeholder="请选择资产类型">
|
<el-select v-model="form.parentId" placeholder="请选择父级分类" style="width:100%">
|
||||||
<el-option v-for="it in lvl2Opts" :key="it.id" :label="it.name" :value="it.id"></el-option>
|
<el-option v-for="item in parentTypeOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="资产名称" prop="name">
|
<el-form-item label="资产名称" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入资产名称" />
|
<el-input v-model="form.name" placeholder="请输入资产名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="资产单位" prop="sunit">
|
<el-form-item label="资产单位" prop="sunit" v-if="form.parentId">
|
||||||
<el-input v-model="form.sunit" placeholder="请输入资产单位" />
|
<el-input v-model="form.sunit" placeholder="请输入资产单位" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="div-unit">
|
<div class="div-unit" v-if="form.parentId">
|
||||||
<el-tag v-for="(it, idx) in units" :class="{ 'is-selected': it.sel, 'is-del': it.del }" @close="doCloseTag(it, idx)"
|
<el-tag v-for="(it, idx) in units" :class="{ 'is-selected': it.sel, 'is-del': it.del }" @close="doCloseTag(it, idx)"
|
||||||
:closable="!it.sys" @click="doSelTag(it)" :key="idx">
|
:closable="!it.sys" @click="doSelTag(it)" :key="idx">
|
||||||
<i class="el-icon-check"></i>
|
<i class="el-icon-check"></i>
|
||||||
|
@ -125,7 +134,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listAssetsType, getAssetsType, delAssetsType, addAssetsType, updateAssetsType, listLevel2 } from "@/api/base/assetsType";
|
import { listAssetsType, getAssetsType, delAssetsType, addAssetsType, updateAssetsType, listLevel2, findParentTypesByCategory } from "@/api/base/assetsType";
|
||||||
import { listDept } from '@/api/system/dept'
|
import { listDept } from '@/api/system/dept'
|
||||||
export default {
|
export default {
|
||||||
name: "AssetsType",
|
name: "AssetsType",
|
||||||
|
@ -158,7 +167,6 @@ export default {
|
||||||
open: false,
|
open: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
parentId: -1,
|
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
compyId: null,
|
compyId: null,
|
||||||
|
@ -172,12 +180,17 @@ export default {
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
|
type: [{ required: true, message: "资产类型不能为空", trigger: "change" }],
|
||||||
name: [{ required: true, message: "资产名称不能为空", trigger: "blur" }]
|
name: [{ required: true, message: "资产名称不能为空", trigger: "blur" }]
|
||||||
}
|
},
|
||||||
|
parentTypeOptions:[],
|
||||||
|
nonAdmin:true,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
if(this.$store.getters.userId==1){
|
||||||
|
this.nonAdmin = false
|
||||||
|
}
|
||||||
listDept().then(d => {
|
listDept().then(d => {
|
||||||
this.deptOpts = d.data || [];
|
this.deptOpts = d.data || [];
|
||||||
this.compyOpts = this.deptOpts.filter(it => it.parentId == 100)
|
this.compyOpts = this.deptOpts.filter(it => it.parentId == 100)
|
||||||
|
@ -196,7 +209,6 @@ export default {
|
||||||
listLevel2().then(d => {
|
listLevel2().then(d => {
|
||||||
this.lvlDatas = d.data;
|
this.lvlDatas = d.data;
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doCloseTag(tag) {
|
doCloseTag(tag) {
|
||||||
|
@ -213,11 +225,15 @@ export default {
|
||||||
}
|
}
|
||||||
tag.sel = !tag.sel;
|
tag.sel = !tag.sel;
|
||||||
},
|
},
|
||||||
doLvl1Change(a) {
|
doLvl1Change(value) {
|
||||||
this.lvl2Opts = this.lvlDatas.filter(d => d.type == a);
|
// this.lvl2Opts = this.lvlDatas.filter(d => d.type == a);
|
||||||
if (this.lvl2Opts.length > 0) {
|
// if (this.lvl2Opts.length > 0) {
|
||||||
this.form.parentId = this.lvl2Opts[0].id;
|
// this.form.parentId = this.lvl2Opts[0].id;
|
||||||
}
|
// }
|
||||||
|
this.form.parentId = null;
|
||||||
|
findParentTypesByCategory(value).then(res =>{
|
||||||
|
this.parentTypeOptions = res.data||[];
|
||||||
|
});
|
||||||
},
|
},
|
||||||
doCompyChange(a) {
|
doCompyChange(a) {
|
||||||
let tmps = this.compyOpts.filter(d => d.deptId == a);
|
let tmps = this.compyOpts.filter(d => d.deptId == a);
|
||||||
|
@ -272,7 +288,7 @@ export default {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
parentId: null,
|
parentId: null,
|
||||||
deptId: this.queryParams.defaultDeptId,
|
deptId: this.nonAdmin?this.queryParams.defaultDeptId:null,
|
||||||
type: null,
|
type: null,
|
||||||
name: null,
|
name: null,
|
||||||
sunit: null,
|
sunit: null,
|
||||||
|
@ -289,14 +305,13 @@ export default {
|
||||||
tmps = this.prjOpts.filter(d => d.deptId == this.form.deptId);
|
tmps = this.prjOpts.filter(d => d.deptId == this.form.deptId);
|
||||||
this.form.deptName = tmps.length > 0 ? tmps[0].deptName : "";
|
this.form.deptName = tmps.length > 0 ? tmps[0].deptName : "";
|
||||||
tmps = this.dict.type.sys_process_category
|
tmps = this.dict.type.sys_process_category
|
||||||
if (tmps.length > 0) {
|
// if (tmps.length > 0) {
|
||||||
this.form.type = tmps[0].value;
|
// this.form.type = tmps[0].value;
|
||||||
this.lvl2Opts = this.lvlDatas.filter(d => d.type == this.form.type);
|
// this.lvl2Opts = this.lvlDatas.filter(d => d.type == this.form.type);
|
||||||
if (this.lvl2Opts.length > 0) {
|
// if (this.lvl2Opts.length > 0) {
|
||||||
this.form.parentId = this.lvl2Opts[0].id;
|
// this.form.parentId = this.lvl2Opts[0].id;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
this.doPrjChange(this.queryParams.defaultDeptId)
|
this.doPrjChange(this.queryParams.defaultDeptId)
|
||||||
},
|
},
|
||||||
|
@ -327,6 +342,7 @@ export default {
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
|
if(row.unit){
|
||||||
let tmps=row.unit.split(",").filter(d=>d);
|
let tmps=row.unit.split(",").filter(d=>d);
|
||||||
let uns=this.units.map(d=>d.text).join(",")
|
let uns=this.units.map(d=>d.text).join(",")
|
||||||
tmps.forEach(it=>{
|
tmps.forEach(it=>{
|
||||||
|
@ -341,11 +357,13 @@ export default {
|
||||||
this.units.forEach(it=>{
|
this.units.forEach(it=>{
|
||||||
it.sel=(","+row.unit+",").indexOf(","+it.text+",")>=0;
|
it.sel=(","+row.unit+",").indexOf(","+it.text+",")>=0;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
getAssetsType(id).then(response => {
|
getAssetsType(id).then(response => {
|
||||||
this.form = {...response.data,sunit:''};
|
this.form = {...response.data,sunit:''};
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改物资类型";
|
this.title = "修改物资类型";
|
||||||
});
|
});
|
||||||
|
this.doLvl1Change(row.type);
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
@ -377,6 +395,32 @@ export default {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
//状态设置
|
||||||
|
setStatus(row, val) {
|
||||||
|
this.$confirm(`是否确认修改数据为${val == "0" ? "有效" : "无效"}?`, "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
let param = {
|
||||||
|
id: row.id,
|
||||||
|
isDel: val,
|
||||||
|
};
|
||||||
|
updateAssetsType(param).then((response) => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
// 取消时恢复原始开关状态
|
||||||
|
if (val == "0") {
|
||||||
|
row.isDel = "1";
|
||||||
|
} else {
|
||||||
|
row.isDel = "0";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="login">
|
<div class="login">
|
||||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||||
<h3 class="title">研筑临时项目管理系统</h3>
|
<h3 class="title">临建管家</h3>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="loginForm.username"
|
v-model="loginForm.username"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="register">
|
<div class="register">
|
||||||
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
|
<el-form ref="registerForm" :model="registerForm" :rules="registerRules" class="register-form">
|
||||||
<h3 class="title">研筑临时项目管理系统</h3>
|
<h3 class="title">临建管家</h3>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
|
<el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||||
|
|
|
@ -7,7 +7,7 @@ function resolve(dir) {
|
||||||
|
|
||||||
const CompressionPlugin = require('compression-webpack-plugin')
|
const CompressionPlugin = require('compression-webpack-plugin')
|
||||||
|
|
||||||
const name = process.env.VUE_APP_TITLE || '研筑临时项目管理系统' // 网页标题
|
const name = process.env.VUE_APP_TITLE || '临建管家' // 网页标题
|
||||||
|
|
||||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ module.exports = {
|
||||||
// 部署生产环境和开发环境下的URL。
|
// 部署生产环境和开发环境下的URL。
|
||||||
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
||||||
// 例如 https://www.yanZhu.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.yanZhu.vip/admin/,则设置 baseUrl 为 /admin/。
|
// 例如 https://www.yanZhu.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.yanZhu.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||||
publicPath: process.env.NODE_ENV === "production" ? "/prjapp" : "/prjapp",
|
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
||||||
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
||||||
outputDir: 'dist',
|
outputDir: 'dist',
|
||||||
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
||||||
|
|
Loading…
Reference in New Issue