Skip to content

Commit

Permalink
action context, chart dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
szuprefix committed Mar 9, 2021
1 parent 472bb73 commit 87ca4f1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-django",
"version": "0.9.3",
"version": "0.9.4",
"description": "个人实验项目, 本框架的目标是借鉴并超越django admin的自动化思想, 实现UI前端的极简快速定制开发",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/components/form/Widget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<el-switch v-model="value[field.name]" v-else-if="field.widget === 'checkbox'"
@change="fieldValueChanged">
</el-switch>
<el-input-number v-model="value[field.name]" v-else-if="field.widget === 'number'" :disabled="field.disabled"
<el-input-number v-model="value[field.name]" v-else-if="field.widget === 'number'" v-bind="[field]"
controls-position="right" :controls="field.type === 'integer'" @change="fieldValueChanged">
</el-input-number>
<el-date-picker v-model="value[field.name]" :type="field.widget" value-format="yyyy-MM-ddTHH:mm:ss"
Expand Down
6 changes: 3 additions & 3 deletions src/components/layout/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<el-button-group v-if="showActions.length>0">
<template v-for="a in showActions">
<el-button v-bind="[a]" :size="a.size || size" @click="handleCommand(a)"
v-if="!a.show || a.show()" :key="a.name">
v-if="!a.show || a.show(context)" :key="a.name">
<i :class="getIconClass(a.icon)" v-if="a.icon"></i>{{a.label}}
</el-button>
</template>
Expand All @@ -12,7 +12,7 @@
</span>
<el-dropdown-menu slot="dropdown">
<template v-for="a in dropdownActions">
<el-dropdown-item :command="a" v-if="!a.show || a.show()" :key="a.name" :title="a.title"
<el-dropdown-item :command="a" v-if="!a.show || a.show(context)" :key="a.name" :title="a.title"
:icon="getIconClass(a.icon)">
{{a.label || a.title}}
</el-dropdown-item>
Expand Down Expand Up @@ -91,7 +91,7 @@
return this.actionItems.filter((a) => {
return (a instanceof Array)
}).reduce((a, b) => a.concat(b), []).filter((a) => {
return !a.show || a.show()
return !a.show || a.show(this.context)
})
}
},
Expand Down
3 changes: 1 addition & 2 deletions src/components/media/aliyun/ImageUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@
return this.genFileNameContext(file, fnt).then(ctx => {
file.uploadContext = ctx
let fileName = template(fnt)(ctx)
console.log(fileName)
return import('ali-oss').then(module => {
let OSS = module.default
return new Promise((resolve, reject) => {
Expand All @@ -180,7 +179,7 @@
},
computed: {
urlPrefix() {
return `https://${this.$store.state.party.settings.aliyun.oss.domain}/`
return this.$attrs.urlPrefix || `https://${this.$store.state.party.settings.aliyun.oss.domain}/`
}
},
watch: {
Expand Down
42 changes: 25 additions & 17 deletions src/components/stats/ChartGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@
},
genDailyOption(item, data){
item.fields = item.fields || ['日期', item.title]
item.fields = arrayNormalise(item.fields,{})
item.fields = arrayNormalise(item.fields, {})
let series = [{
type: 'line',
smooth: true,
name: item.fields[1] && item.fields[1].name || '数量',
data: data.map((a) => a[1])
}]
let yAxis = [{
type: 'value',
Expand All @@ -96,19 +95,20 @@
type: 'bar',
yAxisIndex: 1,
name: item.fields[2] && item.fields[2].name || '数量2',
data: data.map((a) => a[2])
})
yAxis.push({
type: 'value',
name:item.fields[2] && item.fields[2].name
name: item.fields[2] && item.fields[2].name
})
}
return {
visualMap: item.visualMap,
dataset: {
source: data
},
// title: item.title,
xAxis: {
type: 'category',
data: data.map((a) => a[0])
type: 'category'
},
yAxis,
series
Expand Down Expand Up @@ -170,36 +170,44 @@
},
genBarOption (item, data){
let dataZoom = []
let axisLabel = {}
let grid = undefined
if (data.length >= 8) {
axisLabel = {rotate: 30, interval: 0}
}
if (data.length >= 16) {
dataZoom.push(
{
id: 'dataZoomY',
id: 'dataZoomX',
type: 'slider',
yAxisIndex: [0],
xAxisIndex: [0],
filterMode: 'filter',
show: true,
start: 0,
end: 900 / data.length
})
grid = {
bottom: '33%',
}
}
return {
dataZoom,
yAxis: {
type: 'category',
data: data.map((a) => a[0])
},
grid: {
left: '33%',
dataset: {
source: data
},
xAxis: {
position: 'top',
type: 'category', axisLabel
},
grid,
yAxis: {
// position: 'top',
type: 'value',
},
series: [{
type: 'bar',
smooth: true,
name: item.title,
data: data.map((a) => a[1])
name: item.title
}]
}
},
Expand Down

0 comments on commit 87ca4f1

Please sign in to comment.