feat: 首页算力分配开发

dev-deviceSetting
JINGYJ 1 year ago
parent ee28c50602
commit 990bca24f0

@ -51,9 +51,11 @@ setOptions(
bottom: "10px",
textStyle: {
color: "rgba(255, 255, 255, 0.65)", //
fontSize: 14, // 14px
fontSize: 12, // 14px
fontWeight: "bold" //
},
itemWidth: 12,
itemHeight: 8,
data: [
{
name: "间隙告警",

@ -0,0 +1,159 @@
<script setup lang="ts">
import { ref, computed, watch, type Ref } from "vue";
import { useAppStoreHook } from "@/store/modules/app";
import {
delay,
useDark,
useECharts,
type EchartOptions
} from "@pureadmin/utils";
import * as echarts from "echarts/core";
const { isDark } = useDark();
const theme: EchartOptions["theme"] = computed(() => {
return isDark.value ? "dark" : "light";
});
const computingPowerPieChartRef = ref<HTMLDivElement | null>(null);
const { setOptions, resize } = useECharts(
computingPowerPieChartRef as Ref<HTMLDivElement>,
{
theme
}
);
setOptions(
{
title: {
show: false,
text: "算力占用",
left: "left",
textStyle: {
fontSize: 14,
color: "#333"
}
},
tooltip: {
trigger: "item",
formatter: function (params) {
//
return `${params.value}%`;
}
},
legend: {
show: false,
icon: "rect",
// orient: "vertical",
align: "auto",
bottom: "0",
// top: "40%",
// right: "15%",
// itemGap: 18,
textStyle: {
fontSize: 12,
color: "#333"
}
// right: true
},
color: ["#1BFFFD", "#FA783C", "#008FFF", "#0CB6FF", "#FFC97C"],
series: [
{
radius: ["32%", "50%"],
center: ["50%", "50%"],
type: "pie",
// silent: true,// false
label: {
fontSize: 14,
show: true,
formatter: "{b} {c}%",
color: "#fff",
position: "outside"
},
emphasis: {
disabled: true
},
labelLine: {
show: true,
length: 20,
length2: 25
},
name: "",
data: [
{ value: 15, name: "表面缺陷" },
{ value: 40, name: "晶圆缺陷" },
{ value: 20, name: "划伤检测" },
{ value: 15, name: "披锋缺陷" },
{ value: 10, name: "崩边缺陷" }
]
// label: {
// formatter: function (params) {
// return params.value + "%";
// },
// fontWeight: 600
// }
// emphasis: {
// itemStyle: {
// shadowBlur: 10,
// shadowOffsetX: 0,
// shadowColor: "rgba(0, 0, 0, 0.5)"
// }
// }
},
{
name: "外边框",
type: "pie",
clockwise: false, //
// silent: true,
center: ["50%", "50%"],
radius: ["60%", "60%"],
label: { show: false },
data: [
{
value: 9,
name: "",
itemStyle: {
borderWidth: 2,
borderColor: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(12, 182, 255, 0)"
},
{
offset: 1,
color: "rgba(12, 182, 255, 0.6)"
}
])
}
}
]
}
]
},
{
name: "click",
callback: params => {
console.log("click", params);
}
},
//
{
type: "zrender",
name: "click",
callback: params => {
console.log("点击空白处", params);
}
}
);
watch(
() => useAppStoreHook().getSidebarStatus,
() => {
delay(600).then(() => resize());
}
);
</script>
<template>
<div ref="computingPowerPieChartRef" style="width: 100%; height: 100%" />
</template>

@ -13,6 +13,7 @@ import DefectLine from "./components/DefectLine.vue";
import SeamlessScroll from "@/components/ReSeamlessScroll";
import AlarmInfoList from "../../components/alarmInfoList.vue";
import DeviceStatus from "../../components/deviceStatus.vue";
import ComputingPowerPie from "./components/ComputingPowerPie.vue";
import { DsBox2 } from "@/components/DsBox";
@ -20,31 +21,52 @@ const scroll = ref();
const listData = ref([
{
title: "无缝滚动第一行无缝滚动第一行"
type: 2,
label: "紧急",
des: "核心监测001设备发生告警请及时处理",
time: "今天10:03:01"
},
{
title: "无缝滚动第二行无缝滚动第二行"
type: 1,
label: "优先",
des: "核心监测001设备发生告警请及时处理",
time: "今天10:03:01"
},
{
title: "无缝滚动第三行无缝滚动第三行"
type: 0,
label: "一般",
des: "核心监测001设备发生告警请及时处理",
time: "今天10:03:01"
},
{
title: "无缝滚动第四行无缝滚动第四行"
type: 0,
label: "一般",
des: "核心监测001设备发生告警请及时处理",
time: "今天10:03:01"
},
{
title: "无缝滚动第五行无缝滚动第五行"
type: 2,
label: "紧急",
des: "核心监测001设备发生告警请及时处理",
time: "今天10:03:01"
},
{
title: "无缝滚动第六行无缝滚动第六行"
type: 1,
label: "优先",
des: "核心监测001设备发生告警请及时处理",
time: "今天10:03:01"
},
{
title: "无缝滚动第七行无缝滚动第七行"
type: 0,
label: "一般",
des: "核心监测001设备发生告警请及时处理",
time: "今天10:03:01"
},
{
title: "无缝滚动第八行无缝滚动第八行"
},
{
title: "无缝滚动第九行无缝滚动第九行"
type: 0,
label: "一般",
des: "核心监测001设备发生告警请及时处理",
time: "今天10:03:01"
}
]);
@ -119,8 +141,9 @@ const classOption = reactive({
<div class="right_box_1 mb-[24px]">
<DsBox2 title="算力分配" type="w1h1" bgClass="bg_home_item1">
<template #default>
<div class="w-full px-[24px] py-[8px]">
<div class="w-full h-full">
<!-- 算力分配 -->
<ComputingPowerPie />
</div>
</template>
</DsBox2>

@ -0,0 +1,245 @@
<script setup lang="ts">
import { computed, PropType } from "vue";
import generalIndustry from "@/assets/dataScreen/modelList/generalIndustry.png";
import phoneIndustry from "@/assets/dataScreen/modelList/phoneIndustry.png";
import photovoltaicIndustry from "@/assets/dataScreen/modelList/photovoltaicIndustry.png";
import pipeIndustry from "@/assets/dataScreen/modelList/pipeIndustry.png";
import mechanicalIndustry from "@/assets/dataScreen/modelList/mechanicalIndustry.png";
import lithiumBatteryIndustry from "@/assets/dataScreen/modelList/lithiumBatteryIndustry.png";
import healthcareIndustry from "@/assets/dataScreen/modelList/healthcareIndustry.png";
import foundryIndustry from "@/assets/dataScreen/modelList/foundryIndustry.png";
import electronicsIndustry from "@/assets/dataScreen/modelList/electronicsIndustry.png";
import bathroomIndustry from "@/assets/dataScreen/modelList/bathroomIndustry.png";
import bankIndustry from "@/assets/dataScreen/modelList/bankIndustry.png";
import PCBIndustry from "@/assets/dataScreen/modelList/PCBIndustry.png";
defineOptions({
name: "ModelBox"
});
interface CardProductType {
isEnabled: boolean;
state: string;
description: string;
deviceSort: string;
updateTime: string;
type: string;
version: string;
industry: string;
}
const props = defineProps({
modelData: {
type: Object as PropType<CardProductType>
}
});
const boxClass = computed(() => [
"model-box-inUsed",
{ "model-box-notUsed": props.modelData?.state !== "在线" }
]);
function getModelIcon(params: string) {
if (
params == "电子、手机、SMT" ||
params == "手机、电子、手机、工件装配、SMT" ||
params == "手机、电子、SMT" ||
params == "手机、液晶显示屏"
) {
return phoneIndustry;
} else if (
params ==
"机械、金属工件、线缆、铸造、薄膜、玻璃、造纸、铝板带、铝箔、铜箔、无纺布"
) {
return mechanicalIndustry;
} else if (
params == "PVC管材、金属管材、金属工件、塑料水管、汽车软管、线缆"
) {
return pipeIndustry;
} else if (params == "锂电池") {
return lithiumBatteryIndustry;
} else if (params == "食品、饮料、医疗卫生" || params == "食品、饮料") {
return healthcareIndustry;
} else if (params == "陶瓷、卫浴、瓷砖") {
return bathroomIndustry;
} else if (
params == "机加工、光伏、电子、SMT、手机、锂电池、精密零部件加工" ||
params == "光伏"
) {
return photovoltaicIndustry;
} else if (params == "钢铁、冶金、铸造") {
return foundryIndustry;
} else if (params == "银行、营业厅") {
return bankIndustry;
} else if (params == "机加工、电子、手机、精密零部件加工、汽车") {
return electronicsIndustry;
} else if (params == "PCB") {
return PCBIndustry;
} else {
return generalIndustry;
}
}
const emit = defineEmits(["check-detail", "delete-item"]);
const handleClickDetail = (modelData: CardProductType) => {
emit("check-detail", modelData);
};
// const stateClass = computed(() => [
// "model-state",
// { "model-state_offline": props.device?.state === "线" }
// ]);
</script>
<template>
<div :class="boxClass" @click="handleClickDetail(modelData)">
<div class="model-box-state" v-if="modelData.state === '在线'">使</div>
<div class="model-box-title">
<div class="model-box-name ff1">
{{ modelData.deviceSort }}
</div>
<div
:class="
modelData.type === '经典算法'
? 'model-box-type'
: 'model-box-type-deep'
"
>
{{ modelData.type }}
</div>
</div>
<div class="model-box-version">
<div class="model-box-version-icon" />
版本{{ modelData.version }}
</div>
<div class="model-box-industry">
<div class="model-box-industry-icon" />
<div class="model-box-industry-describe">
适用行业{{ modelData.industry }}
</div>
</div>
<!-- <div :class="getModelIcon(item.industry)" /> -->
<div class="model-box-icon">
<!-- <LazyImg :url="generalIndustry" /> -->
<img :src="getModelIcon(modelData.industry)" />
</div>
</div>
</template>
<style lang="scss" scoped>
.model-box-inUsed,
.model-box-notUsed {
box-sizing: border-box;
position: relative;
padding: 65px 20px 24px;
margin-top: 40px;
margin-bottom: 4px;
width: 100%;
height: 172px;
background: linear-gradient(
180deg,
rgba(255, 207, 95, 0.4) 0%,
rgba(255, 207, 95, 0) 100%
);
background-image: url("@/assets/dataScreen/modelList/inUsed.svg");
background-repeat: no-repeat;
cursor: pointer;
.model-box-state {
position: absolute;
top: 0;
right: 0;
width: 48px;
height: 24px;
background: #faad14;
font-size: 12px;
color: #fff;
text-align: center;
line-height: 24px;
border-radius: 8px 0px 8px 0px;
}
.model-box-title {
margin-bottom: 8px;
display: flex;
align-items: center;
justify-content: flex-start;
.model-box-name {
white-space: nowrap;
max-width: 8em;
overflow: hidden;
text-overflow: ellipsis;
font-size: 16px;
}
.model-box-type,
.model-box-type-deep {
margin-left: 16px;
width: 56px;
height: 20px;
background: linear-gradient(180deg, #21c7ff 0%, #428cff 100%);
border-radius: 2px;
font-size: 12px;
text-align: center;
line-height: 20px;
}
.model-box-type-deep {
background: linear-gradient(180deg, #ffb21a 0%, #ff9b3e 100%);
}
}
.model-box-version,
.model-box-industry {
display: flex;
align-items: center;
justify-content: flex-start;
font-size: 14px;
color: #fff;
.model-box-version-icon {
margin-right: 8px;
width: 16px;
height: 16px;
background: url("@/assets/dataScreen/modelList/modelVersion.svg")
no-repeat center center;
}
.model-box-industry-icon {
margin-right: 8px;
width: 16px;
height: 16px;
background: url("@/assets/dataScreen/modelList/modelIndustry.svg")
no-repeat center center;
}
.model-box-industry-describe {
white-space: nowrap;
max-width: 14em;
overflow: hidden;
text-overflow: ellipsis;
}
}
.model-box-version {
margin-bottom: 8px;
}
.model-box-icon,
.model-box-icon-phone,
.model-box-icon-mechanical {
position: absolute;
top: -40px;
left: 91px;
width: 72px;
height: 88px;
// background: url("@/assets/dataScreen/modelList/generalIndustry.svg")
// no-repeat center center;
}
// .model-box-icon-phone {
// background: url("@/assets/dataScreen/modelList/phoneIndustry.svg")
// no-repeat center center;
// }
// .model-box-icon-mechanical {
// background: url("@/assets/dataScreen/modelList/mechanicalIndustry.svg")
// no-repeat center center;
// }
}
.model-box-notUsed {
width: 100%;
height: 172px;
background: linear-gradient(180deg, #07428e 0%, rgba(7, 66, 142, 0) 100%);
background-image: url("@/assets/dataScreen/modelList/notUsed.svg");
background-repeat: no-repeat;
}
</style>

@ -8,19 +8,9 @@ import "vue-waterfall-plugin-next/dist/style.css";
import InfiniteLoading from "v3-infinite-loading";
import { onMounted, reactive, ref, nextTick } from "vue";
import backTop from "@/assets/svg/back_top.svg?component";
import generalIndustry from "@/assets/dataScreen/modelList/generalIndustry.png";
import phoneIndustry from "@/assets/dataScreen/modelList/phoneIndustry.png";
import photovoltaicIndustry from "@/assets/dataScreen/modelList/photovoltaicIndustry.png";
import pipeIndustry from "@/assets/dataScreen/modelList/pipeIndustry.png";
import mechanicalIndustry from "@/assets/dataScreen/modelList/mechanicalIndustry.png";
import lithiumBatteryIndustry from "@/assets/dataScreen/modelList/lithiumBatteryIndustry.png";
import healthcareIndustry from "@/assets/dataScreen/modelList/healthcareIndustry.png";
import foundryIndustry from "@/assets/dataScreen/modelList/foundryIndustry.png";
import electronicsIndustry from "@/assets/dataScreen/modelList/electronicsIndustry.png";
import bathroomIndustry from "@/assets/dataScreen/modelList/bathroomIndustry.png";
import bankIndustry from "@/assets/dataScreen/modelList/bankIndustry.png";
import PCBIndustry from "@/assets/dataScreen/modelList/PCBIndustry.png";
import { Waterfall } from "vue-waterfall-plugin-next";
import ModelBox from "./components/ModelBox.vue";
defineOptions({
name: "ModelList"
});
@ -72,7 +62,19 @@ const list = ref([]);
const pageSize = ref();
const loadingInstance = ref();
const modelDialogVisible = ref(false);
const modelInfo = ref();
const INITIAL_DATA = {
index: null,
industry: "",
state: "",
function: "",
deviceSort: "",
description: "",
version: "",
type: "",
provider: "",
updateTime: ""
};
const modelInfo = ref({ ...INITIAL_DATA });
/** 加载更多 */
function handleLoadMore() {
@ -100,53 +102,12 @@ function handleLoadMore() {
// list.value.splice(index, 1);
// }
function handleClick(item) {
console.log(item);
const handleBoxDetail = product => {
modelDialogVisible.value = true;
modelInfo.value = item;
console.log(modelInfo.value);
}
function getModelIcon(params: string) {
if (
params == "电子、手机、SMT" ||
params == "手机、电子、手机、工件装配、SMT" ||
params == "手机、电子、SMT" ||
params == "手机、液晶显示屏"
) {
return phoneIndustry;
} else if (
params ==
"机械、金属工件、线缆、铸造、薄膜、玻璃、造纸、铝板带、铝箔、铜箔、无纺布"
) {
return mechanicalIndustry;
} else if (
params == "PVC管材、金属管材、金属工件、塑料水管、汽车软管、线缆"
) {
return pipeIndustry;
} else if (params == "锂电池") {
return lithiumBatteryIndustry;
} else if (params == "食品、饮料、医疗卫生" || params == "食品、饮料") {
return healthcareIndustry;
} else if (params == "陶瓷、卫浴、瓷砖") {
return bathroomIndustry;
} else if (
params == "机加工、光伏、电子、SMT、手机、锂电池、精密零部件加工" ||
params == "光伏"
) {
return photovoltaicIndustry;
} else if (params == "钢铁、冶金、铸造") {
return foundryIndustry;
} else if (params == "银行、营业厅") {
return bankIndustry;
} else if (params == "机加工、电子、手机、精密零部件加工、汽车") {
return electronicsIndustry;
} else if (params == "PCB") {
return PCBIndustry;
} else {
return generalIndustry;
}
}
nextTick(() => {
modelInfo.value = { ...product };
});
};
onMounted(() => {
handleLoadMore();
@ -164,84 +125,10 @@ onMounted(() => {
<el-scrollbar height="810px" class="content">
<Waterfall :list="list" v-bind="options">
<template #item="{ item }">
<div
:class="
item.state === '在线'
? 'model-box-inUsed'
: 'model-box-notUsed'
"
@click="handleClick(item)"
>
<div class="model-box-state" v-if="item.state === '在线'">
使用中
</div>
<div class="model-box-title">
<div class="model-box-name ff1">
{{ item.deviceSort }}
</div>
<div
:class="
item.type === '经典算法'
? 'model-box-type'
: 'model-box-type-deep'
"
>
{{ item.type }}
</div>
</div>
<div class="model-box-version">
<div class="model-box-version-icon" />
版本{{ item.version }}
</div>
<div class="model-box-industry">
<div class="model-box-industry-icon" />
<div class="model-box-industry-describe">
适用行业{{ item.industry }}
</div>
</div>
<!-- <div :class="getModelIcon(item.industry)" /> -->
<div class="model-box-icon">
<!-- <LazyImg :url="generalIndustry" /> -->
<img :src="getModelIcon(item.industry)" />
</div>
<!-- {{ item }} -->
<!-- <div class="overflow-hidden">
<LazyImg
:url="url"
class="cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105"
/>
</div> -->
<!-- <div class="px-4 pt-2 pb-4 border-t border-t-gray-800">
<h4 class="pb-4 text-gray-50 group-hover:text-yellow-300">
{{ item.deviceSort }}
</h4>
<div
class="pt-3 flex justify-between items-center border-t border-t-gray-600 border-opacity-50"
>
<div class="text-gray-50">$ {{ item.price }}</div>
<div>
<button
class="px-3 h-7 rounded-full bg-red-500 text-sm text-white shadow-lg transition-all duration-300 hover:bg-red-600"
@click.stop="handleDelete(item, index)"
>
删除
</button>
</div>
</div>
</div> -->
</div>
<ModelBox :modelData="item" @check-detail="handleBoxDetail" />
</template>
</Waterfall>
<!-- <div class="flex justify-center py-10">
<button
class="px-5 py-2 rounded-full bg-gray-700 text-md text-white cursor-pointer hover:bg-gray-800 transition-all duration-300"
@click="handleLoadMore"
>
加载更多
</button>
</div> -->
<el-backtop
title="回到顶部"
:right="35"

Loading…
Cancel
Save