UPDATE: 替换新增比对检测计划时,可选择的标准设备接口;优化选择被检设备组件

This commit is contained in:
贾同学
2025-09-04 11:12:29 +08:00
parent 74e015bd12
commit 25f3570c18
3 changed files with 84 additions and 69 deletions

View File

@@ -1,4 +1,4 @@
import type {StandardDevice} from '@/api/device/interface/standardDevice' import type { StandardDevice } from '@/api/device/interface/standardDevice'
import http from '@/api' import http from '@/api'
/** /**
@@ -30,7 +30,6 @@ export const deletePqStandardDev = (params: string[]) => {
return http.post(`/pqStandardDev/delete`, params) return http.post(`/pqStandardDev/delete`, params)
} }
//导出标准设备 //导出标准设备
export const exportPqStandardDev = (params: StandardDevice.ReqPqStandardDeviceParams) => { export const exportPqStandardDev = (params: StandardDevice.ReqPqStandardDeviceParams) => {
return http.download(`/pqStandardDev/export`, params) return http.download(`/pqStandardDev/export`, params)
@@ -49,3 +48,8 @@ export const importPqStandardDev = (params: StandardDevice.ReqPqStandardDevicePa
export const getAllPqStandardDev = () => { export const getAllPqStandardDev = () => {
return http.get(`/pqStandardDev/getAll`) return http.get(`/pqStandardDev/getAll`)
} }
//获取可以绑定的标准设备
export const canBindingList = () => {
return http.get(`/pqStandardDev/canBindingList`)
}

View File

@@ -36,7 +36,7 @@
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<el-scrollbar ref="scrollbarRef" :height="props.height" style="margin-top: 20px">
<el-tree <el-tree
ref="treeRef" ref="treeRef"
show-checkbox show-checkbox
@@ -46,7 +46,7 @@
:default-checked-keys="defaultCheckedKeys" :default-checked-keys="defaultCheckedKeys"
:filter-node-method="filterNode" :filter-node-method="filterNode"
node-key="id" node-key="id"
:style="{ marginTop: '20px', height: `${props.height}px` }" :style="{ padding: '0 25px' }"
@check-change="handleCheckChange" @check-change="handleCheckChange"
> >
<template #empty> <template #empty>
@@ -61,7 +61,10 @@
<el-icon><Location /></el-icon> <el-icon><Location /></el-icon>
<span style="margin-left: 4px">{{ data.label }}</span> <span style="margin-left: 4px">{{ data.label }}</span>
</div> </div>
<div v-else style="flex: 1; display: flex; align-items: center; justify-content: space-between"> <div
v-else
style="flex: 1; display: flex; align-items: center; justify-content: space-between"
>
<span> <span>
<el-icon><Cpu /></el-icon> <el-icon><Cpu /></el-icon>
<span v-if="node.level === 1" style="margin-left: 4px"> <span v-if="node.level === 1" style="margin-left: 4px">
@@ -98,6 +101,8 @@
</div> </div>
</template> </template>
</el-tree> </el-tree>
</el-scrollbar>
<!-- 传递 footer 插槽到 el-card --> <!-- 传递 footer 插槽到 el-card -->
<template #footer> <template #footer>
<slot name="footer"></slot> <slot name="footer"></slot>
@@ -108,7 +113,7 @@
</template> </template>
<script lang="ts" name="DevSelect" setup> <script lang="ts" name="DevSelect" setup>
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import type { FilterNodeMethodFunction, TreeInstance } from 'element-plus' import type { FilterNodeMethodFunction, ScrollbarInstance, TreeInstance } from 'element-plus'
interface Tree { interface Tree {
[key: string]: any [key: string]: any
@@ -146,6 +151,7 @@ const props = defineProps({
} }
}) })
const treeRef = ref<TreeInstance>() const treeRef = ref<TreeInstance>()
const scrollbarRef = ref<ScrollbarInstance>()
const treeData = ref<Tree[]>([]) const treeData = ref<Tree[]>([])
const defaultCheckedKeys = ref<string[]>([]) const defaultCheckedKeys = ref<string[]>([])
const filter = ref({ const filter = ref({
@@ -254,7 +260,11 @@ const convertToTree = (data: any[], groupBy?: string | undefined) => {
} }
const filterNode: FilterNodeMethodFunction = (value: string, data: Tree) => { const filterNode: FilterNodeMethodFunction = (value: string, data: Tree) => {
if (!value) return true if (!value) return true
return data.label.includes(value) console.log('data', data)
if (data.id.toString().includes('_')) {
return false
}
return data.label.includes(value) || data.cityName.includes(value) || data.manufacturer.includes(value)
} }
const handleCommand = (command: string) => { const handleCommand = (command: string) => {
filter.value.groupBy = command filter.value.groupBy = command
@@ -264,6 +274,7 @@ const handleCommand = (command: string) => {
if (filter.value.checkAll) { if (filter.value.checkAll) {
setCheckedStatus(true) setCheckedStatus(true)
} }
scrollbarRef.value?.setScrollTop(0)
} }
const handleCheckChange = () => { const handleCheckChange = () => {
const checkedKeys = treeRef.value?.getCheckedKeys().filter(item => !item.toString().includes('_')) || [] const checkedKeys = treeRef.value?.getCheckedKeys().filter(item => !item.toString().includes('_')) || []
@@ -289,7 +300,7 @@ const handleCheckChange = () => {
} }
.card-body { .card-body {
padding: 15px; padding: 20px;
} }
.card-footer { .card-footer {

View File

@@ -187,7 +187,7 @@
title="被检设备列表" title="被检设备列表"
filter-placeholder="请输入内容搜索" filter-placeholder="请输入内容搜索"
:data="devData" :data="devData"
:height="250" :height="230"
:disabled="allDisabled" :disabled="allDisabled"
> >
<template v-if="planType === 0 && !allDisabled" #footer> <template v-if="planType === 0 && !allDisabled" #footer>
@@ -354,7 +354,7 @@ import { type ErrorSystem } from '@/api/device/interface/error'
import { type Device } from '@/api/device/interface/device' import { type Device } from '@/api/device/interface/device'
import { getPqReportAllName } from '@/api/device/report/index' import { getPqReportAllName } from '@/api/device/report/index'
import { useAppSceneStore, useModeStore } from '@/stores/modules/mode' import { useAppSceneStore, useModeStore } from '@/stores/modules/mode'
import { getAllPqStandardDev } from '@/api/device/standardDevice/index' import { canBindingList, getAllPqStandardDev } from '@/api/device/standardDevice/index'
import { type StandardDevice } from '@/api/device/interface/standardDevice' import { type StandardDevice } from '@/api/device/interface/standardDevice'
import { type Dict } from '@/api/system/dictionary/interface' import { type Dict } from '@/api/system/dictionary/interface'
import { getAllUser } from '@/api/user/user' import { getAllUser } from '@/api/user/user'
@@ -663,7 +663,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
getPqErrSysList(), getPqErrSysList(),
getUnboundPqDevList(data), getUnboundPqDevList(data),
getPqReportAllName(), getPqReportAllName(),
getAllPqStandardDev(), canBindingList(),
getTestConfig(), getTestConfig(),
getRegRes({ type: patternId }) getRegRes({ type: patternId })
]) ])