Merge branch 'dev-v2' into pr@dev-v2@chore_spring_version

This commit is contained in:
fit2cloud-chenyw 2024-05-24 21:22:00 +08:00
commit 2495e3ffe4
22 changed files with 377 additions and 143 deletions

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1716538241941" class="icon" viewBox="0 0 1166 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4799" xmlns:xlink="http://www.w3.org/1999/xlink" width="227.734375" height="200"><path d="M1016.603881 149.959255A508.396905 508.396905 0 0 0 661.880392 0H47.123419a42.206376 42.206376 0 0 0-42.206376 42.206376 42.206376 42.206376 0 0 0 42.206376 42.206376h607.45527c235.764818 0 427.571694 191.806877 427.571695 427.571695S890.343507 939.577245 654.578689 939.577245s-427.571694-191.82798-427.571694-427.592798h105.51594a42.206376 42.206376 0 0 0 42.206376-42.206376 42.206376 42.206376 0 0 0-42.206376-42.206377H42.206376a42.206376 42.206376 0 0 0-42.206376 42.206377 42.206376 42.206376 0 0 0 42.206376 42.206376h100.387866a511.984447 511.984447 0 0 0 874.009639 362.046295 512.00555 512.00555 0 0 0 0-724.071487z" p-id="4800"></path><path d="M411.237827 298.166945a42.206376 42.206376 0 0 0 42.206376-42.206376 42.206376 42.206376 0 0 0-42.206376-42.206377H120.857958a42.206376 42.206376 0 0 0-42.206376 42.206377 42.206376 42.206376 0 0 0 42.206376 42.206376zM635.205962 232.388308a42.311892 42.311892 0 0 0-42.206376 42.206376v290.379868a42.311892 42.311892 0 0 0 42.206376 42.206377h228.737456a42.206376 42.206376 0 0 0 42.206377-42.206377 42.206376 42.206376 0 0 0-42.206377-42.206376h-186.657699V274.573581A42.206376 42.206376 0 0 0 635.205962 232.388308z" p-id="4801"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -84,7 +84,7 @@
@change="changeStyle"
>
<template #prefix>
<el-icon>
<el-icon :class="{ 'dark-icon': themes === 'dark' }">
<Icon :name="styleOptionKey.icon" />
</el-icon>
</template>
@ -266,12 +266,28 @@ const styleMounted = ref({
opacity: 1,
fontSize: 22,
activeFontSize: 22,
letterSpacing: 0,
scrollSpeed: 0,
fontWeight: 'normal',
fontStyle: 'normal',
textAlign: 'center',
color: '#000000'
})
const scrollSpeedList = [
{ name: '停止', value: 0 },
{ name: '1', value: 20 },
{ name: '2', value: 18 },
{ name: '3', value: 16 },
{ name: '4', value: 14 },
{ name: '5', value: 12 },
{ name: '6', value: 10 },
{ name: '7', value: 8 },
{ name: '8', value: 6 },
{ name: '9', value: 4 },
{ name: '10', value: 2 }
]
const opacitySizeList = [
{ name: '0.1', value: 0.1 },
{ name: '0.2', value: 0.2 },
@ -310,6 +326,17 @@ const styleColorKeyArray = [
{ value: 'backgroundColor', label: '背景色', width: 90, icon: 'dv-style-backgroundColor' }
]
const letterSpacingList = computed(() => {
const arr = []
for (let i = 0; i <= 60; i = i + 1) {
arr.push({
name: i + '',
value: i
})
}
return arr
})
const fontSizeList = computed(() => {
const arr = []
for (let i = 10; i <= 60; i = i + 1) {
@ -351,6 +378,13 @@ const borderStyleList = [
//
const styleOptionMountedKeyArray = [
{
value: 'letterSpacing',
label: '字间距',
customOption: letterSpacingList.value,
width: '90px',
icon: 'dv-style-letterSpacing'
},
{
value: 'fontSize',
label: '字体大小',
@ -369,6 +403,13 @@ const styleOptionMountedKeyArray = [
//
const styleOptionKeyArray = [
{
value: 'scrollSpeed',
label: '滚动速度',
customOption: scrollSpeedList,
width: '90px',
icon: 'dv-style-scroll-speed'
},
{
value: 'opacity',
label: '不透明度',

View File

@ -11,7 +11,7 @@ const props = defineProps({
},
dvModel: {
type: String,
default: 'dv'
default: 'dataV'
},
element: {
type: Object,
@ -52,6 +52,7 @@ const newComponent = (componentName, innerType) => {
v-on:click="newComponent('UserView', 'rich-text')"
></drag-component>
<drag-component
v-if="dvModel === 'dataV'"
:themes="themes"
icon="dv-scroll-text"
label="跑马灯"

View File

@ -386,7 +386,7 @@ const list = [
},
{
component: 'CanvasBoard',
name: '图形',
name: '边框',
label: '边框',
propValue: '',
icon: 'other_material_board',
@ -497,7 +497,8 @@ const list = [
letterSpacing: 0,
color: '',
padding: 4,
verticalAlign: 'middle'
verticalAlign: 'middle',
scrollSpeed: 0
}
}
]

View File

@ -1,6 +1,6 @@
<template>
<el-row>
<el-form ref="form" size="small" style="width: 100%">
<el-form @submit.prevent ref="form" size="small" style="width: 100%">
<el-form-item>
<template #label>
<span class="data-area-label">

View File

@ -1,6 +1,6 @@
<template>
<el-row>
<el-form :effect="themes" ref="form" size="mini" style="width: 100%">
<el-form @submit.prevent :effect="themes" ref="form" size="mini" style="width: 100%">
<el-form-item :effect="themes" :label="t('visualization.video_type')">
<el-radio-group :effect="themes" v-model="state.streamMediaInfoTemp.videoType">
<el-radio :effect="themes" :label="'flv'">FLV</el-radio>

View File

@ -1,6 +1,6 @@
<template>
<el-row>
<el-form ref="form" size="small" style="width: 100%">
<el-form @submit.prevent ref="form" size="small" style="width: 100%">
<el-form-item :effect="themes" :label="t('visualization.auto_play')">
<el-switch
:effect="themes"

View File

@ -1,7 +1,7 @@
<script lang="ts" setup>
import { keycodes } from '@/utils/DeShortcutKey.js'
import eventBus from '@/utils/eventBus'
import { nextTick, onBeforeUnmount, ref } from 'vue'
import { computed, nextTick, onBeforeUnmount, ref } from 'vue'
import { toRefs } from 'vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
@ -112,17 +112,30 @@ const selectText = element => {
onBeforeUnmount(() => {
eventBus.off('componentClick', onComponentClick)
})
const varStyle = computed(() => [{ '--scroll-speed': `${element.value.style.scrollSpeed}s` }])
const textStyle = computed(() => {
return {
verticalAlign: element.value['style'].verticalAlign
}
})
</script>
<template>
<div v-if="editMode == 'edit'" class="v-text" @keydown="handleKeydown" @keyup="handleKeyup">
<div
v-if="editMode == 'edit'"
:style="varStyle"
class="v-text"
@keydown="handleKeydown"
@keyup="handleKeyup"
>
<div
ref="text"
class="marquee-txt"
:contenteditable="canEdit"
:class="{ 'can-edit': canEdit }"
:class="{ 'can-edit': canEdit, 'marquee-txt': !canEdit }"
tabindex="0"
:style="{ verticalAlign: element['style'].verticalAlign }"
:style="textStyle"
@dblclick="setEdit"
@paste="clearStyle"
@mousedown="handleMousedown"
@ -132,11 +145,7 @@ onBeforeUnmount(() => {
></div>
</div>
<div v-else class="v-text preview">
<div
class="marquee-txt"
:style="{ verticalAlign: element['style'].verticalAlign }"
v-html="element['propValue']"
></div>
<div class="marquee-txt" :style="textStyle" v-html="element['propValue']"></div>
</div>
</template>
@ -175,7 +184,7 @@ onBeforeUnmount(() => {
.marquee-txt {
display: inline-block;
padding-left: 100%; /* 从右至左开始滚动 */
animation: marqueeAnimation 10s linear infinite;
animation: marqueeAnimation var(--scroll-speed) linear infinite;
}
@keyframes marqueeAnimation {
0% {

View File

@ -922,7 +922,7 @@ export default {
line_type_dotted: '点',
value_can_not_empty: '值不能为空',
value_error: '值必须为数值',
threshold: '阈值',
threshold: '条件样式',
threshold_range: '阈值区间',
gauge_threshold_format_error: '格式错误',
total_cfg: '总计配置',

View File

@ -134,12 +134,26 @@ declare interface ChartThreshold {
/**
* 表格阈值
*/
tableThreshold: Threshold[]
tableThreshold: TableThreshold[]
/**
* 文本卡阈值
*/
textLabelThreshold: Threshold[]
}
declare interface TableThreshold {
/**
* 字段id
*/
fieldId: string
/**
* 字段
*/
field: ChartViewField
/**
* 条件
*/
conditions: Threshold[]
}
/**
* 阈值
*/
@ -157,7 +171,7 @@ declare interface Threshold {
*/
term: string
/**
*
* 字段
*/
field: ChartViewField
/**

View File

@ -1,6 +1,7 @@
<script setup lang="ts">
import { shallowRef, defineAsyncComponent } from 'vue'
import { propTypes } from '@/utils/propTypes'
import { useEmitt } from '@/hooks/web/useEmitt'
const VisualizationEditor = defineAsyncComponent(
() => import('@/views/data-visualization/index.vue')
@ -33,6 +34,15 @@ const componentMap = {
DashboardPanel
}
const changeCurrentComponent = val => {
currentComponent.value = componentMap[val]
}
useEmitt({
name: 'changeCurrentComponent',
callback: changeCurrentComponent
})
currentComponent.value = componentMap[props.componentName]
</script>
<template>

View File

@ -1,5 +1,6 @@
import { defineStore } from 'pinia'
import { store } from '../index'
import { clear } from '@/api/sync/syncTaskLog'
interface AppState {
type: string
token: string
@ -10,6 +11,9 @@ interface AppState {
pid: string
chartId: string
resourceId: string
opt: string
createType: string
templateParams: string
}
export const userStore = defineStore('embedded', {
@ -23,13 +27,22 @@ export const userStore = defineStore('embedded', {
dvId: '',
pid: '',
chartId: '',
resourceId: ''
resourceId: '',
opt: '',
createType: '',
templateParams: ''
}
},
getters: {
getType(): string {
return this.type
},
getCreateType(): string {
return this.createType
},
getTemplateParams(): string {
return this.templateParams
},
getToken(): string {
return this.token
},
@ -54,6 +67,9 @@ export const userStore = defineStore('embedded', {
getResourceId(): string {
return this.resourceId
},
getOpt(): string {
return this.opt
},
getIframeData(): any {
return {
embeddedToken: this.token,
@ -71,6 +87,12 @@ export const userStore = defineStore('embedded', {
setType(type: string) {
this.type = type
},
setCreateType(createType: string) {
this.createType = createType
},
setTemplateParams(templateParams: string) {
this.templateParams = templateParams
},
setToken(token: string) {
this.token = token
},
@ -95,6 +117,9 @@ export const userStore = defineStore('embedded', {
setResourceId(resourceId: string) {
this.resourceId = resourceId
},
setOpt(opt: string) {
this.opt = opt
},
setIframeData(data: any) {
this.type = data['type']
this.token = data['embeddedToken']
@ -104,6 +129,14 @@ export const userStore = defineStore('embedded', {
this.chartId = data['chartId']
this.pid = data['pid']
this.resourceId = data['resourceId']
},
clearState() {
this.setPid('')
this.setOpt('')
this.setCreateType('')
this.setTemplateParams('')
this.setResourceId('')
this.setDvId('')
}
}
})

View File

@ -7,7 +7,7 @@ import { groupSizeStyleAdaptor } from '@/utils/style'
const dvMainStore = dvMainStoreWithOut()
const { componentData, curComponentIndex, canvasStyleData } = storeToRefs(dvMainStore)
const needToChangeAttrs = ['top', 'left', 'width', 'height', 'fontSize']
const needToChangeAttrs = ['top', 'left', 'width', 'height', 'fontSize', 'letterSpacing']
export function changeSizeWithScale(scale) {
return changeComponentsSizeWithScale(scale)

View File

@ -336,7 +336,9 @@ init()
}}</span>
</el-col>
<el-col :span="12">
<span v-if="!item.term.includes('null')" :title="item.value">{{ item.value }}</span>
<span v-if="!item.term.includes('null')" :title="item.value + ''">{{
item.value
}}</span>
<span v-else>&nbsp;</span>
</el-col>
<el-col :span="6">
@ -426,7 +428,7 @@ init()
}}</span>
</div>
<div style="flex: 1; margin: 0 8px">
<span v-if="item.term !== 'between'" :title="item.value">{{ item.value }}</span>
<span v-if="item.term !== 'between'" :title="item.value + ''">{{ item.value }}</span>
<span v-if="item.term === 'between'">
{{ item.min }}&nbsp;{{ t('chart.drag_block_label_value') }}&nbsp;{{ item.max }}
</span>
@ -498,8 +500,8 @@ init()
<span>
<el-icon>
<Icon
:className="`field-icon-${fieldType[fieldItem.field.deType.deType]}`"
:name="`field_${fieldType[fieldItem.field.deType.deType]}`"
:className="`field-icon-${fieldType[fieldItem.field.deType]}`"
:name="`field_${fieldType[fieldItem.field.deType]}`"
/>
</el-icon>
</span>
@ -556,7 +558,7 @@ init()
!item.term.includes('empty') &&
item.term !== 'between'
"
:title="item.value"
:title="item.value + ''"
>{{ item.value }}</span
>
<span

View File

@ -1,15 +1,14 @@
<script lang="tsx" setup>
import { computed, reactive } from 'vue'
import { PropType, reactive } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { COLOR_PANEL } from '../../../util/chart'
import { fieldType } from '@/utils/attr'
import _ from 'lodash'
const { t } = useI18n()
const props = defineProps({
chart: {
type: Object,
type: Object as PropType<ChartObj>,
required: true
},
threshold: {
@ -164,17 +163,17 @@ const valueOptions = [
const predefineColors = COLOR_PANEL
const state = reactive({
thresholdArr: [],
thresholdArr: [] as TableThreshold[],
fields: [],
thresholdObj: {
fieldId: '',
field: {},
conditions: []
}
} as TableThreshold
})
const init = () => {
state.thresholdArr = JSON.parse(JSON.stringify(props.threshold))
state.thresholdArr = JSON.parse(JSON.stringify(props.threshold)) as TableThreshold[]
initFields()
}
const initOptions = item => {
@ -193,33 +192,20 @@ const initOptions = item => {
}
}
const initFields = () => {
//
let fields = []
if (props.chart.type === 'table-info') {
if (Object.prototype.toString.call(props.chart.xAxis) === '[object Array]') {
state.fields = JSON.parse(JSON.stringify(props.chart.xAxis))
} else {
state.fields = JSON.parse(props.chart.xAxis)
}
fields = JSON.parse(JSON.stringify(props.chart.xAxis))
} else if (props.chart.type === 'table-pivot') {
if (Object.prototype.toString.call(props.chart.yAxis) === '[object Array]') {
state.fields = JSON.parse(JSON.stringify(props.chart.yAxis))
} else {
state.fields = JSON.parse(props.chart.yAxis)
}
const xAxis = JSON.parse(JSON.stringify(props.chart.xAxis))
const xAxisExt = JSON.parse(JSON.stringify(props.chart.xAxisExt))
const yAxis = JSON.parse(JSON.stringify(props.chart.yAxis))
fields = [...xAxis, ...xAxisExt, ...yAxis]
} else {
if (Object.prototype.toString.call(props.chart.xAxis) === '[object Array]') {
state.fields = state.fields.concat(JSON.parse(JSON.stringify(props.chart.xAxis)))
} else {
state.fields = state.fields.concat(JSON.parse(props.chart.xAxis))
}
if (Object.prototype.toString.call(props.chart.yAxis) === '[object Array]') {
state.fields = state.fields.concat(JSON.parse(JSON.stringify(props.chart.yAxis)))
} else {
state.fields = state.fields.concat(JSON.parse(props.chart.yAxis))
}
const xAxis = JSON.parse(JSON.stringify(props.chart.xAxis))
const yAxis = JSON.parse(JSON.stringify(props.chart.yAxis))
fields = [...xAxis, ...yAxis]
}
//
// this.fields = this.fields.filter(ele => ele.deType !== 1)
state.fields.splice(0, state.fields.length, ...fields)
}
const addThreshold = () => {
state.thresholdArr.push(JSON.parse(JSON.stringify(state.thresholdObj)))
@ -243,9 +229,6 @@ const removeCondition = (item, index) => {
changeThreshold()
}
const computedFields = computed(() => {
return _.filter(state.fields, f => f.deType === 2 || f.deType === 3)
})
const addField = item => {
// get field
if (state.fields && state.fields.length > 0) {
@ -280,7 +263,7 @@ init()
<el-select v-model="fieldItem.fieldId" @change="addField(fieldItem)">
<el-option
class="series-select-option"
v-for="fieldOption in computedFields"
v-for="fieldOption in state.fields"
:key="fieldOption.id"
:label="fieldOption.name"
:value="fieldOption.id"
@ -344,10 +327,19 @@ init()
>
<el-form-item class="form-item">
<el-input-number
controls-position="right"
v-model="item.value"
class="value-item"
v-if="[2, 3].includes(fieldItem.field.deType)"
:placeholder="t('chart.drag_block_label_value')"
controls-position="right"
class="value-item"
clearable
@change="changeThreshold"
/>
<el-input
v-model="item.value"
v-else
:placeholder="t('chart.drag_block_label_value')"
controls-position="right"
clearable
@change="changeThreshold"
/>
@ -355,14 +347,16 @@ init()
</el-col>
<el-col v-if="item.term === 'between'" :span="4" style="text-align: center">
<el-input-number
v-model="item.min"
controls-position="right"
class="between-item"
:placeholder="t('chart.axis_value_min')"
clearable
@change="changeThreshold"
/>
<el-form-item class="form-item">
<el-input-number
v-model="item.min"
controls-position="right"
class="between-item"
:placeholder="t('chart.axis_value_min')"
clearable
@change="changeThreshold"
/>
</el-form-item>
</el-col>
<el-col v-if="item.term === 'between'" :span="2" style="text-align: center">
@ -372,43 +366,49 @@ init()
</el-col>
<el-col v-if="item.term === 'between'" :span="4" style="text-align: center">
<el-input-number
v-model="item.max"
controls-position="right"
class="between-item"
:placeholder="t('chart.axis_value_max')"
clearable
@change="changeThreshold"
/>
<el-form-item class="form-item">
<el-input-number
v-model="item.max"
controls-position="right"
class="between-item"
:placeholder="t('chart.axis_value_max')"
clearable
@change="changeThreshold"
/>
</el-form-item>
</el-col>
<div
style="display: flex; align-items: center; justify-content: center; margin-left: 8px"
>
<div class="color-title">{{ t('chart.textColor') }}</div>
<el-color-picker
is-custom
size="large"
v-model="item.color"
show-alpha
class="color-picker-style"
:predefine="predefineColors"
@change="changeThreshold"
/>
<el-form-item class="form-item">
<el-color-picker
is-custom
size="large"
v-model="item.color"
show-alpha
class="color-picker-style"
:predefine="predefineColors"
@change="changeThreshold"
/>
</el-form-item>
</div>
<div
style="display: flex; align-items: center; justify-content: center; margin-left: 8px"
>
<div class="color-title">{{ t('chart.backgroundColor') }}</div>
<el-color-picker
is-custom
size="large"
v-model="item.backgroundColor"
show-alpha
class="color-picker-style"
:predefine="predefineColors"
@change="changeThreshold"
/>
<el-form-item class="form-item">
<el-color-picker
is-custom
size="large"
v-model="item.backgroundColor"
show-alpha
class="color-picker-style"
:predefine="predefineColors"
@change="changeThreshold"
/>
</el-form-item>
</div>
<div
style="display: flex; align-items: center; justify-content: center; margin-left: 8px"

View File

@ -9,6 +9,7 @@ import {
} from '@/views/chart/components/js/panel/charts/bar/common'
import { cloneDeep, defaultTo } from 'lodash-es'
import { valueFormatter } from '@/views/chart/components/js/formatter'
import { Options } from '@antv/g2plot/esm'
const { t } = useI18n()
@ -38,6 +39,7 @@ export class ProgressBar extends G2PlotChartView<BarOptions, G2Progress> {
'tooltip-selector',
'y-axis-selector',
'title-selector',
'function-cfg',
'jump-set',
'linkage'
]
@ -45,10 +47,11 @@ export class ProgressBar extends G2PlotChartView<BarOptions, G2Progress> {
...BAR_EDITOR_PROPERTY_INNER,
'legend-selector': null,
'background-overall-component': ['all'],
'basic-style-selector': ['colors', 'gradient'],
'basic-style-selector': ['colors', 'alpha', 'gradient'],
'label-selector': ['hPosition', 'color', 'fontSize'],
'tooltip-selector': ['fontSize', 'color', 'backgroundColor', 'tooltipFormatter'],
'y-axis-selector': ['name', 'color', 'fontSize', 'axisForm', 'axisLabel', 'position']
'y-axis-selector': ['name', 'color', 'fontSize', 'axisForm', 'axisLabel', 'position'],
'function-cfg': ['emptyDataStrategy']
}
axis: AxisType[] = [...BAR_AXIS_TYPE, 'yAxisExt']
protected baseOptions: BarOptions = {
@ -133,18 +136,14 @@ export class ProgressBar extends G2PlotChartView<BarOptions, G2Progress> {
const basicStyle = parseJson(chart.customAttr).basicStyle
let color1 = basicStyle.colors?.map((ele, index) => {
if (index === 1) {
return hexColorToRGBA(ele, 10)
return hexColorToRGBA(ele, basicStyle.alpha > 10 ? 10 : basicStyle.alpha)
} else {
return ele
return hexColorToRGBA(ele, basicStyle.alpha)
}
})
if (basicStyle.gradient) {
color1 = color1.map((ele, index) => {
if (index === 1) {
return ele
}
const tmp = hexColorToRGBA(ele, basicStyle.alpha)
return setGradientColor(tmp, true, 0)
color1 = color1.map((ele, _index) => {
return setGradientColor(ele, true, 0)
})
}
options = {
@ -186,7 +185,7 @@ export class ProgressBar extends G2PlotChartView<BarOptions, G2Progress> {
const result = []
originalItems.forEach(item => {
if (item.data) {
const value = valueFormatter(item.data.originalValue, tooltipAttr.tooltipFormatter)
const value = valueFormatter(item.data.value, tooltipAttr.tooltipFormatter)
if (item.data.id === yAxis.id) {
result.push({
...item,
@ -275,6 +274,41 @@ export class ProgressBar extends G2PlotChartView<BarOptions, G2Progress> {
}
}
protected configEmptyDataStrategy(chart: Chart, options: BarOptions): BarOptions {
const { data } = options as unknown as Options
if (!data?.length) {
return options
}
const strategy = parseJson(chart.senior).functionCfg.emptyDataStrategy
if (strategy === 'ignoreData') {
const emptyFields = data.filter(obj => obj['value'] === null).map(obj => obj['field'])
return {
...options,
data: data.filter(obj => {
if (emptyFields.includes(obj['field'])) {
return false
}
return true
})
}
}
if (strategy === 'breakLine') {
data.forEach(obj => {
if (obj['value'] === null) {
obj['value'] = null
}
})
}
if (strategy === 'setZero') {
data.forEach(obj => {
if (obj['value'] === null) {
obj['value'] = 0
}
})
}
return options
}
protected setupOptions(chart: Chart, options: BarOptions): BarOptions {
return flow(
this.configTheme,
@ -282,7 +316,8 @@ export class ProgressBar extends G2PlotChartView<BarOptions, G2Progress> {
this.configLabel,
this.configTooltip,
this.configLegend,
this.configYAxis
this.configYAxis,
this.configEmptyDataStrategy
)(chart, options)
}

View File

@ -393,28 +393,51 @@ export function getConditions(chart: Chart) {
}
const conditions = threshold.tableThreshold ?? []
const dimFields = [...chart.xAxis, ...chart.xAxisExt].map(i => i.dataeaseName)
if (conditions?.length > 0) {
const { tableCell, basicStyle } = parseJson(chart.customAttr)
const valueColor = tableCell.tableFontColor
let valueBgColor = hexColorToRGBA(tableCell.tableItemBgColor, basicStyle.alpha)
const { tableCell, basicStyle, tableHeader } = parseJson(chart.customAttr)
const enableTableCrossBG = tableCell.enableTableCrossBG
if (enableTableCrossBG) {
valueBgColor = null
}
const valueColor = tableCell.tableFontColor
const valueBgColor = enableTableCrossBG
? null
: hexColorToRGBA(tableCell.tableItemBgColor, basicStyle.alpha)
const headerValueColor = tableHeader.tableHeaderFontColor
const headerValueBgColor = hexColorToRGBA(tableHeader.tableHeaderBgColor, basicStyle.alpha)
for (let i = 0; i < conditions.length; i++) {
const field = conditions[i]
let defaultValueColor = valueColor
let defaultBgColor = valueBgColor
// 透视表表头颜色配置
if (chart.type === 'table-pivot' && dimFields.includes(field.field.dataeaseName)) {
defaultValueColor = headerValueColor
defaultBgColor = headerValueBgColor
}
res.text.push({
field: field.field.dataeaseName,
mapping(value) {
mapping(value, rowData) {
// 总计小计
if (rowData?.isTotals) {
return null
}
// 表头
if (rowData?.id && rowData?.field === rowData.id) {
return null
}
return {
fill: mappingColor(value, valueColor, field, 'color')
fill: mappingColor(value, defaultValueColor, field, 'color')
}
}
})
res.background.push({
field: field.field.dataeaseName,
mapping(value) {
const fill = mappingColor(value, valueBgColor, field, 'backgroundColor')
mapping(value, rowData) {
if (rowData?.isTotals) {
return null
}
if (rowData?.id && rowData?.field === rowData.id) {
return null
}
const fill = mappingColor(value, defaultBgColor, field, 'backgroundColor')
return fill ? { fill } : null
}
})

View File

@ -3,6 +3,7 @@ import { onMounted, reactive, ref, toRefs, watch, nextTick, computed } from 'vue
import { copyResource, deleteLogic, ResourceOrFolder } from '@/api/visualization/dataVisualization'
import { ElIcon, ElMessage, ElMessageBox, ElScrollbar } from 'element-plus-secondary'
import { Icon } from '@/components/icon-custom'
import { useEmitt } from '@/hooks/web/useEmitt'
import { HandleMore } from '@/components/handle-more'
import DeResourceGroupOpt from '@/views/common/DeResourceGroupOpt.vue'
import { useEmbedded } from '@/store/modules/embedded'
@ -283,11 +284,23 @@ const operation = (cmd: string, data: BusiTreeNode, nodeType: string) => {
curCanvasType.value === 'dataV'
? `#/dvCanvas?opt=copy&pid=${params.pid}&dvId=${data.data}`
: `#/dashboard?opt=copy&pid=${params.pid}&resourceId=${data.data}`
let embeddedBaseUrl = ''
if (isDataEaseBi.value) {
embeddedBaseUrl = embeddedStore.baseUrl
embeddedStore.clearState()
embeddedStore.setPid(params.pid as string)
embeddedStore.setOpt('copy')
if (curCanvasType.value === 'dataV') {
embeddedStore.setDvId(data.data)
} else {
embeddedStore.setResourceId(data.data)
}
useEmitt().emitter.emit(
'changeCurrentComponent',
curCanvasType.value === 'dataV' ? 'VisualizationEditor' : 'Dashboard'
)
return
}
const newWindow = window.open(embeddedBaseUrl + baseUrl, '_blank')
const newWindow = window.open(baseUrl, '_blank')
initOpenHandler(newWindow)
})
} else {
@ -306,14 +319,22 @@ const addOperation = (
const baseUrl =
curCanvasType.value === 'dataV' ? '#/dvCanvas?opt=create' : '#/dashboard?opt=create'
let newWindow = null
let embeddedBaseUrl = ''
if (isDataEaseBi.value) {
embeddedBaseUrl = embeddedStore.baseUrl
embeddedStore.clearState()
embeddedStore.setOpt('create')
if (data?.id) {
embeddedStore.setPid(data?.id as string)
}
useEmitt().emitter.emit(
'changeCurrentComponent',
curCanvasType.value === 'dataV' ? 'VisualizationEditor' : 'Dashboard'
)
return
}
if (data?.id) {
newWindow = window.open(embeddedBaseUrl + baseUrl + `&pid=${data.id}`, '_blank')
newWindow = window.open(baseUrl + `&pid=${data.id}`, '_blank')
} else {
newWindow = window.open(embeddedBaseUrl + baseUrl, '_blank')
newWindow = window.open(baseUrl, '_blank')
}
initOpenHandler(newWindow)
} else if (cmd === 'newFromTemplate') {
@ -334,11 +355,20 @@ function createNewObject() {
const resourceEdit = resourceId => {
const baseUrl = curCanvasType.value === 'dataV' ? '#/dvCanvas?dvId=' : '#/dashboard?resourceId='
let embeddedBaseUrl = ''
if (isDataEaseBi.value) {
embeddedBaseUrl = embeddedStore.baseUrl
embeddedStore.clearState()
if (curCanvasType.value === 'dataV') {
embeddedStore.setDvId(resourceId)
} else {
embeddedStore.setResourceId(resourceId)
}
useEmitt().emitter.emit(
'changeCurrentComponent',
curCanvasType.value === 'dataV' ? 'VisualizationEditor' : 'Dashboard'
)
return
}
const newWindow = window.open(embeddedBaseUrl + baseUrl + resourceId, '_blank')
const newWindow = window.open(baseUrl + resourceId, '_blank')
initOpenHandler(newWindow)
}
@ -354,14 +384,23 @@ const resourceCreateFinish = templateData => {
? '#/dvCanvas?opt=create&createType=template'
: '#/dashboard?opt=create&createType=template'
let newWindow = null
let embeddedBaseUrl = ''
if (isDataEaseBi.value) {
embeddedBaseUrl = embeddedStore.baseUrl
embeddedStore.clearState()
embeddedStore.setOpt('create')
embeddedStore.setCreateType('template')
if (state.templateCreatePid) {
embeddedStore.setPid(state.templateCreatePid as unknown as string)
}
useEmitt().emitter.emit(
'changeCurrentComponent',
curCanvasType.value === 'dataV' ? 'VisualizationEditor' : 'Dashboard'
)
return
}
if (state.templateCreatePid) {
newWindow = window.open(embeddedBaseUrl + baseUrl + `&pid=${state.templateCreatePid}`, '_blank')
newWindow = window.open(baseUrl + `&pid=${state.templateCreatePid}`, '_blank')
} else {
newWindow = window.open(embeddedBaseUrl + baseUrl, '_blank')
newWindow = window.open(baseUrl, '_blank')
}
initOpenHandler(newWindow)
}

View File

@ -34,7 +34,7 @@ const canvasCacheOutRef = ref(null)
const eventCheck = e => {
if (e.key === 'panel-weight' && !compareStorage(e.oldValue, e.newValue)) {
const resourceId = embeddedStore.resourceId || router.currentRoute.value.query.resourceId
const { opt } = router.currentRoute.value.query
const opt = embeddedStore.opt || router.currentRoute.value.query.opt
if (!(opt && opt === 'create')) {
check(wsCache.get('panel-weight'), resourceId as string, 4)
}
@ -163,7 +163,10 @@ onMounted(async () => {
window.addEventListener('storage', eventCheck)
const resourceId = embeddedStore.resourceId || router.currentRoute.value.query.resourceId
const pid = embeddedStore.pid || router.currentRoute.value.query.pid
const { opt, createType, templateParams } = router.currentRoute.value.query
const opt = embeddedStore.opt || router.currentRoute.value.query.opt
const createType = embeddedStore.createType || router.currentRoute.value.query.createType
const templateParams =
embeddedStore.templateParams || router.currentRoute.value.query.templateParams
const checkResult = await checkPer(resourceId)
if (!checkResult) {
return

View File

@ -43,7 +43,7 @@ const embeddedStore = useEmbedded()
const { wsCache } = useCache()
const eventCheck = e => {
if (e.key === 'screen-weight' && !compareStorage(e.oldValue, e.newValue)) {
const { opt } = router.currentRoute.value.query
const opt = embeddedStore.opt || router.currentRoute.value.query.opt
if (!(opt && opt === 'create')) {
check(
wsCache.get('screen-weight'),
@ -270,7 +270,10 @@ onMounted(async () => {
}
const dvId = embeddedStore.dvId || router.currentRoute.value.query.dvId
const pid = embeddedStore.pid || router.currentRoute.value.query.pid
const { opt, createType, templateParams } = router.currentRoute.value.query
const templateParams =
embeddedStore.templateParams || router.currentRoute.value.query.templateParams
const createType = embeddedStore.createType || router.currentRoute.value.query.createType
const opt = embeddedStore.opt || router.currentRoute.value.query.opt
const checkResult = await checkPer(dvId)
if (!checkResult) {
return

View File

@ -174,6 +174,7 @@ import { imgUrlTrans } from '@/utils/imgUtils'
import CategoryTemplateV2 from '@/views/template-market/component/CategoryTemplateV2.vue'
import { interactiveStoreWithOut } from '@/store/modules/interactive'
import { XpackComponent } from '@/components/plugin'
import { useEmitt } from '@/hooks/web/useEmitt'
import { Base64 } from 'js-base64'
const { t } = useI18n()
const { wsCache } = useCache()
@ -434,14 +435,29 @@ const apply = template => {
'&templateParams=' +
encodeURIComponent(Base64.encode(JSON.stringify(templateTemplate)))
let newWindow = null
let embeddedBaseUrl = ''
if (isDataEaseBi.value) {
embeddedBaseUrl = embeddedStore.baseUrl
embeddedStore.clearState()
embeddedStore.setCreateType('template')
embeddedStore.setTemplateParams(
encodeURIComponent(Base64.encode(JSON.stringify(templateTemplate)))
)
embeddedStore.setOpt('create')
if (state.pid) {
embeddedStore.setPid(state.pid)
}
useEmitt().emitter.emit(
'changeCurrentComponent',
['dataV', 'SCREEN'].includes(state.dvCreateForm.nodeType)
? 'VisualizationEditor'
: 'Dashboard'
)
return
}
if (state.pid) {
newWindow = window.open(embeddedBaseUrl + baseUrl + `&pid=${state.pid}`, '_blank')
newWindow = window.open(baseUrl + `&pid=${state.pid}`, '_blank')
} else {
newWindow = window.open(embeddedBaseUrl + baseUrl, '_blank')
newWindow = window.open(baseUrl, '_blank')
}
initOpenHandler(newWindow)
}

View File

@ -693,7 +693,10 @@ defineExpose({
<el-option v-for="item in schemas" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
<el-form-item :label="t('datasource.extra_params')">
<el-form-item
:label="t('datasource.extra_params')"
v-if="form.configuration.urlType !== 'jdbcUrl'"
>
<el-input
:placeholder="t('common.inputText') + t('datasource.extra_params')"
v-model="form.configuration.extraParams"
@ -760,7 +763,7 @@ defineExpose({
/>
</el-form-item>
<el-form-item
v-if="form.type == 'oracle'"
v-if="form.type == 'oracle' && form.configuration.urlType !== 'jdbcUrl'"
:label="t('datasource.connection_mode')"
prop="configuration.connectionType"
>