首页隐藏子计划,计划列表子计划设备管理

This commit is contained in:
sjl
2025-07-22 14:56:58 +08:00
parent f81503091d
commit 1f37cc567c
11 changed files with 204 additions and 95 deletions

View File

@@ -17,7 +17,7 @@
</el-select>
</el-form-item>
</el-form> -->
<!-- <el-button @click="logConnections">打印当前配对</el-button> -->
<el-button @click="logConnections">打印当前配对</el-button>
<VueFlow
:nodes="nodes"
:edges="edges"
@@ -350,8 +350,7 @@ const open = async () => {
'4': 1, // 标准设备2 → 1个通道
}
const yPosition = ref(25)
const yPosition2 = ref(25)
const createNodes = () => {
const newNodes: any[] = []
@@ -365,6 +364,9 @@ const createNodes = () => {
const outputChannelX = 800
const standardWidth = 950
const yPosition = ref(25)
const yPosition2 = ref(25)
// 添加被检通道
Object.entries(channelCounts).forEach(([deviceId, count]) => {
for (let i = 1; i <= count; i++) {

View File

@@ -523,11 +523,11 @@ const columns = reactive<ColumnProps<Device.ResPqDev>[]>([
prop: 'devType',
label: '设备类型',
minWidth: 100,
render: (scope) => {
// 查找设备类型名称
const name = devTypeOptions.value.find(option => option.id === scope.row.devType)
return <span>{name?.name}</span>
},
// render: (scope) => {
// // 查找设备类型名称
// const name = devTypeOptions.value.find(option => option.id === scope.row.devType)
// return <span>{name?.name}</span>
// },
},
{
prop: 'devChns',

View File

@@ -80,7 +80,8 @@ const defaultChecked = ref<string[]>([]) // 明确类型为 number[]
const tree = ref(false)//确保左侧树高凉只执行一次
const getTreeData = (val: any) => {
defaultChecked.value = [];
data.value = val;
// 遍历 val 的每个 children过滤掉 pid !== '0'
data.value = val
for (let item of data.value) {
if (item.children.length > 0) {

View File

@@ -300,7 +300,8 @@ const getPieData = async (id: string) => {
const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 }
if (id) {
const boundPqDevList = ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
const plan = findPlanById(planList.value?.data || [], id)
const plan = findPlanById(planList.value, id)
console.log('所选计划:',plan)
planName.value = '所选计划:' + plan.name
select_Plan.value = plan
@@ -493,22 +494,30 @@ const initPlan = async () => {
dataRule: '',
testItemNameStr:'',
testItems: [],
standardDevIdList:[],
standardDevIds:[],
standardDevMap: new Map<string, number>(),
}
planList.value = (await getPlanListByPattern(reqPlan)) as ResultData<Plan.ReqPlan[]>
planList.value = planList.value.data.map((item: any) => {
if (item.children) {
item.children = item.children.filter(child => child.pid === '0');
}
return item;
});
}
onBeforeMount(async () => {
await initPlan()
for (let i = 0; i < planList.value.data.length; i++) {
if (Array.isArray(planList.value.data[i].children) && planList.value.data[i].children.length > 0) {
currentId.value = planList.value.data[i].children[0].id; // 直接赋值第一个 children 的 id
console.log(planList.value)
for (let i = 0; i < planList.value.length; i++) {
if (Array.isArray(planList.value[i].children) && planList.value[i].children.length > 0) {
currentId.value = planList.value[i].children[0].id; // 直接赋值第一个 children 的 id
break; // 确保只执行一次
}
}
console.log('planList.valuecurrentId.value', currentId.value)
// if (planList.value.data[0].children[0]) {
// currentId.value = planList.value.data[0].children[0].id
// console.log('currentId.value',planList.value.data[0])
@@ -517,8 +526,7 @@ onBeforeMount(async () => {
if (chartsInfoRef.value) {
resizeObserver.observe(chartsInfoRef.value)
}
getTree(planList.value.data)
getTree(planList.value)
getPieData(currentId.value)
})
@@ -532,7 +540,7 @@ const handleBatchGenerate = async () => {
// console.log('批量生成按钮被点击了');
// 在这里添加其他逻辑,比如显示对话框、更新状态等
await initPlan()
treeRef.value.clickTableToTree(planList.value.data,currentId.value)
treeRef.value.clickTableToTree(planList.value,currentId.value)
getPieData(currentId.value)
if (form.value.activeTabs === 0)//设备检测