Merge branch 'dev' of github.com:dataease/dataease into dev

This commit is contained in:
taojinlong 2022-04-29 17:52:08 +08:00
commit 861b576722
10 changed files with 76 additions and 40 deletions

View File

@ -1,5 +1,7 @@
package io.dataease.service.dataset;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.auth.api.dto.CurrentUserDto;
@ -960,6 +962,8 @@ public class DataSetTableService {
res.put("data", jsonArray);
return res;
} catch (Exception e) {
e.printStackTrace();
logger.error(e.getMessage());
return res;
}
}
@ -1321,6 +1325,17 @@ public class DataSetTableService {
DatasourceTypes datasourceTypes = DatasourceTypes.valueOf(ds.getType());
String keyword = datasourceTypes.getKeywordPrefix() + "%s" + datasourceTypes.getKeywordSuffix();
String configuration = ds.getConfiguration();
JSONObject jsonObject = JSON.parseObject(configuration);
String schema = jsonObject.getString("schema");
String joinPrefix = "";
if (StringUtils.isNotEmpty(schema) && (StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.db2.getType()) ||
StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.sqlServer.getType()) ||
StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.oracle.getType()) ||
StringUtils.equalsIgnoreCase(ds.getType(), DatasourceTypes.pg.getType()))) {
joinPrefix = String.format(keyword, schema) + ".";
}
List<UnionDTO> union = dataTableInfoDTO.getUnion();
// 所有选中的字段即select后的查询字段
Map<String, String[]> checkedInfo = new LinkedHashMap<>();
@ -1386,7 +1401,7 @@ public class DataSetTableService {
String currentTableName = new Gson().fromJson(currentTable.getInfo(), DataTableInfoDTO.class)
.getTable();
join.append(" ").append(joinType).append(" ").append(String.format(keyword, currentTableName))
join.append(" ").append(joinType).append(" ").append(joinPrefix).append(String.format(keyword, currentTableName))
.append(" ON ");
for (int i = 0; i < unionParamDTO.getUnionFields().size(); i++) {
UnionItemDTO unionItemDTO = unionParamDTO.getUnionFields().get(i);
@ -1409,13 +1424,13 @@ public class DataSetTableService {
if (StringUtils.isEmpty(f)) {
DEException.throwException(Translator.get("i18n_union_ds_no_checked"));
}
sql = MessageFormat.format("SELECT {0} FROM {1}", f, String.format(keyword, tableName)) + join.toString();
sql = MessageFormat.format("SELECT {0} FROM {1}", f, joinPrefix + String.format(keyword, tableName)) + join.toString();
} else {
String f = StringUtils.join(checkedInfo.get(tableName), ",");
if (StringUtils.isEmpty(f)) {
throw new RuntimeException(Translator.get("i18n_union_ds_no_checked"));
}
sql = MessageFormat.format("SELECT {0} FROM {1}", f, String.format(keyword, tableName));
sql = MessageFormat.format("SELECT {0} FROM {1}", f, joinPrefix + String.format(keyword, tableName));
}
Map<String, Object> map = new HashMap<>();
map.put("sql", sql);
@ -1494,6 +1509,9 @@ public class DataSetTableService {
public void saveTableField(DatasetTable datasetTable) throws Exception {
Datasource ds = datasourceMapper.selectByPrimaryKey(datasetTable.getDataSourceId());
if (ObjectUtils.isEmpty(ds)) {
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
}
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
BeanUtils.copyBean(dataSetTableRequest, datasetTable);

View File

@ -1368,7 +1368,11 @@ export default {
resizeView(index, item) {
if (item.type === 'view' || item.type === 'de-show-date') {
this.$refs.wrapperChild[index].chartResize()
try {
this.$refs.wrapperChild[index].chartResize()
} catch (e) {
// ignore error
}
}
},
editComponent(index, item) {

View File

@ -115,7 +115,7 @@ export default {
this.flvPlayer.load()
this.flvPlayer.play()
} catch (error) {
console.log(error)
console.log('flvjs err ignore')
}
}
}

View File

@ -128,7 +128,7 @@ export function baseGaugeOptionAntV(plot, container, chart, action, scale = 1) {
}
}
}
console.log(options.indicator.pin)
// console.log(options.indicator.pin)
// 开始渲染
if (plot) {

View File

@ -9,7 +9,7 @@
v-for="(config, index) in pcComponentData"
v-if="!config.mobileSelected"
:id="'wait' + config.id"
:key="index"
:key="config.id"
>
<component-wait-item
:config="config"

View File

@ -1,8 +1,5 @@
<template>
<div
v-proportion="0.8"
:style="componentItemStyle"
>
<div class="component-item">
<mobile-check-bar v-if="mobileCheckBarShow" :element="config" />
<de-out-widget
v-if="config.type==='custom'"
@ -70,11 +67,6 @@ export default {
})
return result
},
componentItemStyle() {
return {
padding: '5px'
}
},
...mapState([
'mobileLayoutStatus',
'componentData',
@ -96,4 +88,8 @@ export default {
width: 100% !important;
height: 100%;
}
.component-item {
padding: 5px;
height: 200px!important;
}
</style>

View File

@ -266,35 +266,40 @@ export default {
downloadToTemplate() {
const _this = this
_this.dataLoading = true
_this.findStaticSource(function(staticResource) {
html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
_this.dataLoading = false
const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.1
if (snapshot !== '') {
_this.templateInfo = {
name: _this.$store.state.panel.panelInfo.name,
templateType: 'self',
snapshot: snapshot,
panelStyle: JSON.stringify(_this.canvasStyleData),
panelData: JSON.stringify(_this.componentData),
dynamicData: JSON.stringify(_this.panelViewDetailsInfo),
staticResource: JSON.stringify(staticResource || {})
try {
_this.findStaticSource(function(staticResource) {
html2canvas(document.getElementById('canvasInfoTemp')).then(canvas => {
_this.dataLoading = false
const snapshot = canvas.toDataURL('image/jpeg', 0.1) // 0.1
if (snapshot !== '') {
_this.templateInfo = {
name: _this.$store.state.panel.panelInfo.name,
templateType: 'self',
snapshot: snapshot,
panelStyle: JSON.stringify(_this.canvasStyleData),
panelData: JSON.stringify(_this.componentData),
dynamicData: JSON.stringify(_this.panelViewDetailsInfo),
staticResource: JSON.stringify(staticResource || {})
}
const blob = new Blob([JSON.stringify(_this.templateInfo)], { type: '' })
FileSaver.saveAs(blob, _this.$store.state.panel.panelInfo.name + '-TEMPLATE.DET')
}
const blob = new Blob([JSON.stringify(_this.templateInfo)], { type: '' })
FileSaver.saveAs(blob, _this.$store.state.panel.panelInfo.name + '-TEMPLATE.DET')
}
})
})
})
} catch (e) {
console.error(e)
_this.dataLoading = false
}
},
//
findStaticSource(callBack) {
const staticResource = []
//
if (this.canvasStyleData.panel.imageUrl && this.canvasStyleData.panel.imageUrl.indexOf('static-resource') > -1) {
if (typeof this.canvasStyleData.panel.imageUrl === 'string' && this.canvasStyleData.panel.imageUrl.indexOf('static-resource') > -1) {
staticResource.push(this.canvasStyleData.panel.imageUrl)
}
this.componentData.forEach(item => {
if (item.commonBackground && item.commonBackground.outerImage && item.commonBackground.outerImage.indexOf('static-resource') > -1) {
if (typeof item.commonBackground.outerImage === 'string' && item.commonBackground.outerImage.indexOf('static-resource') > -1) {
staticResource.push(item.commonBackground.outerImage)
}
})
@ -308,7 +313,9 @@ export default {
callBack()
}
} else {
callBack()
setTimeout(() => {
callBack()
}, 0)
}
},

View File

@ -183,7 +183,7 @@ import { pluginLoaded } from '@/api/user'
/* import { ldapStatus, pluginLoaded } from '@/api/user' */
import { userLists, addUser, editUser, delUser, editPassword, editStatus, allRoles } from '@/api/system/user'
import { getDeptTree, treeByDeptId } from '@/api/system/dept'
import { mapGetters } from 'vuex'
export default {
components: { ComplexTable, LayoutContent, Treeselect },
@ -320,6 +320,11 @@ export default {
canLoadDom: false
}
},
computed: {
...mapGetters([
'user'
])
},
mounted() {
this.allRoles()
this.search()
@ -420,7 +425,7 @@ export default {
this.$success(this.$t('commons.modify_success'))
this.editPasswordVisible = false
this.search()
window.location.reload()
this.user && this.user.userId && (this.user.userId === editPasswordForm.userId) && window.location.reload()
})
} else {
return false

View File

@ -85,12 +85,17 @@ export default {
}
updatePersonPwd(param).then(res => {
this.$success(this.$t('commons.save_success'))
this.$router.push('/panel/index')
this.logout()
// this.$router.push('/panel/index')
})
} else {
return false
}
})
},
async logout() {
await this.$store.dispatch('user/logout')
this.$router.push('/')
}
}
}

View File

@ -3,7 +3,8 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>