From 085a3515d98d3d08b2e5f83e20b5cd1932728013 Mon Sep 17 00:00:00 2001
From: JINGYJ <1458671527@qq.com>
Date: Fri, 13 Oct 2023 17:58:28 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20bug=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/layout/components/navbar.vue | 2 +-
.../enterprise/components/DialogForm.vue | 13 +-
src/views/enterprise/index.vue | 23 +-
src/views/platformAlgorithm/index.vue | 233 +++++++++---------
.../project/details/components/BarDetail.vue | 2 +-
.../project/details/components/DialogForm.vue | 102 ++++++--
.../project/details/components/ModelCard.vue | 17 +-
src/views/project/details/components/Pie.vue | 3 +-
src/views/project/details/index.vue | 3 +-
src/views/screen/index.vue | 2 +
src/views/screen/mock.js | 12 +-
src/views/screen1/components/charts/Pie3D.vue | 2 +-
12 files changed, 247 insertions(+), 167 deletions(-)
diff --git a/src/layout/components/navbar.vue b/src/layout/components/navbar.vue
index 5c0d14d..e811f1d 100644
--- a/src/layout/components/navbar.vue
+++ b/src/layout/components/navbar.vue
@@ -46,7 +46,7 @@ const {
-
+
{{ username }}
diff --git a/src/views/enterprise/components/DialogForm.vue b/src/views/enterprise/components/DialogForm.vue
index 05b9bfb..b1ab134 100644
--- a/src/views/enterprise/components/DialogForm.vue
+++ b/src/views/enterprise/components/DialogForm.vue
@@ -31,16 +31,17 @@ const submitForm = async (formEl: FormInstance | undefined) => {
await formEl.validate(valid => {
if (valid) {
const data = formData;
+ emit("submit-form", data, props.type, multipleSelection.value);
if (props.type == "add") {
+ multipleTableRef.value.clearSelection();
message("添加成功", { type: "success" });
} else if (props.type == "edit") {
message("修改成功", { type: "success" });
} else {
message("新建成功", { type: "success" });
}
- emit("submit-form", data, props.type, multipleSelection.value);
formVisible.value = false;
- multipleTableRef.value.clearSelection();
+ // multipleTableRef.value.clearSelection();
formData.value = {};
}
});
@@ -53,7 +54,9 @@ const resetForm = (formEl: FormInstance | undefined) => {
const multipleTableRef = ref>();
const closeDialog = () => {
formVisible.value = false;
- multipleTableRef.value.clearSelection();
+ if (props.type == "add") {
+ multipleTableRef.value.clearSelection();
+ }
resetForm(ruleFormRef.value);
formData.value = {};
};
@@ -142,7 +145,9 @@ watch(
);
const rules = {
- name: [{ required: true, message: "请输入企业全称名称", trigger: "blur" }]
+ privateEnterprise: [
+ { required: true, message: "请输入企业全称名称", trigger: "blur" }
+ ]
};
diff --git a/src/views/enterprise/index.vue b/src/views/enterprise/index.vue
index 3ba3dd5..246fd44 100644
--- a/src/views/enterprise/index.vue
+++ b/src/views/enterprise/index.vue
@@ -106,7 +106,7 @@ const enterpriseInfo = ref({
isSelect: false
});
const pagination = reactive({
- total: 0,
+ total: 3,
pageSize: 10,
currentPage: 1,
background: false
@@ -163,6 +163,11 @@ function handleDelete(row) {
}
)
.then(() => {
+ const updatedListData = dataList.value.filter(
+ item => item.name !== row.name
+ );
+ dataList.value = updatedListData;
+ pagination.total = dataList.value.length;
message("删除成功", { type: "success" });
})
.catch(() => {});
@@ -185,6 +190,7 @@ const addEnterprise = (data, type, multipleSelection) => {
}
// enterprise.value.unshift(data.value);
// count.value++;
+ pagination.total = dataList.value.length;
};
const addCompany = () => {
customType.value = "";
@@ -272,11 +278,11 @@ onMounted(() => {
diff --git a/src/views/project/details/components/BarDetail.vue b/src/views/project/details/components/BarDetail.vue
index af2acf3..274a175 100644
--- a/src/views/project/details/components/BarDetail.vue
+++ b/src/views/project/details/components/BarDetail.vue
@@ -133,7 +133,7 @@ setOptions(
{
name: "已检出",
type: "bar",
- barWidth: "20%",
+ barWidth: "30%",
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
diff --git a/src/views/project/details/components/DialogForm.vue b/src/views/project/details/components/DialogForm.vue
index 9d5415f..272a610 100644
--- a/src/views/project/details/components/DialogForm.vue
+++ b/src/views/project/details/components/DialogForm.vue
@@ -109,11 +109,55 @@ const tableData = [
const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
- await formEl.validate(valid => {
- if (valid) {
- if (activeStep.value == 0 && customType.value == "newBuilt") {
+ if (activeStep.value == 0 && customType.value == "newBuilt") {
+ await formEl.validateField(["inputSource"], valid => {
+ if (valid) {
+ // 校验不通过
activeStep.value++;
- } else {
+ return;
+ }
+ });
+ } else if (customType.value == "alarm") {
+ await formEl.validateField(
+ ["platformWarn", "phone", "httpAddressA", "httpAddressB", "httpAddressC"],
+ valid => {
+ if (valid) {
+ // 校验不通过
+ console.log(valid);
+ message("配置成功", { type: "success" });
+ const data = formData.value;
+ console.log(data);
+ if (customType.value == "newBuilt") {
+ emit("submit-form", data);
+ }
+ formVisible.value = false;
+ formData.value = {};
+ activeStep.value = 0;
+ return;
+ }
+ }
+ );
+ } else if (customType.value == "algorithm") {
+ await formEl.validateField(["inputSource"], valid => {
+ if (valid) {
+ // 校验不通过
+ console.log(valid);
+ message("配置成功", { type: "success" });
+ const data = formData.value;
+ console.log(data);
+ if (customType.value == "newBuilt") {
+ emit("submit-form", data);
+ }
+ formVisible.value = false;
+ formData.value = {};
+ activeStep.value = 0;
+ return;
+ }
+ });
+ } else {
+ await formEl.validate(valid => {
+ console.log(valid);
+ if (valid) {
message("提交成功", { type: "success" });
// formVisible.value = false;
const data = formData.value;
@@ -127,8 +171,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
// closeDialog();
// resetForm(formEl);
}
- }
- });
+ });
+ }
};
const resetForm = (formEl: FormInstance | undefined) => {
@@ -137,24 +181,28 @@ const resetForm = (formEl: FormInstance | undefined) => {
};
const closeDialog = () => {
- formVisible.value = false;
- activeStep.value = 0;
- phoneChecked.value = false;
- httpFirst.value = false;
- httpSecond.value = false;
- httpThird.value = false;
- formData.value.inputSource = "";
- resetForm(ruleFormRef.value);
-};
-
-const nextStep = () => {
- if (activeStep.value == 1) {
+ if (activeStep.value == 1 && customType.value == "newBuilt") {
activeStep.value--;
} else {
- activeStep.value++;
+ formVisible.value = false;
+ activeStep.value = 0;
+ phoneChecked.value = false;
+ httpFirst.value = false;
+ httpSecond.value = false;
+ httpThird.value = false;
+ formData.value.inputSource = "";
+ resetForm(ruleFormRef.value);
}
};
+// const nextStep = () => {
+// if (activeStep.value == 1) {
+// activeStep.value--;
+// } else {
+// activeStep.value++;
+// }
+// };
+
const phoneChecked = ref(false);
const httpFirst = ref(false);
const httpSecond = ref(false);
@@ -210,7 +258,7 @@ watch(
customWidth.value = 790;
} else if (val == "alarm") {
title.value = "告警设置";
- customWidth.value = 580;
+ customWidth.value = 620;
} else if (val == "algorithm") {
title.value = "算法配置";
customWidth.value = 620;
@@ -278,7 +326,7 @@ const rules = {
>
@@ -551,19 +599,21 @@ const rules = {
diff --git a/src/views/project/details/components/ModelCard.vue b/src/views/project/details/components/ModelCard.vue
index 361dcec..9e6f5c0 100644
--- a/src/views/project/details/components/ModelCard.vue
+++ b/src/views/project/details/components/ModelCard.vue
@@ -394,18 +394,27 @@ setTimeout(() => {
box-sizing: border-box;
display: flex;
flex: 1;
- flex-wrap: wrap;
- align-items: center;
- justify-content: space-between;
+ flex-flow: column wrap;
+ // flex-flow: column wrap;
+ // align-items: center;
+ // justify-content: space-between;
height: 260px;
padding: 0;
background: #fff;
.list-item-image {
- flex: 40%;
+ flex: 48%;
height: 120px;
&:nth-of-type(odd) {
+ margin-bottom: 10px;
+ }
+
+ &:nth-of-type(1) {
+ margin-right: 10px;
+ }
+
+ &:nth-of-type(2) {
margin-right: 10px;
}
}
diff --git a/src/views/project/details/components/Pie.vue b/src/views/project/details/components/Pie.vue
index 4146158..f1b5bd1 100644
--- a/src/views/project/details/components/Pie.vue
+++ b/src/views/project/details/components/Pie.vue
@@ -68,7 +68,8 @@ setOptions(
label: {
formatter: function (params) {
return params.value + "%";
- }
+ },
+ fontWeight: 600
}
// emphasis: {
// itemStyle: {
diff --git a/src/views/project/details/index.vue b/src/views/project/details/index.vue
index c1b9eee..3569e06 100644
--- a/src/views/project/details/index.vue
+++ b/src/views/project/details/index.vue
@@ -39,8 +39,9 @@ const loading = ref(false);
const noMore = computed(() => count.value >= 5);
const disabled = computed(() => loading.value || noMore.value);
const load = type => {
- loading.value = true;
if (type == "add") {
+ loading.value = true;
+
nextTick(() => {
setTimeout(() => {
modelCardData.unshift({
diff --git a/src/views/screen/index.vue b/src/views/screen/index.vue
index 3e5930e..2003ed7 100644
--- a/src/views/screen/index.vue
+++ b/src/views/screen/index.vue
@@ -80,6 +80,8 @@ setInterval(() => {
state.data.card3.data[2].value = randomIntFn(0, 500);
state.data.card3.data[3].value = randomIntFn(0, 500);
state.data.card3.data[4].value = randomIntFn(0, 500);
+ state.data.card3.data[5].value = randomIntFn(0, 500);
+ state.data.card3.data[6].value = randomIntFn(0, 500);
}, 300);
//card4
diff --git a/src/views/screen/mock.js b/src/views/screen/mock.js
index c4cb503..1c9f65c 100644
--- a/src/views/screen/mock.js
+++ b/src/views/screen/mock.js
@@ -20,11 +20,13 @@ export const card2_data = {
export const card3_data = {
data: [
- { name: "08:20", value: 150 },
- { name: "10:00", value: 60 },
- { name: "13:00", value: 120 },
- { name: "15:00", value: 90 },
- { name: "17:00", value: 210 }
+ { name: "一", value: 150 },
+ { name: "二", value: 60 },
+ { name: "三", value: 120 },
+ { name: "四", value: 90 },
+ { name: "五", value: 210 },
+ { name: "六", value: 90 },
+ { name: "日", value: 210 }
]
};
diff --git a/src/views/screen1/components/charts/Pie3D.vue b/src/views/screen1/components/charts/Pie3D.vue
index 728a1e6..4324bfb 100644
--- a/src/views/screen1/components/charts/Pie3D.vue
+++ b/src/views/screen1/components/charts/Pie3D.vue
@@ -220,7 +220,7 @@ function getPie3D(pieData, internalDiameterRatio) {
labelLine: {
smooth: 0.2,
length: 10,
- length2: 50,
+ length2: 70,
lineStyle: {
color: "#fff" // 设置标示线的颜色
}