Merge pull request #2596 from dataease/pr@dev@feat_task_type

feat(系统管理): 定时报告增加任务类型
This commit is contained in:
fit2cloud-chenyw 2022-07-06 14:11:39 +08:00 committed by GitHub
commit b7f9e8fd7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 41 deletions

View File

@ -22,17 +22,18 @@
</el-select> </el-select>
<el-popover ref="popover" v-model="visible" :placement="placement" :transition="transition" :popper-class="popperClass" :width="width" trigger="click"> <el-popover ref="popover" v-model="visible" :placement="placement" :transition="transition" :popper-class="popperClass" :width="width" trigger="click">
<el-scrollbar tag="div" wrap-class="el-select-dropdown__wrap" view-class="el-select-dropdown__list" class="is-empty"> <el-scrollbar v-if="viewLoaded" tag="div" wrap-class="el-select-dropdown__wrap" view-class="el-select-dropdown__list" class="is-empty">
<div :style="{'height': panelHeight + 'px'}"> <div :style="{'height': panelHeight + 'px'}">
<Preview <Preview
v-if="viewLoaded"
:component-data="componentData" :component-data="componentData"
:canvas-style-data="canvasStyleData" :canvas-style-data="canvasStyleData"
:panel-info="panelInfo" :panel-info="panelInfo"
:show-position="showPosition" :show-position="showPosition"
/> />
</div> </div>
</el-scrollbar> </el-scrollbar>
<el-empty v-else style="height: 150px;" :image-size="120" description="" />
</el-popover> </el-popover>
</div> </div>
@ -41,6 +42,8 @@
<script> <script>
import { on, off } from './dom' import { on, off } from './dom'
import Preview from '@/components/canvas/components/Editor/Preview' import Preview from '@/components/canvas/components/Editor/Preview'
import { findOne } from '@/api/panel/panel'
import { panelDataPrepare } from '@/components/canvas/utils/utils'
export default { export default {
name: 'DeViewSelect', name: 'DeViewSelect',
components: { Preview }, components: { Preview },
@ -49,14 +52,11 @@ export default {
type: Array, type: Array,
default: () => [] default: () => []
}, },
viewLoaded: { panelId: {
type: Boolean, type: String,
default: false
},
viewPropData: {
type: Object,
default: null default: null
} }
}, },
data() { data() {
return { return {
@ -68,7 +68,8 @@ export default {
selectClass: 'my-top-class', selectClass: 'my-top-class',
innerValues: [], innerValues: [],
panelHeight: 450, panelHeight: 450,
showPosition: 'email-task' showPosition: 'email-task',
viewLoaded: false
} }
}, },
computed: { computed: {
@ -76,19 +77,6 @@ export default {
const _c = 'el-view-select-popper ' + this.popoverClass const _c = 'el-view-select-popper ' + this.popoverClass
return this.disabled ? _c + ' disabled ' : _c return this.disabled ? _c + ' disabled ' : _c
}, },
componentData() {
return this.viewLoaded && this.viewPropData && this.viewPropData.componentData || null
},
canvasStyleData() {
return this.viewLoaded && this.viewPropData && this.viewPropData.canvasStyleData || null
},
panelInfo() {
return this.viewLoaded && this.viewPropData && this.viewPropData.panelInfo || null
},
panelId() {
return this.viewLoaded && this.panelInfo && this.panelInfo.id
},
selectedViews() { selectedViews() {
return this.$store.getters.panelViews[this.panelId] return this.$store.getters.panelViews[this.panelId]
} }
@ -103,11 +91,12 @@ export default {
} }
}, },
panelId(val, old) { panelId(val, old) {
if (val !== old) { this.$store.dispatch('panel/setPanelInfo', this.panelInfo) } if (val !== old) {
this.loadView()
}
}, },
selectedViews: { selectedViews: {
handler(val) { handler(val) {
if (!this.viewLoaded) return
if (!val || !JSON.stringify(val)) { if (!val || !JSON.stringify(val)) {
this.labels = [] this.labels = []
this.innerValues = [] this.innerValues = []
@ -135,32 +124,47 @@ export default {
beforeDestroy() { beforeDestroy() {
off(document, 'mouseup', this._popoverHideFun) off(document, 'mouseup', this._popoverHideFun)
}, },
created() {
this.loadView()
},
methods: { methods: {
loadView() {
// this.viewLoaded = false
this.panelId && findOne(this.panelId).then(response => {
this.panelInfo = {
id: response.data.id,
name: response.data.name,
privileges: response.data.privileges,
sourcePanelName: response.data.sourcePanelName,
status: response.data.status
}
this.$store.dispatch('panel/setPanelInfo', this.panelInfo)
panelDataPrepare(JSON.parse(response.data.panelData), JSON.parse(response.data.panelStyle), rsp => {
this.viewLoaded = true
this.componentData = rsp.componentData
this.canvasStyleData = rsp.componentStyle
})
})
},
_updateH() { _updateH() {
this.$nextTick(() => { this.$nextTick(() => {
this.width = this.$refs.select.$el.getBoundingClientRect().width this.width = this.$refs.select.$el.getBoundingClientRect().width
this.panelHeight = this.width * 9 / 16 this.panelHeight = this.width * 9 / 16
}) })
}, },
// el
_popoverShowFun(val) { _popoverShowFun(val) {
this._updateH() this._updateH()
this.$emit('onFoucs') this.$emit('onFoucs')
}, },
//
_popoverHideFun(e) { _popoverHideFun(e) {
const path = this._getEventPath(e) const path = this._getEventPath(e)
const isInside = path.some(list => { const isInside = path.some(list => {
//
return list.className && typeof list.className === 'string' && list.className.indexOf('el-view-select') !== -1 return list.className && typeof list.className === 'string' && list.className.indexOf('el-view-select') !== -1
}) })
if (!isInside) { if (!isInside) {
this.visible = false this.visible = false
} }
}, },
// MouseEvent.path ie11,edge,chrome,firefox,safari
_getEventPath(evt) { _getEventPath(evt) {
const path = (evt.composedPath && evt.composedPath()) || evt.path const path = (evt.composedPath && evt.composedPath()) || evt.path
const target = evt.target const target = evt.target

View File

@ -2042,7 +2042,8 @@ export default {
once_a_week: 'Once a week', once_a_week: 'Once a week',
once_a_month: 'Once a month', once_a_month: 'Once a month',
complex_repeat: 'Complex repeat', complex_repeat: 'Complex repeat',
pixel_tip: 'Please code custom pixel(such as 2560 * 1600) or select' pixel_tip: 'Please code custom pixel(such as 2560 * 1600) or select',
task_type: 'Task type'
}, },
dynamic_time: { dynamic_time: {

View File

@ -2054,7 +2054,8 @@ export default {
once_a_week: '每周一次', once_a_week: '每周一次',
once_a_month: '每月一次', once_a_month: '每月一次',
complex_repeat: '複雜重複', complex_repeat: '複雜重複',
pixel_tip: '可直接輸入分辨率(例如:2560 * 1600)或者選擇' pixel_tip: '可直接輸入分辨率(例如:2560 * 1600)或者選擇',
task_type: '任務類型'
}, },
dynamic_time: { dynamic_time: {

View File

@ -2064,7 +2064,8 @@ export default {
once_a_week: '每周一次', once_a_week: '每周一次',
once_a_month: '每月一次', once_a_month: '每月一次',
complex_repeat: '复杂重复', complex_repeat: '复杂重复',
pixel_tip: '可直接输入自定义分辨率(例如:2560 * 1600)或选择' pixel_tip: '可直接输入自定义分辨率(例如:2560 * 1600)或选择',
task_type: '任务类型'
}, },
dynamic_time: { dynamic_time: {

View File

@ -22,6 +22,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import './utils/dialog' import './utils/dialog'
import DeComplexInput from '@/components/business/condition-table/DeComplexInput' import DeComplexInput from '@/components/business/condition-table/DeComplexInput'
import DeComplexSelect from '@/components/business/condition-table/DeComplexSelect' import DeComplexSelect from '@/components/business/condition-table/DeComplexSelect'
import DeViewSelect from '@/components/DeViewSelect'
import '@/components/canvas/custom-component' // 注册自定义组件 import '@/components/canvas/custom-component' // 注册自定义组件
import '@/utils/DateUtil' import '@/utils/DateUtil'
@ -88,6 +89,7 @@ Vue.use(message)
Vue.component('Treeselect', Treeselect) Vue.component('Treeselect', Treeselect)
Vue.component('DeComplexInput', DeComplexInput) Vue.component('DeComplexInput', DeComplexInput)
Vue.component('DeComplexSelect', DeComplexSelect) Vue.component('DeComplexSelect', DeComplexSelect)
Vue.component('DeViewSelect', DeViewSelect)
Vue.config.productionTip = false Vue.config.productionTip = false
import vueToPdf from 'vue-to-pdf' import vueToPdf from 'vue-to-pdf'