fix: 修复禅道bug

This commit is contained in:
huanghao1412 2024-03-04 18:25:47 +08:00
parent 69003012ae
commit 33a36f3aad
12 changed files with 99 additions and 19 deletions

View File

@ -95,8 +95,13 @@ export const option = {
const { name, value, unit, showValue } = param.data const { name, value, unit, showValue } = param.data
let str = '' let str = ''
if(showPercent) str += `${showValue * 100}%` if(typeof showValue === 'number') {
else str += showUnit ? `${showValue}${unit}` : showValue if(showPercent) str += `${showValue * 100}%`
else str += showUnit ? `${showValue}${unit}` : showValue
}
else {
str += '--'
}
str += '\n' str += '\n'
if(showSubText) str += name if(showSubText) str += name

View File

@ -29,7 +29,11 @@ const option = {
type: 'ring', type: 'ring',
tooltip: { tooltip: {
show: true, show: true,
trigger: 'item' trigger: 'item',
formatter: (params: any) => {
let str = `${params.seriesName}<br/>${params.marker}${params.name}`
return str
}
}, },
legend: { legend: {
show: true show: true

View File

@ -94,6 +94,7 @@ const fontWeightOptions = [
const labelFormatterOptions = [ const labelFormatterOptions = [
{ label: '数据名', value: '{b}' }, { label: '数据名', value: '{b}' },
{ label: '百分比', value: '{d}' }, { label: '百分比', value: '{d}' },
{ label: '列名:百分比', value: '{b}:{d}%' } { label: '列名:百分比', value: '{b}:{d}%' },
{ label: '列名:数值', value: '{b}:{@[1]}' },
] ]
</script> </script>

View File

@ -152,6 +152,26 @@ watch(
// }) // })
const { vChartRef } = useChartCommonData(props.chartConfig, useChartEditStore) const { vChartRef } = useChartCommonData(props.chartConfig, useChartEditStore)
watch(
() => props.chartConfig.option.dataset,
(v) => {
v.source.forEach((item: {[k: string]: any}) => {
let k = v.dimensions[0]
let k1 = v.dimensions[1]
if(item[k].split(' ').length < 2) {
item[k] += ` ${item[k1]}`
}
})
if(vChartRef.value) {
vChartRef.value.setOption({
dataset: v
})
}
},
{
deep: true
}
)
onMounted(() => { onMounted(() => {
seriesDataMaxLength = dataJson.source.length seriesDataMaxLength = dataJson.source.length

View File

@ -36,7 +36,7 @@ export const option = {
// align: [], // align: [],
rowNum: 5, rowNum: 5,
waitTime: 2, waitTime: 2,
headerHeight: 35, headerHeight: null,
carousel: 'single', carousel: 'single',
headerBGC: '#00BAFF', headerBGC: '#00BAFF',
oddRowBGC: '#003B51', oddRowBGC: '#003B51',

View File

@ -68,7 +68,7 @@
</n-space> </n-space>
</SettingItem> </SettingItem>
<SettingItem name="字段"> <SettingItem name="字段">
<n-text style="height: 28px;line-height: 28px">{{item.key ? item.key : '--'}}</n-text> <n-text style="height: 28px;line-height: 28px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden" :title="item.key ? item.key : '--'">{{item.key ? item.key : '--'}}</n-text>
</SettingItem> </SettingItem>
<SettingItem name="标题"> <SettingItem name="标题">
<n-input v-model:value="item.header" size="small" clearable/> <n-input v-model:value="item.header" size="small" clearable/>

View File

@ -5,16 +5,17 @@
v-if="status.header.length && status.mergedConfig" v-if="status.header.length && status.mergedConfig"
:style="`background-color: ${status.mergedConfig.headerBGC};`" :style="`background-color: ${status.mergedConfig.headerBGC};`"
> >
<!-- line-height: ${status.mergedConfig.headerHeight}px;-->
<div <div
class="header-item" class="header-item"
v-for="(headerItem, i) in status.header" v-for="(headerItem, i) in status.header"
:key="`${headerItem}${i}`" :key="`${headerItem}${i}`"
:style="` :style="`
height: ${status.mergedConfig.headerHeight}px; height: ${status.mergedConfig.headerHeight}px;
line-height: ${status.mergedConfig.headerHeight}px;
width: ${status.widths[i]}px; width: ${status.widths[i]}px;
`" `"
:align="status.aligns[i]" :align="status.aligns[i]"
:title="headerItem"
v-html="headerItem" v-html="headerItem"
/> />
</div> </div>
@ -390,11 +391,13 @@ onUnmounted(() => {
.header { .header {
display: flex; display: flex;
align-items: center;
flex-direction: row; flex-direction: row;
font-size: 15px; font-size: 15px;
.header-item { .header-item {
transition: all 0.3s; transition: all 0.3s;
overflow: hidden;
} }
} }
@ -406,6 +409,11 @@ onUnmounted(() => {
font-size: 14px; font-size: 14px;
transition: all 0.3s; transition: all 0.3s;
overflow: hidden; overflow: hidden;
.ceil{
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
} }
} }
} }

View File

@ -39,6 +39,7 @@ import { CreateComponentType } from '@/packages/index.d'
import { icon } from '@/plugins' import { icon } from '@/plugins'
import {useChartCommonData} from "@/hooks"; import {useChartCommonData} from "@/hooks";
import {useChartEditStore} from "@/store/modules/chartEditStore/chartEditStore"; import {useChartEditStore} from "@/store/modules/chartEditStore/chartEditStore";
import { isPreview } from '@/utils'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
const props = defineProps({ const props = defineProps({
@ -79,7 +80,7 @@ watch(
() => props.chartConfig.option.dataset, () => props.chartConfig.option.dataset,
(newData: any) => { (newData: any) => {
option.dataset = newData option.dataset = newData
option.header.value = newData.dimensions if(!isPreview()) option.header.value = newData.dimensions
option.header.options = newData.dimensions option.header.options = newData.dimensions
newData.dimensions.forEach((key: string) => { newData.dimensions.forEach((key: string) => {
if(!Object.prototype.hasOwnProperty.call(option.header.map, key)) option.header.map[key] = key if(!Object.prototype.hasOwnProperty.call(option.header.map, key)) option.header.map[key] = key

View File

@ -6,7 +6,7 @@ import designColor from './designColor.json'
export const lang = LangEnum.ZH export const lang = LangEnum.ZH
// 水印文字 // 水印文字
export const watermarkText = "GoView 低代码平台" export const watermarkText = ""
// 分组名称 // 分组名称
export const groupTitle = "分组" export const groupTitle = "分组"

View File

@ -9,7 +9,7 @@
<n-input <n-input
v-model:value="currentObj.space_complete_id" v-model:value="currentObj.space_complete_id"
size="small" size="small"
placeholder="请输入测点ID" placeholder="请输入空间ID"
clearable clearable
/> />
</n-space> </n-space>

View File

@ -5,7 +5,7 @@
</n-space> </n-space>
</setting-item-box> </setting-item-box>
<setting-item-box name="告警确认" :alone="true"> <setting-item-box name="告警确认" :alone="true">
<n-select multiple v-model:value="target.confirm_statuses" :options="options1" size="small"/> <n-select multiple v-model:value="target.confirm_statuses" :options="options0" size="small"/>
</setting-item-box> </setting-item-box>
<setting-item-box name="告警恢复" :alone="true"> <setting-item-box name="告警恢复" :alone="true">
<n-select multiple v-model:value="target.recovery_statuses" :options="options1" size="small"/> <n-select multiple v-model:value="target.recovery_statuses" :options="options1" size="small"/>
@ -26,6 +26,7 @@ import {useTargetData} from '../../hooks/useTargetData.hook'
import {DateOptions, PolicyOptions} from './ComponentsType.d' import {DateOptions, PolicyOptions} from './ComponentsType.d'
import {icon} from '@/plugins/icon' import {icon} from '@/plugins/icon'
import {commonDataType, MonthAlarmClassType} from '@/store/modules/chartEditStore/chartEditStore.d' import {commonDataType, MonthAlarmClassType} from '@/store/modules/chartEditStore/chartEditStore.d'
import { useOriginStore } from '@/store/modules/originStore/originStore'
const {CloseIcon, AddIcon} = icon.ionicons5 const {CloseIcon, AddIcon} = icon.ionicons5
@ -42,18 +43,59 @@ type computeIdsItemType = {
value: number | null value: number | null
} }
const originStore = useOriginStore()
const systemConstant = originStore.getOriginStore?.user?.systemConstant
let options2
if(systemConstant.warn_levels) {
type ItemType = {
label: string,
value: string,
remark: string
}
options2 = systemConstant['warn_levels'].filter((item: ItemType) => item.value !== '').map((item: any) => {
return { label: item.label, value: Number(item.value), remark: item.remark }
})
}
const systemConfig = originStore.getOriginStore?.user?.systemConfig
target.value.levels = []
for (let i = 1; i <= Number(systemConfig.history_alarm_level); i++) {
target.value.levels.push(i)
}
const options1 = [ const options1 = [
{label: 'ok', value: 'ok'}, {label: '已恢复', value: 'ok'},
{label: 'not', value: 'not'}, {label: '未回复', value: 'not'},
] ]
const options2 = [ target.value.recovery_statuses = []
{label: 1, value: 1}, if (typeof (systemConfig.history_alarm_recovery_status) !== 'undefined') {
{label: 2, value: 2}, for (const item of JSON.parse(systemConfig.history_alarm_recovery_status)) {
{label: 3, value: 3}, target.value.recovery_statuses.push(item)
{label: 4, value: 4}, }
}
const options0 = [
{label: '已确认', value: 'ok'},
{label: '未确认', value: 'not'},
] ]
target.value.confirm_statuses = []
if (typeof (systemConfig.history_alarm_confirm_status) !== 'undefined') {
for (const item of JSON.parse(systemConfig.history_alarm_confirm_status)) {
target.value.confirm_statuses.push(item)
}
}
// const options2 = [
// {label: 1, value: 1},
// {label: 2, value: 2},
// {label: 3, value: 3},
// {label: 4, value: 4},
// ]
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -236,7 +236,6 @@ const handleContextMenu = (
targetInstance targetInstance
) )
} }
console.log(menuOptions.value)
nextTick().then(() => { nextTick().then(() => {
chartEditStore.setMousePosition(e.clientX, e.clientY) chartEditStore.setMousePosition(e.clientX, e.clientY)
chartEditStore.setRightMenuShow(true) chartEditStore.setRightMenuShow(true)