Skip to content

Commit

Permalink
Last changes previous release
Browse files Browse the repository at this point in the history
  • Loading branch information
rnovec committed Dec 29, 2020
1 parent 6bd75bf commit 8ec3fcc
Show file tree
Hide file tree
Showing 36 changed files with 1,340 additions and 806 deletions.
24 changes: 23 additions & 1 deletion src/api/certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ export function fetchListC () {
})
}

export function getFolders () {
return request({
url: '/storage/?folder=certificates',
method: 'GET'
})
}


export function fetchEvents () {
return request({
url: '/events/',
Expand Down Expand Up @@ -58,11 +66,25 @@ export function update (id, data) {
return request({
url: `/certificates/${id}/`,
method: 'PUT',
headers: { 'Content-Type': 'multipart/form-data' },
data
})
}

/**
*
* @param {*} id String
* @param {*} data Object
*/
export function uploadFile (id, data) {
return request({
url: `/certificates/${id}/upload/`,
method: 'PATCH',
headers: { 'Content-Type': 'multipart/form-data'},
data
})
}


/**
*
* @param {*} id String
Expand Down
13 changes: 13 additions & 0 deletions src/api/invoices.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import request from '@/services/axios'

/**
*
* @param {*} query Object
*/
export function fetchList (query) {
return request({
url: '/invoices/',
method: 'GET',
params: query
})
}
275 changes: 275 additions & 0 deletions src/components/Charts/MixChart.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
<template>
<div :id="id" :class="className" :style="{ height: height, width: width }" />
</template>

<script>
import echarts from 'echarts'
import resize from './mixins/resize'
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
id: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '200px'
},
height: {
type: String,
default: '200px'
}
},
data () {
return {
chart: null
}
},
mounted () {
this.initChart()
},
beforeDestroy () {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart () {
this.chart = echarts.init(document.getElementById(this.id))
const xData = (function () {
const data = []
for (let i = 1; i < 13; i++) {
data.push(i + 'month')
}
return data
})()
this.chart.setOption({
backgroundColor: '#fff',
title: {
text: 'Finances',
x: '20',
top: '20',
textStyle: {
color: '#000',
fontSize: '22'
},
subtextStyle: {
color: '#000000',
fontSize: '16'
}
},
tooltip: {
trigger: 'axis',
axisPointer: {
textStyle: {
color: '#fff'
}
}
},
grid: {
left: '5%',
right: '5%',
borderWidth: 0,
top: 150,
bottom: 95,
textStyle: {
color: '#fff'
}
},
legend: {
x: '5%',
top: '10%',
textStyle: {
color: '#90979c'
},
data: ['Incomes', 'Expenses', 'Balance']
},
calculable: true,
xAxis: [
{
type: 'category',
axisLine: {
lineStyle: {
color: '#90979c'
}
},
splitLine: {
show: false
},
axisTick: {
show: false
},
splitArea: {
show: false
},
axisLabel: {
interval: 0
},
data: xData
}
],
yAxis: [
{
type: 'value',
splitLine: {
show: false
},
axisLine: {
lineStyle: {
color: '#90979c'
}
},
axisTick: {
show: false
},
axisLabel: {
interval: 0
},
splitArea: {
show: false
}
}
],
dataZoom: [
{
show: true,
height: 30,
xAxisIndex: [0],
bottom: 30,
start: 10,
end: 80,
handleIcon:
'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
handleSize: '110%',
handleStyle: {
color: '#d3dee5'
},
textStyle: {
color: '#fff'
},
borderColor: '#90979c'
},
{
type: 'inside',
show: true,
height: 15,
start: 1,
end: 35
}
],
series: [
{
name: 'Incomes',
type: 'bar',
stack: 'total',
barMaxWidth: 35,
barGap: '10%',
itemStyle: {
normal: {
color: 'rgba(255,144,128,1)',
label: {
show: true,
textStyle: {
color: '#fff'
},
position: 'insideTop',
formatter (p) {
return p.value > 0 ? p.value : ''
}
}
}
},
data: [
709,
1917,
2455,
2610,
1719,
1433,
1544,
3285,
5208,
3372,
2484,
4078
]
},
{
name: 'Expenses',
type: 'bar',
stack: 'total',
itemStyle: {
normal: {
color: 'rgba(0,191,183,1)',
barBorderRadius: 0,
label: {
show: true,
position: 'top',
formatter (p) {
return p.value > 0 ? p.value : ''
}
}
}
},
data: [
327,
1776,
507,
1200,
800,
482,
204,
1390,
1001,
951,
381,
220
]
},
{
name: 'Balance',
type: 'line',
stack: 'total',
symbolSize: 10,
symbol: 'circle',
itemStyle: {
normal: {
color: 'rgba(252,230,48,1)',
barBorderRadius: 0,
label: {
show: true,
position: 'top',
formatter (p) {
return p.value > 0 ? p.value : ''
}
}
}
},
data: [
1036,
3693,
2962,
3810,
2519,
1915,
1748,
4675,
6209,
4323,
2865,
4298
]
}
]
})
}
}
}
</script>
66 changes: 66 additions & 0 deletions src/components/Charts/mixins/resize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { debounce } from '@/utils'

export default {
data () {
return {
$_sidebarElm: null,
$_resizeHandler: null
}
},
mounted () {
this.initListener()
},
activated () {
if (!this.$_resizeHandler) {
// avoid duplication init
this.initListener()
}

// when keep-alive chart activated, auto resize
this.resize()
},
beforeDestroy () {
this.destroyListener()
},
deactivated () {
this.destroyListener()
},
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_sidebarResizeHandler (e) {
if (e.propertyName === 'width') {
this.$_resizeHandler()
}
},
initListener () {
this.$_resizeHandler = debounce(() => {
this.resize()
}, 100)
window.addEventListener('resize', this.$_resizeHandler)

this.$_sidebarElm = document.getElementsByClassName(
'sidebar-container'
)[0]
this.$_sidebarElm &&
this.$_sidebarElm.addEventListener(
'transitionend',
this.$_sidebarResizeHandler
)
},
destroyListener () {
window.removeEventListener('resize', this.$_resizeHandler)
this.$_resizeHandler = null

this.$_sidebarElm &&
this.$_sidebarElm.removeEventListener(
'transitionend',
this.$_sidebarResizeHandler
)
},
resize () {
const { chart } = this
chart && chart.resize()
}
}
}
Loading

0 comments on commit 8ec3fcc

Please sign in to comment.