From 7f1712f898d0ff1f388bd312b1522a69f407c813 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 16 May 2022 19:26:16 +0800 Subject: [PATCH 01/18] =?UTF-8?q?refactor:=20=E7=94=BB=E5=B8=83=E5=86=85?= =?UTF-8?q?=E5=AD=98=E4=BD=BF=E7=94=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/view/ChartEdit.vue | 16 +++++++++++++--- frontend/src/views/panel/edit/index.vue | 6 +++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 239d4d7334..2713d54e8e 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1018,11 +1018,9 @@ import ValueFormatterEdit from '@/views/chart/components/value-formatter/ValueFo import ChartStyle from '@/views/chart/view/ChartStyle' import CustomSortEdit from '@/views/chart/components/compare/CustomSortEdit' import { TYPE_CONFIGS } from '@/views/chart/chart/util' -import ChartStyleBack from '@/views/chart/view/ChartStyleBack' export default { name: 'ChartEdit', components: { - ChartStyleBack, CustomSortEdit, ChartStyle, ValueFormatterEdit, @@ -1062,6 +1060,11 @@ export default { type: String, required: false, default: 'view' + }, + editStatue: { + type: Boolean, + required: false, + default: false } }, data() { @@ -1196,10 +1199,17 @@ export default { } */ }, watch: { + 'editStatue': function(val) { + if (val && this.param.id !== this.preChartId) { + this.preChartId = this.param.id + this.chartInit() + // console.log('fromwatch:' + JSON.stringify(val)) + } + }, 'param': function(val) { if (this.param.optType === 'new') { // - } else if (this.param.id !== this.preChartId) { + } else if (this.param.id !== this.preChartId && this.editStatue) { this.preChartId = this.param.id this.chartInit() // console.log('fromwatch:' + JSON.stringify(val)) diff --git a/frontend/src/views/panel/edit/index.vue b/frontend/src/views/panel/edit/index.vue index d489ed6cd0..e2b69618ee 100644 --- a/frontend/src/views/panel/edit/index.vue +++ b/frontend/src/views/panel/edit/index.vue @@ -24,7 +24,7 @@ -
+
@@ -228,7 +228,7 @@
- +
@@ -305,7 +305,7 @@ > - + Date: Mon, 16 May 2022 19:54:28 +0800 Subject: [PATCH 02/18] =?UTF-8?q?refactor:=20=E4=BB=A3=E7=A0=81=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/DeDrag/MoveInShadow.vue | 1 - frontend/src/components/DeDrag/index.vue | 14 -------------- frontend/src/components/DeDrag/shadow.vue | 8 -------- .../src/components/Notification/index.vue | 1 - frontend/src/components/TinyMCE/index.vue | 1 - .../components/canvas/components/AttrList.vue | 1 - .../canvas/components/AttrListExtend.vue | 1 - .../canvas/components/Editor/EditBar.vue | 9 --------- .../canvas/components/Editor/LinkageField.vue | 1 - .../canvas/components/Editor/PreviewEject.vue | 2 -- .../canvas/components/Editor/Shape.vue | 1 - .../canvas/components/Editor/index.vue | 19 ------------------- .../canvas/components/FilterTextAttr.vue | 1 - .../canvas/components/RectangleAttr.vue | 1 - .../components/canvas/components/TextAttr.vue | 4 ---- .../canvas/custom-component/DeFrame.vue | 2 -- .../canvas/custom-component/DeVideo.vue | 11 ----------- .../src/components/dataease/DeOutWidget.vue | 1 - .../components/widget/DeWidget/DeShowDate.vue | 1 - .../src/components/widget/DeWidget/DeTabs.vue | 1 - frontend/src/views/background/index.vue | 1 - .../views/chart/components/ChartComponent.vue | 1 - .../chart/components/ChartComponentG2.vue | 1 - .../chart/components/ChartComponentS2.vue | 3 --- .../components/drag-item/ChartDragItem.vue | 4 ---- .../components/drag-item/DimensionExtItem.vue | 2 -- .../components/drag-item/DimensionItem.vue | 3 --- .../components/drag-item/QuotaExtItem.vue | 3 --- .../chart/components/drag-item/QuotaItem.vue | 3 --- .../components/normal/LabelNormalText.vue | 1 - .../chart/components/table/TableNormal.vue | 2 -- frontend/src/views/chart/view/ChartEdit.vue | 7 ------- frontend/src/views/dataset/add/AddCustom.vue | 6 ------ frontend/src/views/dataset/add/AddSQL.vue | 2 -- .../dataset/common/DatasetGroupSelector.vue | 1 - .../src/views/dataset/data/CalcFieldEdit.vue | 2 -- frontend/src/views/dataset/data/FieldEdit.vue | 1 - .../src/views/dataset/data/TabDataPreview.vue | 1 - frontend/src/views/dataset/data/UnionView.vue | 3 --- .../src/views/dataset/data/UpdateInfo.vue | 2 -- frontend/src/views/dataset/data/ViewTable.vue | 1 - .../src/views/dataset/data/authConfig.vue | 2 -- frontend/src/views/msg/setting.vue | 2 -- .../src/views/panel/GrantAuth/shareTree.vue | 1 - .../src/views/panel/LinkJumpSet/index.vue | 1 - .../src/views/panel/OuterParamsSet/index.vue | 1 - .../SubjectSetting/PreSubject/Slider.vue | 1 - .../PreSubject/SubjectTemplateItem.vue | 1 - .../PreSubject/SubjectTemplateItemback.vue | 1 - frontend/src/views/panel/ViewSelect/index.vue | 1 - frontend/src/views/panel/edit/index.vue | 1 - frontend/src/views/panel/filter/index.vue | 1 - frontend/src/views/panel/index.vue | 1 - frontend/src/views/panel/list/PanelList.vue | 1 - .../panel/template/component/TemplateItem.vue | 1 - frontend/src/views/system/SysParam/index.vue | 1 - frontend/src/views/system/about/index.vue | 2 -- .../src/views/system/authority/authConfig.vue | 2 -- .../system/authority/authQuickConfig.vue | 2 -- frontend/src/views/system/authority/index.vue | 1 - frontend/src/views/system/plugin/dynamic.vue | 3 --- frontend/src/views/system/user/form.vue | 1 - mobile/src/App.vue | 5 +---- 63 files changed, 1 insertion(+), 163 deletions(-) diff --git a/frontend/src/components/DeDrag/MoveInShadow.vue b/frontend/src/components/DeDrag/MoveInShadow.vue index 366436c3aa..83be41af0b 100644 --- a/frontend/src/components/DeDrag/MoveInShadow.vue +++ b/frontend/src/components/DeDrag/MoveInShadow.vue @@ -50,7 +50,6 @@ export default { background: 'gray', position: 'absolute' } - // console.log('style=>' + JSON.stringify(style)) return style }, ...mapState([ diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index be2eccc549..e709d1fe45 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -661,7 +661,6 @@ export default { this.maxH = val }, w(val) { - // console.log('changeWidthCK:' + this.resizing) if (this.resizing || this.dragging) { return @@ -669,7 +668,6 @@ export default { if (this.parent) { this.bounds = this.calcResizeLimits() } - // console.log('changeWidth:' + val) this.changeWidth(val) }, h(val) { @@ -1051,7 +1049,6 @@ export default { const tmpDeltaY = axis && axis !== 'x' ? mouseClickPosition.mouseY - mY : 0 // mY 鼠标指针移动的点 mY - this.latestMoveY 是计算向下移动还是向上移动 const offsetY = mY - this.latestMoveY - // console.log('mY:' + mY + ';latestMoveY=' + this.latestMoveY + ';offsetY=' + offsetY) this.$emit('canvasDragging', mY, offsetY) this.latestMoveY = mY const [deltaX, deltaY] = snapToGrid(grid, tmpDeltaX, tmpDeltaY, this.scaleRatio) @@ -1237,7 +1234,6 @@ export default { newH = restrictToBounds(newH, this.miniHeight || 0, this.maxH) // 纵横比 if (this.lockAspectRatio) { - // console.log(this.lockAspectRatio, this.aspectFactor) if (newW / newH > this.aspectFactor) { newW = newH * this.aspectFactor } else { @@ -1245,7 +1241,6 @@ export default { } } this.width = newW - // console.log('width2:' + this.width) this.height = newH // this.$emit('resizing', this.left, this.top, this.width, this.height) @@ -1256,8 +1251,6 @@ export default { this.element.propValue && this.element.propValue.viewId && eventBus.$emit('resizing', this.element.propValue.viewId) }, changeWidth(val) { - // console.log('parentWidth', this.parentWidth) - // console.log('parentHeight', this.parentHeight) // eslint-disable-next-line no-unused-vars const [newWidth, _] = snapToGrid(this.grid, val, 0, this.scale) // const right = restrictToBounds(this.parentWidth - newWidth - this.left, this.bounds.minRight, this.bounds.maxRight) @@ -1272,7 +1265,6 @@ export default { this.right = right this.bottom = bottom this.width = width - // console.log('width3:' + this.width) this.height = height }, changeHeight(val) { @@ -1291,7 +1283,6 @@ export default { this.right = right this.bottom = bottom this.width = width - // console.log('width4:' + this.width) this.height = height }, // 从控制柄松开 @@ -1309,7 +1300,6 @@ export default { this.lastMouseY = mouseY if (this.resizing) { this.resizing = false - // console.log('resizing2:' + this.resizing) this.conflictCheck() this.$emit('refLineParams', refLine) // this.$emit('resizestop', this.left, this.top, this.width, this.height) @@ -1396,7 +1386,6 @@ export default { this.top = this.mouseClickPosition.top this.left = this.mouseClickPosition.left this.width = this.mouseClickPosition.width - // console.log('width5:' + this.width) this.height = this.mouseClickPosition.height } } @@ -1580,7 +1569,6 @@ export default { let groupLeft = 0 let groupTop = 0 for (const item of nodes) { - // console.log('===' + typeof item.tagName) // 修复判断条件 // if (item.className !== undefined && item.className.split(' ').includes(this.classNameActive)) { if (item.tagName !== 'svg' && item.className !== undefined && item.className.split(' ').includes(this.classNameActive)) { @@ -1680,7 +1668,6 @@ export default { style.height = height style.rotate = this.rotate // this.hasMove = true - // console.log('recordMatrixCurShadowStyle:t1:' + JSON.stringify(style)) this.$store.commit('setShapeStyle', style) @@ -1710,7 +1697,6 @@ export default { this.aspectFactor = this.outsideAspectRatio } this.width = this.w !== 'auto' ? this.w : width - // console.log('width1:' + this.width) this.height = this.h !== 'auto' ? this.h : height this.right = this.parentWidth - this.width - this.left this.bottom = this.parentHeight - this.height - this.top diff --git a/frontend/src/components/DeDrag/shadow.vue b/frontend/src/components/DeDrag/shadow.vue index b57a4d3334..9576338050 100644 --- a/frontend/src/components/DeDrag/shadow.vue +++ b/frontend/src/components/DeDrag/shadow.vue @@ -11,16 +11,12 @@ export default { name: 'Shadow', computed: { styleInfo() { - // console.log('styleInfo==>') - // console.log('dragComponentInfo==>' + this.dragComponentInfo.shadowStyle.x) let left = 0 let top = 0 let width = 0 let height = 0 let transition = 0 - // if (this.dragComponentInfo && !this.dragComponentInfo.auxiliaryMatrix) { if (this.dragComponentInfo) { - // console.log('shadowDrag=') // 组件移入 if (this.dragComponentInfo.auxiliaryMatrix) { left = (this.dragComponentInfo.x - 1) * this.curCanvasScale.matrixStyleWidth @@ -36,7 +32,6 @@ export default { height = this.dragComponentInfo.style.height } - // console.log('left:' + left + 'top:' + top + 'width:' + width + 'height:' + height) } else { // temp 临时测试 // left = this.curComponent.style.left * this.curCanvasScale.scaleWidth / 100 @@ -49,12 +44,10 @@ export default { if (this.curComponent.optStatus.dragging) { transition = 0.1 } - // console.log('curComponent left:' + left + 'top:' + top + 'width:' + width + 'height:' + height) } // 防止阴影区超出边界 const xGap = left + width - this.canvasWidth - // console.log('canvasWidth:' + this.canvasWidth + ';xGap:' + xGap) if (xGap > 0) { left = left - xGap } @@ -66,7 +59,6 @@ export default { if (transition > 0) { style.transition = transition + 's' } - // console.log('style=>' + JSON.stringify(style)) // 记录外部拖拽进入仪表板时阴影区域宽高 if (this.dragComponentInfo) { this.recordShadowStyle(left, top, width, height) diff --git a/frontend/src/components/Notification/index.vue b/frontend/src/components/Notification/index.vue index 1d70e611c3..fe85d4c114 100644 --- a/frontend/src/components/Notification/index.vue +++ b/frontend/src/components/Notification/index.vue @@ -107,7 +107,6 @@ export default { }) bus.$on('web-msg-topic-call', msg => { - console.log('收到websocket消息') this.count = (this.count || this.paginationConfig.total) + 1 // this.queryCount() // this.search() diff --git a/frontend/src/components/TinyMCE/index.vue b/frontend/src/components/TinyMCE/index.vue index b6bdd5c158..c0adf563e6 100644 --- a/frontend/src/components/TinyMCE/index.vue +++ b/frontend/src/components/TinyMCE/index.vue @@ -121,7 +121,6 @@ export default { }, mounted() { tinymce.init({}) - // console.log(this.toolbar,'======') }, methods: { onClick(e) { diff --git a/frontend/src/components/canvas/components/AttrList.vue b/frontend/src/components/canvas/components/AttrList.vue index 5f7a7cd829..9bb53a5de2 100644 --- a/frontend/src/components/canvas/components/AttrList.vue +++ b/frontend/src/components/canvas/components/AttrList.vue @@ -108,7 +108,6 @@ export default { }, computed: { styleKeys() { - // console.log(this.$store.state.curComponent.style) return this.$store.state.curComponent ? Object.keys(this.$store.state.curComponent.style) : [] }, curComponent() { diff --git a/frontend/src/components/canvas/components/AttrListExtend.vue b/frontend/src/components/canvas/components/AttrListExtend.vue index 4ec5faa13f..074fad3646 100644 --- a/frontend/src/components/canvas/components/AttrListExtend.vue +++ b/frontend/src/components/canvas/components/AttrListExtend.vue @@ -129,7 +129,6 @@ export default { }, computed: { styleKeys() { - // console.log(this.$store.state.curComponent.style) return this.$store.state.curComponent ? Object.keys(this.$store.state.curComponent.style) : [] }, curComponent() { diff --git a/frontend/src/components/canvas/components/Editor/EditBar.vue b/frontend/src/components/canvas/components/Editor/EditBar.vue index c6ea63b57b..1130294bd3 100644 --- a/frontend/src/components/canvas/components/Editor/EditBar.vue +++ b/frontend/src/components/canvas/components/Editor/EditBar.vue @@ -148,13 +148,6 @@ export default { closePreview() { this.$emit('closePreview') }, - createTimer() { - if (!this.timer) { - this.timer = setInterval(() => { - console.log('t=' + this.curComponent.auxiliaryMatrix) - }, 5000) - } - }, destroyTimer() { if (this.timer) { clearInterval(this.timer) @@ -277,11 +270,9 @@ export default { if (val) { // push this.$store.commit('addCurBatchComponent', this.element.propValue.viewId) - console.log('push') } else { // remove this.$store.commit('removeCurBatchComponentWithId', this.element.propValue.viewId) - console.log('remove') } } } diff --git a/frontend/src/components/canvas/components/Editor/LinkageField.vue b/frontend/src/components/canvas/components/Editor/LinkageField.vue index 675becbf5b..7217837f80 100644 --- a/frontend/src/components/canvas/components/Editor/LinkageField.vue +++ b/frontend/src/components/canvas/components/Editor/LinkageField.vue @@ -108,7 +108,6 @@ export default { mounted() { // 初始化映射关系 如果当前是相同的数据集且没有关联关系,则自动补充映射关系 checkSameDataSet(this.curLinkageView.propValue.viewId, this.element.propValue.viewId).then(res => { - console.log('linkageFields:' + JSON.stringify(this.linkageInfo.linkageFields)) if (res.data === 'YES' && this.linkageInfo.linkageFields.length === 0) { this.sourceLinkageInfo.targetViewFields.forEach(item => { this.addLinkageField(item.id, item.id) diff --git a/frontend/src/components/canvas/components/Editor/PreviewEject.vue b/frontend/src/components/canvas/components/Editor/PreviewEject.vue index 9a35802c9c..b3e79a80c8 100644 --- a/frontend/src/components/canvas/components/Editor/PreviewEject.vue +++ b/frontend/src/components/canvas/components/Editor/PreviewEject.vue @@ -104,7 +104,6 @@ export default { message: this.$t('panel.outer_param_decode_error'), type: 'error' }) - console.log('outerParams Decode error:', e) } } if (tempParam) { @@ -129,7 +128,6 @@ export default { if (--loadingCount === 0) { this.dataLoading = false } - console.log('queryTargetPanelJumpInfo error:', e) } } if (loadingCount === 0) { diff --git a/frontend/src/components/canvas/components/Editor/Shape.vue b/frontend/src/components/canvas/components/Editor/Shape.vue index ffd2f9885b..7bc1fd3ba1 100644 --- a/frontend/src/components/canvas/components/Editor/Shape.vue +++ b/frontend/src/components/canvas/components/Editor/Shape.vue @@ -339,7 +339,6 @@ export default { curPoint, symmetricPoint }) - // console.log('this is test:' + JSON.stringify(this.element.propValue.viewId)) this.$store.commit('setShapeStyle', style) this.element.propValue && this.element.propValue.viewId && eventBus.$emit('resizing', this.element.propValue.viewId) } diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index a10207c549..e1f77f64c2 100644 --- a/frontend/src/components/canvas/components/Editor/index.vue +++ b/frontend/src/components/canvas/components/Editor/index.vue @@ -264,11 +264,9 @@ function debounce(func, time) { function scrollScreen(e) { if (e.clientY + 50 >= window.innerHeight) { - // console.log('scrollScreen+') const body = $(document.body) body.scrollTop(body.scrollTop() + 20) } else if (e.clientY <= 150) { - // console.log('scrollScreen-') const body = $(document.body) body.scrollTop(body.scrollTop() - 20) } @@ -312,7 +310,6 @@ function addItemToPositionBox(item) { } } catch (e) { // igonre - console.log('addItemToPositionBox failed') } } @@ -514,7 +511,6 @@ function removeItem(index) { }) this.yourList.splice(index, 1, {}) } catch (e) { - console.log('removeItem have some ignore error') } } @@ -527,7 +523,6 @@ function initPosition(_this) { } function addItem(item, index) { - // console.log('addItem') if (index < 0) { index = this.yourList.length } @@ -1057,7 +1052,6 @@ export default { if (newVal.length !== this.lastComponentDataLength) { this.lastComponentDataLength = newVal.length this.initMatrix() - // console.log('componentData-initMatrix') } }, deep: true @@ -1300,7 +1294,6 @@ export default { this.baseHeight = this.matrixStyle.height this.cellWidth = this.matrixStyle.width this.cellHeight = this.matrixStyle.height - // console.log('.initMatrix1') this.initMatrix() this.scaleWidth = this.outStyle.width * 100 / this.canvasStyleData.width @@ -1339,7 +1332,6 @@ export default { } if (prop === 'top') { const top = this.format(style['top'], this.scaleHeight) - // console.log('top:' + top) return top } }, @@ -1467,7 +1459,6 @@ export default { infoBox.oldSizeY = item.sizey }, onMouseUp(e) { - // console.log('onMouseUp') const vm = this if (_.isEmpty(vm.infoBox)) return if (vm.infoBox.cloneItem) { @@ -1510,9 +1501,7 @@ export default { newY = newY > 0 ? newY : 1 debounce((function(newX, oldX, newY, oldY, addSizex, addSizey) { return function() { - // console.log('move1') if (newX !== oldX || oldY !== newY) { - // console.log('move2') movePlayer.call(vm, resizeItem, { x: newX, y: newY @@ -1545,9 +1534,7 @@ export default { newY = newY > 0 ? newY : 1 debounce((function(newX, oldX, newY, oldY) { return function() { - // console.log('move1') if (newX !== oldX || oldY !== newY) { - // console.log('move2') movePlayer.call(vm, moveItem, { x: newX, y: newY @@ -1598,8 +1585,6 @@ export default { * @returns */ getMaxCell() { - // console.log('getMaxCell:') - return this.maxCell }, /** @@ -1608,8 +1593,6 @@ export default { * @returns */ getRenderState() { - // console.log('getRenderState:') - return this.moveAnimate }, addItem: addItem, @@ -1624,7 +1607,6 @@ export default { }, 100) }, addItemBox(item) { - // console.log('addItemBox:' + JSON.stringify(item)) this.yourList.push(item) this.$nextTick(function() { @@ -1632,7 +1614,6 @@ export default { }) }, removeLastItem() { - // console.log('rlI:' + JSON.stringify(this.yourList)) if (this.canvasStyleData.auxiliaryMatrix) { this.removeItem(this.yourList.length - 1) } diff --git a/frontend/src/components/canvas/components/FilterTextAttr.vue b/frontend/src/components/canvas/components/FilterTextAttr.vue index d74188b565..4bcbc78d21 100644 --- a/frontend/src/components/canvas/components/FilterTextAttr.vue +++ b/frontend/src/components/canvas/components/FilterTextAttr.vue @@ -139,7 +139,6 @@ export default { } // 防止toolbar超出边界 const xGap = ps + 295 - this.canvasWidth - // console.log('canvasWidth:' + this.canvasWidth + ';xGap:' + xGap) if (xGap > 0) { return ps - xGap } else { diff --git a/frontend/src/components/canvas/components/RectangleAttr.vue b/frontend/src/components/canvas/components/RectangleAttr.vue index 24dc65d033..75d42fe81c 100644 --- a/frontend/src/components/canvas/components/RectangleAttr.vue +++ b/frontend/src/components/canvas/components/RectangleAttr.vue @@ -191,7 +191,6 @@ export default { } // 防止toolbar超出边界 const xGap = ps + 345 - this.canvasWidth - // console.log('canvasWidth:' + this.canvasWidth + ';xGap:' + xGap) if (xGap > 0) { return ps - xGap } else { diff --git a/frontend/src/components/canvas/components/TextAttr.vue b/frontend/src/components/canvas/components/TextAttr.vue index 27268f32f9..cc775d6b4d 100644 --- a/frontend/src/components/canvas/components/TextAttr.vue +++ b/frontend/src/components/canvas/components/TextAttr.vue @@ -394,7 +394,6 @@ export default { this.$nextTick(() => { this.init() }) - // console.log('curComponent change') } } }, @@ -417,14 +416,11 @@ export default { } else { this.mainWidthOffset = document.getElementById('main-attr').offsetWidth - 50 } - // console.log('mainWidthOffset:' + this.mainWidthOffset) }, attrTabShow(attr) { - // console.log('attr:' + attr + this[this.curComponent.type].includes(attr)) return this.curActiveTabInner && this[this.curActiveTabInner.type] && this[this.curActiveTabInner.type].includes(attr) }, attrShow(attr) { - // console.log('attr:' + attr + this[this.curComponent.type].includes(attr)) return this[this.curComponent.type].includes(attr) }, goColor() { diff --git a/frontend/src/components/canvas/custom-component/DeFrame.vue b/frontend/src/components/canvas/custom-component/DeFrame.vue index a6d7e9e7ae..db2dc4ec31 100644 --- a/frontend/src/components/canvas/custom-component/DeFrame.vue +++ b/frontend/src/components/canvas/custom-component/DeFrame.vue @@ -76,10 +76,8 @@ export default { }, methods: { loaded(e) { - console.log('loaded:', e) }, onError(e) { - console.log('onError:', e) } } diff --git a/frontend/src/components/canvas/custom-component/DeVideo.vue b/frontend/src/components/canvas/custom-component/DeVideo.vue index 8dc5788c3d..826bf67038 100644 --- a/frontend/src/components/canvas/custom-component/DeVideo.vue +++ b/frontend/src/components/canvas/custom-component/DeVideo.vue @@ -109,40 +109,29 @@ export default { }, // listen event onPlayerPlay(player) { - // console.log('player play!', player) }, onPlayerEnded(player) { - // console.log('player ended!', player) }, onPlayerLoadeddata(player) { - // console.log('player Loadeddata!', player) }, onPlayerWaiting(player) { - // console.log('player Waiting!', player) }, onPlayerPlaying(player) { - // console.log('player Playing!', player) }, onPlayerTimeupdate(player) { - // console.log('player Timeupdate!', player.currentTime()) }, onPlayerCanplay(player) { - // console.log('player Canplay!', player) }, onPlayerCanplaythrough(player) { - // console.log('player Ca - // console.log('example 01nplaythrough!', player) }, // or listen state event playerStateChanged(playerCurrentState) { - // console.log('player current update state', playerCurrentState) }, // player is ready playerReadied(player) { // seek to 10s - // console.log('example player 1 readied', player) // player.currentTime(10): the player is readied', player) } } diff --git a/frontend/src/components/dataease/DeOutWidget.vue b/frontend/src/components/dataease/DeOutWidget.vue index aefbd1878b..72b5811aaa 100644 --- a/frontend/src/components/dataease/DeOutWidget.vue +++ b/frontend/src/components/dataease/DeOutWidget.vue @@ -112,7 +112,6 @@ export default { this.watchSize() }, created() { - // console.log('aaaaaa') }, methods: { diff --git a/frontend/src/components/widget/DeWidget/DeShowDate.vue b/frontend/src/components/widget/DeWidget/DeShowDate.vue index 6b95c13419..d888839518 100644 --- a/frontend/src/components/widget/DeWidget/DeShowDate.vue +++ b/frontend/src/components/widget/DeWidget/DeShowDate.vue @@ -37,7 +37,6 @@ export default { methods: { chartResize() { - // console.log('11111') this.$nextTick(() => { this.$refs[this.element.id] && this.$refs[this.element.id].resize && this.$refs[this.element.id].resize() }) diff --git a/frontend/src/components/widget/DeWidget/DeTabs.vue b/frontend/src/components/widget/DeWidget/DeTabs.vue index 40a6eaf09b..adb913984c 100644 --- a/frontend/src/components/widget/DeWidget/DeTabs.vue +++ b/frontend/src/components/widget/DeWidget/DeTabs.vue @@ -378,7 +378,6 @@ export default { }, setComponentInfo() { - console.log('aaa') }, editCurTitle(param) { diff --git a/frontend/src/views/background/index.vue b/frontend/src/views/background/index.vue index 9a6a14a525..251f187ba5 100644 --- a/frontend/src/views/background/index.vue +++ b/frontend/src/views/background/index.vue @@ -192,7 +192,6 @@ export default { uploadFileResult(file, (fileUrl) => { _this.curComponent.commonBackground.outerImage = fileUrl }) - // console.log('this is upload') } } diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 77663c2e78..2feeea8d9f 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -223,7 +223,6 @@ export default { } else if (chart.type === 'chart-mix') { chart_option = baseMixOption(JSON.parse(JSON.stringify(BASE_MIX)), chart) } - // console.log(JSON.stringify(chart_option)) if (this.myChart && this.searchCount > 0) { chart_option.animation = false } diff --git a/frontend/src/views/chart/components/ChartComponentG2.vue b/frontend/src/views/chart/components/ChartComponentG2.vue index d4a1d07092..3cbf812a97 100644 --- a/frontend/src/views/chart/components/ChartComponentG2.vue +++ b/frontend/src/views/chart/components/ChartComponentG2.vue @@ -191,7 +191,6 @@ export default { }, antVAction(param) { - console.log(param) if (this.chart.type === 'treemap') { this.pointParam = param.data.data } else { diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue index 47b07eb64a..eb193fc74d 100644 --- a/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -213,10 +213,8 @@ export default { }, antVAction(param) { - console.log(param, 'param') const cell = this.myChart.getCell(param.target) const meta = cell.getMeta() - console.log(meta, 'meta') let xAxis = [] if (this.chart.xaxis) { @@ -251,7 +249,6 @@ export default { dimensionList: dimensionList } } - console.log(this.pointParam, 'pointParam') if (this.trackMenu.length < 2) { // 只有一个事件直接调用 this.trackClick(this.trackMenu[0]) diff --git a/frontend/src/views/chart/components/drag-item/ChartDragItem.vue b/frontend/src/views/chart/components/drag-item/ChartDragItem.vue index 258e672eee..6bc0e5d6d1 100644 --- a/frontend/src/views/chart/components/drag-item/ChartDragItem.vue +++ b/frontend/src/views/chart/components/drag-item/ChartDragItem.vue @@ -177,7 +177,6 @@ export default { } }, sort(param) { - // console.log(param) this.item.sort = param.type this.$emit('onItemChange', this.item) }, @@ -187,7 +186,6 @@ export default { } }, summary(param) { - // console.log(param) this.item.summary = param.type this.$emit('onItemChange', this.item) }, @@ -202,7 +200,6 @@ export default { }, dateStyle(param) { - // console.log(param) this.item.dateStyle = param.type this.$emit('onItemChange', this.item) }, @@ -212,7 +209,6 @@ export default { } }, datePattern(param) { - // console.log(param) this.item.datePattern = param.type this.$emit('onItemChange', this.item) }, diff --git a/frontend/src/views/chart/components/drag-item/DimensionExtItem.vue b/frontend/src/views/chart/components/drag-item/DimensionExtItem.vue index 16c51b2fb1..22a3f50ce2 100644 --- a/frontend/src/views/chart/components/drag-item/DimensionExtItem.vue +++ b/frontend/src/views/chart/components/drag-item/DimensionExtItem.vue @@ -157,7 +157,6 @@ export default { } }, sort(param) { - // console.log(param) this.item.sort = param.type this.$emit('onDimensionItemChange', this.item) }, @@ -167,7 +166,6 @@ export default { } }, dateStyle(param) { - // console.log(param) this.item.dateStyle = param.type this.$emit('onDimensionItemChange', this.item) }, diff --git a/frontend/src/views/chart/components/drag-item/DimensionItem.vue b/frontend/src/views/chart/components/drag-item/DimensionItem.vue index d6946b284a..8e8ff4a595 100644 --- a/frontend/src/views/chart/components/drag-item/DimensionItem.vue +++ b/frontend/src/views/chart/components/drag-item/DimensionItem.vue @@ -181,7 +181,6 @@ export default { } }, sort(param) { - // console.log(param) if (param.type === 'custom_sort') { const item = { index: this.index, @@ -201,7 +200,6 @@ export default { } }, dateStyle(param) { - // console.log(param) this.item.dateStyle = param.type this.$emit('onDimensionItemChange', this.item) }, @@ -211,7 +209,6 @@ export default { } }, datePattern(param) { - // console.log(param) this.item.datePattern = param.type this.$emit('onDimensionItemChange', this.item) }, diff --git a/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue b/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue index 7dc42f8ffd..de8da14ce3 100644 --- a/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue +++ b/frontend/src/views/chart/components/drag-item/QuotaExtItem.vue @@ -232,7 +232,6 @@ export default { }, summary(param) { - // console.log(param) this.item.summary = param.type this.$emit('onQuotaItemChange', this.item) }, @@ -243,7 +242,6 @@ export default { }, switchChartType(param) { - // console.log(param) this.item.chartType = param.type this.$emit('onQuotaItemChange', this.item) }, @@ -273,7 +271,6 @@ export default { }, sort(param) { - // console.log(param) this.item.sort = param.type this.$emit('onQuotaItemChange', this.item) }, diff --git a/frontend/src/views/chart/components/drag-item/QuotaItem.vue b/frontend/src/views/chart/components/drag-item/QuotaItem.vue index d745e66ab3..2a71a4e59f 100644 --- a/frontend/src/views/chart/components/drag-item/QuotaItem.vue +++ b/frontend/src/views/chart/components/drag-item/QuotaItem.vue @@ -228,7 +228,6 @@ export default { }, summary(param) { - // console.log(param) this.item.summary = param.type this.$emit('onQuotaItemChange', this.item) }, @@ -239,7 +238,6 @@ export default { }, switchChartType(param) { - // console.log(param) this.item.chartType = param.type this.$emit('onQuotaItemChange', this.item) }, @@ -269,7 +267,6 @@ export default { }, sort(param) { - // console.log(param) this.item.sort = param.type this.$emit('onQuotaItemChange', this.item) }, diff --git a/frontend/src/views/chart/components/normal/LabelNormalText.vue b/frontend/src/views/chart/components/normal/LabelNormalText.vue index fc92ec8989..b60dc5ac2e 100644 --- a/frontend/src/views/chart/components/normal/LabelNormalText.vue +++ b/frontend/src/views/chart/components/normal/LabelNormalText.vue @@ -235,7 +235,6 @@ export default { value: 0 } } - console.log(this.pointParam) this.$refs['textData'].offsetTop if (this.trackMenu.length < 2) { // 只有一个事件直接调用 this.trackClick(this.trackMenu[0]) diff --git a/frontend/src/views/chart/components/table/TableNormal.vue b/frontend/src/views/chart/components/table/TableNormal.vue index 509628dadc..2bd64d0d20 100644 --- a/frontend/src/views/chart/components/table/TableNormal.vue +++ b/frontend/src/views/chart/components/table/TableNormal.vue @@ -280,12 +280,10 @@ export default { 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) } diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 2713d54e8e..949b487f36 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1203,7 +1203,6 @@ export default { if (val && this.param.id !== this.preChartId) { this.preChartId = this.param.id this.chartInit() - // console.log('fromwatch:' + JSON.stringify(val)) } }, 'param': function(val) { @@ -1212,7 +1211,6 @@ export default { } else if (this.param.id !== this.preChartId && this.editStatue) { this.preChartId = this.param.id this.chartInit() - // console.log('fromwatch:' + JSON.stringify(val)) } }, searchField(val) { @@ -1247,7 +1245,6 @@ export default { this.bindPluginEvent() this.initFromPanel() this.chartInit() - // console.log('mounted') }, activated() { }, @@ -1261,7 +1258,6 @@ export default { this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions] }, emptyTableData(id) { - console.log('emptyTableData:' + id) this.table = {} this.dimension = [] this.quota = [] @@ -1570,7 +1566,6 @@ export default { // 将视图传入echart组件 // this.chart = response.data // this.data = response.data.data - // // console.log(JSON.stringify(this.chart)) // this.httpRequest.status = true // if (this.chart.privileges) { // this.param.privileges = this.chart.privileges @@ -1677,7 +1672,6 @@ export default { // 将视图传入echart组件 this.chart = response.data this.data = response.data.data - // console.log(JSON.stringify(this.chart)) this.httpRequest.status = true if (this.chart.privileges) { this.param.privileges = this.chart.privileges @@ -1742,7 +1736,6 @@ export default { // move回调方法 onMove(e, originalEvent) { - // console.log(e) this.moveId = e.draggedContext.element.id return true }, diff --git a/frontend/src/views/dataset/add/AddCustom.vue b/frontend/src/views/dataset/add/AddCustom.vue index e5d13885fc..126f35dfab 100644 --- a/frontend/src/views/dataset/add/AddCustom.vue +++ b/frontend/src/views/dataset/add/AddCustom.vue @@ -94,7 +94,6 @@ export default { } }, 'checkedList': function() { - // console.log(this.checkedList) this.getUnionData() } }, @@ -119,11 +118,9 @@ export default { }, getTable(table) { - // console.log(table) this.table = table }, getChecked(tableCheckedField) { - // console.log(tableCheckedField) if (tableCheckedField.checkedFields && tableCheckedField.checkedFields.length > 0) { if (!this.checkedList.some(ele => ele.tableId === tableCheckedField.tableId)) { this.checkedList.push(tableCheckedField) @@ -146,7 +143,6 @@ export default { this.checkedList.splice(index, 1) } } - // console.log(this.checkedList) this.getData() }, getData() { @@ -162,7 +158,6 @@ export default { info: '{"list":' + JSON.stringify(this.checkedList) + '}' } post('/dataset/table/customPreview', table).then(response => { - // console.log(response) this.fields = response.data.fields this.data = response.data.data const datas = this.data @@ -179,7 +174,6 @@ export default { if (this.checkedList && this.checkedList.length > 0) { // 根据第一个选择的数据集找到关联视图 post('dataset/union/listByTableId/' + this.checkedList[0].tableId, {}).then(response => { - // console.log(response) this.unionData = response.data }) } else { diff --git a/frontend/src/views/dataset/add/AddSQL.vue b/frontend/src/views/dataset/add/AddSQL.vue index 6b1fc0b61b..b52b880061 100644 --- a/frontend/src/views/dataset/add/AddSQL.vue +++ b/frontend/src/views/dataset/add/AddSQL.vue @@ -321,10 +321,8 @@ export default { this.codemirror.setSize('-webkit-fill-available', 'auto') }, onCmFocus(cm) { - // console.log('the editor is focus!', cm) }, onCmCodeChange(newCode) { - // console.log(newCode) this.sql = newCode this.$emit('codeChange', this.sql) }, diff --git a/frontend/src/views/dataset/common/DatasetGroupSelector.vue b/frontend/src/views/dataset/common/DatasetGroupSelector.vue index bd90c13c70..619644f99b 100644 --- a/frontend/src/views/dataset/common/DatasetGroupSelector.vue +++ b/frontend/src/views/dataset/common/DatasetGroupSelector.vue @@ -306,7 +306,6 @@ export default { // this.expandedArray.splice(index, 1) // } // } - // console.log(this.expandedArray); }, back() { diff --git a/frontend/src/views/dataset/data/CalcFieldEdit.vue b/frontend/src/views/dataset/data/CalcFieldEdit.vue index c4f3e682b8..5bf010c200 100644 --- a/frontend/src/views/dataset/data/CalcFieldEdit.vue +++ b/frontend/src/views/dataset/data/CalcFieldEdit.vue @@ -301,10 +301,8 @@ export default { this.codemirror.setSize('-webkit-fill-available', 'auto') }, onCmFocus(cm) { - // console.log('the editor is focus!', cm) }, onCmCodeChange(newCode) { - // console.log(newCode) this.fieldForm.originName = newCode }, insertParamToCodeMirror(param) { diff --git a/frontend/src/views/dataset/data/FieldEdit.vue b/frontend/src/views/dataset/data/FieldEdit.vue index 4358303629..7b6703dcd8 100644 --- a/frontend/src/views/dataset/data/FieldEdit.vue +++ b/frontend/src/views/dataset/data/FieldEdit.vue @@ -334,7 +334,6 @@ export default { }) }, saveEdit(item) { - // console.log(this.tableFields) // const list = this.tableFields.dimensionListData.concat(this.tableFields.quotaListData) // batchEdit(list).then(response => { // // this.closeEdit() diff --git a/frontend/src/views/dataset/data/TabDataPreview.vue b/frontend/src/views/dataset/data/TabDataPreview.vue index cb2ff98435..3b4a425c35 100644 --- a/frontend/src/views/dataset/data/TabDataPreview.vue +++ b/frontend/src/views/dataset/data/TabDataPreview.vue @@ -160,7 +160,6 @@ export default { }, pageChange(val) { this.currentPage.page = val - // console.log(this.currentPage) this.$emit('reSearch', { form: this.form, page: this.currentPage }) } } diff --git a/frontend/src/views/dataset/data/UnionView.vue b/frontend/src/views/dataset/data/UnionView.vue index 6c03a63d07..43c0925c05 100644 --- a/frontend/src/views/dataset/data/UnionView.vue +++ b/frontend/src/views/dataset/data/UnionView.vue @@ -210,7 +210,6 @@ export default { this.customType = ['db', 'sql', 'excel', 'api'] } post('dataset/union/listByTableId/' + this.table.id, {}).then(response => { - // console.log(response) this.unionData = response.data }) } @@ -235,7 +234,6 @@ export default { // }) }, saveUnion() { - // console.log(this.union) if (!this.union.sourceTableFieldId || !this.union.sourceUnionRelation || !this.union.targetTableId || !this.union.targetTableFieldId) { this.$message({ type: 'error', @@ -298,7 +296,6 @@ export default { }) }, getTable(param) { - // console.log(param) if (param.id === this.table.id) { this.$message({ type: 'error', diff --git a/frontend/src/views/dataset/data/UpdateInfo.vue b/frontend/src/views/dataset/data/UpdateInfo.vue index 1997a48757..9ed39d709e 100644 --- a/frontend/src/views/dataset/data/UpdateInfo.vue +++ b/frontend/src/views/dataset/data/UpdateInfo.vue @@ -739,10 +739,8 @@ export default { this.codemirror.setSize('-webkit-fill-available', 'auto') }, onCmFocus(cm) { - // console.log('the editor is focus!', cm) }, onCmCodeChange(newCode) { - // console.log(newCode) this.sql = newCode this.$emit('codeChange', this.sql) }, diff --git a/frontend/src/views/dataset/data/ViewTable.vue b/frontend/src/views/dataset/data/ViewTable.vue index 46f82ab45e..b3961bee31 100644 --- a/frontend/src/views/dataset/data/ViewTable.vue +++ b/frontend/src/views/dataset/data/ViewTable.vue @@ -214,7 +214,6 @@ export default { }, clickEditExcel(param) { - // console.log(param); switch (param.type) { case '0': this.$emit('switchComponent', { diff --git a/frontend/src/views/dataset/data/authConfig.vue b/frontend/src/views/dataset/data/authConfig.vue index 8324e167d8..87b45d61be 100644 --- a/frontend/src/views/dataset/data/authConfig.vue +++ b/frontend/src/views/dataset/data/authConfig.vue @@ -177,11 +177,9 @@ export default { this.$emit('close-grant', 0) }, authNodeClick (val) { - console.log('authNodeClick') this.authCondition = val }, clickAuth (auth) { - console.log('clickAuth') } } } diff --git a/frontend/src/views/msg/setting.vue b/frontend/src/views/msg/setting.vue index c396ae3899..751b1d0339 100644 --- a/frontend/src/views/msg/setting.vue +++ b/frontend/src/views/msg/setting.vue @@ -162,7 +162,6 @@ export default { }) }, nodeClick(data, node) { - // console.log(data) }, getAllKidId(node, ids) { if (node.children && node.children.length > 0) { @@ -190,7 +189,6 @@ export default { channelId: channelId, enable } - // console.log(param) batchUpdate(param).then(res => { this.loadSettingData() }) diff --git a/frontend/src/views/panel/GrantAuth/shareTree.vue b/frontend/src/views/panel/GrantAuth/shareTree.vue index de3dca3c45..22803b1274 100644 --- a/frontend/src/views/panel/GrantAuth/shareTree.vue +++ b/frontend/src/views/panel/GrantAuth/shareTree.vue @@ -130,7 +130,6 @@ export default { return data }, expandMsgNode(panelIds) { - // console.log(panelIds) this.$nextTick(() => { this.getMsgNodes(panelIds) }) diff --git a/frontend/src/views/panel/LinkJumpSet/index.vue b/frontend/src/views/panel/LinkJumpSet/index.vue index ce6a123371..b63ca719a9 100644 --- a/frontend/src/views/panel/LinkJumpSet/index.vue +++ b/frontend/src/views/panel/LinkJumpSet/index.vue @@ -317,7 +317,6 @@ export default { }) }, panelNodeClick(data, node) { - // console.log('panelNodeClick:' + JSON.stringify(data)) this.linkJumpInfo.targetViewInfoList = [] this.getPanelViewList(data.id) }, diff --git a/frontend/src/views/panel/OuterParamsSet/index.vue b/frontend/src/views/panel/OuterParamsSet/index.vue index 7906349cbd..d7e4360a7d 100644 --- a/frontend/src/views/panel/OuterParamsSet/index.vue +++ b/frontend/src/views/panel/OuterParamsSet/index.vue @@ -292,7 +292,6 @@ export default { }) }, panelNodeClick(data, node) { - // console.log('panelNodeClick:' + JSON.stringify(data)) this.outerParamsInfo.targetViewInfoList = [] this.getPanelViewList(data.id) }, diff --git a/frontend/src/views/panel/SubjectSetting/PreSubject/Slider.vue b/frontend/src/views/panel/SubjectSetting/PreSubject/Slider.vue index 4f7c4b209e..926b89e26b 100644 --- a/frontend/src/views/panel/SubjectSetting/PreSubject/Slider.vue +++ b/frontend/src/views/panel/SubjectSetting/PreSubject/Slider.vue @@ -169,7 +169,6 @@ export default { }) }, move(offset, direction, speed) { - // console.log(speed) if (!this.transitionEnd) return this.transitionEnd = false direction === -1 ? this.currentIndex += offset / this.sliderWidth : this.currentIndex -= offset / this.sliderWidth diff --git a/frontend/src/views/panel/SubjectSetting/PreSubject/SubjectTemplateItem.vue b/frontend/src/views/panel/SubjectSetting/PreSubject/SubjectTemplateItem.vue index b70b739fa4..16b5dd6242 100644 --- a/frontend/src/views/panel/SubjectSetting/PreSubject/SubjectTemplateItem.vue +++ b/frontend/src/views/panel/SubjectSetting/PreSubject/SubjectTemplateItem.vue @@ -205,7 +205,6 @@ export default { this.$emit('templateEdit', this.template) }, handleDelete() { - // console.log('handleDelete') }, // 双击事件 setEdit() { diff --git a/frontend/src/views/panel/SubjectSetting/PreSubject/SubjectTemplateItemback.vue b/frontend/src/views/panel/SubjectSetting/PreSubject/SubjectTemplateItemback.vue index 2310a7163c..1d19d432b5 100644 --- a/frontend/src/views/panel/SubjectSetting/PreSubject/SubjectTemplateItemback.vue +++ b/frontend/src/views/panel/SubjectSetting/PreSubject/SubjectTemplateItemback.vue @@ -168,7 +168,6 @@ export default { this.$emit('templateEdit', this.template) }, handleDelete() { - // console.log('handleDelete') } } } diff --git a/frontend/src/views/panel/ViewSelect/index.vue b/frontend/src/views/panel/ViewSelect/index.vue index 6f21f7a42c..7439932e15 100644 --- a/frontend/src/views/panel/ViewSelect/index.vue +++ b/frontend/src/views/panel/ViewSelect/index.vue @@ -154,7 +154,6 @@ export default { eventBus.$emit('startMoveIn') }, dragEnd() { - // console.log('dragEnd') this.$store.commit('clearDragComponentInfo') }, // 判断节点能否被拖拽 diff --git a/frontend/src/views/panel/edit/index.vue b/frontend/src/views/panel/edit/index.vue index e2b69618ee..e2583c785c 100644 --- a/frontend/src/views/panel/edit/index.vue +++ b/frontend/src/views/panel/edit/index.vue @@ -1060,7 +1060,6 @@ export default { recordStyleChange(index) { if (index === this.$store.state.styleChangeTimes) { this.timeMachine = setTimeout(() => { - // console.log('recordSnapshot') this.$store.commit('recordSnapshot') this.$store.state.styleChangeTimes = 0 this.destroyTimeMachine() diff --git a/frontend/src/views/panel/filter/index.vue b/frontend/src/views/panel/filter/index.vue index 14892914cc..756014ede5 100644 --- a/frontend/src/views/panel/filter/index.vue +++ b/frontend/src/views/panel/filter/index.vue @@ -84,7 +84,6 @@ export default { return result }) } - // console.log('this.widgetSubjects=>' + JSON.stringify(this.widgetSubjects)) }, methods: { diff --git a/frontend/src/views/panel/index.vue b/frontend/src/views/panel/index.vue index 66e5d03304..1fe7a86c66 100644 --- a/frontend/src/views/panel/index.vue +++ b/frontend/src/views/panel/index.vue @@ -42,7 +42,6 @@ export default { }, watch: { // $route(to, from) { - // console.log('route change') // } }, mounted() { diff --git a/frontend/src/views/panel/list/PanelList.vue b/frontend/src/views/panel/list/PanelList.vue index 37e09bc0c1..8cd30c278a 100644 --- a/frontend/src/views/panel/list/PanelList.vue +++ b/frontend/src/views/panel/list/PanelList.vue @@ -760,7 +760,6 @@ export default { children: res.data } ] - // console.log('tGroupData=>' + JSON.stringify(_this.tGroupData)) } else { _this.tGroupData = res.data } diff --git a/frontend/src/views/panel/template/component/TemplateItem.vue b/frontend/src/views/panel/template/component/TemplateItem.vue index 7456371821..3a37bc7f13 100644 --- a/frontend/src/views/panel/template/component/TemplateItem.vue +++ b/frontend/src/views/panel/template/component/TemplateItem.vue @@ -50,7 +50,6 @@ export default { this.$emit('templateEdit', this.template) }, handleDelete() { - // console.log('handleDelete') } } } diff --git a/frontend/src/views/system/SysParam/index.vue b/frontend/src/views/system/SysParam/index.vue index e03de79504..759bbe6cba 100644 --- a/frontend/src/views/system/SysParam/index.vue +++ b/frontend/src/views/system/SysParam/index.vue @@ -71,7 +71,6 @@ export default { }, methods: { handleClick(tab, event) { - // console.log(tab, event) } } } diff --git a/frontend/src/views/system/about/index.vue b/frontend/src/views/system/about/index.vue index 076b8e199d..6bdf838a1c 100644 --- a/frontend/src/views/system/about/index.vue +++ b/frontend/src/views/system/about/index.vue @@ -104,7 +104,6 @@ export default { getLicenseInfo() { // validate({}).then(res => { // this.license = this.getLicense(res.data) - // console.log(this.license) // }) this.validateHandler({}, res => { this.license = this.getLicense(res.data) @@ -150,7 +149,6 @@ export default { window.open(url, '_blank') }, beforeUpload(file) { - // console.log(file) this.importLic(file) return false } diff --git a/frontend/src/views/system/authority/authConfig.vue b/frontend/src/views/system/authority/authConfig.vue index 4aae4cd2f4..a9ef04b3d0 100644 --- a/frontend/src/views/system/authority/authConfig.vue +++ b/frontend/src/views/system/authority/authConfig.vue @@ -172,11 +172,9 @@ export default { this.$emit('close-grant', 0) }, authNodeClick(val) { - // console.log('authNodeClick') this.authCondition = val }, clickAuth(auth) { - // console.log('clickAuth') } } } diff --git a/frontend/src/views/system/authority/authQuickConfig.vue b/frontend/src/views/system/authority/authQuickConfig.vue index 65c884e07d..7207d45f6a 100644 --- a/frontend/src/views/system/authority/authQuickConfig.vue +++ b/frontend/src/views/system/authority/authQuickConfig.vue @@ -148,11 +148,9 @@ export default { this.$emit('close-grant', 0) }, authNodeClick(val) { - // console.log('authNodeClick') this.authCondition = val }, clickAuth(auth) { - // console.log('clickAuth') } } } diff --git a/frontend/src/views/system/authority/index.vue b/frontend/src/views/system/authority/index.vue index 8c83503960..db488194e1 100644 --- a/frontend/src/views/system/authority/index.vue +++ b/frontend/src/views/system/authority/index.vue @@ -33,7 +33,6 @@ export default { }, methods: { handleClick() { - // console.log('===>handleClick') } } diff --git a/frontend/src/views/system/plugin/dynamic.vue b/frontend/src/views/system/plugin/dynamic.vue index d75169ab9a..eefb31c3ba 100644 --- a/frontend/src/views/system/plugin/dynamic.vue +++ b/frontend/src/views/system/plugin/dynamic.vue @@ -53,7 +53,6 @@ export default { created() { if (this.jsname && this.menuid) { this.showAsync = true - // console.log(this.jsname) this.url = this.baseUrl + this.menuid // this.url = 'http://localhost:8081/PluginDemo.js' // this.url = 'http://localhost:8081/SystemParam.js' @@ -89,8 +88,6 @@ export default { this.backName = backName }, pluginCallBack(param) { - // console.log(param) - const { eventName, eventParam } = param bus.$emit(eventName, eventParam) } diff --git a/frontend/src/views/system/user/form.vue b/frontend/src/views/system/user/form.vue index 1e0ce86ff5..b3d5fcfe98 100644 --- a/frontend/src/views/system/user/form.vue +++ b/frontend/src/views/system/user/form.vue @@ -227,7 +227,6 @@ export default { this.depts = null this.formType = 'add' this.form = Object.assign({}, this.defaultForm) - // console.log(this.form) }, edit(row) { this.depts = null diff --git a/mobile/src/App.vue b/mobile/src/App.vue index f0c4540fd7..edaa30db86 100644 --- a/mobile/src/App.vue +++ b/mobile/src/App.vue @@ -1,17 +1,14 @@ From aae5c707ac97e05e86b6430520c95f9c6c5e083a Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 17 May 2022 13:18:25 +0800 Subject: [PATCH 03/18] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E8=BE=85?= =?UTF-8?q?=E5=8A=A9=E6=96=B9=E6=A0=BC=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/components/Editor/Grid.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/canvas/components/Editor/Grid.vue b/frontend/src/components/canvas/components/Editor/Grid.vue index 05d412fc56..b79ce1388d 100644 --- a/frontend/src/components/canvas/components/Editor/Grid.vue +++ b/frontend/src/components/canvas/components/Editor/Grid.vue @@ -5,7 +5,7 @@ @@ -14,7 +14,7 @@ @@ -23,8 +23,8 @@ From aee2fd9bcf046675f7006e810aad37f2cb47a57c Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 17 May 2022 14:42:03 +0800 Subject: [PATCH 04/18] =?UTF-8?q?refactor:=20=E6=A8=A1=E7=89=88=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E4=BC=98=E5=8C=96,=E7=B3=BB=E7=BB=9F=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E7=9A=84=E7=AE=A1=E7=90=86=E9=9C=80=E8=A6=81=E6=8E=88?= =?UTF-8?q?=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/db/migration/V35__1.11.sql | 3 +++ frontend/src/views/panel/template/index.vue | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/backend/src/main/resources/db/migration/V35__1.11.sql b/backend/src/main/resources/db/migration/V35__1.11.sql index 8be983b423..85007121f6 100644 --- a/backend/src/main/resources/db/migration/V35__1.11.sql +++ b/backend/src/main/resources/db/migration/V35__1.11.sql @@ -1,2 +1,5 @@ ALTER TABLE `panel_group` ADD COLUMN `status` varchar(255) NULL DEFAULT 'publish' COMMENT '1.publish--发布 2.unpublished--未发布' AFTER `mobile_layout`; + +UPDATE `sys_menu` SET `sub_count` = 1 WHERE `menu_id` = 40; +INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (401, 40, 0, 2, '查看系统模板', NULL, NULL, 999, NULL, NULL, 0, 0, 0, 'sys-template:read', NULL, NULL, 1614930862373, 1614930862373); diff --git a/frontend/src/views/panel/template/index.vue b/frontend/src/views/panel/template/index.vue index f5fc445c8c..d40258a2d5 100644 --- a/frontend/src/views/panel/template/index.vue +++ b/frontend/src/views/panel/template/index.vue @@ -2,10 +2,11 @@ - - {{ $t('panel.sys_template') }} + + {{ $t('panel.user_template') }} + - - {{ $t('panel.user_template') }} - + + {{ $t('panel.sys_template') }} Date: Wed, 18 May 2022 18:12:10 +0800 Subject: [PATCH 05/18] =?UTF-8?q?feat:=20=E6=93=8D=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/auth/annotation/DeLog.java | 34 +++++ .../auth/aop/DeCleanerAnnotationHandler.java | 46 +----- .../auth/aop/DeLogAnnotationHandler.java | 143 ++++++++++++++++++ .../commons/constants/SysLogConstants.java | 72 +++++++++ .../io/dataease/commons/utils/AopUtils.java | 52 +++++++ .../datasource/DatasourceController.java | 27 +++- .../datasource/request/DeleteDsRequest.java | 16 ++ .../controller/sys/SysLogController.java | 57 +++++++ .../controller/sys/SysUserController.java | 21 +++ .../main/java/io/dataease/dto/SysLogDTO.java | 24 +++ .../java/io/dataease/dto/SysLogGridDTO.java | 25 +++ .../java/io/dataease/dto/log/FolderItem.java | 16 ++ .../java/io/dataease/ext/ExtSysLogMapper.java | 15 ++ .../java/io/dataease/ext/ExtSysLogMapper.xml | 118 +++++++++++++++ .../dataease/plugins/server/XDeptServer.java | 20 +++ .../dataease/plugins/server/XRoleServer.java | 16 ++ .../dataease/service/sys/SysUserService.java | 1 + .../dataease/service/sys/log/LogManager.java | 133 ++++++++++++++++ .../dataease/service/sys/log/LogService.java | 113 ++++++++++++++ .../resources/i18n/messages_en_US.properties | 20 +++ .../resources/i18n/messages_zh_CN.properties | 23 +++ .../resources/i18n/messages_zh_TW.properties | 19 +++ frontend/package.json | 2 +- frontend/src/api/system/datasource.js | 9 +- frontend/src/api/system/log.js | 26 ++++ frontend/src/lang/zh.js | 9 ++ frontend/src/styles/index.scss | 3 + .../src/views/system/datasource/DsTree.vue | 60 +++++--- frontend/src/views/system/log/index.vue | 137 +++++++++++++++++ 29 files changed, 1181 insertions(+), 76 deletions(-) create mode 100644 backend/src/main/java/io/dataease/auth/annotation/DeLog.java create mode 100644 backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java create mode 100644 backend/src/main/java/io/dataease/commons/constants/SysLogConstants.java create mode 100644 backend/src/main/java/io/dataease/commons/utils/AopUtils.java create mode 100644 backend/src/main/java/io/dataease/controller/datasource/request/DeleteDsRequest.java create mode 100644 backend/src/main/java/io/dataease/controller/sys/SysLogController.java create mode 100644 backend/src/main/java/io/dataease/dto/SysLogDTO.java create mode 100644 backend/src/main/java/io/dataease/dto/SysLogGridDTO.java create mode 100644 backend/src/main/java/io/dataease/dto/log/FolderItem.java create mode 100644 backend/src/main/java/io/dataease/ext/ExtSysLogMapper.java create mode 100644 backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml create mode 100644 backend/src/main/java/io/dataease/service/sys/log/LogManager.java create mode 100644 backend/src/main/java/io/dataease/service/sys/log/LogService.java create mode 100644 frontend/src/api/system/log.js create mode 100644 frontend/src/views/system/log/index.vue diff --git a/backend/src/main/java/io/dataease/auth/annotation/DeLog.java b/backend/src/main/java/io/dataease/auth/annotation/DeLog.java new file mode 100644 index 0000000000..428b32a1c7 --- /dev/null +++ b/backend/src/main/java/io/dataease/auth/annotation/DeLog.java @@ -0,0 +1,34 @@ +package io.dataease.auth.annotation; + +import io.dataease.commons.constants.SysLogConstants.OPERATE_TYPE; +import io.dataease.commons.constants.SysLogConstants.SOURCE_TYPE; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface DeLog { + + OPERATE_TYPE operatetype(); + + + SOURCE_TYPE sourcetype(); + + + int positionIndex() default -1; + String positionKey() default ""; + + + int sourceIndex() default 0; + String sourceKey() default ""; + + int targetIndex() default -1; + String targetKey() default ""; + SOURCE_TYPE targetType() default SOURCE_TYPE.USER; + + String value() default ""; + +} diff --git a/backend/src/main/java/io/dataease/auth/aop/DeCleanerAnnotationHandler.java b/backend/src/main/java/io/dataease/auth/aop/DeCleanerAnnotationHandler.java index ea13f93158..3584de725a 100644 --- a/backend/src/main/java/io/dataease/auth/aop/DeCleanerAnnotationHandler.java +++ b/backend/src/main/java/io/dataease/auth/aop/DeCleanerAnnotationHandler.java @@ -2,10 +2,10 @@ package io.dataease.auth.aop; import io.dataease.auth.annotation.DeCleaner; import io.dataease.auth.api.dto.CurrentUserDto; -import io.dataease.auth.util.ReflectUtil; import io.dataease.commons.constants.AuthConstants; import io.dataease.commons.constants.DePermissionType; import io.dataease.commons.model.AuthURD; +import io.dataease.commons.utils.AopUtils; import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.LogUtil; import io.dataease.listener.util.CacheUtils; @@ -19,11 +19,8 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; -import java.lang.reflect.Array; import java.lang.reflect.Method; -import java.util.Collection; import java.util.List; -import java.util.Map; import java.util.Optional; @Aspect @@ -43,7 +40,7 @@ public class DeCleanerAnnotationHandler { if (ObjectUtils.isNotEmpty(key) && ArrayUtils.isNotEmpty(args)) { int pi = deCleaner.paramIndex(); Object arg = point.getArgs()[pi]; - paramValue = getParamValue(arg, key, 0); + paramValue = AopUtils.getParamValue(arg, key, 0); } switch (type.name()) { @@ -136,44 +133,5 @@ public class DeCleanerAnnotationHandler { }); } - private Object getParamValue(Object arg, String key, int layer) throws Exception{ - if (ObjectUtils.isNotEmpty(arg)) return null; - Class parameterType = arg.getClass(); - if (parameterType.isPrimitive() || ReflectUtil.isWrapClass(parameterType) || ReflectUtil.isString(parameterType)) { - return arg; - } else if (ReflectUtil.isArray(parameterType)) { - Object result; - for (int i = 0; i < Array.getLength(arg); i++) { - Object o = Array.get(arg, i); - if (ObjectUtils.isNotEmpty((result = getParamValue(o, key, layer)))) { - return result; - } - } - return null; - } else if (ReflectUtil.isCollection(parameterType)) { - Object[] array = ((Collection) arg).toArray(); - Object result; - for (int i = 0; i < array.length; i++) { - Object o = array[i]; - if (ObjectUtils.isNotEmpty((result = getParamValue(o, key, layer)))) { - return result; - } - } - return null; - } else if (ReflectUtil.isMap(parameterType)) { - Map argMap = (Map) arg; - String[] values = key.split("\\."); - Object o = argMap.get(values[layer]); - return getParamValue(o, key, ++layer); - } else { - // 当作自定义类处理 - String[] values = key.split("\\."); - String fieldName = values[layer]; - - Object fieldValue = ReflectUtil.getFieldValue(arg, values[layer]); - return getParamValue(fieldValue, key, ++layer); - - } - } } diff --git a/backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java b/backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java new file mode 100644 index 0000000000..7b3f41e148 --- /dev/null +++ b/backend/src/main/java/io/dataease/auth/aop/DeLogAnnotationHandler.java @@ -0,0 +1,143 @@ +package io.dataease.auth.aop; + + +import io.dataease.auth.annotation.DeLog; +import io.dataease.commons.constants.SysLogConstants; +import io.dataease.commons.utils.AopUtils; +import io.dataease.controller.ResultHolder; +import io.dataease.dto.SysLogDTO; +import io.dataease.dto.log.FolderItem; +import io.dataease.service.sys.log.LogManager; +import io.dataease.service.sys.log.LogService; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +@Aspect +@Component +public class DeLogAnnotationHandler { + + @Resource + private LogManager logManager; + + @Resource + private LogService logService; + + private static List befores = new ArrayList<>(); + + @PostConstruct + public void init() { + befores.add(SysLogConstants.OPERATE_TYPE.DELETE.getValue()); + befores.add(SysLogConstants.OPERATE_TYPE.UNSHARE.getValue()); + befores.add(SysLogConstants.OPERATE_TYPE.UNAUTHORIZE.getValue()); + } + + private SysLogDTO exec(JoinPoint point, DeLog deLog) throws Exception{ + + Object[] args = point.getArgs(); + if (ArrayUtils.isEmpty(args)) return null; + + SysLogConstants.OPERATE_TYPE operatetype = deLog.operatetype(); + SysLogConstants.SOURCE_TYPE sourcetype = deLog.sourcetype(); + + String sourceKey = StringUtils.isNotBlank(deLog.sourceKey()) ? deLog.sourceKey() : deLog.value(); + int sourceIndex = deLog.sourceIndex(); + if (args.length <= sourceIndex) return null; + Object arg = args[sourceIndex]; + Object sourceIdValue = AopUtils.getParamValue(arg, sourceKey, 0); + if (ObjectUtils.isEmpty(sourceIdValue)) return null; + + SysLogDTO sysLogDTO = new SysLogDTO(); + sysLogDTO.setOperateType(operatetype.getValue()); + sysLogDTO.setSourceType(sourcetype.getValue()); + sysLogDTO.setSourceId(sourceIdValue.toString()); + FolderItem sourceInfo = logManager.nameWithId(sourceIdValue.toString(), sourcetype.getValue()); + if (ObjectUtils.isEmpty(sourceInfo)) { + return null; + } + sysLogDTO.setSourceName(sourceInfo.getName()); + + // 填充资源位置信息 + int positionIndex = deLog.positionIndex(); + if (positionIndex > -1 && args.length > positionIndex){ + String positionKey = deLog.positionKey(); + Object positionArg = args[positionIndex]; + Object bottomPositionValue = AopUtils.getParamValue(positionArg, positionKey, 0); + if (ObjectUtils.isNotEmpty(bottomPositionValue)) { + if (sourcetype == SysLogConstants.SOURCE_TYPE.DATASOURCE) { + FolderItem folderItem = logManager.dsTypeInfo(bottomPositionValue.toString()); + List items = new ArrayList<>(); + items.add(folderItem); + sysLogDTO.setPositions(items); + }else { + List parentsAndSelf = parents(bottomPositionValue.toString(), sourcetype); + sysLogDTO.setPositions(parentsAndSelf); + } + + } + } + // 填充资源目标位置信息 + int targetIndex = deLog.targetIndex(); + if (targetIndex > -1 && args.length > targetIndex){ + String targetKey = deLog.targetKey(); + Object targetArg = args[targetIndex]; + SysLogConstants.SOURCE_TYPE targetType = deLog.targetType(); + Object bottomTargetValue = AopUtils.getParamValue(targetArg, targetKey, 0); + if (ObjectUtils.isNotEmpty(bottomTargetValue)) { + List parentsAndSelf = parents(bottomTargetValue.toString(), targetType); + sysLogDTO.setRemarks(parentsAndSelf); + } + } + return sysLogDTO; + } + + @Around(value = "@annotation(io.dataease.auth.annotation.DeLog)") + public Object logAround(ProceedingJoinPoint point) throws Throwable { + SysLogDTO logDTO = null; + Object result = null; + DeLog log = getLog(point); + if(befores.contains(log.operatetype().getValue())) { + // 前置处理 比如删除操作 需要在数据删除之前查询 + logDTO = exec(point, log); + result = point.proceed(point.getArgs()); + }else { + // 后置处理 比如保存操作 需要在保存之后才有主键 + result = point.proceed(point.getArgs()); + logDTO = exec(point, log); + } + + if (ObjectUtils.isNotEmpty(result) && result instanceof ResultHolder && !((ResultHolder) result).isSuccess()) { + return result; + } + Optional.ofNullable(logDTO).ifPresent(logService::saveLog); + return result; + } + + + + private DeLog getLog(JoinPoint point) { + MethodSignature ms = (MethodSignature) point.getSignature(); + Method method = ms.getMethod(); + DeLog deLog = method.getAnnotation(DeLog.class); + return deLog; + } + + public List parents(String value, SysLogConstants.SOURCE_TYPE type) { + return logManager.parentsAndSelf(value, type); + } + + +} diff --git a/backend/src/main/java/io/dataease/commons/constants/SysLogConstants.java b/backend/src/main/java/io/dataease/commons/constants/SysLogConstants.java new file mode 100644 index 0000000000..01e68c4647 --- /dev/null +++ b/backend/src/main/java/io/dataease/commons/constants/SysLogConstants.java @@ -0,0 +1,72 @@ +package io.dataease.commons.constants; + +import java.util.Arrays; +import java.util.Optional; + +public class SysLogConstants { + + public static String operateTypeName(Integer value) { + Optional any = Arrays.stream(OPERATE_TYPE.class.getEnumConstants()).filter(e -> e.value == value).findAny(); + if (any.isPresent()) return any.get().name; + return null; + } + + public enum OPERATE_TYPE { + CREATE(1, "OPERATE_TYPE_CREATE"), + MODIFY(2, "OPERATE_TYPE_MODIFY"), + DELETE(3, "OPERATE_TYPE_DELETE"), + SHARE(4, "OPERATE_TYPE_SHARE"), + UNSHARE(5, "OPERATE_TYPE_UNSHARE"), + AUTHORIZE(6, "OPERATE_TYPE_AUTHORIZE"), + UNAUTHORIZE(7, "OPERATE_TYPE_UNAUTHORIZE"), + CREATELINK(8, "OPERATE_TYPE_CREATELINK"), + DELETELINK(9, "OPERATE_TYPE_DELETELINK"), + MODIFYLINK(10, "OPERATE_TYPE_MODIFYLINK"); + private Integer value; + private String name; + OPERATE_TYPE(Integer value, String name) { + this.value = value; + this.name = name; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } + } + + public static String sourceTypeName(Integer value) { + Optional any = Arrays.stream(SOURCE_TYPE.class.getEnumConstants()).filter(e -> e.value == value).findAny(); + if (any.isPresent()) return any.get().name; + return null; + } + + public enum SOURCE_TYPE { + DATASOURCE(1, "SOURCE_TYPE_DATASOURCE"), + DATASET(2, "SOURCE_TYPE_DATASET"), + PANEL(3, "SOURCE_TYPE_PANEL"), + VIEW(4, "SOURCE_TYPE_VIEW"), + /*LINK(5, "SOURCE_TYPE_LINK"),*/ + USER(6, "SOURCE_TYPE_USER"), + DEPT(7, "SOURCE_TYPE_DEPT"), + ROLE(8, "SOURCE_TYPE_ROLE"); + private Integer value; + private String name; + + SOURCE_TYPE(Integer value, String name) { + this.value = value; + this.name = name; + } + + public Integer getValue() { + return value; + } + + public String getName() { + return name; + } + } +} diff --git a/backend/src/main/java/io/dataease/commons/utils/AopUtils.java b/backend/src/main/java/io/dataease/commons/utils/AopUtils.java new file mode 100644 index 0000000000..4168027cf4 --- /dev/null +++ b/backend/src/main/java/io/dataease/commons/utils/AopUtils.java @@ -0,0 +1,52 @@ +package io.dataease.commons.utils; + +import io.dataease.auth.util.ReflectUtil; +import org.apache.commons.lang3.ObjectUtils; + +import java.lang.reflect.Array; +import java.util.Collection; +import java.util.Map; + +public class AopUtils { + + public static Object getParamValue(Object arg, String key, int layer) throws Exception{ + if (ObjectUtils.isEmpty(arg)) return null; + Class parameterType = arg.getClass(); + if (parameterType.isPrimitive() || ReflectUtil.isWrapClass(parameterType) || ReflectUtil.isString(parameterType)) { + return arg; + } else if (ReflectUtil.isArray(parameterType)) { + Object result; + for (int i = 0; i < Array.getLength(arg); i++) { + Object o = Array.get(arg, i); + + if (ObjectUtils.isNotEmpty((result = getParamValue(o, key, layer)))) { + return result; + } + } + return null; + } else if (ReflectUtil.isCollection(parameterType)) { + Object[] array = ((Collection) arg).toArray(); + Object result; + for (int i = 0; i < array.length; i++) { + Object o = array[i]; + if (ObjectUtils.isNotEmpty((result = getParamValue(o, key, layer)))) { + return result; + } + } + return null; + } else if (ReflectUtil.isMap(parameterType)) { + Map argMap = (Map) arg; + String[] values = key.split("\\."); + Object o = argMap.get(values[layer]); + return getParamValue(o, key, ++layer); + } else { + // 当作自定义类处理 + String[] values = key.split("\\."); + String fieldName = values[layer]; + + Object fieldValue = ReflectUtil.getFieldValue(arg, values[layer]); + return getParamValue(fieldValue, key, ++layer); + + } + } +} diff --git a/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java b/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java index 23ffd28b71..0614342afc 100644 --- a/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java +++ b/backend/src/main/java/io/dataease/controller/datasource/DatasourceController.java @@ -1,7 +1,10 @@ package io.dataease.controller.datasource; import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import io.dataease.auth.annotation.DeLog; import io.dataease.auth.annotation.DePermission; +import io.dataease.commons.constants.SysLogConstants; +import io.dataease.controller.datasource.request.DeleteDsRequest; import io.dataease.plugins.common.base.domain.Datasource; import io.dataease.commons.constants.DePermissionType; import io.dataease.commons.constants.ResourceAuthLevel; @@ -39,6 +42,12 @@ public class DatasourceController { @DePermission(type = DePermissionType.DATASOURCE, value = "id") @ApiOperation("新增数据源") @PostMapping("/add") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.CREATE, + sourcetype = SysLogConstants.SOURCE_TYPE.DATASOURCE, + positionIndex = 0,positionKey = "type", + value = "id" + ) public Datasource addDatasource(@RequestBody Datasource datasource) throws Exception{ return datasourceService.addDatasource(datasource); } @@ -81,15 +90,27 @@ public class DatasourceController { @RequiresPermissions("datasource:read") @DePermission(type = DePermissionType.DATASOURCE, level = ResourceAuthLevel.DATASOURCE_LEVEL_MANAGE) @ApiOperation("删除数据源") - @PostMapping("/delete/{datasourceID}") - public ResultHolder deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) throws Exception { - return datasourceService.deleteDatasource(datasourceID); + @PostMapping("/delete") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.DELETE, + sourcetype = SysLogConstants.SOURCE_TYPE.DATASOURCE, + positionIndex = 0,positionKey = "type", + value = "id" + ) + public ResultHolder deleteDatasource(@RequestBody DeleteDsRequest request) throws Exception { + return datasourceService.deleteDatasource(request.getId()); } @RequiresPermissions("datasource:read") @DePermission(type = DePermissionType.DATASOURCE, value = "id", level = ResourceAuthLevel.DATASOURCE_LEVEL_MANAGE) @ApiOperation("更新数据源") @PostMapping("/update") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.MODIFY, + sourcetype = SysLogConstants.SOURCE_TYPE.DATASOURCE, + positionIndex = 0,positionKey = "type", + value = "id" + ) public void updateDatasource(@RequestBody UpdataDsRequest dsRequest) throws Exception{ datasourceService.updateDatasource(dsRequest); } diff --git a/backend/src/main/java/io/dataease/controller/datasource/request/DeleteDsRequest.java b/backend/src/main/java/io/dataease/controller/datasource/request/DeleteDsRequest.java new file mode 100644 index 0000000000..c31818bbf8 --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/datasource/request/DeleteDsRequest.java @@ -0,0 +1,16 @@ +package io.dataease.controller.datasource.request; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class DeleteDsRequest implements Serializable { + + @ApiModelProperty(value = "ID",required = true) + private String id; + + @ApiModelProperty(value = "类型", required = true) + private String type; +} diff --git a/backend/src/main/java/io/dataease/controller/sys/SysLogController.java b/backend/src/main/java/io/dataease/controller/sys/SysLogController.java new file mode 100644 index 0000000000..1b85e090db --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/sys/SysLogController.java @@ -0,0 +1,57 @@ +package io.dataease.controller.sys; + +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import io.dataease.commons.utils.PageUtils; +import io.dataease.commons.utils.Pager; +import io.dataease.controller.handler.annotation.I18n; +import io.dataease.controller.sys.base.BaseGridRequest; +import io.dataease.dto.SysLogGridDTO; +import io.dataease.dto.log.FolderItem; +import io.dataease.service.sys.log.LogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@RestController +@Api(tags = "系统:日志管理") +@ApiSupport(order = 220) +@RequestMapping("/api/log") +public class SysLogController { + + @Resource + private LogService logService; + + @I18n + @ApiOperation("查询日志") + @PostMapping("/logGrid/{goPage}/{pageSize}") + @ApiImplicitParams({ + @ApiImplicitParam(paramType = "path", name = "goPage", value = "页码", required = true, dataType = "Integer"), + @ApiImplicitParam(paramType = "path", name = "pageSize", value = "页容量", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "request", value = "查询条件", required = true) + }) + public Pager> logGrid(@PathVariable int goPage, @PathVariable int pageSize, + @RequestBody BaseGridRequest request) { + Page page = PageHelper.startPage(goPage, pageSize, true); + return PageUtils.setPageInfo(page, logService.query(request)); + } + + @ApiOperation("操作类型") + @PostMapping("/opTypes") + public List types() { + return logService.types(); + } + + @ApiOperation("导出操作日志") + @PostMapping("/export") + public void export(HttpServletResponse response) throws Exception{ + logService.exportExcel(response); + } +} diff --git a/backend/src/main/java/io/dataease/controller/sys/SysUserController.java b/backend/src/main/java/io/dataease/controller/sys/SysUserController.java index 711a574880..53d488862b 100644 --- a/backend/src/main/java/io/dataease/controller/sys/SysUserController.java +++ b/backend/src/main/java/io/dataease/controller/sys/SysUserController.java @@ -3,7 +3,9 @@ package io.dataease.controller.sys; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import io.dataease.auth.annotation.DeLog; import io.dataease.auth.api.dto.CurrentUserDto; +import io.dataease.commons.constants.SysLogConstants; import io.dataease.exception.DataEaseException; import io.dataease.i18n.Translator; import io.dataease.plugins.common.base.domain.SysRole; @@ -69,6 +71,11 @@ public class SysUserController { @ApiOperation("创建用户") @RequiresPermissions("user:add") @PostMapping("/create") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.CREATE, + sourcetype = SysLogConstants.SOURCE_TYPE.USER, + value = "userId" + ) public void create(@RequestBody SysUserCreateRequest request) { sysUserService.save(request); } @@ -76,6 +83,11 @@ public class SysUserController { @ApiOperation("更新用户") @RequiresPermissions("user:edit") @PostMapping("/update") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.MODIFY, + sourcetype = SysLogConstants.SOURCE_TYPE.USER, + value = "userId" + ) public void update(@RequestBody SysUserCreateRequest request) { sysUserService.update(request); } @@ -84,6 +96,10 @@ public class SysUserController { @RequiresPermissions("user:del") @PostMapping("/delete/{userId}") @ApiImplicitParam(paramType = "path", value = "用户ID", name = "userId", required = true, dataType = "Integer") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.DELETE, + sourcetype = SysLogConstants.SOURCE_TYPE.USER + ) public void delete(@PathVariable("userId") Long userId) { sysUserService.delete(userId); } @@ -92,6 +108,11 @@ public class SysUserController { @RequiresPermissions("user:edit") @RequiresRoles("1") @PostMapping("/updateStatus") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.MODIFY, + sourcetype = SysLogConstants.SOURCE_TYPE.USER, + value = "userId" + ) public void updateStatus(@RequestBody SysUserStateRequest request) { sysUserService.updateStatus(request); } diff --git a/backend/src/main/java/io/dataease/dto/SysLogDTO.java b/backend/src/main/java/io/dataease/dto/SysLogDTO.java new file mode 100644 index 0000000000..262b1e4113 --- /dev/null +++ b/backend/src/main/java/io/dataease/dto/SysLogDTO.java @@ -0,0 +1,24 @@ +package io.dataease.dto; + +import io.dataease.dto.log.FolderItem; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class SysLogDTO implements Serializable { + + private Integer sourceType; + + private String sourceId; + + private String sourceName; + + private Integer operateType; + + private List positions; + + private List remarks; + +} diff --git a/backend/src/main/java/io/dataease/dto/SysLogGridDTO.java b/backend/src/main/java/io/dataease/dto/SysLogGridDTO.java new file mode 100644 index 0000000000..706d4a2762 --- /dev/null +++ b/backend/src/main/java/io/dataease/dto/SysLogGridDTO.java @@ -0,0 +1,25 @@ +package io.dataease.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class SysLogGridDTO implements Serializable { + + @ApiModelProperty("操作类型") + private String opType; + + @ApiModelProperty("资源类型") + private String sourceType; + + @ApiModelProperty("详细信息") + private String detail; + + @ApiModelProperty("操作人") + private String user; + + @ApiModelProperty("操作时间") + private Long time; +} diff --git a/backend/src/main/java/io/dataease/dto/log/FolderItem.java b/backend/src/main/java/io/dataease/dto/log/FolderItem.java new file mode 100644 index 0000000000..ad69b5c73d --- /dev/null +++ b/backend/src/main/java/io/dataease/dto/log/FolderItem.java @@ -0,0 +1,16 @@ +package io.dataease.dto.log; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class FolderItem implements Serializable { + + private String id; + + private String name; + + private Integer type; + +} diff --git a/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.java b/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.java new file mode 100644 index 0000000000..ae7875c5f0 --- /dev/null +++ b/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.java @@ -0,0 +1,15 @@ +package io.dataease.ext; + +import io.dataease.dto.log.FolderItem; +import io.dataease.ext.query.GridExample; +import io.dataease.plugins.common.base.domain.SysLogWithBLOBs; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ExtSysLogMapper { + + List query(GridExample example); + + List idAndName(@Param("ids") List ids, @Param("type") Integer type); +} diff --git a/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml b/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml new file mode 100644 index 0000000000..ca90d1006e --- /dev/null +++ b/backend/src/main/java/io/dataease/ext/ExtSysLogMapper.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + diff --git a/backend/src/main/java/io/dataease/plugins/server/XDeptServer.java b/backend/src/main/java/io/dataease/plugins/server/XDeptServer.java index 0d4f46036a..1f74bfa203 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XDeptServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XDeptServer.java @@ -1,7 +1,9 @@ package io.dataease.plugins.server; +import io.dataease.auth.annotation.DeLog; import io.dataease.auth.service.ExtAuthService; +import io.dataease.commons.constants.SysLogConstants; import io.dataease.commons.utils.BeanUtils; import io.dataease.controller.sys.response.DeptNodeResponse; import io.dataease.plugins.common.entity.XpackGridRequest; @@ -70,6 +72,12 @@ public class XDeptServer { @RequiresPermissions("dept:add") @ApiOperation("创建") @PostMapping("/create") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.CREATE, + sourcetype = SysLogConstants.SOURCE_TYPE.DEPT, + positionIndex = 0,positionKey = "pid", + value = "deptId" + ) public int create(@RequestBody XpackCreateDept dept){ DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class); return deptService.add(dept); @@ -78,6 +86,12 @@ public class XDeptServer { @RequiresPermissions("dept:del") @ApiOperation("删除") @PostMapping("/delete") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.DELETE, + sourcetype = SysLogConstants.SOURCE_TYPE.DEPT, + positionIndex = 0,positionKey = "pid", + value = "deptId" + ) public void delete(@RequestBody List requests){ DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class); requests.forEach(request -> { @@ -89,6 +103,12 @@ public class XDeptServer { @RequiresPermissions("dept:edit") @ApiOperation("更新") @PostMapping("/update") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.MODIFY, + sourcetype = SysLogConstants.SOURCE_TYPE.DEPT, + positionIndex = 0,positionKey = "pid", + value = "deptId" + ) public int update(@RequestBody XpackCreateDept dept){ DeptXpackService deptService = SpringContextUtil.getBean(DeptXpackService.class); return deptService.update(dept); diff --git a/backend/src/main/java/io/dataease/plugins/server/XRoleServer.java b/backend/src/main/java/io/dataease/plugins/server/XRoleServer.java index 200a00155f..ff9db5f9ff 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XRoleServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XRoleServer.java @@ -3,7 +3,9 @@ package io.dataease.plugins.server; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; +import io.dataease.auth.annotation.DeLog; import io.dataease.auth.service.ExtAuthService; +import io.dataease.commons.constants.SysLogConstants; import io.dataease.commons.utils.PageUtils; import io.dataease.commons.utils.Pager; import io.dataease.plugins.common.entity.XpackGridRequest; @@ -30,6 +32,11 @@ public class XRoleServer { @RequiresPermissions("role:add") @ApiOperation("新增角色") @PostMapping("/create") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.CREATE, + sourcetype = SysLogConstants.SOURCE_TYPE.ROLE, + value = "roleId" + ) public void create(@RequestBody XpackRoleDto role){ RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class); roleXpackService.save(role); @@ -39,6 +46,10 @@ public class XRoleServer { @RequiresPermissions("role:del") @ApiOperation("删除角色") @PostMapping("/delete/{roleId}") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.DELETE, + sourcetype = SysLogConstants.SOURCE_TYPE.ROLE + ) public void delete(@PathVariable("roleId") Long roleId){ RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class); extAuthService.clearDeptResource(roleId); @@ -49,6 +60,11 @@ public class XRoleServer { @RequiresPermissions("role:edit") @ApiOperation("更新角色") @PostMapping("/update") + @DeLog( + operatetype = SysLogConstants.OPERATE_TYPE.MODIFY, + sourcetype = SysLogConstants.SOURCE_TYPE.ROLE, + value = "roleId" + ) public void update(@RequestBody XpackRoleDto role){ RoleXpackService roleXpackService = SpringContextUtil.getBean(RoleXpackService.class); roleXpackService.update(role); diff --git a/backend/src/main/java/io/dataease/service/sys/SysUserService.java b/backend/src/main/java/io/dataease/service/sys/SysUserService.java index b9b2ed382a..80025e9252 100644 --- a/backend/src/main/java/io/dataease/service/sys/SysUserService.java +++ b/backend/src/main/java/io/dataease/service/sys/SysUserService.java @@ -94,6 +94,7 @@ public class SysUserService { } int insert = sysUserMapper.insert(user); SysUser dbUser = findOne(user); + request.setUserId(dbUser.getUserId()); saveUserRoles(dbUser.getUserId(), request.getRoleIds());//插入用户角色关联 return insert; } diff --git a/backend/src/main/java/io/dataease/service/sys/log/LogManager.java b/backend/src/main/java/io/dataease/service/sys/log/LogManager.java new file mode 100644 index 0000000000..36f9ce3d3e --- /dev/null +++ b/backend/src/main/java/io/dataease/service/sys/log/LogManager.java @@ -0,0 +1,133 @@ +package io.dataease.service.sys.log; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import io.dataease.commons.constants.SysLogConstants; +import io.dataease.commons.utils.AuthUtils; +import io.dataease.dto.log.FolderItem; +import io.dataease.ext.ExtSysLogMapper; +import io.dataease.i18n.Translator; +import io.dataease.plugins.common.base.domain.SysLogWithBLOBs; +import io.dataease.plugins.common.dto.datasource.DataSourceType; +import io.dataease.service.datasource.DatasourceService; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +@Component +public class LogManager { + + protected static final String contentFormat = "【%s】"; + + protected static final String positionFormat = "在【%s】"; + + protected static final String format = "给%s【%s】"; + + protected Gson gson = new Gson(); + + + protected Type type = new TypeToken>() {}.getType(); + + + + @Resource + private ExtSysLogMapper extSysLogMapper; + + @Resource + private DatasourceService datasourceService; + + + public String detailInfo(SysLogWithBLOBs vo) { + String sourceName = vo.getSourceName(); + String postion = null; + String operateTypeName = SysLogConstants.operateTypeName(vo.getOperateType()); + operateTypeName = Translator.get(operateTypeName); + String sourceTypeName = SysLogConstants.sourceTypeName(vo.getSourceType()); + sourceTypeName = Translator.get(sourceTypeName); + String result = operateTypeName + sourceTypeName + String.format(contentFormat, sourceName) + remarkInfo(vo); + + if ((postion = vo.getPosition()) != null) { + List folderItems = gson.fromJson(postion, type); + String template = folderItems.stream().map(folderItem -> folderItem.getName()).collect(Collectors.joining("/")); + String postionResult = String.format(positionFormat, template); + return postionResult + result; + } + return result; + } + + + + public String remarkInfo(SysLogWithBLOBs vo) { + String remakrk = null; + if ((remakrk = vo.getRemark()) != null) { + List targetInfos = gson.fromJson(remakrk, type); + String target = targetInfos.stream().map(item -> { + Integer targetType = item.getType(); + String targetTypeName = SysLogConstants.sourceTypeName(targetType); + return String.format(format, targetTypeName, item.getName()); + }).collect(Collectors.joining("/")); + return target; + } + return ""; + } + + public List parentsAndSelf(String id, SysLogConstants.SOURCE_TYPE type) { + Integer value = type.getValue(); + String typeValue = ""; + switch (value) { + case 2: + typeValue = "dataset"; + break; + case 3: + typeValue = "panel"; + break; + case 7: + typeValue = "dept"; + break; + default: + break; + } + List ids = new ArrayList<>(); + if (StringUtils.isNotBlank(typeValue)) { + ids.addAll(AuthUtils.parentResources(id, typeValue)); + }else { + ids.add(id); + } + List folderItems = extSysLogMapper.idAndName(ids, value); + folderItems.forEach(item -> item.setType(value)); + return folderItems; + } + + public FolderItem nameWithId(String id, Integer type) { + List ids = new ArrayList<>(); + ids.add(id); + List folderItems = extSysLogMapper.idAndName(ids, type); + if (CollectionUtils.isNotEmpty(folderItems)) { + return folderItems.get(0); + } + return null; + } + + public FolderItem dsTypeInfo(String typeId) { + ArrayList dataSourceTypes = new ArrayList<>(datasourceService.types()); + String name = null; + for (int i = 0; i < dataSourceTypes.size(); i++) { + if (dataSourceTypes.get(i).getType().equals(typeId)){ + name = dataSourceTypes.get(i).getName(); + break; + } + } + FolderItem folderItem = new FolderItem(); + folderItem.setId(typeId); + folderItem.setName(StringUtils.isNotBlank(name) ? name : typeId); + return folderItem; + } + + +} diff --git a/backend/src/main/java/io/dataease/service/sys/log/LogService.java b/backend/src/main/java/io/dataease/service/sys/log/LogService.java new file mode 100644 index 0000000000..688b2df2b9 --- /dev/null +++ b/backend/src/main/java/io/dataease/service/sys/log/LogService.java @@ -0,0 +1,113 @@ +package io.dataease.service.sys.log; + + +import com.google.gson.Gson; +import io.dataease.auth.api.dto.CurrentUserDto; +import io.dataease.commons.constants.SysLogConstants; +import io.dataease.commons.utils.AuthUtils; +import io.dataease.commons.utils.BeanUtils; +import io.dataease.controller.sys.base.BaseGridRequest; +import io.dataease.dto.SysLogDTO; +import io.dataease.dto.SysLogGridDTO; +import io.dataease.dto.log.FolderItem; +import io.dataease.ext.ExtSysLogMapper; +import io.dataease.ext.query.GridExample; +import io.dataease.i18n.Translator; +import io.dataease.plugins.common.base.domain.SysLogWithBLOBs; +import io.dataease.plugins.common.base.mapper.SysLogMapper; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class LogService { + + private Gson gson = new Gson(); + + private static Integer[] unPanelOperates = {4, 5, 8, 9, 10}; + + @Resource + private SysLogMapper sysLogMapper; + + @Resource + private ExtSysLogMapper extSysLogMapper; + + @Resource + private LogManager logManager; + + + + public List query(BaseGridRequest request) { + GridExample gridExample = request.convertExample(); + List voLogs = extSysLogMapper.query(gridExample); + List dtos = voLogs.stream().map(this::convertDTO).collect(Collectors.toList()); + return dtos; + } + + + public List types() { + List integers = Arrays.stream(unPanelOperates).collect(Collectors.toList()); + List results = new ArrayList<>(); + SysLogConstants.SOURCE_TYPE[] sourceTypes = SysLogConstants.SOURCE_TYPE.values(); + SysLogConstants.OPERATE_TYPE[] operateTypes = SysLogConstants.OPERATE_TYPE.values(); + for (int i = 0; i < sourceTypes.length; i++) { + SysLogConstants.SOURCE_TYPE sourceType = sourceTypes[i]; + for (int j = 0; j < operateTypes.length; j++) { + SysLogConstants.OPERATE_TYPE operateType = operateTypes[j]; + if (sourceType.getValue() > 3 && operateType.getValue() > 3){ + continue; + } + if (sourceType.getValue() != 3 && integers.contains(operateType.getValue())) { + continue; + } + FolderItem folderItem = new FolderItem(); + folderItem.setId(operateType.getValue() + "-" + sourceType.getValue()); + String operateTypeName = operateType.getName(); + String sourceTypeName = sourceType.getName(); + folderItem.setName( Translator.get(operateTypeName) + Translator.get(sourceTypeName)); + results.add(folderItem); + } + } + + return results; + } + + public SysLogGridDTO convertDTO(SysLogWithBLOBs vo) { + SysLogGridDTO sysLogGridDTO = new SysLogGridDTO(); + sysLogGridDTO.setOpType(SysLogConstants.operateTypeName(vo.getOperateType())); + sysLogGridDTO.setSourceType(SysLogConstants.sourceTypeName(vo.getSourceType())); + sysLogGridDTO.setTime(vo.getTime()); + sysLogGridDTO.setUser(vo.getNickName()); + sysLogGridDTO.setDetail(logManager.detailInfo(vo)); + return sysLogGridDTO; + } + + public void saveLog(SysLogDTO sysLogDTO) { + // String ip = ""; + CurrentUserDto user = AuthUtils.getUser(); + SysLogWithBLOBs sysLogWithBLOBs = BeanUtils.copyBean(new SysLogWithBLOBs(), sysLogDTO); + if (CollectionUtils.isNotEmpty(sysLogDTO.getPositions())) { + sysLogWithBLOBs.setPosition(gson.toJson(sysLogDTO.getPositions())); + } + if (CollectionUtils.isNotEmpty(sysLogDTO.getRemarks())) { + sysLogWithBLOBs.setRemark(gson.toJson(sysLogDTO.getRemarks())); + } + sysLogWithBLOBs.setTime(System.currentTimeMillis()); + sysLogWithBLOBs.setUserId(user.getUserId()); + sysLogWithBLOBs.setLoginName(user.getUsername()); + sysLogWithBLOBs.setNickName(user.getNickName()); + // sysLogWithBLOBs.setIp(ip); + sysLogMapper.insert(sysLogWithBLOBs); + } + + public void exportExcel(HttpServletResponse response) throws Exception{ + + } + +} diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 89119243dc..a548ee5173 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -128,3 +128,23 @@ i18n_wrong_content=Wrong content i18n_wrong_tel=Wrong tel format i18n_wrong_email=Wrong email format i18n_wrong_name_format=Wrong name format + + +OPERATE_TYPE_CREATE=Create +OPERATE_TYPE_MODIFY=Modify +OPERATE_TYPE_DELETE=Delete +OPERATE_TYPE_SHARE=Share +OPERATE_TYPE_UNSHARE=Unshare +OPERATE_TYPE_AUTHORIZE=Authorize +OPERATE_TYPE_UNAUTHORIZE=Unauthorize +OPERATE_TYPE_CREATELINK=Create Link +OPERATE_TYPE_DELETELINK=Delete Link +OPERATE_TYPE_MODIFYLINK=Modify Link + +SOURCE_TYPE_DATASOURCE=数据源 +SOURCE_TYPE_DATASET=数据集 +SOURCE_TYPE_PANEL=仪表板 +SOURCE_TYPE_VIEW=视图 +SOURCE_TYPE_USER=用户 +SOURCE_TYPE_DEPT=组织 +SOURCE_TYPE_ROLE=角色 diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 86b0db5e04..5cfced746a 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -128,3 +128,26 @@ i18n_wrong_tel=电话格式错误 i18n_wrong_email=邮箱格式错误 i18n_wrong_name_format=姓名格式错误 +OPERATE_TYPE_CREATE=创建 +OPERATE_TYPE_MODIFY=修改 +OPERATE_TYPE_DELETE=删除 +OPERATE_TYPE_SHARE=分享 +OPERATE_TYPE_UNSHARE=取消分享 +OPERATE_TYPE_AUTHORIZE=授权 +OPERATE_TYPE_UNAUTHORIZE=取消授权 +OPERATE_TYPE_CREATELINK=创建公共链接 +OPERATE_TYPE_DELETELINK=删除公共链接 +OPERATE_TYPE_MODIFYLINK=修改公共链接 + +SOURCE_TYPE_DATASOURCE=数据源 +SOURCE_TYPE_DATASET=数据集 +SOURCE_TYPE_PANEL=仪表板 +SOURCE_TYPE_VIEW=视图 +SOURCE_TYPE_USER=用户 +SOURCE_TYPE_DEPT=组织 +SOURCE_TYPE_ROLE=角色 + +I18N_OPERATE_TYPE=操作类型 +I18N_DETAIL=操作详情 +I18N_USER=操作人 +I18N_TIME=操作时间 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index 47bcb1d54b..09448cd130 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -128,3 +128,22 @@ i18n_wrong_content=內容不合法 i18n_wrong_tel=電話格式錯誤 i18n_wrong_email=郵箱格式錯誤 i18n_wrong_name_format=姓名格式錯誤 + +OPERATE_TYPE_CREATE=創建 +OPERATE_TYPE_MODIFY=修改 +OPERATE_TYPE_DELETE=刪除 +OPERATE_TYPE_SHARE=分享 +OPERATE_TYPE_UNSHARE=取消分享 +OPERATE_TYPE_AUTHORIZE=授權 +OPERATE_TYPE_UNAUTHORIZE=取消授權 +OPERATE_TYPE_CREATELINK=創建公共鏈接 +OPERATE_TYPE_DELETELINK=刪除公共鏈接 +OPERATE_TYPE_MODIFYLINK=修改公共鏈接 + +SOURCE_TYPE_DATASOURCE=數據源 +SOURCE_TYPE_DATASET=數據集 +SOURCE_TYPE_PANEL=儀表板 +SOURCE_TYPE_VIEW=視圖 +SOURCE_TYPE_USER=用戶 +SOURCE_TYPE_DEPT=組織 +SOURCE_TYPE_ROLE=角色 diff --git a/frontend/package.json b/frontend/package.json index 5cdccb511b..bcd7c8910e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,7 +27,7 @@ "element-ui": "2.15.7", "file-save": "^0.2.0", "file-saver": "^2.0.5", - "fit2cloud-ui": "1.5.4", + "fit2cloud-ui": "^1.8.0", "flv.js": "^1.6.2", "html2canvasde": "^v1.1.4-de", "jquery": "^3.1.1", diff --git a/frontend/src/api/system/datasource.js b/frontend/src/api/system/datasource.js index ada40a1f3b..f85c70d160 100644 --- a/frontend/src/api/system/datasource.js +++ b/frontend/src/api/system/datasource.js @@ -47,11 +47,12 @@ export function editDs(data) { }) } -export function delDs(id) { +export function delDs(data) { return request({ - url: 'datasource/delete/' + id, + url: 'datasource/delete', loading: true, - method: 'post' + method: 'post', + data }) } @@ -81,7 +82,7 @@ export function getSchema(data) { }) } -export function checkApiDatasource(data){ +export function checkApiDatasource(data) { return request({ url: 'datasource/checkApiDatasource', method: 'post', diff --git a/frontend/src/api/system/log.js b/frontend/src/api/system/log.js new file mode 100644 index 0000000000..f91e5547d3 --- /dev/null +++ b/frontend/src/api/system/log.js @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +export function logGrid(page, size, data) { + return request({ + url: '/api/log/logGrid/' + page + '/' + size, + method: 'post', + data, + loading: true + }) +} + +export function opTypes() { + return request({ + url: '/api/log/opTypes', + method: 'post', + loading: true + }) +} + +export function exportExcel() { + return request({ + url: '/api/log/export', + method: 'post', + loading: true + }) +} diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 0ba1fa5899..efb5fabf93 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -2041,5 +2041,14 @@ export default { port: '端口', user: '用户名', passwd: '密码' + }, + log: { + title: '操作日志', + optype: '操作类型', + detail: '操作详情', + user: '操作用户', + time: '操作时间', + export: '导出', + search_by_key: '搜索详情' } } diff --git a/frontend/src/styles/index.scss b/frontend/src/styles/index.scss index c1a934eefd..b71acf0da5 100644 --- a/frontend/src/styles/index.scss +++ b/frontend/src/styles/index.scss @@ -827,3 +827,6 @@ div:focus { // position: relative !important; right: 0px; } +.fu-operator-component__operator { + display: none !important; +} \ No newline at end of file diff --git a/frontend/src/views/system/datasource/DsTree.vue b/frontend/src/views/system/datasource/DsTree.vue index 837883936c..a9fb49237c 100644 --- a/frontend/src/views/system/datasource/DsTree.vue +++ b/frontend/src/views/system/datasource/DsTree.vue @@ -5,11 +5,16 @@ {{ $t('commons.datasource') }} - + - + @@ -39,35 +44,41 @@ - + - + - + - + - + {{ data.name }} - + {{ data.name }} - + {{ data.name }} @@ -103,7 +114,7 @@ + + From cc8ab2d62398245cdbc5b182db23c84a82eea044 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 18 May 2022 18:23:12 +0800 Subject: [PATCH 06/18] =?UTF-8?q?feat:=20=E6=93=8D=E4=BD=9C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/db/migration/V35__1.11.sql | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/backend/src/main/resources/db/migration/V35__1.11.sql b/backend/src/main/resources/db/migration/V35__1.11.sql index 85007121f6..71ebcc2c8c 100644 --- a/backend/src/main/resources/db/migration/V35__1.11.sql +++ b/backend/src/main/resources/db/migration/V35__1.11.sql @@ -3,3 +3,28 @@ ADD COLUMN `status` varchar(255) NULL DEFAULT 'publish' COMMENT '1.publish--发 UPDATE `sys_menu` SET `sub_count` = 1 WHERE `menu_id` = 40; INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (401, 40, 0, 2, '查看系统模板', NULL, NULL, 999, NULL, NULL, 0, 0, 0, 'sys-template:read', NULL, NULL, 1614930862373, 1614930862373); + +-- ---------------------------- +-- Table structure for sys_log +-- ---------------------------- +DROP TABLE IF EXISTS `sys_log`; +CREATE TABLE `sys_log` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', + `user_id` bigint(20) NOT NULL COMMENT '操作人', + `login_name` varchar(255) NOT NULL COMMENT '登录账号', + `nick_name` varchar(255) NOT NULL COMMENT '姓名', + `ip` varchar(255) DEFAULT NULL COMMENT 'ip', + `source_type` int(8) NOT NULL COMMENT '资源类型', + `source_id` varchar(255) NOT NULL COMMENT '资源ID', + `source_name` varchar(255) NOT NULL COMMENT '资源名称', + `operate_type` int(8) NOT NULL COMMENT '操作类型', + `position` longtext COMMENT '资源位置', + `remark` longtext COMMENT '备注信息', + `time` bigint(13) NOT NULL COMMENT '操作时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; + +SET FOREIGN_KEY_CHECKS = 1; + +INSERT INTO `sys_menu` VALUES (618, 1, 1, 1, '日志管理', 'system-log', 'system/log/index', 15, 'peoples', 'log', b'0', b'0', b'0', 'log:read', NULL, NULL, NULL, 1620281952752); +INSERT INTO `sys_menu` VALUES (619, 618, 0, 2, '导出日志', NULL, NULL, 1, NULL, NULL, b'0', b'0', b'0', 'log:export', NULL, NULL, NULL, NULL); From c80eea153bb7928faca0b5c4e897a7e82d50d45b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 18 May 2022 19:06:27 +0800 Subject: [PATCH 07/18] =?UTF-8?q?feat:=20=E6=97=A5=E5=BF=97=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E6=93=8D=E4=BD=9C=E7=B1=BB=E5=9E=8B=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/service/sys/log/LogService.java | 35 +++++++++++++++++++ frontend/src/views/system/log/index.vue | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/dataease/service/sys/log/LogService.java b/backend/src/main/java/io/dataease/service/sys/log/LogService.java index 688b2df2b9..e29ee15d7d 100644 --- a/backend/src/main/java/io/dataease/service/sys/log/LogService.java +++ b/backend/src/main/java/io/dataease/service/sys/log/LogService.java @@ -7,6 +7,7 @@ import io.dataease.commons.constants.SysLogConstants; import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.BeanUtils; import io.dataease.controller.sys.base.BaseGridRequest; +import io.dataease.controller.sys.base.ConditionEntity; import io.dataease.dto.SysLogDTO; import io.dataease.dto.SysLogGridDTO; import io.dataease.dto.log.FolderItem; @@ -16,6 +17,8 @@ import io.dataease.i18n.Translator; import io.dataease.plugins.common.base.domain.SysLogWithBLOBs; import io.dataease.plugins.common.base.mapper.SysLogMapper; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -44,6 +47,38 @@ public class LogService { public List query(BaseGridRequest request) { + List conditions = request.getConditions(); + if (CollectionUtils.isNotEmpty(conditions)) { + ConditionEntity optypeCondition = null; + ConditionEntity sourceCondition = null; + int matchIndex = -1; + for (int i = 0; i < conditions.size(); i++) { + ConditionEntity conditionEntity = conditions.get(i); + String field = conditionEntity.getField(); + Object value = conditionEntity.getValue(); + + if (StringUtils.isNotBlank(field) && StringUtils.equals("optype", field) && ObjectUtils.isNotEmpty(value)) { + matchIndex = i; + optypeCondition = new ConditionEntity(); + sourceCondition = new ConditionEntity(); + List values = (List) value; + sourceCondition.setField("source_type"); + optypeCondition.setField("operate_type"); + List opValue = values.stream().map(v -> Integer.parseInt(v.split("-")[0])).collect(Collectors.toList()); + List soValue = values.stream().map(v -> Integer.parseInt(v.split("-")[1])).collect(Collectors.toList()); + optypeCondition.setValue(opValue); + sourceCondition.setValue(soValue); + optypeCondition.setOperator(conditionEntity.getOperator()); + sourceCondition.setOperator(conditionEntity.getOperator()); + } + } + if (matchIndex >= 0 ) { + conditions.remove(matchIndex); + if (ObjectUtils.isNotEmpty(optypeCondition))conditions.add(optypeCondition); + if (ObjectUtils.isNotEmpty(sourceCondition))conditions.add(sourceCondition); + } + } + GridExample gridExample = request.convertExample(); List voLogs = extSysLogMapper.query(gridExample); List dtos = voLogs.stream().map(this::convertDTO).collect(Collectors.toList()); diff --git a/frontend/src/views/system/log/index.vue b/frontend/src/views/system/log/index.vue index 29ac4bafcc..1553d97f08 100644 --- a/frontend/src/views/system/log/index.vue +++ b/frontend/src/views/system/log/index.vue @@ -44,7 +44,7 @@ export default { columns: [], searchConfig: { - useQuickSearch: true, + useQuickSearch: false, useComplexSearch: true, quickPlaceholder: this.$t('log.search_by_key'), components: [ From 50233116f6e1ec66da8b9f192c8178f1c3e3baa3 Mon Sep 17 00:00:00 2001 From: junjun Date: Thu, 19 May 2022 10:23:05 +0800 Subject: [PATCH 08/18] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=9D=97=E5=AD=97=E6=AE=B5=E5=A2=9E=E5=8A=A0=E5=BF=AB?= =?UTF-8?q?=E9=80=9F=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/drag-item/ChartDragItem.vue | 3 ++- .../views/chart/components/drag-item/DimensionExtItem.vue | 3 ++- .../src/views/chart/components/drag-item/DimensionItem.vue | 2 +- frontend/src/views/chart/components/drag-item/DrillItem.vue | 3 ++- frontend/src/views/chart/components/drag-item/FilterItem.vue | 3 ++- .../src/views/chart/components/drag-item/QuotaExtItem.vue | 5 +++-- frontend/src/views/chart/components/drag-item/QuotaItem.vue | 5 +++-- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/frontend/src/views/chart/components/drag-item/ChartDragItem.vue b/frontend/src/views/chart/components/drag-item/ChartDragItem.vue index 6bc0e5d6d1..a89f168e1c 100644 --- a/frontend/src/views/chart/components/drag-item/ChartDragItem.vue +++ b/frontend/src/views/chart/components/drag-item/ChartDragItem.vue @@ -1,5 +1,6 @@