Commit aa9dd7d3 authored by 姬鋆屾's avatar 姬鋆屾

tui

parent c9dedf2c
...@@ -2,25 +2,48 @@ ...@@ -2,25 +2,48 @@
<!-- 产品分析 --> <!-- 产品分析 -->
<div class="page"> <div class="page">
<div class="img-dv"> <div class="img-dv">
<img :src="img" ref="img"> <img :src="img" ref="img" />
<div id="queuing"></div> <div id="queuing"></div>
</div> </div>
<div class="list-dv"> <div class="list-dv">
<a-form-model :model="queryform" :label-col="labelCol" :wrapper-col="wrapperCol" layout="inline"> <a-form-model
:model="queryform"
:label-col="labelCol"
:wrapper-col="wrapperCol"
layout="inline"
>
<a-form-model-item> <a-form-model-item>
<a-select v-model="queryform.productId" style="width: 200px" placeholder="选择产品" @change="changeProductId"> <a-select
<a-select-option :value="item.id" v-for="(item,index) in product" :key="index"> v-model="queryform.productId"
{{item.title}} style="width: 200px"
placeholder="选择产品"
@change="changeProductId"
>
<a-select-option
:value="item.id"
v-for="(item, index) in product"
:key="index"
>
{{ item.title }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item> <a-form-model-item>
<a-range-picker valueFormat="yyyy-MM-DD" v-model="time" style="width: 300px" :allowClear="false" /> <a-range-picker
valueFormat="yyyy-MM-DD"
v-model="time"
style="width: 300px"
:allowClear="false"
/>
</a-form-model-item> </a-form-model-item>
<a-form-model-item> <a-form-model-item>
<a-select v-model="queryform.pageCode" style="width: 410px"> <a-select v-model="queryform.pageCode" style="width: 410px">
<a-select-option :value="item.id" v-for="(item,index) in page" :key="index"> <a-select-option
{{item.title}} :value="item.id"
v-for="(item, index) in page"
:key="index"
>
{{ item.title }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
...@@ -33,10 +56,15 @@ ...@@ -33,10 +56,15 @@
<div class="main"> <div class="main">
<div class="total-dv"> <div class="total-dv">
<div>总点击次数</div> <div>总点击次数</div>
<div>{{clickSum}}</div> <div>{{ clickSum }}</div>
</div> </div>
<div style="margin-bottom: 20px;">事件排名Top10</div> <div style="margin-bottom: 20px">事件排名Top10</div>
<a-table :columns="columns" :data-source="data" :scroll="{ y: 590 }" :pagination="false"> <a-table
:columns="columns"
:data-source="data"
:scroll="{ y: 590 }"
:pagination="false"
>
</a-table> </a-table>
</div> </div>
</div> </div>
...@@ -44,42 +72,44 @@ ...@@ -44,42 +72,44 @@
</template> </template>
<script> <script>
import product from "../mixins/product" import product from "../mixins/product";
import Heatmap from 'heatmap.js'; import Heatmap from "heatmap.js";
import moment from 'moment'; import moment from "moment";
import { import { getProductHotCensus, pageLlist } from "@/api/dataActuary.js";
getProductHotCensus, export default {
pageLlist mixins: [product],
} from '@/api/dataActuary.js'
export default {
mixins:[product],
data() { data() {
return { return {
queryform: { queryform: {
productId: 1, productId: 1,
dateTimeStart: moment().format('yyyy-MM-DD'), dateTimeStart: moment().format("yyyy-MM-DD"),
dateTimeEnd: moment().format('yyyy-MM-DD'), dateTimeEnd: moment().format("yyyy-MM-DD"),
pageCode: '/' pageCode: "/",
}, },
time: [moment().format('yyyy-MM-DD'), moment().format('yyyy-MM-DD')], time: [moment().format("yyyy-MM-DD"), moment().format("yyyy-MM-DD")],
product: [{ product: [
title: '排队机', {
id: 1 title: "排队机",
}], id: 1,
page: [{ },
title: '首页', ],
id: '/' page: [
}], {
title: "首页",
id: "/",
},
],
labelCol: { labelCol: {
span: 1 span: 1,
}, },
wrapperCol: { wrapperCol: {
span: 14 span: 14,
}, },
columns: [{ columns: [
{
title: "序号", title: "序号",
width: "70px", width: "70px",
customRender: (text, record, index) => `${index+1}`, customRender: (text, record, index) => `${index + 1}`,
align: "center", align: "center",
}, },
{ {
...@@ -88,100 +118,101 @@ ...@@ -88,100 +118,101 @@
align: "center", align: "center",
}, },
{ {
title: '点击次数', title: "点击次数",
dataIndex: 'value', dataIndex: "value",
align: "center", align: "center",
}, },
{ {
title: '事件数量(日均)', title: "事件数量(日均)",
dataIndex: 'proportion', dataIndex: "proportion",
align: "center", align: "center",
} },
], ],
data: [], data: [],
heatmapInstance: null, heatmapInstance: null,
dataPoint: [], dataPoint: [],
img: '', img: "",
BASE_URL: process.env.VUE_APP_API_BASE_URL + '/', BASE_URL: process.env.VUE_APP_API_BASE_URL + "/",
clickSum:0,//总次数 clickSum: 0, //总次数
ProductLlist:[] ProductLlist: [],
} };
}, },
mounted() { mounted() {
this.init('queuing') this.init("queuing");
this.getPageLlist() this.getPageLlist();
}, },
methods: { methods: {
// 选择产品 // 选择产品
changeProductId(v){ changeProductId(v) {
this.getPageLlist(v) this.getPageLlist(v);
}, },
// 查询页面 // 查询页面
getPageLlist(productId = 1){ getPageLlist(productId = 1) {
pageLlist({productId:productId,size:-1}).then(res=>{ pageLlist({ productId: productId, size: -1 }).then((res) => {
const {data} = res.data const { data } = res.data;
let arr = [] let arr = [];
if(data && data.length > 0){ if (data && data.length > 0) {
data.forEach(element => { data.forEach((element) => {
arr.push({title:element.pageName,id:element.pageCode}) arr.push({ title: element.pageName, id: element.pageCode });
}); });
this.page = arr this.page = arr;
}else{ } else {
this.page = [{ this.page = [
title: '首页', {
id: '/' title: "首页",
}] id: "/",
},
];
} }
}) });
}, },
getList() { getList() {
this.queryform.dateTimeStart = this.time ? this.time[0] : null this.queryform.dateTimeStart = this.time ? this.time[0] : null;
this.queryform.dateTimeStart = this.time ? this.time[1] : null this.queryform.dateTimeStart = this.time ? this.time[1] : null;
getProductHotCensus(this.queryform).then(res => { getProductHotCensus(this.queryform).then((res) => {
this.clickSum = res.data.clickSum console.log(res);
this.data = res.data.data this.clickSum = res.data.clickSum;
this.img = (process.env.NODE_ENV == 'development')?`${this.BASE_URL}${res.data.screenUrl}`:res.data.screenUrl this.data = res.data.top10List;
this.img =
process.env.NODE_ENV == "development"
? `${this.BASE_URL}${res.data.screenUrl}`
: res.data.screenUrl;
let imgSize = new Image(); let imgSize = new Image();
imgSize.src = this.img; imgSize.src = this.img;
imgSize.onload = () => { imgSize.onload = () => {
let w = this.$refs.img.width / imgSize.width let w = this.$refs.img.width / imgSize.width;
let h = this.$refs.img.height / imgSize.height let h = this.$refs.img.height / imgSize.height;
this.dataPoint = res.data.data.map(({ this.dataPoint = res.data.hostList.map(({ x, y, value }) => ({
x,
y,
value
}) => ({
x: parseInt(x * w), x: parseInt(x * w),
y: parseInt(y * h), y: parseInt(y * h),
value value,
})) }));
let data = { let data = {
max: 10, max: 10,
min: 0, min: 0,
data: this.dataPoint data: this.dataPoint,
}; };
this.heatmapInstance.setData(data); this.heatmapInstance.setData(data);
} };
}) });
}, },
init(el) { init(el) {
let config = { let config = {
container: document.getElementById(el), container: document.getElementById(el),
radius: 30, radius: 30,
maxOpacity: .8, maxOpacity: 0.8,
minOpacity: 0, minOpacity: 0,
blur: .5 blur: 0.5,
}; };
this.heatmapInstance = Heatmap.create(config); this.heatmapInstance = Heatmap.create(config);
this.getList() this.getList();
} },
} },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.page {
.page {
width: 100%; width: 100%;
height: calc(100% - 50px); height: calc(100% - 50px);
display: flex; display: flex;
...@@ -226,5 +257,5 @@ ...@@ -226,5 +257,5 @@
padding: 20px 0; padding: 20px 0;
} }
} }
} }
</style> </style>
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