提交 97c90910 authored 作者: taojinlong's avatar taojinlong

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

...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# DataEase - 人人可用的开源数据可视化分析工具 # DataEase - 人人可用的开源数据可视化分析工具
DataEase 是开源的数据可视化分析工具,帮助用户分析数据、改善业务。DataEase 支持丰富的数据源连接,能够通过拖拉拽方式快速制作图表,并可以方便的与他人分享。 DataEase 是开源的数据可视化分析工具,帮助用户快速分析数据并洞察业务趋势,从而实现业务的改进与优化。DataEase 支持丰富的数据源连接,能够通过拖拉拽方式快速制作图表,并可以方便的与他人分享。
- 图表展示: 支持 PC 端、移动端及大屏; - 图表展示: 支持 PC 端、移动端及大屏;
- 图表制作: 支持丰富的图表类型(基于 Apache ECharts 实现)、支持拖拉拽方式快速制作仪表板; - 图表制作: 支持丰富的图表类型(基于 Apache ECharts 实现)、支持拖拉拽方式快速制作仪表板;
......
package io.dataease.service.dataset; package io.dataease.service.dataset;
import io.dataease.base.domain.*; import io.dataease.base.domain.DatasetTable;
import io.dataease.base.domain.DatasetTableTask;
import io.dataease.base.domain.DatasetTableTaskExample;
import io.dataease.base.domain.DatasetTableTaskLog;
import io.dataease.base.mapper.DatasetTableTaskMapper; import io.dataease.base.mapper.DatasetTableTaskMapper;
import io.dataease.commons.constants.JobStatus; import io.dataease.commons.constants.JobStatus;
import io.dataease.commons.constants.ScheduleType; import io.dataease.commons.constants.ScheduleType;
import io.dataease.controller.request.dataset.DataSetTaskRequest; import io.dataease.controller.request.dataset.DataSetTaskRequest;
import io.dataease.i18n.Translator; import io.dataease.i18n.Translator;
import io.dataease.service.ScheduleService; import io.dataease.service.ScheduleService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.quartz.CronExpression; import org.quartz.CronExpression;
...@@ -44,25 +46,29 @@ public class DataSetTableTaskService { ...@@ -44,25 +46,29 @@ public class DataSetTableTaskService {
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig()); dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
// check // check
if (StringUtils.equalsIgnoreCase(datasetTableTask.getRate(),"CRON")){
if (StringUtils.isNotEmpty(datasetTableTask.getCron())) { if (StringUtils.isNotEmpty(datasetTableTask.getCron())) {
if (!CronExpression.isValidExpression(datasetTableTask.getCron())) { if (!CronExpression.isValidExpression(datasetTableTask.getCron())) {
throw new RuntimeException(Translator.get("i18n_cron_expression_error")); throw new RuntimeException(Translator.get("i18n_cron_expression_error"));
} }
} }
// check start time and end time // check start time and end time
if (ObjectUtils.isNotEmpty(datasetTableTask.getStartTime()) if (StringUtils.equalsIgnoreCase(datasetTableTask.getEnd(), "1")
&& ObjectUtils.isNotEmpty(datasetTableTask.getStartTime())
&& ObjectUtils.isNotEmpty(datasetTableTask.getEndTime()) && ObjectUtils.isNotEmpty(datasetTableTask.getEndTime())
&& datasetTableTask.getStartTime() != 0 && datasetTableTask.getStartTime() != 0
&& datasetTableTask.getEndTime() != 0 && datasetTableTask.getEndTime() != 0
&& datasetTableTask.getStartTime() > datasetTableTask.getEndTime()) { && datasetTableTask.getStartTime() > datasetTableTask.getEndTime()) {
throw new RuntimeException(Translator.get("i18n_cron_time_error")); throw new RuntimeException(Translator.get("i18n_cron_time_error"));
} }
}
if (StringUtils.isEmpty(datasetTableTask.getId())) { if (StringUtils.isEmpty(datasetTableTask.getId())) {
datasetTableTask.setId(UUID.randomUUID().toString()); datasetTableTask.setId(UUID.randomUUID().toString());
datasetTableTask.setCreateTime(System.currentTimeMillis()); datasetTableTask.setCreateTime(System.currentTimeMillis());
// SIMPLE 类型,提前占位 // SIMPLE 类型,提前占位
if (datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) { if (datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
if(datasetTableTask.getType().equalsIgnoreCase("add_scope")){ if (datasetTableTask.getType().equalsIgnoreCase("add_scope")) {
DatasetTable datasetTable = dataSetTableService.get(datasetTableTask.getTableId()); DatasetTable datasetTable = dataSetTableService.get(datasetTableTask.getTableId());
if (datasetTable.getLastUpdateTime() == 0 || datasetTable.getLastUpdateTime() == null) { if (datasetTable.getLastUpdateTime() == 0 || datasetTable.getLastUpdateTime() == null) {
throw new Exception(Translator.get("i18n_not_exec_add_sync")); throw new Exception(Translator.get("i18n_not_exec_add_sync"));
...@@ -70,7 +76,7 @@ public class DataSetTableTaskService { ...@@ -70,7 +76,7 @@ public class DataSetTableTaskService {
} }
if (extractDataService.updateSyncStatusIsNone(dataSetTableService.get(datasetTableTask.getTableId()))) { if (extractDataService.updateSyncStatusIsNone(dataSetTableService.get(datasetTableTask.getTableId()))) {
throw new Exception(Translator.get("i18n_sync_job_exists")); throw new Exception(Translator.get("i18n_sync_job_exists"));
}else { } else {
//write log //write log
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog(); DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
datasetTableTaskLog.setTableId(datasetTableTask.getTableId()); datasetTableTaskLog.setTableId(datasetTableTask.getTableId());
......
...@@ -1252,7 +1252,7 @@ export default { ...@@ -1252,7 +1252,7 @@ export default {
this.top = this.mouseClickPosition.top this.top = this.mouseClickPosition.top
this.left = this.mouseClickPosition.left this.left = this.mouseClickPosition.left
this.width = this.mouseClickPosition.width this.width = this.mouseClickPosition.width
console.log('width5:' + this.width) // console.log('width5:' + this.width)
this.height = this.mouseClickPosition.height this.height = this.mouseClickPosition.height
} }
} }
...@@ -1436,7 +1436,7 @@ export default { ...@@ -1436,7 +1436,7 @@ export default {
let groupLeft = 0 let groupLeft = 0
let groupTop = 0 let groupTop = 0
for (const item of nodes) { for (const item of nodes) {
console.log('===' + typeof item.tagName) // console.log('===' + typeof item.tagName)
// 修复判断条件 // 修复判断条件
// if (item.className !== undefined && item.className.split(' ').includes(this.classNameActive)) { // if (item.className !== undefined && item.className.split(' ').includes(this.classNameActive)) {
if (item.tagName !== 'svg' && item.className !== undefined && item.className.split(' ').includes(this.classNameActive)) { if (item.tagName !== 'svg' && item.className !== undefined && item.className.split(' ').includes(this.classNameActive)) {
......
...@@ -175,7 +175,7 @@ export default { ...@@ -175,7 +175,7 @@ export default {
this.requestStatus = 'success' this.requestStatus = 'success'
} else { } else {
this.requestStatus = 'error' this.requestStatus = 'error'
this.message = response.massage this.message = response.message
} }
return true return true
}).catch(err => { }).catch(err => {
......
...@@ -33,9 +33,9 @@ export const assistList = [ ...@@ -33,9 +33,9 @@ export const assistList = [
export const pictureList = [ export const pictureList = [
{ {
id: '20001', id: '20001',
component: 'picture', component: 'picture-add',
type: 'picture', type: 'picture-add',
label: '点击上传', label: '拖拽上传',
icon: 'iconfont icon-picture', icon: 'iconfont icon-picture',
defaultClass: 'text-filter' defaultClass: 'text-filter'
} }
...@@ -137,6 +137,14 @@ const list = [ ...@@ -137,6 +137,14 @@ const list = [
height: 300, height: 300,
borderRadius: '' borderRadius: ''
} }
},
{
id: '20001',
component: 'picture-add',
type: 'picture-add',
label: '拖拽上传',
icon: 'iconfont icon-picture',
defaultClass: 'text-filter'
} }
] ]
......
...@@ -71,7 +71,6 @@ const data = { ...@@ -71,7 +71,6 @@ const data = {
}, },
setCurComponent(state, { component, index }) { setCurComponent(state, { component, index }) {
console.log('curComponent' + JSON.stringify(component))
state.curComponent = component state.curComponent = component
state.curComponentIndex = index state.curComponentIndex = index
}, },
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
:key="index" :key="index"
:data-id="item.id" :data-id="item.id"
:data-index="index" :data-index="index"
draggable
:class="'filter-widget '+ (item.defaultClass || '')" :class="'filter-widget '+ (item.defaultClass || '')"
@click="goFile"
> >
<div class="filter-widget-icon"> <div class="filter-widget-icon">
<i :class="(item.icon || 'el-icon-setting') + ' widget-icon-i'" /> <i :class="(item.icon || 'el-icon-setting') + ' widget-icon-i'" />
......
...@@ -154,6 +154,8 @@ ...@@ -154,6 +154,8 @@
<Preview v-if="previewVisible" :show-type="canvasStyleData.selfAdaption?'full':'width'" /> <Preview v-if="previewVisible" :show-type="canvasStyleData.selfAdaption?'full':'width'" />
</fullscreen> </fullscreen>
<input id="input" ref="files" type="file" accept="image/*" hidden @change="handleFileChange">
</el-row> </el-row>
</template> </template>
...@@ -188,6 +190,10 @@ import '@/components/canvas/styles/animate.css' ...@@ -188,6 +190,10 @@ import '@/components/canvas/styles/animate.css'
import { ApplicationContext } from '@/utils/ApplicationContext' import { ApplicationContext } from '@/utils/ApplicationContext'
import FilterDialog from '../filter/filterDialog' import FilterDialog from '../filter/filterDialog'
import toast from '@/components/canvas/utils/toast'
import { commonStyle, commonAttr } from '@/components/canvas/custom-component/component-list'
import generateID from '@/components/canvas/utils/generateID'
export default { export default {
name: 'PanelEdit', name: 'PanelEdit',
components: { components: {
...@@ -238,7 +244,8 @@ export default { ...@@ -238,7 +244,8 @@ export default {
height: null height: null
}, },
beforeDialogValue: [], beforeDialogValue: [],
styleDialogVisible: false styleDialogVisible: false,
currentDropElement: null
} }
}, },
...@@ -248,6 +255,7 @@ export default { ...@@ -248,6 +255,7 @@ export default {
}, },
...mapState([ ...mapState([
'curComponent', 'curComponent',
'curCanvasScale',
'isClickComponent', 'isClickComponent',
'canvasStyleData', 'canvasStyleData',
'curComponentIndex', 'curComponentIndex',
...@@ -384,13 +392,12 @@ export default { ...@@ -384,13 +392,12 @@ export default {
return data return data
}, },
handleDrop(e) { handleDrop(e) {
this.currentDropElement = e
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
let component let component
const newComponentId = uuid.v1() const newComponentId = uuid.v1()
const componentInfo = JSON.parse(e.dataTransfer.getData('componentInfo')) const componentInfo = JSON.parse(e.dataTransfer.getData('componentInfo'))
if (componentInfo.type === 'assist') { if (componentInfo.type === 'assist') {
// 辅助设计组件 // 辅助设计组件
componentList.forEach(componentTemp => { componentList.forEach(componentTemp => {
...@@ -398,6 +405,12 @@ export default { ...@@ -398,6 +405,12 @@ export default {
component = deepCopy(componentTemp) component = deepCopy(componentTemp)
} }
}) })
if (component.type === 'picture-add') {
this.goFile()
this.clearCurrentInfo()
return
}
} else if (componentInfo.type === 'view') { } else if (componentInfo.type === 'view') {
// 用户视图设置 复制一个模板 // 用户视图设置 复制一个模板
componentList.forEach(componentTemp => { componentList.forEach(componentTemp => {
...@@ -415,8 +428,8 @@ export default { ...@@ -415,8 +428,8 @@ export default {
this.currentWidget = ApplicationContext.getService(componentInfo.id) this.currentWidget = ApplicationContext.getService(componentInfo.id)
this.currentFilterCom = this.currentWidget.getDrawPanel() this.currentFilterCom = this.currentWidget.getDrawPanel()
this.currentFilterCom.style.top = e.offsetY this.currentFilterCom.style.top = this.getPositionY(e.layerY)
this.currentFilterCom.style.left = e.offsetX this.currentFilterCom.style.left = this.getPositionX(e.layerX)
this.currentFilterCom.id = newComponentId this.currentFilterCom.id = newComponentId
if (this.currentWidget.filterDialog) { if (this.currentWidget.filterDialog) {
this.show = false this.show = false
...@@ -427,8 +440,8 @@ export default { ...@@ -427,8 +440,8 @@ export default {
} }
// position = absolution 或导致有偏移 这里中和一下偏移量 // position = absolution 或导致有偏移 这里中和一下偏移量
component.style.top = e.offsetY component.style.top = this.getPositionY(e.layerY)
component.style.left = e.offsetX component.style.left = this.getPositionX(e.layerX)
component.id = newComponentId component.id = newComponentId
this.$store.commit('addComponent', { component }) this.$store.commit('addComponent', { component })
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot')
...@@ -525,6 +538,64 @@ export default { ...@@ -525,6 +538,64 @@ export default {
}, },
closeStyleDialog() { closeStyleDialog() {
this.styleDialogVisible = false this.styleDialogVisible = false
},
goFile() {
this.$refs.files.click()
},
handleFileChange(e) {
const file = e.target.files[0]
if (!file.type.includes('image')) {
toast('只能插入图片')
return
}
const reader = new FileReader()
reader.onload = (res) => {
const fileResult = res.target.result
const img = new Image()
img.onload = () => {
const scaleWith = img.width / 400
const scaleHeight = img.height / 200
let scale = scaleWith > scaleHeight ? scaleWith : scaleHeight
scale = scale > 1 ? scale : 1
this.$store.commit('addComponent', {
component: {
...commonAttr,
id: generateID(),
component: 'Picture',
label: '图片',
icon: '',
propValue: fileResult,
style: {
...commonStyle,
top: this.getPositionY(this.currentDropElement.layerY),
left: this.getPositionX(this.currentDropElement.layerX),
width: img.width / scale,
height: img.height / scale
}
}
})
this.$store.commit('recordSnapshot')
}
img.src = fileResult
}
reader.readAsDataURL(file)
},
getPositionX(x) {
if (this.canvasStyleData.selfAdaption) {
return x * 100 / this.curCanvasScale.scaleWidth
} else {
return x
}
},
getPositionY(y) {
if (this.canvasStyleData.selfAdaption) {
return y * 100 / this.curCanvasScale.scaleHeight
} else {
return y
}
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论