fix: bug修改

develop
JINGYJ 2 years ago
parent be4123bd29
commit 085a3515d9

@ -46,7 +46,7 @@ const {
<!-- 通知 --> <!-- 通知 -->
<Notice id="header-notice" /> <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"> <span class="el-dropdown-link navbar-bg-hover select-none">
<img :src="userAvatar" :style="avatarsStyle" /> <img :src="userAvatar" :style="avatarsStyle" />
<p v-if="username" class="dark:text-white">{{ username }}</p> <p v-if="username" class="dark:text-white">{{ username }}</p>

@ -31,16 +31,17 @@ const submitForm = async (formEl: FormInstance | undefined) => {
await formEl.validate(valid => { await formEl.validate(valid => {
if (valid) { if (valid) {
const data = formData; const data = formData;
emit("submit-form", data, props.type, multipleSelection.value);
if (props.type == "add") { if (props.type == "add") {
multipleTableRef.value.clearSelection();
message("添加成功", { type: "success" }); message("添加成功", { type: "success" });
} else if (props.type == "edit") { } else if (props.type == "edit") {
message("修改成功", { type: "success" }); message("修改成功", { type: "success" });
} else { } else {
message("新建成功", { type: "success" }); message("新建成功", { type: "success" });
} }
emit("submit-form", data, props.type, multipleSelection.value);
formVisible.value = false; formVisible.value = false;
multipleTableRef.value.clearSelection(); // multipleTableRef.value.clearSelection();
formData.value = {}; formData.value = {};
} }
}); });
@ -53,7 +54,9 @@ const resetForm = (formEl: FormInstance | undefined) => {
const multipleTableRef = ref<InstanceType<typeof ElTable>>(); const multipleTableRef = ref<InstanceType<typeof ElTable>>();
const closeDialog = () => { const closeDialog = () => {
formVisible.value = false; formVisible.value = false;
multipleTableRef.value.clearSelection(); if (props.type == "add") {
multipleTableRef.value.clearSelection();
}
resetForm(ruleFormRef.value); resetForm(ruleFormRef.value);
formData.value = {}; formData.value = {};
}; };
@ -142,7 +145,9 @@ watch(
); );
const rules = { const rules = {
name: [{ required: true, message: "请输入企业全称名称", trigger: "blur" }] privateEnterprise: [
{ required: true, message: "请输入企业全称名称", trigger: "blur" }
]
}; };
</script> </script>

@ -106,7 +106,7 @@ const enterpriseInfo = ref({
isSelect: false isSelect: false
}); });
const pagination = reactive<PaginationProps>({ const pagination = reactive<PaginationProps>({
total: 0, total: 3,
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
background: false background: false
@ -163,6 +163,11 @@ function handleDelete(row) {
} }
) )
.then(() => { .then(() => {
const updatedListData = dataList.value.filter(
item => item.name !== row.name
);
dataList.value = updatedListData;
pagination.total = dataList.value.length;
message("删除成功", { type: "success" }); message("删除成功", { type: "success" });
}) })
.catch(() => {}); .catch(() => {});
@ -185,6 +190,7 @@ const addEnterprise = (data, type, multipleSelection) => {
} }
// enterprise.value.unshift(data.value); // enterprise.value.unshift(data.value);
// count.value++; // count.value++;
pagination.total = dataList.value.length;
}; };
const addCompany = () => { const addCompany = () => {
customType.value = ""; customType.value = "";
@ -272,11 +278,11 @@ onMounted(() => {
<div class="w-[21%] h-full float-left"> <div class="w-[21%] h-full float-left">
<el-card <el-card
class="box-card-left" class="box-card-left"
:style="{ height: `calc(${height}px - 10vh - 20px)` }" :style="{ height: `calc(${height}px - 130px)` }"
> >
<template #header> <template #header>
<div class="card-header flex justify-between"> <div class="card-header flex justify-between">
<span class="w-[30%] font-semibold">企业列表</span> <span class="w-[50%] font-semibold">企业列表</span>
</div> </div>
</template> </template>
<el-input <el-input
@ -288,7 +294,11 @@ onMounted(() => {
/> />
<el-scrollbar max-height="1000px"> <el-scrollbar max-height="1000px">
<p <p
v-for="(item, index) in enterprise" v-for="(item, index) in enterprise.filter(v =>
v.privateEnterprise
.toLowerCase()
.includes(input.toLowerCase())
)"
:key="index" :key="index"
:class=" :class="
item.isSelect ? 'enterprise-id-select ' : 'scrollbar-item' item.isSelect ? 'enterprise-id-select ' : 'scrollbar-item'
@ -302,10 +312,7 @@ onMounted(() => {
</el-card> </el-card>
</div> </div>
<div class="float-right w-[78%]"> <div class="float-right w-[78%]">
<el-card <el-card class="box-card-right">
class="box-card-right"
:style="{ height: `calc(${height}px - 10vh - 20px)` }"
>
<template #header> <template #header>
<div class="card-header flex justify-between"> <div class="card-header flex justify-between">
<span class="font-semibold">企业详情</span> <span class="font-semibold">企业详情</span>

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

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

@ -109,11 +109,55 @@ const tableData = [
const submitForm = async (formEl: FormInstance | undefined) => { const submitForm = async (formEl: FormInstance | undefined) => {
if (!formEl) return; if (!formEl) return;
await formEl.validate(valid => { if (activeStep.value == 0 && customType.value == "newBuilt") {
if (valid) { await formEl.validateField(["inputSource"], valid => {
if (activeStep.value == 0 && customType.value == "newBuilt") { if (valid) {
//
activeStep.value++; 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" }); message("提交成功", { type: "success" });
// formVisible.value = false; // formVisible.value = false;
const data = formData.value; const data = formData.value;
@ -127,8 +171,8 @@ const submitForm = async (formEl: FormInstance | undefined) => {
// closeDialog(); // closeDialog();
// resetForm(formEl); // resetForm(formEl);
} }
} });
}); }
}; };
const resetForm = (formEl: FormInstance | undefined) => { const resetForm = (formEl: FormInstance | undefined) => {
@ -137,24 +181,28 @@ const resetForm = (formEl: FormInstance | undefined) => {
}; };
const closeDialog = () => { const closeDialog = () => {
formVisible.value = false; if (activeStep.value == 1 && customType.value == "newBuilt") {
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--; activeStep.value--;
} else { } 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 phoneChecked = ref(false);
const httpFirst = ref(false); const httpFirst = ref(false);
const httpSecond = ref(false); const httpSecond = ref(false);
@ -210,7 +258,7 @@ watch(
customWidth.value = 790; customWidth.value = 790;
} else if (val == "alarm") { } else if (val == "alarm") {
title.value = "告警设置"; title.value = "告警设置";
customWidth.value = 580; customWidth.value = 620;
} else if (val == "algorithm") { } else if (val == "algorithm") {
title.value = "算法配置"; title.value = "算法配置";
customWidth.value = 620; customWidth.value = 620;
@ -278,7 +326,7 @@ const rules = {
> >
<el-row <el-row
:gutter="30" :gutter="30"
v-if=" v-show="
(activeStep == 0 && customType == 'newBuilt') || (activeStep == 0 && customType == 'newBuilt') ||
customType == 'algorithm' customType == 'algorithm'
" "
@ -319,7 +367,7 @@ const rules = {
</el-row> </el-row>
<el-row <el-row
:gutter="30" :gutter="30"
v-if=" v-show="
(activeStep == 1 && customType == 'newBuilt') || customType == 'alarm' (activeStep == 1 && customType == 'newBuilt') || customType == 'alarm'
" "
> >
@ -551,19 +599,21 @@ const rules = {
</el-row> </el-row>
<template #footer v-if="customType != 'history'"> <template #footer v-if="customType != 'history'">
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="closeDialog" class="btn-color">取消</el-button> <el-button @click="closeDialog" class="btn-color">{{
<el-button activeStep == 1 && customType == "newBuilt" ? "上一步" : "取消"
}}</el-button>
<!-- <el-button
@click="nextStep" @click="nextStep"
class="btn-color" class="btn-color"
v-if="customType == 'newBuilt'" v-if="customType == 'newBuilt'"
>{{ activeStep == 0 ? "下一步" : "上一步" }}</el-button >{{ activeStep == 0 ? "下一步" : "上一步" }}</el-button
> > -->
<el-button <el-button
type="primary" type="primary"
color="#1C0D82" color="#1C0D82"
@click="submitForm(ruleFormRef)" @click="submitForm(ruleFormRef)"
> >
确定 {{ activeStep == 0 && customType == "newBuilt" ? "下一步" : "完成" }}
</el-button> </el-button>
</div> </div>
</template> </template>

@ -394,18 +394,27 @@ setTimeout(() => {
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
flex: 1; flex: 1;
flex-wrap: wrap; flex-flow: column wrap;
align-items: center; // flex-flow: column wrap;
justify-content: space-between; // align-items: center;
// justify-content: space-between;
height: 260px; height: 260px;
padding: 0; padding: 0;
background: #fff; background: #fff;
.list-item-image { .list-item-image {
flex: 40%; flex: 48%;
height: 120px; height: 120px;
&:nth-of-type(odd) { &:nth-of-type(odd) {
margin-bottom: 10px;
}
&:nth-of-type(1) {
margin-right: 10px;
}
&:nth-of-type(2) {
margin-right: 10px; margin-right: 10px;
} }
} }

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

@ -39,8 +39,9 @@ const loading = ref(false);
const noMore = computed(() => count.value >= 5); const noMore = computed(() => count.value >= 5);
const disabled = computed(() => loading.value || noMore.value); const disabled = computed(() => loading.value || noMore.value);
const load = type => { const load = type => {
loading.value = true;
if (type == "add") { if (type == "add") {
loading.value = true;
nextTick(() => { nextTick(() => {
setTimeout(() => { setTimeout(() => {
modelCardData.unshift({ modelCardData.unshift({

@ -80,6 +80,8 @@ setInterval(() => {
state.data.card3.data[2].value = randomIntFn(0, 500); state.data.card3.data[2].value = randomIntFn(0, 500);
state.data.card3.data[3].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[4].value = randomIntFn(0, 500);
state.data.card3.data[5].value = randomIntFn(0, 500);
state.data.card3.data[6].value = randomIntFn(0, 500);
}, 300); }, 300);
//card4 //card4

@ -20,11 +20,13 @@ export const card2_data = {
export const card3_data = { export const card3_data = {
data: [ data: [
{ name: "08:20", value: 150 }, { name: "一", value: 150 },
{ name: "10:00", value: 60 }, { name: "二", value: 60 },
{ name: "13:00", value: 120 }, { name: "三", value: 120 },
{ name: "15:00", value: 90 }, { name: "四", value: 90 },
{ name: "17:00", value: 210 } { name: "五", value: 210 },
{ name: "六", value: 90 },
{ name: "日", value: 210 }
] ]
}; };

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

Loading…
Cancel
Save