Commit 21364fc1 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化

parent daebc9b5
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"axios": "^1.4.0", "axios": "^1.4.0",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"crypto-js": "^4.1.1", "crypto-js": "^4.1.1",
"echarts": "^5.4.3", "echarts": "^5.5.1",
"element-ui": "^2.15.14", "element-ui": "^2.15.14",
"js-export-excel": "^1.1.4", "js-export-excel": "^1.1.4",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
:fixed="v.fixed" :fixed="v.fixed"
:formatter="v.formatter" :formatter="v.formatter"
:min-width="v.minWidth" :min-width="v.minWidth"
:show-overflow-tooltip="v.showOverflowTooltip"
> >
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -22,21 +22,28 @@ ...@@ -22,21 +22,28 @@
</template> </template>
<script> <script>
import { mapMutations } from "vuex"; import { mapMutations, mapActions } from "vuex";
import Header from "./components/Header.vue"; import Header from "./components/Header.vue";
import { getSiteTree } from "@/api/site"; import { getSiteTree } from "@/api/site";
import storage from "@/utils/storage";
export default { export default {
components: { components: {
Header, Header,
}, },
data() { data() {
return {}; return {
siteId: storage.get(2, "siteId"),
};
}, },
created() { created() {
this.getSiteTree(); this.getSiteTree();
this.getBusiness(this.siteId);
this.getDeptList(this.siteId);
this.getWindowList(this.siteId);
}, },
methods: { methods: {
...mapMutations("user", ["SET_areaTree"]), ...mapMutations("user", ["SET_areaTree"]),
...mapActions("user", ["getBusiness", "getDeptList", "getWindowList"]),
// 获取个人站点树 // 获取个人站点树
async getSiteTree() { async getSiteTree() {
let res = await getSiteTree({ let res = await getSiteTree({
......
...@@ -57,6 +57,13 @@ export default { ...@@ -57,6 +57,13 @@ export default {
], ],
}; };
}, },
watch: {
"$route.path"() {
this.$nextTick(() => {
this.handleDate();
});
},
},
methods: { methods: {
handleDate() { handleDate() {
this.$refs.Page.getDate(this.time); this.$refs.Page.getDate(this.time);
...@@ -72,11 +79,11 @@ export default { ...@@ -72,11 +79,11 @@ export default {
} }
95% { 95% {
transform: rotate(20turn); transform: rotate(30turn);
} }
100% { 100% {
transform: rotate(20turn); transform: rotate(30turn);
} }
} }
.engine { .engine {
...@@ -138,6 +145,6 @@ export default { ...@@ -138,6 +145,6 @@ export default {
} }
.engine-img { .engine-img {
// cubic-bezier(1, 0.05, 0.1, 1) // cubic-bezier(1, 0.05, 0.1, 1)
animation: rotate 5s cubic-bezier(1, -0.01, 0, 0.85) infinite; animation: rotate 5s cubic-bezier(1, -0.01, 0, 0.97) infinite;
} }
</style> </style>
This diff is collapsed.
This diff is collapsed.
<template> <template>
<div class="flex h-full w-full flex-col gap-2"> <div class="flex h-full w-full flex-col gap-2" v-loading="loading">
<div class="flex w-full items-center justify-between"> <div class="flex w-full items-center justify-between">
<div class="title"> <div class="title">
{{ title }} {{ title }}
</div> </div>
<div class="flex gap-4"> <div class="flex gap-4">
<el-button type="primary" size="small">导出</el-button> <el-button type="primary" size="small" @click="handleExport"
<el-input >导出</el-button
>
<el-select
v-if="type == 'business'"
size="small"
filterable
v-model="form.businessName"
placeholder="请选择业务"
clearable
>
<el-option
v-for="v in businessList"
:key="v.id"
:label="v.businessName"
:value="v.businessName"
>
</el-option>
</el-select>
<el-select
v-else-if="type == 'dept'"
size="small"
filterable
v-model="form.deptName"
placeholder="请选择部门"
clearable
>
<el-option
v-for="v in deptList"
:key="v.id"
:label="v.name"
:value="v.name"
>
</el-option>
</el-select>
<el-select
v-else-if="type == 'window'"
size="small"
filterable
v-model="form.windowNum"
placeholder="请选择窗口"
clearable clearable
>
<el-option
v-for="v in windowList"
:key="v.id"
:label="v.name + '-' + v.fromnum"
:value="v.fromnum"
>
</el-option>
</el-select>
<el-button
type="primary"
size="small" size="small"
style="width: 250px" v-if="type != 'hall'"
:placeholder="placeholder" @click="handleSearch"
v-model="searchVal" >搜索</el-button
></el-input> >
<el-button type="primary" size="small">搜索</el-button>
</div> </div>
</div> </div>
<div class="grid w-full grid-cols-2"> <div
:class="[
'w-full',
'grid',
data.length > 5 ? 'grid-cols-2' : 'grid-cols-1',
]"
>
<y-table <y-table
size="small" size="small"
border border
:column="column" :column="leftColumn"
:data="letTableData" :data="letTableData"
></y-table> ></y-table>
<y-table <y-table
v-if="data.length > 5" v-show="data.length > 5"
size="small" size="small"
border border
:column="column" :column="rightColumn"
:data="rightTableData" :data="rightTableData"
></y-table> ></y-table>
</div> </div>
...@@ -35,24 +91,44 @@ ...@@ -35,24 +91,44 @@
</template> </template>
<script> <script>
import { mapState } from "vuex";
import storage from "@/utils/storage";
export default { export default {
props: { props: {
data: { data: {
required: true,
type: Array, type: Array,
default: () => [], default: () => [],
}, },
type: {
required: true,
type: String,
default: "",
},
loading: {
type: Boolean,
default: false,
},
current: {
required: true,
type: Number,
default: 1,
},
size: {
required: true,
type: Number,
default: 10,
},
column: { column: {
required: true,
type: Array, type: Array,
default: () => [], default: () => [],
}, },
title: { title: {
required: true,
type: String, type: String,
default: "", default: "",
}, },
placeholder: {
type: String,
default: "请输入业务名称关键字搜索",
},
border: { border: {
type: Boolean, type: Boolean,
default: true, default: true,
...@@ -61,24 +137,66 @@ export default { ...@@ -61,24 +137,66 @@ export default {
data() { data() {
return { return {
searchVal: "", searchVal: "",
siteId: storage.get(2, "siteId"),
form: {
businessName: "",
deptName: "",
windowNum: "",
},
}; };
}, },
computed: { computed: {
...mapState("user", ["businessList", "deptList", "windowList"]),
leftColumn() {
let index = {
label: "排序",
type: "index",
lign: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 1;
},
};
return [index, ...this.column];
},
rightColumn() {
let index = {
label: "排序",
type: "index",
lign: "center",
index: (index) => {
return (this.current - 1) * this.size + index + 6;
},
};
return [index, ...this.column];
},
letTableData() { letTableData() {
let arr = this.data.slice(0, 5); let arr = this.data.slice(0, 5);
while (arr.length < 5) { if (arr.length) {
arr.push(null); while (arr.length < 5) {
arr.push(null);
}
} }
return arr; return arr;
}, },
rightTableData() { rightTableData() {
let arr = this.data.slice(5, 10); let arr = this.data.slice(5, 10);
while (arr.length < 5) { if (arr.length) {
arr.push(null); while (arr.length < 5) {
arr.push(null);
}
} }
return arr; return arr;
}, },
}, },
created() {},
methods: {
handleSearch() {
this.$emit("search", this.type, this.form);
},
handleExport() {
this.$emit("export", this.type, this.form);
},
},
}; };
</script> </script>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
:value="homeData.totalCount" :value="homeData.totalCount"
></el-statistic> ></el-statistic>
<div class="text-[14px] text-[#424E65]"> <div class="text-[14px] text-[#424E65]">
数仓最近汇聚时间:2024-06-26 23:59:59 数仓最近汇聚时间:{{ newTime }}
</div> </div>
</div> </div>
</div> </div>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
近30日数据总量趋势 近30日数据总量趋势
</div> </div>
<div class="echarts-box"> <div class="echarts-box">
<LineEchart :dataset="dataset"></LineEchart> <LineEchart :dataset="totalDataset"></LineEchart>
</div> </div>
</div> </div>
<div class="flex h-full w-full flex-col"> <div class="flex h-full w-full flex-col">
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
近30日排队数据总量趋势 近30日排队数据总量趋势
</div> </div>
<div class="echarts-box"> <div class="echarts-box">
<LineEchart :dataset="dataset" color="#1DCFB4"></LineEchart> <LineEchart :dataset="phDataset" color="#1DCFB4"></LineEchart>
</div> </div>
</div> </div>
<div class="flex h-full w-full flex-col"> <div class="flex h-full w-full flex-col">
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
近30日评价数据总量趋势 近30日评价数据总量趋势
</div> </div>
<div class="echarts-box"> <div class="echarts-box">
<LineEchart :dataset="dataset" color="#F57520"></LineEchart> <LineEchart :dataset="pjDataset" color="#F57520"></LineEchart>
</div> </div>
</div> </div>
</div> </div>
...@@ -84,26 +84,17 @@ export default { ...@@ -84,26 +84,17 @@ export default {
}, },
data() { data() {
return { return {
dataset: { totalDataset: {
dimensions: ["name", "value"], dimensions: ["name", "value"],
source: [ source: [],
{ },
name: "06-1", phDataset: {
value: 900000, dimensions: ["name", "value"],
}, source: [],
{ },
name: "06-2", pjDataset: {
value: 800000, dimensions: ["name", "value"],
}, source: [],
{
name: "06-3",
value: 700000,
},
{
name: "06-4",
value: 900000,
},
],
}, },
areaList: [ areaList: [
{ {
...@@ -186,16 +177,38 @@ export default { ...@@ -186,16 +177,38 @@ export default {
}, },
], ],
homeData: {}, homeData: {},
newTime: this.$moment().format("YYYY-MM-DD HH:mm:ss"),
}; };
}, },
created() { created() {
this.getHomeData(); this.getHomeData();
}, },
mounted() {},
methods: { methods: {
async getHomeData() { async getHomeData() {
let res = await getHomeData(); let res = await getHomeData();
if (res.data.code == 1) { if (res.data.code == 1) {
this.homeData = res.data.data; let { data } = res.data;
let { thirtyPhStatList, thirtyPjStatList, thirtyStatList } = data;
this.homeData = data;
this.totalDataset.source = thirtyStatList.map((item) => {
return {
name: `${item.month}-${item.day}`,
value: item.count,
};
});
this.phDataset.source = thirtyPhStatList.map((item) => {
return {
name: `${item.month}-${item.day}`,
value: item.phCount,
};
});
this.pjDataset.source = thirtyPjStatList.map((item) => {
return {
name: `${item.month}-${item.day}`,
value: item.pjCount,
};
});
} }
}, },
}, },
......
...@@ -44,7 +44,12 @@ export default { ...@@ -44,7 +44,12 @@ export default {
initChart(dataset) { initChart(dataset) {
let data = dataset.source || []; let data = dataset.source || [];
let dom = this.$refs.MyEchart; let dom = this.$refs.MyEchart;
this.myChart = this.$echarts.init(dom); // 获取或者初始化 ECharts 实例
this.myChart = this.$echarts.getInstanceByDom(dom);
if (!this.myChart) {
this.myChart = this.$echarts.init(dom);
}
let option = { let option = {
grid: { grid: {
top: "15%", top: "15%",
...@@ -52,7 +57,6 @@ export default { ...@@ -52,7 +57,6 @@ export default {
right: "5%", right: "5%",
bottom: "12%", bottom: "12%",
}, },
// 鼠标移入信息查看
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",
borderWidth: 0, borderWidth: 0,
...@@ -62,16 +66,17 @@ export default { ...@@ -62,16 +66,17 @@ export default {
}<br/><div style='margin-top:4px;padding:4px 8px;background:${this.hexToRgba( }<br/><div style='margin-top:4px;padding:4px 8px;background:${this.hexToRgba(
this.color, this.color,
0.1 0.1
)};color:${this.color}';border-radius:10px> )};color:${
<span style='margin-right:10px'>${params[0].seriesName}</span> this.color
${params[0].value.value}</div>`; };border-radius:4px'><span style='margin-right:20px'>${
params[0].seriesName
}</span>${params[0].value.value}</div>`;
}, },
}, },
dataZoom: [ dataZoom: [
{ {
// 开启数据平移
type: "inside", type: "inside",
show: true, show: false,
startValue: 0, startValue: 0,
endValue: this.endValue - 1, endValue: this.endValue - 1,
}, },
...@@ -106,7 +111,7 @@ export default { ...@@ -106,7 +111,7 @@ export default {
}, },
yAxis: { yAxis: {
type: "value", type: "value",
splitNumber: 3, // 配置 Y 轴数值间隔 splitNumber: 3,
axisLabel: { axisLabel: {
color: "#666", color: "#666",
}, },
...@@ -168,10 +173,16 @@ export default { ...@@ -168,10 +173,16 @@ export default {
], ],
dataset, dataset,
}; };
this.myChart.setOption(option); this.myChart.setOption(option);
// 适配 // 适配
window.addEventListener("resize", this.adapterEcharts); window.addEventListener("resize", this.adapterEcharts);
// 清除现有定时器,防止多次调用
clearInterval(this.timer); clearInterval(this.timer);
// 定义并启动定时器
this.timer = setInterval(() => { this.timer = setInterval(() => {
if (option.dataZoom[0].endValue >= data.length - 1) { if (option.dataZoom[0].endValue >= data.length - 1) {
option.dataZoom[0].endValue = this.endValue - 1; option.dataZoom[0].endValue = this.endValue - 1;
...@@ -180,15 +191,17 @@ export default { ...@@ -180,15 +191,17 @@ export default {
option.dataZoom[0].endValue += 1; option.dataZoom[0].endValue += 1;
option.dataZoom[0].startValue += 1; option.dataZoom[0].startValue += 1;
} }
option && this.myChart.setOption(option); this.myChart.setOption(option);
}, 2000); }, 2000);
//鼠标移入组件时停止轮播
// 绑定鼠标移入事件
this.myChart.on("mousemove", () => { this.myChart.on("mousemove", () => {
clearInterval(this.timer); //清除循环 clearInterval(this.timer); // 清除定时器
}); });
//鼠标移出组件时恢复轮播
// 绑定鼠标移出事件
this.myChart.on("mouseout", () => { this.myChart.on("mouseout", () => {
clearInterval(this.timer); //清除循环 clearInterval(this.timer); // 清除定时器
this.timer = setInterval(() => { this.timer = setInterval(() => {
if (option.dataZoom[0].endValue >= data.length - 1) { if (option.dataZoom[0].endValue >= data.length - 1) {
option.dataZoom[0].endValue = this.endValue - 1; option.dataZoom[0].endValue = this.endValue - 1;
...@@ -197,10 +210,11 @@ export default { ...@@ -197,10 +210,11 @@ export default {
option.dataZoom[0].endValue += 1; option.dataZoom[0].endValue += 1;
option.dataZoom[0].startValue += 1; option.dataZoom[0].startValue += 1;
} }
option && this.myChart.setOption(option); this.myChart.setOption(option);
}, 2000); }, 2000);
}); });
}, },
hexToRgba(hex, opacity) { hexToRgba(hex, opacity) {
let rgbaColor = ""; let rgbaColor = "";
let reg = /^#[\da-f]{6}$/i; let reg = /^#[\da-f]{6}$/i;
......
...@@ -119,6 +119,7 @@ const routes = [ ...@@ -119,6 +119,7 @@ const routes = [
}, },
{ {
path: "/market/evaluatereport", path: "/market/evaluatereport",
name: "evaluatereport",
hideChildrenInMenu: true, hideChildrenInMenu: true,
component: () => import("@/pages/market/EvaluateReport"), component: () => import("@/pages/market/EvaluateReport"),
meta: { meta: {
......
import { getSiteBusiness, getDepartment, getWindow } from "@/api/site";
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
menus: [], // 菜单 menus: [], // 菜单
token: "", token: "",
siteId: "", // 站点id siteId: "", // 站点id
deptList: [], // 部门列表
userInfo: {}, // 用户信息 userInfo: {}, // 用户信息
sysName: "", // 系统名称 sysName: "", // 系统名称
sysLogo: "", // 系统logo sysLogo: "", // 系统logo
path: "", // 门户跳转过来的路由 path: "", // 门户跳转过来的路由
areaTree: [], // 个人区域树 areaTree: [], // 个人区域树
businessList: [], // 站点业务列表
deptList: [], // 站点部门列表
windowList: [], // 站点窗口列表
}, },
getters: { getters: {
siteId(state) { siteId(state) {
...@@ -38,9 +41,6 @@ export default { ...@@ -38,9 +41,6 @@ export default {
SET_siteId(state, siteId) { SET_siteId(state, siteId) {
state.siteId = siteId; state.siteId = siteId;
}, },
SET_deptList(state, deptList) {
state.deptList = deptList;
},
SET_userInfo(state, userInfo) { SET_userInfo(state, userInfo) {
state.userInfo = userInfo; state.userInfo = userInfo;
}, },
...@@ -56,9 +56,55 @@ export default { ...@@ -56,9 +56,55 @@ export default {
SET_areaTree(state, areaTree) { SET_areaTree(state, areaTree) {
state.areaTree = areaTree; state.areaTree = areaTree;
}, },
SET_businessList(state, businessList) {
state.businessList = businessList;
},
SET_deptList(state, deptList) {
state.deptList = deptList;
},
SET_windowList(state, windowList) {
state.windowList = windowList;
},
// 重置所有仓库状态 // 重置所有仓库状态
reset: () => {}, reset: () => {},
}, },
actions: {}, actions: {
// 获取站点业务列表
getBusiness: async (context, siteId) => {
let res = await getSiteBusiness({
page: 1,
size: -1,
siteId,
});
if (res.data.code == 1) {
let { data } = res.data.data;
context.commit("SET_businessList", data);
}
},
// 获取站点部门列表
getDeptList: async (context, siteId) => {
let res = await getDepartment({
page: 1,
size: -1,
siteId,
});
if (res.data.code == 1) {
let { data } = res.data.data;
context.commit("SET_deptList", data);
}
},
// 获取站点窗口列表
getWindowList: async (context, siteId) => {
let res = await getWindow({
page: 1,
size: -1,
siteId,
});
if (res.data.code == 1) {
let { data } = res.data.data;
context.commit("SET_windowList", data);
}
},
},
}; };
...@@ -3109,13 +3109,13 @@ easy-stack@1.0.1: ...@@ -3109,13 +3109,13 @@ easy-stack@1.0.1:
resolved "https://registry.npmmirror.com/easy-stack/-/easy-stack-1.0.1.tgz" resolved "https://registry.npmmirror.com/easy-stack/-/easy-stack-1.0.1.tgz"
integrity sha512-wK2sCs4feiiJeFXn3zvY0p41mdU5VUgbgs1rNsc/y5ngFUijdWd+iIN8eoyuZHKB8xN6BL4PdWmzqFmxNg6V2w== integrity sha512-wK2sCs4feiiJeFXn3zvY0p41mdU5VUgbgs1rNsc/y5ngFUijdWd+iIN8eoyuZHKB8xN6BL4PdWmzqFmxNg6V2w==
echarts@^5.4.3: echarts@^5.5.1:
version "5.4.3" version "5.5.1"
resolved "https://registry.npmmirror.com/echarts/-/echarts-5.4.3.tgz" resolved "https://registry.npmmirror.com/echarts/-/echarts-5.5.1.tgz#8dc9c68d0c548934bedcb5f633db07ed1dd2101c"
integrity sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA== integrity sha512-Fce8upazaAXUVUVsjgV6mBnGuqgO+JNDlcgF79Dksy4+wgGpQB2lmYoO4TSweFg/mZITdpGHomw/cNBJZj1icA==
dependencies: dependencies:
tslib "2.3.0" tslib "2.3.0"
zrender "5.4.4" zrender "5.6.0"
ee-first@1.1.1: ee-first@1.1.1:
version "1.1.1" version "1.1.1"
...@@ -7000,9 +7000,9 @@ yorkie@^2.0.0: ...@@ -7000,9 +7000,9 @@ yorkie@^2.0.0:
normalize-path "^1.0.0" normalize-path "^1.0.0"
strip-indent "^2.0.0" strip-indent "^2.0.0"
zrender@5.4.4: zrender@5.6.0:
version "5.4.4" version "5.6.0"
resolved "https://registry.npmmirror.com/zrender/-/zrender-5.4.4.tgz" resolved "https://registry.npmmirror.com/zrender/-/zrender-5.6.0.tgz#01325b0bb38332dd5e87a8dbee7336cafc0f4a5b"
integrity sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw== integrity sha512-uzgraf4njmmHAbEUxMJ8Oxg+P3fT04O+9p7gY+wJRVxo8Ge+KmYv0WJev945EH4wFuc4OY2NLXz46FZrWS9xJg==
dependencies: dependencies:
tslib "2.3.0" tslib "2.3.0"
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