Commit ddca17e6 by yuwei

项目初始化

parent ea4049f4
export const CELL_MIN_HEIGHT = 38
export const SEPARATOR = ':'
import { SEPARATOR } from './constants'
// Convert path to object
export default (paths, keys) => {
return paths.map(path => {
const pathArr = path.split(SEPARATOR)
const obj = {}
keys.forEach((key, index) => {
if (pathArr[index]) {
obj[key] = pathArr[index]
}
})
return obj
})
}
import { CELL_MIN_HEIGHT } from './constants'
export default count => count * CELL_MIN_HEIGHT + 'px'
import mergeBaseInfo from './merge_base_info'
import convertPathToMap from './convert_path_to_map'
import getHeightByCount from './get_height_by_count'
export {
mergeBaseInfo,
convertPathToMap,
getHeightByCount
}
// merge base info
export default function mergeBaseInfo(info = {}) {
const _baseCellInfo = {
value: '',
x: 0,
y: 0,
colspan: 1,
rowspan: 1
}
return Object.assign({}, _baseCellInfo, info)
}
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<el-tabs type="card"> <el-tabs type="card">
<el-tab-pane label="图表预览"> <el-tab-pane label="图表预览">
<div class="widget-center-pane-chart"> <div class="widget-center-pane-chart">
<chart-panel v-if="visible" id="chartPanel" ref="chartPanel" :chart-schema="widget" :chart-data="[]" /> <chart-panel v-if="visible" id="chartPanel" ref="chartPanel" :chart-schema="widget" :chart-data="chartData.data" />
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="查询脚本"> <el-tab-pane label="查询脚本">
......
<template> <template>
<div ref="chart" :style="chartStyle"> <div ref="chart" :style="chartStyle" style="overflow: auto;">
<my-chart-table :col="tableCol" :data="tableData" /> <pivot-table
ref="pivottable"
:data="data"
:rows="rows"
:columns="columns"
:values="values"
/>
</div> </div>
</template> </template>
<script> <script>
import MyChartTable from './charttable/MyChartTable' import PivotTable from '@/components/PivotTable'
export default { export default {
name: 'ChartTable', name: 'ChartTable',
components: { components: {
MyChartTable PivotTable
}, },
props: { props: {
data: { data: {
...@@ -38,60 +44,34 @@ export default { ...@@ -38,60 +44,34 @@ export default {
} }
}, },
computed: { computed: {
tableCol() { rows() {
return [ return this.chartSchema.rows.map((row, index, arr) => {
{ return {
prop: 'date', key: `${row.col}`,
label: '日期' label: `${row.col}`
}, }
{ })
label: '配送信息', },
children: [ columns() {
{ return this.chartSchema.columns.map((column, index, arr) => {
prop: 'name', return {
label: '姓名' key: `${column.col}`,
}, label: `${column.col}`
{
label: '地址',
children: [
{
prop: 'province',
label: '省份'
},
{
prop: 'city',
label: '市区'
},
{
prop: 'address',
label: '地址'
}
]
}
]
} }
] })
}, },
tableData() { values() {
return [ return this.chartSchema.measures.map((measure, index, arr) => {
{ return {
date: '2016-05-03', key: `${measure.col}`,
name: '王小虎', label: `${measure.col}`
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
},
{
date: '2016-05-02',
name: '王小虎',
province: '上海',
city: '普陀区',
address: '上海市普陀区金沙江路 1518 弄',
zip: 200333
} }
] })
} }
},
created() {
console.log(this.data)
console.log(this.chartSchema)
} }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment