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

@@ -224,4 +224,4 @@
]
}
]
}
}

View File

@@ -14,7 +14,6 @@
:props="defaultProps"
node-key="id"
default-expand-all
show-checkbox
:default-checked-keys="defaultChecked"
@node-click="handleNodeClick"
@check-change="changeSelect"
@@ -25,7 +24,9 @@
class="custom-tree-node"
style="display: flex; align-items: center"
>
<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;"/>
<span>{{ node.label }}</span>
</span>
@@ -52,7 +53,16 @@ const treeList: any = ref([]);
const getTreeData = (val: any) => {
defaultChecked.value = [];
data.value = val;
defaultChecked.value.push(data.value[0].children[0].children[0].id);
if(data.value[0].children[0].hasOwnProperty("children"))
{
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);
};
const filterText = ref("");

View File

@@ -5,6 +5,7 @@
<!-- {{ printText }} -->
<div class="test_top">
<!-- style="pointer-events: none" -->
<svg-icon name="wind" spin></svg-icon>
<el-checkbox
v-for="(item, index) in detectionOptions"
v-model="item.selected"
@@ -17,6 +18,17 @@
<el-button type="primary" @click="handleBackDeviceList"
>返回首页</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 class="test_bot">
<div class="test_left">
@@ -124,21 +136,6 @@
</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 class="right_status" ref="statusRef">
@@ -160,7 +157,6 @@
import { ref, onMounted, reactive, nextTick } from "vue";
import Tree from "./components/tree.vue";
import { data } from "@/api/plan/autoTest.json";
import ProTable from "@/components/ProTable/index.vue";
import { useTransition } from "@vueuse/core";
import { getPlanList } from "@/api/plan/planList";
import { ElMessage, ElMessageBox } from "element-plus";
@@ -179,6 +175,10 @@ import {
Close,
VideoPause,
} 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 PopupVisible = ref(false)
const showDataPopup = ref()
@@ -262,7 +262,58 @@ const initLeftDeviceData = () => {
// 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 data = "检测脚本为:"+item.name+";被检设备为:"+item.children.value.devID+";被检通道序号为:"+ item.children.monitorIndex;
console.log(vvs,index,item.name,item.children)
@@ -272,38 +323,41 @@ const handleClick = (item,index,vvs) => {
//启动预检测
const handlePreTest = () => {
ElMessage.success("启动预检测");
let count = 0;
if (timer) {
clearInterval(timer);
count = 0;
leftDeviceData.value = [];
}
if (count == 5) {
count = 0;
} else {
timer = setInterval(async () => {
count++;
if (count > 15) return;
await nextTick(() => {
leftDeviceData.value.push({
id: count,
name: "设备" + count + "预检测",
status: count % 2 == 0 ? 0 : 1,
});
});
}, 2000);
}
getTreeData(preTestData)
// let count = 0;
// if (timer) {
// clearInterval(timer);
// count = 0;
// leftDeviceData.value = [];
// }
// if (count == 5) {
// count = 0;
// }
// else {
// timer = setInterval(async () => {
// count++;
// if (count > 15) return;
// await nextTick(() => {
// leftDeviceData.value.push({
// id: count,
// name: "设备" + count + "预检测",
// status: count % 2 == 0 ? 0 : 1,
// });
// });
// }, 2000);
// }
};
//进入检测流程
const handleAutoTest = () => {
router.push({
path: "/plan/autoTest",
});
ElMessage.success("启动正式检测");
getTreeData(data)
};
//返回设备列表
const handleBackDeviceList = () => {
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 },
]);
const getTreeData = () => {
treeRef.value && treeRef.value.getTreeData(data);
const getTreeData = (val) => {
treeRef.value && treeRef.value.getTreeData(val);
};
// ProTable 实例
const proTable = ref<ProTableInstance>();
@@ -616,8 +673,9 @@ const getStatusList = () => {
statusRef.value.scrollTop = statusRef.value.scrollHeight;
});
};
onMounted(() => {
getTreeData();
});
</script>
<style lang="scss" scoped>
@@ -644,6 +702,12 @@ onMounted(() => {
margin-bottom: 10px;
margin-left: 20px;
}
.el-select {
margin-top: 10px;
margin-bottom: 10px;
margin-left: 20px;
}
}
.test_bot {

View File

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

View File

@@ -105,6 +105,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import type { Action } from 'element-plus'
import type { ErrorSystem } from '@/api/error/interface'
import ErrorStandardDialog from '@/views/machine/errorSystem/components/ErrorStandardDialog.vue' // 导入子组件
import { isVisible } from 'element-plus/es/utils'
const dictStore = useDictStore()
// 定义包含和排除的单位
@@ -176,8 +177,10 @@ const columns = reactive<ColumnProps<Plan.PlanAndSourceBO>[]>([
<el-button type='primary' link onClick={() => showData(scope.row.testSourceName)}>
{scope.row.testSourceName}
</el-button>
<Temp></Temp>
<Temp isShow={isVisible(scope.row)} ></Temp>
</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>
@@ -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) {
detail_dialogTitle.value = row