fix: bug修改

develop
JINGYJ 2 years ago
parent be4123bd29
commit 085a3515d9

@ -46,7 +46,7 @@ const {
<!-- 通知 -->
<Notice id="header-notice" />
<!-- 退出登录 -->
<el-dropdown trigger="click">
<el-dropdown trigger="click" class="mr-6">
<span class="el-dropdown-link navbar-bg-hover select-none">
<img :src="userAvatar" :style="avatarsStyle" />
<p v-if="username" class="dark:text-white">{{ username }}</p>

@ -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<InstanceType<typeof ElTable>>();
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" }
]
};
</script>

@ -106,7 +106,7 @@ const enterpriseInfo = ref({
isSelect: false
});
const pagination = reactive<PaginationProps>({
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(() => {
<div class="w-[21%] h-full float-left">
<el-card
class="box-card-left"
:style="{ height: `calc(${height}px - 10vh - 20px)` }"
:style="{ height: `calc(${height}px - 130px)` }"
>
<template #header>
<div class="card-header flex justify-between">
<span class="w-[30%] font-semibold">企业列表</span>
<span class="w-[50%] font-semibold">企业列表</span>
</div>
</template>
<el-input
@ -288,7 +294,11 @@ onMounted(() => {
/>
<el-scrollbar max-height="1000px">
<p
v-for="(item, index) in enterprise"
v-for="(item, index) in enterprise.filter(v =>
v.privateEnterprise
.toLowerCase()
.includes(input.toLowerCase())
)"
:key="index"
:class="
item.isSelect ? 'enterprise-id-select ' : 'scrollbar-item'
@ -302,10 +312,7 @@ onMounted(() => {
</el-card>
</div>
<div class="float-right w-[78%]">
<el-card
class="box-card-right"
:style="{ height: `calc(${height}px - 10vh - 20px)` }"
>
<el-card class="box-card-right">
<template #header>
<div class="card-header flex justify-between">
<span class="font-semibold">企业详情</span>

@ -86,7 +86,7 @@ const columns: TableColumnList = [
function handleDelete(row) {
// message(`${row.name}`, { type: "success" });
// onSearch();
console.log(row);
// console.log(row);
ElMessageBox.confirm(
"确定删除这个算法吗,删除后将无法找回,请谨慎操作",
"确定删除这个算法吗?",
@ -116,23 +116,26 @@ function handleDelete(row) {
}
function searchValue() {
dataStaticList.value = dataStaticList.value.filter(function (val) {
return val.type == algorithmValue.value; // id
});
// dataStaticList.value = dataStaticList.value.filter(function (val) {
// return val.industry == typeValue.value; // id
// });
// dataStaticList.value = dataStaticList.value.filter(function (val) {
// return val.function == defectValue.value; // id
// });
console.log(dataStaticList.value);
const list = getPagedData(
dataStaticList.value,
pagination.currentPage,
pagination.pageSize
);
const data = dataStaticList.value
.filter(v =>
v.type.toLowerCase().includes(algorithmValue.value.toLowerCase())
)
.filter(v =>
v.industry.toLowerCase().includes(typeValue.value.toLowerCase())
)
.filter(v =>
v.function.toLowerCase().includes(defectValue.value.toLowerCase())
);
const list = getPagedData(data, pagination.currentPage, pagination.pageSize);
dataList.value = list.data;
pagination.total = dataStaticList.value.length;
pagination.total = data.length;
}
function handleRefresh() {
algorithmValue.value = "";
typeValue.value = "";
defectValue.value = "";
searchValue();
}
function handleSizeChange(val: number) {
@ -152,7 +155,7 @@ function handleSelectionChange(val) {
async function onSearch(page = 1, size = 15) {
loading.value = true;
const { data } = await getAlgorithmList();
console.log(data);
// console.log(data);
// productList.value = data.list;
// pagination.value = {
// ...pagination.value,
@ -160,7 +163,7 @@ async function onSearch(page = 1, size = 15) {
// };
dataStaticList.value = data.list;
const list = getPagedData(data.list, page, size);
console.log(list);
// console.log(list);
dataList.value = list.data;
pagination.total = data.list.length;
// pagination.pageSize = data.pageSize;
@ -184,7 +187,7 @@ const typeValue = ref("");
const defectValue = ref("");
const options = [
{
value: "全部",
value: "",
label: "全部"
},
{
@ -198,11 +201,11 @@ const options = [
];
const optionsB = [
{
value: "全部",
value: "",
label: "全部"
},
{
value: "通用",
value: "通用",
label: "通用类"
},
{
@ -220,7 +223,7 @@ const optionsB = [
];
const optionsC = [
{
value: "全部",
value: "",
label: "全部"
},
{
@ -286,101 +289,101 @@ const formDialogVisible = ref(false);
</el-button>
</el-empty>
</el-card>
<template v-if="pagination.total > 0">
<el-card shadow="never">
<template #header>
<div>
<span class="font-bold">苏胜天算法库</span
><span class="font-bold">({{ pagination.total }})</span>
</div>
</template>
<div class="w-full flex justify-stretch mb-4">
<el-select
v-model="algorithmValue"
clearable
placeholder="请选择算法"
class="mr-3"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select
v-model="typeValue"
clearable
placeholder="请选择"
class="mr-3"
<!-- <template v-if="pagination.total > 0"> -->
<el-card shadow="never">
<template #header>
<div>
<span class="font-bold">苏胜天算法库</span
><span class="font-bold">({{ pagination.total }})</span>
</div>
</template>
<div class="w-full flex justify-stretch mb-4">
<el-select
v-model="algorithmValue"
clearable
placeholder="请选择算法"
class="mr-3"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select
v-model="typeValue"
clearable
placeholder="请选择"
class="mr-3"
>
<el-option
v-for="item in optionsB"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select
v-model="defectValue"
clearable
placeholder="请选择"
class="mr-3"
>
<el-option
v-for="item in optionsC"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button type="primary" color="#1C0D82" @click="searchValue()">
查询
</el-button>
<el-button type="" @click="handleRefresh()"> </el-button>
</div>
<pure-table
align-whole="left"
showOverflowTooltip
table-layout="auto"
:loading="loading"
adaptive
:data="dataList"
:columns="columns"
:pagination="pagination"
:paginationSmall="false"
:header-cell-style="{
background: 'var(--el-table-row-hover-bg-color)',
color: 'var(--el-text-color-primary)'
}"
@selection-change="handleSelectionChange"
@page-size-change="handleSizeChange"
@page-current-change="handleCurrentChange"
>
<template #name="{ row }">
<span class="mr-2">{{ row.name }}</span>
<el-tag
class="mx-1"
:class="row.type == '经典算法' ? 'tagStyle' : 'tagDeepStyle'"
:type="row.type == '经典算法' ? '' : ''"
effect="plain"
>
<el-option
v-for="item in optionsB"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-select
v-model="defectValue"
clearable
placeholder="请选择"
class="mr-3"
{{ row.type }}
</el-tag>
</template>
<template #operation="{ row }">
<el-button
class="reset-margin"
link
text
@click="handleDelete(row)"
>
<el-option
v-for="item in optionsC"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-button type="primary" color="#1C0D82" @click="searchValue()">
查询
删除
</el-button>
<el-button type=""> 重置 </el-button>
</div>
<pure-table
align-whole="left"
showOverflowTooltip
table-layout="auto"
:loading="loading"
adaptive
:data="dataList"
:columns="columns"
:pagination="pagination"
:paginationSmall="false"
:header-cell-style="{
background: 'var(--el-table-row-hover-bg-color)',
color: 'var(--el-text-color-primary)'
}"
@selection-change="handleSelectionChange"
@page-size-change="handleSizeChange"
@page-current-change="handleCurrentChange"
>
<template #name="{ row }">
<span class="mr-2">{{ row.name }}</span>
<el-tag
class="mx-1"
:class="row.type == '经典算法' ? 'tagStyle' : 'tagDeepStyle'"
:type="row.type == '经典算法' ? '' : ''"
effect="plain"
>
{{ row.type }}
</el-tag>
</template>
<template #operation="{ row }">
<el-button
class="reset-margin"
link
text
@click="handleDelete(row)"
>
删除
</el-button>
</template>
</pure-table>
</el-card>
</template>
</template>
</pure-table>
</el-card>
<!-- </template> -->
</div>
</div>
</template>

@ -133,7 +133,7 @@ setOptions(
{
name: "已检出",
type: "bar",
barWidth: "20%",
barWidth: "30%",
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{

@ -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 = {
>
<el-row
:gutter="30"
v-if="
v-show="
(activeStep == 0 && customType == 'newBuilt') ||
customType == 'algorithm'
"
@ -319,7 +367,7 @@ const rules = {
</el-row>
<el-row
:gutter="30"
v-if="
v-show="
(activeStep == 1 && customType == 'newBuilt') || customType == 'alarm'
"
>
@ -551,19 +599,21 @@ const rules = {
</el-row>
<template #footer v-if="customType != 'history'">
<div class="dialog-footer">
<el-button @click="closeDialog" class="btn-color">取消</el-button>
<el-button
<el-button @click="closeDialog" class="btn-color">{{
activeStep == 1 && customType == "newBuilt" ? "上一步" : "取消"
}}</el-button>
<!-- <el-button
@click="nextStep"
class="btn-color"
v-if="customType == 'newBuilt'"
>{{ activeStep == 0 ? "下一步" : "上一步" }}</el-button
>
> -->
<el-button
type="primary"
color="#1C0D82"
@click="submitForm(ruleFormRef)"
>
确定
{{ activeStep == 0 && customType == "newBuilt" ? "下一步" : "完成" }}
</el-button>
</div>
</template>

@ -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;
}
}

@ -68,7 +68,8 @@ setOptions(
label: {
formatter: function (params) {
return params.value + "%";
}
},
fontWeight: 600
}
// emphasis: {
// itemStyle: {

@ -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({

@ -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

@ -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 }
]
};

@ -220,7 +220,7 @@ function getPie3D(pieData, internalDiameterRatio) {
labelLine: {
smooth: 0.2,
length: 10,
length2: 50,
length2: 70,
lineStyle: {
color: "#fff" // 线
}

Loading…
Cancel
Save