| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <template>
- <div class="container">
- <visitorStatistics />
- <div class="card">
- <cord-top title="留言分析" @returnWhere="getMessageAnalysis" />
- <div ref="messageAnalysis" style="margin-top: 20px"></div>
- </div>
- <div class="card">
- <cord-top title="服务申请分析" @returnWhere="getServiceRequestAnalysis" />
- <div ref="serviceRequestAnalysis" style="margin-top: 20px"></div>
- </div>
- </div>
- </template>
- <script>
- import cordTop from "./modules/header.vue";
- import visitorStatistics from "./modules/visitorStatistics";
- import { Line } from "@antv/g2plot";
- export default {
- components: { visitorStatistics, cordTop },
- data() {
- return {
- messageAnalysis: null, //留言分析
- serviceRequestAnalysis: null, //服务申请分析
- siteid: "", //站点id
- };
- },
- created() {
- this.siteid = JSON.parse(sessionStorage.getItem("active_account")).siteid;
- this.getMessageAnalysis();
- this.getServiceRequestAnalysis();
- },
- methods: {
- // 获取留言分析
- getMessageAnalysis(detail) {
- let content = {
- siteid: this.siteid,
- type: "近七日",
- };
- if (detail) {
- if (detail.type) {
- content.type = detail.type;
- } else {
- content.type = "";
- content.where = detail;
- }
- }
- this.$api
- .requested({
- id: 2025010310381303,
- content,
- })
- .then((res) => {
- console.log("获取留言分析", res);
- if (res.code != 1) return;
- let type = this.$t("留言量分析");
- let list = res.data.map((v) => {
- v.type = type;
- return v;
- });
- if (detail) {
- this.messageAnalysis.changeData(list);
- } else {
- this.messageAnalysis = new Line(this.$refs.messageAnalysis, {
- height: 300,
- data: list,
- xField: "date",
- scrollbar: {
- type: "horizontal",
- },
- seriesField: "type",
- yField: "count",
- color: "#5588F7",
- tooltip: {
- formatter: (datum) => {
- return {
- name: type,
- value: datum.count,
- };
- },
- },
- point: {
- shape: "breath-point",
- },
- });
- this.messageAnalysis.render();
- }
- });
- },
- // 获取服务申请分析
- getServiceRequestAnalysis(detail) {
- let content = {
- siteid: this.siteid,
- type: "近七日",
- };
- if (detail) {
- if (detail.type) {
- content.type = detail.type;
- } else {
- content.type = "";
- content.where = detail;
- }
- }
- this.$api
- .requested({
- id: 2025010310402603,
- content,
- })
- .then((res) => {
- console.log("获取申请量分析", res);
- if (res.code != 1) return;
- let type = this.$t("申请量分析");
- let list = res.data.map((v) => {
- v.type = type;
- return v;
- });
- if (detail) {
- this.serviceRequestAnalysis.changeData(list);
- } else {
- this.serviceRequestAnalysis = new Line(
- this.$refs.serviceRequestAnalysis,
- {
- height: 300,
- data: list,
- xField: "date",
- scrollbar: {
- type: "horizontal",
- },
- seriesField: "type",
- yField: "count",
- color: "#F29C37",
- tooltip: {
- formatter: (datum) => {
- return {
- name: type,
- value: datum.count,
- };
- },
- },
- point: {
- shape: "breath-point",
- },
- }
- );
- this.serviceRequestAnalysis.render();
- }
- });
- },
- },
- };
- </script>
- <style scoped>
- .container {
- padding: 20px;
- box-sizing: border-box;
- }
- .card {
- width: 100%;
- padding: 20px;
- background: #ffffff;
- box-shadow: 0px 1px 6px 1px rgba(0, 0, 0, 0.16);
- border-radius: 10px;
- box-sizing: border-box;
- margin-top: 20px;
- }
- </style>
|