Commit cc7dd8de authored by liuChang's avatar liuChang

Merge branch 'V20230915' of 192.168.60.201:root/dsk-operate-sys into V20230915

parents 9cb4e776 8e4ccc6b
......@@ -61,6 +61,11 @@
<artifactId>dsk-biz-api</artifactId>
</dependency>
<dependency>
<groupId>com.dsk</groupId>
<artifactId>dsk-biz-bi</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......@@ -84,6 +89,7 @@
<!-- <version>${与你的agent探针版本保持一致}</version>-->
<!-- </dependency>-->
</dependencies>
<build>
......
......@@ -3,6 +3,7 @@ package com.dsk.web.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.annotation.SaMode;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.lock.annotation.Lock4j;
import com.dsk.common.annotation.Log;
import com.dsk.common.annotation.RepeatSubmit;
......@@ -15,9 +16,13 @@ import com.dsk.common.core.validate.AddGroup;
import com.dsk.common.core.validate.EditGroup;
import com.dsk.common.enums.BusinessType;
import com.dsk.common.tenant.helper.TenantHelper;
import com.dsk.common.utils.StringUtils;
import com.dsk.system.domain.SysUser;
import com.dsk.system.domain.bo.SysTenantAdminBo;
import com.dsk.system.domain.bo.SysTenantBo;
import com.dsk.system.domain.vo.SysTenantVo;
import com.dsk.system.service.ISysTenantService;
import com.dsk.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -39,11 +44,12 @@ import java.util.Arrays;
@RequestMapping("/system/tenant")
public class SysTenantController extends BaseController {
private final ISysTenantService tenantService;
private final ISysUserService userService;
/**
* 查询租户列表
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY,TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY},mode = SaMode.OR)
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@SaCheckPermission(value = "system:tenant:list", orRole = "accountAdmin")
@GetMapping("/list")
public TableDataInfo<SysTenantVo> list(SysTenantBo bo, PageQuery pageQuery) {
......@@ -67,7 +73,7 @@ public class SysTenantController extends BaseController {
*
* @param id 主键
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY,TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY},mode = SaMode.OR)
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@SaCheckPermission(value = "system:tenant:query", orRole = "accountAdmin")
@GetMapping("/{id}")
public R<SysTenantVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
......@@ -77,7 +83,7 @@ public class SysTenantController extends BaseController {
/**
* 新增租户
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY,TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY},mode = SaMode.OR)
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@SaCheckPermission(value = "system:tenant:add", orRole = "accountAdmin")
@Log(title = "租户", businessType = BusinessType.INSERT)
@Lock4j
......@@ -90,10 +96,26 @@ public class SysTenantController extends BaseController {
return toAjax(TenantHelper.ignore(() -> tenantService.insertByBo(bo)));
}
/**
* 新增企业普通管理员账号
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@SaCheckPermission(value = "system:user:add")
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping("/addTenantAdmin")
public R<Void> addTenantAdmin(@Validated @RequestBody SysTenantAdminBo tenantAdminBo) {
//校验手机号是否已存在
if (TenantHelper.ignore(()->userService.checkTenantAdminPhoneUnique(tenantAdminBo))) {
return R.fail("新增用户'" + tenantAdminBo.getPhonenumber() + "'失败,手机号码已存在");
}
return toAjax(TenantHelper.ignore(() -> tenantService.addTenantAdmin(tenantAdminBo)));
//return R.ok("手机号验证成功");
}
/**
* 修改租户
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY,TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY},mode = SaMode.OR)
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@SaCheckPermission(value = "system:tenant:edit", orRole = "accountAdmin")
@Log(title = "租户", businessType = BusinessType.UPDATE)
@RepeatSubmit()
......@@ -123,7 +145,7 @@ public class SysTenantController extends BaseController {
*
* @param ids 主键串
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY,TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY},mode = SaMode.OR)
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@SaCheckPermission(value = "system:tenant:remove", orRole = "accountAdmin")
@Log(title = "租户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
......@@ -146,7 +168,7 @@ public class SysTenantController extends BaseController {
/**
* 清除动态租户
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY,TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY},mode = SaMode.OR)
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@GetMapping("/dynamic/clear")
public R<Void> dynamicClear() {
TenantHelper.clearDynamic();
......@@ -159,7 +181,7 @@ public class SysTenantController extends BaseController {
* @param tenantId 租户id
* @param packageId 套餐id
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY,TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY},mode = SaMode.OR)
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@SaCheckPermission(value = "system:tenant:edit", orRole = "accountAdmin")
@Log(title = "租户", businessType = BusinessType.UPDATE)
@GetMapping("/syncTenantPackage")
......
package com.dsk.web.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.annotation.SaMode;
import cn.dev33.satoken.secure.BCrypt;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.tree.Tree;
......@@ -9,6 +11,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.dsk.biz.utils.ExcelUtils;
import com.dsk.common.annotation.Log;
import com.dsk.common.constant.GlobalConstants;
import com.dsk.common.constant.TenantConstants;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.domain.R;
......@@ -16,6 +19,7 @@ import com.dsk.common.core.page.TableDataInfo;
import com.dsk.common.enums.BusinessType;
import com.dsk.common.exception.ServiceException;
import com.dsk.common.helper.LoginHelper;
import com.dsk.common.tenant.helper.TenantHelper;
import com.dsk.common.utils.StreamUtils;
import com.dsk.common.utils.StringUtils;
import com.dsk.common.utils.poi.ExcelUtil;
......@@ -37,6 +41,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.*;
/**
......@@ -55,6 +60,16 @@ public class SysUserController extends BaseController {
private final ISysPostService postService;
private final ISysDeptService deptService;
/**
* 根据租户ID查询大司空超管or租户管理员为其创建的企业管理员和管理员账号数量
*/
@SaCheckRole(value = {TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.DSK_TENANT_ADMIN_ROLE_KEY}, mode = SaMode.OR)
@SaCheckPermission(value = "system:user:query", orRole = "accountAdmin")
@GetMapping("/queryTenantAdminNumCreatedByDSK/{tenantId}")
public R<Long> queryTenantAdminNumCreatedByDSK(@NotNull(message = "租户ID不能为空") @PathVariable Long tenantId) {
return R.ok(TenantHelper.ignore(() -> userService.queryTenantAdminNumCreatedByDSK(tenantId)));
}
/**
* 获取用户列表
*/
......
......@@ -140,7 +140,7 @@ security:
- /*/api-docs
- /*/api-docs/**
# actuator 监控配置
- /actuator
- /api/**
- /actuator/**
......@@ -300,3 +300,25 @@ management:
show-details: ALWAYS
logfile:
external-file: ./logs/sys-console.log
gv:
img-path: D:\dsk\dsk-operate-sys\
#spring:
# datasource:
# type: com.alibaba.druid.pool.DruidDataSource
# druid:
# driver-class-name: com.mysql.cj.jdbc.Driver
# username: ${MYSQL_USER:root}
# password: ${MYSQL_PWD:root}
# url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_report}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true
# jpa:
# database-platform:
# org.hibernate.dialect.MySQL8Dialectsecurity:
# oauth2:
# client:
# ignore-urls:
# - /
# - /api/project/getData
# - /static/**
# - /api/project/get-file/*
# # 文件上传路径
......@@ -18,34 +18,44 @@ public interface TenantConstants {
String DISABLE = "1";
/**
* 超级管理员ID
* 大司空超级管理员ID
*/
Long SUPER_ADMIN_ID = 1L;
/**
* 超级管理员角色 roleKey
* 大司空超级管理员角色 roleKey
*/
String SUPER_ADMIN_ROLE_KEY = "superadmin";
/**
* 租户管理员角色 roleKey
* 大司空租户管理员角色
*/
String TENANT_ADMIN_ROLE_KEY = "admin";
String DSK_TENANT_ADMIN_ROLE_KEY = "accountAdmin";
/**
* 租户管理员角色名称
* 大司空租户管理员角色名称
*/
String TENANT_ADMIN_ROLE_NAME = "管理员";
String DSK_TENANT_ADMIN_ROLE_NAME = "企业账号管理员";
/**
* 大司空租户管理员角色
* 企业超级管理员角色 roleKey
*/
String DSK_TENANT_ADMIN_ROLE_KEY = "accountAdmin";
String TENANT_SUPER_ADMIN_ROLE_KEY = "tenantSuperAdmin";
/**
* 大司空租户管理员角色名称
* 企业超级管理员角色名称
*/
String DSK_TENANT_ADMIN_ROLE_NAME = "企业账号管理员";
String TENANT_SUPER_ADMIN_ROLE_NAME = "企业管理员";
/**
* 企业普通管理员角色 roleKey
*/
String TENANT_ADMIN_ROLE_KEY = "tenantAdmin";
/**
* 企业普通管理员角色名称
*/
String TENANT_ADMIN_ROLE_NAME = "管理员";
/**
* 默认租户ID
......
......@@ -169,7 +169,7 @@ public class LoginHelper {
* @return 结果
*/
public static boolean isTenantAdmin(Set<String> rolePermission) {
return rolePermission.contains(TenantConstants.TENANT_ADMIN_ROLE_KEY);
return rolePermission.contains(TenantConstants.TENANT_SUPER_ADMIN_ROLE_KEY);
}
public static boolean isTenantAdmin() {
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>dsk-module</artifactId>
<groupId>com.dsk</groupId>
<version>4.8.0</version>
</parent>
<groupId>com.dsk</groupId>
<artifactId>dsk-biz-bi</artifactId>
<name>dsk-biz-bi</name>
<description>BI数字大屏</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.dsk</groupId>
<artifactId>dsk-common</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- ORM -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- hutool-core -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
</dependency>
<!-- hutool-core -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-json</artifactId>
</dependency>
<!-- hutool-http -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
</dependency>
<!-- hutool-extra -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-extra</artifactId>
</dependency>
<!--数据库-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
<!-- <build>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <image>-->
<!-- <builder>paketobuildpacks/builder-jammy-base:latest</builder>-->
<!-- </image>-->
<!-- </configuration>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>
package com.dsk.biz.goview.common.base;
import cn.hutool.core.util.StrUtil;
import com.dsk.biz.goview.common.bean.AjaxResult;
import com.dsk.biz.goview.common.domain.ResultTable;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* web层通用数据处理
*
* @author fuce
* @ClassName: BaseController
* @date 2018年8月18日
*/
public class BaseController {
/**
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
*/
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
/**
* 响应返回结果
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows) {
return rows > 0 ? success() : error();
}
/**
* 返回成功
*/
public AjaxResult success() {
return AjaxResult.success();
}
/**
* 返回失败消息
*/
public AjaxResult error() {
return AjaxResult.error();
}
/**
* 返回成功消息
*/
public AjaxResult success(String message) {
return AjaxResult.success(message);
}
/**
* 返回失败消息
*/
public AjaxResult error(String message) {
return AjaxResult.error(message);
}
/**
* 返回错误码消息
*/
public AjaxResult error(int code, String message) {
return AjaxResult.error(code, message);
}
/**
* 返回object数据
*/
public AjaxResult retobject(int code, Object data) {
return AjaxResult.successData(code, data);
}
/**
* 页面跳转
*/
public String redirect(String url) {
return StrUtil.format("redirect:{}", url);
}
/**
* Describe: 返回数据表格数据 分页 Param data Return 表格分页数据
*/
protected static ResultTable pageTable(Object data, long count) {
return ResultTable.pageTable(count, data);
}
/**
* Describe: 返回数据表格数据 Param data Return 表格分页数据
*/
protected static ResultTable dataTable(Object data) {
return ResultTable.dataTable(data);
}
/**
* Describe: 返回树状表格数据 分页 Param data Return 表格分页数据
*/
protected static ResultTable treeTable(Object data) {
return ResultTable.dataTable(data);
}
}
package com.dsk.biz.goview.common.base;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 抽象类BaseService
*
* @ClassName: BaseService
* @Description: Service实现这个
* @author fuce
* @date 2018年6月3日
*
*/
public interface BaseService<T, T2> {
int deleteByPrimaryKey(String id);
int insertSelective(T record);
T selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(T record);
int updateByExampleSelective(@Param("record") T record, @Param("example") T2 example);
int updateByExample(@Param("record") T record, @Param("example") T2 example);
List<T> selectByExample(T2 example);
long countByExample(T2 example);
int deleteByExample(T2 example);
}
package com.dsk.biz.goview.common.bean;
import java.util.HashMap;
/**
* @ClassName: AjaxResult
* @Description: ajax操作消息提醒
* @author fuce
* @date 2018年8月18日
*
*/
public class AjaxResult extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;
/**
* 初始化一个新创建的 Message 对象
*/
public AjaxResult() {
}
/**
* 返回错误消息
* @return 错误消息
*/
public static AjaxResult error() {
return error(500, "操作失败");
}
/**
* 返回错误消息
* @param msg 内容
* @return 错误消息
*/
public static AjaxResult error(String msg) {
return error(500, msg);
}
/**
* 返回错误消息
* @param code 错误码
* @param msg 内容
* @return 错误消息
*/
public static AjaxResult error(int code, String msg) {
AjaxResult json = new AjaxResult();
json.put("code", code);
json.put("msg", msg);
return json;
}
/**
* 返回成功消息
* @param msg 内容
* @return 成功消息
*/
public static AjaxResult success(String msg) {
AjaxResult json = new AjaxResult();
json.put("msg", msg);
json.put("code", 200);
return json;
}
/**
* 返回成功消息
* @param msg 内容
* @return 成功消息
*/
public static AjaxResult successNullData(String msg) {
AjaxResult json = new AjaxResult();
json.put("msg", msg);
json.put("data", null);
json.put("code", 200);
return json;
}
/**
* 返回成功消息
* @return 成功消息
*/
public static AjaxResult success() {
return AjaxResult.success("操作成功");
}
public static AjaxResult successData(int code, Object value) {
AjaxResult json = new AjaxResult();
json.put("code", code);
json.put("data", value);
return json;
}
/**
* 返回成功消息
* @param key 键值
* @param value 内容
* @return 成功消息
*/
@Override
public AjaxResult put(String key, Object value) {
super.put(key, value);
return this;
}
}
package com.dsk.biz.goview.common.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@Entity
public class GoviewProject implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@TableId(type = IdType.ASSIGN_UUID)
private String id;
private String projectName;
private Integer state;
private LocalDateTime createTime;
private String createUserId;
private Integer isDelete;
private String indexImage;
private String remarks;
private Long tenantId;
@Transient
@TableField(exist = false)
private String content;
}
package com.dsk.biz.goview.common.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@Entity
public class GoviewProjectData implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@TableId(type = IdType.ASSIGN_UUID)
private String id;
private String projectId;
private LocalDateTime createTime;
private String createUserId;
private Long tenantId;
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(columnDefinition = "TEXT")
private String content;
}
package com.dsk.biz.goview.common.domain;
import java.util.Map;
public class MagicHttp {
/**
* 请求url
*/
private String url;
/**
* 请求类型 get post
*/
private String requestType;
private Map<String, String> head;
private String body;
private Integer timeout;
private Map<String, Object> form;
private String cookie;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getRequestType() {
return requestType;
}
public void setRequestType(String requestType) {
this.requestType = requestType;
}
public Map<String, String> getHead() {
return head;
}
public void setHead(Map<String, String> head) {
this.head = head;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getCookie() {
return cookie;
}
public void setCookie(String cookie) {
this.cookie = cookie;
}
public Integer getTimeout() {
return timeout;
}
public void setTimeout(Integer timeout) {
this.timeout = timeout;
}
public Map<String, Object> getForm() {
return form;
}
public void setForm(Map<String, Object> form) {
this.form = form;
}
}
package com.dsk.biz.goview.common.domain;
public class ResultTable {
/**
* 状态码
*/
private Integer code;
/**
* 提示消息
*/
private String msg;
/**
* 消息总量
*/
private Long count;
/**
* 数据对象
*/
private Object data;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
/**
* 构 建
*/
public static ResultTable pageTable(long count, Object data) {
ResultTable resultTable = new ResultTable();
resultTable.setData(data);
resultTable.setCode(0);
resultTable.setCount(count);
if (data != null) {
resultTable.setMsg("获取成功");
}
else {
resultTable.setMsg("获取失败");
}
return resultTable;
}
public static ResultTable dataTable(Object data) {
ResultTable resultTable = new ResultTable();
resultTable.setData(data);
resultTable.setCode(0);
if (data != null) {
resultTable.setMsg("获取成功");
}
else {
resultTable.setMsg("获取失败");
}
return resultTable;
}
}
package com.dsk.biz.goview.common.domain;
/**
* boostrap table post 参数
*
* @author fc
*
*/
public class Tablepar {
private int page;// 页码
private int limit;// 数量
private String orderByColumn;// 排序字段
private String isAsc;// 排序字符 asc desc
private String searchText;// 列表table里面的搜索
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getOrderByColumn() {
return orderByColumn;
}
public void setOrderByColumn(String orderByColumn) {
this.orderByColumn = orderByColumn;
}
public String getIsAsc() {
return isAsc;
}
public void setIsAsc(String isAsc) {
this.isAsc = isAsc;
}
public String getSearchText() {
return searchText;
}
public void setSearchText(String searchText) {
this.searchText = searchText;
}
}
///*
// * Copyright (c) 2018-2025, lengleng All rights reserved.
// *
// * Redistribution and use in source and binary forms, with or without
// * modification, are permitted provided that the following conditions are met:
// *
// * Redistributions of source code must retain the above copyright notice,
// * this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// * notice, this list of conditions and the following disclaimer in the
// * documentation and/or other materials provided with the distribution.
// * Neither the name of the pig4cloud.com developer nor the names of its
// * contributors may be used to endorse or promote products derived from
// * this software without specific prior written permission.
// * Author: lengleng (wangiegie@gmail.com)
// */
//
//package com.dsk.biz.goview.config;
//
//import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import net.sf.jsqlparser.expression.Expression;
//import net.sf.jsqlparser.expression.LongValue;
//import net.sf.jsqlparser.expression.NullValue;
//
///**
// * @author lengleng
// * @date 2018-12-26
// * <p>
// * 租户维护处理器
// */
//@Slf4j
//@RequiredArgsConstructor
//public class DataVTenantHandler implements TenantLineHandler {
//
// /**
// * 获取租户 ID 值表达式,只支持单个 ID 值
// * <p>
// * @return 租户 ID 值表达式
// */
// @Override
// public Expression getTenantId() {
// Long tenantId = TenantContextHolder.getTenantId();
// log.debug("当前租户为 >> {}", tenantId);
//
// if (tenantId == null) {
// return new NullValue();
// }
// return new LongValue(tenantId);
// }
//
//}
package com.dsk.biz.goview.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author lengleng
* @date 2022/5/2
* <p>
* 数据大屏配置
*/
@Data
//@ConfigurationProperties("gv")
@Component
@ConfigurationProperties(prefix = "gv")
public class GoviewProperties {
/**
* 服务 http://IP:port
*/
private String host = "";
/**
* 路由前缀
*/
private String gatewayPrefix = "/api/gv";
/**
* 图片存放路径
*/
private String imgPath;
/**
* 项目 license
*/
private String license;
/**
* 是否开启检查更新
*/
private boolean checkUpdate = true;
}
///*
// * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
//package com.dsk.biz.goview.config;
//
//import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
//import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
//import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.boot.autoconfigure.domain.EntityScan;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @author lengleng
// * @date 2020-03-14
// * <p>
// * mybatis plus 统一配置
// */
//@Configuration(proxyBeanMethods = false)
//@MapperScan(basePackages = "io.springboot.plugin.goview.mapper")
//@EntityScan(basePackages = "io.springboot.plugin.goview.common.domain")
//public class MybatisAutoConfiguration {
//
// @Bean
// public TenantContextHolderFilter tenantContextHolderFilter() {
// return new TenantContextHolderFilter();
// }
//
// /**
// * 分页插件, 对于单一数据库类型来说,都建议配置该值,避免每次分页都去抓取数据库类型
// */
// @Bean
// @ConditionalOnMissingBean
// public MybatisPlusInterceptor mybatisPlusInterceptor() {
// MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(new DataVTenantHandler()));
// interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
// return interceptor;
// }
//
//}
package com.dsk.biz.goview.config;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertySourceFactory;
import org.springframework.lang.Nullable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
/**
* @author lengleng
* @date 2023/4/5
*/
public class YamlPropertySourceFactory implements PropertySourceFactory {
@Override
public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource resource) throws IOException {
Properties propertiesFromYaml = loadYamlIntoProperties(resource);
String sourceName = name != null ? name : resource.getResource().getFilename();
return new PropertiesPropertySource(sourceName, propertiesFromYaml);
}
private Properties loadYamlIntoProperties(EncodedResource resource) throws FileNotFoundException {
try {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(resource.getResource());
factory.afterPropertiesSet();
return factory.getObject();
}
catch (IllegalStateException e) {
Throwable cause = e.getCause();
if (cause instanceof FileNotFoundException)
throw (FileNotFoundException) e.getCause();
throw e;
}
}
}
package com.dsk.biz.goview.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsk.biz.goview.common.base.BaseController;
import com.dsk.biz.goview.common.bean.AjaxResult;
import com.dsk.biz.goview.common.domain.*;
import com.dsk.biz.goview.config.GoviewProperties;
import com.dsk.biz.goview.mapper.GoviewProjectDataMapper;
import com.dsk.biz.goview.mapper.GoviewProjectMapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ContentDisposition;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.ModelMap;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 项目表Controller
*
* @author fuce
* @ClassName: GoviewProjectController
* @date 2022-05-18 21:43:25
*/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/goview/project")
public class GoViewProjectAPIController extends BaseController {
private final GoviewProjectDataMapper projectDataMapper;
private final GoviewProjectMapper projectMapper;
private final GoviewProperties goviewProperties;
@GetMapping("/list")
public ResultTable list(Tablepar tablepar, GoviewProject goviewProject) {
Page page = new Page(tablepar.getPage(), tablepar.getLimit());
Page result = projectMapper.selectPage(page, Wrappers.query(goviewProject));
ResultTable resultTable = pageTable(result.getRecords(), result.getTotal());
resultTable.setCode(200);
return resultTable;
}
/**
* 新增保存
* @param
* @return
*/
@PostMapping("/create")
public AjaxResult add(@RequestBody GoviewProject goviewProject) {
projectMapper.insert(goviewProject);
return AjaxResult.successData(200, goviewProject).put("msg", "创建成功");
}
/**
* 项目表删除
* @param ids
* @return
*/
@DeleteMapping("/delete")
public AjaxResult delete(String ids) {
projectMapper.deleteById(ids);
return success();
}
@PostMapping("/edit")
public AjaxResult editSave(@RequestBody GoviewProject goviewProject) {
projectMapper.updateById(goviewProject);
return success();
}
@PostMapping("/rename")
public AjaxResult rename(@RequestBody GoviewProject goviewProject) {
projectMapper.updateById(goviewProject);
return success();
}
// 发布/取消项目状态
@PutMapping("/publish")
@ResponseBody
public AjaxResult updateVisible(@RequestBody GoviewProject goviewProject) {
projectMapper.updateById(goviewProject);
return success();
}
/**
* 获取项目存储数据
* @param id 项目id
* @param mmap
* @return
*/
@GetMapping("/getData")
public AjaxResult getData(String projectId, ModelMap map) {
InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
GoviewProject goviewProject = projectMapper.selectById(projectId);
if (goviewProject == null) {
return AjaxResult.successData(200, null).put("msg", "无数据");
}
List<GoviewProjectData> goviewProjectDataList = projectDataMapper
.selectList(Wrappers.<GoviewProjectData>lambdaQuery().eq(GoviewProjectData::getProjectId, projectId));
if (CollUtil.isNotEmpty(goviewProjectDataList)) {
goviewProject.setContent(goviewProjectDataList.get(0).getContent());
return AjaxResult.successData(200, goviewProject).put("msg", "获取成功");
}
return AjaxResult.successData(200, null).put("msg", "无数据");
}
@PostMapping("/save/data")
public AjaxResult saveData(GoviewProjectData data) {
boolean exists = projectDataMapper
.exists(Wrappers.<GoviewProjectData>lambdaQuery().eq(GoviewProjectData::getProjectId, data.getProjectId()));
if (exists) {
projectDataMapper.update(data,
Wrappers.<GoviewProjectData>lambdaQuery().eq(GoviewProjectData::getProjectId, data.getProjectId()));
}
else {
projectDataMapper.insert(data);
}
return AjaxResult.success("操作成功");
}
/**
* 模拟请求
* @return
*/
@PostMapping("/magicHttp")
public AjaxResult magicHttp(@RequestBody MagicHttp magicHttp) {
return AjaxResult.successNullData("参数异常为null");
}
/**
* 上传文件
* @param file 文件流对象
* @return
* @throws Exception
*/
@PostMapping("/upload")
@ResponseBody
public AjaxResult upload(@RequestBody MultipartFile object) throws IOException {
File dest = new File(goviewProperties.getImgPath() + object.getOriginalFilename());
object.transferTo(dest);
Map<String, String> map = new HashMap(4);
String url;
if (StrUtil.isNotBlank(goviewProperties.getHost())) {
url = goviewProperties.getHost() + goviewProperties.getGatewayPrefix() + "/api/project/get-file/"
+ object.getOriginalFilename();
}
else {
url = goviewProperties.getGatewayPrefix() + "/api/project/get-file/" + object.getOriginalFilename();
}
map.put("link", url);
return AjaxResult.successData(200, map);
}
/**
* 文件获取
* @param fileName 文件名
*/
@GetMapping("/get-file/{fileName}")
public ResponseEntity<byte[]> getFile(@PathVariable String fileName) {
HttpHeaders headers = new HttpHeaders();
// 通知浏览器以下载文件方式打开
ContentDisposition contentDisposition = ContentDisposition.builder("attachment").filename(fileName).build();
headers.setContentDisposition(contentDisposition);
try {
return new ResponseEntity<>(
FileCopyUtils.copyToByteArray(new File(goviewProperties.getImgPath() + fileName)), headers,
HttpStatus.OK);
}
catch (IOException e) {
log.warn(e.getLocalizedMessage());
}
return null;
}
}
package com.dsk.biz.goview.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.dsk.biz.goview.common.bean.AjaxResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import static com.dsk.biz.goview.common.bean.AjaxResult.success;
/**
* @author lengleng
* @date 2022/5/21
*/
@Slf4j
@Controller
@RequestMapping
@RequiredArgsConstructor
public class GoviewPageController {
@SaIgnore
@GetMapping({ "/", "/chart/**", "/project/**" })
public String index() {
return "index";
}
@GetMapping("/api/goview/sys/getOssInfo")
@ResponseBody
public AjaxResult getOssInfo() {
return success();
}
}
package com.dsk.biz.goview.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.biz.goview.common.domain.GoviewProjectData;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lengleng
* @date 2023/4/4
*/
@Mapper
public interface GoviewProjectDataMapper extends BaseMapper<GoviewProjectData> {
}
package com.dsk.biz.goview.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.biz.goview.common.domain.GoviewProject;
import org.apache.ibatis.annotations.Mapper;
/**
* @author lengleng
* @date 2023/4/4
*/
@Mapper
public interface GoviewProjectMapper extends BaseMapper<GoviewProject> {
}
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<script>self["MonacoEnvironment"] = (function (paths) {
return {
globalAPI: false,
getWorkerUrl : function (moduleId, label) {
var result = paths[label];
if (/^((http:)|(https:)|(file:)|(\/\/))/.test(result)) {
var currentUrl = String(window.location);
var currentOrigin = currentUrl.substr(0, currentUrl.length - window.location.hash.length - window.location.search.length - window.location.pathname.length);
if (result.substring(0, currentOrigin.length) !== currentOrigin) {
var js = '/*' + label + '*/importScripts("' + result + '");';
var blob = new Blob([js], { type: 'application/javascript' });
return URL.createObjectURL(blob);
}
}
return result;
}
};
})({
"editorWorkerService": "/api/gv/monacoeditorwork/editor.worker.bundle.js",
"typescript": "/api/gv/monacoeditorwork/ts.worker.bundle.js",
"json": "/api/gv/monacoeditorwork/json.worker.bundle.js",
"html": "/api/gv/monacoeditorwork/html.worker.bundle.js",
"javascript": "/api/gv/monacoeditorwork/ts.worker.bundle.js",
"handlebars": "/api/gv/monacoeditorwork/html.worker.bundle.js",
"razor": "/api/gv/monacoeditorwork/html.worker.bundle.js"
});</script>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="description" content="GoView 是高效、高性能的拖拽式低代码数据可视化开发平台,将页面元素封装为基础组件,无需编写代码即可完成业务需求。">
<meta name="keywords" content="GoView,goview,低代码,可视化">
<meta name="author" content="奔跑的面条,面条">
<meta
name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/>
<link rel="icon" href="./favicon.ico" />
<title>GoView</title>
<script type="module" crossorigin src="/api/gv/static/js/index-ebdecea3.js"></script>
<link rel="stylesheet" href="/api/gv/static/css/index-9c2eb289.css">
</head>
<body>
<div id="appProvider" style="display: none;"></div>
<div id="app">
<div class="first-loading-wrp">
<div class="loading-wrp">
<span class="dot dot-spin"><i></i><i></i><i></i><i></i></span>
</div>
</div>
</div>
</body>
</html>
......@@ -22,6 +22,7 @@
<modules>
<module>dsk-biz-api</module>
<module>dsk-biz-bi</module>
</modules>
<build>
......
......@@ -8,4 +8,4 @@ ENV = 'production'
VUE_APP_BASE_API = 'https://szhapi.jiansheku.com'
# 子系统地址
VUE_APP_SUB_SYSTEM_ADDRESS = "https://plug.jiansheku.com"
\ No newline at end of file
VUE_APP_SUB_SYSTEM_ADDRESS = "https://plug.jiansheku.com"
......@@ -39,6 +39,7 @@
"dependencies": {
"@cell-x/el-table-sticky": "^1.0.2",
"@riophae/vue-treeselect": "0.4.0",
"@vue/composition-api": "^1.7.2",
"axios": "0.24.0",
"clipboard": "2.0.8",
"core-js": "^3.32.2",
......@@ -56,6 +57,7 @@
"js-cookie": "3.0.1",
"js-md5": "^0.7.3",
"jsencrypt": "3.0.0-rc.1",
"json-editor-vue": "^0.11.0",
"nprogress": "0.2.0",
"quill": "1.3.7",
"screenfull": "5.0.2",
......
......@@ -141,3 +141,12 @@ export function peojectTop(data) {
data: data
})
}
// 集团成员导出
export function memberListExport(data) {
return request({
url: '/combine/info/memberList/export',
method: 'post',
data: data
})
}
......@@ -178,6 +178,51 @@ export const searchOwnerUnitListApi = (data) => request({
method: 'post',
data
});
// 查城投平台导出
export const uipSerachExport = (data) => request({
url: '/enterprise/uipSerach/export',
method: 'post',
data
});
// 企业基本信息导出
export const infoExport = (data) => request({
url: '/enterprise/info/export',
method: 'post',
data
});
// 企业资质导出
export const aptitudeExport = (data) => request({
url: '/enterprise/aptitude/export',
method: 'post',
data
});
export default { label, centralEnterprsesocialPage, centralEnterprselocalPage, centralEnterprseChildPage, centralEnterprsesocial, centralEnterprselocal, centralEnterprseChild, searchCentralEnterprse, centralEnterprse, region, aptitudeCode, personCert, searchDic, regionWebList, uipGroupData, uipSerach, claim, cancelClaim, enterprisePage, infoHeader, historyClaim, customerStatus, searchOwnerUnitListApi };
export default {
label,
centralEnterprsesocialPage,
centralEnterprselocalPage,
centralEnterprseChildPage,
centralEnterprsesocial,
centralEnterprselocal,
centralEnterprseChild,
searchCentralEnterprse,
centralEnterprse,
region,
aptitudeCode,
personCert,
searchDic,
regionWebList,
uipGroupData,
uipSerach,
claim,
cancelClaim,
enterprisePage,
infoHeader,
historyClaim,
customerStatus,
searchOwnerUnitListApi,
uipSerachExport,
infoExport,
aptitudeExport
};
import request from '@/utils/request'
import request from '@/utils/request';
//新增租户套餐
export function addTenantPackage(param) {
return request({
url: '/system/tenant/package',
method: 'POST',
data: param
})
});
}
//修改租户套餐
export function saveTenantPackage(param) {
......@@ -13,21 +13,21 @@ export function saveTenantPackage(param) {
url: '/system/tenant/package/',
method: 'PUT',
data: param
})
});
}
//获取租户套餐
export function detailTenantPackage(packageId) {
return request({
url: '/system/tenant/package/'+packageId,
url: '/system/tenant/package/' + packageId,
method: 'get',
})
});
}
//删除租户套餐
export function deleteTenantPackage(packageId) {
return request({
url: '/system/tenant/package/'+packageId,
url: '/system/tenant/package/' + packageId,
method: 'DELETE',
})
});
}
//租户套餐列表
export function getTenantPackage(param) {
......@@ -35,7 +35,7 @@ export function getTenantPackage(param) {
url: '/system/tenant/package/list',
method: 'get',
params: param
})
});
}
//同步企业方案
export function syncTenantPackage(param) {
......@@ -43,7 +43,7 @@ export function syncTenantPackage(param) {
url: '/system/tenant/syncTenantPackage',
method: 'get',
params: param
})
});
}
//租户列表
......@@ -52,15 +52,15 @@ export function getTenantList(param) {
url: '/system/tenant/list',
method: 'get',
params: param
})
});
}
//获取租户详情
export function getTenant(id) {
return request({
url: '/system/tenant/'+id,
url: '/system/tenant/' + id,
method: 'get',
})
});
}
//修改租户
......@@ -68,31 +68,52 @@ export function editTenant(data) {
return request({
url: '/system/tenant/',
method: 'PUT',
data:data,
})
data: data,
});
}
//新增租户
export function saveTenant(data) {
return request({
url: '/system/tenant/',
method: 'POST',
data:data,
})
data: data,
});
}
//删除租户
export function deleteTenant(ids) {
return request({
url: '/system/tenant/'+ids,
url: '/system/tenant/' + ids,
method: 'Delete',
})
});
}
//租户请求企业套餐下拉
export function selectTenant(ids) {
return request({
url: '/system/tenant/package/selectList',
method: 'Get',
})
});
}
/**
* 企业管理新增账号
* @param {object} data
* @returns
*/
export const enterpriseAddAccountApi = (data) => request({
url: "/system/tenant/addTenantAdmin",
method: "post",
data
});
/**
* 租户ID查询大司空超管or租户管理员为其创建的企业管理员和管理员账号数量
* @param {*} tenantId
* @returns
*/
export const getEnterpriseAddAccountCountApi = (tenantId) => request({
url: `/system/user/queryTenantAdminNumCreatedByDSK/${tenantId}`,
method: "get"
})
......@@ -337,6 +337,15 @@ export function getUipIdByCid(param) {
})
}
//城投平台导出
export function urbanInvestmentExport(param) {
return request({
url: '/urbanInvestment/export',
method: 'POST',
data: param
})
}
......
......@@ -230,10 +230,9 @@ let getImportantDetail = function getImportantDetail(param) {
})
}
//项目清单导出
let radarExport = function radarExport(param) {
return request({
url: '/radar/export/important',
url: '/radar/importantPage/export',
method: 'post',
data: param
})
......@@ -269,4 +268,4 @@ export default {
tenderDetail,
tenderPage,
getUipIdByCid
}
\ No newline at end of file
}
......@@ -26,6 +26,16 @@
opacity: 0;
}
.list-enter-active,
.list-leave-active {
transition: all 0.5s ease;
}
.list-enter,
.list-leave-to {
opacity: 0;
transform: translateX(50px);
}
.el-message {
z-index: 3000 !important;
}
......@@ -11,7 +11,7 @@ body {
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
Microsoft YaHei, Arial, sans-serif;
Microsoft YaHei, Arial, sans-serif;
}
label {
......@@ -106,7 +106,7 @@ aside {
line-height: 32px;
font-size: 16px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
color: #2c3e50;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
......@@ -149,11 +149,11 @@ aside {
padding-right: 20px;
transition: 600ms ease position;
background: linear-gradient(
90deg,
rgba(32, 182, 249, 1) 0%,
rgba(32, 182, 249, 1) 0%,
rgba(33, 120, 241, 1) 100%,
rgba(33, 120, 241, 1) 100%
90deg,
rgba(32, 182, 249, 1) 0%,
rgba(32, 182, 249, 1) 0%,
rgba(33, 120, 241, 1) 100%,
rgba(33, 120, 241, 1) 100%
);
.subtitle {
......@@ -229,9 +229,9 @@ li {
.app-main {
position: relative;
background-color: #f5f5f5;
>div{
width: calc(100% - 48px);
}
>div{
width: calc(100% - 48px);
}
}
.app-container {
margin: 16px 24px;
......@@ -246,7 +246,7 @@ li {
}
}
.el-input__inner::placeholder {
color: rgba(35, 35, 35, 0.8) !important;
color: rgba(35, 35, 35, 0.4) !important;
}
.el-select .el-input .el-select__caret {
color: #232323;
......@@ -322,14 +322,14 @@ li {
.table-item {
width: 100%;
.el-table {
font-size: 13px;
font-size: 14px;
color: #232323;
th {
font-size: 13px !important;
font-weight: 400 !important;
}
td {
font-size: 13px;
font-size: 14px;
}
.cell {
padding-right: 12px !important;
......
......@@ -145,7 +145,8 @@
}
.el-table .el-dropdown, .el-icon-arrow-down {
font-size: 12px;
color: #232323;
font-size: 14px;
}
.el-tree-node__content > .el-checkbox {
......
<template>
<div class="dsk-json-editor">
<json-editor-vue class="dsk-json-editor-ins" v-model="modelValue" ref="dskJsonEditor" :mode.sync="mode" :readOnly="readOnly"
@input="jsonChange"></json-editor-vue>
</div>
</template>
<script>
import JsonEditorVue from 'json-editor-vue';
import { jsonEscape, jsonTraversal } from "@/utils";
export default {
name: "dskJsonEditor",
components: {
JsonEditorVue
},
props: {
jsonValue: {
required: true,
type: [Object, String],
default: ""
},
defaultMode: {
required: true,
type: [String],
default: "text"
},
jsonReadOnly: {
required: true,
type: [Boolean],
default: false
}
},
watch: {
jsonValue: {
handler(newValue) {
this.modelValue = newValue;
},
deep: true
}
},
data() {
return {
modelValue: this.jsonValue,
mode: this.defaultMode,
readOnly: this.jsonReadOnly
};
},
//可访问data属性
created() {
},
//计算集
computed: {
},
//方法集
methods: {
validateJson() {
return new Promise((resolve, reject) => {
try {
let isPass = false;
// 验证通过
if (!this.$refs["dskJsonEditor"].jsonEditor.validate()) {
isPass = true;
let jsonText = this.modelValue;
// 初始默认对象
if (Object.prototype.toString.call(jsonText) == "[object Object]") {
// 对象转为json字符串
jsonText = JSON.stringify(jsonText);
}
// 转换字符串 去除空格 换行符
jsonText = jsonEscape(jsonText);
// 特殊字符识别编码
jsonText = JSON.stringify(jsonTraversal(JSON.parse(jsonText)));
console.log(jsonText);
return resolve({ isPass, value: jsonText });
}
resolve({ isPass });
} catch (error) {
console.log(error);
reject(error);
}
});
},
jsonChange(e) {
try {
this.$emit("jsonChange", e);
} catch (error) {
console.log(error);
}
}
},
}
</script>
<style lang="scss" scoped>
.dsk-json-editor {
width: 100%;
height: 100%;
box-sizing: border-box;
::v-deep .dsk-json-editor-ins {
width: 100%;
height: 100%;
.jsoneditor-vue {
width: 100%;
height: 100%;
}
.jsoneditor-poweredBy {
display: none;
}
}
}
</style>
......@@ -3,9 +3,9 @@
<div class="table-item">
<el-table v-if="tableDataTotal>0" class="fixed-table" :class="headerFixed ? 'headerFixed':''" v-loading="tableLoading" :data="tableData"
element-loading-text="Loading" ref="tableRef" border fit highlight-current-row v-sticky-header.always="stickyHeader"
:default-sort="defaultSort?defaultSort:{}" @sort-change="sortChange" @selection-change="selectionChange">
:default-sort="defaultSort?defaultSort:{}" @sort-change="sortChange" @selection-change="selectionChange" :cell-class-name="cellClassName" :cell-style="cellStyle">
<el-table-column type="selection" :width="needSelection.width ? needSelection.width : '38px'" v-if="needSelection.flag"
:fixed="needSelection.fixed" :align="needSelection.align">
:fixed="needSelection.fixed" :align="needSelection.align" :show-overflow-tooltip="needSelection.showOverflowTooltip">
</el-table-column>
<el-table-column v-if="isIndex" label="序号" :width="flexWidth(tableData)" align="left" :fixed="indexFixed" :resizable="false">
<template slot-scope="scope">{{ queryParams.pageNum * queryParams.pageSize - queryParams.pageSize + scope.$index + 1 }}</template>
......@@ -69,9 +69,18 @@ export default {
flag: false,
width: "39px",
fixed: false,
align: "left"
align: "left",
showOverflowTooltip: false
})
},
cellClassName: {
type: Function,
default: () => () => { }
},
cellStyle: {
type: Function,
default: () => () => { }
},
// 吸顶偏移量
stickyHeader: {
type: Object,
......
......@@ -73,11 +73,8 @@ export default {
};
},
computed: {
visitedViews: {
get() {
return this.$store.state.tagsView.visitedViews;
},
set() { }
visitedViews() {
return this.$store.state.tagsView.visitedViews;
},
iconName() {
return function (val) {
......@@ -105,7 +102,6 @@ export default {
},
watch: {
$route() {
// console.log(this.$route);
this.addTags();
this.moveToCurrentTag();
this.getviews();
......@@ -118,10 +114,11 @@ export default {
}
},
},
mounted() {
this.initTags();
this.addTags();
// this.getviews()
created() {
this.$nextTick(() => {
this.initTags();
this.addTags();
});
},
methods: {
getviews() {
......
import Vue from 'vue';
import VCA from '@vue/composition-api' //composition APi
import Cookies from 'js-cookie';
......@@ -8,6 +9,7 @@ import './assets/styles/element-variables.scss';
import "@/assets/styles/common.css";
import '@/assets/styles/index.scss'; // global css
import '@/assets/styles/ruoyi.scss'; // ruoyi css
import App from './App';
import store from './store';
import router from './router';
......@@ -22,6 +24,7 @@ import './permission'; // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
// 分页组件
import Pagination from "@/components/Pagination";
// 自定义表格工具组件
......@@ -61,6 +64,7 @@ Vue.component('FileUpload', FileUpload);
Vue.component('ImageUpload', ImageUpload);
Vue.component('ImagePreview', ImagePreview);
Vue.use(VCA);
Vue.use(horizontalScroll);
Vue.use(elTableSticky);
Vue.use(directive);
......
import router from './router'
import store from './store'
import { Message } from 'element-ui'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import { getToken } from '@/utils/auth'
import { isRelogin } from '@/utils/request'
import router from './router';
import store from './store';
import { Message } from 'element-ui';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import { getToken } from '@/utils/auth';
import { isRelogin } from '@/utils/request';
NProgress.configure({ showSpinner: false })
NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register']
const whiteList = ['/login', '/register'];
router.beforeEach((to, from, next) => {
NProgress.start()
NProgress.start();
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
// tab页签title
const { tabTitle, url } = to.query;
if (tabTitle) to.meta.title = decodeURIComponent(tabTitle);
if (!tabTitle && to.meta.isSubSystem && url) to.meta.title = decodeURIComponent(url);
to.meta.title && store.dispatch('settings/setTitle', to.meta.title);
/* has token*/
if (to.path === '/login') {
next({ path: '/' })
NProgress.done()
next({ path: '/' });
NProgress.done();
} else {
if (store.getters.roles.length === 0) {
isRelogin.show = true
isRelogin.show = true;
// 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(() => {
isRelogin.show = false
isRelogin.show = false;
store.dispatch('GenerateRoutes').then(accessRoutes => {
// 根据roles权限生成可访问的路由表
router.addRoutes(accessRoutes) // 动态添加可访问路由表
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
})
router.addRoutes(accessRoutes); // 动态添加可访问路由表
next({ ...to, replace: true }); // hack方法 确保addRoutes已完成
});
}).catch(err => {
store.dispatch('LogOut').then(() => {
Message.error(err)
sessionStorage.removeItem('views')
next({ path: '/' })
})
})
store.dispatch('LogOut').then(() => {
Message.error(err);
sessionStorage.removeItem('views');
next({ path: '/' });
});
});
} else {
next()
next();
}
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入
next()
next();
} else {
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done()
next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
NProgress.done();
}
}
})
});
router.afterEach(() => {
NProgress.done()
})
NProgress.done();
});
import store from '@/store'
import store from '@/store';
import router from '@/router';
import { paramsToQuery } from "@/utils/";
export default {
// 刷新当前tab页签
......@@ -15,12 +16,12 @@ export default {
});
}
return store.dispatch('tagsView/delCachedView', obj).then(() => {
const { path, query } = obj
const { path, query } = obj;
router.replace({
path: '/redirect' + path,
query: query
})
})
});
});
},
// 关闭当前tab页签,打开新页签
closeOpenPage(obj) {
......@@ -33,9 +34,9 @@ export default {
closePage(obj) {
if (obj === undefined) {
return store.dispatch('tagsView/delView', router.currentRoute).then(({ visitedViews }) => {
const latestView = visitedViews.slice(-1)[0]
const latestView = visitedViews.slice(-1)[0];
if (latestView) {
return router.push(latestView.fullPath)
return router.push(latestView.fullPath);
}
return router.push('/');
});
......@@ -59,13 +60,16 @@ export default {
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
},
// 添加tab页签
openPage(title, url, params) {
var obj = { path: url, meta: { title: title } }
store.dispatch('tagsView/addView', obj);
async openPage(title, url, params) {
const obj = { path: url, fullPath: url, query: params, meta: { title: title } };
if (params && Object.keys(params).length) {
obj.fullPath = `${obj.path}${paramsToQuery(params) ? "?" + paramsToQuery(params) : ""}`;
}
await store.dispatch('tagsView/addView', obj);
return router.push({ path: url, query: params });
},
// 修改tab页签
updatePage(obj) {
return store.dispatch('tagsView/updateVisitedView', obj);
}
}
};
This diff is collapsed.
import auth from '@/plugins/auth'
import router, { constantRoutes, dynamicRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView'
import InnerLink from '@/layout/components/InnerLink'
import auth from '@/plugins/auth';
import router, { constantRoutes, dynamicRoutes } from '@/router';
import { getRouters } from '@/api/menu';
import Layout from '@/layout/index';
import ParentView from '@/components/ParentView';
import InnerLink from '@/layout/components/InnerLink';
const permission = {
state: {
......@@ -15,17 +15,17 @@ const permission = {
},
mutations: {
SET_ROUTES: (state, routes) => {
state.addRoutes = routes
state.routes = constantRoutes.concat(routes)
state.addRoutes = routes;
state.routes = constantRoutes.concat(routes);
},
SET_DEFAULT_ROUTES: (state, routes) => {
state.defaultRoutes = constantRoutes.concat(routes)
state.defaultRoutes = constantRoutes.concat(routes);
},
SET_TOPBAR_ROUTES: (state, routes) => {
state.topbarRouters = routes
state.topbarRouters = routes;
},
SET_SIDEBAR_ROUTERS: (state, routes) => {
state.sidebarRouters = routes
state.sidebarRouters = routes;
},
},
actions: {
......@@ -34,100 +34,108 @@ const permission = {
return new Promise(resolve => {
// 向后端请求路由数据
getRouters().then(res => {
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
const sdata = JSON.parse(JSON.stringify(res.data));
const rdata = JSON.parse(JSON.stringify(res.data));
const sidebarRoutes = filterAsyncRouter(sdata);
const rewriteRoutes = filterAsyncRouter(rdata, false, true);
const asyncRoutes = filterDynamicRoutes(dynamicRoutes);
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true });
router.addRoutes(asyncRoutes);
commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
commit('SET_TOPBAR_ROUTES', sidebarRoutes)
resolve(rewriteRoutes)
})
})
commit('SET_ROUTES', rewriteRoutes);
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes));
commit('SET_DEFAULT_ROUTES', sidebarRoutes);
commit('SET_TOPBAR_ROUTES', sidebarRoutes);
resolve(rewriteRoutes);
});
});
}
}
}
};
// 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
return asyncRouterMap.filter(route => {
if (type && route.children) {
route.children = filterChildren(route.children)
route.children = filterChildren(route.children);
}
// query默认参数转换
if (route.query) {
try {
route.query = JSON.parse(route.query);
} catch (error) {
}
}
if (route.component) {
// Layout ParentView 组件特殊处理
if (route.component === 'Layout') {
route.component = Layout
route.component = Layout;
} else if (route.component === 'ParentView') {
route.component = ParentView
route.component = ParentView;
} else if (route.component === 'InnerLink') {
route.component = InnerLink
route.component = InnerLink;
} else {
route.component = loadView(route.component)
route.component = loadView(route.component);
}
}
if (route.children != null && route.children && route.children.length) {
route.children = filterAsyncRouter(route.children, route, type)
route.children = filterAsyncRouter(route.children, route, type);
} else {
delete route['children']
delete route['redirect']
delete route['children'];
delete route['redirect'];
}
return true
})
return true;
});
}
function filterChildren(childrenMap, lastRouter = false) {
var children = []
var children = [];
childrenMap.forEach((el, index) => {
if (el.children && el.children.length) {
if (el.component === 'ParentView' && !lastRouter) {
el.children.forEach(c => {
c.path = el.path + '/' + c.path
c.path = el.path + '/' + c.path;
if (c.children && c.children.length) {
children = children.concat(filterChildren(c.children, c))
return
children = children.concat(filterChildren(c.children, c));
return;
}
children.push(c)
})
return
children.push(c);
});
return;
}
}
if (lastRouter) {
el.path = lastRouter.path + '/' + el.path
el.path = lastRouter.path + '/' + el.path;
}
children = children.concat(el)
})
return children
children = children.concat(el);
});
return children;
}
// 动态路由遍历,验证是否具备权限
export function filterDynamicRoutes(routes) {
const res = []
const res = [];
routes.forEach(route => {
if (route.permissions) {
if (auth.hasPermiOr(route.permissions)) {
res.push(route)
res.push(route);
}
} else if (route.roles) {
if (auth.hasRoleOr(route.roles)) {
res.push(route)
res.push(route);
}
}
})
return res
});
return res;
}
export const loadView = (view) => {
if (process.env.NODE_ENV === 'development') {
return (resolve) => require([`@/views/${view}`], resolve)
return (resolve) => require([`@/views/${view}`], resolve);
} else {
// 使用 import 实现生产环境的路由懒加载
return () => import(`@/views/${view}`)
return () => import(`@/views/${view}`);
}
}
};
export default permission
export default permission;
......@@ -3,227 +3,227 @@ const state = {
visitedViews: [],
cachedViews: [],
iframeViews: []
}
};
const mutations = {
ADD_IFRAME_VIEW: (state, view) => {
if (state.iframeViews.some(v => v.fullPath === view.fullPath)) return
if (state.iframeViews.some(v => v.fullPath === view.fullPath)) return;
state.iframeViews.push(
Object.assign({}, view, {
title: view.meta.title || 'no-name'
})
)
);
},
ADD_VISITED_VIEW: (state, view) => {
if (state.visitedViews.some(v => v.fullPath === view.fullPath)) return
if (state.visitedViews.some(v => v.fullPath === view.fullPath)) return;
state.visitedViews.push(
Object.assign({}, view, {
title: view.meta.title || 'no-name'
})
)
);
},
ADD_CACHED_VIEW: (state, view) => {
if (state.cachedViews.includes(view.name)) return
if (state.cachedViews.includes(view.name)) return;
if (view.meta && !view.meta.noCache) {
state.cachedViews.push(view.name)
state.cachedViews.push(view.name);
}
},
DEL_VISITED_VIEW: (state, view) => {
for (const [i, v] of state.visitedViews.entries()) {
if (v.fullPath === view.fullPath) {
state.visitedViews.splice(i, 1)
break
state.visitedViews.splice(i, 1);
break;
}
}
state.iframeViews = state.iframeViews.filter(item => item.fullPath !== view.fullPath)
state.iframeViews = state.iframeViews.filter(item => item.fullPath !== view.fullPath);
},
DEL_IFRAME_VIEW: (state, view) => {
state.iframeViews = state.iframeViews.filter(item => item.fullPath !== view.fullPath)
state.iframeViews = state.iframeViews.filter(item => item.fullPath !== view.fullPath);
},
DEL_CACHED_VIEW: (state, view) => {
const index = state.cachedViews.indexOf(view.name)
index > -1 && state.cachedViews.splice(index, 1)
const index = state.cachedViews.indexOf(view.name);
index > -1 && state.cachedViews.splice(index, 1);
},
DEL_OTHERS_VISITED_VIEWS: (state, view) => {
state.visitedViews = state.visitedViews.filter(v => {
return v.meta.affix || v.fullPath === view.fullPath
})
state.iframeViews = state.iframeViews.filter(item => item.fullPath === view.fullPath)
return v.meta.affix || v.fullPath === view.fullPath;
});
state.iframeViews = state.iframeViews.filter(item => item.fullPath === view.fullPath);
},
DEL_OTHERS_CACHED_VIEWS: (state, view) => {
const index = state.cachedViews.indexOf(view.name)
const index = state.cachedViews.indexOf(view.name);
if (index > -1) {
state.cachedViews = state.cachedViews.slice(index, index + 1)
state.cachedViews = state.cachedViews.slice(index, index + 1);
} else {
state.cachedViews = []
state.cachedViews = [];
}
},
DEL_ALL_VISITED_VIEWS: state => {
// keep affix tags
const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
state.visitedViews = affixTags
state.iframeViews = []
const affixTags = state.visitedViews.filter(tag => tag.meta.affix);
state.visitedViews = affixTags;
state.iframeViews = [];
},
DEL_ALL_CACHED_VIEWS: state => {
state.cachedViews = []
state.cachedViews = [];
},
UPDATE_VISITED_VIEW: (state, view) => {
for (let v of state.visitedViews) {
if (v.fullPath === view.fullPath) {
v = Object.assign(v, view)
break
v = Object.assign(v, view);
break;
}
}
},
DEL_RIGHT_VIEWS: (state, view) => {
const index = state.visitedViews.findIndex(v => v.fullPath === view.fullPath)
const index = state.visitedViews.findIndex(v => v.fullPath === view.fullPath);
if (index === -1) {
return
return;
}
state.visitedViews = state.visitedViews.filter((item, idx) => {
if (idx <= index || (item.meta && item.meta.affix)) {
return true
return true;
}
const i = state.cachedViews.indexOf(item.name)
const i = state.cachedViews.indexOf(item.name);
if (i > -1) {
state.cachedViews.splice(i, 1)
state.cachedViews.splice(i, 1);
}
if(item.meta.link) {
const fi = state.iframeViews.findIndex(v => v.fullPath === item.fullPath)
state.iframeViews.splice(fi, 1)
if (item.meta.link) {
const fi = state.iframeViews.findIndex(v => v.fullPath === item.fullPath);
state.iframeViews.splice(fi, 1);
}
return false
})
return false;
});
},
DEL_LEFT_VIEWS: (state, view) => {
const index = state.visitedViews.findIndex(v => v.fullPath === view.fullPath)
const index = state.visitedViews.findIndex(v => v.fullPath === view.fullPath);
if (index === -1) {
return
return;
}
state.visitedViews = state.visitedViews.filter((item, idx) => {
if (idx >= index || (item.meta && item.meta.affix)) {
return true
return true;
}
const i = state.cachedViews.indexOf(item.name)
const i = state.cachedViews.indexOf(item.name);
if (i > -1) {
state.cachedViews.splice(i, 1)
state.cachedViews.splice(i, 1);
}
if(item.meta.link) {
const fi = state.iframeViews.findIndex(v => v.fullPath === item.fullPath)
state.iframeViews.splice(fi, 1)
if (item.meta.link) {
const fi = state.iframeViews.findIndex(v => v.fullPath === item.fullPath);
state.iframeViews.splice(fi, 1);
}
return false
})
return false;
});
}
}
};
const actions = {
addView({ dispatch }, view) {
dispatch('addVisitedView', view)
dispatch('addCachedView', view)
dispatch('addVisitedView', view);
dispatch('addCachedView', view);
},
addIframeView({ commit }, view) {
commit('ADD_IFRAME_VIEW', view)
commit('ADD_IFRAME_VIEW', view);
},
addVisitedView({ commit }, view) {
commit('ADD_VISITED_VIEW', view)
commit('ADD_VISITED_VIEW', view);
},
addCachedView({ commit }, view) {
commit('ADD_CACHED_VIEW', view)
commit('ADD_CACHED_VIEW', view);
},
delView({ dispatch, state }, view) {
return new Promise(resolve => {
dispatch('delVisitedView', view)
dispatch('delCachedView', view)
dispatch('delVisitedView', view);
dispatch('delCachedView', view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews]
})
})
});
});
},
delVisitedView({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_VISITED_VIEW', view)
resolve([...state.visitedViews])
})
commit('DEL_VISITED_VIEW', view);
resolve([...state.visitedViews]);
});
},
delIframeView({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_IFRAME_VIEW', view)
resolve([...state.iframeViews])
})
commit('DEL_IFRAME_VIEW', view);
resolve([...state.iframeViews]);
});
},
delCachedView({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_CACHED_VIEW', view)
resolve([...state.cachedViews])
})
commit('DEL_CACHED_VIEW', view);
resolve([...state.cachedViews]);
});
},
delOthersViews({ dispatch, state }, view) {
return new Promise(resolve => {
dispatch('delOthersVisitedViews', view)
dispatch('delOthersCachedViews', view)
dispatch('delOthersVisitedViews', view);
dispatch('delOthersCachedViews', view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews]
})
})
});
});
},
delOthersVisitedViews({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_OTHERS_VISITED_VIEWS', view)
resolve([...state.visitedViews])
})
commit('DEL_OTHERS_VISITED_VIEWS', view);
resolve([...state.visitedViews]);
});
},
delOthersCachedViews({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_OTHERS_CACHED_VIEWS', view)
resolve([...state.cachedViews])
})
commit('DEL_OTHERS_CACHED_VIEWS', view);
resolve([...state.cachedViews]);
});
},
delAllViews({ dispatch, state }, view) {
return new Promise(resolve => {
dispatch('delAllVisitedViews', view)
dispatch('delAllCachedViews', view)
dispatch('delAllVisitedViews', view);
dispatch('delAllCachedViews', view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews]
})
})
});
});
},
delAllVisitedViews({ commit, state }) {
return new Promise(resolve => {
commit('DEL_ALL_VISITED_VIEWS')
resolve([...state.visitedViews])
})
commit('DEL_ALL_VISITED_VIEWS');
resolve([...state.visitedViews]);
});
},
delAllCachedViews({ commit, state }) {
return new Promise(resolve => {
commit('DEL_ALL_CACHED_VIEWS')
resolve([...state.cachedViews])
})
commit('DEL_ALL_CACHED_VIEWS');
resolve([...state.cachedViews]);
});
},
updateVisitedView({ commit }, view) {
commit('UPDATE_VISITED_VIEW', view)
commit('UPDATE_VISITED_VIEW', view);
},
delRightTags({ commit }, view) {
return new Promise(resolve => {
commit('DEL_RIGHT_VIEWS', view)
resolve([...state.visitedViews])
})
commit('DEL_RIGHT_VIEWS', view);
resolve([...state.visitedViews]);
});
},
delLeftTags({ commit }, view) {
return new Promise(resolve => {
commit('DEL_LEFT_VIEWS', view)
resolve([...state.visitedViews])
})
commit('DEL_LEFT_VIEWS', view);
resolve([...state.visitedViews]);
});
},
}
};
export default {
namespaced: true,
state,
mutations,
actions
}
};
/*
* @Author: thy
* @Date: 2023-11-08 09:28:17
* @LastEditors: thy
* @LastEditTime: 2023-11-17 09:36:01
* @Description: file content
* @FilePath: \dsk-operate-ui\src\utils\iframeTools.js
*/
import { dskAccessToken } from '@/api/common';
import { getUrlSearchQuery, isUrl, paramsToQuery } from "@/utils/";
import { Message } from "element-ui";
/**
* iframe嵌入参数处理
*/
class IframeTools {
queryParams = {};
pluginDomain = "";
subSystemIframe = null;
refreshTimer = null;
count = 0;
authToken = "";
origin = location.origin;
isOuter = false;
/**
* 插件域名地址
* @param {string} pluginDomain 默认当前环境变量VUE_APP_SUB_SYSTEM_ADDRESS
* @param {HTMLIFrameElement} subSystemIframe 子系统iframe dom节点
* @returns
*/
constructor(subSystemIframe, pluginDomain = process.env.VUE_APP_SUB_SYSTEM_ADDRESS) {
try {
const query = getUrlSearchQuery();
if (!query.url) return Message.warning("缺少子系统目标地址");
// 传入的iframeUrl不是一个合法地址
if (!isUrl(pluginDomain)) return Message.warning("子系统源地址不合法");
// 未获取到子系统节点
if (!subSystemIframe) return Message.warning("未获取到子系统节点");
this.queryParams = query;
this.pluginDomain = pluginDomain;
this.subSystemIframe = subSystemIframe;
this.isOuter = query.isOuter && typeof JSON.parse(query.isOuter) == "boolean" ? JSON.parse(query.isOuter) : false;
// 是一个合法地址 初始化 先替换域名地址 再获取令牌并 拼接
this.init();
} catch (error) {
throw new Error(error);
}
}
/**
* 初始化类
*/
async init() {
try {
// 不是合法url的情况下需要拼接完整路径 例如path /xxxx/xxx
!isUrl(this.queryParams.url) ? this.queryParams.url = `${this.pluginDomain}${this.queryParams.url}` : null;
// 获取到子系统加载地址query参数
const subSystemParams = getUrlSearchQuery(this.queryParams.url);
// 获取子系统path
const subSystemUrl = new URL(this.queryParams.url);
// 以环境文件地址为准 拼接子系统查询参数
let url = this.isOuter ? this.queryParams.url : `${this.pluginDomain}${subSystemUrl.pathname == "/" ? "" : subSystemUrl.pathname}`;
// 子系统地址带有查询参数 处理
Object.keys(subSystemParams).length ? url = `${url}?${paramsToQuery(subSystemParams)}` : null;
// 获取授权 token
const { accessToken, expire } = await this.getSubSystemToken();
// 拼接授权地址
if (accessToken) {
this.authToken = accessToken;
const query = {
initTime: new Date().valueOf(),
ak: accessToken,
uid: accessToken,
origin: this.origin
};
url = `${url}${paramsToQuery(query) ? "?" + paramsToQuery(query) : ""}`;
this.queryParams.url = url;
console.log(this.queryParams.url);
// 倒计时刷新token 正常误差10s 提前获取
this.setTokenRefresh(expire * 1000 - 1000 * 10);
}
} catch (error) {
console.log(error);
Message.warning(error.message ? error.message : (typeof error == "string") ? error : "子系统初始化错误");
}
}
/**
* 获取子系统token
*/
async getSubSystemToken() {
try {
const result = await dskAccessToken();
if (result.code == 200) {
return result.data;
}
throw new Error("子系统获取授权失败");
} catch (error) {
throw error;
}
}
/**
* 根据服务端返回过期时间刷新token有效期
*/
setTokenRefresh(expire) {
if (!expire) throw new Error("令牌无有效的刷新时间");
return new Promise((resolve, reject) => {
// 只允许出现一个定时器实例状态
this.clearRefreshTimer();
this.refreshTimer = setTimeout(async () => {
const result = await this.getSubSystemToken();
if (result.accessToken) {
this.count = 0;
this.authToken = result.accessToken;
this.setTokenRefresh(result.expire);
resolve(result);
} else {
// 请求失败进行重试 清理定时器
this.clearRefreshTimer();
// 尝试最多3次刷新 重新调取接口
while (this.count < 3) {
// 重试次数大于等于三次 停止刷新
if (this.count >= 3) {
return reject("子系统令牌刷新失败,请稍后重试");
}
this.count++;
Message.warning(`授权失败,正在尝试第 ${this.count} 次刷新令牌,请勿进行操作`);
const refreshAuth = await this.getSubSystemToken();
if (refreshAuth.accessToken) {
this.count = 0;
this.authToken = refreshAuth.accessToken;
this.setTokenRefresh(refreshAuth.expire);
resolve(refreshAuth);
}
}
}
}, expire);
});
}
clearRefreshTimer() {
clearTimeout(this.refreshTimer);
this.refreshTimer = null;
}
}
export default IframeTools;
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<template>
<div class="head-form-new" :class="headerFixed ? 'headerFixed':''">
<div class="common-title" v-if="title">{{ title }}</div>
<div class="common-title" v-if="title && title !='集团招标'">{{ title }}</div>
<div class="flex-box query-box">
<div class="flex-box query-params">
<div class="headForm-from">
......@@ -27,7 +27,7 @@
<transition name="fade-position" appear mode="out-in">
<span v-if="!form.hover && !form.value">搜索</span>
<el-input v-model="form.value" :placeholder="form.placeholder ? form.placeholder : '输入关键词查询'"
:style="form.width?'width:'+form.width+'px':'width:238px'" @focus="searchFocus($event,form)" @blur="searchBlur($event,form)"
:style="form.width?'width:'+form.width+'px':'width:238px'" @focus.stop="searchFocus($event,form)" @blur.stop="searchBlur($event,form)"
@input="value => searchInput(value,form)" v-else @keydown.native.enter="changeSelect">
<template slot="suffix">
<transition mode="out-in" appear name="fade">
......@@ -78,7 +78,7 @@
</template>
<div v-else class="flex-box">
<span class="flex-box ability-total" v-if="isTotal">共有{{ total }}条</span>
<span class="flex-box ability-excel" v-hasPermi="['combine:info:export:win:bid','combine:info:export:bid']" v-if="isExcel && title ==='集团业绩'"
<span class="flex-box ability-excel" v-hasPermi="['combine:info:export:win:bid','combine:info:export:bid']" v-if="isExcel && title ==='集团业绩'|| title ==='集团业绩' "
@click="clickEXCEL"><img src="@/assets/images/ability_excel.png">导出EXCEL</span>
<span class="flex-box ability-excel" v-else @click="clickEXCEL"><img src="@/assets/images/ability_excel.png">导出EXCEL</span>
</div>
......@@ -296,7 +296,7 @@ export default {
this.$emit('handle-search');
},
clickEXCEL() {
if (this.title === '集团业绩') {
if (this.title === '集团业绩' || this.title === '集团招标' || this.title === '集团成员') {
this.$emit('handle-excel');
} else {
this.$message({
......
......@@ -278,13 +278,13 @@ export default {
this.sideRoute[2].children[7].disabled = true;
}
break;
case 'customer':
case 'customerV1':
if (arr[i][j] < 1) {
this.sideRoute[3].children[0].disabled = true;
}
break;
case 'supplier':
case 'supplierV1':
if (arr[i][j] < 1) {
this.sideRoute[3].children[1].disabled = true;
}
......@@ -369,7 +369,6 @@ export default {
if (this.sideRoute1[i].children) {
for (var j in this.sideRoute1[i].children) {
if (item.title == this.sideRoute1[i].children[j].title) {
console.log(this.sideRoute1[i].children[j]);
obj.pathName = this.sideRoute1[i].children[j].pathName;
}
}
......
......@@ -377,6 +377,7 @@ export default {
<style lang="scss" scoped>
.part-container {
padding: 0;
margin: 0 24px;
}
.part-main {
margin-top: 12px;
......
......@@ -184,7 +184,7 @@ export default {
showMore: false,
showState: false,
graphList: [
{ id: 1, name: '业务往来', isShow: true, intro: [{ id: 101, name: '客户', val: 0, category: 'global', field: 'customer' }, { id: 102, name: '供应商', val: 0, category: 'global', field: 'supplier' }], ico: require('@/assets/images/detail/overview/company_ywwl.png') },
{ id: 1, name: '业务往来', isShow: true, intro: [{ id: 101, name: '客户', val: 0, category: 'global', field: 'customerV1' }, { id: 102, name: '供应商', val: 0, category: 'global', field: 'supplierV1' }], ico: require('@/assets/images/detail/overview/company_ywwl.png') },
{ id: 2, name: '商机线索', isShow: true, intro: [{ id: 201, name: '专项债项目', val: 0, category: 'performance', field: 'specialDebt' }, { id: 202, name: '招标计划', val: 0, category: 'performance', field: 'bidPlan' }], ico: require('@/assets/images/detail/overview/company_sjxs.png') },
{ id: 3, name: '城投拿地', isShow: true, intro: [{ id: 301, name: '土地交易', val: 0, category: 'global', field: 'landInfo' }, { id: 302, name: '行政许可', val: 0, category: 'business', field: 'adminLicensing' }], ico: require('@/assets/images/detail/overview/company_ctnd.png') },
{ id: 4, name: '对外投资', isShow: true, intro: [{ id: 401, name: '企业经营实力展现' }], ico: require('@/assets/images/detail/overview/company_dwtz.png') },
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment