config.vue 2.65 KB
<template>
  <CollapseItem v-for="(item, index) in seriesList" :key="index" :name="t('charts.chart.waterPolo')" :expanded="true">
    <SettingItemBox :name="t('common.contentText')">
      <SettingItem :name="t('common.numericalText')">
        <n-input-number
          v-model:value="optionData.dataset"
          :min="0"
          :step="0.01"
          size="small"
          :placeholder="t('charts.chart.waterBalvalue')"
        ></n-input-number>
      </SettingItem>
      <SettingItem :name="t('common.shapeText')">
        <n-select v-model:value="item.shape" :options="shapes" placeholder="选择形状" />
      </SettingItem>
      <SettingItem :name="t('common.textText')">
        <n-input-number
          v-model:value="item.label.normal.textStyle.fontSize"
          :min="0"
          :step="1"
          size="small"
          placeholder="文字大小"
        >
        </n-input-number>
      </SettingItem>
      <SettingItem :name="t('charts.chart.color1')">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="item.color[0].colorStops[0].color"
        ></n-color-picker>
      </SettingItem>
      <SettingItem :name="t('charts.chart.color2')">
        <n-color-picker
          size="small"
          :modes="['hex']"
          v-model:value="item.color[0].colorStops[1].color"
        ></n-color-picker>
      </SettingItem>
    </SettingItemBox>
    <SettingItemBox :name="t('common.backgroundText')" :alone="true">
      <SettingItem>
        <n-color-picker size="small" :modes="['hex']" v-model:value="item.backgroundStyle.color"></n-color-picker>
      </SettingItem>
    </SettingItemBox>
  </CollapseItem>
</template>

<script setup lang="ts">
import { PropType, computed } from 'vue'
// import { option, shapes } from './config'
import { option } from './config'
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'

const props = defineProps({
  optionData: {
    type: Object as PropType<typeof option>,
    required: true
  }
})

const t = window['$t']

const seriesList = computed(() => {
  return props.optionData.series
})

const shapes = [
  {
    label: t('common.symbolEnumList.circle'),
    value: 'circle'
  },
  {
    label: t('common.symbolEnumList.rect'),
    value: 'rect'
  },
  {
    label: t('common.symbolEnumList.roundRect'),
    value: 'roundRect'
  },
  {
    label: t('common.symbolEnumList.ascending'),
    value: 'triangle'
  },
  {
    label: t('common.symbolEnumList.diamond'),
    value: 'diamond'
  },
  {
    label: t('common.symbolEnumList.pin'),
    value: 'pin'
  },
  {
    label: t('common.symbolEnumList.arrow'),
    value: 'arrow'
  }
]
</script>