Files
zgty-mas-m/pages/device/deviceBusUseRecord/SampleSelectPopup.vue
2026-03-05 16:54:47 +08:00

97 lines
2.9 KiB
Vue

<template>
<view>
<up-popup :show="addConfigShow" round="10" @close="addConfigShow = false">
<view class="text-center">样品选择</view>
<view class="x-bc mt8">
<up-button size="small" style="width: 60px" text="取消" @click="handleCancel"></up-button>
<up-button size="small" style="width: 60px" type="primary" text="确认" @click="handleAdd"></up-button>
</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">
<view v-for="(task, index) in taskList">
<up-radio :name="task.id">
<template #label>
<view
class="x-f pb4 pl8 border-b full-width"
:class="{ active: current === index }"
@click="current = index"
>
<view class="fs20">{{ task.taskNo }}</view>
<view class="pl16 pr16">{{ 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>
</view>
</up-radio-group>
</template>
<up-empty v-else text="暂无数据" mode="list"> </up-empty>
</scroll-view>
</up-popup>
</view>
</template>
<script setup>
import { ref, computed } from 'vue'
import nx from '@/nx'
let emits = defineEmits(['confirm'])
const addConfigShow = ref(false)
function show() {
addConfigShow.value = true
selectRowId.value = undefined
current.value = undefined
getAssayTaskList()
}
const userInfo = computed(() => nx.$store('user').userInfo)
const taskList = ref([])
const current = ref(undefined)
const getAssayTaskList = async () => {
const param = {
taskAssignStatus: 'submitted',
taskAssayStatusList: ['not_start', 'saved'],
assayOperator: userInfo.value.nickname
}
const res = await nx.$api.assayTask.getAssayTaskList(param)
taskList.value = res
}
function handleCancel() {
addConfigShow.value = false
}
const selectRowId = ref(undefined)
function handleAdd() {
if (!selectRowId.value) {
return uni.showToast({
title: '请选择任务单',
icon: 'none'
})
}
let sampleList = []
nx.$api.assayTask.getAssayTaskDetailList({ businessAssayTaskId: selectRowId.value }).then(res => {
const list = res || []
sampleList = list
emits('confirm', sampleList)
addConfigShow.value = false
})
}
defineExpose({
show
})
</script>
<style lang="scss" scoped>
:deep(.u-radio__label-wrap) {
width: 100%;
}
.active {
color: #0055a2;
font-weight: 500;
}
</style>