forked from github/dataease
Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
a06297a73a
@ -8,6 +8,8 @@ import io.dataease.auth.entity.TokenInfo;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.auth.util.JWTUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.AuthenticationInfo;
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
@ -54,6 +56,11 @@ public class F2CRealm extends AuthorizingRealm {
|
||||
|
||||
@Override
|
||||
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken auth) throws AuthenticationException {
|
||||
try {
|
||||
CacheUtils.get("lic_info", "lic");
|
||||
}catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
String token = (String) auth.getCredentials();
|
||||
// 解密获得username,用于和数据库进行对比
|
||||
TokenInfo tokenInfo = JWTUtils.tokenInfoByToken(token);
|
||||
|
@ -6,12 +6,9 @@ import com.auth0.jwt.algorithms.Algorithm;
|
||||
import com.auth0.jwt.exceptions.JWTDecodeException;
|
||||
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||
import io.dataease.auth.entity.TokenInfo;
|
||||
import io.dataease.auth.filter.JWTFilter;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -21,6 +21,12 @@
|
||||
<if test="mode != null">
|
||||
and mode = #{mode,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="typeFilter != null">
|
||||
and type in
|
||||
<foreach collection="typeFilter" item="item" open="(" separator="," close=")">
|
||||
#{item,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
<if test="sort != null">
|
||||
order by ${sort}
|
||||
|
@ -25,12 +25,12 @@ public class DataSetTableController {
|
||||
private DataSetTableService dataSetTableService;
|
||||
|
||||
@PostMapping("batchAdd")
|
||||
public void batchAdd(@RequestBody List<DatasetTable> datasetTable) throws Exception {
|
||||
public void batchAdd(@RequestBody List<DataSetTableRequest> datasetTable) throws Exception {
|
||||
dataSetTableService.batchInsert(datasetTable);
|
||||
}
|
||||
|
||||
@PostMapping("update")
|
||||
public DatasetTable save(@RequestBody DatasetTable datasetTable) throws Exception {
|
||||
public DatasetTable save(@RequestBody DataSetTableRequest datasetTable) throws Exception {
|
||||
return dataSetTableService.save(datasetTable);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,8 @@ public class DataSetTableRequest extends DatasetTable {
|
||||
private String sort;
|
||||
private List<String> tableNames;
|
||||
private String row = "1000";
|
||||
|
||||
private String userId;
|
||||
private Integer editType;
|
||||
private Boolean isRename;
|
||||
private List<String> typeFilter;
|
||||
}
|
||||
|
@ -35,7 +35,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} finally {
|
||||
connection.close();
|
||||
if(connection != null){
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -52,7 +54,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} finally {
|
||||
connection.close();
|
||||
if(connection != null){
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +74,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} finally {
|
||||
connection.close();
|
||||
if(connection != null){
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +116,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} finally {
|
||||
connection.close();
|
||||
if(connection != null){
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +143,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} finally {
|
||||
connection.close();
|
||||
if(connection != null){
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,7 +185,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR: " + e.getMessage(), e);
|
||||
} finally {
|
||||
con.close();
|
||||
if(con != null){
|
||||
con.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +226,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} finally {
|
||||
connection.close();
|
||||
if(connection != null){
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class ScheduleManager {
|
||||
|
||||
triggerBuilder.withIdentity(triggerKey);
|
||||
|
||||
Date nTimeByCron = getNTimeByCron(cron);
|
||||
Date nTimeByCron = getNTimeByCron(cron, startTime);
|
||||
if (startTime.before(new Date())) {
|
||||
triggerBuilder.startAt(nTimeByCron);
|
||||
}
|
||||
@ -156,7 +156,7 @@ public class ScheduleManager {
|
||||
|
||||
triggerBuilder.withIdentity(triggerKey);// 触发器名,触发器组
|
||||
|
||||
Date nTimeByCron = getNTimeByCron(cron);
|
||||
Date nTimeByCron = getNTimeByCron(cron, startTime);
|
||||
if (startTime.before(new Date())) {
|
||||
triggerBuilder.startAt(nTimeByCron);
|
||||
}
|
||||
@ -410,22 +410,38 @@ public class ScheduleManager {
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public static Date getNTimeByCron(String cron) {
|
||||
try {
|
||||
CronTriggerImpl cronTriggerImpl = new CronTriggerImpl();
|
||||
cronTriggerImpl.setCronExpression(cron);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
Date now = calendar.getTime();
|
||||
// calendar.add(java.util.Calendar.YEAR, 1);
|
||||
calendar.add(Calendar.MONTH, 2);
|
||||
// public static Date getNTimeByCron(String cron) {
|
||||
// try {
|
||||
// CronTriggerImpl cronTriggerImpl = new CronTriggerImpl();
|
||||
// cronTriggerImpl.setCronExpression(cron);
|
||||
// Calendar calendar = Calendar.getInstance();
|
||||
// Date now = calendar.getTime();
|
||||
//// calendar.add(java.util.Calendar.YEAR, 1);
|
||||
// calendar.add(Calendar.MONTH, 2);
|
||||
//
|
||||
// List<Date> dates = TriggerUtils.computeFireTimesBetween(cronTriggerImpl, null, now, calendar.getTime());
|
||||
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// String nextTime = dateFormat.format(dates.get(0));
|
||||
// Date date = dateFormat.parse(nextTime);
|
||||
// return date;
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
|
||||
List<Date> dates = TriggerUtils.computeFireTimesBetween(cronTriggerImpl, null, now, calendar.getTime());
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String nextTime = dateFormat.format(dates.get(0));
|
||||
Date date = dateFormat.parse(nextTime);
|
||||
return date;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
public static CronTrigger getCronTrigger(String cron) {
|
||||
if (!CronExpression.isValidExpression(cron)) {
|
||||
throw new RuntimeException("cron :" + cron + " error");
|
||||
}
|
||||
return TriggerBuilder.newTrigger().withIdentity("Calculate Date").withSchedule(CronScheduleBuilder.cronSchedule(cron)).build();
|
||||
|
||||
}
|
||||
|
||||
public static Date getNTimeByCron(String cron, Date start) {
|
||||
CronTrigger trigger = getCronTrigger(cron);
|
||||
if (start == null) {
|
||||
start = trigger.getStartTime();
|
||||
}
|
||||
return trigger.getFireTimeAfter(start);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,80 @@
|
||||
package io.dataease.listener;
|
||||
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import net.sf.ehcache.CacheException;
|
||||
import net.sf.ehcache.Ehcache;
|
||||
import net.sf.ehcache.Element;
|
||||
import net.sf.ehcache.event.CacheEventListener;
|
||||
import net.sf.ehcache.event.CacheEventListenerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.util.Properties;
|
||||
|
||||
@Component
|
||||
public class LicCacheEventListener extends CacheEventListenerFactory implements CacheEventListener {
|
||||
|
||||
private static CacheEventListener cacheEventListener;
|
||||
|
||||
public LicCacheEventListener() {
|
||||
cacheEventListener = cacheEventListener == null ? this : cacheEventListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyElementRemoved(Ehcache ehcache, Element element) throws CacheException {
|
||||
/*System.out.println("notifyElementRemoved");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyElementPut(Ehcache ehcache, Element element) throws CacheException {
|
||||
|
||||
/*long expirationTime = element.getExpirationTime();
|
||||
System.out.println(expirationTime);
|
||||
System.out.println("notifyElementPut");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyElementUpdated(Ehcache ehcache, Element element) throws CacheException {
|
||||
/*System.out.println("notifyElementUpdated");*/
|
||||
}
|
||||
|
||||
/**
|
||||
* lic过期触发: 清除用户、角色、权限缓存
|
||||
* @param ehcache
|
||||
* @param element
|
||||
*/
|
||||
@Override
|
||||
public void notifyElementExpired(Ehcache ehcache, Element element) {
|
||||
// System.out.println("notifyElementExpired");
|
||||
/*String token = ServletUtils.getToken();
|
||||
Long userId = JWTUtils.tokenInfoByToken(token).getUserId();
|
||||
authUserService.clearCache(userId);*/
|
||||
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyElementEvicted(Ehcache ehcache, Element element) {
|
||||
/*System.out.println("notifyElementEvicted");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyRemoveAll(Ehcache ehcache) {
|
||||
/*System.out.println("notifyRemoveAll");*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public CacheEventListener createCacheEventListener(Properties properties) {
|
||||
return cacheEventListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package io.dataease.listener.util;
|
||||
|
||||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.Element;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import java.util.Date;
|
||||
|
||||
@Configuration
|
||||
public class CacheUtils {
|
||||
|
||||
private static CacheManager manager;
|
||||
|
||||
@Autowired
|
||||
public void setManager(CacheManager manager) {
|
||||
CacheUtils.manager = manager;
|
||||
}
|
||||
|
||||
public static Object get(String cacheName, Object key) {
|
||||
Element element = cache(cacheName).get(key);
|
||||
if (null == element) return null;
|
||||
return element.getObjectValue();
|
||||
}
|
||||
|
||||
private static void put(String cacheName, Object key, Object value, Integer ttl, Integer tti) {
|
||||
Element e = new Element(key, value);
|
||||
//不设置则使用xml配置
|
||||
if (ttl != null)
|
||||
e.setEternal(false);
|
||||
e.setTimeToLive(ttl);
|
||||
if (tti != null)
|
||||
e.setTimeToIdle(tti);
|
||||
cache(cacheName).put(e);
|
||||
}
|
||||
|
||||
private static boolean remove(String cacheName, Object key) {
|
||||
return cache(cacheName).remove(key);
|
||||
}
|
||||
|
||||
public static void removeAll(String cacheName) {
|
||||
cache(cacheName).removeAll();
|
||||
}
|
||||
|
||||
private static Cache cache(String cacheName) {
|
||||
net.sf.ehcache.CacheManager cacheManager = ((EhCacheCacheManager) manager).getCacheManager();
|
||||
if (!cacheManager.cacheExists(cacheName))
|
||||
cacheManager.addCache(cacheName);
|
||||
Cache cacheManagerCache = cacheManager.getCache(cacheName);
|
||||
return cacheManagerCache;
|
||||
}
|
||||
|
||||
public static void updateLicCache(Date expDate){
|
||||
long time = expDate.getTime();
|
||||
long exp = (time - System.currentTimeMillis()) / 1000;
|
||||
int intExp = (int)exp;
|
||||
removeAll("lic_info");
|
||||
put("lic_info", "lic", "lic", intExp, intExp);
|
||||
}
|
||||
}
|
@ -2,18 +2,22 @@ package io.dataease.plugins.server;
|
||||
|
||||
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.handler.annotation.I18n;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
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.XpackSysAuthDetailDTO;
|
||||
import io.dataease.plugins.xpack.auth.dto.response.XpackVAuthModelDTO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.dataease.plugins.xpack.auth.service.AuthXpackService;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@RequestMapping("/plugin/auth")
|
||||
@RestController
|
||||
@ -45,5 +49,13 @@ public class XAuthServer {
|
||||
AuthXpackService sysAuthService = SpringContextUtil.getBean(AuthXpackService.class);
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
sysAuthService.authChange(request, user.getUserId(), user.getUsername(), user.getIsAdmin());
|
||||
// 当权限发生变化 前端实时刷新对应菜单
|
||||
Optional.ofNullable(request.getAuthSourceType()).ifPresent(type -> {
|
||||
if (StringUtils.equals("menu", type)) {
|
||||
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,8 @@ public class DorisQueryProvider extends QueryProvider {
|
||||
filter.append(" ")
|
||||
.append(transMysqlFilterTerm(request.getTerm()))
|
||||
.append(" ");
|
||||
if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
|
||||
if (StringUtils.containsIgnoreCase(request.getTerm(), "null")) {
|
||||
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(value, "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {
|
||||
filter.append("'%").append(value).append("%'");
|
||||
|
@ -302,7 +302,8 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
filter.append(" ")
|
||||
.append(transMysqlFilterTerm(request.getTerm()))
|
||||
.append(" ");
|
||||
if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
|
||||
if (StringUtils.containsIgnoreCase(request.getTerm(), "null")) {
|
||||
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(value, "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {
|
||||
filter.append("'%").append(value).append("%'");
|
||||
|
@ -1,16 +1,18 @@
|
||||
package io.dataease.service;
|
||||
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.commons.license.DefaultLicenseService;
|
||||
import io.dataease.commons.license.F2CLicenseResponse;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@ -23,6 +25,15 @@ public class AboutService {
|
||||
|
||||
public F2CLicenseResponse updateLicense(String licenseKey) {
|
||||
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.updateLicense(product, licenseKey);
|
||||
Optional.ofNullable(f2CLicenseResponse).ifPresent(resp -> {
|
||||
if (resp.getStatus() == F2CLicenseResponse.Status.valid){
|
||||
CacheUtils.updateLicCache(new Date(f2CLicenseResponse.getLicense().getExpired()));
|
||||
|
||||
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
|
||||
}
|
||||
});
|
||||
return f2CLicenseResponse;
|
||||
}
|
||||
|
||||
|
@ -84,13 +84,13 @@ public class DataSetTableService {
|
||||
@Value("${upload.file.path}")
|
||||
private String path;
|
||||
|
||||
public void batchInsert(List<DatasetTable> datasetTable) throws Exception {
|
||||
for (DatasetTable table : datasetTable) {
|
||||
public void batchInsert(List<DataSetTableRequest> datasetTable) throws Exception {
|
||||
for (DataSetTableRequest table : datasetTable) {
|
||||
save(table);
|
||||
}
|
||||
}
|
||||
|
||||
public DatasetTable save(DatasetTable datasetTable) throws Exception {
|
||||
public DatasetTable save(DataSetTableRequest datasetTable) throws Exception {
|
||||
checkName(datasetTable);
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
|
||||
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
||||
@ -114,12 +114,25 @@ public class DataSetTableService {
|
||||
}
|
||||
} else {
|
||||
int update = datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
|
||||
// sql 更新
|
||||
if (update == 1) {
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql") || StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||
// 删除所有字段,重新抽象
|
||||
dataSetTableFieldsService.deleteByTableId(datasetTable.getId());
|
||||
saveTableField(datasetTable);
|
||||
if (datasetTable.getIsRename() == null || !datasetTable.getIsRename()) {
|
||||
// 更新数据和字段
|
||||
if (update == 1) {
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql") || StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||
// 删除所有字段,重新抽象
|
||||
dataSetTableFieldsService.deleteByTableId(datasetTable.getId());
|
||||
saveTableField(datasetTable);
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
|
||||
if (datasetTable.getEditType() == 0) {
|
||||
commonThreadPool.addTask(() -> {
|
||||
extractDataService.extractData(datasetTable.getId(), null, "all_scope", null);
|
||||
});
|
||||
} else if (datasetTable.getEditType() == 1) {
|
||||
commonThreadPool.addTask(() -> {
|
||||
extractDataService.extractData(datasetTable.getId(), null, "add_scope", null);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,9 +148,12 @@ public class DataSetTableService {
|
||||
// 删除关联关系
|
||||
dataSetTableUnionService.deleteUnionByTableId(id);
|
||||
try {
|
||||
deleteDorisTable(id, table);
|
||||
// 抽取的数据集删除doris
|
||||
if (table.getMode() == 1) {
|
||||
deleteDorisTable(id, table);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,6 +179,7 @@ public class DataSetTableService {
|
||||
|
||||
public List<DataSetTableDTO> list(DataSetTableRequest dataSetTableRequest) {
|
||||
dataSetTableRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
dataSetTableRequest.setTypeFilter(dataSetTableRequest.getTypeFilter());
|
||||
return extDataSetTableMapper.search(dataSetTableRequest);
|
||||
}
|
||||
|
||||
@ -706,10 +723,17 @@ public class DataSetTableService {
|
||||
} else {
|
||||
rows = sheet0.getPhysicalNumberOfRows();
|
||||
}
|
||||
int columnNum = 0;
|
||||
for (int i = 0; i < rows; i++) {
|
||||
HSSFRow row = sheet0.getRow(i);
|
||||
String[] r = new String[row.getPhysicalNumberOfCells()];
|
||||
for (int j = 0; j < row.getPhysicalNumberOfCells(); j++) {
|
||||
if (i == 0) {
|
||||
if (row == null) {
|
||||
throw new RuntimeException(Translator.get("i18n_excel_header_empty"));
|
||||
}
|
||||
columnNum = row.getPhysicalNumberOfCells();
|
||||
}
|
||||
String[] r = new String[columnNum];
|
||||
for (int j = 0; j < columnNum; j++) {
|
||||
if (i == 0) {
|
||||
TableFiled tableFiled = new TableFiled();
|
||||
tableFiled.setFieldType("TEXT");
|
||||
@ -722,8 +746,14 @@ public class DataSetTableService {
|
||||
tableFiled.setRemarks(columnName);
|
||||
fields.add(tableFiled);
|
||||
} else if (i == 1) {
|
||||
if (row == null) {
|
||||
break;
|
||||
}
|
||||
r[j] = readCell(row.getCell(j), true, fields.get(j));
|
||||
} else {
|
||||
if (row == null) {
|
||||
break;
|
||||
}
|
||||
r[j] = readCell(row.getCell(j), false, null);
|
||||
}
|
||||
}
|
||||
@ -746,10 +776,17 @@ public class DataSetTableService {
|
||||
} else {
|
||||
rows = sheet0.getPhysicalNumberOfRows();
|
||||
}
|
||||
int columnNum = 0;
|
||||
for (int i = 0; i < rows; i++) {
|
||||
XSSFRow row = sheet0.getRow(i);
|
||||
String[] r = new String[row.getPhysicalNumberOfCells()];
|
||||
for (int j = 0; j < row.getPhysicalNumberOfCells(); j++) {
|
||||
if (i == 0) {
|
||||
if (row == null) {
|
||||
throw new RuntimeException(Translator.get("i18n_excel_header_empty"));
|
||||
}
|
||||
columnNum = row.getPhysicalNumberOfCells();
|
||||
}
|
||||
String[] r = new String[columnNum];
|
||||
for (int j = 0; j < columnNum; j++) {
|
||||
if (i == 0) {
|
||||
TableFiled tableFiled = new TableFiled();
|
||||
tableFiled.setFieldType("TEXT");
|
||||
@ -762,8 +799,14 @@ public class DataSetTableService {
|
||||
tableFiled.setRemarks(columnName);
|
||||
fields.add(tableFiled);
|
||||
} else if (i == 1) {
|
||||
if (row == null) {
|
||||
break;
|
||||
}
|
||||
r[j] = readCell(row.getCell(j), true, fields.get(j));
|
||||
} else {
|
||||
if (row == null) {
|
||||
break;
|
||||
}
|
||||
r[j] = readCell(row.getCell(j), false, null);
|
||||
}
|
||||
}
|
||||
@ -815,6 +858,9 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
private String readCell(Cell cell, boolean cellType, TableFiled tableFiled) {
|
||||
if (cell == null) {
|
||||
return "";
|
||||
}
|
||||
CellType cellTypeEnum = cell.getCellTypeEnum();
|
||||
if (cellTypeEnum.equals(CellType.STRING)) {
|
||||
if (cellType) {
|
||||
@ -915,7 +961,7 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
DatasetTable record = new DatasetTable();
|
||||
record.setSyncStatus(JobStatus.Completed.name());
|
||||
record.setSyncStatus(JobStatus.Error.name());
|
||||
example.clear();
|
||||
example.createCriteria().andSyncStatusEqualTo(JobStatus.Underway.name()).andIdIn(jobStoppeddDatasetTables.stream().map(DatasetTable::getId).collect(Collectors.toList()));
|
||||
datasetTableMapper.updateByExampleSelective(record, example);
|
||||
|
@ -69,6 +69,7 @@ public class DataSetTableTaskLogService {
|
||||
if(StringUtils.isNotEmpty(datasetTableTaskLog.getTaskId())){
|
||||
criteria.andTaskIdEqualTo(datasetTableTaskLog.getTaskId());
|
||||
}
|
||||
example.setOrderByClause("create_time desc");
|
||||
return datasetTableTaskLogMapper.selectByExampleWithBLOBs(example);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import io.dataease.commons.constants.ScheduleType;
|
||||
import io.dataease.controller.request.dataset.DataSetTaskRequest;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.service.ScheduleService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.quartz.CronExpression;
|
||||
@ -61,7 +62,16 @@ public class DataSetTableTaskService {
|
||||
datasetTableTask.setCreateTime(System.currentTimeMillis());
|
||||
// SIMPLE 类型,提前占位
|
||||
if (datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||
if (extractDataService.updateSyncStatus(dataSetTableService.get(datasetTableTask.getTableId()))) {
|
||||
if(datasetTableTask.getType().equalsIgnoreCase("add_scope")){
|
||||
DatasetTableTaskLog request = new DatasetTableTaskLog();
|
||||
request.setTableId(datasetTableTask.getTableId());
|
||||
request.setStatus(JobStatus.Completed.name());
|
||||
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.select(request);
|
||||
if (CollectionUtils.isEmpty(datasetTableTaskLogs)) {
|
||||
throw new Exception(Translator.get("i18n_not_exec_add_sync"));
|
||||
}
|
||||
}
|
||||
if (extractDataService.updateSyncStatusIsNone(dataSetTableService.get(datasetTableTask.getTableId()))) {
|
||||
throw new Exception(Translator.get("i18n_sync_job_exists"));
|
||||
}else {
|
||||
//write log
|
||||
|
@ -27,6 +27,9 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
@ -34,6 +37,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.pentaho.di.cluster.SlaveServer;
|
||||
import org.pentaho.di.core.database.DatabaseMeta;
|
||||
import org.pentaho.di.core.row.ValueMetaInterface;
|
||||
import org.pentaho.di.core.util.HttpClientManager;
|
||||
import org.pentaho.di.job.Job;
|
||||
import org.pentaho.di.job.JobExecutionConfiguration;
|
||||
import org.pentaho.di.job.JobHopMeta;
|
||||
@ -66,6 +70,7 @@ import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -124,6 +129,181 @@ public class ExtractDataService {
|
||||
" exit 1\n" +
|
||||
"fi\n" +
|
||||
"rm -rf %s\n";
|
||||
|
||||
public synchronized boolean updateSyncStatusIsNone(DatasetTable datasetTable ){
|
||||
datasetTable.setSyncStatus(JobStatus.Underway.name());
|
||||
DatasetTableExample example = new DatasetTableExample();
|
||||
example.createCriteria().andIdEqualTo(datasetTable.getId());
|
||||
datasetTableMapper.selectByExample(example);
|
||||
example.clear();
|
||||
example.createCriteria().andIdEqualTo(datasetTable.getId()).andSyncStatusNotEqualTo(JobStatus.Underway.name());
|
||||
example.or(example.createCriteria().andIdEqualTo(datasetTable.getId()).andSyncStatusIsNull());
|
||||
return datasetTableMapper.updateByExampleSelective(datasetTable, example) == 0;
|
||||
}
|
||||
|
||||
public void extractData(String datasetTableId, String taskId, String type, JobExecutionContext context) {
|
||||
DatasetTable datasetTable = getDatasetTable(datasetTableId);
|
||||
if(datasetTable == null){
|
||||
LogUtil.error("Can not find DatasetTable: " + datasetTableId);
|
||||
}
|
||||
DatasetTableTask datasetTableTask = datasetTableTaskMapper.selectByPrimaryKey(taskId);
|
||||
boolean isCronJob = (datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.CRON.toString()));
|
||||
if(updateSyncStatusIsNone(datasetTable) && isCronJob){
|
||||
LogUtil.info("Skip synchronization task for table : " + datasetTableId);
|
||||
return;
|
||||
}
|
||||
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
|
||||
UpdateType updateType = UpdateType.valueOf(type);
|
||||
Datasource datasource = new Datasource();
|
||||
if(context != null){
|
||||
datasetTable.setQrtzInstance(context.getFireInstanceId());
|
||||
datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(datasetTable.getDataSourceId())) {
|
||||
datasource = datasourceMapper.selectByPrimaryKey(datasetTable.getDataSourceId());
|
||||
} else {
|
||||
datasource.setType(datasetTable.getType());
|
||||
}
|
||||
|
||||
List<DatasetTableField> datasetTableFields = dataSetTableFieldsService.list(DatasetTableField.builder().tableId(datasetTable.getId()).build());
|
||||
datasetTableFields.sort((o1, o2) -> {
|
||||
if (o1.getColumnIndex() == null) {
|
||||
return -1;
|
||||
}
|
||||
if (o2.getColumnIndex() == null) {
|
||||
return 1;
|
||||
}
|
||||
return o1.getColumnIndex().compareTo(o2.getColumnIndex());
|
||||
});
|
||||
String dorisTablColumnSql = createDorisTablColumnSql(datasetTableFields);
|
||||
|
||||
switch (updateType) {
|
||||
case all_scope: // 全量更新
|
||||
try{
|
||||
if(datasource.getType().equalsIgnoreCase("excel")){
|
||||
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, null);
|
||||
}
|
||||
if(datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.CRON.toString())) {
|
||||
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
|
||||
}
|
||||
if(datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||
datasetTableTaskLog = getDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
|
||||
}
|
||||
createDorisTable(DorisTableUtils.dorisName(datasetTableId), dorisTablColumnSql);
|
||||
createDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)), dorisTablColumnSql);
|
||||
generateTransFile("all_scope", datasetTable, datasource, datasetTableFields, null);
|
||||
generateJobFile("all_scope", datasetTable, String.join(",", datasetTableFields.stream().map(DatasetTableField::getDataeaseName).collect(Collectors.toList())));
|
||||
extractData(datasetTable, "all_scope");
|
||||
replaceTable(DorisTableUtils.dorisName(datasetTableId));
|
||||
saveSucessLog(datasetTableTaskLog);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed);
|
||||
}catch (Exception e){
|
||||
saveErrorLog(datasetTableId, taskId, e);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error);
|
||||
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
|
||||
}finally {
|
||||
if (datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||
datasetTableTask.setRate(ScheduleType.SIMPLE_COMPLETE.toString());
|
||||
dataSetTableTaskService.update(datasetTableTask);
|
||||
}
|
||||
deleteFile("all_scope", datasetTableId);
|
||||
}
|
||||
break;
|
||||
|
||||
case add_scope: // 增量更新
|
||||
try {
|
||||
if(datasource.getType().equalsIgnoreCase("excel")){
|
||||
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, null);
|
||||
generateTransFile("incremental_add", datasetTable, datasource, datasetTableFields, null);
|
||||
generateJobFile("incremental_add", datasetTable, String.join(",", datasetTableFields.stream().map(DatasetTableField::getDataeaseName).collect(Collectors.toList())));
|
||||
extractData(datasetTable, "incremental_add");
|
||||
saveSucessLog(datasetTableTaskLog);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed);
|
||||
}else {
|
||||
DatasetTableIncrementalConfig datasetTableIncrementalConfig = dataSetTableService.incrementalConfig(datasetTableId);
|
||||
if (datasetTableIncrementalConfig == null || StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())) {
|
||||
return;
|
||||
}
|
||||
DatasetTableTaskLog request = new DatasetTableTaskLog();
|
||||
request.setTableId(datasetTableId);
|
||||
request.setStatus(JobStatus.Completed.name());
|
||||
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.select(request);
|
||||
if (CollectionUtils.isEmpty(datasetTableTaskLogs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.CRON.toString())) {
|
||||
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
|
||||
}
|
||||
if(datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||
datasetTableTaskLog = getDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {// 增量添加
|
||||
String sql = datasetTableIncrementalConfig.getIncrementalAdd().replace(lastUpdateTime, datasetTableTaskLogs.get(0).getStartTime().toString())
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
|
||||
generateTransFile("incremental_add", datasetTable, datasource, datasetTableFields, sql);
|
||||
generateJobFile("incremental_add", datasetTable, fetchSqlField(sql, datasource));
|
||||
extractData(datasetTable, "incremental_add");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete().replace(" ", ""))) {// 增量删除
|
||||
String sql = datasetTableIncrementalConfig.getIncrementalDelete().replace(lastUpdateTime, datasetTableTaskLogs.get(0).getStartTime().toString())
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString());
|
||||
generateTransFile("incremental_delete", datasetTable, datasource, datasetTableFields, sql);
|
||||
generateJobFile("incremental_delete", datasetTable, fetchSqlField(sql, datasource));
|
||||
extractData(datasetTable, "incremental_delete");
|
||||
}
|
||||
saveSucessLog(datasetTableTaskLog);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Completed);
|
||||
}
|
||||
}catch (Exception e){
|
||||
saveErrorLog(datasetTableId, taskId, e);
|
||||
updateTableStatus(datasetTableId, datasetTable, JobStatus.Error);
|
||||
}finally {
|
||||
if (datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||
datasetTableTask.setRate(ScheduleType.SIMPLE_COMPLETE.toString());
|
||||
dataSetTableTaskService.update(datasetTableTask);
|
||||
}
|
||||
deleteFile("incremental_add", datasetTableId);
|
||||
deleteFile("incremental_delete", datasetTableId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTableStatus(String datasetTableId, DatasetTable datasetTable, JobStatus completed) {
|
||||
datasetTable.setSyncStatus(completed.name());
|
||||
DatasetTableExample example = new DatasetTableExample();
|
||||
example.createCriteria().andIdEqualTo(datasetTableId);
|
||||
datasetTableMapper.updateByExampleSelective(datasetTable, example);
|
||||
}
|
||||
|
||||
private void saveSucessLog(DatasetTableTaskLog datasetTableTaskLog) {
|
||||
datasetTableTaskLog.setStatus(JobStatus.Completed.name());
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
}
|
||||
|
||||
private void saveErrorLog(String datasetTableId, String taskId, Exception e){
|
||||
LogUtil.error("Extract data error: " + datasetTableId, e);
|
||||
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
|
||||
datasetTableTaskLog.setTableId(datasetTableId);
|
||||
datasetTableTaskLog.setStatus(JobStatus.Underway.name());
|
||||
if(StringUtils.isNotEmpty(taskId)){
|
||||
datasetTableTaskLog.setTaskId(taskId);
|
||||
}
|
||||
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.select(datasetTableTaskLog);
|
||||
if(CollectionUtils.isNotEmpty(datasetTableTaskLogs)){
|
||||
datasetTableTaskLog = datasetTableTaskLogs.get(0);
|
||||
datasetTableTaskLog.setStatus(JobStatus.Error.name());
|
||||
datasetTableTaskLog.setInfo(ExceptionUtils.getStackTrace(e));
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String createDorisTablColumnSql(List<DatasetTableField> datasetTableFields) {
|
||||
String Column_Fields = "dataease_uuid varchar(50), `";
|
||||
for (DatasetTableField datasetTableField : datasetTableFields) {
|
||||
@ -189,133 +369,6 @@ public class ExtractDataService {
|
||||
jdbcProvider.exec(datasourceRequest);
|
||||
}
|
||||
|
||||
public synchronized boolean updateSyncStatus(DatasetTable datasetTable ){
|
||||
datasetTable.setSyncStatus(JobStatus.Underway.name());
|
||||
DatasetTableExample example = new DatasetTableExample();
|
||||
example.createCriteria().andIdEqualTo(datasetTable.getId());
|
||||
datasetTableMapper.selectByExample(example);
|
||||
example.clear();
|
||||
example.createCriteria().andIdEqualTo(datasetTable.getId()).andSyncStatusNotEqualTo(JobStatus.Underway.name());
|
||||
example.or(example.createCriteria().andIdEqualTo(datasetTable.getId()).andSyncStatusIsNull());
|
||||
return datasetTableMapper.updateByExampleSelective(datasetTable, example) == 0;
|
||||
}
|
||||
|
||||
public void extractData(String datasetTableId, String taskId, String type, JobExecutionContext context) {
|
||||
DatasetTable datasetTable = getDatasetTable(datasetTableId);
|
||||
if(datasetTable == null){
|
||||
LogUtil.error("Can not find DatasetTable: " + datasetTableId);
|
||||
}
|
||||
DatasetTableTask datasetTableTask = datasetTableTaskMapper.selectByPrimaryKey(taskId);
|
||||
boolean isCronJob = (datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.CRON.toString()));
|
||||
if(updateSyncStatus(datasetTable) && isCronJob){
|
||||
LogUtil.info("Skip synchronization task for table : " + datasetTableId);
|
||||
return;
|
||||
}
|
||||
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
|
||||
UpdateType updateType = UpdateType.valueOf(type);
|
||||
Datasource datasource = new Datasource();
|
||||
try {
|
||||
if(context != null){
|
||||
datasetTable.setQrtzInstance(context.getFireInstanceId());
|
||||
datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(datasetTable.getDataSourceId())) {
|
||||
datasource = datasourceMapper.selectByPrimaryKey(datasetTable.getDataSourceId());
|
||||
} else {
|
||||
datasource.setType(datasetTable.getType());
|
||||
}
|
||||
|
||||
List<DatasetTableField> datasetTableFields = dataSetTableFieldsService.list(DatasetTableField.builder().tableId(datasetTable.getId()).build());
|
||||
datasetTableFields.sort((o1, o2) -> {
|
||||
if (o1.getColumnIndex() == null) {
|
||||
return -1;
|
||||
}
|
||||
if (o2.getColumnIndex() == null) {
|
||||
return 1;
|
||||
}
|
||||
return o1.getColumnIndex().compareTo(o2.getColumnIndex());
|
||||
});
|
||||
String dorisTablColumnSql = createDorisTablColumnSql(datasetTableFields);
|
||||
switch (updateType) {
|
||||
// 全量更新
|
||||
case all_scope:
|
||||
datasetTableTaskLog = getDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
|
||||
createDorisTable(DorisTableUtils.dorisName(datasetTableId), dorisTablColumnSql);
|
||||
createDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)), dorisTablColumnSql);
|
||||
generateTransFile("all_scope", datasetTable, datasource, datasetTableFields, null);
|
||||
generateJobFile("all_scope", datasetTable, String.join(",", datasetTableFields.stream().map(DatasetTableField::getDataeaseName).collect(Collectors.toList())));
|
||||
extractData(datasetTable, "all_scope");
|
||||
replaceTable(DorisTableUtils.dorisName(datasetTableId));
|
||||
datasetTableTaskLog.setStatus(JobStatus.Completed.name());
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
break;
|
||||
|
||||
// 增量更新
|
||||
case add_scope:
|
||||
DatasetTableIncrementalConfig datasetTableIncrementalConfig = dataSetTableService.incrementalConfig(datasetTableId);
|
||||
if (datasetTableIncrementalConfig == null || StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())) {
|
||||
return;
|
||||
}
|
||||
DatasetTableTaskLog request = new DatasetTableTaskLog();
|
||||
request.setTableId(datasetTableId);
|
||||
request.setStatus(JobStatus.Completed.name());
|
||||
List<DataSetTaskLogDTO> dataSetTaskLogDTOS = dataSetTableTaskLogService.list(request);
|
||||
if (CollectionUtils.isEmpty(dataSetTaskLogDTOS)) {
|
||||
return;
|
||||
}
|
||||
datasetTableTaskLog = writeDatasetTableTaskLog(datasetTableTaskLog, datasetTableId, taskId);
|
||||
|
||||
// 增量添加
|
||||
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalAdd().replace(" ", ""))) {
|
||||
String sql = datasetTableIncrementalConfig.getIncrementalAdd().replace(lastUpdateTime, dataSetTaskLogDTOS.get(0).getStartTime().toString()
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString()));
|
||||
generateTransFile("incremental_add", datasetTable, datasource, datasetTableFields, sql);
|
||||
generateJobFile("incremental_add", datasetTable, fetchSqlField(sql, datasource));
|
||||
extractData(datasetTable, "incremental_add");
|
||||
}
|
||||
|
||||
// 增量删除
|
||||
if (StringUtils.isNotEmpty(datasetTableIncrementalConfig.getIncrementalDelete())) {
|
||||
String sql = datasetTableIncrementalConfig.getIncrementalDelete().replace(lastUpdateTime, dataSetTaskLogDTOS.get(0).getStartTime().toString()
|
||||
.replace(currentUpdateTime, Long.valueOf(System.currentTimeMillis()).toString()));
|
||||
generateTransFile("incremental_delete", datasetTable, datasource, datasetTableFields, sql);
|
||||
generateJobFile("incremental_delete", datasetTable, fetchSqlField(sql, datasource));
|
||||
extractData(datasetTable, "incremental_delete");
|
||||
}
|
||||
datasetTableTaskLog.setStatus(JobStatus.Completed.name());
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
break;
|
||||
}
|
||||
datasetTable.setSyncStatus(JobStatus.Completed.name());
|
||||
DatasetTableExample example = new DatasetTableExample();
|
||||
example.createCriteria().andIdEqualTo(datasetTableId);
|
||||
datasetTableMapper.updateByExampleSelective(datasetTable, example);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error("Extract data error: " + datasetTableId, e);
|
||||
datasetTableTaskLog.setStatus(JobStatus.Error.name());
|
||||
datasetTableTaskLog.setInfo(ExceptionUtils.getStackTrace(e));
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
|
||||
datasetTable.setSyncStatus(JobStatus.Error.name());
|
||||
DatasetTableExample example = new DatasetTableExample();
|
||||
example.createCriteria().andIdEqualTo(datasetTableId);
|
||||
datasetTableMapper.updateByExampleSelective(datasetTable, example);
|
||||
|
||||
if(updateType.name().equalsIgnoreCase("all_scope")){
|
||||
dropDorisTable(DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTableId)));
|
||||
}
|
||||
} finally {
|
||||
if (datasetTableTask != null && datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||
datasetTableTask.setRate(ScheduleType.SIMPLE_COMPLETE.toString());
|
||||
dataSetTableTaskService.update(datasetTableTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DatasetTable getDatasetTable(String datasetTableId){
|
||||
for (int i=0;i<5;i++){
|
||||
DatasetTable datasetTable = dataSetTableService.get(datasetTableId);
|
||||
@ -353,6 +406,9 @@ public class ExtractDataService {
|
||||
if(CollectionUtils.isNotEmpty(datasetTableTaskLogs)){
|
||||
return datasetTableTaskLogs.get(0);
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
}catch (Exception ignore){}
|
||||
}
|
||||
datasetTableTaskLog.setStartTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
@ -360,8 +416,6 @@ public class ExtractDataService {
|
||||
}
|
||||
|
||||
private void extractData(DatasetTable datasetTable, String extractType) throws Exception {
|
||||
|
||||
|
||||
KettleFileRepository repository = CommonBeanFactory.getBean(KettleFileRepository.class);
|
||||
RepositoryDirectoryInterface repositoryDirectoryInterface = repository.loadRepositoryDirectoryTree();
|
||||
JobMeta jobMeta = null;
|
||||
@ -643,7 +697,7 @@ public class ExtractDataService {
|
||||
ExcelInputField field = new ExcelInputField();
|
||||
field.setName(datasetTableFields.get(i).getOriginName());
|
||||
if(datasetTableFields.get(i).getDeExtractType() == 1){
|
||||
field.setType("Date");
|
||||
field.setType("String");
|
||||
field.setFormat("yyyy-MM-dd HH:mm:ss");
|
||||
}else {
|
||||
field.setType("String");
|
||||
@ -692,6 +746,7 @@ public class ExtractDataService {
|
||||
tmp_code = tmp_code.replace("handleExcelWraps", handleExcelWraps);
|
||||
}else {
|
||||
tmp_code = tmp_code.replace("handleExcelIntColumn", "");
|
||||
tmp_code = tmp_code.replace("handleExcelWraps", "");
|
||||
}
|
||||
UserDefinedJavaClassDef userDefinedJavaClassDef = new UserDefinedJavaClassDef(UserDefinedJavaClassDef.ClassType.TRANSFORM_CLASS, "Processor", tmp_code);
|
||||
|
||||
@ -705,28 +760,57 @@ public class ExtractDataService {
|
||||
return userDefinedJavaClassStep;
|
||||
}
|
||||
|
||||
private void deleteFile(String type, String dataSetTableId){
|
||||
String transName = null;
|
||||
String jobName = null;
|
||||
|
||||
switch (type) {
|
||||
case "all_scope":
|
||||
transName = "trans_" + dataSetTableId;
|
||||
jobName = "job_" + dataSetTableId;
|
||||
break;
|
||||
case "incremental_add":
|
||||
transName = "trans_add_" + dataSetTableId;
|
||||
jobName = "job_add_" + dataSetTableId;
|
||||
break;
|
||||
case "incremental_delete":
|
||||
transName = "trans_delete_" + dataSetTableId;
|
||||
jobName = "job_delete_" + dataSetTableId;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
try{
|
||||
File file = new File(root_path + jobName + ".kjb");
|
||||
FileUtils.forceDelete(file);
|
||||
}catch (Exception e){}
|
||||
try{
|
||||
File file = new File(root_path + transName + ".ktr");
|
||||
FileUtils.forceDelete(file);
|
||||
}catch (Exception e){}
|
||||
}
|
||||
|
||||
public boolean isKettleRunning() {
|
||||
return true;
|
||||
// try {
|
||||
// if (!InetAddress.getByName(carte).isReachable(1000)) {
|
||||
// return false;
|
||||
// }
|
||||
// HttpClient httpClient;
|
||||
// HttpGet getMethod = new HttpGet("http://" + carte + ":" + port);
|
||||
// HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
|
||||
// clientBuilder.setConnectionTimeout(1);
|
||||
// clientBuilder.setCredentials(user, passwd);
|
||||
// httpClient = clientBuilder.build();
|
||||
// HttpResponse httpResponse = httpClient.execute(getMethod);
|
||||
// int statusCode = httpResponse.getStatusLine().getStatusCode();
|
||||
// if (statusCode != -1 && statusCode < 400) {
|
||||
// return true;
|
||||
// } else {
|
||||
// return false;
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// return false;
|
||||
// }
|
||||
try {
|
||||
if (!InetAddress.getByName(carte).isReachable(1000)) {
|
||||
return false;
|
||||
}
|
||||
HttpClient httpClient;
|
||||
HttpGet getMethod = new HttpGet("http://" + carte + ":" + port);
|
||||
HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
|
||||
clientBuilder.setConnectionTimeout(1);
|
||||
clientBuilder.setCredentials(user, passwd);
|
||||
httpClient = clientBuilder.build();
|
||||
HttpResponse httpResponse = httpClient.execute(getMethod);
|
||||
int statusCode = httpResponse.getStatusLine().getStatusCode();
|
||||
if (statusCode != -1 && statusCode < 400) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static String alterColumnTypeCode = " if(\"FILED\".equalsIgnoreCase(filed)){\n" +
|
||||
|
@ -5,9 +5,11 @@ import io.dataease.base.domain.MyPlugin;
|
||||
import io.dataease.base.mapper.MyPluginMapper;
|
||||
import io.dataease.base.mapper.ext.ExtSysPluginMapper;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.commons.utils.DeFileUtils;
|
||||
import io.dataease.commons.utils.ZipUtils;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.listener.util.CacheUtils;
|
||||
import io.dataease.plugins.config.LoadjarUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -89,6 +91,10 @@ public class PluginService {
|
||||
jarPath = DeFileUtils.copy(jarFile, targetDir);
|
||||
loadJar(jarPath, myPlugin);
|
||||
myPluginMapper.insert(myPlugin);
|
||||
|
||||
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
|
||||
} catch (Exception e) {
|
||||
if (StringUtils.isNotEmpty(targetDir)) {
|
||||
DeFileUtils.deleteFile(targetDir);
|
||||
@ -137,6 +143,9 @@ public class PluginService {
|
||||
* @return
|
||||
*/
|
||||
public Boolean uninstall(Long pluginId) {
|
||||
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
|
||||
myPluginMapper.deleteByPrimaryKey(pluginId);
|
||||
return true;
|
||||
}
|
||||
@ -148,6 +157,9 @@ public class PluginService {
|
||||
* @return
|
||||
*/
|
||||
public Boolean changeStatus(Long pluginId, Boolean status) {
|
||||
CacheUtils.removeAll(AuthConstants.USER_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME);
|
||||
CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,2 +1,33 @@
|
||||
ALTER TABLE `dataset_table` ADD COLUMN `sync_status` VARCHAR(45) NULL AFTER `create_time`;
|
||||
ALTER TABLE `dataset_table` ADD COLUMN `qrtz_instance` VARCHAR(1024) NULL AFTER `create_time`;
|
||||
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO `sys_auth` VALUES ('05e5440f-b9c1-4998-bb7e-cabdb293183f', '25', 'menu', '2', 'role', 1622713311975, NULL, 'admin', NULL);
|
||||
INSERT INTO `sys_auth` VALUES ('19569764-ad2e-4d7b-b575-508913495ccf', '8', 'menu', '2', 'role', 1622713307681, NULL, 'admin', NULL);
|
||||
INSERT INTO `sys_auth` VALUES ('4541d582-b532-47b1-9e64-b4937c7b614f', '30', 'menu', '2', 'role', 1622713299688, NULL, 'admin', NULL);
|
||||
INSERT INTO `sys_auth` VALUES ('45dacd42-e9a4-4ce5-a03c-61c8850cf5b1', '10', 'menu', '2', 'role', 1622713304841, NULL, 'admin', NULL);
|
||||
INSERT INTO `sys_auth` VALUES ('8b1e1e02-b6c2-49dc-9118-10ab31f78b46', '34', 'menu', '2', 'role', 1623142236719, NULL, 'admin', NULL);
|
||||
INSERT INTO `sys_auth` VALUES ('a11f5705-887d-403b-9a9d-d3a1317ed91f', '24', 'menu', '2', 'role', 1622713311583, NULL, 'admin', NULL);
|
||||
INSERT INTO `sys_auth` VALUES ('c318d302-457d-43d8-bb01-96a7cbbf6cb7', '27', 'menu', '2', 'role', 1622713313044, NULL, 'admin', NULL);
|
||||
INSERT INTO `sys_auth` VALUES ('c3349d14-1433-41e6-9ddc-ba947c3b523c', '26', 'menu', '2', 'role', 1622713312606, NULL, 'admin', NULL);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO `sys_auth_detail` VALUES ('980c14e1-c836-11eb-bbcc-00163e0c8d3f', '8b1e1e02-b6c2-49dc-9118-10ab31f78b46', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1623142236000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('980c1674-c836-11eb-bbcc-00163e0c8d3f', '8b1e1e02-b6c2-49dc-9118-10ab31f78b46', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1623142236000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('e59001d3-c44f-11eb-bbcc-00163e0c8d3f', '4541d582-b532-47b1-9e64-b4937c7b614f', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1622713299000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('e59003a0-c44f-11eb-bbcc-00163e0c8d3f', '4541d582-b532-47b1-9e64-b4937c7b614f', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1622713299000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('e8a4bdbf-c44f-11eb-bbcc-00163e0c8d3f', '45dacd42-e9a4-4ce5-a03c-61c8850cf5b1', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1622713304000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('e8a4bf70-c44f-11eb-bbcc-00163e0c8d3f', '45dacd42-e9a4-4ce5-a03c-61c8850cf5b1', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1622713304000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('ea536049-c44f-11eb-bbcc-00163e0c8d3f', '19569764-ad2e-4d7b-b575-508913495ccf', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1622713307000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('ea5361d6-c44f-11eb-bbcc-00163e0c8d3f', '19569764-ad2e-4d7b-b575-508913495ccf', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1622713307000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('eca67ad0-c44f-11eb-bbcc-00163e0c8d3f', 'a11f5705-887d-403b-9a9d-d3a1317ed91f', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1622713311000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('eca67c74-c44f-11eb-bbcc-00163e0c8d3f', 'a11f5705-887d-403b-9a9d-d3a1317ed91f', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1622713311000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('ece430b9-c44f-11eb-bbcc-00163e0c8d3f', '05e5440f-b9c1-4998-bb7e-cabdb293183f', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1622713312000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('ece4330e-c44f-11eb-bbcc-00163e0c8d3f', '05e5440f-b9c1-4998-bb7e-cabdb293183f', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1622713312000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('ed4328d0-c44f-11eb-bbcc-00163e0c8d3f', 'c3349d14-1433-41e6-9ddc-ba947c3b523c', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1622713312000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('ed432abc-c44f-11eb-bbcc-00163e0c8d3f', 'c3349d14-1433-41e6-9ddc-ba947c3b523c', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1622713312000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('ed8722a7-c44f-11eb-bbcc-00163e0c8d3f', 'c318d302-457d-43d8-bb01-96a7cbbf6cb7', 'i18n_auth_grant', 15, 0, 'grant', '基础权限-授权', 'admin', 1622713313000, NULL);
|
||||
INSERT INTO `sys_auth_detail` VALUES ('ed872435-c44f-11eb-bbcc-00163e0c8d3f', 'c318d302-457d-43d8-bb01-96a7cbbf6cb7', 'i18n_auth_use', 1, 1, 'use', '基础权限-使用', 'admin', 1622713313000, NULL);
|
||||
COMMIT;
|
@ -69,5 +69,18 @@
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
|
||||
<cache
|
||||
name="lic_info"
|
||||
eternal="false"
|
||||
maxElementsInMemory="10"
|
||||
overflowToDisk="false"
|
||||
diskPersistent="false"
|
||||
timeToIdleSeconds="60"
|
||||
timeToLiveSeconds="60"
|
||||
memoryStoreEvictionPolicy="FIFO"
|
||||
>
|
||||
<cacheEventListenerFactory class="io.dataease.listener.LicCacheEventListener" />
|
||||
</cache>
|
||||
|
||||
|
||||
</ehcache>
|
@ -252,3 +252,5 @@ i18n_id_or_pwd_error=Invalid ID or password
|
||||
i18n_datasource_delete=Data source is delete
|
||||
i18n_dataset_delete=Data set is delete
|
||||
i18n_chart_delete=Chart is delete
|
||||
i18n_not_exec_add_sync=There is no completed synchronization task. Incremental synchronization cannot be performed
|
||||
i18n_excel_header_empty=Excel first row can not empty
|
@ -252,3 +252,5 @@ i18n_id_or_pwd_error=无效的ID或密码
|
||||
i18n_datasource_delete=当前用到的数据源已被删除
|
||||
i18n_dataset_delete=当前用到的数据集已被删除
|
||||
i18n_chart_delete=当前用到的视图已被删除
|
||||
i18n_not_exec_add_sync=没有已完成的同步任务,无法进行增量同步
|
||||
i18n_excel_header_empty=Excel第一行为空
|
||||
|
@ -254,3 +254,5 @@ i18n_id_or_pwd_error=無效的ID或密碼
|
||||
i18n_datasource_delete=當前用到的數據源已被刪除
|
||||
i18n_dataset_delete=當前用到的數據集已被刪除
|
||||
i18n_chart_delete=當前用到的視圖已被刪除
|
||||
i18n_not_exec_add_sync=沒有已經完成的同步任務,無法進行增量同步
|
||||
i18n_excel_header_empty=Excel第一行為空
|
@ -18,7 +18,7 @@
|
||||
"@riophae/vue-treeselect": "0.4.0",
|
||||
"axios": "^0.21.1",
|
||||
"core-js": "^2.6.5",
|
||||
"echarts": "^5.0.2",
|
||||
"echarts": "^5.0.1",
|
||||
"element-resize-detector": "^1.2.2",
|
||||
"element-ui": "2.13.0",
|
||||
"file-saver": "^2.0.5",
|
||||
@ -58,8 +58,8 @@
|
||||
"eslint": "5.15.3",
|
||||
"eslint-plugin-vue": "5.2.2",
|
||||
"html-webpack-plugin": "3.2.0",
|
||||
"less": "^4.1.1",
|
||||
"less-loader": "^8.0.0",
|
||||
"less": "^3.0.0",
|
||||
"less-loader": "^5.0.0",
|
||||
"mockjs": "1.0.1-beta3",
|
||||
"runjs": "^4.1.3",
|
||||
"sass": "^1.32.5",
|
||||
|
@ -3,7 +3,8 @@ import request from '@/utils/request'
|
||||
export function get(url) {
|
||||
return request({
|
||||
url: url,
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,10 @@ export default {
|
||||
className: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
customClass: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -31,9 +35,11 @@ export default {
|
||||
svgClass() {
|
||||
if (this.className) {
|
||||
return 'svg-icon ' + this.className
|
||||
} else {
|
||||
return 'svg-icon'
|
||||
}
|
||||
if (this.customClass) {
|
||||
return this.customClass
|
||||
}
|
||||
return 'svg-icon'
|
||||
},
|
||||
styleExternalIcon() {
|
||||
return {
|
||||
|
@ -17,7 +17,6 @@
|
||||
:style="getStyle(config.style)"
|
||||
:prop-value="config.propValue"
|
||||
:element="config"
|
||||
:filter="filter"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@ -32,11 +31,13 @@ export default {
|
||||
props: {
|
||||
config: {
|
||||
type: Object,
|
||||
require: true
|
||||
require: true,
|
||||
default: null
|
||||
},
|
||||
filter: {
|
||||
type: Object,
|
||||
require: false
|
||||
require: false,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -89,7 +89,7 @@ export default {
|
||||
|
||||
deleteCurCondition() {
|
||||
if (this.curComponent.type === 'custom') {
|
||||
this.$store.dispatch('conditions/delete', { componentId: this.curComponent.id })
|
||||
this.$store.commit('removeViewFilter', this.curComponent.id)
|
||||
bus.$emit('delete-condition', { componentId: this.curComponent.id })
|
||||
}
|
||||
},
|
||||
|
@ -102,7 +102,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
// 先清除查询条件
|
||||
this.$store.dispatch('conditions/clear')
|
||||
// this.$store.dispatch('conditions/clear')
|
||||
},
|
||||
methods: {
|
||||
changeStyleWithScale,
|
||||
|
@ -36,15 +36,18 @@ export default {
|
||||
},
|
||||
element: {
|
||||
require: true,
|
||||
type: Object
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
defaultStyle: {
|
||||
require: true,
|
||||
type: Object
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
index: {
|
||||
require: true,
|
||||
type: [Number, String]
|
||||
type: [Number, String],
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -200,6 +203,7 @@ export default {
|
||||
pointList.forEach(point => {
|
||||
const angle = mod360(initialAngle[point] + rotate)
|
||||
const len = angleToCursor.length
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
lastMatchIndex = (lastMatchIndex + 1) % len
|
||||
const angleLimit = angleToCursor[lastMatchIndex]
|
||||
|
@ -50,7 +50,6 @@
|
||||
:style="getComponentStyle(item.style)"
|
||||
:prop-value="item.propValue"
|
||||
:element="item"
|
||||
:filter="filter"
|
||||
:out-style="getShapeStyleInt(item.style)"
|
||||
/>
|
||||
<component
|
||||
@ -109,8 +108,6 @@ import Area from './Area'
|
||||
import eventBus from '@/components/canvas/utils/eventBus'
|
||||
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, DeDrag },
|
||||
@ -119,13 +116,11 @@ export default {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
filter: {
|
||||
type: Object,
|
||||
require: false
|
||||
},
|
||||
|
||||
outStyle: {
|
||||
type: Object,
|
||||
require: false
|
||||
require: false,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -171,20 +166,6 @@ export default {
|
||||
hLine: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
outStyle: {
|
||||
handler(newVal, oldVla) {
|
||||
this.changeScale()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
canvasStyleData: {
|
||||
handler(newVal, oldVla) {
|
||||
this.changeScale()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
customStyle() {
|
||||
let style = {
|
||||
@ -218,6 +199,26 @@ export default {
|
||||
'editor'
|
||||
])
|
||||
},
|
||||
watch: {
|
||||
outStyle: {
|
||||
handler(newVal, oldVla) {
|
||||
this.changeScale()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
canvasStyleData: {
|
||||
handler(newVal, oldVla) {
|
||||
this.changeScale()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
componentData: {
|
||||
handler(newVal, oldVla) {
|
||||
console.log('11111')
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
// 获取编辑器元素
|
||||
@ -226,12 +227,12 @@ export default {
|
||||
eventBus.$on('hideArea', () => {
|
||||
this.hideArea()
|
||||
})
|
||||
bus.$on('delete-condition', condition => {
|
||||
this.deleteCondition(condition)
|
||||
})
|
||||
// bus.$on('delete-condition', condition => {
|
||||
// this.deleteCondition(condition)
|
||||
// })
|
||||
},
|
||||
created() {
|
||||
this.$store.dispatch('conditions/clear')
|
||||
// this.$store.dispatch('conditions/clear')
|
||||
},
|
||||
methods: {
|
||||
changeStyleWithScale,
|
||||
@ -446,40 +447,6 @@ export default {
|
||||
return height > newHeight ? height : newHeight
|
||||
},
|
||||
|
||||
filterValueChange(value) {
|
||||
// console.log('emit:' + value)
|
||||
},
|
||||
|
||||
setConditionValue(obj) {
|
||||
const { component, value, operator } = obj
|
||||
const fieldId = component.options.attrs.fieldId
|
||||
const viewIds = component.options.attrs.viewIds
|
||||
const condition = new Condition(component.id, fieldId, operator, value, viewIds)
|
||||
this.addCondition(condition)
|
||||
},
|
||||
addCondition(condition) {
|
||||
let conditionExist = false
|
||||
for (let index = 0; index < this.conditions.length; index++) {
|
||||
const element = this.conditions[index]
|
||||
if (condition.componentId === element.componentId) {
|
||||
this.conditions[index] = condition
|
||||
conditionExist = true
|
||||
}
|
||||
}
|
||||
!conditionExist && this.conditions.push(condition)
|
||||
this.executeSearch()
|
||||
},
|
||||
deleteCondition(condition) {
|
||||
this.conditions = this.conditions.filter(item => {
|
||||
const componentIdSuitable = !condition.componentId || (item.componentId === condition.componentId)
|
||||
const fieldIdSuitable = !condition.fieldId || (item.fieldId === condition.fieldId)
|
||||
return !(componentIdSuitable && fieldIdSuitable)
|
||||
})
|
||||
this.executeSearch()
|
||||
},
|
||||
executeSearch() {
|
||||
// console.log('当前查询条件是: ' + JSON.stringify(this.conditions))
|
||||
},
|
||||
format(value, scale) {
|
||||
// 自适应画布区域 返回原值
|
||||
if (this.canvasStyleData.selfAdaption) {
|
||||
|
@ -22,7 +22,7 @@ import LabelNormal from '../../../views/chart/components/normal/LabelNormal'
|
||||
import { uuid } from 'vue-uuid'
|
||||
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
import { isChange } from '@/utils/conditionUtil'
|
||||
import {
|
||||
DEFAULT_COLOR_CASE,
|
||||
DEFAULT_SIZE,
|
||||
@ -40,17 +40,14 @@ export default {
|
||||
components: { ChartComponent, TableNormal, LabelNormal },
|
||||
props: {
|
||||
element: {
|
||||
type: Object
|
||||
},
|
||||
filter: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: function() {
|
||||
return {
|
||||
filter: []
|
||||
}
|
||||
}
|
||||
default: null
|
||||
},
|
||||
// filters: {
|
||||
// type: Array,
|
||||
// required: false,
|
||||
// default: null
|
||||
// },
|
||||
outStyle: {
|
||||
type: Object,
|
||||
required: false,
|
||||
@ -59,38 +56,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$store.getters.conditions': function(newVal, oldVal) {
|
||||
this.filter.filter = newVal
|
||||
this.getData(this.element.propValue.viewId)
|
||||
},
|
||||
filter(val) {
|
||||
this.getData(this.element.propValue.viewId)
|
||||
},
|
||||
// deep监听panel 如果改变 提交到 store
|
||||
canvasStyleData: {
|
||||
handler(newVal, oldVla) {
|
||||
// this.chart.stylePriority == panel 优先使用仪表板样式
|
||||
this.mergeStyle()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
// 监听外部的样式变化
|
||||
outStyle: {
|
||||
handler(newVal, oldVla) {
|
||||
if (this.$refs[this.element.propValue.id]) {
|
||||
this.$refs[this.element.propValue.id].chartResize()
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.refId = uuid.v1
|
||||
},
|
||||
computed: mapState([
|
||||
'canvasStyleData'
|
||||
]),
|
||||
data() {
|
||||
return {
|
||||
refId: null,
|
||||
@ -120,8 +85,49 @@ export default {
|
||||
message: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filter() {
|
||||
const filter = {}
|
||||
filter.filter = this.element.filters
|
||||
return filter
|
||||
},
|
||||
filters() {
|
||||
// 必要 勿删勿该 watch数组,哪怕发生变化 oldValue等于newValue ,深拷贝解决
|
||||
if (!this.element.filters) return []
|
||||
return JSON.parse(JSON.stringify(this.element.filters))
|
||||
},
|
||||
...mapState([
|
||||
'canvasStyleData'
|
||||
])
|
||||
},
|
||||
|
||||
watch: {
|
||||
'filters': function(val1, val2) {
|
||||
// this.getData(this.element.propValue.viewId)
|
||||
isChange(val1, val2) && this.getData(this.element.propValue.viewId)
|
||||
},
|
||||
// deep监听panel 如果改变 提交到 store
|
||||
canvasStyleData: {
|
||||
handler(newVal, oldVla) {
|
||||
// this.chart.stylePriority == panel 优先使用仪表板样式
|
||||
this.mergeStyle()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
// 监听外部的样式变化
|
||||
outStyle: {
|
||||
handler(newVal, oldVla) {
|
||||
if (this.$refs[this.element.propValue.id]) {
|
||||
this.$refs[this.element.propValue.id].chartResize()
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.filter.filter = this.$store.getters.conditions
|
||||
this.refId = uuid.v1
|
||||
// this.filter.filter = this.$store.getters.conditions
|
||||
this.getData(this.element.propValue.viewId)
|
||||
},
|
||||
mounted() {
|
||||
@ -173,6 +179,9 @@ export default {
|
||||
return true
|
||||
})
|
||||
}
|
||||
},
|
||||
viewIdMatch(viewIds, viewId) {
|
||||
return !viewIds || viewIds.length === 0 || viewIds.includes(viewId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ export default {
|
||||
operator: this.operator
|
||||
}
|
||||
param.value = this.formatValues(param.value)
|
||||
this.inDraw && this.$store.dispatch('conditions/add', param)
|
||||
this.inDraw && this.$store.commit('addViewFilter', param)
|
||||
},
|
||||
dateChange(value) {
|
||||
this.setCondition()
|
||||
|
@ -49,7 +49,7 @@ export default {
|
||||
value: [this.options.value],
|
||||
operator: this.operator
|
||||
}
|
||||
this.inDraw && this.$store.dispatch('conditions/add', param)
|
||||
this.inDraw && this.$store.commit('addViewFilter', param)
|
||||
},
|
||||
setEdit() {
|
||||
this.canEdit = true
|
||||
|
@ -37,8 +37,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
options: null,
|
||||
// operator: 'eq',
|
||||
values: null,
|
||||
showNumber: false
|
||||
}
|
||||
},
|
||||
@ -49,26 +47,32 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
'options.attrs.multiple': function(value) {
|
||||
const sourceValue = this.options.value
|
||||
if (value) {
|
||||
this.values = []
|
||||
!sourceValue && (this.options.value = [])
|
||||
sourceValue && !Array.isArray(sourceValue) && (this.options.value = sourceValue.split(','))
|
||||
!this.inDraw && (this.options.value = [])
|
||||
} else {
|
||||
this.values = null
|
||||
!sourceValue && (this.options.value = null)
|
||||
sourceValue && Array.isArray(sourceValue) && (this.options.value = sourceValue[0])
|
||||
!this.inDraw && (this.options.value = null)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.options = this.element.options
|
||||
this.setCondition()
|
||||
|
||||
// this.setCondition()
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
|
||||
})
|
||||
// this.$nextTick(() => {
|
||||
// this.options && this.options.value && this.changeValue(this.options.value)
|
||||
// })
|
||||
this.options && this.options.value && this.changeValue(this.options.value)
|
||||
},
|
||||
methods: {
|
||||
changeValue(value) {
|
||||
this.setCondition()
|
||||
// this.inDraw && this.$emit('set-condition-value', { component: this.element, value: [value], operator: this.operator })
|
||||
this.showNumber = false
|
||||
this.$nextTick(() => {
|
||||
if (!this.$refs.deSelect.$refs.tags || !this.options.attrs.multiple) {
|
||||
@ -89,7 +93,7 @@ export default {
|
||||
value: Array.isArray(this.options.value) ? this.options.value : [this.options.value],
|
||||
operator: this.operator
|
||||
}
|
||||
this.inDraw && this.$store.dispatch('conditions/add', param)
|
||||
this.inDraw && this.$store.commit('addViewFilter', param)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ const drawPanel = {
|
||||
type: 'custom',
|
||||
style: {
|
||||
width: 300,
|
||||
height: 47,
|
||||
height: 38,
|
||||
fontSize: 14,
|
||||
fontWeight: 500,
|
||||
lineHeight: '',
|
||||
|
86
frontend/src/icons/svg/DataEase.svg
Normal file
86
frontend/src/icons/svg/DataEase.svg
Normal file
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 23.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 902.97 232.66" style="enable-background:new 0 0 902.97 232.66;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#0A7BE0;}
|
||||
.st1{fill-rule:evenodd;clip-rule:evenodd;fill:#0A7BE0;}
|
||||
.st2{fill:#53BAF9;}
|
||||
.st3{fill:#2DAAF7;}
|
||||
</style>
|
||||
<path id="XMLID_997_" class="st0" d="M108.42,7.03l94.65,54.65v109.3l-94.65,54.65l-94.65-54.65V61.68L108.42,7.03 M108.42,4.04
|
||||
L11.18,60.19v112.28l97.24,56.14l97.24-56.14V60.19L108.42,4.04L108.42,4.04z"/>
|
||||
<g id="XMLID_963_">
|
||||
<path id="XMLID_995_" class="st0" d="M610.32,104.68h30.73l-3.98,21.39h-26.74v25.21h36.71l1.64,23.15h-68.53V57.08h68.53
|
||||
l-1.64,22.69h-36.71V104.68z"/>
|
||||
<path id="XMLID_992_" class="st0" d="M420.83,122.77v51.5h-22.5l-0.11-5.21c-7.87,4.09-15.56,6.13-23.07,6.13h-2.22
|
||||
c-7.72,0-13.85-2.96-18.39-8.89c-3.02-4.65-4.52-9.84-4.52-15.56v-0.61c0-10.12,3.55-16.83,10.65-20.16
|
||||
c2.91-1.94,10.3-2.91,22.15-2.91h12.11v-2.84c0-5.82-0.84-9.17-2.53-10.04c-1.84-1.38-5.08-2.07-9.73-2.07h-24.14l0.41-20.63
|
||||
l27.79-0.75c16.5,0,26.72,4.09,30.66,12.26C419.68,107.74,420.83,114.34,420.83,122.77z M377.49,144.16
|
||||
c-0.77,0.91-1.57,3.88-1.57,5.97c0,4.6,2.35,6.9,7.05,6.9c2.81,0,6.79-1.15,11.96-3.45v-11.22
|
||||
C394.92,142.35,380.28,140.83,377.49,144.16z"/>
|
||||
<path id="XMLID_989_" class="st0" d="M571.04,122.77v51.5h-22.5l-0.11-5.21c-7.87,4.09-15.56,6.13-23.07,6.13h-2.22
|
||||
c-7.72,0-13.85-2.96-18.39-8.89c-3.02-4.65-4.52-9.84-4.52-15.56v-0.61c0-10.12,3.55-16.83,10.65-20.16
|
||||
c2.91-1.94,10.3-2.91,22.15-2.91h12.11v-2.84c0-5.82-0.84-9.17-2.53-10.04c-1.84-1.38-5.08-2.07-9.73-2.07h-24.14l0.41-20.63
|
||||
l27.79-0.75c16.5,0,26.72,4.09,30.66,12.26C569.89,107.74,571.04,114.34,571.04,122.77z M527.7,144.16
|
||||
c-0.77,0.91-1.57,3.88-1.57,5.97c0,4.6,2.35,6.9,7.05,6.9c2.81,0,6.79-1.15,11.96-3.45v-11.22
|
||||
C545.13,142.35,530.5,140.83,527.7,144.16z"/>
|
||||
<path id="XMLID_986_" class="st0" d="M728.13,122.77v51.5h-22.5l-0.11-5.21c-7.87,4.09-15.56,6.13-23.07,6.13h-2.22
|
||||
c-7.72,0-13.85-2.96-18.39-8.89c-3.02-4.65-4.52-9.84-4.52-15.56v-0.61c0-10.12,3.55-16.83,10.65-20.16
|
||||
c2.91-1.94,10.3-2.91,22.15-2.91h12.11v-2.84c0-5.82-0.84-9.17-2.53-10.04c-1.84-1.38-5.08-2.07-9.73-2.07h-24.14l0.41-20.63
|
||||
l27.79-0.75c16.5,0,26.72,4.09,30.66,12.26C726.98,107.74,728.13,114.34,728.13,122.77z M684.79,144.16
|
||||
c-0.77,0.91-1.57,3.88-1.57,5.97c0,4.6,2.35,6.9,7.05,6.9c2.81,0,6.79-1.15,11.96-3.45v-11.22
|
||||
C702.22,142.35,687.59,140.83,684.79,144.16z"/>
|
||||
<g id="XMLID_983_">
|
||||
<path id="XMLID_984_" class="st0" d="M488.61,174.44h-13.03c-2.64,0-4.9-0.08-6.78-0.23c-5.03-0.35-9.15-1.3-12.35-2.82
|
||||
c-3.91-1.88-6.88-4.75-8.92-8.61c-2.29-4.37-3.43-10.21-3.43-17.53l-0.15-32.92h-12.5V90.92h12.5v-26.6l25.61,4.94v21.67h19.51
|
||||
l-2.67,21.41h-16.84v31.47c0,0.71,0.03,1.32,0.08,1.83c0.1,1.32,0.31,2.41,0.61,3.28c0.76,2.08,2.39,3.53,4.88,4.34
|
||||
c1.93,0.81,4.65,1.47,8.15,1.98c0.61,0.1,1.24,0.18,1.9,0.23c0.56,0.05,1.09,0.1,1.6,0.15l1.83,0.08V174.44z"/>
|
||||
</g>
|
||||
<path id="XMLID_980_" class="st0" d="M889.77,125.26v14.8h-47.12l-0.09,2.69c0,5.65,2.25,8.91,5.71,10.13
|
||||
c2.7,0.76,5.75,1.14,9.16,1.14h2.06c9.16,0,22.54-2.06,32.15-4.05h0.15l-3.87,20.91c0,0.25-4.5,2.17-13.25,3.59
|
||||
c-5.49,0.61-11.8,0.92-18.92,0.92c-18.31,0-30.14-6.18-35.48-18.54c-1.98-4.88-3.82-9.97-3.82-15.31v-19.99
|
||||
c0-14.65,6.99-24.42,19.31-29.25c5.44-1.78,11.27-2.67,17.47-2.67c17.24,0,28.43,5.62,33.57,16.86
|
||||
C888.78,110.92,889.77,117.17,889.77,125.26z M865.08,121.37c0-5.8-1.73-9.68-4.22-10.74c-1.88-1.27-4.79-1.46-7.48-1.46
|
||||
c-6.87,0-10.3,3.23-10.3,9.69l-0.43,3.89h22.44V121.37z"/>
|
||||
<g id="XMLID_966_">
|
||||
<g id="XMLID_65_">
|
||||
<path id="XMLID_66_" class="st1" d="M288.16,55.9h-45.27v118.54h45.27c28.84-0.01,52.22-19.54,52.22-43.63V99.54
|
||||
C340.39,75.44,317,55.92,288.16,55.9z M311.3,131.83c0,10.69-10.35,19.34-23.14,19.36h-15.12V79.15h15.12
|
||||
c12.79,0.01,23.14,8.68,23.14,19.36V131.83z"/>
|
||||
</g>
|
||||
</g>
|
||||
<path id="XMLID_964_" class="st0" d="M769.93,176.75c-4.8,0-10.07-0.28-15.8-0.83c-2.2-0.22-4.45-0.48-6.77-0.77l-5.43-0.77
|
||||
l-3.01-22.63l5.83,2.25l7.19,1.82c2.85,0.4,5.53,0.71,8.05,0.93c3.01,0.26,5.74,0.39,8.18,0.39c8.87,0,13.99-0.21,15.38-3.84
|
||||
c0.77-1.5,0.73-5.62-0.12-7.05c-0.85-1.58-2.67-2.93-5.43-4.07c-1.18-0.48-2.67-0.97-4.45-1.49l-5.25-1.43
|
||||
c-2.32-0.51-4.39-1.03-6.22-1.54c-2.36-0.66-4.52-1.36-6.47-2.09c-4.84-1.83-8.6-3.96-11.29-6.38c-2.56-2.46-4.21-5.47-4.94-9.03
|
||||
c-0.53-2.53-0.59-5.41-0.18-8.64c1.1-9.32,5.51-15.72,13.24-19.2c2.89-1.39,6.37-2.4,10.43-3.03c1.59-0.22,3.4-0.4,5.43-0.55
|
||||
l5.25-0.33h3.54c4.03,0,8.46,0.22,13.3,0.66l5.92,0.61l5,0.66l2.08,20.33c-2.59-0.77-5.97-1.06-10-1.54
|
||||
c-5.17-0.66-9.91-0.55-14.1-0.55c-9.27,0-14.73-0.51-16.35,3.27c-0.61,1.58-0.57,3.08,0.12,4.51c0.89,1.65,2.85,3.1,5.86,4.35
|
||||
c1.26,0.51,2.85,1.06,4.76,1.65l12.08,3.25c2.32,0.66,4.39,1.34,6.22,2.04c4.43,1.69,7.79,3.63,10.07,5.83
|
||||
c2.69,2.42,4.41,5.45,5.19,9.08c0.53,2.61,0.59,8.07,0.18,11.12c-1.1,9.25-5.51,15.65-13.24,19.2c-2.85,1.4-6.33,2.39-10.43,2.97
|
||||
c-1.59,0.22-3.4,0.4-5.43,0.55l-4.7,0.28H769.93z"/>
|
||||
</g>
|
||||
<path id="XMLID_960_" class="st0" d="M108.42,40.31l65.83,38.01v76.02l-65.83,38.01l-65.83-38.01V78.32L108.42,40.31 M108.42,19.89
|
||||
L24.91,68.11v96.43l83.51,48.22l83.51-48.22V68.11L108.42,19.89L108.42,19.89z"/>
|
||||
<g id="XMLID_958_">
|
||||
<path id="XMLID_959_" class="st2" d="M68.03,117.32c-2.65,0-5.24-1.38-6.66-3.84c-2.12-3.67-0.86-8.37,2.82-10.49L91.4,87.3
|
||||
c3.67-2.12,8.37-0.86,10.49,2.82s0.86,8.37-2.82,10.49l-27.21,15.7C70.65,116.99,69.33,117.32,68.03,117.32z"/>
|
||||
</g>
|
||||
<g id="XMLID_956_">
|
||||
<path id="XMLID_957_" class="st2" d="M116.17,89.56c-2.65,0-5.24-1.38-6.66-3.84c-2.12-3.67-0.86-8.37,2.82-10.49l9.96-5.74
|
||||
c3.67-2.12,8.37-0.86,10.49,2.82c2.12,3.67,0.86,8.37-2.82,10.49L120,88.53C118.79,89.23,117.47,89.56,116.17,89.56z"/>
|
||||
</g>
|
||||
<g id="XMLID_875_">
|
||||
<path id="XMLID_876_" class="st3" d="M79.38,140.76c-2.65,0-5.23-1.37-6.65-3.83c-2.12-3.67-0.87-8.37,2.8-10.49l0.26-0.15
|
||||
c3.67-2.12,8.37-0.87,10.49,2.8c2.12,3.67,0.87,8.37-2.8,10.49l-0.26,0.15C82.01,140.43,80.69,140.76,79.38,140.76z"/>
|
||||
</g>
|
||||
<g id="XMLID_780_">
|
||||
<path id="XMLID_874_" class="st3" d="M100.31,128.9c-2.64,0-5.22-1.37-6.64-3.81c-2.13-3.66-0.89-8.37,2.77-10.5l37.17-21.65
|
||||
c3.66-2.13,8.36-0.9,10.5,2.77c2.13,3.66,0.89,8.37-2.77,10.5l-37.17,21.65C102.95,128.57,101.62,128.9,100.31,128.9z"/>
|
||||
</g>
|
||||
<g id="XMLID_778_">
|
||||
<path id="XMLID_779_" class="st0" d="M90.73,164.2c-2.65,0-5.24-1.38-6.66-3.84c-2.12-3.67-0.86-8.37,2.82-10.49l58.1-33.51
|
||||
c3.67-2.12,8.37-0.86,10.49,2.82c2.12,3.67,0.86,8.37-2.82,10.49l-58.1,33.51C93.35,163.87,92.03,164.2,90.73,164.2z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 6.6 KiB |
@ -455,7 +455,7 @@ export default {
|
||||
admin: 'Administrator',
|
||||
org_admin: 'Organization Administrator',
|
||||
org_member: 'Organization Member',
|
||||
add: 'Add Role',
|
||||
add: 'Create Role',
|
||||
delete: 'Delete Role',
|
||||
modify: 'Modify Role',
|
||||
tips: 'Tips',
|
||||
@ -532,15 +532,15 @@ export default {
|
||||
cancel: 'Cancel',
|
||||
search: 'Search',
|
||||
back: 'Back',
|
||||
add_table: 'Add Table',
|
||||
add_table: 'Add Dataset',
|
||||
process: 'Speed of progress',
|
||||
add_chart: 'Add Chart',
|
||||
db_data: 'Database Table',
|
||||
db_data: 'Database Dataset',
|
||||
sql_data: 'SQL data set',
|
||||
excel_data: 'Excel data set',
|
||||
custom_data: 'Custom data set',
|
||||
pls_slc_tbl_left: 'Please select the chart from the left',
|
||||
add_db_table: 'Add database table',
|
||||
add_db_table: 'Add Database Dataset',
|
||||
pls_slc_data_source: 'Please select data source',
|
||||
table: 'Table',
|
||||
edit: 'Edit',
|
||||
@ -663,7 +663,7 @@ export default {
|
||||
radius_mode: 'Radius',
|
||||
area_mode: 'Area',
|
||||
rose_radius: 'Fillet',
|
||||
view_name: 'Chart Name',
|
||||
view_name: 'Chart Title',
|
||||
name_can_not_empty: 'Name cannot be empty',
|
||||
template_can_not_empty: 'Please check a Template',
|
||||
custom_count: 'Number of records',
|
||||
@ -715,7 +715,8 @@ export default {
|
||||
date_split: 'yyyy/MM/dd',
|
||||
chartName: 'New Chart',
|
||||
chart_show_error: 'can not show normal',
|
||||
chart_error_tips: 'Please contact admin '
|
||||
chart_error_tips: 'Please contact admin ',
|
||||
title_cannot_empty: 'Title can not be empty'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default',
|
||||
@ -737,12 +738,12 @@ export default {
|
||||
add_table: 'Add Table',
|
||||
process: 'Speed of progress',
|
||||
update: 'update',
|
||||
db_data: 'Database Table',
|
||||
db_data: 'Database Dataset',
|
||||
sql_data: 'SQL data set',
|
||||
excel_data: 'Excel data set',
|
||||
custom_data: 'Custom data set',
|
||||
pls_slc_tbl_left: 'Please select the chart from the left',
|
||||
add_db_table: 'Add database table',
|
||||
add_db_table: 'Add Database Dataset',
|
||||
pls_slc_data_source: 'Please select data source',
|
||||
table: 'Table',
|
||||
edit: 'Edit',
|
||||
@ -753,7 +754,7 @@ export default {
|
||||
field_origin_name: 'Field Origin Name',
|
||||
field_check: 'Selected',
|
||||
update_info: 'Update Info',
|
||||
join_view: 'Associated view',
|
||||
join_view: 'Data Associated',
|
||||
text: 'Text',
|
||||
time: 'Time',
|
||||
value: 'Value',
|
||||
@ -785,7 +786,7 @@ export default {
|
||||
close: 'Close',
|
||||
required: 'Required',
|
||||
input_content: 'Please input the content',
|
||||
add_sql_table: 'Add SQL',
|
||||
add_sql_table: 'Add SQL Dataset',
|
||||
preview: 'Preview',
|
||||
pls_input_name: 'Please enter a name',
|
||||
connect_mode: 'Connection Mode',
|
||||
@ -795,7 +796,7 @@ export default {
|
||||
last_update_time: 'Last update time',
|
||||
current_update_time: 'Current update time',
|
||||
param: 'Parameter',
|
||||
edit_sql: 'Edit SQL',
|
||||
edit_sql: 'Edit SQL Dataset',
|
||||
showRow: 'Display line',
|
||||
add_excel_table: 'Add excel dataset',
|
||||
add_custom_table: 'Add self help dataset',
|
||||
@ -811,7 +812,7 @@ export default {
|
||||
field_edit: 'Edit Field',
|
||||
table_already_add_to: 'This table is already add to',
|
||||
uploading: 'Uploading...',
|
||||
add_union: 'Add Associations',
|
||||
add_union: 'Create Associations',
|
||||
union_setting: 'Association Settings',
|
||||
pls_slc_union_field: 'Please select associated field',
|
||||
pls_slc_union_table: 'Please select association table',
|
||||
@ -830,7 +831,15 @@ export default {
|
||||
preview_100_data: 'Show 100 lines data',
|
||||
invalid_table_check: 'Please sync data first.',
|
||||
parse_error: 'Parse Error',
|
||||
origin_field_type: 'Origin Type'
|
||||
origin_field_type: 'Origin Type',
|
||||
edit_excel_table: 'Edit Excel Dataset',
|
||||
edit_excel: 'Edit Excel',
|
||||
excel_replace: 'Replace',
|
||||
excel_add: 'Add',
|
||||
dataset_group: 'Dataset Group',
|
||||
m1: 'Move ',
|
||||
m2: ' To',
|
||||
char_can_not_more_50: 'Dataset name can not more 50'
|
||||
},
|
||||
datasource: {
|
||||
datasource: 'Data Source',
|
||||
@ -840,7 +849,7 @@ export default {
|
||||
data_base: 'Database name',
|
||||
user_name: 'User Name',
|
||||
password: 'Password',
|
||||
host: 'Host',
|
||||
host: 'Host name / IP address',
|
||||
port: 'Port',
|
||||
please_input_data_base: 'Please enter the database name',
|
||||
please_input_user_name: 'Please enter user name',
|
||||
@ -1015,6 +1024,7 @@ export default {
|
||||
datasetAuth: 'Dataset Permissions',
|
||||
chartAuth: 'Chart Permissions',
|
||||
panelAuth: 'Dashboard Permissions',
|
||||
menuAuth: 'Menu and operation permission',
|
||||
deptHead: 'All Dept',
|
||||
roleHead: 'All Role',
|
||||
userHead: 'All User',
|
||||
|
@ -425,7 +425,7 @@ export default {
|
||||
no_such_user: '无此用戶信息, 請輸入正确的用戶 ID 或者 用戶郵箱!'
|
||||
},
|
||||
user: {
|
||||
create: '創建用戶',
|
||||
create: '新建用戶',
|
||||
modify: '修改用戶',
|
||||
input_name: '請輸入用戶姓名',
|
||||
input_id: '請輸入ID',
|
||||
@ -455,7 +455,7 @@ export default {
|
||||
admin: '系統管理員',
|
||||
org_admin: '組織管理员',
|
||||
org_member: '組織成員',
|
||||
add: '添加角色',
|
||||
add: '新建角色',
|
||||
delete: '删除角色',
|
||||
modify: '修改角色',
|
||||
tips: '提示',
|
||||
@ -489,7 +489,7 @@ export default {
|
||||
sort: '組織排序',
|
||||
sub_organizations: '下屬組織數',
|
||||
create_time: '創建日期',
|
||||
create: '創建組織',
|
||||
create: '新建組織',
|
||||
modify: '修改組織',
|
||||
delete: '删除組織',
|
||||
delete_confirm: '删除該組織會關聯刪除該組織的下屬組織,確定要删除吗?',
|
||||
@ -532,13 +532,13 @@ export default {
|
||||
cancel: '取消',
|
||||
search: '搜索',
|
||||
back: '返回',
|
||||
add_table: '添加表',
|
||||
add_table: '添加數據集',
|
||||
process: '進度',
|
||||
add_chart: '添加視圖',
|
||||
db_data: '數據庫表',
|
||||
db_data: '數據庫數據集',
|
||||
sql_data: 'SQL數據集',
|
||||
excel_data: 'Excel數據集',
|
||||
custom_data: '自助數據集',
|
||||
custom_data: '自定義數據集',
|
||||
pls_slc_tbl_left: '請從左側選擇視圖',
|
||||
add_db_table: '添加數據庫表',
|
||||
pls_slc_data_source: '請選擇數據源',
|
||||
@ -663,7 +663,7 @@ export default {
|
||||
radius_mode: '半徑',
|
||||
area_mode: '面積',
|
||||
rose_radius: '園角',
|
||||
view_name: '視圖名稱',
|
||||
view_name: '視圖標題',
|
||||
name_can_not_empty: '名稱不能為空',
|
||||
template_can_not_empty: '请选择仪表板',
|
||||
custom_count: '記錄數',
|
||||
@ -715,7 +715,8 @@ export default {
|
||||
date_split: 'yyyy/MM/dd',
|
||||
chartName: '新建視圖',
|
||||
chart_show_error: '無法正常顯示',
|
||||
chart_error_tips: '如有疑問請聯系管理員'
|
||||
chart_error_tips: '如有疑問請聯系管理員',
|
||||
title_cannot_empty: '標題不能為空'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: '有多個sheet頁面,默認抽取第一個',
|
||||
@ -734,15 +735,15 @@ export default {
|
||||
cancel: '取消',
|
||||
search: '搜索',
|
||||
back: '返回',
|
||||
add_table: '添加表',
|
||||
add_table: '添加數據集',
|
||||
process: '進度',
|
||||
update: '更新',
|
||||
db_data: '數據庫表',
|
||||
sql_data: 'SQL數據集',
|
||||
excel_data: 'Excel數據集',
|
||||
custom_data: '自助數據集',
|
||||
db_data: '數據庫數據集',
|
||||
sql_data: 'SQL 數據集',
|
||||
excel_data: 'Excel 數據集',
|
||||
custom_data: '自定義數據集',
|
||||
pls_slc_tbl_left: '請從左側選擇表',
|
||||
add_db_table: '添加數據庫表',
|
||||
add_db_table: '添加數據庫數據集',
|
||||
pls_slc_data_source: '請選擇數據源',
|
||||
table: '表',
|
||||
edit: '編輯',
|
||||
@ -753,7 +754,7 @@ export default {
|
||||
field_origin_name: '原始名',
|
||||
field_check: '選中',
|
||||
update_info: '更新信息',
|
||||
join_view: '關聯視圖',
|
||||
join_view: '數據關聯',
|
||||
text: '文本',
|
||||
time: '時間',
|
||||
value: '數值',
|
||||
@ -785,7 +786,7 @@ export default {
|
||||
close: '關閉',
|
||||
required: '必填',
|
||||
input_content: '請輸入內容',
|
||||
add_sql_table: '添加 SQL',
|
||||
add_sql_table: '添加 SQL 數據集',
|
||||
preview: '預覽',
|
||||
pls_input_name: '請輸入名稱',
|
||||
connect_mode: '鏈接模式',
|
||||
@ -795,10 +796,10 @@ export default {
|
||||
last_update_time: '上次更新時間',
|
||||
current_update_time: '當前更新時間',
|
||||
param: '參數',
|
||||
edit_sql: '編輯 SQL',
|
||||
edit_sql: '編輯 SQL 數據集',
|
||||
showRow: '顯示行',
|
||||
add_excel_table: ' 添加 Excel 數據集',
|
||||
add_custom_table: '添加自助數據集',
|
||||
add_custom_table: '添加自定義數據集',
|
||||
upload_file: '上傳文件',
|
||||
detail: '詳情',
|
||||
type: '類型',
|
||||
@ -811,7 +812,7 @@ export default {
|
||||
field_edit: '編輯字段',
|
||||
table_already_add_to: '該表已添加至',
|
||||
uploading: '上傳中...',
|
||||
add_union: '添加關聯',
|
||||
add_union: '新建關聯',
|
||||
union_setting: '關聯設置',
|
||||
pls_slc_union_field: '請選擇關聯字段',
|
||||
pls_slc_union_table: '請選擇關聯表',
|
||||
@ -830,7 +831,15 @@ export default {
|
||||
preview_100_data: '顯示前100行數據',
|
||||
invalid_table_check: '非直連數據集請先完成數據同步',
|
||||
parse_error: '解析錯誤',
|
||||
origin_field_type: '原始類型'
|
||||
origin_field_type: '原始類型',
|
||||
edit_excel_table: '編輯Excel數據集',
|
||||
edit_excel: '編輯Excel',
|
||||
excel_replace: '替換',
|
||||
excel_add: '追加',
|
||||
dataset_group: '數據集分組',
|
||||
m1: '將 ',
|
||||
m2: ' 移動到',
|
||||
char_can_not_more_50: '數據集名稱不能超過50個字符'
|
||||
},
|
||||
datasource: {
|
||||
datasource: '數據源',
|
||||
@ -840,7 +849,7 @@ export default {
|
||||
data_base: '數據庫名稱',
|
||||
user_name: '用戶名',
|
||||
password: '密碼',
|
||||
host: '主機',
|
||||
host: '主機名/IP地址',
|
||||
port: '端口',
|
||||
please_input_data_base: '請輸入數據庫名稱',
|
||||
please_input_user_name: '請輸入用戶名',
|
||||
@ -1015,6 +1024,7 @@ export default {
|
||||
datasetAuth: '數據集權限',
|
||||
chartAuth: '視圖權限',
|
||||
panelAuth: '儀表板權限',
|
||||
menuAuth: '菜單和操作權限',
|
||||
deptHead: '所有组织',
|
||||
roleHead: '所有角色',
|
||||
userHead: '所有用戶',
|
||||
|
@ -425,7 +425,7 @@ export default {
|
||||
no_such_user: '无此用户信息, 请输入正确的用户 ID 或者 用户邮箱!'
|
||||
},
|
||||
user: {
|
||||
create: '创建用户',
|
||||
create: '新建用户',
|
||||
modify: '修改用户',
|
||||
input_name: '请输入用户姓名',
|
||||
input_id: '请输入ID',
|
||||
@ -455,7 +455,7 @@ export default {
|
||||
admin: '系统管理员',
|
||||
org_admin: '组织管理员',
|
||||
org_member: '组织成员',
|
||||
add: '添加角色',
|
||||
add: '新建角色',
|
||||
delete: '删除角色',
|
||||
modify: '修改角色',
|
||||
tips: '提示',
|
||||
@ -489,7 +489,7 @@ export default {
|
||||
sort: '组织排序',
|
||||
sub_organizations: '下属组织数',
|
||||
create_time: '创建日期',
|
||||
create: '创建组织',
|
||||
create: '新建组织',
|
||||
modify: '修改组织',
|
||||
delete: '删除组织',
|
||||
delete_confirm: '删除该组织会关联删除该组织的下属组织,确定要删除吗?',
|
||||
@ -532,15 +532,15 @@ export default {
|
||||
cancel: '取消',
|
||||
search: '搜索',
|
||||
back: '返回',
|
||||
add_table: '添加表',
|
||||
add_table: '添加数据集',
|
||||
process: '进度',
|
||||
add_chart: '添加视图',
|
||||
db_data: '数据库表',
|
||||
db_data: '数据库数据集',
|
||||
sql_data: 'SQL数据集',
|
||||
excel_data: 'Excel数据集',
|
||||
custom_data: '自助数据集',
|
||||
custom_data: '自定义数据集',
|
||||
pls_slc_tbl_left: '请从左侧选视图',
|
||||
add_db_table: '添加数据库表',
|
||||
add_db_table: '添加数据库数据集',
|
||||
pls_slc_data_source: '请选择数据源',
|
||||
table: '表',
|
||||
edit: '编辑',
|
||||
@ -663,7 +663,7 @@ export default {
|
||||
radius_mode: '半径',
|
||||
area_mode: '面积',
|
||||
rose_radius: '圆角',
|
||||
view_name: '视图名称',
|
||||
view_name: '视图标题',
|
||||
name_can_not_empty: '名称不能为空',
|
||||
template_can_not_empty: '请选择仪表版',
|
||||
custom_count: '记录数',
|
||||
@ -715,10 +715,11 @@ export default {
|
||||
date_split: 'yyyy/MM/dd',
|
||||
chartName: '新建视图',
|
||||
chart_show_error: '无法正常显示',
|
||||
chart_error_tips: '如有疑问请联系管理员'
|
||||
chart_error_tips: '如有疑问请联系管理员',
|
||||
title_cannot_empty: '标题不能为空'
|
||||
},
|
||||
dataset: {
|
||||
sheet_warn: '有多个Sheet页,默认抽取第一个',
|
||||
sheet_warn: '有多个 Sheet 页,默认抽取第一个',
|
||||
datalist: '数据集',
|
||||
add_group: '添加分组',
|
||||
add_scene: '添加场景',
|
||||
@ -734,15 +735,15 @@ export default {
|
||||
cancel: '取消',
|
||||
search: '搜索',
|
||||
back: '返回',
|
||||
add_table: '添加表',
|
||||
add_table: '添加数据集',
|
||||
process: '进度',
|
||||
update: '更新',
|
||||
db_data: '数据库表',
|
||||
sql_data: 'SQL数据集',
|
||||
excel_data: 'Excel数据集',
|
||||
custom_data: '自助数据集',
|
||||
db_data: '数据库数据集',
|
||||
sql_data: 'SQL 数据集',
|
||||
excel_data: 'Excel 数据集',
|
||||
custom_data: '自定义数据集',
|
||||
pls_slc_tbl_left: '请从左侧选择表',
|
||||
add_db_table: '添加数据库表',
|
||||
add_db_table: '添加数据库数据集',
|
||||
pls_slc_data_source: '请选择数据源',
|
||||
table: '表',
|
||||
edit: '编辑',
|
||||
@ -753,7 +754,7 @@ export default {
|
||||
field_origin_name: '原始名',
|
||||
field_check: '选中',
|
||||
update_info: '更新信息',
|
||||
join_view: '关联视图',
|
||||
join_view: '数据关联',
|
||||
text: '文本',
|
||||
time: '时间',
|
||||
value: '数值',
|
||||
@ -785,7 +786,7 @@ export default {
|
||||
close: '关闭',
|
||||
required: '必填',
|
||||
input_content: '请输入内容',
|
||||
add_sql_table: '添加SQL',
|
||||
add_sql_table: '添加 SQL 数据集',
|
||||
preview: '预览',
|
||||
pls_input_name: '请输入名称',
|
||||
connect_mode: '连接模式',
|
||||
@ -795,10 +796,10 @@ export default {
|
||||
last_update_time: '上次更新时间',
|
||||
current_update_time: '当前更新时间',
|
||||
param: '参数',
|
||||
edit_sql: '编辑SQL',
|
||||
edit_sql: '编辑 SQL 数据集',
|
||||
showRow: '显示行',
|
||||
add_excel_table: '添加Excel数据集',
|
||||
add_custom_table: '添加自助数据集',
|
||||
add_custom_table: '添加自定义数据集',
|
||||
upload_file: '上传文件',
|
||||
detail: '详情',
|
||||
type: '类型',
|
||||
@ -811,7 +812,7 @@ export default {
|
||||
field_edit: '编辑字段',
|
||||
table_already_add_to: '该表已添加至',
|
||||
uploading: '上传中...',
|
||||
add_union: '添加关联',
|
||||
add_union: '新建关联',
|
||||
union_setting: '关联设置',
|
||||
pls_slc_union_field: '请选择关联字段',
|
||||
pls_slc_union_table: '请选择关联表',
|
||||
@ -825,12 +826,20 @@ export default {
|
||||
check_all: '全选',
|
||||
can_not_union_self: '被关联表不能与关联表相同',
|
||||
float: '小数',
|
||||
edit_custom_table: '编辑自助数据集',
|
||||
edit_custom_table: '编辑自定义数据集',
|
||||
edit_field: '编辑字段',
|
||||
preview_100_data: '显示前100行数据',
|
||||
invalid_table_check: '非直连数据集请先完成数据同步',
|
||||
parse_error: '解析错误',
|
||||
origin_field_type: '原始类型'
|
||||
origin_field_type: '原始类型',
|
||||
edit_excel_table: '编辑Excel数据集',
|
||||
edit_excel: '编辑Excel',
|
||||
excel_replace: '替换',
|
||||
excel_add: '追加',
|
||||
dataset_group: '数据集分组',
|
||||
m1: '将 ',
|
||||
m2: ' 移动到',
|
||||
char_can_not_more_50: '数据集名称不能超过50个字符'
|
||||
},
|
||||
datasource: {
|
||||
datasource: '数据源',
|
||||
@ -840,7 +849,7 @@ export default {
|
||||
data_base: '数据库名称',
|
||||
user_name: '用户名',
|
||||
password: '密码',
|
||||
host: '主机',
|
||||
host: '主机名/IP地址',
|
||||
port: '端口',
|
||||
please_input_data_base: '请输入数据库名称',
|
||||
please_input_user_name: '请输入用户名',
|
||||
|
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<div class="top-nav" :style="{'background-color': '#f1f3f8'}">
|
||||
<div class="log">
|
||||
<img v-if="!logoUrl" src="@/assets/DataEase-color.png" width="140" alt="" style="padding-top: 10px;">
|
||||
<!-- <img v-if="!logoUrl" src="@/assets/DataEase-color.png" width="140" alt="" style="padding-top: 10px;">-->
|
||||
<svg-icon v-if="!logoUrl" icon-class="DataEase" custom-class="top-nav-logo-icon" />
|
||||
<img v-else :src="logoUrl" width="140" alt="" style="padding-top: 10px;">
|
||||
</div>
|
||||
<el-menu
|
||||
|
@ -51,8 +51,8 @@ Vue.use(fullscreen)
|
||||
* please remove it before going online ! ! !
|
||||
*/
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
const { mockXHR } = require('../mock')
|
||||
mockXHR()
|
||||
// const { mockXHR } = require('../mock')
|
||||
// mockXHR()
|
||||
}
|
||||
|
||||
// set ElementUI lang to EN
|
||||
|
@ -11,7 +11,6 @@ import request from './modules/request'
|
||||
import panel from './modules/panel'
|
||||
import application from './modules/application'
|
||||
import lic from './modules/lic'
|
||||
import conditions from './modules/conditions'
|
||||
import animation from '@/components/canvas/store/animation'
|
||||
import compose from '@/components/canvas/store/compose'
|
||||
import contextmenu from '@/components/canvas/store/contextmenu'
|
||||
@ -20,7 +19,7 @@ import event from '@/components/canvas/store/event'
|
||||
import layer from '@/components/canvas/store/layer'
|
||||
import snapshot from '@/components/canvas/store/snapshot'
|
||||
import lock from '@/components/canvas/store/lock'
|
||||
|
||||
import { valueValid, formatCondition } from '@/utils/conditionUtil'
|
||||
import {
|
||||
DEFAULT_COMMON_CANVAS_STYLE
|
||||
} from '@/views/panel/panel'
|
||||
@ -105,7 +104,48 @@ const data = {
|
||||
state.componentData.push(component)
|
||||
}
|
||||
},
|
||||
removeViewFilter(state, componentId) {
|
||||
state.componentData = state.componentData.map(item => {
|
||||
const newItem = item
|
||||
newItem.filters = newItem.filters && newItem.filters.filter(filter => filter.componentId !== componentId) || []
|
||||
return newItem
|
||||
})
|
||||
},
|
||||
addViewFilter(state, data) {
|
||||
const condition = formatCondition(data)
|
||||
const vValid = valueValid(condition)
|
||||
// 1.根据componentId过滤
|
||||
const filterComponentId = condition.componentId
|
||||
|
||||
// 2.循环每个Component 得到 三种情况 a增加b删除c无操作
|
||||
const viewIdMatch = (viewIds, viewId) => !viewIds || viewIds.length === 0 || viewIds.includes(viewId)
|
||||
|
||||
for (let index = 0; index < state.componentData.length; index++) {
|
||||
const element = state.componentData[index]
|
||||
if (!element.type || element.type !== 'view') continue
|
||||
const currentFilters = element.filters || []
|
||||
const vidMatch = viewIdMatch(condition.viewIds, element.propValue.viewId)
|
||||
|
||||
let j = currentFilters.length
|
||||
// let filterExist = false
|
||||
while (j--) {
|
||||
const filter = currentFilters[j]
|
||||
if (filter.componentId === filterComponentId) {
|
||||
// filterExist = true
|
||||
// 已存在该条件 且 条件值有效 直接替换原体检
|
||||
// vidMatch && vValid && (currentFilters[j] = condition)
|
||||
// 已存在该条件 且 条件值无效 直接删除原条件
|
||||
// vidMatch && !vValid && (currentFilters.splice(j, 1))
|
||||
currentFilters.splice(j, 1)
|
||||
}
|
||||
}
|
||||
// 不存在该条件 且 条件有效 直接保存该条件
|
||||
// !filterExist && vValid && currentFilters.push(condition)
|
||||
vidMatch && vValid && currentFilters.push(condition)
|
||||
element.filters = currentFilters
|
||||
state.componentData[index] = element
|
||||
}
|
||||
},
|
||||
setComponentWithId(state, component) {
|
||||
for (let index = 0; index < state.componentData.length; index++) {
|
||||
const element = state.componentData[index]
|
||||
@ -143,8 +183,7 @@ const data = {
|
||||
request,
|
||||
panel,
|
||||
application,
|
||||
lic,
|
||||
conditions
|
||||
lic
|
||||
},
|
||||
getters
|
||||
}
|
||||
|
@ -1,94 +0,0 @@
|
||||
import { Condition } from '@/components/widget/bean/Condition'
|
||||
const state = {
|
||||
conditions: []
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
ADD_CONDITION: (state, condition) => {
|
||||
condition && valueValid(condition) && state.conditions.push(condition)
|
||||
},
|
||||
REDUCE_CONDITION: (state, index) => {
|
||||
state.conditions && state.conditions.length > index && state.conditions.splice(index, 1)
|
||||
},
|
||||
CLEAR: (state) => {
|
||||
state.conditions = []
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
add({ commit }, data) {
|
||||
const condition = formatCondition(data)
|
||||
if (!state.conditions || state.conditions.length === 0) {
|
||||
state.conditions = []
|
||||
}
|
||||
const validResult = isValid(condition)
|
||||
if (!validResult.statu && validResult.hasOwnProperty('existIndex') && validResult.existIndex !== -1) {
|
||||
commit('REDUCE_CONDITION', validResult.existIndex)
|
||||
commit('ADD_CONDITION', condition)
|
||||
}
|
||||
if (validResult.statu) {
|
||||
commit('ADD_CONDITION', condition)
|
||||
}
|
||||
},
|
||||
reduce({ commit }, index) {
|
||||
commit('ADD_CONDITION', index)
|
||||
},
|
||||
delete({ commit }, component) {
|
||||
for (let index = 0; index < state.conditions.length; index++) {
|
||||
const element = state.conditions[index]
|
||||
if (element.componentId === component.componentId) {
|
||||
commit('REDUCE_CONDITION', index)
|
||||
}
|
||||
}
|
||||
},
|
||||
clear({ commit }) {
|
||||
commit('CLEAR')
|
||||
}
|
||||
|
||||
}
|
||||
// 判断条件condition是否有效
|
||||
const isValid = condition => {
|
||||
const nullResult = {
|
||||
statu: false,
|
||||
msg: 'condition is null'
|
||||
}
|
||||
const repeatResult = {
|
||||
statu: false,
|
||||
existIndex: -1,
|
||||
msg: 'condition is exist'
|
||||
}
|
||||
const validResult = {
|
||||
statu: true,
|
||||
msg: null
|
||||
}
|
||||
if (!condition) {
|
||||
return nullResult
|
||||
}
|
||||
for (let index = 0; index < state.conditions.length; index++) {
|
||||
const item = state.conditions[index]
|
||||
if (item.componentId === condition.componentId) {
|
||||
repeatResult.existIndex = index
|
||||
return repeatResult
|
||||
}
|
||||
}
|
||||
return validResult
|
||||
}
|
||||
|
||||
const valueValid = condition => {
|
||||
return condition && condition.value && condition.value.length > 0 && condition.value[0]
|
||||
}
|
||||
|
||||
const formatCondition = obj => {
|
||||
const { component, value, operator } = obj
|
||||
const fieldId = component.options.attrs.fieldId
|
||||
const viewIds = component.options.attrs.viewIds
|
||||
const condition = new Condition(component.id, fieldId, operator, value, viewIds)
|
||||
return condition
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
actions
|
||||
}
|
@ -246,4 +246,14 @@ div:focus {
|
||||
position: fixed!important;
|
||||
}
|
||||
}
|
||||
.login-logo-icon{
|
||||
width: auto;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.top-nav-logo-icon{
|
||||
width: 140px;
|
||||
height: 45px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
|
32
frontend/src/utils/conditionUtil.js
Normal file
32
frontend/src/utils/conditionUtil.js
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
import { Condition } from '@/components/widget/bean/Condition'
|
||||
/**
|
||||
* 判断两个conditions数组是否相同
|
||||
* @param {*} conditions1
|
||||
* @param {*} conditions2
|
||||
* @returns
|
||||
*/
|
||||
export const isChange = (conditions1, conditions2) => {
|
||||
// 两个都null
|
||||
if (!conditions1 && !conditions2) return false
|
||||
if (!conditions1 || !conditions2) return true
|
||||
// 数组长度不一样 肯定发生了改变
|
||||
if (conditions1.length !== conditions2.length) return true
|
||||
let arr1 = JSON.parse(JSON.stringify(conditions1))
|
||||
let arr2 = JSON.parse(JSON.stringify(conditions2))
|
||||
arr1 = arr1.sort((s1, s2) => s1.componentId > s2.componentId)
|
||||
arr2 = arr2.sort((s1, s2) => s1.componentId > s2.componentId)
|
||||
return JSON.stringify(arr1) !== JSON.stringify(arr2)
|
||||
}
|
||||
|
||||
export const valueValid = condition => {
|
||||
return condition && condition.value && condition.value.length > 0 && condition.value[0]
|
||||
}
|
||||
|
||||
export const formatCondition = obj => {
|
||||
const { component, value, operator } = obj
|
||||
const fieldId = component.options.attrs.fieldId
|
||||
const viewIds = component.options.attrs.viewIds
|
||||
const condition = new Condition(component.id, fieldId, operator, value, viewIds)
|
||||
return condition
|
||||
}
|
@ -9,7 +9,6 @@ export function checkPermission(pers) {
|
||||
}
|
||||
|
||||
export function hasDataPermission(pTarget, pSource) {
|
||||
debugger
|
||||
if (pSource && pTarget) {
|
||||
return pSource.indexOf(pTarget) > -1
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ const LinkTokenKey = Config.LinkTokenKey
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
||||
// withCredentials: true, // send cookies when cross-domain requests
|
||||
timeout: 0 // request timeout
|
||||
timeout: 10000 // request timeout
|
||||
})
|
||||
|
||||
// request interceptor
|
||||
@ -83,6 +83,10 @@ const checkAuth = response => {
|
||||
const linkToken = response.headers[LinkTokenKey.toLocaleLowerCase()]
|
||||
setLinkToken(linkToken)
|
||||
}
|
||||
// 许可状态改变 刷新页面
|
||||
// if (response.headers['lic-status']) {
|
||||
// location.reload()
|
||||
// }
|
||||
}
|
||||
|
||||
// 请根据实际需求修改
|
||||
@ -91,7 +95,10 @@ service.interceptors.response.use(response => {
|
||||
checkAuth(response)
|
||||
return response.data
|
||||
}, error => {
|
||||
error.response.config.loading && tryHideLoading(store.getters.currentPath)
|
||||
const config = error.response && error.response.config || error.config
|
||||
const headers = error.response && error.response.headers || error.response || config.headers
|
||||
config.loading && tryHideLoading(store.getters.currentPath)
|
||||
|
||||
let msg
|
||||
if (error.response) {
|
||||
checkAuth(error.response)
|
||||
@ -100,7 +107,7 @@ service.interceptors.response.use(response => {
|
||||
} else {
|
||||
msg = error.message
|
||||
}
|
||||
!error.config.hideMsg && (!error.response.headers['authentication-status']) && $error(msg)
|
||||
!config.hideMsg && (!headers['authentication-status']) && $error(msg)
|
||||
return Promise.reject(error)
|
||||
})
|
||||
export default service
|
||||
|
@ -38,7 +38,8 @@ export function basePieOption(chart_option, chart) {
|
||||
}
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
|
||||
borderRadius: 0
|
||||
}
|
||||
y.type = 'pie'
|
||||
chart_option.series[0].data.push(y)
|
||||
@ -51,17 +52,53 @@ export function basePieOption(chart_option, chart) {
|
||||
}
|
||||
|
||||
export function rosePieOption(chart_option, chart) {
|
||||
basePieOption(chart_option, chart)
|
||||
// 处理shape attr
|
||||
let customAttr = {}
|
||||
if (chart.customAttr) {
|
||||
customAttr = JSON.parse(chart.customAttr)
|
||||
if (customAttr.size) {
|
||||
chart_option.series[0].roseType = customAttr.size.pieRoseType
|
||||
chart_option.series[0].itemStyle = {
|
||||
borderRadius: customAttr.size.pieRoseRadius
|
||||
if (customAttr.color) {
|
||||
chart_option.color = customAttr.color.colors
|
||||
}
|
||||
// tooltip
|
||||
if (customAttr.tooltip) {
|
||||
const tooltip = JSON.parse(JSON.stringify(customAttr.tooltip))
|
||||
const reg = new RegExp('\n', 'g')
|
||||
tooltip.formatter = tooltip.formatter.replace(reg, '<br/>')
|
||||
chart_option.tooltip = tooltip
|
||||
}
|
||||
}
|
||||
// 处理data
|
||||
if (chart.data) {
|
||||
chart_option.title.text = chart.title
|
||||
if (chart.data.series.length > 0) {
|
||||
chart_option.series[0].name = chart.data.series[0].name
|
||||
// size
|
||||
if (customAttr.size) {
|
||||
chart_option.series[0].radius = [customAttr.size.pieInnerRadius + '%', customAttr.size.pieOuterRadius + '%']
|
||||
chart_option.series[0].roseType = customAttr.size.pieRoseType
|
||||
}
|
||||
// label
|
||||
if (customAttr.label) {
|
||||
chart_option.series[0].label = customAttr.label
|
||||
}
|
||||
const valueArr = chart.data.series[0].data
|
||||
for (let i = 0; i < valueArr.length; i++) {
|
||||
const y = {
|
||||
name: chart.data.x[i],
|
||||
value: valueArr[i]
|
||||
}
|
||||
// color
|
||||
y.itemStyle = {
|
||||
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha),
|
||||
borderRadius: customAttr.size.pieRoseRadius
|
||||
}
|
||||
y.type = 'pie'
|
||||
chart_option.series[0].data.push(y)
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(chart_option);
|
||||
componentStyle(chart_option, chart)
|
||||
return chart_option
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,9 @@ export default {
|
||||
mounted() {
|
||||
this.preDraw()
|
||||
},
|
||||
destroyed() {
|
||||
this.myChart.dispose()
|
||||
},
|
||||
methods: {
|
||||
preDraw() {
|
||||
// 基于准备好的dom,初始化echarts实例
|
||||
|
@ -115,6 +115,11 @@ export default {
|
||||
this.fontSize = arr
|
||||
},
|
||||
changeTitleStyle() {
|
||||
if (this.titleForm.title.length < 1) {
|
||||
this.$error(this.$t('chart.title_cannot_empty'))
|
||||
this.titleForm.title = this.chart.title
|
||||
return
|
||||
}
|
||||
if (!this.titleForm.show) {
|
||||
this.isSetting = false
|
||||
}
|
||||
|
@ -11,13 +11,13 @@
|
||||
:header-row-style="table_header_class"
|
||||
:row-style="getRowStyle"
|
||||
class="table-class"
|
||||
:class="chart.id"
|
||||
show-summary
|
||||
:summary-method="summaryMethod"
|
||||
>
|
||||
<ux-table-column
|
||||
v-for="field in fields"
|
||||
:key="field.dataeaseName"
|
||||
min-width="200px"
|
||||
:field="field.dataeaseName"
|
||||
:resizable="true"
|
||||
sortable
|
||||
@ -109,7 +109,9 @@ export default {
|
||||
datas = []
|
||||
}
|
||||
this.$refs.plxTable.reloadData(datas)
|
||||
this.initStyle()
|
||||
this.$nextTick(() => {
|
||||
this.initStyle()
|
||||
})
|
||||
window.onresize = function() {
|
||||
that.calcHeight()
|
||||
}
|
||||
@ -149,7 +151,13 @@ export default {
|
||||
}
|
||||
this.table_item_class_stripe = JSON.parse(JSON.stringify(this.table_item_class))
|
||||
if (customAttr.color.tableStripe) {
|
||||
this.table_item_class_stripe.background = hexColorToRGBA(customAttr.color.tableItemBgColor, customAttr.color.alpha - 40)
|
||||
// this.table_item_class_stripe.background = hexColorToRGBA(customAttr.color.tableItemBgColor, customAttr.color.alpha - 40)
|
||||
if (this.chart.customStyle) {
|
||||
const customStyle = JSON.parse(this.chart.customStyle)
|
||||
if (customStyle.background) {
|
||||
this.table_item_class_stripe.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.chart.customStyle) {
|
||||
@ -165,18 +173,23 @@ export default {
|
||||
this.bg_class.background = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha)
|
||||
}
|
||||
}
|
||||
|
||||
// 修改footer合计样式
|
||||
const s_table = document.getElementsByClassName('elx-table--footer')[0]
|
||||
// console.log(s_table)
|
||||
let s = ''
|
||||
for (const i in this.table_header_class) {
|
||||
s += (i === 'fontSize' ? 'font-size' : i) + ':' + this.table_header_class[i] + ';'
|
||||
const table = document.getElementsByClassName(this.chart.id)
|
||||
for (let i = 0; i < table.length; i++) {
|
||||
const s_table = table[i].getElementsByClassName('elx-table--footer')
|
||||
// console.log(s_table)
|
||||
let s = ''
|
||||
for (const i in this.table_header_class) {
|
||||
s += (i === 'fontSize' ? 'font-size' : i) + ':' + this.table_header_class[i] + ';'
|
||||
}
|
||||
// console.log(s_table)
|
||||
for (let i = 0; i < s_table.length; i++) {
|
||||
s_table[i].setAttribute('style', s)
|
||||
}
|
||||
}
|
||||
s_table.setAttribute('style', s)
|
||||
},
|
||||
getRowStyle({ row, rowIndex }) {
|
||||
if (rowIndex % 2 === 0) {
|
||||
if (rowIndex % 2 !== 0) {
|
||||
return this.table_item_class_stripe
|
||||
} else {
|
||||
return this.table_item_class
|
||||
@ -217,6 +230,10 @@ export default {
|
||||
chartResize() {
|
||||
// 指定图表的配置项和数据
|
||||
this.calcHeight()
|
||||
},
|
||||
|
||||
initClass() {
|
||||
return this.chart.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,10 @@
|
||||
node-key="id"
|
||||
:expand-on-click-node="true"
|
||||
@node-click="nodeClick"
|
||||
@node-expand="nodeExpand"
|
||||
@node-collapse="nodeCollapse"
|
||||
>
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node">
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node father">
|
||||
<span style="display: flex;flex: 1;width: 0;">
|
||||
<span v-if="data.type === 'scene'">
|
||||
<!-- <el-button-->
|
||||
@ -53,7 +55,7 @@
|
||||
</span>
|
||||
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
|
||||
</span>
|
||||
<span v-if="hasDataPermission('manage',data.privileges)">
|
||||
<span v-if="hasDataPermission('manage',data.privileges)" class="child">
|
||||
<span v-if="data.type ==='group'" @click.stop>
|
||||
<el-dropdown trigger="click" size="small" @command="clickAdd">
|
||||
<span class="el-dropdown-link">
|
||||
@ -150,12 +152,12 @@
|
||||
highlight-current
|
||||
@node-click="sceneClick"
|
||||
>
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node-list">
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node-list father">
|
||||
<span style="display: flex;flex: 1;width: 0;">
|
||||
<span><svg-icon :icon-class="data.type" /></span>
|
||||
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
|
||||
</span>
|
||||
<span v-if="hasDataPermission('manage',data.privileges)">
|
||||
<span v-if="hasDataPermission('manage',data.privileges)" class="child">
|
||||
<span style="margin-left: 12px;" @click.stop>
|
||||
<el-dropdown trigger="click" size="small" @command="clickMore">
|
||||
<span class="el-dropdown-link">
|
||||
@ -166,9 +168,9 @@
|
||||
/>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('renameChart',data,node)">
|
||||
{{ $t('chart.rename') }}
|
||||
</el-dropdown-item>
|
||||
<!-- <el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('renameChart',data,node)">-->
|
||||
<!-- {{ $t('chart.rename') }}-->
|
||||
<!-- </el-dropdown-item>-->
|
||||
<el-dropdown-item icon="el-icon-delete" :command="beforeClickMore('deleteChart',data,node)">
|
||||
{{ $t('chart.delete') }}
|
||||
</el-dropdown-item>
|
||||
@ -250,7 +252,7 @@ export default {
|
||||
expandedArray: [],
|
||||
groupForm: {
|
||||
name: '',
|
||||
pid: null,
|
||||
pid: '0',
|
||||
level: 0,
|
||||
type: '',
|
||||
children: [],
|
||||
@ -449,7 +451,7 @@ export default {
|
||||
this.editGroup = false
|
||||
this.groupForm = {
|
||||
name: '',
|
||||
pid: null,
|
||||
pid: '0',
|
||||
level: 0,
|
||||
type: '',
|
||||
children: [],
|
||||
@ -491,14 +493,14 @@ export default {
|
||||
this.$store.dispatch('chart/setSceneId', this.currGroup.id)
|
||||
this.chartTree()
|
||||
}
|
||||
if (node.expanded) {
|
||||
this.expandedArray.push(data.id)
|
||||
} else {
|
||||
const index = this.expandedArray.indexOf(data.id)
|
||||
if (index > -1) {
|
||||
this.expandedArray.splice(index, 1)
|
||||
}
|
||||
}
|
||||
// if (node.expanded) {
|
||||
// this.expandedArray.push(data.id)
|
||||
// } else {
|
||||
// const index = this.expandedArray.indexOf(data.id)
|
||||
// if (index > -1) {
|
||||
// this.expandedArray.splice(index, 1)
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
back() {
|
||||
@ -534,6 +536,7 @@ export default {
|
||||
this.chartData.forEach(function(ele) {
|
||||
if (ele.id === that.$store.state.chart.chartSceneData.id) {
|
||||
ele.type = that.$store.state.chart.chartSceneData.type
|
||||
ele.name = that.$store.state.chart.chartSceneData.name
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -609,6 +612,17 @@ export default {
|
||||
this.currGroup = response.data
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
nodeExpand(data) {
|
||||
if (data.id) {
|
||||
this.expandedArray.push(data.id)
|
||||
}
|
||||
},
|
||||
nodeCollapse(data) {
|
||||
if (data.id) {
|
||||
this.expandedArray.splice(this.expandedArray.indexOf(data.id), 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -692,4 +706,10 @@ export default {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.father .child {
|
||||
display: none;
|
||||
}
|
||||
.father:hover .child {
|
||||
display: inline;
|
||||
}
|
||||
</style>
|
||||
|
@ -486,9 +486,9 @@ export default {
|
||||
const view = JSON.parse(JSON.stringify(this.view))
|
||||
view.id = this.view.id
|
||||
view.sceneId = this.view.sceneId
|
||||
view.name = this.view.name ? this.view.name : this.table.name
|
||||
view.name = this.view.title ? this.view.title : this.table.name
|
||||
if (view.title.length > 50) {
|
||||
this.$warning(this.$t('chart.title_limit'))
|
||||
this.$error(this.$t('chart.title_limit'))
|
||||
return
|
||||
}
|
||||
view.tableId = this.view.tableId
|
||||
@ -623,7 +623,7 @@ export default {
|
||||
}
|
||||
// 从仪表板入口关闭
|
||||
bus.$emit('PanelSwitchComponent', { name: 'PanelEdit' })
|
||||
this.$emit('switchComponent', { name: '' })
|
||||
// this.$emit('switchComponent', { name: '' })
|
||||
},
|
||||
getData(id) {
|
||||
if (id) {
|
||||
|
@ -16,14 +16,14 @@
|
||||
<el-divider />
|
||||
<el-row>
|
||||
<el-form :inline="true">
|
||||
<el-form-item class="form-item">
|
||||
<el-form-item class="form-item" :label="$t('commons.name')">
|
||||
<el-input v-model="name" size="mini" :placeholder="$t('commons.name')" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-col style="display: flex;flex-direction: row">
|
||||
<el-col class="panel-height" style="width: 220px;border-right:solid 1px #dcdfe6;border-top:solid 1px #dcdfe6;padding-right: 15px;overflow-y: auto;">
|
||||
<dataset-group-selector :table="table" :mode="1" :checked-list="checkedList" :union-data="unionData" @getTable="getTable" />
|
||||
<dataset-group-selector :custom-type="customType" :table="table" :mode="1" :checked-list="checkedList" :union-data="unionData" @getTable="getTable" />
|
||||
</el-col>
|
||||
<el-col class="panel-height" style="width: 235px;border-top:solid 1px #dcdfe6;padding: 0 15px;overflow-y: auto;">
|
||||
<dataset-custom-field :table="table" :checked-list="checkedList" @getChecked="getChecked" />
|
||||
@ -31,7 +31,7 @@
|
||||
<el-col class="panel-height" style="flex: 1;overflow: hidden;">
|
||||
<el-card class="box-card dataPreview" shadow="never">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{ $t('dataset.data_preview') }}</span>
|
||||
<span style="font-size: 16px;">{{ $t('dataset.data_preview') }}</span>
|
||||
</div>
|
||||
<ux-grid
|
||||
ref="plxTable"
|
||||
@ -77,13 +77,14 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: '自助数据集',
|
||||
name: '自定义数据集',
|
||||
table: {},
|
||||
checkedList: [],
|
||||
unionData: [],
|
||||
height: 500,
|
||||
data: [],
|
||||
fields: []
|
||||
fields: [],
|
||||
customType: ['db', 'sql', 'excel']
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -192,7 +193,7 @@ export default {
|
||||
if (this.name.length > 50) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: this.$t('commons.char_can_not_more_50'),
|
||||
message: this.$t('dataset.char_can_not_more_50'),
|
||||
type: 'error'
|
||||
})
|
||||
return
|
||||
@ -265,7 +266,7 @@ export default {
|
||||
}
|
||||
|
||||
.dataPreview>>>.el-card__header{
|
||||
padding: 6px 8px;
|
||||
padding: 0 8px 12px;
|
||||
}
|
||||
|
||||
.dataPreview>>>.el-card__body{
|
||||
|
@ -3,7 +3,7 @@
|
||||
<el-row>
|
||||
<el-row style="height: 26px;">
|
||||
<span style="line-height: 26px;">
|
||||
{{ $t('dataset.add_excel_table') }}
|
||||
{{ param.tableId?$t('dataset.edit_excel_table'):$t('dataset.add_excel_table') }}
|
||||
</span>
|
||||
<el-row style="float: right">
|
||||
<el-button size="mini" @click="cancel">
|
||||
@ -20,7 +20,7 @@
|
||||
<el-col style="width: 500px;">
|
||||
<el-form :inline="true" size="mini" class="row-style">
|
||||
<el-form-item class="form-item">
|
||||
<el-input v-model="name" :placeholder="$t('commons.name')" />
|
||||
<el-input v-show="!param.tableId" v-model="name" :placeholder="$t('commons.name')" />
|
||||
</el-form-item>
|
||||
<el-form-item class="form-item">
|
||||
<el-upload
|
||||
@ -171,19 +171,35 @@ export default {
|
||||
if (this.name.length > 50) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: this.$t('commons.char_can_not_more_50'),
|
||||
message: this.$t('dataset.char_can_not_more_50'),
|
||||
type: 'error'
|
||||
})
|
||||
return
|
||||
}
|
||||
const table = {
|
||||
id: this.param.tableId,
|
||||
name: this.name,
|
||||
sceneId: this.param.id,
|
||||
dataSourceId: null,
|
||||
type: 'excel',
|
||||
mode: parseInt(this.mode),
|
||||
info: '{"data":"' + this.path + '"}'
|
||||
let table = {}
|
||||
if (!this.param.tableId) {
|
||||
table = {
|
||||
id: this.param.tableId,
|
||||
name: this.name,
|
||||
sceneId: this.param.id,
|
||||
dataSourceId: null,
|
||||
type: 'excel',
|
||||
mode: parseInt(this.mode),
|
||||
// info: '{"data":"' + this.path + '"}',
|
||||
info: JSON.stringify({ data: this.path })
|
||||
}
|
||||
} else {
|
||||
table = {
|
||||
id: this.param.tableId,
|
||||
name: this.param.table.name,
|
||||
sceneId: this.param.id,
|
||||
dataSourceId: null,
|
||||
type: 'excel',
|
||||
mode: parseInt(this.mode),
|
||||
// info: '{"data":"' + this.path + '"}',
|
||||
info: JSON.stringify({ data: this.path }),
|
||||
editType: this.param.editType ? this.param.editType : 0
|
||||
}
|
||||
}
|
||||
post('/dataset/table/update', table).then(response => {
|
||||
this.$store.dispatch('dataset/setSceneData', new Date().getTime())
|
||||
|
@ -219,7 +219,8 @@ export default {
|
||||
post('/dataset/table/sqlPreview', {
|
||||
dataSourceId: this.dataSource,
|
||||
type: 'sql',
|
||||
info: '{"sql":"' + this.sql + '"}'
|
||||
// info: '{"sql":"' + this.sql + '"}',
|
||||
info: JSON.stringify({ sql: this.sql })
|
||||
}).then(response => {
|
||||
this.fields = response.data.fields
|
||||
this.data = response.data.data
|
||||
@ -248,7 +249,7 @@ export default {
|
||||
if (this.name.length > 50) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: this.$t('commons.char_can_not_more_50'),
|
||||
message: this.$t('dataset.char_can_not_more_50'),
|
||||
type: 'error'
|
||||
})
|
||||
return
|
||||
@ -260,7 +261,8 @@ export default {
|
||||
dataSourceId: this.dataSource,
|
||||
type: 'sql',
|
||||
mode: parseInt(this.mode),
|
||||
info: '{"sql":"' + this.sql + '"}'
|
||||
// info: '{"sql":"' + this.sql + '"}',
|
||||
info: JSON.stringify({ sql: this.sql })
|
||||
}
|
||||
post('/dataset/table/update', table).then(response => {
|
||||
this.$store.dispatch('dataset/setSceneData', new Date().getTime())
|
||||
|
@ -4,9 +4,9 @@
|
||||
<span class="table-name">{{ table.name }}</span>
|
||||
</el-row>
|
||||
<el-divider />
|
||||
<el-checkbox v-model="checkAll" :disabled="!(fields.length > 0)" :indeterminate="isIndeterminate" @change="handleCheckAllChange">{{ $t('dataset.check_all') }}</el-checkbox>
|
||||
<el-checkbox v-model="checkAll" :disabled="!(fields.length > 0)" :indeterminate="isIndeterminate" style="font-weight: 400;" @change="handleCheckAllChange">{{ $t('dataset.check_all') }}</el-checkbox>
|
||||
<el-checkbox-group v-model="checkedFields" @change="handleCheckedFieldsChange">
|
||||
<el-checkbox v-for="f in fields" :key="f.id" :label="f.id" style="display: block;margin-top: 4px;width: 100%;">
|
||||
<el-checkbox v-for="f in fields" :key="f.id" :label="f.id" style="display: block;margin-top: 4px;width: 100%;font-weight: 400;">
|
||||
<span style="display: flex;flex-direction: row;flex: 1;">
|
||||
<span>
|
||||
<span v-if="f.deType === 0">
|
||||
|
@ -108,6 +108,11 @@ import { isKettleRunning, post } from '@/api/dataset/dataset'
|
||||
export default {
|
||||
name: 'DatasetGroupSelector',
|
||||
props: {
|
||||
customType: {
|
||||
type: Array,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
mode: {
|
||||
type: Number,
|
||||
required: false,
|
||||
@ -226,7 +231,8 @@ export default {
|
||||
post('/dataset/table/list', {
|
||||
sort: 'type asc,create_time desc,name asc',
|
||||
sceneId: this.currGroup.id,
|
||||
mode: this.mode < 0 ? null : this.mode
|
||||
mode: this.mode < 0 ? null : this.mode,
|
||||
typeFilter: this.customType ? this.customType : null
|
||||
}, false).then(response => {
|
||||
this.tables = response.data
|
||||
for (let i = 0; i < this.tables.length; i++) {
|
||||
|
@ -14,6 +14,19 @@
|
||||
</span>
|
||||
</el-popover>
|
||||
<el-row style="float: right">
|
||||
<el-dropdown v-if="table.type ==='excel'" style="margin-right: 10px;" size="small" trigger="click" @command="clickEditExcel">
|
||||
<el-button size="mini">
|
||||
{{ $t('dataset.edit_excel') }}
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeEditExcel('0')">
|
||||
{{ $t('dataset.excel_replace') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeEditExcel('1')">
|
||||
{{ $t('dataset.excel_add') }}
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-button v-if="table.type ==='custom'" size="mini" @click="editCustom">
|
||||
{{ $t('dataset.edit_custom_table') }}
|
||||
</el-button>
|
||||
@ -108,10 +121,10 @@ export default {
|
||||
this.fields = response.data.fields
|
||||
this.data = response.data.data
|
||||
this.page = response.data.page
|
||||
if(response.data.status === 'warnning'){
|
||||
if (response.data.status === 'warnning') {
|
||||
this.$warning(response.data.msg, 3000)
|
||||
}
|
||||
if(response.data.status === 'error') {
|
||||
if (response.data.status === 'error') {
|
||||
this.$error(response.data.msg, 3000)
|
||||
}
|
||||
}).catch(response => {
|
||||
@ -147,6 +160,24 @@ export default {
|
||||
},
|
||||
hideTab() {
|
||||
this.tabStatus = false
|
||||
},
|
||||
|
||||
clickEditExcel(param) {
|
||||
// console.log(param);
|
||||
switch (param.type) {
|
||||
case '0':
|
||||
this.$emit('switchComponent', { name: 'AddExcel', param: { id: this.table.sceneId, tableId: this.table.id, editType: 0, table: this.table }})
|
||||
break
|
||||
case '1':
|
||||
this.$emit('switchComponent', { name: 'AddExcel', param: { id: this.table.sceneId, tableId: this.table.id, editType: 1, table: this.table }})
|
||||
break
|
||||
}
|
||||
},
|
||||
|
||||
beforeEditExcel(type) {
|
||||
return {
|
||||
'type': type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
85
frontend/src/views/dataset/group/DsMoveSelector.vue
Normal file
85
frontend/src/views/dataset/group/DsMoveSelector.vue
Normal file
@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<el-col style="height: 400px;overflow-y: auto;margin-bottom: 10px;">
|
||||
<el-tree
|
||||
:data="tData"
|
||||
node-key="id"
|
||||
:expand-on-click-node="false"
|
||||
highlight-current
|
||||
@node-click="nodeClick"
|
||||
>
|
||||
<span slot-scope="{ node, data }" :class="treeClass(data,node)">
|
||||
<span style="display: flex;flex: 1;width: 0;">
|
||||
<span v-if="data.type === 'scene'">
|
||||
<svg-icon icon-class="scene" class="ds-icon-scene" />
|
||||
</span>
|
||||
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { groupTree } from '@/api/dataset/dataset'
|
||||
|
||||
export default {
|
||||
name: 'DsMoveSelector',
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tData: [],
|
||||
currGroup: '',
|
||||
groupForm: {
|
||||
name: '',
|
||||
pid: null,
|
||||
level: 0,
|
||||
type: '',
|
||||
children: [],
|
||||
sort: 'type desc,name asc'
|
||||
},
|
||||
targetGroup: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'item': function() {
|
||||
this.tree(this.groupForm)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.tree(this.groupForm)
|
||||
},
|
||||
methods: {
|
||||
tree(group) {
|
||||
groupTree(group).then(res => {
|
||||
this.tData = res.data
|
||||
})
|
||||
},
|
||||
nodeClick(data, node) {
|
||||
this.targetGroup = data
|
||||
this.$emit('targetDs', data)
|
||||
},
|
||||
treeClass(data, node) {
|
||||
if (data.id === this.item.id) {
|
||||
node.visible = false
|
||||
}
|
||||
return 'custom-tree-node'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right:8px;
|
||||
}
|
||||
</style>
|
@ -40,8 +40,10 @@
|
||||
node-key="id"
|
||||
:expand-on-click-node="true"
|
||||
@node-click="nodeClick"
|
||||
@node-expand="nodeExpand"
|
||||
@node-collapse="nodeCollapse"
|
||||
>
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node">
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node father">
|
||||
<span style="display: flex;flex: 1;width: 0;">
|
||||
<span v-if="data.type === 'scene'">
|
||||
<!-- <el-button-->
|
||||
@ -53,7 +55,7 @@
|
||||
</span>
|
||||
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
|
||||
</span>
|
||||
<span v-if="hasDataPermission('manage',data.privileges)">
|
||||
<span v-if="hasDataPermission('manage',data.privileges)" class="child">
|
||||
<span v-if="data.type ==='group'" @click.stop>
|
||||
<el-dropdown trigger="click" size="small" @command="clickAdd">
|
||||
<span class="el-dropdown-link">
|
||||
@ -86,9 +88,9 @@
|
||||
<el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('rename',data,node)">
|
||||
{{ $t('dataset.rename') }}
|
||||
</el-dropdown-item>
|
||||
<!-- <el-dropdown-item icon="el-icon-right" :command="beforeClickMore('move',data,node)">-->
|
||||
<!-- {{$t('dataset.move_to')}}-->
|
||||
<!-- </el-dropdown-item>-->
|
||||
<el-dropdown-item icon="el-icon-right" :command="beforeClickMore('move',data,node)">
|
||||
{{ $t('dataset.move_to') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-delete" :command="beforeClickMore('delete',data,node)">
|
||||
{{ $t('dataset.delete') }}
|
||||
</el-dropdown-item>
|
||||
@ -179,7 +181,7 @@
|
||||
highlight-current
|
||||
@node-click="sceneClick"
|
||||
>
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node-list">
|
||||
<span slot-scope="{ node, data }" class="custom-tree-node-list father">
|
||||
<span style="display: flex;flex: 1;width: 0;">
|
||||
<span>
|
||||
<svg-icon v-if="data.type === 'db'" icon-class="ds-db" class="ds-icon-db" />
|
||||
@ -193,7 +195,7 @@
|
||||
</span>
|
||||
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
|
||||
</span>
|
||||
<span v-if="hasDataPermission('manage',data.privileges)">
|
||||
<span v-if="hasDataPermission('manage',data.privileges)" class="child">
|
||||
<span style="margin-left: 12px;" @click.stop>
|
||||
<el-dropdown trigger="click" size="small" @command="clickMore">
|
||||
<span class="el-dropdown-link">
|
||||
@ -207,9 +209,9 @@
|
||||
<el-dropdown-item icon="el-icon-edit-outline" :command="beforeClickMore('editTable',data,node)">
|
||||
{{ $t('dataset.rename') }}
|
||||
</el-dropdown-item>
|
||||
<!-- <el-dropdown-item icon="el-icon-right" :command="beforeClickMore('move',data,node)">-->
|
||||
<!-- {{$t('dataset.move_to')}}-->
|
||||
<!-- </el-dropdown-item>-->
|
||||
<el-dropdown-item icon="el-icon-right" :command="beforeClickMore('moveDs',data,node)">
|
||||
{{ $t('dataset.move_to') }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-delete" :command="beforeClickMore('deleteTable',data,node)">
|
||||
{{ $t('dataset.delete') }}
|
||||
</el-dropdown-item>
|
||||
@ -238,14 +240,37 @@
|
||||
</el-dialog>
|
||||
|
||||
</el-col>
|
||||
|
||||
<!--移动分组、场景-->
|
||||
<el-dialog v-dialogDrag :title="moveDialogTitle" :visible="moveGroup" :show-close="false" width="30%" class="dialog-css">
|
||||
<group-move-selector :item="groupForm" @targetGroup="targetGroup" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeMoveGroup()">{{ $t('dataset.cancel') }}</el-button>
|
||||
<el-button :disabled="groupMoveConfirmDisabled" type="primary" size="mini" @click="saveMoveGroup(tGroup)">{{ $t('dataset.confirm') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!--移动数据集-->
|
||||
<el-dialog v-dialogDrag :title="moveDialogTitle" :visible="moveDs" :show-close="false" width="30%" class="dialog-css">
|
||||
<ds-move-selector :item="dsForm" @targetDs="targetDs" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeMoveDs()">{{ $t('dataset.cancel') }}</el-button>
|
||||
<el-button :disabled="dsMoveConfirmDisabled" type="primary" size="mini" @click="saveMoveDs(tDs)">{{ $t('dataset.confirm') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, groupTree } from '@/api/dataset/dataset'
|
||||
import GroupMoveSelector from './GroupMoveSelector'
|
||||
import DsMoveSelector from './DsMoveSelector'
|
||||
|
||||
export default {
|
||||
name: 'Group',
|
||||
components: { GroupMoveSelector, DsMoveSelector },
|
||||
data() {
|
||||
return {
|
||||
sceneMode: false,
|
||||
@ -260,7 +285,15 @@ export default {
|
||||
expandedArray: [],
|
||||
groupForm: {
|
||||
name: '',
|
||||
pid: null,
|
||||
pid: '0',
|
||||
level: 0,
|
||||
type: '',
|
||||
children: [],
|
||||
sort: 'type desc,name asc'
|
||||
},
|
||||
dsForm: {
|
||||
name: '',
|
||||
pid: '0',
|
||||
level: 0,
|
||||
type: '',
|
||||
children: [],
|
||||
@ -282,7 +315,14 @@ export default {
|
||||
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' },
|
||||
{ max: 50, message: this.$t('commons.char_can_not_more_50'), trigger: 'change' }
|
||||
]
|
||||
}
|
||||
},
|
||||
moveGroup: false,
|
||||
tGroup: {},
|
||||
moveDs: false,
|
||||
tDs: {},
|
||||
groupMoveConfirmDisabled: true,
|
||||
dsMoveConfirmDisabled: true,
|
||||
moveDialogTitle: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -329,7 +369,12 @@ export default {
|
||||
this.groupForm = JSON.parse(JSON.stringify(param.data))
|
||||
break
|
||||
case 'move':
|
||||
|
||||
this.moveTo(param.data)
|
||||
this.groupForm = JSON.parse(JSON.stringify(param.data))
|
||||
break
|
||||
case 'moveDs':
|
||||
this.moveToDs(param.data)
|
||||
this.dsForm = JSON.parse(JSON.stringify(param.data))
|
||||
break
|
||||
case 'delete':
|
||||
this.delete(param.data)
|
||||
@ -395,6 +440,7 @@ export default {
|
||||
table.mode = parseInt(table.mode)
|
||||
this.$refs['tableForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
table.isRename = true
|
||||
addTable(table).then(response => {
|
||||
this.closeTable()
|
||||
this.$message({
|
||||
@ -462,7 +508,7 @@ export default {
|
||||
this.editGroup = false
|
||||
this.groupForm = {
|
||||
name: '',
|
||||
pid: null,
|
||||
pid: '0',
|
||||
level: 0,
|
||||
type: '',
|
||||
children: [],
|
||||
@ -505,14 +551,14 @@ export default {
|
||||
this.currGroup = data
|
||||
this.$store.dispatch('dataset/setSceneData', this.currGroup.id)
|
||||
}
|
||||
if (node.expanded) {
|
||||
this.expandedArray.push(data.id)
|
||||
} else {
|
||||
const index = this.expandedArray.indexOf(data.id)
|
||||
if (index > -1) {
|
||||
this.expandedArray.splice(index, 1)
|
||||
}
|
||||
}
|
||||
// if (node.expanded) {
|
||||
// this.expandedArray.push(data.id)
|
||||
// } else {
|
||||
// const index = this.expandedArray.indexOf(data.id)
|
||||
// if (index > -1) {
|
||||
// this.expandedArray.splice(index, 1)
|
||||
// }
|
||||
// }
|
||||
// console.log(this.expandedArray);
|
||||
},
|
||||
|
||||
@ -562,6 +608,79 @@ export default {
|
||||
this.currGroup = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
nodeExpand(data) {
|
||||
if (data.id) {
|
||||
this.expandedArray.push(data.id)
|
||||
}
|
||||
},
|
||||
nodeCollapse(data) {
|
||||
if (data.id) {
|
||||
this.expandedArray.splice(this.expandedArray.indexOf(data.id), 1)
|
||||
}
|
||||
},
|
||||
|
||||
moveTo(data) {
|
||||
this.moveGroup = true
|
||||
this.moveDialogTitle = this.$t('dataset.m1') + (data.name.length > 10 ? (data.name.substr(0, 10) + '...') : data.name) + this.$t('dataset.m2')
|
||||
},
|
||||
closeMoveGroup() {
|
||||
this.moveGroup = false
|
||||
this.groupForm = {
|
||||
name: '',
|
||||
pid: '0',
|
||||
level: 0,
|
||||
type: '',
|
||||
children: [],
|
||||
sort: 'type desc,name asc'
|
||||
}
|
||||
},
|
||||
saveMoveGroup() {
|
||||
this.groupForm.pid = this.tGroup.id
|
||||
addGroup(this.groupForm).then(res => {
|
||||
this.closeMoveGroup()
|
||||
this.tree(this.groupForm)
|
||||
})
|
||||
},
|
||||
targetGroup(val) {
|
||||
this.tGroup = val
|
||||
this.groupMoveConfirmDisabled = false
|
||||
},
|
||||
|
||||
moveToDs(data) {
|
||||
this.moveDs = true
|
||||
this.moveDialogTitle = this.$t('dataset.m1') + (data.name.length > 10 ? (data.name.substr(0, 10) + '...') : data.name) + this.$t('dataset.m2')
|
||||
},
|
||||
closeMoveDs() {
|
||||
this.moveDs = false
|
||||
this.dsForm = {
|
||||
name: '',
|
||||
pid: '0',
|
||||
level: 0,
|
||||
type: '',
|
||||
children: [],
|
||||
sort: 'type desc,name asc'
|
||||
}
|
||||
},
|
||||
saveMoveDs() {
|
||||
if (this.tDs && this.tDs.type === 'group') {
|
||||
return
|
||||
}
|
||||
this.dsForm.sceneId = this.tDs.id
|
||||
this.dsForm.isRename = true
|
||||
addTable(this.dsForm).then(res => {
|
||||
this.closeMoveDs()
|
||||
this.tableTree()
|
||||
})
|
||||
},
|
||||
targetDs(val) {
|
||||
this.tDs = val
|
||||
if (this.tDs.type === 'group') {
|
||||
this.dsMoveConfirmDisabled = true
|
||||
} else {
|
||||
this.dsMoveConfirmDisabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -633,4 +752,14 @@ export default {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.father .child {
|
||||
display: none;
|
||||
}
|
||||
.father:hover .child {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.dialog-css >>> .el-dialog__body {
|
||||
padding: 10px 20px 20px;
|
||||
}
|
||||
</style>
|
||||
|
92
frontend/src/views/dataset/group/GroupMoveSelector.vue
Normal file
92
frontend/src/views/dataset/group/GroupMoveSelector.vue
Normal file
@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<el-col style="height: 400px;overflow-y: auto;margin-bottom: 10px;">
|
||||
<el-tree
|
||||
:data="tData"
|
||||
node-key="id"
|
||||
:expand-on-click-node="false"
|
||||
highlight-current
|
||||
@node-click="nodeClick"
|
||||
>
|
||||
<span slot-scope="{ node, data }" :class="treeClass(data,node)">
|
||||
<span style="display: flex;flex: 1;width: 0;">
|
||||
<span v-if="data.type === 'scene'">
|
||||
<svg-icon icon-class="scene" class="ds-icon-scene" />
|
||||
</span>
|
||||
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</el-col>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { groupTree } from '@/api/dataset/dataset'
|
||||
|
||||
export default {
|
||||
name: 'GroupMoveSelector',
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tData: [],
|
||||
currGroup: '',
|
||||
groupForm: {
|
||||
name: '',
|
||||
pid: null,
|
||||
level: 0,
|
||||
type: 'group',
|
||||
children: [],
|
||||
sort: 'type desc,name asc'
|
||||
},
|
||||
targetGroup: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'item': function() {
|
||||
this.tree(this.groupForm)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.tree(this.groupForm)
|
||||
},
|
||||
methods: {
|
||||
tree(group) {
|
||||
groupTree(group).then(res => {
|
||||
this.tData = [{
|
||||
id: '0',
|
||||
name: this.$t('dataset.dataset_group'),
|
||||
pid: '0',
|
||||
privileges: 'grant,manage,use',
|
||||
type: 'group',
|
||||
children: res.data
|
||||
}]
|
||||
})
|
||||
},
|
||||
nodeClick(data, node) {
|
||||
this.targetGroup = data
|
||||
this.$emit('targetGroup', data)
|
||||
},
|
||||
treeClass(data, node) {
|
||||
if (data.id === this.item.id) {
|
||||
node.visible = false
|
||||
}
|
||||
return 'custom-tree-node'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right:8px;
|
||||
}
|
||||
</style>
|
@ -5,11 +5,14 @@
|
||||
<el-col :span="12">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" size="default">
|
||||
<div class="login-logo">
|
||||
<img v-if="!loginLogoUrl" src="@/assets/DataEase-color.png" alt="">
|
||||
<svg-icon v-if="!loginLogoUrl" icon-class="DataEase" custom-class="login-logo-icon" />
|
||||
<img v-else :src="loginLogoUrl" alt="">
|
||||
</div>
|
||||
<div class="login-welcome">
|
||||
{{ $t('login.welcome') + (uiInfo && uiInfo['ui.title'] && uiInfo['ui.title'].paramValue || 'DATAEASE') }}
|
||||
<div v-if="uiInfo && uiInfo['ui.loginTitle'] && uiInfo['ui.loginTitle'].paramValue" class="login-welcome">
|
||||
{{ uiInfo['ui.loginTitle'].paramValue }}
|
||||
</div>
|
||||
<div v-else class="login-welcome">
|
||||
{{ $t('login.welcome') + (uiInfo && uiInfo['ui.title'] && uiInfo['ui.title'].paramValue || ' DataEase') }}
|
||||
</div>
|
||||
<div class="login-form">
|
||||
<el-form-item prop="username">
|
||||
|
@ -223,7 +223,8 @@ export default {
|
||||
outStyle: {
|
||||
width: null,
|
||||
height: null
|
||||
}
|
||||
},
|
||||
beforeDialogValue: []
|
||||
}
|
||||
},
|
||||
|
||||
@ -232,7 +233,6 @@ export default {
|
||||
return this.$store.state.panel.panelInfo
|
||||
},
|
||||
...mapState([
|
||||
'componentData',
|
||||
'curComponent',
|
||||
'isClickComponent',
|
||||
'canvasStyleData',
|
||||
@ -293,14 +293,24 @@ export default {
|
||||
const componentDataTemp = this.$store.state.panel.componentDataTemp
|
||||
const canvasStyleDataTemp = this.$store.state.panel.canvasStyleDataTemp
|
||||
if (componentDataTemp && canvasStyleDataTemp) {
|
||||
this.$store.commit('setComponentData', this.resetID(JSON.parse(componentDataTemp)))
|
||||
const componentDatas = JSON.parse(componentDataTemp)
|
||||
componentDatas.forEach(item => {
|
||||
item.filters = (item.filters || [])
|
||||
})
|
||||
this.$store.commit('setComponentData', this.resetID(componentDatas))
|
||||
// this.$store.commit('setComponentData', this.resetID(JSON.parse(componentDataTemp)))
|
||||
this.$store.commit('setCanvasStyle', JSON.parse(canvasStyleDataTemp))
|
||||
// 清空临时画布数据
|
||||
this.$store.dispatch('panel/setComponentDataTemp', null)
|
||||
this.$store.dispatch('panel/setCanvasStyleDataTemp', null)
|
||||
} else if (panelId) {
|
||||
findOne(panelId).then(response => {
|
||||
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
|
||||
const componentDatas = JSON.parse(response.data.panelData)
|
||||
componentDatas.forEach(item => {
|
||||
item.filters = (item.filters || [])
|
||||
})
|
||||
this.$store.commit('setComponentData', this.resetID(componentDatas))
|
||||
// this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
|
||||
const panelStyle = JSON.parse(response.data.panelStyle)
|
||||
this.$store.commit('setCanvasStyle', panelStyle)
|
||||
this.$store.commit('recordSnapshot')// 记录快照
|
||||
@ -380,6 +390,7 @@ export default {
|
||||
viewId: componentInfo.id
|
||||
}
|
||||
component.propValue = propValue
|
||||
component.filters = []
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@ -432,15 +443,19 @@ export default {
|
||||
}
|
||||
},
|
||||
openFilterDiolog() {
|
||||
this.beforeDialogValue = []
|
||||
this.filterVisible = true
|
||||
},
|
||||
cancelFilter() {
|
||||
this.beforeDialogValue = []
|
||||
this.filterVisible = false
|
||||
this.currentWidget = null
|
||||
this.clearCurrentInfo()
|
||||
},
|
||||
sureFilter() {
|
||||
this.currentFilterCom.options.value = []
|
||||
const component = deepCopy(this.currentFilterCom)
|
||||
|
||||
// this.$store.commit('addComponent', { component })
|
||||
this.$store.commit('setComponentWithId', component)
|
||||
this.$store.commit('recordSnapshot')
|
||||
|
@ -29,13 +29,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentList from '@/components/canvas/custom-component/component-list'
|
||||
import { ApplicationContext } from '@/utils/ApplicationContext'
|
||||
export default {
|
||||
name: 'FilterGroup',
|
||||
data() {
|
||||
return {
|
||||
componentList,
|
||||
panelInfo: this.$store.state.panel.panelInfo,
|
||||
// widgetSubjects: {
|
||||
// '文本过滤组件': [
|
||||
|
@ -82,7 +82,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
showCurrentTemplateInfo(data) {
|
||||
debugger
|
||||
this.editPanel.panelInfo.name = data.name
|
||||
this.editPanel.panelInfo.panelStyle = data.templateStyle
|
||||
this.editPanel.panelInfo.panelData = data.templateData
|
||||
|
@ -574,7 +574,11 @@ export default {
|
||||
if (data.nodeType === 'panel') {
|
||||
// 加载视图数据
|
||||
findOne(data.id).then(response => {
|
||||
this.$store.commit('setComponentData', this.resetID(JSON.parse(response.data.panelData)))
|
||||
const componentDatas = JSON.parse(response.data.panelData)
|
||||
componentDatas.forEach(item => {
|
||||
item.filters = (item.filters || [])
|
||||
})
|
||||
this.$store.commit('setComponentData', this.resetID(componentDatas))
|
||||
// this.$store.commit('setComponentData', sourceInfo.type === 'custom' ? sourceInfo : this.resetID(sourceInfo))
|
||||
const temp = JSON.parse(response.data.panelStyle)
|
||||
this.$store.commit('setCanvasStyle', temp)
|
||||
|
@ -57,7 +57,8 @@ export default {
|
||||
},
|
||||
authCondition: {
|
||||
type: Object,
|
||||
required: false
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
dataInfo: {
|
||||
type: Object,
|
||||
@ -67,7 +68,10 @@ export default {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
attachActiveName: String,
|
||||
attachActiveName: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
defaultProps: {
|
||||
type: Object,
|
||||
required: false,
|
||||
|
@ -92,7 +92,7 @@
|
||||
|
||||
import LayoutContent from '@/components/business/LayoutContent'
|
||||
import ComplexTable from '@/components/business/complex-table'
|
||||
import { checkPermission, hasDataPermission } from '@/utils/permission'
|
||||
import { hasDataPermission } from '@/utils/permission'
|
||||
import { formatCondition } from '@/utils/index'
|
||||
import { dsGrid, addDs, editDs, delDs, validateDs } from '@/api/system/datasource'
|
||||
|
||||
|
@ -146,7 +146,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event)
|
||||
// console.log(tab, event)
|
||||
},
|
||||
create() {
|
||||
this.$router.push({ name: 'system-role-form' })
|
||||
|
@ -152,7 +152,7 @@ export default {
|
||||
this.formInline = response.data
|
||||
this.formInline.ssl = this.formInline.ssl === 'true'
|
||||
this.formInline.tls = this.formInline.tls === 'true'
|
||||
console.log(this.formInline)
|
||||
// console.log(this.formInline)
|
||||
this.$nextTick(() => {
|
||||
this.$refs.formInline.clearValidate()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user