fix skit2

This commit is contained in:
fifi97
2021-12-28 01:23:25 +08:00
parent 53ac187c8c
commit a36340eb10
13 changed files with 1797 additions and 956 deletions
+73 -311
View File
@@ -16,309 +16,21 @@
</template>
<script>
export default {
props:{
kodcaw: String
},
data: () => ({
series: [{
name: 'Gadai',
// data: [44, 55, 57, 56, 61, 58, 63, 60, 66, 80, 68]
data:[
{
x: 'Jan',
y: 44,
goals: [
{
name: 'Expected',
value: 32,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Feb',
y: 55,
goals: [
{
name: 'Expected',
value: 56,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Mac',
y: 57,
goals: [
{
name: 'Expected',
value: 40,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Apr',
y: 56,
goals: [
{
name: 'Expected',
value: 77,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Mei',
y: 61,
goals: [
{
name: 'Expected',
value: 65,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Jun',
y: 58,
goals: [
{
name: 'Expected',
value: 60,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Jul',
y: 63,
goals: [
{
name: 'Expected',
value: 43,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Ogos',
y: 60,
goals: [
{
name: 'Expected',
value: 20,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Sept',
y: 66,
goals: [
{
name: 'Expected',
value: 60,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Okt',
y: 80,
goals: [
{
name: 'Expected',
value: 60,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Nov',
y: 86,
goals: [
{
name: 'Expected',
value: 60,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Dis',
y: 101,
goals: [
{
name: 'Expected',
value: 60,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
]
data:[]
}, {
name: 'Tebus',
// data: [76, 85, 101, 98, 87, 105, 91, 114, 94, 67, 65]
data:[
{
x: 'Jan',
y: 76,
goals: [
{
name: 'Expected',
value: 80,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Feb',
y: 85,
goals: [
{
name: 'Expected',
value: 60,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Mac',
y: 101,
goals: [
{
name: 'Expected',
value: 50,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Apr',
y: 76,
goals: [
{
name: 'Expected',
value: 56,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Mei',
y: 85,
goals: [
{
name: 'Expected',
value: 70,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Jun',
y: 101,
goals: [
{
name: 'Expected',
value: 40,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Jul',
y: 76,
goals: [
{
name: 'Expected',
value: 44,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Ogos',
y: 85,
goals: [
{
name: 'Expected',
value: 45,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Sept',
y: 101,
goals: [
{
name: 'Expected',
value: 80,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Okt',
y: 101,
goals: [
{
name: 'Expected',
value: 70,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Nov',
y: 101,
goals: [
{
name: 'Expected',
value: 40,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
{
x: 'Dis',
y: 101,
goals: [
{
name: 'Expected',
value: 80,
strokeHeight: 5,
strokeColor: '#775DD0'
}
]
},
]
data:[]
}],
chartOptions: {
chart: {
id:'bilangan-bulanan',
type: 'bar',
height: 350
},
@@ -333,24 +45,21 @@ export default {
},
},
// dataLabels: {
// enabled: false
// },
dataLabels: {
enabled: true,
style: {
colors: ['#333']
},
offsetY: -30,
style: {
colors: ['#333']
},
offsetY: -30,
formatter: function (val, opt) {
let total = ((val - opt.w.globals.seriesGoals[0][opt.dataPointIndex][0]['value']) / opt.w.globals.seriesGoals[0][opt.dataPointIndex][0]['value']) * 100
if(isNaN(total))
{
return 0.00
}else{
return total.toFixed(2)
}
if(isNaN(total))
{
return 0.00
}else{
return total.toFixed(2)
}
},
},
stroke: {
@@ -358,9 +67,14 @@ export default {
width: 2,
colors: ['transparent']
},
// xaxis: {
// categories: ['Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct','Nov','Dis'],
// },
legend: {
show: true,
showForSingleSeries: true,
customLegendItems: ['Gadai', 'Tebus','Expected'],
markers: {
fillColors: ['#3498db', '#e74c3c','#775DD0']
}
},
yaxis: {
title: {
text: '(Bilangan Orang)'
@@ -380,6 +94,54 @@ export default {
}),
created() {
this.getData();
},
methods: {
getData(){
this.axios.all([
axios.get(`http://localhost:8000/admin/bilangan/gadai`, {
params: {
kodcaw: this.kodcaw
}
}),
axios.get(`http://localhost:8000/admin/bilangan/tebus`, {
params: {
kodcaw: this.kodcaw
}
})
])
.then(this.axios.spread((datagadai, datatebus) => {
this.$apexcharts.exec('bilangan-bulanan', 'updateSeries', [
{
name: 'Gadai',
data: datagadai.data
},
{
name: 'Tebus',
data: datatebus.data
},
])
}));
}
},
mounted () {
var channel = this.$pusher.subscribe('gadai-notify');
channel.bind('trigger-gadai', ({ response }) => {
if(response.cawangan = this.kodcaw)
this.getData()
});
var channel2 = this.$pusher.subscribe('tebus-notify');
channel2.bind('trigger-tebus', ({ response }) => {
if(response.cawangan = this.kodcaw)
this.getData()
});
}
}
</script>
@@ -109,15 +109,17 @@ export default {
var channel = this.$pusher.subscribe('keuntungan-notify');
channel.bind('trigger-keuntungan', ({ response }) => {
console.log(`${response}`);
this.getDatakeuntungan()
// console.log(`${response}`);
if(response.cawangan == this.kodcaw)
this.getDatakeuntungan()
});
var channel2 = this.$pusher.subscribe('tebus-notify');
channel2.bind('trigger-tebus', ({ response }) => {
console.log(`${response}`);
this.getDatakeuntungan()
// console.log(`${response}`);
if(response.cawangan == this.kodcaw)
this.getDatakeuntungan()
});
}
@@ -110,8 +110,9 @@ export default {
var channel = this.$pusher.subscribe('gadai-notify');
channel.bind('trigger-gadai', ({ response }) => {
console.log(`${response}`);
this.getDataPembiayaan()
// console.log(`${response}`);
if(response.cawangan == this.kodcaw)
this.getDataPembiayaan()
});
}
}
@@ -107,8 +107,9 @@ export default {
var channel = this.$pusher.subscribe('tebus-notify');
channel.bind('trigger-tebus', ({ response }) => {
console.log(`${response}`);
this.getDataPenebusan()
// console.log(`${response}`);
if(response.cawangan == this.kodcaw)
this.getDataPenebusan()
});
}
}