|
|
@@ -3,6 +3,19 @@
|
|
|
<!-- 搜索区域 -->
|
|
|
<div class="searchBox">
|
|
|
<div>
|
|
|
+ 对比时间:
|
|
|
+ <el-date-picker
|
|
|
+ v-model="compareTimes"
|
|
|
+ type="daterange"
|
|
|
+ unlink-panels
|
|
|
+ range-separator="到"
|
|
|
+ start-placeholder="开始时间"
|
|
|
+ end-placeholder="结束时间"
|
|
|
+ disabled
|
|
|
+ size="large"
|
|
|
+ style="margin-right: 30px"
|
|
|
+ />
|
|
|
+ 搜索时间:
|
|
|
<el-date-picker
|
|
|
v-model="dateValue"
|
|
|
type="daterange"
|
|
|
@@ -10,7 +23,7 @@
|
|
|
range-separator="到"
|
|
|
start-placeholder="开始时间"
|
|
|
end-placeholder="结束时间"
|
|
|
- :shortcuts="shortcuts"
|
|
|
+ :shortcuts="shortcutsFun"
|
|
|
size="large"
|
|
|
/>
|
|
|
</div>
|
|
|
@@ -106,7 +119,7 @@
|
|
|
/>
|
|
|
</div>
|
|
|
<div style="width: 38%; height: 400px">
|
|
|
- <EchartsDome :chartOption="chartOptions['服务类别分布']" title="应用状态分布" />
|
|
|
+ <EchartsDome :chartOption="chartOptions['应用状态分布']" title="应用状态分布" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -123,7 +136,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 区级特色信息统计 -->
|
|
|
- <div class="bigCard" style="background: #00000000">
|
|
|
+ <div class="bigCard">
|
|
|
<div class="bigCard_title">区级特色信息统计</div>
|
|
|
<div class="flex" style="margin-top: 20px">
|
|
|
<div class="flex_column" style="width: 28%; height: 420px">
|
|
|
@@ -167,7 +180,8 @@
|
|
|
import card from "@/components/yxgl/card.vue";
|
|
|
import EchartsDome from "@/components/yxgl/EchartsDome.vue";
|
|
|
import Table from "@/components/yxgl/table.vue";
|
|
|
-import { totalCountGroupByTime } from "@/api/count";
|
|
|
+import { totalCountGroupByTime, serviceInfo } from "@/api/count";
|
|
|
+import appCenter from "@/api/appCenter";
|
|
|
export default {
|
|
|
name: "",
|
|
|
components: {
|
|
|
@@ -178,16 +192,10 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
// 比较的时间范围(默认60天到30天前,主要跟dateValue有关系)
|
|
|
- compareTimes: [
|
|
|
- new Date(new Date().setTime(new Date() - 3600 * 1000 * 24 * 60)),
|
|
|
- new Date(new Date().setTime(new Date() - 3600 * 1000 * 24 * 30)),
|
|
|
- ],
|
|
|
+ compareTimes: [],
|
|
|
// 当前选中的时间范围
|
|
|
- dateValue: [
|
|
|
- new Date(new Date().setTime(new Date() - 3600 * 1000 * 24 * 30)),
|
|
|
- new Date(),
|
|
|
- ],
|
|
|
- shortcuts: this.shortcuts(),
|
|
|
+ dateValue: [],
|
|
|
+ shortcutsFun: this.shortcuts(),
|
|
|
chartOptions: {},
|
|
|
tableDatas: [],
|
|
|
};
|
|
|
@@ -196,24 +204,32 @@ export default {
|
|
|
dateValue: {
|
|
|
handler(newVal, oldVal) {
|
|
|
if (newVal !== oldVal && newVal.length > 0) {
|
|
|
- this.initChart();
|
|
|
- // 要先算出来dateValue的开始时间,和范围天数。然后根据范围天数,计算出比较的时间。其中dateValue的开始时间是比较时间的结束时间,比较的开始时间是比较时间的结束时间减去范围天数。
|
|
|
// 计算出比较的时间范围
|
|
|
this.compareTimes = [
|
|
|
- new Date(
|
|
|
- new Date(newVal[0]).setTime(
|
|
|
- new Date(newVal[0]).getTime() - 3600 * 1000 * 24 * (newVal[1] - newVal[0])
|
|
|
+ this.$moment(
|
|
|
+ new Date(
|
|
|
+ new Date(newVal[0]).setTime(
|
|
|
+ new Date(newVal[0]).getTime() - (newVal[1] - newVal[0])
|
|
|
+ )
|
|
|
)
|
|
|
- ),
|
|
|
- new Date(newVal[0]),
|
|
|
+ ).format("YYYY-MM-DD"),
|
|
|
+ this.$moment(new Date(newVal[0])).format("YYYY-MM-DD"),
|
|
|
];
|
|
|
+ this.initChart();
|
|
|
}
|
|
|
},
|
|
|
deep: true,
|
|
|
- immediate: true,
|
|
|
+ // immediate: true,
|
|
|
},
|
|
|
},
|
|
|
- mounted() {},
|
|
|
+ mounted() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.dateValue = [
|
|
|
+ new Date(new Date().setTime(new Date() - 3600 * 1000 * 24 * 30)),
|
|
|
+ new Date(),
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ },
|
|
|
methods: {
|
|
|
initChart() {
|
|
|
let datas = [
|
|
|
@@ -245,24 +261,118 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+ serviceInfo(this.dateValue[0], this.dateValue[1]).then((res) => {
|
|
|
+ if (res) {
|
|
|
+ // 得到服务类别分布,map中key是cUnit,value是count,可以写一个公共方法,专门用来统计服务类别分布
|
|
|
+ let serviceTypeMap = {};
|
|
|
+ res.forEach((item) => {
|
|
|
+ if (serviceTypeMap[item.cUnit]) {
|
|
|
+ serviceTypeMap[item.cUnit] += item.count;
|
|
|
+ } else {
|
|
|
+ serviceTypeMap[item.cUnit] = item.count;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 转换为数组
|
|
|
+ let serviceTypeDatas = [];
|
|
|
+ for (let key in serviceTypeMap) {
|
|
|
+ if (serviceTypeMap[key] && key) {
|
|
|
+ serviceTypeDatas.push({
|
|
|
+ name: key,
|
|
|
+ value: serviceTypeMap[key],
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.dataToOption("服务类别分布", "pie", [...serviceTypeDatas], {
|
|
|
+ pieKey: { value: "value", name: "name" },
|
|
|
+ pieData: [],
|
|
|
+ });
|
|
|
|
|
|
- // timeCheckers拼接时间参数,topUnit添加一个,然后修改查询字段:c_unit,修改成c_path
|
|
|
- this.dataToOption("服务类别分布", "pie", datas, {
|
|
|
- pieKey: { value: "value", name: "name" },
|
|
|
- pieData: [],
|
|
|
+ this.dataToOption("委办分布", "pie", [...serviceTypeDatas], {
|
|
|
+ pieKey: { value: "value", name: "name" },
|
|
|
+ pieData: [],
|
|
|
+ legend: {
|
|
|
+ bottom: 10,
|
|
|
+ },
|
|
|
+ radius: "60%",
|
|
|
+ padAngle: 0,
|
|
|
+ borderRadius: 0,
|
|
|
+ label: {},
|
|
|
+ });
|
|
|
+ // 服务调用TOP10《cPathComment+cUnit,调用次数》
|
|
|
+ let serviceTypeMap2 = {};
|
|
|
+ res.forEach((item) => {
|
|
|
+ if (serviceTypeMap2[item.cPathComment + item.cUnit]) {
|
|
|
+ serviceTypeMap2[item.cPathComment + item.cUnit].push(item);
|
|
|
+ } else {
|
|
|
+ serviceTypeMap2[item.cPathComment + item.cUnit] = [item];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 转换为数组
|
|
|
+ let serviceTypeDatas2 = [];
|
|
|
+ for (let key in serviceTypeMap2) {
|
|
|
+ if (serviceTypeMap2[key] && key) {
|
|
|
+ let item = serviceTypeMap2[key];
|
|
|
+ let tableDataItem = {
|
|
|
+ serviceName: "",
|
|
|
+ serviceType: "",
|
|
|
+ callCount: 0,
|
|
|
+ };
|
|
|
+ item.forEach((item2) => {
|
|
|
+ tableDataItem.serviceName = item2.cPathComment;
|
|
|
+ tableDataItem.serviceType = item2.cUnit;
|
|
|
+ tableDataItem.callCount += item2.count;
|
|
|
+ });
|
|
|
+ serviceTypeDatas2.push(tableDataItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 根据callCount进行降序排序并截取前10条
|
|
|
+ serviceTypeDatas2.sort((a, b) => b.callCount - a.callCount);
|
|
|
+ serviceTypeDatas2 = serviceTypeDatas2.slice(0, 10);
|
|
|
+ this.initTableDatas(serviceTypeDatas2);
|
|
|
+ }
|
|
|
});
|
|
|
+ // 应用状态分布,cloumnId:1659
|
|
|
+ appCenter
|
|
|
+ .getDmsDataList({
|
|
|
+ columnId: 1659,
|
|
|
+ pageSize: 1000,
|
|
|
+ page: 0,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ let dmsDatas = res.content.data;
|
|
|
+ let tableDatas = [];
|
|
|
+ // 根据状态进行groupBy统计个数
|
|
|
+ let statusMap = {};
|
|
|
+ dmsDatas.forEach((item) => {
|
|
|
+ if (statusMap[item.appstauts + ""]) {
|
|
|
+ statusMap[item.appstauts + ""] += 1;
|
|
|
+ } else {
|
|
|
+ statusMap[item.appstauts + ""] = 1;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 转换为数组
|
|
|
+ for (let key in statusMap) {
|
|
|
+ if (statusMap[key] && key) {
|
|
|
+ tableDatas.push({
|
|
|
+ name: this.$getDmsTypes("appstatus", key),
|
|
|
+ value: statusMap[key],
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.dataToOption("应用状态分布", "pie", tableDatas, {
|
|
|
+ pieKey: { value: "value", name: "name" },
|
|
|
+ pieData: [],
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "error",
|
|
|
+ message: "服务器忙碌,请稍后重试!",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
- this.dataToOption("委办分布", "pie", datas, {
|
|
|
- pieKey: { value: "value", name: "name" },
|
|
|
- pieData: [],
|
|
|
- legend: {
|
|
|
- bottom: 10,
|
|
|
- },
|
|
|
- radius: "60%",
|
|
|
- padAngle: 0,
|
|
|
- borderRadius: 0,
|
|
|
- label: {},
|
|
|
- });
|
|
|
+ // 用户部门分布
|
|
|
this.dataToOption("用户部门分布", "bar", datas, {
|
|
|
showLegend: false,
|
|
|
xData: [],
|
|
|
@@ -286,8 +396,6 @@ export default {
|
|
|
label: {},
|
|
|
});
|
|
|
this.dataToOption("数据质量评分", "radar", null, null);
|
|
|
- // 表格数据初始化
|
|
|
- this.initTableDatas();
|
|
|
},
|
|
|
/**
|
|
|
* 数据转换为图表选项
|
|
|
@@ -452,11 +560,11 @@ export default {
|
|
|
radar: [
|
|
|
{
|
|
|
indicator: [
|
|
|
- { text: "健壮性", max: 100 },
|
|
|
- { text: "完整性", max: 100 },
|
|
|
- { text: "一致性", max: 100 },
|
|
|
- { text: "及时性", max: 100 },
|
|
|
- { text: "准确性", max: 100 },
|
|
|
+ { name: "健壮性", max: 100 },
|
|
|
+ { name: "完整性", max: 100 },
|
|
|
+ { name: "一致性", max: 100 },
|
|
|
+ { name: "及时性", max: 100 },
|
|
|
+ { name: "准确性", max: 100 },
|
|
|
],
|
|
|
},
|
|
|
],
|
|
|
@@ -478,24 +586,8 @@ export default {
|
|
|
this.chartOptions[title] = _option;
|
|
|
},
|
|
|
// 服务调用列表
|
|
|
- initTableDatas() {
|
|
|
- this.tableDatas = [
|
|
|
- {
|
|
|
- serviceName: "服务A",
|
|
|
- serviceType: "类别A",
|
|
|
- callCount: 100,
|
|
|
- },
|
|
|
- {
|
|
|
- serviceName: "服务B",
|
|
|
- serviceType: "类别B",
|
|
|
- callCount: 200,
|
|
|
- },
|
|
|
- {
|
|
|
- serviceName: "服务C",
|
|
|
- serviceType: "类别C",
|
|
|
- callCount: 300,
|
|
|
- },
|
|
|
- ];
|
|
|
+ initTableDatas(serviceTypeDatas2) {
|
|
|
+ this.tableDatas = serviceTypeDatas2;
|
|
|
},
|
|
|
// 时间范围自定义时间
|
|
|
shortcuts() {
|
|
|
@@ -554,26 +646,28 @@ export default {
|
|
|
width: calc(25% - 56px);
|
|
|
border-radius: 5px;
|
|
|
padding: 20px 18px;
|
|
|
- background: #00000032;
|
|
|
- box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.15);
|
|
|
+ // background: #00000032;
|
|
|
+ background: rgba(255, 255, 255, 0.1);
|
|
|
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
|
|
|
}
|
|
|
|
|
|
.card2 {
|
|
|
width: 100%;
|
|
|
border-radius: 5px;
|
|
|
padding: 20px 18px;
|
|
|
- background: #00000032;
|
|
|
- box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.15);
|
|
|
+ // background: rgba(255, 255, 255, 0.1);
|
|
|
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
|
|
|
}
|
|
|
|
|
|
.bigCard {
|
|
|
width: calc(100% - 36px);
|
|
|
border-radius: 5px;
|
|
|
padding: 20px 18px;
|
|
|
- background: #00000032;
|
|
|
+ // background: #00000032;
|
|
|
position: relative;
|
|
|
flex-direction: column;
|
|
|
- box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.15);
|
|
|
+ background: rgba(255, 255, 255, 0.1);
|
|
|
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
|
|
|
.tools {
|
|
|
position: absolute;
|
|
|
top: 20px;
|