This commit is contained in:
Fine 2024-10-15 15:33:07 +08:00
parent fc09a1f6fb
commit c0eecfc53b
3 changed files with 15 additions and 3 deletions

View File

@ -14,6 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. --> limitations under the License. -->
<template> <template>
<div> <div>
<span class="label">{{ t("contentDecorations") }}</span>
<content-decorations />
</div>
<div class="item">
<span class="label">{{ t("showValues") }}</span> <span class="label">{{ t("showValues") }}</span>
<el-switch <el-switch
v-model="showTableValues" v-model="showTableValues"
@ -37,6 +41,7 @@ limitations under the License. -->
import { ref } from "vue"; import { ref } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
import ContentDecorations from "./components/ContentDecorations.vue";
const { t } = useI18n(); const { t } = useI18n();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();

View File

@ -38,8 +38,9 @@ limitations under the License. -->
import { useDashboardStore } from "@/store/modules/dashboard"; import { useDashboardStore } from "@/store/modules/dashboard";
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const decorations = ref<{ [key: string]: string }>(dashboardStore.selectedGrid.decorations || {}); const graph = dashboardStore.selectedGrid.graph;
const keys = ref<string[]>(dashboardStore.selectedGrid.decorations ? Object.keys(decorations.value) : [""]); const decorations = ref<{ [key: string]: string }>(graph?.decorations || {});
const keys = ref<string[]>(graph.decorations ? Object.keys(decorations.value) : [""]);
function changeKeys(event: any, index: number) { function changeKeys(event: any, index: number) {
const params = event.target.textContent || ""; const params = event.target.textContent || "";

View File

@ -37,7 +37,7 @@ limitations under the License. -->
>{{ k.split("=")[1] }}</div >{{ k.split("=")[1] }}</div
> >
<div class="value-col" v-if="config.showTableValues"> <div class="value-col" v-if="config.showTableValues">
{{ data[(keys as string[]).join(",")][data[(keys as string[]).join(",")].length - 1 || 0] }} {{ getColValue(keys) }}
</div> </div>
</div> </div>
</div> </div>
@ -58,12 +58,14 @@ limitations under the License. -->
showTableValues: boolean; showTableValues: boolean;
tableHeaderCol2: string; tableHeaderCol2: string;
typesOfMQE: string[]; typesOfMQE: string[];
decorations: {};
}>, }>,
default: () => ({ showTableValues: true }), default: () => ({ showTableValues: true }),
}, },
}); });
const { t } = useI18n(); const { t } = useI18n();
const decorations = computed<{ [key: number]: string }>(() => props.config.decorations || {});
const nameWidth = computed(() => (props.config.showTableValues ? 80 : 100)); const nameWidth = computed(() => (props.config.showTableValues ? 80 : 100));
const dataKeys = computed(() => { const dataKeys = computed(() => {
const keys = Object.keys(props.data || {}).filter( const keys = Object.keys(props.data || {}).filter(
@ -73,6 +75,10 @@ limitations under the License. -->
return list; return list;
}); });
function getColValue(keys: string[]) {
const val = props.data[(keys as string[]).join(",")][props.data[(keys as string[]).join(",")].length - 1 || 0];
return decorations.value[val] || val;
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.chart-table { .chart-table {