feat: 识别excel 时间类型

This commit is contained in:
taojinlong 2021-06-01 14:18:24 +08:00
commit 89c758a50a
29 changed files with 835 additions and 522 deletions

View File

@ -31,6 +31,8 @@ public class DynamicMenuDto implements Serializable {
private Boolean isPlugin;
private Boolean noLayout;
private List<DynamicMenuDto> children;
}

View File

@ -14,10 +14,10 @@ import io.dataease.commons.utils.BeanUtils;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.ServletUtils;
import io.dataease.plugins.config.SpringContextUtil;
/*import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;*/
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
@ -110,7 +110,7 @@ public class AuthServer implements AuthApi {
SysUserEntity userById = authUserService.getUserById(4L);
String nickName = userById.getNickName();
// System.out.println(nickName);
Map<String, DisPlayXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(DisPlayXpackService.class);
/* Map<String, DisPlayXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(DisPlayXpackService.class);
for (Map.Entry entry : beansOfType.entrySet()) {
Object key = entry.getKey();
DisPlayXpackService value = (DisPlayXpackService)entry.getValue();
@ -118,7 +118,7 @@ public class AuthServer implements AuthApi {
String name = entry.getValue().getClass().getName();
System.out.println("key: "+ key + ", value: "+ name);
}
}*/
return "apple";
}
}

View File

@ -73,6 +73,7 @@ public class DynamicMenuServiceImpl implements DynamicMenuService {
dynamicMenuDto.setPermission(sysMenu.getPermission());
dynamicMenuDto.setHidden(sysMenu.getHidden());
dynamicMenuDto.setIsPlugin(true);
dynamicMenuDto.setNoLayout(!!sysMenu.isNoLayout());
return dynamicMenuDto;
}

View File

@ -9,10 +9,14 @@ public class MyPlugin implements Serializable {
private String name;
private String store;
private Boolean free;
private Integer cost;
private String category;
private String descript;
private String version;
@ -29,8 +33,6 @@ public class MyPlugin implements Serializable {
private String moduleName;
private String beanName;
private String icon;
private static final long serialVersionUID = 1L;

View File

@ -234,6 +234,76 @@ public class MyPluginExample {
return (Criteria) this;
}
public Criteria andStoreIsNull() {
addCriterion("store is null");
return (Criteria) this;
}
public Criteria andStoreIsNotNull() {
addCriterion("store is not null");
return (Criteria) this;
}
public Criteria andStoreEqualTo(String value) {
addCriterion("store =", value, "store");
return (Criteria) this;
}
public Criteria andStoreNotEqualTo(String value) {
addCriterion("store <>", value, "store");
return (Criteria) this;
}
public Criteria andStoreGreaterThan(String value) {
addCriterion("store >", value, "store");
return (Criteria) this;
}
public Criteria andStoreGreaterThanOrEqualTo(String value) {
addCriterion("store >=", value, "store");
return (Criteria) this;
}
public Criteria andStoreLessThan(String value) {
addCriterion("store <", value, "store");
return (Criteria) this;
}
public Criteria andStoreLessThanOrEqualTo(String value) {
addCriterion("store <=", value, "store");
return (Criteria) this;
}
public Criteria andStoreLike(String value) {
addCriterion("store like", value, "store");
return (Criteria) this;
}
public Criteria andStoreNotLike(String value) {
addCriterion("store not like", value, "store");
return (Criteria) this;
}
public Criteria andStoreIn(List<String> values) {
addCriterion("store in", values, "store");
return (Criteria) this;
}
public Criteria andStoreNotIn(List<String> values) {
addCriterion("store not in", values, "store");
return (Criteria) this;
}
public Criteria andStoreBetween(String value1, String value2) {
addCriterion("store between", value1, value2, "store");
return (Criteria) this;
}
public Criteria andStoreNotBetween(String value1, String value2) {
addCriterion("store not between", value1, value2, "store");
return (Criteria) this;
}
public Criteria andFreeIsNull() {
addCriterion("`free` is null");
return (Criteria) this;
@ -354,6 +424,76 @@ public class MyPluginExample {
return (Criteria) this;
}
public Criteria andCategoryIsNull() {
addCriterion("category is null");
return (Criteria) this;
}
public Criteria andCategoryIsNotNull() {
addCriterion("category is not null");
return (Criteria) this;
}
public Criteria andCategoryEqualTo(String value) {
addCriterion("category =", value, "category");
return (Criteria) this;
}
public Criteria andCategoryNotEqualTo(String value) {
addCriterion("category <>", value, "category");
return (Criteria) this;
}
public Criteria andCategoryGreaterThan(String value) {
addCriterion("category >", value, "category");
return (Criteria) this;
}
public Criteria andCategoryGreaterThanOrEqualTo(String value) {
addCriterion("category >=", value, "category");
return (Criteria) this;
}
public Criteria andCategoryLessThan(String value) {
addCriterion("category <", value, "category");
return (Criteria) this;
}
public Criteria andCategoryLessThanOrEqualTo(String value) {
addCriterion("category <=", value, "category");
return (Criteria) this;
}
public Criteria andCategoryLike(String value) {
addCriterion("category like", value, "category");
return (Criteria) this;
}
public Criteria andCategoryNotLike(String value) {
addCriterion("category not like", value, "category");
return (Criteria) this;
}
public Criteria andCategoryIn(List<String> values) {
addCriterion("category in", values, "category");
return (Criteria) this;
}
public Criteria andCategoryNotIn(List<String> values) {
addCriterion("category not in", values, "category");
return (Criteria) this;
}
public Criteria andCategoryBetween(String value1, String value2) {
addCriterion("category between", value1, value2, "category");
return (Criteria) this;
}
public Criteria andCategoryNotBetween(String value1, String value2) {
addCriterion("category not between", value1, value2, "category");
return (Criteria) this;
}
public Criteria andDescriptIsNull() {
addCriterion("descript is null");
return (Criteria) this;
@ -874,76 +1014,6 @@ public class MyPluginExample {
return (Criteria) this;
}
public Criteria andBeanNameIsNull() {
addCriterion("bean_name is null");
return (Criteria) this;
}
public Criteria andBeanNameIsNotNull() {
addCriterion("bean_name is not null");
return (Criteria) this;
}
public Criteria andBeanNameEqualTo(String value) {
addCriterion("bean_name =", value, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameNotEqualTo(String value) {
addCriterion("bean_name <>", value, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameGreaterThan(String value) {
addCriterion("bean_name >", value, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameGreaterThanOrEqualTo(String value) {
addCriterion("bean_name >=", value, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameLessThan(String value) {
addCriterion("bean_name <", value, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameLessThanOrEqualTo(String value) {
addCriterion("bean_name <=", value, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameLike(String value) {
addCriterion("bean_name like", value, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameNotLike(String value) {
addCriterion("bean_name not like", value, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameIn(List<String> values) {
addCriterion("bean_name in", values, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameNotIn(List<String> values) {
addCriterion("bean_name not in", values, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameBetween(String value1, String value2) {
addCriterion("bean_name between", value1, value2, "beanName");
return (Criteria) this;
}
public Criteria andBeanNameNotBetween(String value1, String value2) {
addCriterion("bean_name not between", value1, value2, "beanName");
return (Criteria) this;
}
public Criteria andIconIsNull() {
addCriterion("icon is null");
return (Criteria) this;

View File

@ -4,8 +4,10 @@
<resultMap id="BaseResultMap" type="io.dataease.base.domain.MyPlugin">
<id column="plugin_id" jdbcType="BIGINT" property="pluginId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="store" jdbcType="VARCHAR" property="store" />
<result column="free" jdbcType="BIT" property="free" />
<result column="cost" jdbcType="INTEGER" property="cost" />
<result column="category" jdbcType="VARCHAR" property="category" />
<result column="descript" jdbcType="VARCHAR" property="descript" />
<result column="version" jdbcType="VARCHAR" property="version" />
<result column="install_type" jdbcType="INTEGER" property="installType" />
@ -14,7 +16,6 @@
<result column="release_time" jdbcType="BIGINT" property="releaseTime" />
<result column="install_time" jdbcType="BIGINT" property="installTime" />
<result column="module_name" jdbcType="VARCHAR" property="moduleName" />
<result column="bean_name" jdbcType="VARCHAR" property="beanName" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
</resultMap>
<sql id="Example_Where_Clause">
@ -76,8 +77,8 @@
</where>
</sql>
<sql id="Base_Column_List">
plugin_id, `name`, `free`, cost, descript, version, install_type, creator, load_mybatis,
release_time, install_time, module_name, bean_name, icon
plugin_id, `name`, store, `free`, cost, category, descript, version, install_type,
creator, load_mybatis, release_time, install_time, module_name, icon
</sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.MyPluginExample" resultMap="BaseResultMap">
select
@ -110,16 +111,16 @@
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.MyPlugin">
insert into my_plugin (plugin_id, `name`, `free`,
cost, descript, version,
install_type, creator, load_mybatis,
release_time, install_time, module_name,
bean_name, icon)
values (#{pluginId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{free,jdbcType=BIT},
#{cost,jdbcType=INTEGER}, #{descript,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR},
#{installType,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{loadMybatis,jdbcType=BIT},
#{releaseTime,jdbcType=BIGINT}, #{installTime,jdbcType=BIGINT}, #{moduleName,jdbcType=VARCHAR},
#{beanName,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR})
insert into my_plugin (plugin_id, `name`, store,
`free`, cost, category, descript,
version, install_type, creator,
load_mybatis, release_time, install_time,
module_name, icon)
values (#{pluginId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{store,jdbcType=VARCHAR},
#{free,jdbcType=BIT}, #{cost,jdbcType=INTEGER}, #{category,jdbcType=VARCHAR}, #{descript,jdbcType=VARCHAR},
#{version,jdbcType=VARCHAR}, #{installType,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR},
#{loadMybatis,jdbcType=BIT}, #{releaseTime,jdbcType=BIGINT}, #{installTime,jdbcType=BIGINT},
#{moduleName,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.MyPlugin">
insert into my_plugin
@ -130,12 +131,18 @@
<if test="name != null">
`name`,
</if>
<if test="store != null">
store,
</if>
<if test="free != null">
`free`,
</if>
<if test="cost != null">
cost,
</if>
<if test="category != null">
category,
</if>
<if test="descript != null">
descript,
</if>
@ -160,9 +167,6 @@
<if test="moduleName != null">
module_name,
</if>
<if test="beanName != null">
bean_name,
</if>
<if test="icon != null">
icon,
</if>
@ -174,12 +178,18 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="store != null">
#{store,jdbcType=VARCHAR},
</if>
<if test="free != null">
#{free,jdbcType=BIT},
</if>
<if test="cost != null">
#{cost,jdbcType=INTEGER},
</if>
<if test="category != null">
#{category,jdbcType=VARCHAR},
</if>
<if test="descript != null">
#{descript,jdbcType=VARCHAR},
</if>
@ -204,9 +214,6 @@
<if test="moduleName != null">
#{moduleName,jdbcType=VARCHAR},
</if>
<if test="beanName != null">
#{beanName,jdbcType=VARCHAR},
</if>
<if test="icon != null">
#{icon,jdbcType=VARCHAR},
</if>
@ -227,12 +234,18 @@
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.store != null">
store = #{record.store,jdbcType=VARCHAR},
</if>
<if test="record.free != null">
`free` = #{record.free,jdbcType=BIT},
</if>
<if test="record.cost != null">
cost = #{record.cost,jdbcType=INTEGER},
</if>
<if test="record.category != null">
category = #{record.category,jdbcType=VARCHAR},
</if>
<if test="record.descript != null">
descript = #{record.descript,jdbcType=VARCHAR},
</if>
@ -257,9 +270,6 @@
<if test="record.moduleName != null">
module_name = #{record.moduleName,jdbcType=VARCHAR},
</if>
<if test="record.beanName != null">
bean_name = #{record.beanName,jdbcType=VARCHAR},
</if>
<if test="record.icon != null">
icon = #{record.icon,jdbcType=VARCHAR},
</if>
@ -272,8 +282,10 @@
update my_plugin
set plugin_id = #{record.pluginId,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
store = #{record.store,jdbcType=VARCHAR},
`free` = #{record.free,jdbcType=BIT},
cost = #{record.cost,jdbcType=INTEGER},
category = #{record.category,jdbcType=VARCHAR},
descript = #{record.descript,jdbcType=VARCHAR},
version = #{record.version,jdbcType=VARCHAR},
install_type = #{record.installType,jdbcType=INTEGER},
@ -282,7 +294,6 @@
release_time = #{record.releaseTime,jdbcType=BIGINT},
install_time = #{record.installTime,jdbcType=BIGINT},
module_name = #{record.moduleName,jdbcType=VARCHAR},
bean_name = #{record.beanName,jdbcType=VARCHAR},
icon = #{record.icon,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -294,12 +305,18 @@
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="store != null">
store = #{store,jdbcType=VARCHAR},
</if>
<if test="free != null">
`free` = #{free,jdbcType=BIT},
</if>
<if test="cost != null">
cost = #{cost,jdbcType=INTEGER},
</if>
<if test="category != null">
category = #{category,jdbcType=VARCHAR},
</if>
<if test="descript != null">
descript = #{descript,jdbcType=VARCHAR},
</if>
@ -324,9 +341,6 @@
<if test="moduleName != null">
module_name = #{moduleName,jdbcType=VARCHAR},
</if>
<if test="beanName != null">
bean_name = #{beanName,jdbcType=VARCHAR},
</if>
<if test="icon != null">
icon = #{icon,jdbcType=VARCHAR},
</if>
@ -336,8 +350,10 @@
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.MyPlugin">
update my_plugin
set `name` = #{name,jdbcType=VARCHAR},
store = #{store,jdbcType=VARCHAR},
`free` = #{free,jdbcType=BIT},
cost = #{cost,jdbcType=INTEGER},
category = #{category,jdbcType=VARCHAR},
descript = #{descript,jdbcType=VARCHAR},
version = #{version,jdbcType=VARCHAR},
install_type = #{installType,jdbcType=INTEGER},
@ -346,7 +362,6 @@
release_time = #{releaseTime,jdbcType=BIGINT},
install_time = #{installTime,jdbcType=BIGINT},
module_name = #{moduleName,jdbcType=VARCHAR},
bean_name = #{beanName,jdbcType=VARCHAR},
icon = #{icon,jdbcType=VARCHAR}
where plugin_id = #{pluginId,jdbcType=BIGINT}
</update>

View File

@ -2,6 +2,7 @@ package io.dataease.plugins.config;
import io.dataease.base.domain.MyPlugin;
import io.dataease.commons.utils.DeFileUtils;
import io.dataease.commons.utils.LogUtil;
import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.service.sys.PluginService;
import org.apache.commons.lang3.StringUtils;
@ -30,15 +31,22 @@ public class PluginRunner implements ApplicationRunner {
BaseGridRequest request = new BaseGridRequest();
List<MyPlugin> plugins = pluginService.query(request);
plugins.stream().forEach(plugin -> {
String name = plugin.getName();
String store = plugin.getStore();
String version = plugin.getVersion();
String versionDir = pluginDir + name + "/" + version + "/";
File fileDir = new File(versionDir);
File[] jarFiles = fileDir.listFiles(this::isPluginJar);
File jarFile = jarFiles[0];
String moduleName = plugin.getModuleName();
String fileName = moduleName + "-" + version + ".jar";
String path = pluginDir + store + "/" + fileName;
File jarFile = new File(path);
String jarPath = jarFile.getAbsolutePath();
try {
pluginService.loadJar(jarPath, plugin);
if (jarFile.exists()) {
pluginService.loadJar(jarPath, plugin);
}else {
LogUtil.error("插件错误");
}
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -0,0 +1,48 @@
package io.dataease.plugins.server;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.handler.annotation.I18n;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.auth.dto.request.XpackBaseTreeRequest;
import io.dataease.plugins.xpack.auth.dto.request.XpackSysAuthRequest;
import io.dataease.plugins.xpack.auth.dto.response.XpackSysAuthDetail;
import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO;
import org.springframework.web.bind.annotation.*;
import io.dataease.plugins.xpack.auth.service.AuthXpackService;
import java.util.List;
import java.util.Map;
@RequestMapping("/plugin/auth")
@RestController
public class XAuthServer {
@PostMapping("/authModels")
@I18n
public List<XpackVAuthModelDTO> authModels(@RequestBody XpackBaseTreeRequest request){
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
CurrentUserDto user = AuthUtils.getUser();
return sysAuthService.searchAuthModelTree(request, user.getUserId(), user.getIsAdmin());
}
@PostMapping("/authDetails")
public Map<String,List<XpackSysAuthDetail>> authDetails(@RequestBody XpackSysAuthRequest request){
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
return sysAuthService.searchAuthDetails(request);
}
@GetMapping("/authDetailsModel/{authType}")
@I18n
public List<XpackSysAuthDetail>authDetailsModel(@PathVariable String authType){
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
return sysAuthService.searchAuthDetailsModel(authType);
}
@PostMapping("/authChange")
public void authChange(@RequestBody XpackSysAuthRequest request){
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
CurrentUserDto user = AuthUtils.getUser();
sysAuthService.authChange(request, user.getUserId(), user.getUsername(), user.getIsAdmin());
}
}

View File

@ -16,7 +16,7 @@ import java.util.stream.Collectors;
@RequestMapping("/plugin/dept")
@RestController
public class DeptServer {
public class XDeptServer {
@PostMapping("/childNodes/{pid}")
public List<DeptNodeResponse> childNodes(@PathVariable("pid") Long pid){

View File

@ -3,7 +3,7 @@ package io.dataease.plugins.server;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.display.dto.response.SysSettingDto;
import io.dataease.plugins.xpack.display.service.DisPlayXpackService;
import io.dataease.plugins.xpack.display.service.DisplayXpackService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -11,20 +11,20 @@ import java.util.Map;
@RequestMapping("/api/display")
@RestController
public class DisplayServer {
public class XDisplayServer {
@GetMapping("/uiInfo")
public List<SysSettingDto> uiInfo() {
DisPlayXpackService disPlayXpackService = SpringContextUtil.getBean(DisPlayXpackService.class);
DisplayXpackService disPlayXpackService = SpringContextUtil.getBean(DisplayXpackService.class);
return disPlayXpackService.systemSettings();
}
@PostMapping(value="/save", consumes = {"multipart/form-data"})
public void saveUIInfo(@RequestPart("request") Map<String,List<SysSettingDto>> systemParameterMap, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws Exception {
DisPlayXpackService disPlayXpackService = SpringContextUtil.getBean(DisPlayXpackService.class);
DisplayXpackService disPlayXpackService = SpringContextUtil.getBean(DisplayXpackService.class);
disPlayXpackService.save(systemParameterMap, bodyFiles);
}

View File

@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
@RequestMapping("/plugin/role")
@RestController
public class RoleServer {
public class XRoleServer {
@PostMapping("/create")

View File

@ -275,16 +275,16 @@ public class DataSetTableService {
map.put("status", "warnning");
map.put("msg", Translator.get("i18n_processing_data"));
dataSetPreviewPage.setTotal(0);
}else if (datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Error.name())) {
} else if (datasetTable.getSyncStatus().equalsIgnoreCase(JobStatus.Error.name())) {
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.getByTableId(datasetTable.getId());
map.put("status", "error");
if(CollectionUtils.isNotEmpty(datasetTableTaskLogs)){
if (CollectionUtils.isNotEmpty(datasetTableTaskLogs)) {
map.put("msg", "Failed to extract data: " + datasetTableTaskLogs.get(0).getInfo());
}else {
} else {
map.put("msg", "Failed to extract data.");
}
dataSetPreviewPage.setTotal(0);
}else {
} else {
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
DatasourceRequest datasourceRequest = new DatasourceRequest();
@ -338,9 +338,9 @@ public class DataSetTableService {
}).collect(Collectors.toList());
}
if(!map.containsKey("status")){
map.put("status", "success");
}
if (!map.containsKey("status")) {
map.put("status", "success");
}
map.put("fields", fields);
map.put("data", jsonArray);
map.put("page", dataSetPreviewPage);
@ -808,7 +808,8 @@ public class DataSetTableService {
if (cellTypeEnum.equals(CellType.STRING)) {
if(cellType){ tableFiled.setFieldType("TEXT"); }
return cell.getStringCellValue();
} else if (cellTypeEnum.equals(CellType.NUMERIC)) {
}
if (cellTypeEnum.equals(CellType.NUMERIC)) {
if(HSSFDateUtil.isCellDateFormatted(cell)){
if(cellType) { tableFiled.setFieldType("DATETIME"); }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -836,11 +837,11 @@ public class DataSetTableService {
return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + "";
}
}
} else if (cellTypeEnum.equals(CellType.BOOLEAN)) {
return cell.getBooleanCellValue() ? "1" : "0";
} else {
return "";
}
if (cellTypeEnum.equals(CellType.BOOLEAN)) {
return cell.getBooleanCellValue() ? "1" : "0";
}
return "";
}
private String saveFile(MultipartFile file) throws Exception {
@ -876,20 +877,20 @@ public class DataSetTableService {
private UtilMapper utilMapper;
@QuartzScheduled(cron = "0 0/3 * * * ?")
public void updateDatasetTableStatus(){
public void updateDatasetTableStatus() {
List<QrtzSchedulerState> qrtzSchedulerStates = qrtzSchedulerStateMapper.selectByExample(null);
List<String> activeQrtzInstances = qrtzSchedulerStates.stream().filter(qrtzSchedulerState -> qrtzSchedulerState.getLastCheckinTime() + qrtzSchedulerState.getCheckinInterval() + 1000 > utilMapper.currentTimestamp()).map(QrtzSchedulerStateKey::getInstanceName).collect(Collectors.toList());
List<DatasetTable> jobStoppeddDatasetTables = new ArrayList<>();
DatasetTableExample example = new DatasetTableExample();
example.createCriteria().andSyncStatusEqualTo(JobStatus.Underway.name());
datasetTableMapper.selectByExample(example).forEach(datasetTable -> {
if(StringUtils.isEmpty(datasetTable.getQrtzInstance()) || !activeQrtzInstances.contains(datasetTable.getQrtzInstance().substring(0, datasetTable.getQrtzInstance().length() - 13))){
jobStoppeddDatasetTables.add(datasetTable);
}
});
datasetTableMapper.selectByExample(example).forEach(datasetTable -> {
if (StringUtils.isEmpty(datasetTable.getQrtzInstance()) || !activeQrtzInstances.contains(datasetTable.getQrtzInstance().substring(0, datasetTable.getQrtzInstance().length() - 13))) {
jobStoppeddDatasetTables.add(datasetTable);
}
});
if(CollectionUtils.isEmpty(jobStoppeddDatasetTables)){
if (CollectionUtils.isEmpty(jobStoppeddDatasetTables)) {
return;
}

View File

@ -81,18 +81,17 @@ public class PluginService {
DeFileUtils.deleteFile(folder);
throw new RuntimeException("缺少插件jar文件");
}
String versionDir = null;
String targetDir = null;
try {
File jarFile = jarFiles[0];
versionDir = makeVersionDir(myPlugin);
targetDir = makeTargetDir(myPlugin);
String jarPath = null;
jarPath = DeFileUtils.copy(jarFile, versionDir);
//DeFileUtils.copy(folderFile, versionDir);
jarPath = DeFileUtils.copy(jarFile, targetDir);
loadJar(jarPath, myPlugin);
myPluginMapper.insert(myPlugin);
} catch (Exception e) {
if (StringUtils.isNotEmpty(versionDir)) {
DeFileUtils.deleteFile(versionDir);
if (StringUtils.isNotEmpty(targetDir)) {
DeFileUtils.deleteFile(targetDir);
}
e.printStackTrace();
}finally {
@ -113,7 +112,7 @@ public class PluginService {
private String makeVersionDir(MyPlugin myPlugin) {
/*private String makeTargetDir(MyPlugin myPlugin) {
String name = myPlugin.getName();
String dir = pluginDir + name + "/" + myPlugin.getVersion() + "/";
File fileDir = new File(dir);
@ -121,6 +120,15 @@ public class PluginService {
fileDir.mkdirs();
}
return dir;
}*/
private String makeTargetDir(MyPlugin myPlugin) {
String store = myPlugin.getStore();
String dir = pluginDir + store + "/";
File fileDir = new File(dir);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
return dir;
}
/**

View File

@ -166,8 +166,10 @@ DROP TABLE IF EXISTS `my_plugin`;
CREATE TABLE `my_plugin` (
`plugin_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(255) DEFAULT NULL COMMENT '插件名称',
`store` varchar(255) DEFAULT NULL COMMENT '商家',
`free` tinyint(1) DEFAULT '0' COMMENT '是否免费',
`cost` int(10) DEFAULT NULL COMMENT '费用',
`category` varchar(255) DEFAULT NULL COMMENT '列别',
`descript` varchar(255) DEFAULT NULL COMMENT '描述',
`version` varchar(255) DEFAULT NULL COMMENT '版本号',
`install_type` int(4) DEFAULT NULL COMMENT '安装类型',
@ -176,10 +178,9 @@ CREATE TABLE `my_plugin` (
`release_time` bigint(13) DEFAULT NULL COMMENT '发布时间',
`install_time` bigint(13) DEFAULT NULL COMMENT '安装时间',
`module_name` varchar(255) DEFAULT NULL COMMENT 'jar包名称',
`bean_name` varchar(40) DEFAULT NULL COMMENT 'bean名称',
`icon` varchar(255) DEFAULT NULL COMMENT '图标',
PRIMARY KEY (`plugin_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='插件表';
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='插件表';
DROP TABLE IF EXISTS `license`;
CREATE TABLE `license` (
@ -457,21 +458,3 @@ CREATE TABLE `license` (
`f2c_license` longtext COMMENT 'F2C License',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `my_plugin`;
CREATE TABLE `my_plugin` (
`plugin_id` bigint(20) NOT NULL COMMENT '主键',
`name` varchar(255) DEFAULT NULL COMMENT '插件名称',
`free` tinyint(1) DEFAULT NULL COMMENT '是否免费',
`cost` int(10) DEFAULT NULL COMMENT '费用',
`descript` varchar(255) DEFAULT NULL COMMENT '描述',
`version` varchar(255) DEFAULT NULL COMMENT '版本号',
`install_type` int(4) DEFAULT NULL COMMENT '安装类型',
`creator` varchar(255) DEFAULT NULL COMMENT '开发者',
`release_time` bigint(13) DEFAULT NULL COMMENT '发布时间',
`install_time` bigint(13) DEFAULT NULL COMMENT '安装时间',
`module_name` varchar(255) DEFAULT NULL COMMENT 'jar包名称',
`bean_name` varchar(40) DEFAULT NULL COMMENT 'bean名称',
`icon` varchar(255) DEFAULT NULL COMMENT '图标',
PRIMARY KEY (`plugin_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -25,12 +25,15 @@ INSERT INTO `sys_menu` VALUES (14, 3, 0, 2, '编辑菜单', NULL, NULL, 999, NUL
INSERT INTO `sys_menu` VALUES (15, 2, 0, 2, '创建用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:add', NULL, NULL, 1614930862373, 1614930862373);
INSERT INTO `sys_menu` VALUES (16, 2, 0, 2, '删除用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:del', NULL, NULL, 1614930903502, 1614930903502);
INSERT INTO `sys_menu` VALUES (17, 2, 0, 2, '编辑用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:edit', NULL, NULL, 1614930935529, 1614930935529);
/*
INSERT INTO `sys_menu` VALUES (18, 4, 0, 2, '创建组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:add', NULL, NULL, 1614930976297, 1614930976297);
INSERT INTO `sys_menu` VALUES (19, 4, 0, 2, '删除组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:del', NULL, NULL, 1614930997130, 1614930997130);
INSERT INTO `sys_menu` VALUES (20, 4, 0, 2, '编辑组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:edit', NULL, NULL, 1614931022967, 1614931022967);
INSERT INTO `sys_menu` VALUES (21, 5, 0, 2, '创建角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:add', NULL, NULL, 1614931069408, 1614931069408);
INSERT INTO `sys_menu` VALUES (22, 5, 0, 2, '删除角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:del', NULL, NULL, 1614931097720, 1614931097720);
INSERT INTO `sys_menu` VALUES (23, 5, 0, 2, '编辑角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:edit', NULL, NULL, 1614931124782, 1614931124782);
*/
INSERT INTO `sys_menu` VALUES (24, 34, 0, 2, '创建连接', NULL, NULL, 997, NULL, NULL, b'0', b'0', b'0', 'datasource:add', NULL, NULL, 1614931168956, 1615783705537);
INSERT INTO `sys_menu` VALUES (25, 34, 0, 2, '删除连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:del', NULL, NULL, 1614931205899, 1614931205899);
INSERT INTO `sys_menu` VALUES (26, 34, 0, 2, '编辑连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:edit', NULL, NULL, 1614931234105, 1614931234105);
@ -44,8 +47,10 @@ INSERT INTO `sys_menu` VALUES (35, 1, 0, 1, '用户表单', 'system-user-form',
/*INSERT INTO `sys_menu` VALUES (38, 1, 0, 1, '角色表单', 'system-role-form', 'system/role/form', 13, '', 'role-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);*/
INSERT INTO `sys_menu` VALUES (39, 0, 0, 1, '数据源表单', 'datasource-form', 'system/datasource/form', 5, NULL, '/ds-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (40, 1, 0, 1, '模板管理', 'system-template', 'panel/template/index', 13, 'dashboard', 'panel/template/index', NULL, b'0', b'0', 'template:read', NULL, NULL, NULL, 1620444227389);
/*
INSERT INTO `sys_menu` VALUES (41, 1, 0, 1, '权限管理', 'system-auth', 'system/authority/index', 14, 'password', 'system/authority/index', b'0', b'0', b'0', 'auth:read', NULL, NULL, NULL, 1620447312657);
INSERT INTO `sys_menu` VALUES (42, 1, 0, 1, '插件管理', 'system-plugin', 'system/plugin/index', 15, 'sys-tools', '/plugin', b'0', b'0', b'0', 'plugin:read', NULL, NULL, NULL, NULL);
*/
INSERT INTO `sys_menu` VALUES (50, 0, 0, 1, '个人信息', 'person-info', 'system/user/privateForm', 999, NULL, '/person-info', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (51, 0, 0, 1, '重置密码', 'person-pwd-reset', 'system/user/personPwd', 999, NULL, '/person-pwd', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (52, 0, 0, 1, '关于', 'about', 'system/about/index', 16, 'system', '/about', b'0', b'0', b'1', NULL, NULL, NULL, NULL, 1620897406691);
@ -58,8 +63,8 @@ COMMIT;
BEGIN;
INSERT INTO `sys_role` VALUES (3, '管理员', 'www', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null);
INSERT INTO `sys_role` VALUES (4, '普通员工', 'ceshi', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null);
INSERT INTO `sys_role` VALUES (3, '管理员', '', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null);
INSERT INTO `sys_role` VALUES (4, '普通员工', '', NULL, NULL, REPLACE(unix_timestamp(current_timestamp(3)),'.',''), null);
COMMIT;
@ -92,7 +97,9 @@ INSERT INTO `sys_roles_menus` VALUES (30, 3);
INSERT INTO `sys_roles_menus` VALUES (31, 3);
INSERT INTO `sys_roles_menus` VALUES (32, 3);
INSERT INTO `sys_roles_menus` VALUES (34, 3);
INSERT INTO `sys_roles_menus` VALUES (101, 3);
INSERT INTO `sys_roles_menus` VALUES (40, 3);
INSERT INTO `sys_roles_menus` VALUES (41, 3);
INSERT INTO `sys_roles_menus` VALUES (42, 3);
INSERT INTO `sys_roles_menus` VALUES (30, 4);
COMMIT;
@ -157,7 +164,9 @@ COMMIT;
INSERT INTO `panel_template`(`id`, `name`, `pid`, `level`, `node_type`, `create_by`, `create_time`, `snapshot`, `template_type`, `template_style`, `template_data`, `dynamic_data`) VALUES ('self', '用户模板', '', -1, 'folder', NULL, NULL, '', 'self', '', '', NULL);
INSERT INTO `panel_template`(`id`, `name`, `pid`, `level`, `node_type`, `create_by`, `create_time`, `snapshot`, `template_type`, `template_style`, `template_data`, `dynamic_data`) VALUES ('system', '系统模板', '', -1, 'folder', NULL, NULL, NULL, 'system', NULL, NULL, NULL);
BEGIN;
INSERT INTO `my_plugin` VALUES (1, 'xpakc默认插件', 'default', 0, 20000, 'xpack', '请购买正式许可', '1.0-SNAPSHOT', NULL, 'fit2cloud-chenyw', 1, 1620624387327, NULL, 'deplugin-xpack-backend', NULL);
COMMIT;
-- ----------------------------

View File

@ -1,19 +1,53 @@
/*
Navicat Premium Data Transfer
Source Server : A-LOCAL-
Source Server Type : MySQL
Source Server Version : 50726
Source Host : localhost:3306
Source Schema : data_ease
SET FOREIGN_KEY_CHECKS = 1;
Target Server Type : MySQL
Target Server Version : 50726
File Encoding : 65001
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
Date: 27/05/2021 14:59:53
*/
-- ----------------------------
-- Table structure for sys_auth
-- ----------------------------
DROP TABLE IF EXISTS `sys_auth`;
CREATE TABLE `sys_auth` (
`id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`auth_source` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权资产源 数据集 视图 仪表板',
`auth_source_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权资产类型 dataset 数据集 view 视图 panel 仪表板',
`auth_target` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权目标 用户 角色 组织 ',
`auth_target_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权目标类型 user 用户 role 角色 org dept 组织',
`auth_time` bigint(13) NULL DEFAULT NULL COMMENT '授权时间',
`auth_details` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权明细 privilegename 名称 privilegeType 权限类型 1 查看 2 管理 3 导出 4 使用 ; privilegeValue 1 不可用 2 可用 3 部分可用',
`auth_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权人员',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci;
-- ----------------------------
-- Table structure for sys_auth_detail
-- ----------------------------
DROP TABLE IF EXISTS `sys_auth_detail`;
CREATE TABLE `sys_auth_detail` (
`id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`auth_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`privilege_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名称',
`privilege_type` int(6) NULL DEFAULT NULL COMMENT '权限类型',
`privilege_value` int(6) NULL DEFAULT NULL COMMENT '权限值 1 可用 2 不用',
`privilege_extend` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限扩展',
`remark` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`create_time` bigint(13) NULL DEFAULT NULL,
`update_time` bigint(13) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci;
-- ----------------------------
-- Records of sys_auth_detail
-- ----------------------------
BEGIN;
INSERT INTO `sys_auth_detail` VALUES ('chart_grant', 'chart', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('chart_manage', 'chart', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('chart_use', 'chart', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('dataset_grant', 'dataset', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('dataset_manege', 'dataset', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('dataset_use', 'dataset', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('link_grant', 'link', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('link_manage', 'link', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('link_use', 'link', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('menu_grant', 'menu', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('menu_use', 'menu', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('panel_export', 'panel', 'i18n_auth_export', 3, 0, 'export', '基础权限-导出', 'system', NULL, NULL), ('panel_grant', 'panel', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('panel_manage', 'panel', 'i18n_auth_manage', 5, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('panel_use', 'panel', 'i18n_auth_view', 1, 0, 'view', '基础权限-查看', 'system', NULL, NULL);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
@ -442,54 +476,6 @@ END
;;
delimiter ;
SET FOREIGN_KEY_CHECKS = 1;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for sys_auth
-- ----------------------------
DROP TABLE IF EXISTS `sys_auth`;
CREATE TABLE `sys_auth` (
`id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`auth_source` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权资产源 数据集 视图 仪表板',
`auth_source_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权资产类型 dataset 数据集 view 视图 panel 仪表板',
`auth_target` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权目标 用户 角色 组织 ',
`auth_target_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权目标类型 user 用户 role 角色 org dept 组织',
`auth_time` bigint(13) NULL DEFAULT NULL COMMENT '授权时间',
`auth_details` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权明细 privilegename 名称 privilegeType 权限类型 1 查看 2 管理 3 导出 4 使用 ; privilegeValue 1 不可用 2 可用 3 部分可用',
`auth_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权人员',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci;
-- ----------------------------
-- Table structure for sys_auth_detail
-- ----------------------------
DROP TABLE IF EXISTS `sys_auth_detail`;
CREATE TABLE `sys_auth_detail` (
`id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`auth_id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`privilege_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名称',
`privilege_type` int(6) NULL DEFAULT NULL COMMENT '权限类型',
`privilege_value` int(6) NULL DEFAULT NULL COMMENT '权限值 1 可用 2 不用',
`privilege_extend` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限扩展',
`remark` varchar(2000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
`create_user` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`create_time` bigint(13) NULL DEFAULT NULL,
`update_time` bigint(13) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci;
-- ----------------------------
-- Records of sys_auth_detail
-- ----------------------------
BEGIN;
INSERT INTO `sys_auth_detail` VALUES ('chart_grant', 'chart', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('chart_manage', 'chart', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('chart_use', 'chart', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('dataset_grant', 'dataset', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('dataset_manege', 'dataset', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('dataset_use', 'dataset', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('link_grant', 'link', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('link_manage', 'link', 'i18n_auth_manage', 3, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('link_use', 'link', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('menu_grant', 'menu', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('menu_use', 'menu', 'i18n_auth_use', 1, 0, 'use', '基础权限-使用', 'system', NULL, NULL), ('panel_export', 'panel', 'i18n_auth_export', 3, 0, 'export', '基础权限-导出', 'system', NULL, NULL), ('panel_grant', 'panel', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'system', NULL, NULL), ('panel_manage', 'panel', 'i18n_auth_manage', 5, 0, 'manage', '基础权限-管理', 'system', NULL, NULL), ('panel_use', 'panel', 'i18n_auth_view', 1, 0, 'view', '基础权限-查看', 'system', NULL, NULL);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
DROP TRIGGER if exists`new_auth_link`;

View File

@ -1,25 +1,28 @@
<template>
<div :style="{
left: start.x + 'px',
top: start.y + 'px',
width: width + 'px',
height: height + 'px',
}" class="area"></div>
<div
:style="{
left: start.x + 'px',
top: start.y + 'px',
width: width + 'px',
height: height + 'px',
}"
class="area"
/>
</template>
<script>
export default {
props: {
start: {
type: Object,
},
width: {
type: Number,
},
height: {
type: Number,
},
props: {
start: {
type: Object
},
width: {
type: Number
},
height: {
type: Number
}
}
}
</script>
@ -28,4 +31,4 @@ export default {
border: 1px solid #70c0ff;
position: absolute;
}
</style>
</style>

View File

@ -14,13 +14,15 @@
<Shape
v-for="(item, index) in componentData"
:key="item.id"
:default-style="item.style"
:default-style="getShapeStyleInt(item.style)"
:style="getShapeStyle(item.style)"
:active="item === curComponent"
:element="item"
:index="index"
:class="{ lock: item.isLock }"
>
<!-- item.style-&#45;&#45;{{ item.style }}-->
<!-- item.style-&#45;&#45;{{ getShapeStyleInt(item.style) }}-->
<component
:is="item.component"
@ -28,6 +30,7 @@
:id="'component' + item.id"
class="component"
:style="item.style"
:out-style="getShapeStyleInt(item.style)"
:element="item"
/>
@ -40,7 +43,7 @@
:prop-value="item.propValue"
:element="item"
:filter="filter"
:out-style="item.style"
:out-style="getShapeStyleInt(item.style)"
/>
<!-- <component
:is="item.component"
@ -76,6 +79,7 @@ import Grid from './Grid'
import { changeStyleWithScale } from '@/components/canvas/utils/translate'
import { Condition } from '@/components/widget/bean/Condition'
import bus from '@/utils/bus'
export default {
components: { Shape, ContextMenu, MarkLine, Area, Grid },
props: {
@ -86,6 +90,10 @@ export default {
filter: {
type: Object,
require: false
},
outStyle: {
type: Object,
require: false
}
},
data() {
@ -99,31 +107,58 @@ export default {
width: 0,
height: 0,
isShowArea: false,
conditions: []
conditions: [],
scaleWidth: 100,
scaleHeight: 100,
timer: null,
needToChangeHeight: [
'top',
'height',
'fontSize',
'borderWidth'
],
needToChangeWidth: [
'left',
'width'
]
}
},
watch: {
outStyle: {
handler(newVal, oldVla) {
this.changeScale()
},
deep: true
},
canvasStyleData: {
handler(newVal, oldVla) {
this.changeScale()
},
deep: true
}
},
computed: {
customStyle() {
let style = {
width: this.changeStyleWithScale(this.canvasStyleData.width) + 'px',
height: this.changeStyleWithScale(this.canvasStyleData.height) + 'px'
width: this.format(this.canvasStyleData.width, this.scaleWidth) + 'px',
height: this.format(this.canvasStyleData.height, this.scaleHeight) + 'px'
}
console.log('customStyle=>' + JSON.stringify(style))
if (this.canvasStyleData.openCommonStyle) {
if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) {
style = {
width: this.changeStyleWithScale(this.canvasStyleData.width) + 'px',
height: this.changeStyleWithScale(this.canvasStyleData.height) + 'px',
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`
background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`,
...style
}
} else {
style = {
width: this.changeStyleWithScale(this.canvasStyleData.width) + 'px',
height: this.changeStyleWithScale(this.canvasStyleData.height) + 'px',
background: this.canvasStyleData.panel.color
background: this.canvasStyleData.panel.color,
...style
}
}
}
return style
},
panelInfo() {
@ -153,7 +188,6 @@ export default {
},
methods: {
changeStyleWithScale,
handleMouseDown(e) {
// e.preventDefault() drop
if (!this.curComponent || (this.curComponent.component !== 'v-text' && this.curComponent.component !== 'rect-shape')) {
@ -218,8 +252,10 @@ export default {
// Group
// left top right bottom
let top = Infinity; let left = Infinity
let right = -Infinity; let bottom = -Infinity
let top = Infinity
let left = Infinity
let right = -Infinity
let bottom = -Infinity
areaData.forEach(component => {
let style = {}
if (component.component === 'Group') {
@ -303,19 +339,34 @@ export default {
getShapeStyle(style) {
const result = {};
['width', 'height', 'top', 'left', 'rotate'].forEach(attr => {
if (attr !== 'rotate') {
result[attr] = style[attr] + 'px'
} else {
result.transform = 'rotate(' + style[attr] + 'deg)'
}
['width', 'left'].forEach(attr => {
result[attr] = this.format(style[attr], this.scaleWidth) + 'px'
});
['height', 'top'].forEach(attr => {
result[attr] = this.format(style[attr], this.scaleHeight) + 'px'
})
result.transform = 'rotate(' + style['rotate'] + 'deg)'
return result
},
getShapeStyleInt(style) {
const result = {};
['width', 'left'].forEach(attr => {
result[attr] = this.format(style[attr], this.scaleWidth)
});
['height', 'top'].forEach(attr => {
result[attr] = this.format(style[attr], this.scaleHeight)
})
result['rotate'] = style['rotate']
result['borderWidth'] = style['borderWidth']
result['opacity'] = style['opacity']
return result
},
getComponentStyle(style) {
// return getStyle(style, ['top', 'left', 'width', 'height', 'rotate'])
// return getStyle(style, ['top', 'left', 'width', 'height', 'rotate'])
return style
},
@ -368,6 +419,21 @@ export default {
},
executeSearch() {
console.log('当前查询条件是: ' + JSON.stringify(this.conditions))
},
format(value, scale) {
//
if (this.canvasStyleData.selfAdaption) {
return parseInt(value * parseInt(scale) / 100)
} else {
return parseInt(value)
}
},
changeScale() {
if (this.outStyle.width && this.outStyle.height) {
this.scaleWidth = parseInt(this.outStyle.width * 100 / this.canvasStyleData.width)
this.scaleHeight = parseInt(this.outStyle.height * 100 / this.canvasStyleData.height)
this.$store.commit('setCurCanvasScale', { scaleWidth: this.scaleWidth, scaleHeight: this.scaleHeight })
}
}
}
}

View File

@ -1,11 +1,17 @@
<template>
<div>
<div class="toolbar">
<div class="canvas-config" style="margin-right: 10px">
<el-switch v-model="canvasStyleData.selfAdaption" :width="35" label="自适应画布区域" name="selfAdaption" />
<span>自适应画布区域 </span>
</div>
<div class="canvas-config" style="margin-right: 10px">
<span> {{ $t('panel.canvas_size') }} </span>
<input v-model="canvasStyleData.width">
<input v-model="canvasStyleData.width" :disabled="canvasStyleData.selfAdaption">
<span>*</span>
<input v-model="canvasStyleData.height">
<input v-model="canvasStyleData.height" :disabled="canvasStyleData.selfAdaption">
</div>
<!-- <div class="canvas-config" style="margin-right: 10px">-->
<!-- <span> {{ $t('panel.canvas_scale') }} </span>-->
@ -140,7 +146,6 @@ export default {
...this.canvasStyleData,
scale: this.scale
})
this.$nextTick(() => (eventBus.$emit('resizing', '')))
}, 1000)
},
@ -320,4 +325,17 @@ export default {
background-color: #ffffff!important;
}
>>>.el-switch__core{
width:30px!important;
height:15px;
/*color:#409EFF;*/
}
/*设置圆*/
>>>.el-switch__core::after{
width:14px;
height:14px;
margin-top:-1px;
margin-bottom: 2px;
}
</style>

View File

@ -2,272 +2,272 @@
import { calculateRotatedPointCoordinate, getCenterPoint } from './translate'
const funcs = {
lt: calculateLeftTop,
t: calculateTop,
rt: calculateRightTop,
r: calculateRight,
rb: calculateRightBottom,
b: calculateBottom,
lb: calculateLeftBottom,
l: calculateLeft,
lt: calculateLeftTop,
t: calculateTop,
rt: calculateRightTop,
r: calculateRight,
rb: calculateRightBottom,
b: calculateBottom,
lb: calculateLeftBottom,
l: calculateLeft
}
function calculateLeftTop(style, curPositon, proportion, needLockProportion, pointInfo) {
const { symmetricPoint } = pointInfo
let newCenterPoint = getCenterPoint(curPositon, symmetricPoint)
let newTopLeftPoint = calculateRotatedPointCoordinate(curPositon, newCenterPoint, -style.rotate)
let newBottomRightPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
let newWidth = newBottomRightPoint.x - newTopLeftPoint.x
let newHeight = newBottomRightPoint.y - newTopLeftPoint.y
const { symmetricPoint } = pointInfo
let newCenterPoint = getCenterPoint(curPositon, symmetricPoint)
let newTopLeftPoint = calculateRotatedPointCoordinate(curPositon, newCenterPoint, -style.rotate)
let newBottomRightPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
if (needLockProportion) {
if (newWidth / newHeight > proportion) {
newTopLeftPoint.x += Math.abs(newWidth - newHeight * proportion)
newWidth = newHeight * proportion
} else {
newTopLeftPoint.y += Math.abs(newHeight - newWidth / proportion)
newHeight = newWidth / proportion
}
let newWidth = newBottomRightPoint.x - newTopLeftPoint.x
let newHeight = newBottomRightPoint.y - newTopLeftPoint.y
// 由于现在求的未旋转前的坐标是以没按比例缩减宽高前的坐标来计算的
// 所以缩减宽高后,需要按照原来的中心点旋转回去,获得缩减宽高并旋转后对应的坐标
// 然后以这个坐标和对称点获得新的中心点,并重新计算未旋转前的坐标
const rotatedTopLeftPoint = calculateRotatedPointCoordinate(newTopLeftPoint, newCenterPoint, style.rotate)
newCenterPoint = getCenterPoint(rotatedTopLeftPoint, symmetricPoint)
newTopLeftPoint = calculateRotatedPointCoordinate(rotatedTopLeftPoint, newCenterPoint, -style.rotate)
newBottomRightPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
newWidth = newBottomRightPoint.x - newTopLeftPoint.x
newHeight = newBottomRightPoint.y - newTopLeftPoint.y
if (needLockProportion) {
if (newWidth / newHeight > proportion) {
newTopLeftPoint.x += Math.abs(newWidth - newHeight * proportion)
newWidth = newHeight * proportion
} else {
newTopLeftPoint.y += Math.abs(newHeight - newWidth / proportion)
newHeight = newWidth / proportion
}
if (newWidth > 0 && newHeight > 0) {
style.width = Math.round(newWidth)
style.height = Math.round(newHeight)
style.left = Math.round(newTopLeftPoint.x)
style.top = Math.round(newTopLeftPoint.y)
}
// 由于现在求的未旋转前的坐标是以没按比例缩减宽高前的坐标来计算的
// 所以缩减宽高后,需要按照原来的中心点旋转回去,获得缩减宽高并旋转后对应的坐标
// 然后以这个坐标和对称点获得新的中心点,并重新计算未旋转前的坐标
const rotatedTopLeftPoint = calculateRotatedPointCoordinate(newTopLeftPoint, newCenterPoint, style.rotate)
newCenterPoint = getCenterPoint(rotatedTopLeftPoint, symmetricPoint)
newTopLeftPoint = calculateRotatedPointCoordinate(rotatedTopLeftPoint, newCenterPoint, -style.rotate)
newBottomRightPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
newWidth = newBottomRightPoint.x - newTopLeftPoint.x
newHeight = newBottomRightPoint.y - newTopLeftPoint.y
}
if (newWidth > 0 && newHeight > 0) {
style.width = Math.round(newWidth)
style.height = Math.round(newHeight)
style.left = Math.round(newTopLeftPoint.x)
style.top = Math.round(newTopLeftPoint.y)
}
}
function calculateRightTop(style, curPositon, proportion, needLockProportion, pointInfo) {
const { symmetricPoint } = pointInfo
let newCenterPoint = getCenterPoint(curPositon, symmetricPoint)
let newTopRightPoint = calculateRotatedPointCoordinate(curPositon, newCenterPoint, -style.rotate)
let newBottomLeftPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
let newWidth = newTopRightPoint.x - newBottomLeftPoint.x
let newHeight = newBottomLeftPoint.y - newTopRightPoint.y
const { symmetricPoint } = pointInfo
let newCenterPoint = getCenterPoint(curPositon, symmetricPoint)
let newTopRightPoint = calculateRotatedPointCoordinate(curPositon, newCenterPoint, -style.rotate)
let newBottomLeftPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
if (needLockProportion) {
if (newWidth / newHeight > proportion) {
newTopRightPoint.x -= Math.abs(newWidth - newHeight * proportion)
newWidth = newHeight * proportion
} else {
newTopRightPoint.y += Math.abs(newHeight - newWidth / proportion)
newHeight = newWidth / proportion
}
let newWidth = newTopRightPoint.x - newBottomLeftPoint.x
let newHeight = newBottomLeftPoint.y - newTopRightPoint.y
const rotatedTopRightPoint = calculateRotatedPointCoordinate(newTopRightPoint, newCenterPoint, style.rotate)
newCenterPoint = getCenterPoint(rotatedTopRightPoint, symmetricPoint)
newTopRightPoint = calculateRotatedPointCoordinate(rotatedTopRightPoint, newCenterPoint, -style.rotate)
newBottomLeftPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
newWidth = newTopRightPoint.x - newBottomLeftPoint.x
newHeight = newBottomLeftPoint.y - newTopRightPoint.y
}
if (newWidth > 0 && newHeight > 0) {
style.width = Math.round(newWidth)
style.height = Math.round(newHeight)
style.left = Math.round(newBottomLeftPoint.x)
style.top = Math.round(newTopRightPoint.y)
if (needLockProportion) {
if (newWidth / newHeight > proportion) {
newTopRightPoint.x -= Math.abs(newWidth - newHeight * proportion)
newWidth = newHeight * proportion
} else {
newTopRightPoint.y += Math.abs(newHeight - newWidth / proportion)
newHeight = newWidth / proportion
}
const rotatedTopRightPoint = calculateRotatedPointCoordinate(newTopRightPoint, newCenterPoint, style.rotate)
newCenterPoint = getCenterPoint(rotatedTopRightPoint, symmetricPoint)
newTopRightPoint = calculateRotatedPointCoordinate(rotatedTopRightPoint, newCenterPoint, -style.rotate)
newBottomLeftPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
newWidth = newTopRightPoint.x - newBottomLeftPoint.x
newHeight = newBottomLeftPoint.y - newTopRightPoint.y
}
if (newWidth > 0 && newHeight > 0) {
style.width = Math.round(newWidth)
style.height = Math.round(newHeight)
style.left = Math.round(newBottomLeftPoint.x)
style.top = Math.round(newTopRightPoint.y)
}
}
function calculateRightBottom(style, curPositon, proportion, needLockProportion, pointInfo) {
const { symmetricPoint } = pointInfo
let newCenterPoint = getCenterPoint(curPositon, symmetricPoint)
let newTopLeftPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
let newBottomRightPoint = calculateRotatedPointCoordinate(curPositon, newCenterPoint, -style.rotate)
let newWidth = newBottomRightPoint.x - newTopLeftPoint.x
let newHeight = newBottomRightPoint.y - newTopLeftPoint.y
const { symmetricPoint } = pointInfo
let newCenterPoint = getCenterPoint(curPositon, symmetricPoint)
let newTopLeftPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
let newBottomRightPoint = calculateRotatedPointCoordinate(curPositon, newCenterPoint, -style.rotate)
if (needLockProportion) {
if (newWidth / newHeight > proportion) {
newBottomRightPoint.x -= Math.abs(newWidth - newHeight * proportion)
newWidth = newHeight * proportion
} else {
newBottomRightPoint.y -= Math.abs(newHeight - newWidth / proportion)
newHeight = newWidth / proportion
}
let newWidth = newBottomRightPoint.x - newTopLeftPoint.x
let newHeight = newBottomRightPoint.y - newTopLeftPoint.y
const rotatedBottomRightPoint = calculateRotatedPointCoordinate(newBottomRightPoint, newCenterPoint, style.rotate)
newCenterPoint = getCenterPoint(rotatedBottomRightPoint, symmetricPoint)
newTopLeftPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
newBottomRightPoint = calculateRotatedPointCoordinate(rotatedBottomRightPoint, newCenterPoint, -style.rotate)
newWidth = newBottomRightPoint.x - newTopLeftPoint.x
newHeight = newBottomRightPoint.y - newTopLeftPoint.y
if (needLockProportion) {
if (newWidth / newHeight > proportion) {
newBottomRightPoint.x -= Math.abs(newWidth - newHeight * proportion)
newWidth = newHeight * proportion
} else {
newBottomRightPoint.y -= Math.abs(newHeight - newWidth / proportion)
newHeight = newWidth / proportion
}
if (newWidth > 0 && newHeight > 0) {
style.width = Math.round(newWidth)
style.height = Math.round(newHeight)
style.left = Math.round(newTopLeftPoint.x)
style.top = Math.round(newTopLeftPoint.y)
}
const rotatedBottomRightPoint = calculateRotatedPointCoordinate(newBottomRightPoint, newCenterPoint, style.rotate)
newCenterPoint = getCenterPoint(rotatedBottomRightPoint, symmetricPoint)
newTopLeftPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
newBottomRightPoint = calculateRotatedPointCoordinate(rotatedBottomRightPoint, newCenterPoint, -style.rotate)
newWidth = newBottomRightPoint.x - newTopLeftPoint.x
newHeight = newBottomRightPoint.y - newTopLeftPoint.y
}
if (newWidth > 0 && newHeight > 0) {
style.width = Math.round(newWidth)
style.height = Math.round(newHeight)
style.left = Math.round(newTopLeftPoint.x)
style.top = Math.round(newTopLeftPoint.y)
}
}
function calculateLeftBottom(style, curPositon, proportion, needLockProportion, pointInfo) {
const { symmetricPoint } = pointInfo
let newCenterPoint = getCenterPoint(curPositon, symmetricPoint)
let newTopRightPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
let newBottomLeftPoint = calculateRotatedPointCoordinate(curPositon, newCenterPoint, -style.rotate)
const { symmetricPoint } = pointInfo
let newCenterPoint = getCenterPoint(curPositon, symmetricPoint)
let newTopRightPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
let newBottomLeftPoint = calculateRotatedPointCoordinate(curPositon, newCenterPoint, -style.rotate)
let newWidth = newTopRightPoint.x - newBottomLeftPoint.x
let newHeight = newBottomLeftPoint.y - newTopRightPoint.y
let newWidth = newTopRightPoint.x - newBottomLeftPoint.x
let newHeight = newBottomLeftPoint.y - newTopRightPoint.y
if (needLockProportion) {
if (newWidth / newHeight > proportion) {
newBottomLeftPoint.x += Math.abs(newWidth - newHeight * proportion)
newWidth = newHeight * proportion
} else {
newBottomLeftPoint.y -= Math.abs(newHeight - newWidth / proportion)
newHeight = newWidth / proportion
}
const rotatedBottomLeftPoint = calculateRotatedPointCoordinate(newBottomLeftPoint, newCenterPoint, style.rotate)
newCenterPoint = getCenterPoint(rotatedBottomLeftPoint, symmetricPoint)
newTopRightPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
newBottomLeftPoint = calculateRotatedPointCoordinate(rotatedBottomLeftPoint, newCenterPoint, -style.rotate)
newWidth = newTopRightPoint.x - newBottomLeftPoint.x
newHeight = newBottomLeftPoint.y - newTopRightPoint.y
if (needLockProportion) {
if (newWidth / newHeight > proportion) {
newBottomLeftPoint.x += Math.abs(newWidth - newHeight * proportion)
newWidth = newHeight * proportion
} else {
newBottomLeftPoint.y -= Math.abs(newHeight - newWidth / proportion)
newHeight = newWidth / proportion
}
if (newWidth > 0 && newHeight > 0) {
style.width = Math.round(newWidth)
style.height = Math.round(newHeight)
style.left = Math.round(newBottomLeftPoint.x)
style.top = Math.round(newTopRightPoint.y)
}
const rotatedBottomLeftPoint = calculateRotatedPointCoordinate(newBottomLeftPoint, newCenterPoint, style.rotate)
newCenterPoint = getCenterPoint(rotatedBottomLeftPoint, symmetricPoint)
newTopRightPoint = calculateRotatedPointCoordinate(symmetricPoint, newCenterPoint, -style.rotate)
newBottomLeftPoint = calculateRotatedPointCoordinate(rotatedBottomLeftPoint, newCenterPoint, -style.rotate)
newWidth = newTopRightPoint.x - newBottomLeftPoint.x
newHeight = newBottomLeftPoint.y - newTopRightPoint.y
}
if (newWidth > 0 && newHeight > 0) {
style.width = Math.round(newWidth)
style.height = Math.round(newHeight)
style.left = Math.round(newBottomLeftPoint.x)
style.top = Math.round(newTopRightPoint.y)
}
}
function calculateTop(style, curPositon, proportion, needLockProportion, pointInfo) {
const { symmetricPoint, curPoint } = pointInfo
let rotatedcurPositon = calculateRotatedPointCoordinate(curPositon, curPoint, -style.rotate)
let rotatedTopMiddlePoint = calculateRotatedPointCoordinate({
x: curPoint.x,
y: rotatedcurPositon.y,
}, curPoint, style.rotate)
// 勾股定理
let newHeight = Math.sqrt((rotatedTopMiddlePoint.x - symmetricPoint.x) ** 2 + (rotatedTopMiddlePoint.y - symmetricPoint.y) ** 2)
if (newHeight > 0) {
const newCenter = {
x: rotatedTopMiddlePoint.x - (rotatedTopMiddlePoint.x - symmetricPoint.x) / 2,
y: rotatedTopMiddlePoint.y + (symmetricPoint.y - rotatedTopMiddlePoint.y) / 2,
}
const { symmetricPoint, curPoint } = pointInfo
const rotatedcurPositon = calculateRotatedPointCoordinate(curPositon, curPoint, -style.rotate)
const rotatedTopMiddlePoint = calculateRotatedPointCoordinate({
x: curPoint.x,
y: rotatedcurPositon.y
}, curPoint, style.rotate)
let width = style.width
// 因为调整的是高度 所以只需根据锁定的比例调整宽度即可
if (needLockProportion) {
width = newHeight * proportion
}
style.width = width
style.height = Math.round(newHeight)
style.top = Math.round(newCenter.y - (newHeight / 2))
style.left = Math.round(newCenter.x - (style.width / 2))
// 勾股定理
const newHeight = Math.sqrt((rotatedTopMiddlePoint.x - symmetricPoint.x) ** 2 + (rotatedTopMiddlePoint.y - symmetricPoint.y) ** 2)
if (newHeight > 0) {
const newCenter = {
x: rotatedTopMiddlePoint.x - (rotatedTopMiddlePoint.x - symmetricPoint.x) / 2,
y: rotatedTopMiddlePoint.y + (symmetricPoint.y - rotatedTopMiddlePoint.y) / 2
}
let width = style.width
// 因为调整的是高度 所以只需根据锁定的比例调整宽度即可
if (needLockProportion) {
width = newHeight * proportion
}
style.width = width
style.height = Math.round(newHeight)
style.top = Math.round(newCenter.y - (newHeight / 2))
style.left = Math.round(newCenter.x - (style.width / 2))
}
}
function calculateRight(style, curPositon, proportion, needLockProportion, pointInfo) {
const { symmetricPoint, curPoint } = pointInfo
const rotatedcurPositon = calculateRotatedPointCoordinate(curPositon, curPoint, -style.rotate)
const rotatedRightMiddlePoint = calculateRotatedPointCoordinate({
x: rotatedcurPositon.x,
y: curPoint.y,
}, curPoint, style.rotate)
let newWidth = Math.sqrt((rotatedRightMiddlePoint.x - symmetricPoint.x) ** 2 + (rotatedRightMiddlePoint.y - symmetricPoint.y) ** 2)
if (newWidth > 0) {
const newCenter = {
x: rotatedRightMiddlePoint.x - (rotatedRightMiddlePoint.x - symmetricPoint.x) / 2,
y: rotatedRightMiddlePoint.y + (symmetricPoint.y - rotatedRightMiddlePoint.y) / 2,
}
const { symmetricPoint, curPoint } = pointInfo
const rotatedcurPositon = calculateRotatedPointCoordinate(curPositon, curPoint, -style.rotate)
const rotatedRightMiddlePoint = calculateRotatedPointCoordinate({
x: rotatedcurPositon.x,
y: curPoint.y
}, curPoint, style.rotate)
let height = style.height
// 因为调整的是宽度 所以只需根据锁定的比例调整高度即可
if (needLockProportion) {
height = newWidth / proportion
}
style.height = height
style.width = Math.round(newWidth)
style.top = Math.round(newCenter.y - (style.height / 2))
style.left = Math.round(newCenter.x - (newWidth / 2))
const newWidth = Math.sqrt((rotatedRightMiddlePoint.x - symmetricPoint.x) ** 2 + (rotatedRightMiddlePoint.y - symmetricPoint.y) ** 2)
if (newWidth > 0) {
const newCenter = {
x: rotatedRightMiddlePoint.x - (rotatedRightMiddlePoint.x - symmetricPoint.x) / 2,
y: rotatedRightMiddlePoint.y + (symmetricPoint.y - rotatedRightMiddlePoint.y) / 2
}
let height = style.height
// 因为调整的是宽度 所以只需根据锁定的比例调整高度即可
if (needLockProportion) {
height = newWidth / proportion
}
style.height = height
style.width = Math.round(newWidth)
style.top = Math.round(newCenter.y - (style.height / 2))
style.left = Math.round(newCenter.x - (newWidth / 2))
}
}
function calculateBottom(style, curPositon, proportion, needLockProportion, pointInfo) {
const { symmetricPoint, curPoint } = pointInfo
const rotatedcurPositon = calculateRotatedPointCoordinate(curPositon, curPoint, -style.rotate)
const rotatedBottomMiddlePoint = calculateRotatedPointCoordinate({
x: curPoint.x,
y: rotatedcurPositon.y,
}, curPoint, style.rotate)
const newHeight = Math.sqrt((rotatedBottomMiddlePoint.x - symmetricPoint.x) ** 2 + (rotatedBottomMiddlePoint.y - symmetricPoint.y) ** 2)
if (newHeight > 0) {
const newCenter = {
x: rotatedBottomMiddlePoint.x - (rotatedBottomMiddlePoint.x - symmetricPoint.x) / 2,
y: rotatedBottomMiddlePoint.y + (symmetricPoint.y - rotatedBottomMiddlePoint.y) / 2,
}
const { symmetricPoint, curPoint } = pointInfo
const rotatedcurPositon = calculateRotatedPointCoordinate(curPositon, curPoint, -style.rotate)
const rotatedBottomMiddlePoint = calculateRotatedPointCoordinate({
x: curPoint.x,
y: rotatedcurPositon.y
}, curPoint, style.rotate)
let width = style.width
// 因为调整的是高度 所以只需根据锁定的比例调整宽度即可
if (needLockProportion) {
width = newHeight * proportion
}
style.width = width
style.height = Math.round(newHeight)
style.top = Math.round(newCenter.y - (newHeight / 2))
style.left = Math.round(newCenter.x - (style.width / 2))
const newHeight = Math.sqrt((rotatedBottomMiddlePoint.x - symmetricPoint.x) ** 2 + (rotatedBottomMiddlePoint.y - symmetricPoint.y) ** 2)
if (newHeight > 0) {
const newCenter = {
x: rotatedBottomMiddlePoint.x - (rotatedBottomMiddlePoint.x - symmetricPoint.x) / 2,
y: rotatedBottomMiddlePoint.y + (symmetricPoint.y - rotatedBottomMiddlePoint.y) / 2
}
let width = style.width
// 因为调整的是高度 所以只需根据锁定的比例调整宽度即可
if (needLockProportion) {
width = newHeight * proportion
}
style.width = width
style.height = Math.round(newHeight)
style.top = Math.round(newCenter.y - (newHeight / 2))
style.left = Math.round(newCenter.x - (style.width / 2))
}
}
function calculateLeft(style, curPositon, proportion, needLockProportion, pointInfo) {
const { symmetricPoint, curPoint } = pointInfo
const rotatedcurPositon = calculateRotatedPointCoordinate(curPositon, curPoint, -style.rotate)
const rotatedLeftMiddlePoint = calculateRotatedPointCoordinate({
x: rotatedcurPositon.x,
y: curPoint.y,
}, curPoint, style.rotate)
const newWidth = Math.sqrt((rotatedLeftMiddlePoint.x - symmetricPoint.x) ** 2 + (rotatedLeftMiddlePoint.y - symmetricPoint.y) ** 2)
if (newWidth > 0) {
const newCenter = {
x: rotatedLeftMiddlePoint.x - (rotatedLeftMiddlePoint.x - symmetricPoint.x) / 2,
y: rotatedLeftMiddlePoint.y + (symmetricPoint.y - rotatedLeftMiddlePoint.y) / 2,
}
let height = style.height
if (needLockProportion) {
height = newWidth / proportion
}
style.height = height
style.width = Math.round(newWidth)
style.top = Math.round(newCenter.y - (style.height / 2))
style.left = Math.round(newCenter.x - (newWidth / 2))
const { symmetricPoint, curPoint } = pointInfo
const rotatedcurPositon = calculateRotatedPointCoordinate(curPositon, curPoint, -style.rotate)
const rotatedLeftMiddlePoint = calculateRotatedPointCoordinate({
x: rotatedcurPositon.x,
y: curPoint.y
}, curPoint, style.rotate)
const newWidth = Math.sqrt((rotatedLeftMiddlePoint.x - symmetricPoint.x) ** 2 + (rotatedLeftMiddlePoint.y - symmetricPoint.y) ** 2)
if (newWidth > 0) {
const newCenter = {
x: rotatedLeftMiddlePoint.x - (rotatedLeftMiddlePoint.x - symmetricPoint.x) / 2,
y: rotatedLeftMiddlePoint.y + (symmetricPoint.y - rotatedLeftMiddlePoint.y) / 2
}
let height = style.height
if (needLockProportion) {
height = newWidth / proportion
}
style.height = height
style.width = Math.round(newWidth)
style.top = Math.round(newCenter.y - (style.height / 2))
style.left = Math.round(newCenter.x - (newWidth / 2))
}
}
export default function calculateComponentPositonAndSize(name, style, curPositon, proportion, needLockProportion, pointInfo) {
funcs[name](style, curPositon, proportion, needLockProportion, pointInfo)
}
funcs[name](style, curPositon, proportion, needLockProportion, pointInfo)
}

View File

@ -126,6 +126,30 @@ export function changeStyleWithScale(value) {
return value * parseInt(store.state.canvasStyleData.scale) / 100
}
export function changeStyleWithScaleIn(value, scale) {
return value * parseInt(scale) / 100
// 自适应宽高
export function changeStyleWithScaleHeightInAuto(value) {
const scale = store.state.canvasStyleData.scaleHeight ? store.state.canvasStyleData.scaleHeight : 100
const result = value * scale / 100
console.log('heightInAuto=>' + scale + ';' + result)
return result
}
// 自适应宽高
export function changeStyleWithScaleWidthInAuto(value) {
const scale = store.state.canvasStyleData.scaleWidth ? store.state.canvasStyleData.scaleWidth : 100
const result = value * scale / 100
console.log('widthInAuto=>' + scale + ';' + result)
return result
}
export function getOriginStyleHeight(value) {
const scale = store.state.canvasStyleData.scaleHeight ? store.state.canvasStyleData.scaleHeight : 100
const result = value / (scale / 100)
return result
}
export function getOriginStyleWidth(value) {
const scale = store.state.canvasStyleData.scaleWidth ? store.state.canvasStyleData.scaleWidth : 100
const result = value / (scale / 100)
return result
}

View File

@ -42,6 +42,7 @@ const data = {
canvasStyleData: DEFAULT_COMMON_CANVAS_STYLE, // 页面全局数据 //扩展公共样式 公共的仪表板样式,用来实时响应样式的变化
componentData: [], // 画布组件数据
curComponent: null,
curCanvasScale: null,
curComponentIndex: null,
// 点击画布时是否点中组件,主要用于取消选中组件用。
// 如果没点中组件,并且在画布空白处弹起鼠标,则取消当前组件的选中状态
@ -75,11 +76,16 @@ const data = {
state.curComponentIndex = index
},
setShapeStyle({ curComponent }, { top, left, width, height, rotate }) {
if (top) curComponent.style.top = top
if (left) curComponent.style.left = left
if (width) curComponent.style.width = width
if (height) curComponent.style.height = height
setCurCanvasScale(state, curCanvasScale) {
debugger
state.curCanvasScale = curCanvasScale
},
setShapeStyle({ curComponent, canvasStyleData, curCanvasScale }, { top, left, width, height, rotate }) {
if (top) curComponent.style.top = parseInt(canvasStyleData.selfAdaption ? (top * 100 / curCanvasScale.scaleHeight) : top)
if (left) curComponent.style.left = parseInt(canvasStyleData.selfAdaption ? (left * 100 / curCanvasScale.scaleWidth) : left)
if (width) curComponent.style.width = parseInt(canvasStyleData.selfAdaption ? (width * 100 / curCanvasScale.scaleWidth) : width)
if (height) curComponent.style.height = parseInt(canvasStyleData.selfAdaption ? (height * 100 / curCanvasScale.scaleHeight) : height)
if (rotate) curComponent.style.rotate = rotate
},

View File

@ -41,7 +41,8 @@ export const filterAsyncRouter = (routers) => { // 遍历后台传来的路由
router.component = 'system/plugin/dynamic'
router.props = {
jsname: jsName,
menuid: router.id
menuid: router.id,
noLayout: router.noLayout
}
}
if (router.component) {

View File

@ -57,7 +57,7 @@
</de-aside-container>
<!--画布区域-->
<de-main-container style="margin-left: 5px;margin-right: 5px">
<de-main-container id="canvasInfo-main" style="margin-left: 5px;margin-right: 5px">
<!--左侧抽屉-->
<el-drawer
:visible.sync="show"
@ -76,13 +76,14 @@
</el-drawer>
<div
id="canvasInfo"
class="content this_canvas"
@drop="handleDrop"
@dragover="handleDragOver"
@mousedown="handleMouseDown"
@mouseup="deselectCurComponent"
>
<Editor style="margin: 15px;" />
<Editor :out-style="outStyle" />
</div>
</de-main-container>
<de-aside-container v-if="aidedButtonActive" :class="aidedButtonActive ? 'show' : 'hidden'" class="style-aside">
@ -147,6 +148,7 @@ import { findOne } from '@/api/panel/panel'
import PreviewFullScreen from '@/components/canvas/components/Editor/PreviewFullScreen'
import Preview from '@/components/canvas/components/Editor/Preview'
import AttrList from '@/components/canvas/components/AttrList.vue'
import elementResizeDetectorMaker from 'element-resize-detector'
//
import '@/components/canvas/assets/iconfont/iconfont.css'
@ -187,7 +189,21 @@ export default {
subjectVisible: false,
previewVisible: false,
componentStyleShow: true,
aidedButtonActive: false
aidedButtonActive: false,
timer: null,
needToChange: [
'top',
'left',
'width',
'height',
'fontSize',
'borderWidth'
],
scale: '100',
outStyle: {
width: null,
height: null
}
}
},
@ -238,6 +254,15 @@ export default {
bus.$on('previewFullScreenClose', () => {
this.previewVisible = false
})
const _this = this
const erd = elementResizeDetectorMaker()
// div
erd.listenTo(document.getElementById('canvasInfo-main'), element => {
_this.$nextTick(() => {
debugger
_this.restore()
})
})
},
beforeDestroy() {
const elx = this.$refs.rightPanel
@ -410,8 +435,24 @@ export default {
},
changeAidedDesign() {
this.aidedButtonActive = !this.aidedButtonActive
},
getOriginStyle(value) {
const scale = this.canvasStyleData.scale
const result = value / (parseInt(scale) / 100)
return result
},
restore() {
debugger
if (document.getElementById('canvasInfo')) {
this.$nextTick(() => {
const canvasHeight = document.getElementById('canvasInfo').offsetHeight
const canvasWidth = document.getElementById('canvasInfo').offsetWidth
this.outStyle.height = canvasHeight
this.outStyle.width = canvasWidth
console.log(canvasHeight + '--' + canvasWidth)
})
}
}
}
}
</script>
@ -419,9 +460,9 @@ export default {
<style scoped>
.ms-aside-container {
height: calc(100vh - 91px);
min-width: 40px;
max-width: 60px;
border: none;
width: 60px;
}
.ms-main-container {

View File

@ -217,9 +217,12 @@ export default {
nodeType: null,
panelType: null,
panelStyle: JSON.stringify({
width: 1280,
height: 720,
width: 1600,
height: 900,
scale: 100,
scaleWidth: 100,
scaleHeight: 100,
selfAdaption: true,
openCommonStyle: true,
panel: DEFAULT_PANEL_STYLE,
chart: {
@ -258,9 +261,12 @@ export default {
nodeType: null,
panelType: null,
panelStyle: JSON.stringify({
width: 1280,
height: 720,
width: 1600,
height: 900,
scale: 100,
scaleWidth: 100,
scaleHeight: 100,
selfAdaption: true,
openCommonStyle: true,
panel: DEFAULT_PANEL_STYLE,
chart: {

View File

@ -19,9 +19,12 @@ export const DEFAULT_PANEL_STYLE = {
}
export const DEFAULT_COMMON_CANVAS_STYLE = {
width: 1280,
height: 720,
width: 1600,
height: 900,
scale: 100,
scaleWidth: 100,
scaleHeight: 100,
selfAdaption: true,
openCommonStyle: true,
panel: DEFAULT_PANEL_STYLE,
chart: {

View File

@ -2,13 +2,13 @@
<de-main-container style="height: calc(100vh - 56px)">
<el-tabs v-model="authorityType" @tab-click="handleClick">
<el-tab-pane name="authConfig">
<span slot="label">{{$t('auth.authConfig')}}</span>
<span slot="label">{{ $t('auth.authConfig') }}</span>
<auth-config />
</el-tab-pane>
<!-- <el-tab-pane name="authQuickConfig">-->
<!-- <span slot="label">{{$t('auth.authQuickConfig')}}</span>-->
<!-- <auth-quick-config />-->
<!-- </el-tab-pane>-->
<!-- <el-tab-pane name="authQuickConfig">-->
<!-- <span slot="label">{{$t('auth.authQuickConfig')}}</span>-->
<!-- <auth-quick-config />-->
<!-- </el-tab-pane>-->
</el-tabs>
</de-main-container>
</template>

View File

@ -1,10 +1,17 @@
<template>
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]" :header="header" :back-name="backName">
<layout-content v-if="!noLayout" v-loading="$store.getters.loadingMap[$store.getters.currentPath]" :header="header" :back-name="backName">
<async-component v-if="showAsync" :url="url" @execute-axios="executeAxios" @on-add-languanges="addLanguages" @on-plugin-layout="setLayoutInfo" />
<div v-else>
<h1>未知组件无法展示</h1>
</div>
</layout-content>
<div v-else>
<async-component v-if="showAsync" :url="url" @execute-axios="executeAxios" @on-add-languanges="addLanguages" @on-plugin-layout="setLayoutInfo" />
<div v-else>
<h1>未知组件无法展示</h1>
</div>
</div>
</template>
<script>
@ -26,6 +33,10 @@ export default {
menuid: {
type: Number,
default: null
},
noLayout: {
type: Boolean,
default: false
}
},
data() {

View File

@ -52,7 +52,7 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { checkPermission } from '@/utils/permission'
// import { checkPermission } from '@/utils/permission'
import { formatCondition } from '@/utils/index'
import { pluginLists, uninstall } from '@/api/system/plugin'
import { getToken } from '@/utils/auth'
@ -64,10 +64,10 @@ export default {
header: '',
columns: [],
buttons: [
{
label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.del,
show: checkPermission(['user:del'])
}
// {
// label: this.$t('commons.delete'), icon: 'el-icon-delete', type: 'danger', click: this.del,
// show: checkPermission(['user:del'])
// }
],
searchConfig: {
useQuickSearch: false,
@ -123,6 +123,7 @@ export default {
},
uploadSuccess(response, file, fileList) {
this.uploading = false
this.search()
},
del(row) {