Commit 29cd91b8 authored by “yiyousong”'s avatar “yiyousong”

fix: 修复数据引擎数据偶尔不存在id时候显示错误

parent 19d7c16b
// prettier.config.js // prettier.config.js
module.exports = { module.exports = {
plugins: ['prettier-plugin-tailwindcss'], plugins: ["prettier-plugin-tailwindcss"],
} printWidth: 100, // 每行最多 100 个字符
\ No newline at end of file tabWidth: 2, // 每个缩进使用 2 个空格
useTabs: false, // 使用空格而不是制表符
semi: true, // 语句末尾加分号
singleQuote: true, // 使用单引号表示字符串
quoteProps: "as-needed", // 对象属性名仅在必要时使用引号
jsxSingleQuote: false, // JSX 使用双引号
trailingComma: "none", // 不添加尾逗号
bracketSpacing: true, // 对象花括号内有空格
jsxBracketSameLine: false, // JSX 的 `>` 换行
arrowParens: "always", // 箭头函数参数始终带括号
rangeStart: 0, // 从文件开始格式化
rangeEnd: Infinity, // 格式化到文件结尾
requirePragma: false, // 不需要特定注释
insertPragma: false, // 不插入注释
proseWrap: "preserve", // 保持原有换行
htmlWhitespaceSensitivity: "css", // 按 CSS 规则处理 HTML 空白
endOfLine: "lf", // 使用换行符 LF
};
...@@ -53,29 +53,29 @@ ...@@ -53,29 +53,29 @@
<script> <script>
export default { export default {
name: "YTable", name: 'YTable',
props: { props: {
loading: { loading: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
size: { size: {
type: String, type: String,
default: "", default: ''
}, },
data: { data: {
type: Array, type: Array,
default: () => [], default: () => []
}, },
column: { column: {
type: Array, type: Array,
default: () => [], default: () => []
}, },
rowkey: { rowkey: {
type: [String, Function], type: [String, Function],
default: "id", default: 'id'
}, }
}, },
data() { data() {
return {}; return {};
...@@ -89,8 +89,8 @@ export default { ...@@ -89,8 +89,8 @@ export default {
}); });
}, },
immediate: true, immediate: true,
deep: true, deep: true
}, }
}, },
computed: {}, computed: {},
created() {}, created() {},
...@@ -121,8 +121,8 @@ export default { ...@@ -121,8 +121,8 @@ export default {
}, },
toggleRowSelection() { toggleRowSelection() {
this.$refs.MyTable.toggleRowSelection(...arguments); this.$refs.MyTable.toggleRowSelection(...arguments);
}, }
}, }
}; };
</script> </script>
......
...@@ -5,11 +5,7 @@ ...@@ -5,11 +5,7 @@
{{ title }} {{ title }}
</div> </div>
<div class="flex gap-4"> <div class="flex gap-4">
<el-button <el-button type="primary" size="small" @click="handleExport" v-hasPermi="[hasPermiExport]"
type="primary"
size="small"
@click="handleExport"
v-hasPermi="[hasPermiExport]"
>导出</el-button >导出</el-button
> >
...@@ -22,13 +18,7 @@ ...@@ -22,13 +18,7 @@
clearable clearable
v-hasPermi="[hasPermiQuery]" v-hasPermi="[hasPermiQuery]"
> >
<el-option <el-option v-for="(v, i) in dict.pjOption" :key="i" :label="v" :value="v"> </el-option>
v-for="(v, i) in dict.pjOption"
:key="i"
:label="v"
:value="v"
>
</el-option>
</el-select> </el-select>
<el-select <el-select
v-else-if="type == 'business'" v-else-if="type == 'business'"
...@@ -91,22 +81,18 @@ ...@@ -91,22 +81,18 @@
> >
</div> </div>
</div> </div>
<div <div :class="['w-full', 'grid', data.length > 5 ? 'grid-cols-2' : 'grid-cols-1']">
:class="[
'w-full',
'grid',
data.length > 5 ? 'grid-cols-2' : 'grid-cols-1',
]"
>
<y-table <y-table
size="small" size="small"
border border
:rowkey="null"
:column="leftColumn" :column="leftColumn"
:data="letTableData" :data="letTableData"
></y-table> ></y-table>
<y-table <y-table
v-show="data.length > 5" v-show="data.length > 5"
size="small" size="small"
:rowkey="null"
border border
:column="rightColumn" :column="rightColumn"
:data="rightTableData" :data="rightTableData"
...@@ -116,91 +102,91 @@ ...@@ -116,91 +102,91 @@
</template> </template>
<script> <script>
import storage from "@/utils/storage"; import storage from '@/utils/storage';
export default { export default {
props: { props: {
data: { data: {
required: true, required: true,
type: Array, type: Array,
default: () => [], default: () => []
}, },
type: { type: {
required: true, required: true,
type: String, type: String,
default: "", default: ''
}, },
loading: { loading: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
current: { current: {
required: true, required: true,
type: Number, type: Number,
default: 1, default: 1
}, },
size: { size: {
required: true, required: true,
type: Number, type: Number,
default: 10, default: 10
}, },
column: { column: {
required: true, required: true,
type: Array, type: Array,
default: () => [], default: () => []
}, },
title: { title: {
required: true, required: true,
type: String, type: String,
default: "", default: ''
}, },
border: { border: {
type: Boolean, type: Boolean,
default: true, default: true
}, },
dict: { dict: {
required: true, required: true,
type: Object, type: Object,
default: () => {}, default: () => {}
}, },
hasPermiQuery: { hasPermiQuery: {
type: String, type: String
}, },
hasPermiExport: { hasPermiExport: {
type: String, type: String
}, }
}, },
data() { data() {
return { return {
searchVal: "", searchVal: '',
siteId: storage.get(2, "siteId"), siteId: storage.get(2, 'siteId'),
form: { form: {
pjOption: "", pjOption: '',
deptName: "", deptName: '',
windowNum: "", windowNum: '',
businessName: "", businessName: ''
}, }
}; };
}, },
computed: { computed: {
leftColumn() { leftColumn() {
let index = { let index = {
label: "排序", label: '排序',
type: "index", type: 'index',
align: "center", align: 'center',
index: (index) => { index: (index) => {
return (this.current - 1) * this.size + index + 1; return (this.current - 1) * this.size + index + 1;
}, }
}; };
return [index, ...this.column]; return [index, ...this.column];
}, },
rightColumn() { rightColumn() {
let index = { let index = {
label: "排序", label: '排序',
type: "index", type: 'index',
align: "center", align: 'center',
index: (index) => { index: (index) => {
return (this.current - 1) * this.size + index + 6; return (this.current - 1) * this.size + index + 6;
}, }
}; };
return [index, ...this.column]; return [index, ...this.column];
}, },
...@@ -221,15 +207,15 @@ export default { ...@@ -221,15 +207,15 @@ export default {
} }
} }
return arr; return arr;
}, }
}, },
created() {}, created() {},
methods: { methods: {
handleSearch() { handleSearch() {
this.$emit("search", this.type, this.form); this.$emit('search', this.type, this.form);
}, },
handleExport() { handleExport() {
this.$emit("export", this.type, this.form); this.$emit('export', this.type, this.form);
}, },
getTopKeyList(arr) { getTopKeyList(arr) {
if (arr) { if (arr) {
...@@ -237,8 +223,8 @@ export default { ...@@ -237,8 +223,8 @@ export default {
} else { } else {
return []; return [];
} }
}, }
}, }
}; };
</script> </script>
......
<template> <template>
<div <div class="home flex min-h-full w-full flex-col items-center" v-loading="loading">
class="home flex min-h-full w-full flex-col items-center"
v-loading="loading"
>
<div class="top-data-total flex h-[360px] w-full justify-center pt-[66px]"> <div class="top-data-total flex h-[360px] w-full justify-center pt-[66px]">
<div class="flex h-full flex-col"> <div class="flex h-full flex-col">
<div class="mb-[53px] flex flex-col items-center"> <div class="mb-[53px] flex flex-col items-center">
<div class="title mb-[28px]">您好,欢迎使用数据仓库工作台</div> <div class="title mb-[28px]">您好,欢迎使用数据仓库工作台</div>
<div class="area-total"> <div class="area-total">
累计接入站点: {{ homeData.totalAccessSite ?? 0 }} 累计接入站点: {{ homeData.totalAccessSite ?? 0 }}个 (含区/县、镇/街道)
(含区/县、镇/街道)
</div> </div>
</div> </div>
<div class="data-total flex justify-center"> <div class="data-total flex justify-center">
<div class="name">累计汇聚数据:(条)</div> <div class="name">累计汇聚数据:(条)</div>
<div class="flex flex-col justify-center gap-4"> <div class="flex flex-col justify-center gap-4">
<el-statistic <el-statistic group-separator="," :value="homeData.totalCount"></el-statistic>
group-separator=","
:value="homeData.totalCount"
></el-statistic>
<div class="text-[14px] text-[#424E65]"> <div class="text-[14px] text-[#424E65]">
数仓汇聚时间范围:2023-01-01 00:00:00至{{ 数仓汇聚时间范围:2023-01-01 00:00:00至{{ homeData.lastStatUpdateTime }}
homeData.lastStatUpdateTime
}}
</div> </div>
</div> </div>
</div> </div>
...@@ -30,33 +21,23 @@ ...@@ -30,33 +21,23 @@
</div> </div>
<div class="main w-[90%]"> <div class="main w-[90%]">
<!-- 主题数据分析 --> <!-- 主题数据分析 -->
<div <div class="theme-data-analyse mb-[36px] flex w-full flex-col items-center">
class="theme-data-analyse mb-[36px] flex w-full flex-col items-center"
>
<div class="main-title">主题数据分析</div> <div class="main-title">主题数据分析</div>
<div <div class="grid h-[270px] w-full grid-cols-3 gap-4 rounded-[8px] bg-white p-[20px]">
class="grid h-[270px] w-full grid-cols-3 gap-4 rounded-[8px] bg-white p-[20px]"
>
<div class="flex h-full w-full flex-col"> <div class="flex h-full w-full flex-col">
<div class="mb-[18px] text-[18px] text-[#232323]"> <div class="mb-[18px] text-[18px] text-[#232323]">近30日数据总量趋势</div>
近30日数据总量趋势
</div>
<div class="echarts-box"> <div class="echarts-box">
<LineEchart :dataset="totalDataset"></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">
<div class="mb-[18px] text-[18px] text-[#232323]"> <div class="mb-[18px] text-[18px] text-[#232323]">近30日排队数据总量趋势</div>
近30日排队数据总量趋势
</div>
<div class="echarts-box"> <div class="echarts-box">
<LineEchart :dataset="phDataset" 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">
<div class="mb-[18px] text-[18px] text-[#232323]"> <div class="mb-[18px] text-[18px] text-[#232323]">近30日评价数据总量趋势</div>
近30日评价数据总量趋势
</div>
<div class="echarts-box"> <div class="echarts-box">
<LineEchart :dataset="pjDataset" color="#F57520"></LineEchart> <LineEchart :dataset="pjDataset" color="#F57520"></LineEchart>
</div> </div>
...@@ -67,11 +48,7 @@ ...@@ -67,11 +48,7 @@
<div class="flex w-full flex-col items-center"> <div class="flex w-full flex-col items-center">
<div class="main-title">对接站点矩阵</div> <div class="main-title">对接站点矩阵</div>
<div class="area-list grid w-full grid-cols-7 gap-5"> <div class="area-list grid w-full grid-cols-7 gap-5">
<AreaCard <AreaCard v-for="v in homeData.accessList" :key="v.id" :data="v"></AreaCard>
v-for="v in homeData.accessList"
:key="v.id"
:data="v"
></AreaCard>
</div> </div>
</div> </div>
</div> </div>
...@@ -79,30 +56,30 @@ ...@@ -79,30 +56,30 @@
</template> </template>
<script> <script>
import LineEchart from "./components/LineEchart.vue"; import LineEchart from './components/LineEchart.vue';
import AreaCard from "./components/AreaCard.vue"; import AreaCard from './components/AreaCard.vue';
import { getHomeData } from "@/api/home"; import { getHomeData } from '@/api/home';
export default { export default {
components: { components: {
LineEchart, LineEchart,
AreaCard, AreaCard
}, },
data() { data() {
return { return {
loading: false, loading: false,
totalDataset: { totalDataset: {
dimensions: ["name", "value"], dimensions: ['name', 'value'],
source: [], source: []
}, },
phDataset: { phDataset: {
dimensions: ["name", "value"], dimensions: ['name', 'value'],
source: [], source: []
}, },
pjDataset: { pjDataset: {
dimensions: ["name", "value"], dimensions: ['name', 'value'],
source: [], source: []
}, },
homeData: {}, homeData: {}
}; };
}, },
created() { created() {
...@@ -122,34 +99,33 @@ export default { ...@@ -122,34 +99,33 @@ export default {
const formatData = (list, valueKey) => { const formatData = (list, valueKey) => {
return list return list
.map((item) => { .map((item) => {
let formattedDate = `${item.year}-${String(item.month).padStart( let formattedDate = `${item.year}-${String(item.month).padStart(2, '0')}-${String(
2, item.day
"0" ).padStart(2, '0')}`;
)}-${String(item.day).padStart(2, "0")}`;
return { return {
name: formattedDate, name: formattedDate,
value: item[valueKey], value: item[valueKey]
}; };
}) })
.reverse(); .reverse();
}; };
this.totalDataset.source = formatData(thirtyStatList, "count"); this.totalDataset.source = formatData(thirtyStatList, 'count');
this.phDataset.source = formatData(thirtyPhStatList, "phCount"); this.phDataset.source = formatData(thirtyPhStatList, 'phCount');
this.pjDataset.source = formatData(thirtyPjStatList, "pjCount"); this.pjDataset.source = formatData(thirtyPjStatList, 'pjCount');
} }
}, }
}, }
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.home { .home {
padding-bottom: 100px; padding-bottom: 100px;
background: url("@/assets/img/bg-2.png") no-repeat center bottom; background: url('@/assets/img/bg-2.png') no-repeat center bottom;
} }
.top-data-total { .top-data-total {
background: url("@/assets/img/banner.png") no-repeat center / 100% 100%; background: url('@/assets/img/banner.png') no-repeat center / 100% 100%;
// font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
.title { .title {
// font-family: FZZhengHeiS-EB-GB; // font-family: FZZhengHeiS-EB-GB;
...@@ -166,7 +142,7 @@ export default { ...@@ -166,7 +142,7 @@ export default {
.data-total { .data-total {
width: 870px; width: 870px;
height: 100px; height: 100px;
background: url("@/assets/img/total-bg.png") no-repeat center / 100% 100%; background: url('@/assets/img/total-bg.png') no-repeat center / 100% 100%;
position: relative; position: relative;
.name { .name {
position: absolute; position: absolute;
......
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