修改问题 选择班级颜色过浅 连接节点颜色过浅 限制ip和端口书写 实验报告增加校验100-500

main
JayChou 1 day ago
parent 4f0650263c
commit c0b697786d
  1. 3
      src/layout/index.vue
  2. 3
      src/layout/loginPage.vue
  3. 7
      src/styles/index.scss
  4. 4
      src/views/designRoute/components/i.vue
  5. 4
      src/views/designRoute/components/number10.vue
  6. 4
      src/views/designRoute/components/number2.vue
  7. 7
      src/views/designRoute/index.vue
  8. 69
      src/views/largeDataScreen/home.vue
  9. 73
      src/views/program/components/chart.vue
  10. 216
      src/views/program/index.vue

@ -8,11 +8,8 @@
<div class="title">{{ setting.title }}</div>
</div>
<router-view v-slot="{ Component }">
<keep-alive>
<component :is="Component"></component>
</keep-alive>
</router-view>
<keep-alive> </keep-alive>
<div class="bottom" v-if=" setting.activeStepIndex!=12">
当前实验步骤为第{{ setting.activeStepIndex }}实验名称为:{{
stepData[setting.activeStepIndex]

@ -623,7 +623,7 @@ onMounted(() => {
});
</script>
<style lang="less" scoped>
<style lang="scss" scoped>
.login_container {
position: relative;
width: 100%;
@ -735,4 +735,5 @@ onMounted(() => {
:deep(.el-form-item__error) {
left: 110px;
}
</style>

@ -24,4 +24,11 @@
/* 轨道悬停样式 */
::-webkit-scrollbar-track:hover {
background-color: #e1e1e1;
}
.el-radio__inner{
border-color: #000 !important;
// background-color: #000 !important;
&:hover{
border-color: blue !important;
}
}

@ -14,11 +14,11 @@ import { ref, computed, nextTick, watch, onMounted } from "vue"
.main{
width: 40px;
height: 40px;
border: 2px solid #0712ca;
border: 2px solid #f82caa;
text-align: center;
font-size: 20px;
line-height: 40px;
font-weight: 700;
color: #0712ca;
color: #f82caa;
}
</style>

@ -14,12 +14,12 @@
.main{
width: 40px;
height: 40px;
border: 2px solid #0712ca;
border: 2px solid #f82caa;
text-align: center;
font-size: 20px;
line-height: 40px;
font-weight: 700;
color: #0712ca;
color: #f82caa;
}

@ -13,11 +13,11 @@
.main{
width: 20px;
height: 30px;
border: 2px solid #0712ca;
border: 2px solid #f82caa;
text-align: center;
font-size: 20px;
line-height: 30px;
font-weight: 700;
color: #0712ca;
color: #f82caa;
}
</style>

@ -10,12 +10,13 @@
>
<div id="container"></div>
<div class="setting">
<el-button @click="router.push('/program')">上一步</el-button>
<el-button @click="onUndo">撤回</el-button>
<el-button @click="onRedo">恢复</el-button>
<el-button @click="clearLocalStorage">清除缓存</el-button>
<el-button @click="onSave">保存</el-button>
<el-button @click="onTip">提示</el-button>
<el-button @click="onTip">步骤提示</el-button>
</div>
</div>
<div class="tip-view">
@ -842,7 +843,7 @@ const shiduCode = "float b;a=10000*S0/W1;R+(1-exp(-t1/b))*100+R0;if(R>=100){R=10
const onSave = () => {
// console.log(removeDuplicateEdges(formatEdges()), standardData);
console.log(removeDuplicateEdges(formatEdges()), standardData);
// return
if (standardData.length !== removeDuplicateEdges(formatEdges()).length)
return ElMessage.error("请完善数据");
@ -858,6 +859,8 @@ const onSave = () => {
ElMessage.success("保存成功");
settingStore.setValue( true,'saveRoute');
localStorage.setItem('saveRoute',true)
settingStore.setValue(true, "experimentPreservation");
localStorage.setItem("experimentPreservation", "true");
router.push('/program')
// const data = graph.toJSON();
// console.log(data);

@ -7,9 +7,10 @@
:width="260"
trigger="contextmenu"
ref="popover1"
>
<template #reference>
<div class="item">
<div class="item" @click="showMessage('请右键点击')">
<div class="icon">
<img
style="width: 100%"
@ -22,13 +23,13 @@
</div>
</template>
<div class="setting-list">
<div class="item">
<div class="item" @click="showMessage('请点击解压到当前文件夹')">
<div class="icon">
<!-- <img src="@/assets/images/home.png" alt="" /> -->
</div>
<div class="name" style="font-weight: 700">打开</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击解压到当前文件夹')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
@ -40,25 +41,25 @@
</div>
<div class="name">解压到当前文件夹</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击解压到当前文件夹')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到...</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击解压到当前文件夹')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到"LabVIEW2024 (64位)\"</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击解压到当前文件夹')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">其他压缩命令</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击解压到当前文件夹')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
@ -74,7 +75,7 @@
ref="popover2"
>
<template #reference>
<div class="item">
<div class="item" @click="showMessage('请右键点击')">
<div class="icon">
<img
style="width: 100%"
@ -93,37 +94,37 @@
</div>
<div class="name" style="font-weight: 700">打开</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击打开')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">管理员身份运行</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击打开')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到当前文件夹</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击打开')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到...</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击打开')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到"LabVIEW2024 (64位)\"</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击打开')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">其他压缩命令</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击打开')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
@ -139,7 +140,7 @@
ref="popover2"
>
<template #reference>
<div class="item">
<div class="item" @click="showMessage('请右键点击')">
<div class="icon">
<img
style="width: 100%"
@ -152,7 +153,7 @@
</div>
</template>
<div class="setting-list">
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<!-- <img src="@/assets/images/home.png" alt="" /> -->
</div>
@ -164,31 +165,31 @@
</div>
<div class="name" @click="goToLabView">管理员身份运行</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到当前文件夹</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到...</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到"LabVIEW2024 (64位)\"</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">其他压缩命令</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
@ -204,7 +205,7 @@
v-if="installationStep === 11"
>
<template #reference>
<div class="item">
<div class="item" @click="showMessage('请右键点击')">
<div class="icon">
<img
style="width: 100%"
@ -219,43 +220,43 @@
</div>
</template>
<div class="setting-list">
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<!-- <img src="@/assets/images/home.png" alt="" /> -->
</div>
<div class="name" style="font-weight: 700">打开</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name" @click="goToLabIdea">管理员身份运行</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到当前文件夹</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到...</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">解压到"LabVIEW2024 (64位)\"</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
<div class="name">其他压缩命令</div>
</div>
<div class="item">
<div class="item" @click="showMessage('请点击管理员身份运行')">
<div class="icon">
<img src="@/assets/images/home.png" alt="" />
</div>
@ -759,6 +760,7 @@ import { formatDate } from "@/utils";
import { useRouter, useRoute } from "vue-router";
import { onMounted,onActivated } from "vue";
import settingStore from "@/store/modules/setting";
import { ElMessage } from "element-plus";
type Falg = boolean;
type Step = number;
const falg = ref<Falg>(Boolean(localStorage.getItem("falg")) || false);
@ -834,6 +836,8 @@ const isShowStrring = Boolean(localStorage.getItem("falg")) || false;
// labView
const goToLabView = async () => {
console.log(isShowStrring);
if (isShowStrring) {
await setStepEvent(1, formatDate(new Date()));
useSettingStore.activeStepIndex = 2;
@ -855,6 +859,13 @@ const insatIdea = () => {
setStepEvent(6, formatDate(new Date()));
useSettingStore.activeStepIndex = 7;
};
const showMessage = (msg:string) => {
ElMessage({
message: msg,
type: "warning",
});
}
</script>
<style scoped lang="scss">

@ -0,0 +1,73 @@
<template>
<div id="my-chart"></div>
</template>
<script setup lang="ts">
import { onMounted, watch } from "vue";
import * as echarts from "echarts";
import useSettingStore from "@/store/modules/setting";
import { storeToRefs } from "pinia";
const store = useSettingStore();
const { shiyanData } = storeToRefs(store); //
let myChart: echarts.ECharts;
onMounted(() => {
myChart = echarts.init(document.getElementById("my-chart") as HTMLElement);
const option = {
title: { text: "温度 & 湿度变化", left: "center" },
tooltip: { trigger: "axis" },
xAxis: {
type: "category",
data: shiyanData.value.map((d) => d.time + 's'),
},
yAxis: [
{ type: "value", name: "温度 (°C)" },
{ type: "value", name: "湿度 (%)", position: "right" },
],
series: [
{
name: "温度",
type: "line",
data: shiyanData.value.map((d) => d.currentTemp),
},
{
name: "湿度",
type: "line",
data: shiyanData.value.map((d) => d.currentHumidity),
yAxisIndex: 1,
},
],
};
myChart.setOption(option);
});
//
watch(
shiyanData,
(newData) => {
if (myChart) {
myChart.setOption({
xAxis: {
data: newData.map((d) =>d.time + 's'),
},
series: [
{ data: newData.map((d) => d.currentTemp) },
{ data: newData.map((d) => d.currentHumidity) },
],
});
}
},
{ deep: true }
);
</script>
<style scoped>
#my-chart {
width: 800px;
height: 400px;
}
</style>

@ -40,6 +40,7 @@
</el-form>
</el-drawer>
<div class="setting" v-if="isShowStrring">
<el-button @click="router.push('/')">上一步</el-button>
<el-button @click="onUndo">撤回</el-button>
<el-button @click="onRedo">恢复</el-button>
<el-button @click="clearLocalStorage">清除缓存</el-button>
@ -50,7 +51,7 @@
@click="onSave"
>{{ useSettingStore.experimentPreservation ? "运行" : "保存" }}</el-button
>
<el-button @click="onTip">提示</el-button>
<el-button @click="onTip">步骤提示</el-button>
<el-button @click="showDialog">填写实验报告</el-button>
</div>
<div class="setting" v-else>
@ -78,26 +79,37 @@
v-if="dialogVisible"
>
<el-form :model="form" label-width="auto" style="max-width: 600px">
<el-form-item label="实验内容">
<el-input v-model="form.shiyanStep" type="textarea" />
<div class="tips">实践内容及步骤</div>
</el-form-item>
<el-form-item label="实验结果">
<el-input v-model="form.shiyanJieGuo" type="textarea" />
<div class="tips">本实践源程序清单及运行结果或实践结论实践设计图</div>
</el-form-item>
<el-form-item label="实践总结">
<el-input v-model="form.shijianZhongJie" type="textarea" />
<el-input
v-model="form.shijianZhongJie"
type="textarea"
:rows="5"
placeholder="请输入实践总结字数为100字到500字"
show-word-limit
maxlength="500"
/>
<div class="tips">对本实践结果进行分析实践心得及改进意见</div>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="exportWord">
保存
</el-button>
<el-button type="primary" @click="exportWord"> 保存 </el-button>
</div>
</template>
</el-dialog>
<el-dialog
v-model="chartDialog"
title="温度变化曲线"
width="850"
v-if="chartDialog"
draggable
overflow
>
<chart />
<template #footer>
<div class="dialog-footer">
<el-button @click="chartDialog = false">关闭</el-button>
</div>
</template>
</el-dialog>
@ -127,14 +139,15 @@ import JSZipUtils from "jszip-utils";
import JSZip from "pizzip";
import Docxtemplater from "docxtemplater";
import { saveAs } from "file-saver";
import { getReport,saveReport} from '@/api'
import { getReport, saveReport } from "@/api";
import chart from "./components/chart.vue";
const useSettingStore = settingStore();
const router = useRouter();
// console.log(useSettingStore.qw);
//
const falg = ref(false);
const isShowStrring = Boolean(localStorage.getItem('falg')) || false
const isShowStrring = Boolean(localStorage.getItem("falg")) || false;
let graph: any = null;
const nodeName = ref("");
const csedNode = ref<any>(null);
@ -236,7 +249,7 @@ onMounted(() => {
// #endregion
//
graph.on("node:click", ({ cell }: any) => {
if(!isShowStrring) return
if (!isShowStrring) return;
// console.log(cell.store.previous.name);
console.log(cell);
if (!useSettingStore.saveRoute) {
@ -255,6 +268,9 @@ onMounted(() => {
)
return;
// if (cell.store.previous.name === "qw") {
nodeName.value = cell.shape;
console.log(nodeName.value);
falg.value = true;
// }
//
@ -264,6 +280,7 @@ onMounted(() => {
// width: cell.getAttr('body/width'),
// height: cell.getAttr('body/height'),
};
drawerVisible.value = true; //
// cell.addTools([
// {
@ -1105,6 +1122,15 @@ const saveNodeData = () => {
// // height: selectedNodeData.value.height,
// // },
// });
if (nodeName.value === "custom-text-IP") {
if (!isIP(selectedNodeData.value.label)) {
return ElMessage.error("请输入正确的IP地址,如127.0.0.1");
}
} else if (nodeName.value === "custom-text-prot") {
if (!(selectedNodeData.value.label === "8866")) {
return ElMessage.error("端口号为8866");
}
}
node.label = selectedNodeData.value.label;
}
drawerVisible.value = false;
@ -1155,6 +1181,19 @@ const saveNodeData = () => {
});
}
};
function isIPv4(str: string) {
const ipv4Regex =
/^(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|1?[0-9][0-9]?)$/;
return ipv4Regex.test(str);
}
function isIPv6(str: string) {
const ipv6Regex =
/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
return ipv6Regex.test(str);
}
function isIP(str: string) {
return isIPv4(str) || isIPv6(str);
}
//
const beforeClose = () => {
@ -1230,8 +1269,10 @@ const sdsz = ref<any>(null);
const onSave = async () => {
if (useSettingStore.isRunCode) {
await setStepEvent(9, formatDate(new Date()));
useSettingStore.activeStepIndex = 10
useSettingStore.activeStepIndex = 10;
setTimeout(() => {
chartDialog.value = true;
}, 1000);
}
if (
!hasExactNames(graph.getNodes(), [
@ -1254,12 +1295,9 @@ useSettingStore.activeStepIndex = 10
});
}
if (!useSettingStore.experimentPreservation) {
useSettingStore.setValue(true, "experimentPreservation");
localStorage.setItem("experimentPreservation", "true");
if (!useSettingStore.isRunCode) {
await setStepEvent(2, formatDate(new Date()));
useSettingStore.activeStepIndex = 3
useSettingStore.activeStepIndex = 3;
}
router.push("/designRoute");
@ -1424,8 +1462,7 @@ useSettingStore.activeStepIndex = 3
if (!useSettingStore.isRunCode) {
setStepEvent(4, formatDate(new Date()));
setStepEvent(5, formatDate(new Date()));
useSettingStore.activeStepIndex = 6
useSettingStore.activeStepIndex = 6;
}
// const data = graph.toJSON();
@ -1484,13 +1521,11 @@ function loadFromLocalStorage() {
return JSON.parse(localStorage.getItem(SESSION_KEY) as string) || [];
}
function clearLocalStorage(falg=true) {
function clearLocalStorage(falg = true) {
localStorage.removeItem(SESSION_KEY);
if(falg){
window.location.reload();
if (falg) {
window.location.reload();
}
}
//
function restoreGraph() {
@ -1512,76 +1547,87 @@ const onTip = () => {
};
const dialogVisible = ref(false);
const form = ref({
shiyanStep: "",
shiyanJieGuo:'',
shijianZhongJie:'',
laoshipingyu:' 非常好',
sum:100
shijianZhongJie: "",
laoshipingyu: " 非常好",
sum: 100,
});
const showDialog = async () => {
const res:any = await getReport();
const res: any = await getReport();
form.value.shijianZhongJie = res.result.summarize;
form.value.shiyanJieGuo = res.result.result;
form.value.shiyanStep = res.result.experimentalResult;
console.log(res);
dialogVisible.value = true;
};
const exportWord = async () => {
console.log(form.value.shijianZhongJie);
if (!form.value.shijianZhongJie)
return ElMessage({
type: "warning",
message: "总结不能为空",
});
if (form.value.shijianZhongJie.length < 100) {
return ElMessage({
type: "warning",
message: "总结不能少于100字",
});
}
// return;
await saveReport({
experimentalResult:form.value.shiyanStep,
result:form.value.shiyanJieGuo,
summarize:form.value.shijianZhongJie
})
summarize: form.value.shijianZhongJie,
});
dialogVisible.value = false;
ElMessage.success('保存成功')
ElMessage.success("保存成功");
localStorage.removeItem("falg");
await setStepEvent(11, formatDate(new Date()));
useSettingStore.activeStepIndex = 12
router.push('/studyPage')
return
JSZipUtils.getBinaryContent("template.docx", function (error:any, content:any) {
//
if (error) {
throw error;
}
// JSZip
let zip = new JSZip(content);
// docxtemplater
let doc = new Docxtemplater().loadZip(zip);
//
useSettingStore.activeStepIndex = 12;
router.push("/studyPage");
return;
JSZipUtils.getBinaryContent(
"template.docx",
function (error: any, content: any) {
//
if (error) {
throw error;
}
// JSZip
let zip = new JSZip(content);
// docxtemplater
let doc = new Docxtemplater().loadZip(zip);
//
doc.setData({
...form.value,
shiyanTime:formatDate(new Date())
// table:_this.table,
});
try {
//
doc.render();
} catch (error) {
//
// let e = {
// message: error.message,
// name: error.name,
// stack: error.stack,
// properties: error.properties,
// }
ElMessage.error('导出失败')
throw error;
}
doc.setData({
...form.value,
shiyanTime: formatDate(new Date()),
// table:_this.table,
});
try {
//
doc.render();
} catch (error) {
//
// let e = {
// message: error.message,
// name: error.name,
// stack: error.stack,
// properties: error.properties,
// }
ElMessage.error("导出失败");
throw error;
}
// docxtemplaterzip
let out = doc.getZip().generate({
type: "blob",
mimeType:
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
});
//
saveAs(out, "实验报告.docx");
// docxtemplaterzip
let out = doc.getZip().generate({
type: "blob",
mimeType:
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
});
//
saveAs(out, "实验报告.docx");
}
);
};
const chartDialog = ref(false);
</script>
<style scoped>

Loading…
Cancel
Save