This commit is contained in:
GYYM
2024-11-14 18:40:58 +08:00
parent 12201e065f
commit a3051c0ea4
6 changed files with 146 additions and 56 deletions

View File

@@ -19,6 +19,6 @@ VITE_API_URL=/api
# 开发环境跨域代理,支持配置多个 # 开发环境跨域代理,支持配置多个
VITE_PROXY=[["/api","http://192.168.1.124:18092/"]] VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
# VITE_PROXY=[["/api","http://192.168.1.125:18092/"]] # VITE_PROXY=[["/api","http://192.168.1.125:18092/"]]
# VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文 # VITE_PROXY=[["/api","http://192.168.1.138:8080/"]]张文

View File

@@ -14,7 +14,6 @@
:props="defaultProps" :props="defaultProps"
node-key="id" node-key="id"
default-expand-all default-expand-all
show-checkbox
:default-checked-keys="defaultChecked" :default-checked-keys="defaultChecked"
@node-click="handleNodeClick" @node-click="handleNodeClick"
@check-change="changeSelect" @check-change="changeSelect"
@@ -25,7 +24,9 @@
class="custom-tree-node" class="custom-tree-node"
style="display: flex; align-items: center" style="display: flex; align-items: center"
> >
<CircleCheck v-if="data.isChildNode && data.scriptIdx < currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#67C23A;"/> <CircleCheck v-if="data.isChildNode && data.scriptIdx < currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#67C23A;"/>
<svg-icon name="wind" spin></svg-icon>
<Loading v-if="data.isChildNode && data.scriptIdx === currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#E6A23C;"/> <Loading v-if="data.isChildNode && data.scriptIdx === currentIndex" style="width:18px;height: 18px;margin-right:8px;color:#E6A23C;"/>
<span>{{ node.label }}</span> <span>{{ node.label }}</span>
</span> </span>
@@ -52,7 +53,16 @@ const treeList: any = ref([]);
const getTreeData = (val: any) => { const getTreeData = (val: any) => {
defaultChecked.value = []; defaultChecked.value = [];
data.value = val; data.value = val;
if(data.value[0].children[0].hasOwnProperty("children"))
{
defaultChecked.value.push(data.value[0].children[0].children[0].id); defaultChecked.value.push(data.value[0].children[0].children[0].id);
}
else
{
defaultChecked.value.push(data.value[0].children[0].id);
}
treeRef.value.setCurrentKey(defaultChecked.value); treeRef.value.setCurrentKey(defaultChecked.value);
}; };
const filterText = ref(""); const filterText = ref("");

View File

@@ -5,6 +5,7 @@
<!-- {{ printText }} --> <!-- {{ printText }} -->
<div class="test_top"> <div class="test_top">
<!-- style="pointer-events: none" --> <!-- style="pointer-events: none" -->
<svg-icon name="wind" spin></svg-icon>
<el-checkbox <el-checkbox
v-for="(item, index) in detectionOptions" v-for="(item, index) in detectionOptions"
v-model="item.selected" v-model="item.selected"
@@ -17,6 +18,17 @@
<el-button type="primary" @click="handleBackDeviceList" <el-button type="primary" @click="handleBackDeviceList"
>返回首页</el-button >返回首页</el-button
> >
<el-select v-model="currentErrSysID" placeholder="请选择误差体系" autocomplete="off">
<el-option
v-for="plan in testErrSystDataList"
:key="plan.id"
:label="plan.label"
:value="plan.id">
</el-option>
</el-select>
<el-button type="primary" @click="handlePreTest">重新计算</el-button>
</div> </div>
<div class="test_bot"> <div class="test_bot">
<div class="test_left"> <div class="test_left">
@@ -124,21 +136,6 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="table_body"></div> -->
<!-- </div> -->
<!-- ------------------------ -->
<ProTable
v-if="false"
ref="proTable"
:columns="columns"
:request-api="getTableList"
:init-param="initParam"
:data-callback="dataCallback"
@drag-sort="sortTable"
>
<!-- 表格 header 按钮 -->
<template #tableHeader> </template>
</ProTable>
</div> </div>
<!-- 右侧状态加载 --> <!-- 右侧状态加载 -->
<div class="right_status" ref="statusRef"> <div class="right_status" ref="statusRef">
@@ -160,7 +157,6 @@
import { ref, onMounted, reactive, nextTick } from "vue"; import { ref, onMounted, reactive, nextTick } from "vue";
import Tree from "./components/tree.vue"; import Tree from "./components/tree.vue";
import { data } from "@/api/plan/autoTest.json"; import { data } from "@/api/plan/autoTest.json";
import ProTable from "@/components/ProTable/index.vue";
import { useTransition } from "@vueuse/core"; import { useTransition } from "@vueuse/core";
import { getPlanList } from "@/api/plan/planList"; import { getPlanList } from "@/api/plan/planList";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
@@ -179,6 +175,10 @@ import {
Close, Close,
VideoPause, VideoPause,
} from "@element-plus/icons-vue"; } from "@element-plus/icons-vue";
import {dictPattern,dictTestState,dictReportState,dictResult,testPlanDataList,testSoureDataList,testScriptDataList,testErrSystDataList,planData,testFatherPlanList} from '@/api/plan/planData'
import { useRouter } from 'vue-router'
const router = useRouter()
const currentErrSysID = ref("2")
const treeRef = ref<any>(); const treeRef = ref<any>();
const PopupVisible = ref(false) const PopupVisible = ref(false)
const showDataPopup = ref() const showDataPopup = ref()
@@ -262,7 +262,58 @@ const initLeftDeviceData = () => {
// handlePrintText(item.name, index); // handlePrintText(item.name, index);
}); });
}; };
// 点击数据结果
const preTestData = [
{
"id": 0,
"name": "预检测项目",
"children": [
{
"scriptIdx":1,
"isChildNode":true,
"pid": "0-2",
"id": "0-2-2",
"name": "标准源通讯检测"
},
{
"scriptIdx":2,
"isChildNode":true,
"pid": "0-3",
"id": "0-3-1",
"name": "设备通讯检测"
},
{
"scriptIdx":3,
"isChildNode":true,
"pid": "0-3",
"id": "0-3-1",
"name": "协议校验"
},
{
"scriptIdx":4,
"isChildNode":true,
"pid": "0-3",
"id": "0-3-1",
"name": "相序校验"
},
{
"scriptIdx":5,
"isChildNode":true,
"pid": "0-3",
"id": "0-3-1",
"name": "守时校验"
},
{
"scriptIdx":6,
"isChildNode":true,
"pid": "0-3",
"id": "0-3-1",
"name": "通道系数校准"
}
]
}
]
// 弹出检测结果页面
const handleClick = (item,index,vvs) => { const handleClick = (item,index,vvs) => {
//const data = "检测脚本为:"+item.name+";被检设备为:"+item.children.value.devID+";被检通道序号为:"+ item.children.monitorIndex; //const data = "检测脚本为:"+item.name+";被检设备为:"+item.children.value.devID+";被检通道序号为:"+ item.children.monitorIndex;
console.log(vvs,index,item.name,item.children) console.log(vvs,index,item.name,item.children)
@@ -272,38 +323,41 @@ const handleClick = (item,index,vvs) => {
//启动预检测 //启动预检测
const handlePreTest = () => { const handlePreTest = () => {
ElMessage.success("启动预检测"); ElMessage.success("启动预检测");
let count = 0; getTreeData(preTestData)
if (timer) {
clearInterval(timer); // let count = 0;
count = 0; // if (timer) {
leftDeviceData.value = []; // clearInterval(timer);
} // count = 0;
if (count == 5) { // leftDeviceData.value = [];
count = 0; // }
} else { // if (count == 5) {
timer = setInterval(async () => { // count = 0;
count++; // }
if (count > 15) return; // else {
await nextTick(() => { // timer = setInterval(async () => {
leftDeviceData.value.push({ // count++;
id: count, // if (count > 15) return;
name: "设备" + count + "预检测", // await nextTick(() => {
status: count % 2 == 0 ? 0 : 1, // leftDeviceData.value.push({
}); // id: count,
}); // name: "设备" + count + "预检测",
}, 2000); // status: count % 2 == 0 ? 0 : 1,
} // });
// });
// }, 2000);
// }
}; };
//进入检测流程 //进入检测流程
const handleAutoTest = () => { const handleAutoTest = () => {
router.push({ ElMessage.success("启动正式检测");
path: "/plan/autoTest",
}); getTreeData(data)
}; };
//返回设备列表 //返回设备列表
const handleBackDeviceList = () => { const handleBackDeviceList = () => {
router.push({ router.push({
path: "/plan/home/index", path: "/home/index",
}); });
}; };
@@ -430,9 +484,12 @@ const columns = reactive<ColumnProps<User.ResUserList>[]>([
}, },
// { prop: "operation", label: "操作", fixed: "right", width: 250 }, // { prop: "operation", label: "操作", fixed: "right", width: 250 },
]); ]);
const getTreeData = () => {
treeRef.value && treeRef.value.getTreeData(data);
const getTreeData = (val) => {
treeRef.value && treeRef.value.getTreeData(val);
}; };
// ProTable 实例 // ProTable 实例
const proTable = ref<ProTableInstance>(); const proTable = ref<ProTableInstance>();
@@ -616,8 +673,9 @@ const getStatusList = () => {
statusRef.value.scrollTop = statusRef.value.scrollHeight; statusRef.value.scrollTop = statusRef.value.scrollHeight;
}); });
}; };
onMounted(() => { onMounted(() => {
getTreeData();
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -644,6 +702,12 @@ onMounted(() => {
margin-bottom: 10px; margin-bottom: 10px;
margin-left: 20px; margin-left: 20px;
} }
.el-select {
margin-top: 10px;
margin-bottom: 10px;
margin-left: 20px;
}
} }
.test_bot { .test_bot {

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="device-list-container"> <div class="device-list-container" v-if="isShow">
<!-- :model-value="visible" -->
<el-dropdown @command="handleCommand"> <el-dropdown @command="handleCommand">
<el-button link type='primary' class='table-operate'> <el-button link type='primary' class='table-operate'>
<div class='table-operate-text'>更多...</div> <div class='table-operate-text'>更多...</div>
@@ -44,9 +44,11 @@ import type { ErrorSystem } from '@/api/error/interface'
maxErrorValue: '',//最大误差 maxErrorValue: '',//最大误差
}) })
// const props = defineProps<{
// visible: boolean; const props = defineProps<{
// }>(); isShow: boolean;
}>();
console.log(props.isShow,1111)
const handleCommand = (command: string | number | object) => { const handleCommand = (command: string | number | object) => {
detail_dialogTitle.value = command as string; detail_dialogTitle.value = command as string;
detail_dialogFormVisible.value = true // 显示对话框 detail_dialogFormVisible.value = true // 显示对话框

View File

@@ -105,6 +105,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import type { Action } from 'element-plus' import type { Action } from 'element-plus'
import type { ErrorSystem } from '@/api/error/interface' import type { ErrorSystem } from '@/api/error/interface'
import ErrorStandardDialog from '@/views/machine/errorSystem/components/ErrorStandardDialog.vue' // 导入子组件 import ErrorStandardDialog from '@/views/machine/errorSystem/components/ErrorStandardDialog.vue' // 导入子组件
import { isVisible } from 'element-plus/es/utils'
const dictStore = useDictStore() const dictStore = useDictStore()
// 定义包含和排除的单位 // 定义包含和排除的单位
@@ -176,8 +177,10 @@ const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
<el-button type='primary' link onClick={() => showData(scope.row.testSourceName)}> <el-button type='primary' link onClick={() => showData(scope.row.testSourceName)}>
{scope.row.testSourceName} {scope.row.testSourceName}
</el-button> </el-button>
<Temp></Temp>
<Temp isShow={isVisible(scope.row)} ></Temp>
</div> </div>
// isVisible(scope.row)
// <Temp { visible: scope.row.testSourceList.length > 1 }></Temp> // <Temp { visible: scope.row.testSourceList.length > 1 }></Temp>
// <Temp :visible='{scope.row.testSourceList.length > 1}'></Temp> // <Temp :visible='{scope.row.testSourceList.length > 1}'></Temp>
// <Temp :visible="scope.row.testSourceList.length > 1"></Temp> // <Temp :visible="scope.row.testSourceList.length > 1"></Temp>
@@ -287,6 +290,17 @@ function openFileDialog() {
} }
} }
function isVisible(row: Plan.PlanAndSourceBO) {
console.log(row)
if(!row.hasOwnProperty('testSourceList') || !Array.isArray(row.testSourceList))
return false
else if(row.testSourceList.length <= 1)
return false
else
return true
}
function showData(row: string) { function showData(row: string) {
detail_dialogTitle.value = row detail_dialogTitle.value = row