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

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

parent 19d7c16b
// prettier.config.js
module.exports = {
plugins: ['prettier-plugin-tailwindcss'],
}
\ No newline at end of file
plugins: ["prettier-plugin-tailwindcss"],
printWidth: 100, // 每行最多 100 个字符
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 @@
<script>
export default {
name: "YTable",
name: 'YTable',
props: {
loading: {
type: Boolean,
default: false,
default: false
},
size: {
type: String,
default: "",
default: ''
},
data: {
type: Array,
default: () => [],
default: () => []
},
column: {
type: Array,
default: () => [],
default: () => []
},
rowkey: {
type: [String, Function],
default: "id",
},
default: 'id'
}
},
data() {
return {};
......@@ -89,8 +89,8 @@ export default {
});
},
immediate: true,
deep: true,
},
deep: true
}
},
computed: {},
created() {},
......@@ -121,8 +121,8 @@ export default {
},
toggleRowSelection() {
this.$refs.MyTable.toggleRowSelection(...arguments);
},
},
}
}
};
</script>
......
......@@ -5,11 +5,7 @@
{{ title }}
</div>
<div class="flex gap-4">
<el-button
type="primary"
size="small"
@click="handleExport"
v-hasPermi="[hasPermiExport]"
<el-button type="primary" size="small" @click="handleExport" v-hasPermi="[hasPermiExport]"
>导出</el-button
>
......@@ -22,13 +18,7 @@
clearable
v-hasPermi="[hasPermiQuery]"
>
<el-option
v-for="(v, i) in dict.pjOption"
:key="i"
:label="v"
:value="v"
>
</el-option>
<el-option v-for="(v, i) in dict.pjOption" :key="i" :label="v" :value="v"> </el-option>
</el-select>
<el-select
v-else-if="type == 'business'"
......@@ -91,22 +81,18 @@
>
</div>
</div>
<div
:class="[
'w-full',
'grid',
data.length > 5 ? 'grid-cols-2' : 'grid-cols-1',
]"
>
<div :class="['w-full', 'grid', data.length > 5 ? 'grid-cols-2' : 'grid-cols-1']">
<y-table
size="small"
border
:rowkey="null"
:column="leftColumn"
:data="letTableData"
></y-table>
<y-table
v-show="data.length > 5"
size="small"
:rowkey="null"
border
:column="rightColumn"
:data="rightTableData"
......@@ -116,91 +102,91 @@
</template>
<script>
import storage from "@/utils/storage";
import storage from '@/utils/storage';
export default {
props: {
data: {
required: true,
type: Array,
default: () => [],
default: () => []
},
type: {
required: true,
type: String,
default: "",
default: ''
},
loading: {
type: Boolean,
default: false,
default: false
},
current: {
required: true,
type: Number,
default: 1,
default: 1
},
size: {
required: true,
type: Number,
default: 10,
default: 10
},
column: {
required: true,
type: Array,
default: () => [],
default: () => []
},
title: {
required: true,
type: String,
default: "",
default: ''
},
border: {
type: Boolean,
default: true,
default: true
},
dict: {
required: true,
type: Object,
default: () => {},
default: () => {}
},
hasPermiQuery: {
type: String,
type: String
},
hasPermiExport: {
type: String,
},
type: String
}
},
data() {
return {
searchVal: "",
siteId: storage.get(2, "siteId"),
searchVal: '',
siteId: storage.get(2, 'siteId'),
form: {
pjOption: "",
deptName: "",
windowNum: "",
businessName: "",
},
pjOption: '',
deptName: '',
windowNum: '',
businessName: ''
}
};
},
computed: {
leftColumn() {
let index = {
label: "排序",
type: "index",
align: "center",
label: '排序',
type: 'index',
align: 'center',
index: (index) => {
return (this.current - 1) * this.size + index + 1;
},
}
};
return [index, ...this.column];
},
rightColumn() {
let index = {
label: "排序",
type: "index",
align: "center",
label: '排序',
type: 'index',
align: 'center',
index: (index) => {
return (this.current - 1) * this.size + index + 6;
},
}
};
return [index, ...this.column];
},
......@@ -221,15 +207,15 @@ export default {
}
}
return arr;
},
}
},
created() {},
methods: {
handleSearch() {
this.$emit("search", this.type, this.form);
this.$emit('search', this.type, this.form);
},
handleExport() {
this.$emit("export", this.type, this.form);
this.$emit('export', this.type, this.form);
},
getTopKeyList(arr) {
if (arr) {
......@@ -237,8 +223,8 @@ export default {
} else {
return [];
}
},
},
}
}
};
</script>
......
<template>
<div
class="home flex min-h-full w-full flex-col items-center"
v-loading="loading"
>
<div 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="flex h-full flex-col">
<div class="mb-[53px] flex flex-col items-center">
<div class="title mb-[28px]">您好,欢迎使用数据仓库工作台</div>
<div class="area-total">
累计接入站点: {{ homeData.totalAccessSite ?? 0 }}
(含区/县、镇/街道)
累计接入站点: {{ homeData.totalAccessSite ?? 0 }}个 (含区/县、镇/街道)
</div>
</div>
<div class="data-total flex justify-center">
<div class="name">累计汇聚数据:(条)</div>
<div class="flex flex-col justify-center gap-4">
<el-statistic
group-separator=","
:value="homeData.totalCount"
></el-statistic>
<el-statistic group-separator="," :value="homeData.totalCount"></el-statistic>
<div class="text-[14px] text-[#424E65]">
数仓汇聚时间范围:2023-01-01 00:00:00至{{
homeData.lastStatUpdateTime
}}
数仓汇聚时间范围:2023-01-01 00:00:00至{{ homeData.lastStatUpdateTime }}
</div>
</div>
</div>
......@@ -30,33 +21,23 @@
</div>
<div class="main w-[90%]">
<!-- 主题数据分析 -->
<div
class="theme-data-analyse mb-[36px] flex w-full flex-col items-center"
>
<div class="theme-data-analyse mb-[36px] flex w-full flex-col items-center">
<div class="main-title">主题数据分析</div>
<div
class="grid h-[270px] w-full grid-cols-3 gap-4 rounded-[8px] bg-white p-[20px]"
>
<div 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="mb-[18px] text-[18px] text-[#232323]">
近30日数据总量趋势
</div>
<div class="mb-[18px] text-[18px] text-[#232323]">近30日数据总量趋势</div>
<div class="echarts-box">
<LineEchart :dataset="totalDataset"></LineEchart>
</div>
</div>
<div class="flex h-full w-full flex-col">
<div class="mb-[18px] text-[18px] text-[#232323]">
近30日排队数据总量趋势
</div>
<div class="mb-[18px] text-[18px] text-[#232323]">近30日排队数据总量趋势</div>
<div class="echarts-box">
<LineEchart :dataset="phDataset" color="#1DCFB4"></LineEchart>
</div>
</div>
<div class="flex h-full w-full flex-col">
<div class="mb-[18px] text-[18px] text-[#232323]">
近30日评价数据总量趋势
</div>
<div class="mb-[18px] text-[18px] text-[#232323]">近30日评价数据总量趋势</div>
<div class="echarts-box">
<LineEchart :dataset="pjDataset" color="#F57520"></LineEchart>
</div>
......@@ -67,11 +48,7 @@
<div class="flex w-full flex-col items-center">
<div class="main-title">对接站点矩阵</div>
<div class="area-list grid w-full grid-cols-7 gap-5">
<AreaCard
v-for="v in homeData.accessList"
:key="v.id"
:data="v"
></AreaCard>
<AreaCard v-for="v in homeData.accessList" :key="v.id" :data="v"></AreaCard>
</div>
</div>
</div>
......@@ -79,30 +56,30 @@
</template>
<script>
import LineEchart from "./components/LineEchart.vue";
import AreaCard from "./components/AreaCard.vue";
import { getHomeData } from "@/api/home";
import LineEchart from './components/LineEchart.vue';
import AreaCard from './components/AreaCard.vue';
import { getHomeData } from '@/api/home';
export default {
components: {
LineEchart,
AreaCard,
AreaCard
},
data() {
return {
loading: false,
totalDataset: {
dimensions: ["name", "value"],
source: [],
dimensions: ['name', 'value'],
source: []
},
phDataset: {
dimensions: ["name", "value"],
source: [],
dimensions: ['name', 'value'],
source: []
},
pjDataset: {
dimensions: ["name", "value"],
source: [],
dimensions: ['name', 'value'],
source: []
},
homeData: {},
homeData: {}
};
},
created() {
......@@ -122,34 +99,33 @@ export default {
const formatData = (list, valueKey) => {
return list
.map((item) => {
let formattedDate = `${item.year}-${String(item.month).padStart(
2,
"0"
)}-${String(item.day).padStart(2, "0")}`;
let formattedDate = `${item.year}-${String(item.month).padStart(2, '0')}-${String(
item.day
).padStart(2, '0')}`;
return {
name: formattedDate,
value: item[valueKey],
value: item[valueKey]
};
})
.reverse();
};
this.totalDataset.source = formatData(thirtyStatList, "count");
this.phDataset.source = formatData(thirtyPhStatList, "phCount");
this.pjDataset.source = formatData(thirtyPjStatList, "pjCount");
this.totalDataset.source = formatData(thirtyStatList, 'count');
this.phDataset.source = formatData(thirtyPhStatList, 'phCount');
this.pjDataset.source = formatData(thirtyPjStatList, 'pjCount');
}
}
}
},
},
};
</script>
<style lang="less" scoped>
.home {
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 {
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;
.title {
// font-family: FZZhengHeiS-EB-GB;
......@@ -166,7 +142,7 @@ export default {
.data-total {
width: 870px;
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;
.name {
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