Перезалить

This commit is contained in:
iriska-gri committed 2024-03-11 12:30:39 +03:00
1 parent 8bca4cf566
commit e7e900f122
5 files changed
+42 -236

No files matched your search

@@ -89,7 +89,7 @@ export default {
data: [],
func: (val)=>{return val.unic.length},
datakey: "unic",
hidden: true,
customlabel: [],
tooltips: true,
yAxisID: 'y'
@@ -104,7 +104,7 @@ export default {
data: [],
func: (val, key)=>{ return parseFloat(crrfunc(key).toFixed(2))
},
hidden: true,
datakey: "crr",
customlabel: [],
tooltips: true,
@@ -193,11 +193,8 @@ export default {
// const data = ref(datachanged.value)
const crrfunc = (date)=>{
//
// let h = new Date('2024-01-20') >=moment(new Date(date)).subtract(between.value*2, 'd')
let baseunic = unicperson(fullper.value.filter(e => new Date(e.visitdate) >=moment(new Date(date)).subtract(between.value*2, 'd') && new Date(e.visitdate) <= moment(new Date(date)).subtract(between.value, 'd')))
let crrunic = unicperson(fullper.value.filter(e => new Date(e.visitdate) >=moment(new Date(date)).subtract(between.value, 'd') && new Date(e.visitdate) <= new Date(date)))
@@ -224,20 +221,8 @@ export default {
// watch(()=>data.value,()=>{
// console.log(linear.value)
// if(linear.value!==null) {
// console.log(linear.value.chart);
// // linear.value.chart.destroy()
// linear.value.chart.render(data.value, options)
// }
// }, {deep:true})
const options = {
// layout: {
// padding: 20
// },
plugins: {
datalabels: {
@@ -255,20 +240,7 @@ export default {
}
},
// tooltip: {
// displayColors: false,
// callbacks: {
// label: function(context) {
// let label = context.dataset.label || '';
// if (context.datasetIndex==1) {
// if (context.parsed.y !== null) {
// label =arrlines.value.datasets[1].customlabel[context.dataIndex];
// }
// return label
// }
// }
// }
// }
},
layout: {
padding: {
@@ -1,179 +0,0 @@
<template>
<v-card class="h-100 ">
<line-graph :data="data" :options="options"/>
</v-card>
</template>
<script>
import lineGraph from '@/components/graph/line-graph.vue'
import {computed } from 'vue'
import {formatComa, splitname} from '@/utils/universal_functions'
export default {
components: {
lineGraph,
},
props: {
dataLineChart: {
type: Object,
default: () => {}
},
},
setup(props, {emit}) {
const arrlines = {}
const data = computed({
get() {
arrlines.value = {
labels: [],
datasets: [
{
label: 'Открыто страниц',
backgroundColor: '#C62828',
borderColor: '#C62828',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
tooltips: false
},
{
label: 'Активные пользователи',
backgroundColor: 'teal',
borderColor: 'teal',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
customlabel: [],
tooltips: true
}
,
{
label: 'CRR',
backgroundColor: '#673AB7',
borderColor: '#673AB7',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
customlabel: [],
tooltips: true
}
,
{
label: 'BR',
backgroundColor: '#283593',
borderColor: '#283593',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
customlabel: [],
tooltips: true
}
,
{
label: 'PPV',
backgroundColor: '#EF9A9A',
borderColor: '#EF9A9A',
borderWidth: 3,
cubicInterpolationMode: 'monotone',
data: [],
hidden: true,
customlabel: [],
tooltips: true
}
]
}
arrforline()
return arrlines.value
}
})
const options = {
plugins: {
datalabels: {
color: 'grey',
align: 'top',
display: 'auto'
},
legend: {
labels: {
color: 'grey',
}
},
tooltip: {
displayColors: false,
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (context.datasetIndex==1) {
if (context.parsed.y !== null) {
label =arrlines.value.datasets[1].customlabel[context.dataIndex];
}
return label
}
}
}
}
},
scales: {
x: {
grid: {
color: 'white',
}
},
y: {
ticks: {
stepSize: 10
},
offset: true,
grid: {
color: 'white',
}
}
},
responsive: true,
maintainAspectRatio: false
}
const arrforline=() => {
Object.entries(props.dataLineChart).forEach(e => {
const [key, value] = e
arrlines.value.datasets[0].data.push(value.count)
arrlines.value.datasets[1].data.push(value.unic.length)
arrlines.value.datasets[2].data.push(value.crr)
arrlines.value.datasets[3].data.push(value.br)
arrlines.value.datasets[4].data.push(value.ppv)
arrlines.value.labels.push(formatComa(key))
arrlines.value.datasets[1].customlabel.push(props.dataLineChart[key].unic)
})
}
return {
data,
options,
}
}
}
</script>
<style>
canvas {
flex: 1!important
}
</style>
@@ -33,13 +33,13 @@
</span>
</template>
<template v-slot:item.now="{ value, item }">
<span class="font-weight-medium text-subtitle-2">
<span class="font-weight-medium text-subtitle-2 ">
<v-tooltip
v-if="value>0"
location="bottom"
>
<template v-slot:activator="{ props }">
<span v-bind="props" :class="'untot'=='уникальные'?getColorTooday1(value):getColorTooday2(value) " class="cursor-help font-weight-medium text-subtitle-1 " >
<span v-bind="props" :class="'untot'=='уникальные'?getColorTooday1(value):getColorTooday2(value) " class="cursor-help font-weight-medium text-subtitle-1 " >
{{value}}
</span>
</template>
@@ -51,7 +51,7 @@
no-gutters v-for="n in item.now.unic"
:key="n"
>
<v-col>
<v-col >
{{n}}
</v-col>
</v-row>
@@ -274,8 +274,12 @@ export default {
}
.mytable tr {
font-size: 12px;
font-size: 13px;
}
.mytable i{
font-size: 10px;
}
.myleft {
float: left;
@@ -16,7 +16,7 @@
show-expand
class="h-0 cursor-default bg-grey_white"
:sort-by="[{ key: 'info.count', order: 'desc' }]"
density="compact"
density="comfortable"
>
<template v-slot:item.user="{ value }">
@@ -28,8 +28,10 @@
<template v-slot:headers="{ columns, isSorted, getSortIcon, toggleSort }">
<tr>
<template v-for="column in columns" :key="column.key">
<td class="pa-0">
<td class="pa-0 py-2 pb-3" >
<v-tooltip location="top" v-if="column.title!=''">
<template v-slot:activator="{ props }">
<v-btn
@@ -46,17 +48,23 @@
<v-icon size="x-small"></v-icon>
</template>
</v-btn>
</template>
<span>{{ column.tooltip }} </span>
</v-tooltip>
</td>
</template>
</tr>
</template>
<template v-slot:expanded-row="{ columns, item }">
<tr>
<td :colspan="columns.length">
<v-card class="my-2 elevation-0" color='grey'>
<v-divider/>
<v-data-table
@@ -88,19 +96,19 @@
</template>
</tr>
</template>
<template v-slot:item.unic="{ value }">
<span :class="'text-'+getColor(value) " class="font-weight-medium text-subtitle-2">
{{ value }}
</span>
</template>
<template v-slot:item.count="{ value }">
<span :class="'text-'+getColor2(value) " class="font-weight-medium text-subtitle-2">
{{ value }}
</span>
<template v-slot:item.count="{ value }">
<span :class="'text-'+getColor2(value) " class="font-weight-medium text-subtitle-2">
{{ value }}
</span>
</template>
<template v-slot:item.unic="{ value }">
<span :class="'text-'+getColor(value) " class="font-weight-medium text-subtitle-2">
{{ value }}
</span>
</template>
</v-data-table>
</v-card>
@@ -163,7 +171,7 @@ export default {
let res = []
props.activusers.forEach((e) => {
let ind = res.findIndex(el => el.user.id == e.user.id)
if (ind == -1) {
res.push({user: e.user,
@@ -178,8 +186,9 @@ export default {
unic: 1
}]
})
console.log(res, 'ind----------------------')
}
else {
let ob =res[ind]
ob.info.count += e.count,
@@ -198,7 +207,7 @@ export default {
}
else {
ob.tooltip[indt].unic += e.count
ob.tooltip[indt].count += e.count
ob.tooltip[indt].unic += 1
}
}
@@ -237,9 +246,9 @@ export default {
maxWidth: '60%',
minWidth: '60%',
},
{ title: 'уникальных', align: 'center', key: 'count', width: '20%', maxWidth: '20%'
{ title: 'всего', align: 'center', key: 'count', width: '20%', maxWidth: '20%'
},
{ title: 'всего', align: 'center', key: 'unic', width: '20%', maxWidth: '20%'
{ title:'уникальных' , align: 'center', key: 'unic', width: '20%', maxWidth: '20%'
},
@@ -38,7 +38,7 @@
>
<template v-slot:filling_feedback>
<div v-if="criteria.length!=0">
<div v-if="criteria.length!=0" class="pt-4">
<v-row
class="align-center flex-column scoreheight gap mt-n2"