feat:设备管理修改

This commit is contained in:
houjunxiang
2026-03-20 17:56:17 +08:00
parent f0dffc29fa
commit 904d1c4ea4
15 changed files with 564 additions and 468 deletions

View File

@@ -8,26 +8,22 @@
</view>
<scroll-view style="height: 60vh" scroll-y scroll-with-animation class="mt16 pl16">
<template v-if="taskList.length > 0">
<up-radio-group v-model="selectRowId" placement="column">
<u-checkbox-group placement="column" v-model="selectRows">
<view v-for="(task, index) in taskList">
<up-radio :name="task.id">
<u-checkbox :name="task.id">
<template #label>
<view
class="x-f pb4 pl8 border-b full-width"
:class="{ active: current === index }"
@click="current = index"
>
<view class="x-f pb4 pl8 border-b full-width" @click="current = index">
<view class="fs20">{{ task.taskNo }}</view>
<view class="pl16 pr16">{{ task.taskName }}{{ task.assayOper }}</view>
<view class="pl32 pr32">{{ task.taskName }}{{ task.assayOper }}</view>
<view class="x-f">
<u-icon name="clock"></u-icon>
<text class="ml5">{{ nx.$helper.formateToDateTime(task.taskAssignTime) }}</text>
</view>
</view>
</template>
</up-radio>
</u-checkbox>
</view>
</up-radio-group>
</u-checkbox-group>
</template>
<up-empty v-else text="暂无数据" mode="list"> </up-empty>
</scroll-view>
@@ -44,7 +40,7 @@ let emits = defineEmits(['confirm'])
const addConfigShow = ref(false)
function show() {
addConfigShow.value = true
selectRowId.value = undefined
selectRows.value = []
current.value = undefined
getAssayTaskList()
}
@@ -63,21 +59,40 @@ const getAssayTaskList = async () => {
function handleCancel() {
addConfigShow.value = false
}
const selectRowId = ref(undefined)
function handleAdd() {
if (!selectRowId.value) {
const selectRows = ref([])
async function handleAdd() {
// 1. 校验是否选择了数据
if (!selectRows.value || !selectRows.value.length) {
return uni.showToast({
title: '请选择任务单',
icon: 'none'
})
}
let sampleList = []
nx.$api.assayTask.getAssayTaskDetailList({ businessAssayTaskId: selectRowId.value }).then(res => {
const list = res || []
sampleList = list
try {
const requestPromises = selectRows.value.map(businessAssayTaskId => {
return nx.$api.assayTask.getAssayTaskDetailList({
businessAssayTaskId
})
})
const results = await Promise.all(requestPromises)
let sampleList = []
results.forEach(res => {
const list = res || []
sampleList = sampleList.concat(list)
})
// 5. 执行回调和关闭弹窗
emits('confirm', sampleList)
addConfigShow.value = false
})
} catch (error) {
console.error('批量获取详情失败:', error)
uni.showToast({
title: '数据加载失败',
icon: 'none'
})
}
}
defineExpose({
@@ -86,7 +101,7 @@ defineExpose({
</script>
<style lang="scss" scoped>
:deep(.u-radio__label-wrap) {
:deep(.u-checkbox__label-wrap) {
width: 100%;
}
.active {