feat:样品分析
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
<template>
|
||||
<view>
|
||||
<navbar-back :autoBack="false" title="审核查询" @leftClick="customBack"></navbar-back>
|
||||
<navbar-back :autoBack="false" title="分析记录" @leftClick="customBack"></navbar-back>
|
||||
<u-row gutter="16">
|
||||
<u-col span="4">
|
||||
<view class="content-title-name">
|
||||
<text>任务列表</text>
|
||||
<up-badge v-if="taskList.length > 0" class="ml5" :value="taskList.length" type="warning"></up-badge>
|
||||
</view>
|
||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||||
<scroll-view
|
||||
@@ -14,15 +13,22 @@
|
||||
scroll-with-animation
|
||||
class="content-main-left"
|
||||
:scroll-top="scrollTop"
|
||||
@scrolltolower="handleScrolltolower"
|
||||
>
|
||||
<TaskItem
|
||||
v-for="(task, index) in taskList"
|
||||
v-for="(task, index) in listData"
|
||||
:key="index"
|
||||
:task="task"
|
||||
:seq="index + 1"
|
||||
:active="current === index"
|
||||
:active="selectedIndex === index"
|
||||
@click="switchTask(index)"
|
||||
/>
|
||||
>
|
||||
<template #tag="{ task }">
|
||||
<u-icon v-if="task.flowStatus === 'approved'" name="/static/images/status/completed.png" size="45" />
|
||||
<u-icon v-else name="/static/images/status/wait_for_audit.png" size="45" />
|
||||
</template>
|
||||
</TaskItem>
|
||||
<up-loadmore :status="loadStatus" />
|
||||
</scroll-view>
|
||||
</u-col>
|
||||
<u-col span="8">
|
||||
@@ -33,33 +39,30 @@
|
||||
<view>
|
||||
<scroll-view scroll-y scroll-with-animation style="height: calc(75vh - 60px)">
|
||||
<block v-for="(sample, index) in sampleList" :key="index">
|
||||
<view class="p5 fs16">
|
||||
<u-row
|
||||
@click="showSampleDetail(sample.id, index)"
|
||||
:class="selectedIndex.value === index ? 'selected_Sample' : ''"
|
||||
>
|
||||
<u-col span="2" class="text-center" :style="sampleStyle(sample)">
|
||||
<view class="sample-item">
|
||||
<u-row @click="showSampleDetail(sample.id, index)">
|
||||
<u-col span="2" class="text-center">
|
||||
<view>
|
||||
<text>【{{ index + 1 }}】</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="5">
|
||||
<u-col span="4">
|
||||
<view>
|
||||
<text class="pl5">{{ sample.sampleAssayCode }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="pl5">
|
||||
{{ getDataSourceTypeShow(sample.dataSourceType) }}{{ sample.sampleName }}
|
||||
{{ sample.sampleName }}
|
||||
</text>
|
||||
</view>
|
||||
</u-col>
|
||||
<u-col span="5">
|
||||
<u-col span="4">
|
||||
<view>
|
||||
<text style="padding-left: 10px">{{ sample.assayProject }}</text>
|
||||
<text style="padding-left: 10px" v-html="sample.assayProject"></text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-line class="p5" color="#bbb" />
|
||||
<u-icon class="sample-status" name="/static/images/status/return_b.png" size="45" />
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
@@ -88,20 +91,16 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { onLoad, onBackPress } from '@dcloudio/uni-app'
|
||||
import { onLoad, onBackPress, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||
import SampleDetailPopup from '@/components/sample/sample-detail-popup.vue'
|
||||
import TaskItem from './components/task-item.vue'
|
||||
import nx from '@/nx'
|
||||
import { useListData } from '@/nx/hooks/usePageListData'
|
||||
import { getDataSourceTypeShow } from '../common'
|
||||
|
||||
// 响应式数据
|
||||
const scrollTop = ref(0)
|
||||
const current = ref(0)
|
||||
const currentTask = ref({})
|
||||
const currentTaskId = ref('')
|
||||
const reviewNum = ref(0)
|
||||
const selectedIndex = ref(-1)
|
||||
const taskList = ref([])
|
||||
const selectedIndex = ref(0)
|
||||
const sampleList = ref([])
|
||||
const showDetailPopup = ref(false)
|
||||
const detailId = ref('')
|
||||
@@ -114,56 +113,40 @@ const customBack = () => {
|
||||
uni.reLaunch({ url: '/pages/analysis/index/index' })
|
||||
}
|
||||
|
||||
const sampleStyle = sample => {
|
||||
if ((sample.weightSubmitStatus === 0 || sample.weightSubmitStatus === 1) && sample.reviewCount > 0) {
|
||||
return 'color: red'
|
||||
}
|
||||
if (sample.weightSubmitStatus === 2 && sample.reviewCount > 0) {
|
||||
return 'color: green'
|
||||
}
|
||||
return ''
|
||||
function handleScrolltolower() {
|
||||
scrollToLower()
|
||||
}
|
||||
|
||||
const currentTask = computed(() => {
|
||||
if (listData.value.length > 0) {
|
||||
return listData.value[selectedIndex.value]
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
})
|
||||
const switchTask = async index => {
|
||||
if (index === current.value) return
|
||||
current.value = index
|
||||
selectedIndex.value = -1
|
||||
const task = taskList.value[index]
|
||||
currentTask.value = task
|
||||
getAssayTaskDetail(task.id)
|
||||
if (index === selectedIndex.value) return
|
||||
selectedIndex.value = index
|
||||
getAssayTaskDetail(currentTask.value.id)
|
||||
}
|
||||
|
||||
const showSampleDetail = (id, index) => {
|
||||
selectedIndex.value = index
|
||||
detailId.value = id
|
||||
showDetailPopup.value = true
|
||||
}
|
||||
const searchParams = computed(() => ({
|
||||
taskAssignStatus: 'submitted',
|
||||
taskAssayStatus: 'submitted'
|
||||
}))
|
||||
|
||||
const getAssayTask = () => {
|
||||
taskList.value = []
|
||||
sampleList.value = []
|
||||
current.value = 0
|
||||
const param = {
|
||||
taskAssignStatus: 'submitted',
|
||||
taskAssayStatus: 'submitted',
|
||||
finishStatus: 'not_start',
|
||||
flowStatus: 'not_start',
|
||||
assayOper: userInfo.value.realname
|
||||
}
|
||||
nx.$api.assayTask.getAssayTaskList(param).then(res => {
|
||||
taskList.value = res
|
||||
if (taskList.value.length > 0) {
|
||||
currentTask.value = taskList.value[0]
|
||||
getAssayTaskDetail(currentTask.value.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
const { listData, scrollToLower, loadStatus, getInitData } = useListData({
|
||||
searchParams,
|
||||
api: nx.$api.assayTask.getAssayTaskPage
|
||||
})
|
||||
|
||||
const getAssayTaskDetail = businessAssayTaskId => {
|
||||
reviewNum.value = 0
|
||||
nx.$api.assayTask.getAssayTaskDataList({ businessAssayTaskId }).then(res => {
|
||||
sampleList.value = res || []
|
||||
})
|
||||
const getAssayTaskDetail = async businessAssayTaskId => {
|
||||
const res = await nx.$api.assayTask.getAssayTaskDetailList({ businessAssayTaskId })
|
||||
sampleList.value = res || []
|
||||
}
|
||||
|
||||
const previewPDF = () => {
|
||||
@@ -173,8 +156,11 @@ const previewPDF = () => {
|
||||
}
|
||||
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
getAssayTask()
|
||||
onMounted(async () => {
|
||||
await getInitData()
|
||||
if (listData.value.length > 0) {
|
||||
getAssayTaskDetail(currentTask.value.id)
|
||||
}
|
||||
})
|
||||
|
||||
onBackPress(() => {
|
||||
@@ -195,7 +181,16 @@ onBackPress(() => {
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sample-item {
|
||||
position: relative;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding: 4px;
|
||||
.sample-status {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
.content-main-left {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user