Merge remote-tracking branch 'origin/fix-bug-202303' into fix-bug-202303

This commit is contained in:
梁琦涛
2023-03-06 11:37:07 +08:00
37 changed files with 436 additions and 373 deletions
@@ -8,8 +8,10 @@ import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.vo.SysDepartTreeModel; import com.jero.common.system.vo.SysDepartTreeModel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.constant.CacheConstant; import com.jero.common.constant.CacheConstant;
@@ -69,7 +71,8 @@ public class SysDepartController {
* *
* @return * @return
*/ */
@RequestMapping(value = "/queryMyDeptTreeList", method = RequestMethod.GET) // @RequestMapping(value = "/queryMyDeptTreeList", method = RequestMethod.GET)
@GetMapping("/queryMyDeptTreeList")
public Result<List<SysDepartTreeModel>> queryMyDeptTreeList() { public Result<List<SysDepartTreeModel>> queryMyDeptTreeList() {
Result<List<SysDepartTreeModel>> result = new Result<>(); Result<List<SysDepartTreeModel>> result = new Result<>();
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -99,7 +102,8 @@ public class SysDepartController {
* *
* @return * @return
*/ */
@RequestMapping(value = "/queryTreeList", method = RequestMethod.GET) // @RequestMapping(value = "/queryTreeList", method = RequestMethod.GET)
@GetMapping("/queryTreeList")
public Result<List<SysDepartTreeModel>> queryTreeList() { public Result<List<SysDepartTreeModel>> queryTreeList() {
Result<List<SysDepartTreeModel>> result = new Result<>(); Result<List<SysDepartTreeModel>> result = new Result<>();
try { try {
@@ -122,7 +126,8 @@ public class SysDepartController {
* *
* @return * @return
*/ */
@RequestMapping(value = "/queryDepartTreeSync", method = RequestMethod.GET) // @RequestMapping(value = "/queryDepartTreeSync", method = RequestMethod.GET)
@GetMapping("/queryDepartTreeSync")
public Result<List<SysDepartTreeModel>> queryDepartTreeSync(@RequestParam(name = "pid", required = false) String parentId) { public Result<List<SysDepartTreeModel>> queryDepartTreeSync(@RequestParam(name = "pid", required = false) String parentId) {
Result<List<SysDepartTreeModel>> result = new Result<>(); Result<List<SysDepartTreeModel>> result = new Result<>();
try { try {
@@ -142,7 +147,7 @@ public class SysDepartController {
* @param orgCode 根据orgCode查,departId和orgCode必须有一个不为空 * @param orgCode 根据orgCode查,departId和orgCode必须有一个不为空
*/ */
@GetMapping("/queryAllParentId") @GetMapping("/queryAllParentId")
public Result queryParentIds( public Result<JSONObject> queryParentIds(
@RequestParam(name = "departId", required = false) String departId, @RequestParam(name = "departId", required = false) String departId,
@RequestParam(name = "orgCode", required = false) String orgCode @RequestParam(name = "orgCode", required = false) String orgCode
) { ) {
@@ -170,7 +175,8 @@ public class SysDepartController {
*/ */
//@RequiresRoles({"admin"}) //@RequiresRoles({"admin"})
@RequiresPermissions("sys:depart:add") @RequiresPermissions("sys:depart:add")
@RequestMapping(value = "/add", method = RequestMethod.POST) // @RequestMapping(value = "/add", method = RequestMethod.POST)
@PostMapping("/add")
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<Object> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) { public Result<Object> add(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request); String username = JwtUtil.getUserNameByToken(request);
@@ -192,7 +198,8 @@ public class SysDepartController {
*/ */
//@RequiresRoles({"admin"}) //@RequiresRoles({"admin"})
@RequiresPermissions("sys:depart:edit") @RequiresPermissions("sys:depart:edit")
@RequestMapping(value = "/edit", method = RequestMethod.PUT) // @RequestMapping(value = "/edit", method = RequestMethod.PUT)
@PutMapping("/edit")
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<Object> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) { public Result<Object> edit(@RequestBody SysDepart sysDepart, HttpServletRequest request) {
String username = JwtUtil.getUserNameByToken(request); String username = JwtUtil.getUserNameByToken(request);
@@ -216,7 +223,8 @@ public class SysDepartController {
*/ */
//@RequiresRoles({"admin"}) //@RequiresRoles({"admin"})
@RequiresPermissions("sys:depart:del") @RequiresPermissions("sys:depart:del")
@RequestMapping(value = "/delete", method = RequestMethod.DELETE) // @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
@DeleteMapping("/delete")
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<Object> delete(@RequestParam(name="id",required=true) String id) { public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
SysDepart sysDepart = sysDepartService.getById(id); SysDepart sysDepart = sysDepartService.getById(id);
@@ -240,7 +248,8 @@ public class SysDepartController {
*/ */
//@RequiresRoles({"admin"}) //@RequiresRoles({"admin"})
@RequiresPermissions("sys:depart:del") @RequiresPermissions("sys:depart:del")
@RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) // @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
@DeleteMapping("/deleteBatch")
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<Object> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { public Result<Object> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
if (ids == null || "".equals(ids.trim())) { if (ids == null || "".equals(ids.trim())) {
@@ -256,7 +265,8 @@ public class SysDepartController {
* *
* @return * @return
*/ */
@RequestMapping(value = "/queryIdTree", method = RequestMethod.GET) // @RequestMapping(value = "/queryIdTree", method = RequestMethod.GET)
@GetMapping("/queryIdTree")
public Result<List<DepartIdModel>> queryIdTree() { public Result<List<DepartIdModel>> queryIdTree() {
try { try {
List<DepartIdModel> list = sysDepartService.queryDepartIdTreeList(); List<DepartIdModel> list = sysDepartService.queryDepartIdTreeList();
@@ -275,7 +285,8 @@ public class SysDepartController {
* @param keyWord * @param keyWord
* @return * @return
*/ */
@RequestMapping(value = "/searchBy", method = RequestMethod.GET) // @RequestMapping(value = "/searchBy", method = RequestMethod.GET)
@GetMapping("/searchBy")
public Result<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord,@RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) { public Result<List<SysDepartTreeModel>> searchBy(@RequestParam(name = "keyWord", required = true) String keyWord,@RequestParam(name = "myDeptSearch", required = false) String myDeptSearch) {
//部门查询,myDeptSearch为1时为我的部门查询,登录用户为上级时查只查负责部门下数据 //部门查询,myDeptSearch为1时为我的部门查询,登录用户为上级时查只查负责部门下数据
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -284,7 +295,7 @@ public class SysDepartController {
departIds = user.getDepartIds(); departIds = user.getDepartIds();
} }
List<SysDepartTreeModel> treeList = this.sysDepartService.searhBy(keyWord,myDeptSearch,departIds); List<SysDepartTreeModel> treeList = this.sysDepartService.searhBy(keyWord,myDeptSearch,departIds);
if (treeList == null || treeList.size() == 0) { if (treeList == null || treeList.isEmpty()) {
return Result.error("未查询匹配数据!"); return Result.error("未查询匹配数据!");
} }
return Result.OK(treeList); return Result.OK(treeList);
@@ -305,17 +316,12 @@ public class SysDepartController {
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SysDepart> pageList = sysDepartService.list(queryWrapper); List<SysDepart> pageList = sysDepartService.list(queryWrapper);
//按字典排序 //按字典排序
Collections.sort(pageList, new Comparator<SysDepart>() { Collections.sort(pageList,(SysDepart arg0, SysDepart arg1)-> arg0.getOrgCode().compareTo(arg1.getOrgCode()));
@Override
public int compare(SysDepart arg0, SysDepart arg1) {
return arg0.getOrgCode().compareTo(arg1.getOrgCode());
}
});
//导出文件名称 //导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "部门列表"); mv.addObject(JeroController.FILE_NAME, "部门列表");
mv.addObject(NormalExcelConstants.CLASS, SysDepart.class); mv.addObject(JeroController.CLASS, SysDepart.class);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息")); mv.addObject(JeroController.PARAMS, new ExportParams("部门列表数据", "导出人:"+user.getRealname(), "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
@@ -329,9 +335,10 @@ public class SysDepartController {
*/ */
//@RequiresRoles({"admin"}) //@RequiresRoles({"admin"})
@RequiresPermissions("sys:depart:import") @RequiresPermissions("sys:depart:import")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) // @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
@PostMapping("/importExcel")
@CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true) @CacheEvict(value= {CacheConstant.SYS_DEPARTS_CACHE,CacheConstant.SYS_DEPART_IDS_CACHE}, allEntries=true)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
List<String> errorMessageList = new ArrayList<>(); List<String> errorMessageList = new ArrayList<>();
List<SysDepart> listSysDeparts = null; List<SysDepart> listSysDeparts = null;
@@ -346,24 +353,25 @@ public class SysDepartController {
// orgCode编码长度 // orgCode编码长度
int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH; int codeLength = YouBianCodeUtil.ZHANWEI_LENGTH;
listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepart.class, params); listSysDeparts = ExcelImportUtil.importExcel(file.getInputStream(), SysDepart.class, params);
//按长度排序 //按长度排序 todo 当比较到最后一个元素时会出现空指针 导入需要做orgCode必填效验
Collections.sort(listSysDeparts, new Comparator<SysDepart>() { /*Collections.sort(listSysDeparts, new Comparator<SysDepart>() {
@Override @Override
public int compare(SysDepart arg0, SysDepart arg1) { public int compare(SysDepart arg0, SysDepart arg1) {
return arg0.getOrgCode().length() - arg1.getOrgCode().length(); return arg0.getOrgCode().length() - arg1.getOrgCode().length();
} }
}); });*/
Collections.sort(listSysDeparts, (SysDepart arg0, SysDepart arg1) -> arg0.getOrgCode().length() - arg1.getOrgCode().length());
int num = 0; int num = 0;
for (SysDepart sysDepart : listSysDeparts) { for (SysDepart sysDepart : listSysDeparts) {
String orgCode = sysDepart.getOrgCode(); String orgCode = sysDepart.getOrgCode();
if(orgCode.length() > codeLength) { if(orgCode.length() > codeLength) {
String parentCode = orgCode.substring(0, orgCode.length()-codeLength); String parentCode = orgCode.substring(0, orgCode.length()-codeLength);
QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<SysDepart>(); QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("org_code", parentCode); queryWrapper.eq("org_code", parentCode);
try { try {
SysDepart parentDept = sysDepartService.getOne(queryWrapper); SysDepart parentDept = sysDepartService.getOne(queryWrapper);
if(!parentDept.equals(null)) { if(parentDept != null) {
sysDepart.setParentId(parentDept.getId()); sysDepart.setParentId(parentDept.getId());
} else { } else {
sysDepart.setParentId(""); sysDepart.setParentId("");
@@ -408,10 +416,10 @@ public class SysDepartController {
*/ */
@GetMapping("listAll") @GetMapping("listAll")
public Result<List<SysDepart>> listAll(@RequestParam(name = "id", required = false) String id) { public Result<List<SysDepart>> listAll(@RequestParam(name = "id", required = false) String id) {
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>(); LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<>();
query.orderByAsc(SysDepart::getOrgCode); query.orderByAsc(SysDepart::getOrgCode);
if(oConvertUtils.isNotEmpty(id)){ if(oConvertUtils.isNotEmpty(id)){
String arr[] = id.split(","); String[] arr = id.split(",");
query.in(SysDepart::getId,arr); query.in(SysDepart::getId,arr);
} }
List<SysDepart> ls = this.sysDepartService.list(query); List<SysDepart> ls = this.sysDepartService.list(query);
@@ -422,14 +430,15 @@ public class SysDepartController {
* *
* @return * @return
*/ */
@RequestMapping(value = "/queryTreeByKeyWord", method = RequestMethod.GET) // @RequestMapping(value = "/queryTreeByKeyWord", method = RequestMethod.GET)
@GetMapping("/queryTreeByKeyWord")
public Result<Map<String,Object>> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) { public Result<Map<String,Object>> queryTreeByKeyWord(@RequestParam(name = "keyWord", required = false) String keyWord) {
Result<Map<String,Object>> result = new Result<>(); Result<Map<String,Object>> result = new Result<>();
try { try {
Map<String,Object> map=new HashMap<String,Object>(); Map<String,Object> map=new HashMap<>();
List<SysDepartTreeModel> list = sysDepartService.queryTreeByKeyWord(keyWord); List<SysDepartTreeModel> list = sysDepartService.queryTreeByKeyWord(keyWord);
//根据keyWord获取用户信息 //根据keyWord获取用户信息
LambdaQueryWrapper<SysUser> queryUser = new LambdaQueryWrapper<SysUser>(); LambdaQueryWrapper<SysUser> queryUser = new LambdaQueryWrapper<>();
queryUser.eq(SysUser::getDelFlag,CommonConstant.DEL_FLAG_0); queryUser.eq(SysUser::getDelFlag,CommonConstant.DEL_FLAG_0);
queryUser.and(i -> i.like(SysUser::getUsername, keyWord).or().like(SysUser::getRealname, keyWord)); queryUser.and(i -> i.like(SysUser::getUsername, keyWord).or().like(SysUser::getRealname, keyWord));
List<SysUser> sysUsers = this.sysUserService.list(queryUser); List<SysUser> sysUsers = this.sysUserService.list(queryUser);
@@ -24,6 +24,7 @@ import lombok.extern.slf4j.Slf4j;
import com.jero.modules.system.service.ISysPermissionDataRuleService; import com.jero.modules.system.service.ISysPermissionDataRuleService;
import com.jero.modules.system.service.ISysPermissionService; import com.jero.modules.system.service.ISysPermissionService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
@@ -61,16 +62,16 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
*/ */
@ApiOperation(value="部门权限表-分页列表查询", notes="部门权限表-分页列表查询") @ApiOperation(value="部门权限表-分页列表查询", notes="部门权限表-分页列表查询")
@GetMapping(value = "/page") @GetMapping(value = "/page")
public Result<?> queryPageList(SysDepartPermission sysDepartPermission, public Result<IPage<SysDepartPermission>> queryPageList(SysDepartPermission sysDepartPermission,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<SysDepartPermission> queryWrapper = QueryGenerator.initQueryWrapper(sysDepartPermission, req.getParameterMap()); QueryWrapper<SysDepartPermission> queryWrapper = QueryGenerator.initQueryWrapper(sysDepartPermission, req.getParameterMap());
Page<SysDepartPermission> page = new Page<SysDepartPermission>(pageNo, pageSize); Page<SysDepartPermission> page = new Page<>(pageNo, pageSize);
IPage<SysDepartPermission> pageList = sysDepartPermissionService.page(page, queryWrapper); IPage<SysDepartPermission> pageList = sysDepartPermissionService.page(page, queryWrapper);
return Result.OK(pageList); return Result.OK(pageList);
} }
/** /**
* 添加 * 添加
* *
@@ -79,11 +80,11 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
*/ */
@ApiOperation(value="部门权限表-添加", notes="部门权限表-添加") @ApiOperation(value="部门权限表-添加", notes="部门权限表-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody SysDepartPermission sysDepartPermission) { public Result<T> add(@RequestBody SysDepartPermission sysDepartPermission) {
sysDepartPermissionService.save(sysDepartPermission); sysDepartPermissionService.save(sysDepartPermission);
return Result.OK("操作成功!"); return Result.OK("操作成功!");
} }
/** /**
* 编辑 * 编辑
* *
@@ -92,11 +93,11 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
*/ */
@ApiOperation(value="部门权限表-编辑", notes="部门权限表-编辑") @ApiOperation(value="部门权限表-编辑", notes="部门权限表-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@RequestBody SysDepartPermission sysDepartPermission) { public Result<T> edit(@RequestBody SysDepartPermission sysDepartPermission) {
sysDepartPermissionService.updateById(sysDepartPermission); sysDepartPermissionService.updateById(sysDepartPermission);
return Result.OK("操作成功!"); return Result.OK("操作成功!");
} }
/** /**
* 通过id删除 * 通过id删除
* *
@@ -105,11 +106,11 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
*/ */
@ApiOperation(value="部门权限表-通过id删除", notes="部门权限表-通过id删除") @ApiOperation(value="部门权限表-通过id删除", notes="部门权限表-通过id删除")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { public Result<T> delete(@RequestParam(name="id",required=true) String id) {
sysDepartPermissionService.removeById(id); sysDepartPermissionService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
/** /**
* 批量删除 * 批量删除
* *
@@ -118,11 +119,11 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
*/ */
@ApiOperation(value="部门权限表-批量删除", notes="部门权限表-批量删除") @ApiOperation(value="部门权限表-批量删除", notes="部门权限表-批量删除")
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<T> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.sysDepartPermissionService.removeByIds(Arrays.asList(ids.split(","))); this.sysDepartPermissionService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
/** /**
* 通过id查询 * 通过id查询
* *
@@ -131,7 +132,7 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
*/ */
@ApiOperation(value="部门权限表-通过id查询", notes="部门权限表-通过id查询") @ApiOperation(value="部门权限表-通过id查询", notes="部门权限表-通过id查询")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { public Result<SysDepartPermission> queryById(@RequestParam(name="id",required=true) String id) {
SysDepartPermission sysDepartPermission = sysDepartPermissionService.getById(id); SysDepartPermission sysDepartPermission = sysDepartPermissionService.getById(id);
return Result.OK(sysDepartPermission); return Result.OK(sysDepartPermission);
} }
@@ -154,8 +155,9 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
* @param response * @param response
* @return * @return
*/ */
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) // @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { @PostMapping("/importExcel")
public Result<SysDepartPermission> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, SysDepartPermission.class); return super.importExcel(request, response, SysDepartPermission.class);
} }
@@ -163,9 +165,9 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
* 部门管理授权查询数据规则数据 * 部门管理授权查询数据规则数据
*/ */
@GetMapping(value = "/datarule/{permissionId}/{departId}") @GetMapping(value = "/datarule/{permissionId}/{departId}")
public Result<?> loadDatarule(@PathVariable("permissionId") String permissionId,@PathVariable("departId") String departId) { public Result<Map<String, Object>> loadDatarule(@PathVariable("permissionId") String permissionId,@PathVariable("departId") String departId) {
List<SysPermissionDataRule> list = sysPermissionDataRuleService.getPermRuleListByPermId(permissionId); List<SysPermissionDataRule> list = sysPermissionDataRuleService.getPermRuleListByPermId(permissionId);
if(list==null || list.size()==0) { if(list==null || list.isEmpty()) {
return Result.error("未找到权限配置信息"); return Result.error("未找到权限配置信息");
}else { }else {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
@@ -192,13 +194,14 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
* @param request * @param request
* @return * @return
*/ */
@RequestMapping(value = "/queryTreeListForDeptRole", method = RequestMethod.GET) // @RequestMapping(value = "/queryTreeListForDeptRole", method = RequestMethod.GET)
@GetMapping("/queryTreeListForDeptRole")
public Result<Map<String,Object>> queryTreeListForDeptRole(@RequestParam(name="departId",required=true) String departId,HttpServletRequest request) { public Result<Map<String,Object>> queryTreeListForDeptRole(@RequestParam(name="departId",required=true) String departId,HttpServletRequest request) {
Result<Map<String,Object>> result = new Result<>(); Result<Map<String,Object>> result = new Result<>();
//全部权限ids //全部权限ids
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
try { try {
LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<SysPermission>(); LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0); query.eq(SysPermission::getDelFlag, CommonConstant.DEL_FLAG_0);
query.orderByAsc(SysPermission::getSortNo); query.orderByAsc(SysPermission::getSortNo);
query.inSql(SysPermission::getId,"select permission_id from sys_depart_permission where depart_id='"+departId+"'"); query.inSql(SysPermission::getId,"select permission_id from sys_depart_permission where depart_id='"+departId+"'");
@@ -208,7 +211,7 @@ public class SysDepartPermissionController extends JeroController<SysDepartPermi
} }
List<TreeModel> treeList = new ArrayList<>(); List<TreeModel> treeList = new ArrayList<>();
getTreeModelList(treeList, list, null); getTreeModelList(treeList, list, null);
Map<String,Object> resMap = new HashMap<String,Object>(); Map<String,Object> resMap = new HashMap<>();
resMap.put("treeList", treeList); //全部树节点数据 resMap.put("treeList", treeList); //全部树节点数据
resMap.put("ids", ids);//全部树ids resMap.put("ids", ids);//全部树ids
result.setResult(resMap); result.setResult(resMap);
@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.system.base.controller.JeroController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles; import org.apache.shiro.authz.annotation.RequiresRoles;
@@ -69,13 +71,18 @@ public class SysDictController {
@Autowired @Autowired
public RedisTemplate<String, Object> redisTemplate; public RedisTemplate<String, Object> redisTemplate;
@RequestMapping(value = "/page", method = RequestMethod.GET) private String DICT_CODE_ERROE = "字典Code格式不正确!";
private String OPTION_SUCCESS = "操作成功!";
private String DEL_SUCCESS = "删除成功!";
// @RequestMapping(value = "/page", method = RequestMethod.GET)
@GetMapping("/page")
@ApiOperation(value = "字典控制器-分页列表查询", notes = "字典控制器-分页列表查询") @ApiOperation(value = "字典控制器-分页列表查询", notes = "字典控制器-分页列表查询")
public Result<IPage<SysDict>> queryPageList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, public Result<IPage<SysDict>> queryPageList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
Result<IPage<SysDict>> result = new Result<IPage<SysDict>>(); Result<IPage<SysDict>> result = new Result<>();
QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, req.getParameterMap()); QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, req.getParameterMap());
Page<SysDict> page = new Page<SysDict>(pageNo, pageSize); Page<SysDict> page = new Page<>(pageNo, pageSize);
IPage<SysDict> pageList = sysDictService.page(page, queryWrapper); IPage<SysDict> pageList = sysDictService.page(page, queryWrapper);
log.debug("查询当前页:"+pageList.getCurrent()); log.debug("查询当前页:"+pageList.getCurrent());
log.debug("查询当前页数量:"+pageList.getSize()); log.debug("查询当前页数量:"+pageList.getSize());
@@ -95,7 +102,8 @@ public class SysDictController {
* @return * @return
*/ */
@ApiOperation(value = "字典控制器-树形字典数据", notes = "字典控制器-树形字典数据") @ApiOperation(value = "字典控制器-树形字典数据", notes = "字典控制器-树形字典数据")
@RequestMapping(value = "/treeList", method = RequestMethod.GET) // @RequestMapping(value = "/treeList", method = RequestMethod.GET)
@GetMapping("/treeList")
public Result<List<SysDictTree>> treeList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, public Result<List<SysDictTree>> treeList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
Result<List<SysDictTree>> result = new Result<>(); Result<List<SysDictTree>> result = new Result<>();
@@ -122,9 +130,10 @@ public class SysDictController {
* @return * @return
*/ */
@ApiOperation(value = "字典控制器-获取全部字典数据", notes = "字典控制器-获取全部字典数据") @ApiOperation(value = "字典控制器-获取全部字典数据", notes = "字典控制器-获取全部字典数据")
@RequestMapping(value = "/queryAllDictItems", method = RequestMethod.GET) // @RequestMapping(value = "/queryAllDictItems", method = RequestMethod.GET)
public Result<?> queryAllDictItems(HttpServletRequest request) { @GetMapping("/queryAllDictItems")
Map<String, List<DictModel>> res = new HashMap<String, List<DictModel>>(); public Result<Map<String, List<DictModel>>> queryAllDictItems(HttpServletRequest request) {
Map<String, List<DictModel>> res ;
res = sysDictService.queryAllDictItems(); res = sysDictService.queryAllDictItems();
return Result.OK(res); return Result.OK(res);
} }
@@ -135,10 +144,11 @@ public class SysDictController {
* @return * @return
*/ */
@ApiOperation(value = "字典控制器-通过字典code和字典值key获取字典数据", notes = "字典控制器-通过字典code和字典值key获取字典数据") @ApiOperation(value = "字典控制器-通过字典code和字典值key获取字典数据", notes = "字典控制器-通过字典code和字典值key获取字典数据")
@RequestMapping(value = "/getDictText/{dictCode}/{key}", method = RequestMethod.GET) // @RequestMapping(value = "/getDictText/{dictCode}/{key}", method = RequestMethod.GET)
@GetMapping("/getDictText/{dictCode}/{key}")
public Result<String> getDictText(@PathVariable("dictCode") String dictCode, @PathVariable("key") String key) { public Result<String> getDictText(@PathVariable("dictCode") String dictCode, @PathVariable("key") String key) {
log.info(" dictCode : "+ dictCode); log.info(" dictCode : "+ dictCode);
Result<String> result = new Result<String>(); Result<String> result = new Result<>();
String text = null; String text = null;
try { try {
text = sysDictService.queryDictTextByKey(dictCode, key); text = sysDictService.queryDictTextByKey(dictCode, key);
@@ -157,14 +167,15 @@ public class SysDictController {
* @param dictCode 表名,文本字段,code字段 | 举例:sys_user,realname,id * @param dictCode 表名,文本字段,code字段 | 举例:sys_user,realname,id
* @return * @return
*/ */
@RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET) // @RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET)
@GetMapping("/getDictItems/{dictCode}")
public Result<List<DictModel>> getDictItems(@PathVariable String dictCode, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) { public Result<List<DictModel>> getDictItems(@PathVariable String dictCode, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) {
log.info(" dictCode : "+ dictCode); log.info(" dictCode : "+ dictCode);
Result<List<DictModel>> result = new Result<List<DictModel>>(); Result<List<DictModel>> result = new Result<>();
try { try {
List<DictModel> ls = sysDictService.getDictItems(dictCode); List<DictModel> ls = sysDictService.getDictItems(dictCode);
if (ls == null) { if (ls == null) {
return Result.error("字典Code格式不正确!"); return Result.error(DICT_CODE_ERROE);
} }
result.setSuccess(true); result.setSuccess(true);
result.setResult(ls); result.setResult(ls);
@@ -183,17 +194,18 @@ public class SysDictController {
* @param dictCode 字典code格式:table,text,code * @param dictCode 字典code格式:table,text,code
* @return * @return
*/ */
@RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET) // @RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET)
@GetMapping("/loadDict/{dictCode}")
public Result<List<DictModel>> loadDict(@PathVariable String dictCode, public Result<List<DictModel>> loadDict(@PathVariable String dictCode,
@RequestParam(name="keyword") String keyword, @RequestParam(name="keyword") String keyword,
@RequestParam(value = "sign",required = false) String sign, @RequestParam(value = "sign",required = false) String sign,
@RequestParam(value = "pageSize", required = false) Integer pageSize) { @RequestParam(value = "pageSize", required = false) Integer pageSize) {
log.info(" 加载字典表数据,加载关键字: "+ keyword); log.info(" 加载字典表数据,加载关键字: "+ keyword);
Result<List<DictModel>> result = new Result<List<DictModel>>(); Result<List<DictModel>> result = new Result<>();
try { try {
List<DictModel> ls = sysDictService.loadDict(dictCode, keyword, pageSize); List<DictModel> ls = sysDictService.loadDict(dictCode, keyword, pageSize);
if (ls == null) { if (ls == null) {
return Result.error("字典Code格式不正确!"); return Result.error(DICT_CODE_ERROE);
} }
result.setSuccess(true); result.setSuccess(true);
result.setResult(ls); result.setResult(ls);
@@ -213,7 +225,8 @@ public class SysDictController {
* @param pageSize * @param pageSize
* @return * @return
*/ */
@RequestMapping(value = "/loadDictOrderByValue/{dictCode}", method = RequestMethod.GET) // @RequestMapping(value = "/loadDictOrderByValue/{dictCode}", method = RequestMethod.GET)
@GetMapping("/loadDictOrderByValue/{dictCode}")
public Result<List<DictModel>> loadDictOrderByValue( public Result<List<DictModel>> loadDictOrderByValue(
@PathVariable String dictCode, @PathVariable String dictCode,
@RequestParam(name = "keyword") String keyword, @RequestParam(name = "keyword") String keyword,
@@ -255,14 +268,15 @@ public class SysDictController {
* @param request * @param request
* @return * @return
*/ */
@RequestMapping(value = "/loadDictItem/{dictCode}", method = RequestMethod.GET) // @RequestMapping(value = "/loadDictItem/{dictCode}", method = RequestMethod.GET)
@GetMapping("/loadDictItem/{dictCode}")
public Result<List<String>> loadDictItem(@PathVariable String dictCode,@RequestParam(name="key") String keys, @RequestParam(value = "sign",required = false) String sign,@RequestParam(value = "delNotExist",required = false,defaultValue = "true") boolean delNotExist,HttpServletRequest request) { public Result<List<String>> loadDictItem(@PathVariable String dictCode,@RequestParam(name="key") String keys, @RequestParam(value = "sign",required = false) String sign,@RequestParam(value = "delNotExist",required = false,defaultValue = "true") boolean delNotExist,HttpServletRequest request) {
Result<List<String>> result = new Result<>(); Result<List<String>> result = new Result<>();
try { try {
if(dictCode.indexOf(",")!=-1) { if(dictCode.indexOf(",")!=-1) {
String[] params = dictCode.split(","); String[] params = dictCode.split(",");
if(params.length!=3) { if(params.length!=3) {
return Result.error("字典Code格式不正确!"); return Result.error(DICT_CODE_ERROE);
} }
List<String> texts = sysDictService.queryTableDictByKeys(params[0], params[1], params[2], keys, delNotExist); List<String> texts = sysDictService.queryTableDictByKeys(params[0], params[1], params[2], keys, delNotExist);
@@ -270,7 +284,7 @@ public class SysDictController {
result.setResult(texts); result.setResult(texts);
log.info(result.toString()); log.info(result.toString());
}else { }else {
return Result.error("字典Code格式不正确!"); return Result.error(DICT_CODE_ERROE);
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(),e);
@@ -285,14 +299,15 @@ public class SysDictController {
* 根据表名——显示字段-存储字段 pid 加载树形数据 * 根据表名——显示字段-存储字段 pid 加载树形数据
*/ */
@ApiOperation(value = "字典控制器-根据表名—显示字段-存储字段 pid 加载树形数据", notes = "字典控制器-根据表名—显示字段-存储字段 pid 加载树形数据") @ApiOperation(value = "字典控制器-根据表名—显示字段-存储字段 pid 加载树形数据", notes = "字典控制器-根据表名—显示字段-存储字段 pid 加载树形数据")
@RequestMapping(value = "/loadTreeData", method = RequestMethod.GET) // @RequestMapping(value = "/loadTreeData", method = RequestMethod.GET)
@GetMapping("/loadTreeData")
public Result<List<TreeSelectModel>> loadTreeData(@RequestParam(name="pid") String pid, @RequestParam(name="pidField") String pidField, public Result<List<TreeSelectModel>> loadTreeData(@RequestParam(name="pid") String pid, @RequestParam(name="pidField") String pidField,
@RequestParam(name="tableName") String tbname, @RequestParam(name="tableName") String tbname,
@RequestParam(name="text") String text, @RequestParam(name="text") String text,
@RequestParam(name="code") String code, @RequestParam(name="code") String code,
@RequestParam(name="hasChildField", required = false) String hasChildField, @RequestParam(name="hasChildField", required = false) String hasChildField,
@RequestParam(value = "sign", required = false) String sign, HttpServletRequest request) { @RequestParam(value = "sign", required = false) String sign, HttpServletRequest request) {
Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>(); Result<List<TreeSelectModel>> result = new Result<>();
// SQL注入漏洞 sign签名校验(表名,label字段,val字段,条件) // SQL注入漏洞 sign签名校验(表名,label字段,val字段,条件)
String dictCode = tbname +","+ text +","+ code; String dictCode = tbname +","+ text +","+ code;
@@ -307,13 +322,14 @@ public class SysDictController {
* 查询后返回树型数据 * 查询后返回树型数据
*/ */
@ApiOperation(value = "字典控制器-根据表名—显示字段-存储字段 加载树形数据", notes = "字典控制器-根据表名—显示字段-存储字段 加载树形数据") @ApiOperation(value = "字典控制器-根据表名—显示字段-存储字段 加载树形数据", notes = "字典控制器-根据表名—显示字段-存储字段 加载树形数据")
@RequestMapping(value = "/queryAllTreeData", method = RequestMethod.GET) // @RequestMapping(value = "/queryAllTreeData", method = RequestMethod.GET)
@GetMapping("/queryAllTreeData")
public Result<List<TreeSelectModel>> queryAllTreeData(@RequestParam(name="pidField") String pidField, public Result<List<TreeSelectModel>> queryAllTreeData(@RequestParam(name="pidField") String pidField,
@RequestParam(name="tableName") String tbname, @RequestParam(name="tableName") String tbname,
@RequestParam(name="text") String text, @RequestParam(name="text") String text,
@RequestParam(name="code") String code, @RequestParam(name="code") String code,
HttpServletRequest request) { HttpServletRequest request) {
Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>(); Result<List<TreeSelectModel>> result = new Result<>();
// SQL注入漏洞 sign签名校验(表名,label字段,val字段,条件) // SQL注入漏洞 sign签名校验(表名,label字段,val字段,条件)
String dictCode = tbname +","+ text +","+ code; String dictCode = tbname +","+ text +","+ code;
@@ -330,7 +346,8 @@ public class SysDictController {
* @return * @return
*/ */
@ApiOperation(value = "字典控制器-新增字典", notes = "字典控制器-新增字典") @ApiOperation(value = "字典控制器-新增字典", notes = "字典控制器-新增字典")
@RequestMapping(value = "/add", method = RequestMethod.POST) // @RequestMapping(value = "/add", method = RequestMethod.POST)
@PostMapping("/add")
public Result<Object> add(@RequestBody SysDict sysDict) { public Result<Object> add(@RequestBody SysDict sysDict) {
try { try {
sysDict.setCreateTime(new Date()); sysDict.setCreateTime(new Date());
@@ -338,7 +355,7 @@ public class SysDictController {
sysDictService.save(sysDict); sysDictService.save(sysDict);
//添加成功后需要刷新缓存 //添加成功后需要刷新缓存
sysDictService.refreshCache(); sysDictService.refreshCache();
return Result.OK("操作成功!"); return Result.OK(OPTION_SUCCESS);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(),e);
return Result.error("操作失败"); return Result.error("操作失败");
@@ -351,7 +368,8 @@ public class SysDictController {
* @return * @return
*/ */
@ApiOperation(value = "字典控制器-编辑字典", notes = "字典控制器-编辑字典") @ApiOperation(value = "字典控制器-编辑字典", notes = "字典控制器-编辑字典")
@RequestMapping(value = "/edit", method = RequestMethod.PUT) // @RequestMapping(value = "/edit", method = RequestMethod.PUT)
@PutMapping("/edit")
public Result<Object> edit(@RequestBody SysDict sysDict) { public Result<Object> edit(@RequestBody SysDict sysDict) {
SysDict sysdict = sysDictService.getById(sysDict.getId()); SysDict sysdict = sysDictService.getById(sysDict.getId());
if(sysdict==null) { if(sysdict==null) {
@@ -362,7 +380,7 @@ public class SysDictController {
if(ok) { if(ok) {
//编辑成功后需要刷新缓存 //编辑成功后需要刷新缓存
sysDictService.refreshCache(); sysDictService.refreshCache();
return Result.OK("操作成功!"); return Result.OK(OPTION_SUCCESS);
} }
} }
return Result.OK(); return Result.OK();
@@ -379,7 +397,7 @@ public class SysDictController {
public Result<Object> delete(@RequestParam(name="id",required=true) String id) { public Result<Object> delete(@RequestParam(name="id",required=true) String id) {
boolean ok = sysDictService.removeById(id); boolean ok = sysDictService.removeById(id);
if(ok) { if(ok) {
return Result.OK("删除成功!"); return Result.OK(DEL_SUCCESS);
}else{ }else{
return Result.error("删除失败!"); return Result.error("删除失败!");
} }
@@ -398,7 +416,7 @@ public class SysDictController {
return Result.error("参数不识别!"); return Result.error("参数不识别!");
}else { }else {
sysDictService.removeByIds(Arrays.asList(ids.split(","))); sysDictService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("删除成功!"); return Result.OK(DEL_SUCCESS);
} }
} }
@@ -408,8 +426,8 @@ public class SysDictController {
* @return * @return
*/ */
@RequestMapping(value = "/refleshCache") @RequestMapping(value = "/refleshCache")
public Result<?> refleshCache() { public Result<SysDict> refleshCache() {
Result<?> result = new Result<SysDict>(); Result<SysDict> result = new Result<>();
sysDictService.refreshCache(); sysDictService.refreshCache();
return result; return result;
} }
@@ -425,7 +443,7 @@ public class SysDictController {
QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap()); QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap());
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SysDictPage> pageList = new ArrayList<SysDictPage>(); List<SysDictPage> pageList = new ArrayList<>();
List<SysDict> sysDictList = sysDictService.list(queryWrapper); List<SysDict> sysDictList = sysDictService.list(queryWrapper);
for (SysDict dictMain : sysDictList) { for (SysDict dictMain : sysDictList) {
@@ -438,12 +456,12 @@ public class SysDictController {
} }
// 导出文件名称 // 导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "数据字典"); mv.addObject(JeroController.FILE_NAME, "数据字典");
// 注解对象Class // 注解对象Class
mv.addObject(NormalExcelConstants.CLASS, SysDictPage.class); mv.addObject(JeroController.CLASS, SysDictPage.class);
// 自定义表格参数 // 自定义表格参数
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典")); mv.addObject(JeroController.PARAMS, new ExportParams("数据字典列表", "导出人:"+user.getRealname(), "数据字典"));
// 导出数据列表 // 导出数据列表
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
@@ -451,7 +469,7 @@ public class SysDictController {
@PostMapping(value = "/importExcel") @PostMapping(value = "/importExcel")
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<T> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
@@ -469,7 +487,8 @@ public class SysDictController {
List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params); List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params);
// 错误信息 // 错误信息
List<String> errorMessage = new ArrayList<>(); List<String> errorMessage = new ArrayList<>();
int successLines = 0, errorLines = 0; int successLines = 0;
int errorLines = 0;
for (int i=0;i< list.size();i++) { for (int i=0;i< list.size();i++) {
SysDict po = new SysDict(); SysDict po = new SysDict();
BeanUtils.copyProperties(list.get(i), po); BeanUtils.copyProperties(list.get(i), po);
@@ -521,10 +540,10 @@ public class SysDictController {
* @return * @return
*/ */
@DeleteMapping(value = "/deletePhysic/{id}") @DeleteMapping(value = "/deletePhysic/{id}")
public Result<?> deletePhysic(@PathVariable String id) { public Result<T> deletePhysic(@PathVariable String id) {
try { try {
sysDictService.deleteOneDictPhysically(id); sysDictService.deleteOneDictPhysically(id);
return Result.OK("删除成功!"); return Result.OK(DEL_SUCCESS);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return Result.error("删除失败!"); return Result.error("删除失败!");
@@ -537,10 +556,10 @@ public class SysDictController {
* @return * @return
*/ */
@PutMapping(value = "/back/{id}") @PutMapping(value = "/back/{id}")
public Result<?> back(@PathVariable String id) { public Result<T> back(@PathVariable String id) {
try { try {
sysDictService.updateDictDelFlag(0,id); sysDictService.updateDictDelFlag(0,id);
return Result.OK("操作成功!"); return Result.OK(OPTION_SUCCESS);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return Result.error("操作失败!"); return Result.error("操作失败!");
+68 -68
View File
@@ -23,89 +23,89 @@
</template> </template>
<script> <script>
export default { export default {
name: "ChartCard", name: 'ChartCard',
props: { props: {
title: { title: {
type: String, type: String,
default: '' default: ''
}, },
total: { total: {
type: String, type: String,
default: '' default: ''
}, },
loading: { loading: {
type: Boolean, type: Boolean,
default: false default: false
}
} }
} }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chart-card-header { .chart-card-header {
position: relative;
overflow: hidden;
width: 100%;
.meta {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
width: 100%; width: 100%;
color: rgba(0, 0, 0, .45);
.meta { font-size: 14px;
position: relative; line-height: 22px;
overflow: hidden;
width: 100%;
color: rgba(0, 0, 0, .45);
font-size: 14px;
line-height: 22px;
}
} }
}
.chart-card-action { .chart-card-action {
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
} }
.chart-card-footer { .chart-card-footer {
border-top: 1px solid #e8e8e8; border-top: 1px solid #e8e8e8;
padding-top: 9px; padding-top: 9px;
margin-top: 8px; margin-top: 8px;
> * { > * {
position: relative;
}
.field {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin: 0;
}
}
.chart-card-content {
margin-bottom: 12px;
position: relative; position: relative;
height: 46px;
width: 100%;
.content-fix {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
}
} }
.total { .field {
white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
word-break: break-all; margin: 0;
white-space: nowrap;
color: #000;
margin-top: 4px;
margin-bottom: 0;
font-size: 30px;
line-height: 38px;
height: 38px;
} }
</style> }
.chart-card-content {
margin-bottom: 12px;
position: relative;
height: 46px;
width: 100%;
.content-fix {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
}
}
.total {
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
white-space: nowrap;
color: #000;
margin-top: 4px;
margin-bottom: 0;
font-size: 30px;
line-height: 38px;
height: 38px;
}
</style>
@@ -1,45 +1,49 @@
<template> <template>
<div> <div>
<template v-if="hasFile" v-for="(file, fileKey) of [innerFile || {}]"> <template v-if="hasFile">
<div :key="fileKey" style="position: relative;">
<a-tooltip v-if="file.status==='uploading'" :title="`上传中(${Math.floor(file.percent)}%)`">
<a-icon type="loading"/>
<span style="margin-left:5px">上传中</span>
</a-tooltip>
<a-tooltip v-else-if="file.status==='done'" :title="file.name"> <template v-for="(file, fileKey) of [innerFile || {}]">
<a-icon type="paper-clip"/> <div :key="fileKey" style="position: relative;">
<span style="margin-left:5px">{{ ellipsisFileName }}</span> <a-tooltip v-if="file.status==='uploading'" :title="`上传中(${Math.floor(file.percent)}%)`">
</a-tooltip> <a-icon type="loading"/>
<span style="margin-left:5px">上传中</span>
</a-tooltip>
<a-tooltip v-else :title="file.message||'上传失败'"> <a-tooltip v-else-if="file.status==='done'" :title="file.name">
<a-icon type="exclamation-circle" style="color:red;"/> <a-icon type="paper-clip"/>
<span style="margin-left:5px">{{ ellipsisFileName }}</span> <span style="margin-left:5px">{{ ellipsisFileName }}</span>
</a-tooltip> </a-tooltip>
<template style="width: 30px"> <a-tooltip v-else :title="file.message||'上传失败'">
<a-dropdown :trigger="['click']" placement="bottomRight" style="margin-left: 10px;"> <a-icon type="exclamation-circle" style="color:red;"/>
<a-tooltip title="操作"> <span style="margin-left:5px">{{ ellipsisFileName }}</span>
<a-icon </a-tooltip>
v-if="file.status!=='uploading'"
type="setting" <template style="width: 30px">
style="cursor: pointer;"/> <a-dropdown :trigger="['click']" placement="bottomRight" style="margin-left: 10px;">
</a-tooltip> <a-tooltip title="操作">
<a-icon
v-if="file.status!=='uploading'"
type="setting"
style="cursor: pointer;"/>
</a-tooltip>
<a-menu slot="overlay">
<a-menu-item v-if="originColumn.allowDownload !== false" @click="handleClickDownloadFile">
<span><a-icon type="download"/>&nbsp;下载</span>
</a-menu-item>
<a-menu-item v-if="originColumn.allowRemove !== false" @click="handleClickDeleteFile">
<span><a-icon type="delete"/>&nbsp;删除</span>
</a-menu-item>
<a-menu-item @click="handleMoreOperation(originColumn)">
<span><a-icon type="bars"/> 更多</span>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</div>
</template>
<a-menu slot="overlay">
<a-menu-item v-if="originColumn.allowDownload !== false" @click="handleClickDownloadFile">
<span><a-icon type="download"/>&nbsp;下载</span>
</a-menu-item>
<a-menu-item v-if="originColumn.allowRemove !== false" @click="handleClickDeleteFile">
<span><a-icon type="delete"/>&nbsp;删除</span>
</a-menu-item>
<a-menu-item @click="handleMoreOperation(originColumn)">
<span><a-icon type="bars"/> 更多</span>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</div>
</template> </template>
<a-upload <a-upload
@@ -166,7 +170,7 @@ export default {
}, },
handleChangeUpload (info) { handleChangeUpload (info) {
const { originColumn: col } = this // const { originColumn: col } = this
const { file } = info const { file } = info
const value = { const value = {
name: file.name, name: file.name,
@@ -1,44 +1,47 @@
<template> <template>
<div> <div>
<template v-if="hasFile" v-for="(file, fileKey) of [innerFile || {}]"> <template v-if="hasFile">
<div :key="fileKey" style="position: relative;"> <template v-for="(file, fileKey) of [innerFile || {}]">
<template v-if="!file || !(file['url'] || file['path'] || file['message'])"> <div :key="fileKey" style="position: relative;">
<a-tooltip :title="'请稍后: ' + JSON.stringify (file) + ((file['url'] || file['path'] || file['message']))"> <template v-if="!file || !(file['url'] || file['path'] || file['message'])">
<a-icon type="loading"/> <a-tooltip :title="'请稍后: ' + JSON.stringify (file) + ((file['url'] || file['path'] || file['message']))">
</a-tooltip> <a-icon type="loading"/>
</template>
<template v-else-if="file['path']">
<img class="j-editable-image" :src="imgSrc" alt="无图片" @click="handleMoreOperation"/>
</template>
<a-tooltip v-else :title="file.message||'上传失败'" @click="handleClickShowImageError">
<a-icon type="exclamation-circle" style="color:red;"/>
</a-tooltip>
<template style="width: 30px">
<a-dropdown :trigger="['click']" placement="bottomRight" style="margin-left: 10px;">
<a-tooltip title="操作">
<a-icon
v-if="file.status!=='uploading'"
type="setting"
style="cursor: pointer;"/>
</a-tooltip> </a-tooltip>
</template>
<template v-else-if="file['path']">
<img class="j-editable-image" :src="imgSrc" alt="无图片" @click="handleMoreOperation"/>
</template>
<a-tooltip v-else :title="file.message||'上传失败'" @click="handleClickShowImageError">
<a-icon type="exclamation-circle" style="color:red;"/>
</a-tooltip>
<a-menu slot="overlay"> <template style="width: 30px">
<a-menu-item v-if="originColumn.allowDownload !== false" @click="handleClickDownloadFile"> <a-dropdown :trigger="['click']" placement="bottomRight" style="margin-left: 10px;">
<span><a-icon type="download"/>&nbsp;下载</span> <a-tooltip title="操作">
</a-menu-item> <a-icon
<a-menu-item v-if="originColumn.allowRemove !== false" @click="handleClickDeleteFile"> v-if="file.status!=='uploading'"
<span><a-icon type="delete"/>&nbsp;删除</span> type="setting"
</a-menu-item> style="cursor: pointer;"/>
<a-menu-item @click="handleMoreOperation(originColumn)"> </a-tooltip>
<span><a-icon type="bars"/> 更多</span>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</div> <a-menu slot="overlay">
<a-menu-item v-if="originColumn.allowDownload !== false" @click="handleClickDownloadFile">
<span><a-icon type="download"/>&nbsp;下载</span>
</a-menu-item>
<a-menu-item v-if="originColumn.allowRemove !== false" @click="handleClickDeleteFile">
<span><a-icon type="delete"/>&nbsp;删除</span>
</a-menu-item>
<a-menu-item @click="handleMoreOperation(originColumn)">
<span><a-icon type="bars"/> 更多</span>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</div>
</template>
</template> </template>
<a-upload <a-upload
v-show="!hasFile" v-show="!hasFile"
name="file" name="file"
@@ -172,7 +175,7 @@ export default {
}, },
handleChangeUpload (info) { handleChangeUpload (info) {
const { originColumn: col } = this // const { originColumn: col } = this
const { file } = info const { file } = info
const value = { const value = {
name: file.name, name: file.name,
@@ -1,7 +1,7 @@
import { getVmParentByName } from '@/utils/util' import { getVmParentByName } from '@/utils/util'
import { JVXETypes } from '@comp/jero/JVxeTable' import { JVXETypes } from '@comp/jero/JVxeTable'
export const VALIDATE_FAILED = Symbol() export const VALIDATE_FAILED = Symbol('')
/** /**
* 获取指定的 $refs 对象 * 获取指定的 $refs 对象
@@ -69,6 +69,7 @@ import { cloneDeep } from 'lodash'
export default { export default {
name: 'JSelectBizComponentModal', name: 'JSelectBizComponentModal',
mixins: [JeroListMixin], mixins: [JeroListMixin],
// eslint-disable-next-line vue/no-unused-components
components: { Ellipsis, JSelectBizQueryItem }, components: { Ellipsis, JSelectBizQueryItem },
props: { props: {
value: { value: {
@@ -284,7 +285,7 @@ export default {
} }
if (!notExist) return if (!notExist) return
getAction(this.valueUrl || this.listUrl, { getAction(this.valueUrl || this.listUrl, {
// 这里最后加一个 , 的原因是因为无论如何都要使用 in 查询,防止后台进行了模糊匹配,导致查询结果不准确 // 这里最后加一个 , 的原因是无论如何都要使用 in 查询,防止后台进行了模糊匹配,导致查询结果不准确
[this.valueKey]: value.join(',') + ',', [this.valueKey]: value.join(',') + ',',
pageNo: 1, pageNo: 1,
pageSize: value.length pageSize: value.length
@@ -308,7 +309,10 @@ export default {
const key = data[this.valueKey] const key = data[this.valueKey]
this.dataSourceMap[key] = data this.dataSourceMap[key] = data
pushIfNotExist(this.options, { label: data[this.displayKey || this.valueKey], value: key }, 'value') pushIfNotExist(this.options, { label: data[this.displayKey || this.valueKey], value: key }, 'value')
typeof callback === 'function' ? callback(data) : '' // typeof callback === 'function' ? callback(data) : ''
if (typeof callback === 'function') {
callback(data)
}
}) })
this.$emit('options', this.options, this.dataSourceMap) this.$emit('options', this.options, this.dataSourceMap)
}, },
@@ -320,7 +324,7 @@ export default {
this.close() this.close()
}, },
/** 删除已选择的 */ /** 删除已选择的 */
handleDeleteSelected (record, index) { handleDeleteSelected (record/* , index */) {
this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(record[this.rowKey]), 1) this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(record[this.rowKey]), 1)
// update--begin--autor:wangshuai-----date:20200722------forJSelectBizComponent组件切换页数值问题------ // update--begin--autor:wangshuai-----date:20200722------forJSelectBizComponent组件切换页数值问题------
this.selectedTable.dataSource.splice(this.selectedTable.dataSource.indexOf(record), 1) this.selectedTable.dataSource.splice(this.selectedTable.dataSource.indexOf(record), 1)
@@ -16,6 +16,7 @@ import JSelectBizComponent from './JSelectBizComponent'
export default { export default {
name: 'JSelectMultiUser', name: 'JSelectMultiUser',
// eslint-disable-next-line vue/no-unused-components
components: { JDate, JSelectBizComponent }, components: { JDate, JSelectBizComponent },
props: { props: {
value: null, // any type value: null, // any type
@@ -13,7 +13,7 @@
<a-spin tip="Loading..." :spinning="false"> <a-spin tip="Loading..." :spinning="false">
<a-input-search style="margin-bottom: 1px" placeholder="请输入部门名称按回车进行搜索" @search="onSearch" /> <a-input-search style="margin-bottom: 1px" placeholder="请输入部门名称按回车进行搜索" @search="onSearch" />
<a-tree <a-tree
checkable :checkable="true"
:class="treeScreenClass" :class="treeScreenClass"
:treeData="treeData" :treeData="treeData"
:checkStrictly="checkStrictly" :checkStrictly="checkStrictly"
@@ -117,7 +117,7 @@ export default {
initDepartComponent (flag) { initDepartComponent (flag) {
const arr = [] const arr = []
// 该方法两个地方用 1.visible改变事件重新设置选中项 2.组件编辑页面回显 // 该方法两个地方用 1.visible改变事件重新设置选中项 2.组件编辑页面回显
const fieldName = flag == true ? 'key' : this.text const fieldName = flag === true ? 'key' : this.text
if (this.departId) { if (this.departId) {
const arr2 = this.departId.split(',') const arr2 = this.departId.split(',')
for (const item of this.dataList) { for (const item of this.dataList) {
@@ -126,7 +126,7 @@ export default {
} }
} }
} }
if (flag == true) { if (flag === true) {
this.checkedKeys = [...arr] this.checkedKeys = [...arr]
} else { } else {
this.$emit('initComp', arr.join(',')) this.$emit('initComp', arr.join(','))
@@ -196,7 +196,7 @@ export default {
this.autoExpandParent = false this.autoExpandParent = false
}, },
handleSubmit () { handleSubmit () {
if (!this.checkedKeys || this.checkedKeys.length == 0) { if (!this.checkedKeys || this.checkedKeys.length === 0) {
this.$emit('ok', '') this.$emit('ok', '')
} else { } else {
const checkRow = this.getCheckedRows(this.checkedKeys) const checkRow = this.getCheckedRows(this.checkedKeys)
@@ -267,9 +267,9 @@ export default {
return rows return rows
}, },
switchCheckStrictly (v) { switchCheckStrictly (v) {
if (v == 1) { if (v === 1) {
this.checkStrictly = false this.checkStrictly = false
} else if (v == 2) { } else if (v === 2) {
this.checkStrictly = true this.checkStrictly = true
} }
}, },
@@ -63,7 +63,7 @@
<script> <script>
import { filterObj } from '@/utils/util' import { filterObj } from '@/utils/util'
import { queryDepartTreeList, getUserList, queryUserByDepId, queryDepartTreeSync } from '@/api/api' import { getUserList, queryUserByDepId, queryDepartTreeSync } from '@/api/api'
import { getAction } from '@/api/manage' import { getAction } from '@/api/manage'
export default { export default {
@@ -135,7 +135,7 @@ export default {
computed: { computed: {
// 计算属性的 getter // 计算属性的 getter
getType: function () { getType: function () {
return this.multi == true ? 'checkbox' : 'radio' return this.multi === true ? 'checkbox' : 'radio'
} }
}, },
watch: { watch: {
@@ -154,7 +154,7 @@ export default {
methods: { methods: {
initUserNames () { initUserNames () {
if (this.userIds) { if (this.userIds) {
// 这里最后加一个 , 的原因是因为无论如何都要使用 in 查询,防止后台进行了模糊匹配,导致查询结果不准确 // 这里最后加一个 , 的原因是无论如何都要使用 in 查询,防止后台进行了模糊匹配,导致查询结果不准确
const values = this.userIds.split(',') + ',' const values = this.userIds.split(',') + ','
const param = { [this.store]: values } const param = { [this.store]: values }
getAction('/sys/user/getMultiUser', param).then((list) => { getAction('/sys/user/getMultiUser', param).then((list) => {
@@ -258,7 +258,7 @@ export default {
that.close() that.close()
}, },
// 获取选择用户信息 // 获取选择用户信息
getSelectUserRows (rowId) { getSelectUserRows (/* rowId */) {
const dataSource = this.dataSource const dataSource = this.dataSource
let userIds = '' let userIds = ''
this.selectUserRows = [] this.selectUserRows = []
@@ -316,7 +316,7 @@ export default {
queryDepartTreeSync({ pid: treeNode.dataRef.id }).then((res) => { queryDepartTreeSync({ pid: treeNode.dataRef.id }).then((res) => {
if (res.success) { if (res.success) {
// 判断chidlren是否为空,并修改isLeaf属性值 // 判断chidlren是否为空,并修改isLeaf属性值
if (res.result.length == 0) { if (res.result.length === 0) {
treeNode.dataRef.isLeaf = true treeNode.dataRef.isLeaf = true
} else { } else {
treeNode.dataRef.children = res.result treeNode.dataRef.children = res.result
@@ -97,7 +97,7 @@ export default {
} else { } else {
selectedRowKeys = [] selectedRowKeys = []
} }
return new Promise((resolve, reject) => { return new Promise((resolve/* , reject */) => {
const model = this.$confirm({ const model = this.$confirm({
title: '同步', title: '同步',
content, content,
@@ -202,7 +202,7 @@ export async function loadEnabledTypes () {
enabledTypes = cloneObject(result) enabledTypes = cloneObject(result)
return result return result
} else { } else {
console.warn('getEnabledType查询失败', res) console.warn('getEnabledType查询失败', result)
} }
} }
return {} return {}
@@ -5,8 +5,8 @@
</template> </template>
<script> <script>
import PageLayout from '../page/PageLayout' // import PageLayout from '../page/PageLayout'
import RouteView from './RouteView' // import RouteView from './RouteView'
export default { export default {
name: 'IframePageContent', name: 'IframePageContent',
@@ -23,15 +23,14 @@ export default {
this.goUrl() this.goUrl()
}, },
watch: { watch: {
$route (to, from) { $route (/* to, from */) {
this.goUrl() this.goUrl()
} }
}, },
methods: { methods: {
goUrl () { goUrl () {
const url = this.$route.meta.url const url = this.$route.meta.url
const id = this.$route.path this.id = this.$route.path
this.id = id
// url = "http://www.baidu.com" // url = "http://www.baidu.com"
console.log('------url------' + url) console.log('------url------' + url)
if (url !== null && url !== undefined) { if (url !== null && url !== undefined) {
@@ -7,8 +7,8 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import PageLayout from '../page/PageLayout' // import PageLayout from '../page/PageLayout'
import RouteView from './RouteView' // import RouteView from './RouteView'
export default { export default {
name: 'IframePageContent', name: 'IframePageContent',
@@ -26,22 +26,22 @@ export default {
this.goUrl() this.goUrl()
}, },
watch: { watch: {
$route (to, from) { $route (/* to, from */) {
this.goUrl() this.goUrl()
} }
}, },
methods: { methods: {
goUrl () { goUrl () {
const url = this.$route.meta.url const url = this.$route.meta.url
const id = this.$route.path this.id = this.$route.path
this.id = id
// url = "http://www.baidu.com" // url = "http://www.baidu.com"
console.log('------url------' + url) console.log('------url------' + url)
if (url !== null && url !== undefined) { if (url !== null && url !== undefined) {
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
// url支持通过 ${token}方式传递当前登录TOKEN // url支持通过 ${token}方式传递当前登录TOKEN
// eslint-disable-next-line no-template-curly-in-string
const tokenStr = '${token}' const tokenStr = '${token}'
if (url.indexOf(tokenStr) != -1) { if (url.indexOf(tokenStr) !== -1) {
const token = Vue.ls.get(ACCESS_TOKEN) const token = Vue.ls.get(ACCESS_TOKEN)
this.url = url.replace(tokenStr, token) this.url = url.replace(tokenStr, token)
} else { } else {
@@ -50,7 +50,7 @@ export default {
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
/* update_begin author:wuxianquan date:20190908 for:判断打开方式,新窗口打开时this.$route.meta.internalOrExternal==true */ /* update_begin author:wuxianquan date:20190908 for:判断打开方式,新窗口打开时this.$route.meta.internalOrExternal==true */
if (this.$route.meta.internalOrExternal != undefined && this.$route.meta.internalOrExternal == true) { if (this.$route.meta.internalOrExternal !== undefined && this.$route.meta.internalOrExternal === true) {
this.closeCurrent() this.closeCurrent()
window.open(this.url) window.open(this.url)
} }
+2 -2
View File
@@ -1,7 +1,7 @@
<template> <template>
<page-layout :desc="description" :title="getTitle" :link-list="linkList" :search="search" :tabs="tabs"> <page-layout :desc="description" :title="getTitle" :link-list="linkList" :search="search" :tabs="tabs">
<div slot="extra" class="extra-img"> <div slot="extra" class="extra-img">
<img :src="extraImage"/> <img :src="extraImage" alt=""/>
</div> </div>
<!-- keep-alive --> <!-- keep-alive -->
<route-view ref="content"></route-view> <route-view ref="content"></route-view>
@@ -52,7 +52,7 @@ export default {
this.description = content.description this.description = content.description
this.linkList = content.linkList this.linkList = content.linkList
this.extraImage = content.extraImage this.extraImage = content.extraImage
this.search = content.search == true this.search = content.search === true
this.tabs = content.tabs this.tabs = content.tabs
} }
} }
@@ -98,7 +98,7 @@ export default {
this.linkList = [newRoute.fullPath] this.linkList = [newRoute.fullPath]
this.pageList = [Object.assign({}, newRoute)] this.pageList = [Object.assign({}, newRoute)]
// update-begin-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存 // update-begin-author:taoyan date:20200211 for: TASK #3368 【路由缓存】首页的缓存设置有问题,需要根据后台的路由配置来实现是否缓存
} else if (indexKey == newRoute.fullPath) { } else if (indexKey === newRoute.fullPath) {
// 首页时 判断是否缓存 没有缓存 刷新之 // 首页时 判断是否缓存 没有缓存 刷新之
if (newRoute.meta.keepAlive === false) { if (newRoute.meta.keepAlive === false) {
this.routeReload() this.routeReload()
@@ -171,7 +171,7 @@ export default {
return return
} }
console.log('this.pageList ', this.pageList) console.log('this.pageList ', this.pageList)
const removeRoute = this.pageList.filter(item => item.fullPath == key) const removeRoute = this.pageList.filter(item => (item.fullPath + '') === (key + ''))
this.pageList = this.pageList.filter(item => item.fullPath !== key) this.pageList = this.pageList.filter(item => item.fullPath !== key)
let index = this.linkList.indexOf(key) let index = this.linkList.indexOf(key)
this.linkList = this.linkList.filter(item => item !== key) this.linkList = this.linkList.filter(item => item !== key)
@@ -234,7 +234,7 @@ export default {
/* update_end author:wuxianquan date:20190828 for: 关闭当前tab页,供子页面调用->望菜单能配置外链,直接弹出新页面而不是嵌入iframe #428 */ /* update_end author:wuxianquan date:20190828 for: 关闭当前tab页,供子页面调用->望菜单能配置外链,直接弹出新页面而不是嵌入iframe #428 */
closeOthers (pageKey) { closeOthers (pageKey) {
const index = this.linkList.indexOf(pageKey) const index = this.linkList.indexOf(pageKey)
if (pageKey == indexKey || pageKey.indexOf('?ticke=') >= 0) { if ((pageKey + '') === (indexKey + '') || pageKey.indexOf('?ticke=') >= 0) {
this.linkList = this.linkList.slice(index, index + 1) this.linkList = this.linkList.slice(index, index + 1)
this.pageList = this.pageList.slice(index, index + 1) this.pageList = this.pageList.slice(index, index + 1)
this.activePage = this.linkList[0] this.activePage = this.linkList[0]
@@ -245,10 +245,10 @@ export default {
} }
}, },
closeLeft (pageKey) { closeLeft (pageKey) {
if (pageKey == indexKey) { if ((pageKey + '') === (indexKey + '')) {
return return
} }
const tempList = [...this.pageList] // const tempList = [...this.pageList]
const index = this.linkList.indexOf(pageKey) const index = this.linkList.indexOf(pageKey)
this.linkList = this.linkList.slice(index) this.linkList = this.linkList.slice(index)
this.pageList = this.pageList.slice(index) this.pageList = this.pageList.slice(index)
+10 -10
View File
@@ -53,27 +53,27 @@ export default {
} }
// 判断当前设备 // 判断当前设备
function isMobile () { function isMobile () {
var userAgentInfo = navigator.userAgent const userAgentInfo = navigator.userAgent
var mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'] const mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
var mobile_flag = false let mobileFlag = false
// 根据userAgent判断是否是手机 // 根据userAgent判断是否是手机
for (var v = 0; v < mobileAgents.length; v++) { for (let v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) { if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true mobileFlag = true
break break
} }
} }
var screen_width = window.screen.width const screenWidth = window.screen.width
var screen_height = window.screen.height const screenHeight = window.screen.height
// 根据屏幕分辨率判断是否是手机 // 根据屏幕分辨率判断是否是手机
if (screen_width < 500 && screen_height < 800) { if (screenWidth < 500 && screenHeight < 800) {
mobile_flag = true mobileFlag = true
} }
return mobile_flag return mobileFlag
} }
</script> </script>
<style lang="less" > <style lang="less" >
+3 -3
View File
@@ -58,9 +58,9 @@ import {
Slider, Slider,
Transfer, Transfer,
Rate, Rate,
Collapse, Collapse
} from 'ant-design-vue' } from 'ant-design-vue'
import Viser from 'viser-vue' // import Viser from 'viser-vue'
Vue.use(ConfigProvider) Vue.use(ConfigProvider)
Vue.use(Layout) Vue.use(Layout)
@@ -123,4 +123,4 @@ Vue.prototype.$success = Modal.success
Vue.prototype.$error = Modal.error Vue.prototype.$error = Modal.error
Vue.prototype.$warning = Modal.warning Vue.prototype.$warning = Modal.warning
process.env.NODE_ENV !== 'production' && console.warn('[jero-boot-vue] NOTICE: Antd use lazy-load.') process.env.NODE_ENV !== 'production' && console.warn('[jero-boot-vue] NOTICE: Antd use lazy-load.')
@@ -56,7 +56,7 @@
} }
.jeecg-mask-cust[data-v-7750c39d] { .jeecg-mask-cust[data-v-7750c39d] {
height: 0%; height: 0;
width: 100%; width: 100%;
opacity: .3; opacity: .3;
position: absolute; position: absolute;
@@ -367,7 +367,7 @@ th[data-v-125d8be6] {
} }
.jeecg-mask-cust[data-v-4070e3c9] { .jeecg-mask-cust[data-v-4070e3c9] {
height: 0%; height: 0;
width: 100%; width: 100%;
opacity: .3; opacity: .3;
position: absolute; position: absolute;
@@ -466,18 +466,29 @@ th[data-v-125d8be6] {
border-radius: 4px 0 0 4px border-radius: 4px 0 0 4px
} }
.j-table-force-nowrap { /*.j-table-force-nowrap {*/
td, th { /* td, th {*/
white-space: nowrap /* white-space: nowrap*/
} /* }*/
.ant-table-selection-column { /* .ant-table-selection-column {*/
padding: 12px 22px !important /* padding: 12px 22px !important*/
} /* }*/
&.ant-table-wrapper .ant-table-content { /* &.ant-table-wrapper .ant-table-content {*/
overflow-x: auto /* overflow-x: auto*/
} /* }*/
/*}*/
.j-table-force-nowrap td,
.j-table-force-nowrap th {
white-space: nowrap;
}
.j-table-force-nowrap .ant-table-selection-column {
padding: 12px 22px !important;
}
.j-table-force-nowrap.ant-table-wrapper .ant-table-content {
overflow-x: auto;
} }
.ant-card-body .table-operator[data-v-67102101] { .ant-card-body .table-operator[data-v-67102101] {
@@ -664,7 +675,7 @@ th[data-v-125d8be6] {
} }
.jeecg-mask-cust[data-v-22098770] { .jeecg-mask-cust[data-v-22098770] {
height: 0%; height: 0;
width: 100%; width: 100%;
opacity: .3; opacity: .3;
position: absolute; position: absolute;
+10 -10
View File
@@ -1,5 +1,6 @@
import T from 'ant-design-vue/es/table/Table' import T from 'ant-design-vue/es/table/Table'
import get from 'lodash.get' import get from 'lodash.get'
export default { export default {
data () { data () {
return { return {
@@ -84,12 +85,10 @@ export default {
}, },
loadData (pagination, filters, sorter) { loadData (pagination, filters, sorter) {
this.localLoading = true this.localLoading = true
var result = this.data( const result = this.data(
Object.assign({ Object.assign({
pageNo: (pagination && pagination.current) || pageNo: (pagination && pagination.current) || this.localPagination.current,
this.localPagination.current, pageSize: (pagination && pagination.pageSize) || this.localPagination.pageSize
pageSize: (pagination && pagination.pageSize) ||
this.localPagination.pageSize
}, },
(sorter && sorter.field && { (sorter && sorter.field && {
sortField: sorter.field sortField: sorter.field
@@ -98,8 +97,7 @@ export default {
sortOrder: sorter.order sortOrder: sorter.order
}) || {}, { }) || {}, {
...filters ...filters
} })
)
) )
if (result instanceof Promise) { if (result instanceof Promise) {
@@ -112,7 +110,7 @@ export default {
this.localPagination.pageSize this.localPagination.pageSize
}); });
// update--begin--autor:wangshuai-----date:20200724------for:判断showPagination是否为false------ // update--begin--autor:wangshuai-----date:20200724------for:判断showPagination是否为false------
(!this.showPagination || !r.totalCount && this.showPagination === 'auto') && (this.localPagination = false) ((!this.showPagination || !r.totalCount) && this.showPagination === 'auto') && (this.localPagination = false)
// update--end--autor:wangshuai-----date:20200724------for:判断showPagination是否为false----- // update--end--autor:wangshuai-----date:20200724------for:判断showPagination是否为false-----
this.localDataSource = r.data // 返回结果中的数组数据 this.localDataSource = r.data // 返回结果中的数组数据
this.localLoading = false this.localLoading = false
@@ -217,9 +215,11 @@ export default {
Object.keys(T.props).forEach(k => { Object.keys(T.props).forEach(k => {
const localKey = `local${k.substring(0, 1).toUpperCase()}${k.substring(1)}` const localKey = `local${k.substring(0, 1).toUpperCase()}${k.substring(1)}`
if (localKeys.includes(localKey)) { if (localKeys.includes(localKey)) {
return props[k] = _vm[localKey] const tempItem = props[k] = _vm[localKey]
return tempItem
} }
return props[k] = _vm[k] const tempItemA = props[k] = _vm[k]
return tempItemA
}) })
// 显示信息提示 // 显示信息提示
+1 -1
View File
@@ -1,7 +1,7 @@
<template> <template>
<a-breadcrumb class="breadcrumb"> <a-breadcrumb class="breadcrumb">
<a-breadcrumb-item v-for="(item, index) in breadList" :key="index"> <a-breadcrumb-item v-for="(item, index) in breadList" :key="index">
<router-link v-if="item.name != name" :to="{ path: item.path }"> <router-link v-if="item.name + '' !== name + ''" :to="{ path: item.path }">
{{ item.meta.title }} {{ item.meta.title }}
</router-link> </router-link>
<span v-else>{{ item.meta.title }}</span> <span v-else>{{ item.meta.title }}</span>
@@ -20,9 +20,9 @@
<template slot="title"> <template slot="title">
<span>您隶属于多部门请选择当前所在部门</span> <span>您隶属于多部门请选择当前所在部门</span>
</template> </template>
<a-avatar style="backgroundColor:#87d068" icon="gold" /> <a-avatar style="background-color:#87d068" icon="gold" />
</a-tooltip> </a-tooltip>
<a-select v-model="departSelected" :class="{'valid-error':validate_status=='error'}" placeholder="请选择登录部门" style="margin-left:10px;width: 80%"> <a-select v-model="departSelected" :class="{'valid-error':validate_status + '' === 'error' + ''}" placeholder="请选择登录部门" style="margin-left:10px;width: 80%">
<a-icon slot="suffixIcon" type="gold" /> <a-icon slot="suffixIcon" type="gold" />
<a-select-option <a-select-option
v-for="d in departList" v-for="d in departList"
@@ -94,7 +94,7 @@ export default {
const orgCode = res.result.orgCode const orgCode = res.result.orgCode
if (departs && departs.length > 0) { if (departs && departs.length > 0) {
for (const i of departs) { for (const i of departs) {
if (i.orgCode == orgCode) { if (i.orgCode + '' === orgCode + '') {
this.currDepartName = i.departName this.currDepartName = i.departName
break break
} }
+1 -3
View File
@@ -44,9 +44,7 @@ const responsive = {
export default { export default {
name: 'DetailList', name: 'DetailList',
Item: Item, Item: Item,
components: { components: { Col },
Col
},
props: { props: {
title: { title: {
type: String, type: String,
+15 -15
View File
@@ -32,7 +32,7 @@
<a-list-item :key="index" v-for="(record, index) in announcement1"> <a-list-item :key="index" v-for="(record, index) in announcement1">
<div style="margin-left: 5%;width: 80%"> <div style="margin-left: 5%;width: 80%">
<p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p> <p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p>
<p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTime }} 发布</p> <p style="color: rgba(0,0,0,.45);margin-bottom: 0">{{ record.createTime }} 发布</p>
</div> </div>
<div style="text-align: right"> <div style="text-align: right">
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag> <a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
@@ -50,7 +50,7 @@
<a-list-item :key="index" v-for="(record, index) in announcement2"> <a-list-item :key="index" v-for="(record, index) in announcement2">
<div style="margin-left: 5%;width: 80%"> <div style="margin-left: 5%;width: 80%">
<p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p> <p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p>
<p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTime }} 发布</p> <p style="color: rgba(0,0,0,.45);margin-bottom: 0">{{ record.createTime }} 发布</p>
</div> </div>
<div style="text-align: right"> <div style="text-align: right">
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag> <a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
@@ -130,7 +130,7 @@ export default {
this.stopTimer = false this.stopTimer = false
const myTimer = setInterval(() => { const myTimer = setInterval(() => {
// 停止定时器 // 停止定时器
if (this.stopTimer == true) { if (this.stopTimer === true) {
clearInterval(myTimer) clearInterval(myTimer)
return return
} }
@@ -197,8 +197,8 @@ export default {
initWebSocket: function () { initWebSocket: function () {
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
var userId = store.getters.userInfo.id const userId = store.getters.userInfo.id
var url = window._CONFIG.domianWebSocketURL.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId const url = window._CONFIG.domianWebSocketURL.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId
// console.log(url); // console.log(url);
this.websock = new WebSocket(url) this.websock = new WebSocket(url)
this.websock.onopen = this.websocketOnopen this.websock.onopen = this.websocketOnopen
@@ -211,17 +211,17 @@ export default {
// 心跳检测重置 // 心跳检测重置
// this.heartCheck.reset().start(); // this.heartCheck.reset().start();
}, },
websocketOnerror: function (e) { websocketOnerror: function () {
console.log('WebSocket连接发生错误') console.log('WebSocket连接发生错误')
this.reconnect() this.reconnect()
}, },
websocketOnmessage: function (e) { websocketOnmessage: function (e) {
console.log('-----接收消息-------', e.data) console.log('-----接收消息-------', e.data)
var data = eval('(' + e.data + ')') // 解析对象 const data = eval('(' + e.data + ')') // 解析对象
if (data.cmd == 'topic') { if (data.cmd + '' === 'topic') {
// 系统通知 // 系统通知
this.loadData() this.loadData()
} else if (data.cmd == 'user') { } else if (data.cmd + '' === 'user') {
// 用户消息 // 用户消息
this.loadData() this.loadData()
} }
@@ -244,7 +244,7 @@ export default {
}, },
openNotification (data) { openNotification (data) {
var text = data.msgTxt const text = data.msgTxt
const key = `open${Date.now()}` const key = `open${Date.now()}`
this.$notification.open({ this.$notification.open({
message: '消息提醒', message: '消息提醒',
@@ -266,7 +266,7 @@ export default {
}, },
reconnect () { reconnect () {
var that = this const that = this
if (that.lockReconnect) return if (that.lockReconnect) return
that.lockReconnect = true that.lockReconnect = true
// 没连接上会一直重连,设置延迟避免请求过多 // 没连接上会一直重连,设置延迟避免请求过多
@@ -277,7 +277,7 @@ export default {
}, 5000) }, 5000)
}, },
heartCheckFun () { heartCheckFun () {
var that = this const that = this
// 心跳检测,每20s心跳一次 // 心跳检测,每20s心跳一次
that.heartCheck = { that.heartCheck = {
timeout: 20000, timeout: 20000,
@@ -289,7 +289,7 @@ export default {
return this return this
}, },
start: function () { start: function () {
var self = this // const self = this
this.timeoutObj = setTimeout(function () { this.timeoutObj = setTimeout(function () {
// 这里发送一个心跳,后端收到后,返回一个心跳消息, // 这里发送一个心跳,后端收到后,返回一个心跳消息,
// onmessage拿到返回的心跳就说明连接正常 // onmessage拿到返回的心跳就说明连接正常
@@ -305,10 +305,10 @@ export default {
showDetail (key, data) { showDetail (key, data) {
this.$notification.close(key) this.$notification.close(key)
var id = data.msgId const id = data.msgId
getAction(this.url.queryById, { id: id }).then((res) => { getAction(this.url.queryById, { id: id }).then((res) => {
if (res.success) { if (res.success) {
var record = res.result const record = res.result
this.showAnnouncement(record) this.showAnnouncement(record)
} }
}) })
+1 -1
View File
@@ -135,7 +135,7 @@ export default {
}, },
mounted () { mounted () {
// 如果是单点登录模式 // 如果是单点登录模式
if (process.env.VUE_APP_SSO == 'true') { if (process.env.VUE_APP_SSO + '' === 'true') {
const depart = this.userInfo().orgCode const depart = this.userInfo().orgCode
if (!depart) { if (!depart) {
this.updateCurrentDepart() this.updateCurrentDepart()
@@ -136,6 +136,7 @@ export default {
compareToFirstPassword (rule, value, callback) { compareToFirstPassword (rule, value, callback) {
const form = this.form const form = this.form
if (value && value !== form.getFieldValue('password')) { if (value && value !== form.getFieldValue('password')) {
// eslint-disable-next-line standard/no-callback-literal
callback('两次输入的密码不一样') callback('两次输入的密码不一样')
} else { } else {
callback() callback()
+1 -1
View File
@@ -1,4 +1,4 @@
import { UserLayout, TabLayout, RouteView, BlankLayout, PageView } from '@/components/layouts' import { UserLayout, TabLayout, BlankLayout } from '@/components/layouts'
/** /**
* 走菜单,走权限控制 * 走菜单,走权限控制
+6 -3
View File
@@ -20,7 +20,8 @@ export const JEditableTableMixin = {
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 18 } sm: { span: 18 }
} },
addDefaultRowNum: null // 这个变量应该是一个数字,但是为了保留原本代码中的提示逻辑,定义为null
} }
}, },
methods: { methods: {
@@ -72,7 +73,7 @@ export const JEditableTableMixin = {
}, },
/** 当点击了编辑(修改)按钮时调用此方法 */ /** 当点击了编辑(修改)按钮时调用此方法 */
edit (record) { edit (record) {
if (record && JSON.stringify(record) != '{}') { if (record && JSON.stringify(record) !== '{}') {
this.tableReset() this.tableReset()
} }
if (typeof this.editBefore === 'function') this.editBefore(record) if (typeof this.editBefore === 'function') this.editBefore(record)
@@ -107,7 +108,9 @@ export const JEditableTableMixin = {
} }
} }
tab.dataSource = dataSource tab.dataSource = dataSource
typeof success === 'function' ? success(res) : '' if (typeof success === 'function') {
success(res)
}
}).finally(() => { }).finally(() => {
tab.loading = false tab.loading = false
}) })
@@ -19,7 +19,9 @@ export const JEditableTableModelMixin = {
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 18 } sm: { span: 18 }
} },
addDefaultRowNum: null, // 这个变量应该是一个数字,但是为了保留原本代码中的提示逻辑,定义为null
refKeys: null
} }
}, },
methods: { methods: {
@@ -70,7 +72,7 @@ export const JEditableTableModelMixin = {
}, },
/** 当点击了编辑(修改)按钮时调用此方法 */ /** 当点击了编辑(修改)按钮时调用此方法 */
edit (record) { edit (record) {
if (record && JSON.stringify(record) != '{}' && record.id) { if (record && JSON.stringify(record) !== '{}' && record.id) {
this.tableReset() this.tableReset()
} }
if (typeof this.editBefore === 'function') this.editBefore(record) if (typeof this.editBefore === 'function') this.editBefore(record)
@@ -105,7 +107,9 @@ export const JEditableTableModelMixin = {
} }
} }
tab.dataSource = dataSource tab.dataSource = dataSource
typeof success === 'function' ? success(res) : '' if (typeof success === 'function') {
success(res)
}
}).finally(() => { }).finally(() => {
tab.loading = false tab.loading = false
}) })
+11 -4
View File
@@ -1,6 +1,8 @@
import { VALIDATE_FAILED, getRefPromise, validateFormAndTables } from '@/components/jero/JVxeTable/utils/vxeUtils.js' import { getRefPromise, validateFormAndTables } from '@/components/jero/JVxeTable/utils/vxeUtils.js'
import { httpAction, getAction } from '@/api/manage' import { httpAction, getAction } from '@/api/manage'
const VALIDATE_NO_PASSED = ''
export const JVxeTableMixin = { export const JVxeTableMixin = {
data () { data () {
return { return {
@@ -17,7 +19,9 @@ export const JVxeTableMixin = {
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 18 } sm: { span: 18 }
} },
refKeys: null,
addDefaultRowNum: null // 这个变量应该是一个数字,但是为了保留原本代码中的提示逻辑,定义为null
} }
}, },
methods: { methods: {
@@ -92,14 +96,17 @@ export const JVxeTableMixin = {
} }
} }
tab.dataSource = dataSource tab.dataSource = dataSource
typeof success === 'function' ? success(res) : '' if (typeof success === 'function') {
success(res)
}
}).finally(() => { }).finally(() => {
tab.loading = false tab.loading = false
}) })
}, },
/** 发起请求,自动判断是执行新增还是修改操作 */ /** 发起请求,自动判断是执行新增还是修改操作 */
request (formData) { request (formData) {
let url = this.url.add; let method = 'post' let url = this.url.add
let method = 'post'
if (this.model.id) { if (this.model.id) {
url = this.url.edit url = this.url.edit
method = 'put' method = 'put'
+7 -3
View File
@@ -1,4 +1,4 @@
import { VALIDATE_FAILED, getRefPromise, validateFormAndTables, validateFormModelAndTables } from '@/components/jero/JVxeTable/utils/vxeUtils.js' import { VALIDATE_FAILED, getRefPromise, validateFormModelAndTables } from '@/components/jero/JVxeTable/utils/vxeUtils.js'
import { httpAction, getAction } from '@/api/manage' import { httpAction, getAction } from '@/api/manage'
export const JVxeTableModelMixin = { export const JVxeTableModelMixin = {
@@ -16,7 +16,9 @@ export const JVxeTableModelMixin = {
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 18 } sm: { span: 18 }
} },
refKeys: null,
addDefaultRowNum: null // 这个变量应该是一个数字,但是为了保留原本代码中的提示逻辑,定义为null
} }
}, },
methods: { methods: {
@@ -94,7 +96,9 @@ export const JVxeTableModelMixin = {
} }
} }
tab.dataSource = dataSource tab.dataSource = dataSource
typeof success === 'function' ? success(res) : '' if (typeof success === 'function') {
success(res)
}
}).finally(() => { }).finally(() => {
tab.loading = false tab.loading = false
}) })
+10 -11
View File
@@ -4,7 +4,7 @@
* data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除 * data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除
*/ */
import { filterObj } from '@/utils/util' import { filterObj } from '@/utils/util'
import { deleteAction, getAction, downFile, getFileAccessHttpUrl } from '@/api/manage' import { deleteAction, downFile, getAction, getFileAccessHttpUrl } from '@/api/manage'
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types' import { ACCESS_TOKEN, TENANT_ID } from '@/store/mutation-types'
import store from '@/store' import store from '@/store'
@@ -79,7 +79,7 @@ export const JeroListMixin = {
if (arg === 1) { if (arg === 1) {
this.ipagination.current = 1 this.ipagination.current = 1
} }
var params = this.getQueryParams()// 查询条件 const params = this.getQueryParams()// 查询条件
this.loading = true this.loading = true
getAction(this.url.list, params).then((res) => { getAction(this.url.list, params).then((res) => {
if (res.success) { if (res.success) {
@@ -120,7 +120,7 @@ export const JeroListMixin = {
sqp.superQueryParams = encodeURI(this.superQueryParams) sqp.superQueryParams = encodeURI(this.superQueryParams)
sqp.superQueryMatchType = this.superQueryMatchType sqp.superQueryMatchType = this.superQueryMatchType
} }
var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters) const param = Object.assign(sqp, this.queryParam, this.isorter, this.filters)
param.field = this.getQueryField() param.field = this.getQueryField()
param.pageNo = this.ipagination.current param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize param.pageSize = this.ipagination.pageSize
@@ -128,7 +128,7 @@ export const JeroListMixin = {
}, },
getQueryField () { getQueryField () {
// TODO 字段权限控制 // TODO 字段权限控制
var str = 'id,' let str = 'id,'
this.columns.forEach(function (value) { this.columns.forEach(function (value) {
str += ',' + value.dataIndex str += ',' + value.dataIndex
}) })
@@ -164,11 +164,11 @@ export const JeroListMixin = {
if (this.selectedRowKeys.length <= 0) { if (this.selectedRowKeys.length <= 0) {
this.$message.warning('请选择一条记录') this.$message.warning('请选择一条记录')
} else { } else {
var ids = '' let ids = ''
for (var a = 0; a < this.selectedRowKeys.length; a++) { for (let a = 0; a < this.selectedRowKeys.length; a++) {
ids += this.selectedRowKeys[a] + ',' ids += this.selectedRowKeys[a] + ','
} }
var that = this const that = this
this.$confirm({ this.$confirm({
title: '确认删除', title: '确认删除',
content: '是否删除选中数据?', content: '是否删除选中数据?',
@@ -196,7 +196,7 @@ export const JeroListMixin = {
this.$message.error('请设置url.delete属性!') this.$message.error('请设置url.delete属性!')
return return
} }
var that = this const that = this
deleteAction(that.url.delete, { id: id }).then((res) => { deleteAction(that.url.delete, { id: id }).then((res) => {
if (res.success) { if (res.success) {
// 重新计算分页问题 // 重新计算分页问题
@@ -233,7 +233,7 @@ export const JeroListMixin = {
// 分页、排序、筛选变化时触发 // 分页、排序、筛选变化时触发
if (Object.keys(sorter).length > 0) { if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field this.isorter.column = sorter.field
this.isorter.order = sorter.order == 'ascend' ? 'asc' : 'desc' this.isorter.order = sorter.order === 'ascend' ? 'asc' : 'desc'
} }
this.ipagination = pagination this.ipagination = pagination
this.loadData() this.loadData()
@@ -259,8 +259,7 @@ export const JeroListMixin = {
/* 导出 */ /* 导出 */
handleExportXls2 () { handleExportXls2 () {
const paramsStr = encodeURI(JSON.stringify(this.getQueryParams())) const paramsStr = encodeURI(JSON.stringify(this.getQueryParams()))
const url = `${window._CONFIG.domianURL}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}` window.location.href = `${window._CONFIG.domianURL}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`
window.location.href = url
}, },
handleExportXls (fileName) { handleExportXls (fileName) {
if (!fileName || typeof fileName !== 'string') { if (!fileName || typeof fileName !== 'string') {
-1
View File
@@ -1,6 +1,5 @@
import { formatDate } from '@/utils/util' import { formatDate } from '@/utils/util'
import Area from '@/components/_util/Area' import Area from '@/components/_util/Area'
import { postAction } from '@/api/manage'
const onlUtil = { const onlUtil = {
data () { data () {
+5 -5
View File
@@ -15,14 +15,14 @@ export const WebsocketMixin = {
const token = Vue.ls.get(ACCESS_TOKEN) const token = Vue.ls.get(ACCESS_TOKEN)
console.log('------------WebSocket连接成功') console.log('------------WebSocket连接成功')
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
var userId = store.getters.userInfo.id const userId = store.getters.userInfo.id
if (!this.socketUrl.startsWith('/')) { if (!this.socketUrl.startsWith('/')) {
this.socketUrl = '/' + this.socketUrl this.socketUrl = '/' + this.socketUrl
} }
if (!this.socketUrl.endsWith('/')) { if (!this.socketUrl.endsWith('/')) {
this.socketUrl = this.socketUrl + '/' this.socketUrl = this.socketUrl + '/'
} }
var url = window._CONFIG.domianURL.replace('https://', 'wss://').replace('http://', 'ws://') + this.socketUrl + userId + '/' + token const url = window._CONFIG.domianURL.replace('https://', 'wss://').replace('http://', 'ws://') + this.socketUrl + userId + '/' + token
this.websock = new WebSocket(url) this.websock = new WebSocket(url)
this.websock.onopen = this.websocketOnopen this.websock.onopen = this.websocketOnopen
this.websock.onerror = this.websocketOnerror this.websock.onerror = this.websocketOnerror
@@ -32,11 +32,11 @@ export const WebsocketMixin = {
websocketOnopen: function () { websocketOnopen: function () {
console.log('WebSocket连接成功') console.log('WebSocket连接成功')
}, },
websocketOnerror: function (e) { websocketOnerror: function () {
console.log('WebSocket连接发生错误') console.log('WebSocket连接发生错误')
this.reconnect() this.reconnect()
}, },
websocketOnclose: function (e) { websocketOnclose: function () {
this.reconnect() this.reconnect()
}, },
websocketSend (text) { websocketSend (text) {
@@ -48,7 +48,7 @@ export const WebsocketMixin = {
} }
}, },
reconnect () { reconnect () {
var that = this const that = this
if (that.lockReconnect) return if (that.lockReconnect) return
that.lockReconnect = true that.lockReconnect = true
// 没连接上会一直重连,设置延迟避免请求过多 // 没连接上会一直重连,设置延迟避免请求过多
-2
View File
@@ -1,6 +1,4 @@
import Vue from 'vue' import Vue from 'vue'
import { ONL_AUTH_FIELDS } from '@/store/mutation-types'
import { getAction } from '@/api/manage'
const online = { const online = {
state: { state: {
+2 -4
View File
@@ -38,7 +38,7 @@ function hasRole(roles, route) {
} }
function filterAsyncRouter (routerMap, roles) { function filterAsyncRouter (routerMap, roles) {
const accessedRouters = routerMap.filter(route => { return routerMap.filter(route => {
if (hasPermission(roles.permissionList, route)) { if (hasPermission(roles.permissionList, route)) {
if (route.children && route.children.length) { if (route.children && route.children.length) {
route.children = filterAsyncRouter(route.children, roles) route.children = filterAsyncRouter(route.children, roles)
@@ -47,7 +47,6 @@ function filterAsyncRouter (routerMap, roles) {
} }
return false return false
}) })
return accessedRouters
} }
const permission = { const permission = {
@@ -65,8 +64,7 @@ const permission = {
GenerateRoutes ({ commit }, data) { GenerateRoutes ({ commit }, data) {
return new Promise(resolve => { return new Promise(resolve => {
const { roles } = data const { roles } = data
let accessedRouters const accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
commit('SET_ROUTERS', accessedRouters) commit('SET_ROUTERS', accessedRouters)
resolve() resolve()
}) })
+7 -8
View File
@@ -5,7 +5,6 @@ import store from '@/store'
import { welcome } from '@/utils/util' import { welcome } from '@/utils/util'
import { queryPermissionsByUser } from '@/api/api' import { queryPermissionsByUser } from '@/api/api'
import { getAction } from '@/api/manage' import { getAction } from '@/api/manage'
import notification from 'ant-design-vue/lib/notification'
const user = { const user = {
state: { state: {
@@ -71,7 +70,7 @@ const user = {
Login ({ commit }, userInfo) { Login ({ commit }, userInfo) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(userInfo).then(response => { login(userInfo).then(response => {
if (response.code == '200') { if (response.code + '' === '200') {
const result = response.result const result = response.result
const userInfo = result.userInfo const userInfo = result.userInfo
Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000) Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
@@ -95,7 +94,7 @@ const user = {
PhoneLogin ({ commit }, userInfo) { PhoneLogin ({ commit }, userInfo) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
phoneLogin(userInfo).then(response => { phoneLogin(userInfo).then(response => {
if (response.code == '200') { if (response.code + '' === '200') {
const result = response.result const result = response.result
const userInfo = result.userInfo const userInfo = result.userInfo
Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000) Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
@@ -127,12 +126,12 @@ const user = {
sessionStorage.setItem(SYS_BUTTON_AUTH, JSON.stringify(allAuthData)) sessionStorage.setItem(SYS_BUTTON_AUTH, JSON.stringify(allAuthData))
if (menuData && menuData.length > 0) { if (menuData && menuData.length > 0) {
// update--begin--autor:qinfeng-----date:20200109------for 一级菜单的子菜单全部是隐藏路由,则一级菜单不显示------ // update--begin--autor:qinfeng-----date:20200109------for 一级菜单的子菜单全部是隐藏路由,则一级菜单不显示------
menuData.forEach((item, index) => { menuData.forEach((item) => {
if (item.children) { if (item.children) {
const hasChildrenMenu = item.children.filter((i) => { const hasChildrenMenu = item.children.filter((i) => {
return !i.hidden || i.hidden == false return !i.hidden || i.hidden === false
}) })
if (hasChildrenMenu == null || hasChildrenMenu.length == 0) { if (hasChildrenMenu == null || hasChildrenMenu.length === 0) {
item.hidden = true item.hidden = true
} }
} }
@@ -173,7 +172,7 @@ const user = {
Vue.ls.remove(TENANT_ID) Vue.ls.remove(TENANT_ID)
// console.log('logoutToken: '+ logoutToken) // console.log('logoutToken: '+ logoutToken)
logout(logoutToken).then(() => { logout(logoutToken).then(() => {
if (process.env.VUE_APP_SSO == 'true') { if (process.env.VUE_APP_SSO + '' === 'true') {
const sevice = 'http://' + window.location.host + '/' const sevice = 'http://' + window.location.host + '/'
const serviceUrl = encodeURIComponent(sevice) const serviceUrl = encodeURIComponent(sevice)
window.location.href = process.env.VUE_APP_CAS_BASE_URL + '/logout?service=' + serviceUrl window.location.href = process.env.VUE_APP_CAS_BASE_URL + '/logout?service=' + serviceUrl
@@ -189,7 +188,7 @@ const user = {
ThirdLogin ({ commit }, param) { ThirdLogin ({ commit }, param) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
thirdLogin(param.token, param.thirdType).then(response => { thirdLogin(param.token, param.thirdType).then(response => {
if (response.code == '200') { if (response.code + '' === '200') {
const result = response.result const result = response.result
const userInfo = result.userInfo const userInfo = result.userInfo
Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000) Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)