// 添加类型定义
/**
 * @typedef {Object} ChartConfig
 * @property {string} type - 图表类型
 * @property {string[]} chartsTools - 图表工具
 * @property {string} dataSource - 数据源
 * @property {string} xField - 横轴字段
 * @property {string} xFieldSortBy - 排序依据
 * @property {string} xFieldSortType - 排序方式
 * @property {string} yFieldType - 纵轴类型
 * @property {Array<{field: string, mold: string}>} yField - 纵轴字段
 */

export const colorItems = [
  [
    { label: '', color: '#3371EC' },
    { label: '', color: '#1CCEC0' },
    { label: '', color: '#FFC60A' },
    { label: '', color: '#ED6D0C' },
    { label: '', color: '#DCA1E5' },
    { label: '', color: '#25B2E7' }
  ],
  [
    { label: '', color: '#F5222D' },
    { label: '', color: '#FA541C' },
    { label: '', color: '#FA8C16' },
    { label: '', color: '#FAAD14' },
    { label: '', color: '#FADB14' },
    { label: '', color: '#A0D911' }
  ],
  [
    { label: '', color: '#52C41A' },
    { label: '', color: '#13C2C2' },
    { label: '', color: '#1890FF' },
    { label: '', color: '#2F54EB' },
    { label: '', color: '#722ED1' },
    { label: '', color: '#EB2F96' }
  ],
  [
    { label: '', color: '#0F58FF' },
    { label: '', color: '#2B6BFF' },
    { label: '', color: '#467EFF' },
    { label: '', color: '#6392FE' },
    { label: '', color: '#81A6FF' },
    { label: '', color: '#B7CDFF' }
  ],
  [
    { label: '', color: '#34C623' },
    { label: '', color: '#44DB34' },
    { label: '', color: '#62E153' },
    { label: '', color: '#80E774' },
    { label: '', color: '#9DEC93' },
    { label: '', color: '#D7F6D4' }
  ],
  [
    { label: '', color: '#FF8800' },
    { label: '', color: '#FF951D' },
    { label: '', color: '#FFA33B' },
    { label: '', color: '#FFAF56' },
    { label: '', color: '#FFBE74' },
    { label: '', color: '#FFD8AD' }
  ],
  [
    { label: '', color: '#FF160F' },
    { label: '', color: '#FE322B' },
    { label: '', color: '#FF4E48' },
    { label: '', color: '#FE6962' },
    { label: '', color: '#FF847F' },
    { label: '', color: '#FFB9B7' }
  ],
  [
    { label: '', color: '#000000' },
    { label: '', color: '#222222' },
    { label: '', color: '#444444' },
    { label: '', color: '#666666' },
    { label: '', color: '#888888' },
    { label: '', color: '#CCCCCC' }
  ],
  [
    { label: '', color: '#2A004E' },
    { label: '', color: '#500073' },
    { label: '', color: '#C62300' },
    { label: '', color: '#F14A00' },
    { label: '', color: '#FFC145' },
    { label: '', color: '#ECE852' }
  ],
  [
    { label: '', color: '#7C444F' },
    { label: '', color: '#9F5255' },
    { label: '', color: '#DF6D2D' },
    { label: '', color: '#F39E60' },
    { label: '', color: '#F87A53' },
    { label: '', color: '#E6C767' }
  ]
]

export const chartsTools = [
  { label: '图例', value: 'legend', match: 'line,bar,pie' },
  { label: '数据标签', value: 'label', match: 'line,bar,pie' },
  { label: '坐标轴', value: 'xyVisible', match: 'line,bar' },
  { label: '数据点', value: 'point', match: 'line' },
  { label: '网格线', value: 'grid', match: 'line,bar' }
]

export const dataSourceOptions = [
  { label: '当前CRUD', value: 'curCrud' },
  { label: '业务逻辑', value: 'Logic' },
  { label: 'api', value: 'api', disabled: true }
]

export const tabList = [{
  key: '类型与数据',
  tab: '类型与数据',
}, {
  key: '自定义样式',
  tab: '自定义样式',
}]

export const chartTypes = [
  { label: '折线图', value: 'line', icon: 'line-chart', type: 'icon' },
  { label: '柱状图', value: 'bar', icon: 'bar-chart', type: 'icon' },
  { label: '圆饼图', value: 'pie', icon: 'pie-chart', type: 'icon' }]

export const sortBy = [
  {
    value: 'value',
    label: '横轴顺序',
    placeholder: '按照横轴值排序'
  },
  {
    value: 'statistics',
    label: '统计值',
    placeholder: '按照统计值大小排序'
  }
]

export const sortType = [
  { label: '正序', value: 'asc' },
  { label: '倒序', value: 'desc' }
]

export const yValueType = [
  {
    label: '统计字段数值',
    value: 'sum',
    molds: [{ label: '求和', value: 'sum' },
      { label: '最大值', value: 'max' },
      { label: '最小值', value: 'min' },
      { label: '平均值', value: 'avg' },
    ]
  },
  {
    label: '统计记录总数',
    value: 'count'
  }
]

// 数据字段操作选项
export const operationOptions = [
  { label: '删除', value: 'delete', icon: 'delete' },
  { label: '上移', value: 'moveUp', icon: 'arrow-up' },
  { label: '下移', value: 'moveDown', icon: 'arrow-down' }
]

// 每种图标的 formLabel 标签不同
export const fromItemLabelMap = {
  bar: {
    xField: '横轴(字段)',
    yFieldType: '纵轴(字段)',
  },
  line: {
    xField: '横轴(字段)',
    yFieldType: '纵轴(字段)',
  },
  pie: {
    xField: '扇区分组',
    yFieldType: '扇区数值',
  }
}

export const demoColumn = [{
  label: '用户姓名',
  value: 'f_user_name',
}, {
  label: '用户编号',
  value: 'f_userinfo_code',
}, {
  label: '用户类型',
  value: 'f_user_type',
}, {
  label: '收款方式',
  value: 'f_payment',
}, {
  label: '收款金额',
  value: 'f_collection',
}, {
  label: '收款公司',
  value: 'f_orgname',
}, {
  label: '收款时间',
  value: 'f_operate_date',
}]
