feat:设备使用记录

This commit is contained in:
houjunxiang
2026-03-05 16:54:47 +08:00
parent 749ac7f507
commit 9c88c45d66
357 changed files with 21486 additions and 5845 deletions

View File

@@ -0,0 +1,96 @@
<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>

View File

@@ -0,0 +1,80 @@
<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="standardList.length > 0">
<u-checkbox-group placement="column" v-model="selectRows">
<view v-for="(item, index) in standardList">
<u-checkbox :name="item.id">
<template #label>
<view class="x-f p8 border-b">
<view>{{ item.name }}</view>
<view class="pl16 pr16">{{ item.code }}</view>
<view class="pl16 pr16">{{ item.modelNo }}</view>
</view>
</template>
</u-checkbox>
</view>
</u-checkbox-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
selectRows.value = []
current.value = undefined
getList()
}
const standardList = ref([])
const current = ref(undefined)
const getList = async () => {
standardList.value = []
const param = {
standardMaterialFlag: 1,
pageNo: 1,
pageSize: 1000
}
const { list } = await nx.$api.material.queryMaterialInformation(param)
standardList.value = list
}
function handleCancel() {
addConfigShow.value = false
}
const selectRows = ref([])
function handleAdd() {
if (selectRows.value.length === 0) {
return uni.showToast({
title: '请选择标准物质',
icon: 'none'
})
}
let list = standardList.value.filter(item => selectRows.value.includes(item.id))
emits('confirm', list)
addConfigShow.value = false
}
defineExpose({
show
})
</script>
<style lang="scss" scoped>
:deep(.u-checkbox__label-wrap) {
width: 100%;
}
</style>

View File

@@ -9,7 +9,7 @@
</up-col>
<up-col span="6"
>开始时间
<text class="value">{{ detailInfo.useTimeStart }}</text>
<text class="value">{{ nx.$helper.formateToDateTime(detailInfo.useTimeStart) }}</text>
</up-col>
</up-row>
<up-row>
@@ -19,7 +19,7 @@
</up-col>
<up-col span="6"
>结束时间
<text class="value">{{ detailInfo.useTimeEnd }}</text>
<text class="value">{{ nx.$helper.formateToDateTime(detailInfo.useTimeEnd) }}</text>
</up-col>
</up-row>
<up-row>
@@ -42,16 +42,19 @@
<text class="value">{{ detailInfo.humidity }}</text>
</up-col>
<up-col span="6"
>样品类别/个数/任务
<text class="value">{{ detailInfo.useRemark }}</text>
>检测项目
<text class="value">{{ detailInfo.useItem }}</text>
</up-col>
</up-row>
<u-table2 class="mt8" height="300px" :data="tableData" :columns="columns" stripe border> </u-table2>
</scroll-view>
</up-popup>
</template>
<script setup>
import { ref, reactive, onMounted, watch, computed } from 'vue'
import nx from '@/nx'
import { getDetailList } from './useRecord.api'
const props = defineProps({
show: {
@@ -77,8 +80,18 @@ function handleClose() {
emit('close')
}
const columns = ref([
{ title: '样品名称', key: 'sampleName', align: 'center' },
{ title: '样品编号', key: 'sampleCode', align: 'center' }
])
const tableData = ref([])
async function getUseRecordDetailList(id) {
const res = await getDetailList({ parentId: id })
tableData.value = res
}
function handleOpen() {
detailInfo.value = props.checkInfo
getUseRecordDetailList(props.checkInfo.id)
}
</script>
@@ -101,4 +114,7 @@ function handleOpen() {
:deep(.uicon-close) {
font-size: 22px !important;
}
:deep(.u-popup__content__close--top-right) {
top: 30px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,6 @@
<template>
<view>
<up-sticky v-if="!isComponent">
<navbar-back title="设备使用记录查看"> </navbar-back>
</up-sticky>
<navbar-back v-if="!isComponent" title="设备使用记录查看"> </navbar-back>
<uni-card spacing="0">
<uni-section v-if="!isComponent" titleFontSize="20px" type="line" :title="deviceText"> </uni-section>
<view class="p10" style="width: 50%">
@@ -18,7 +16,7 @@
@custom="reset"
></up-search>
</view>
<view :style="{ height: isComponent ? '60vh' : '62vh' }">
<view :style="{ height: isComponent ? '70vh' : '72vh' }">
<zb-table
ref="zbTableRef"
isShowLoadMore
@@ -28,6 +26,7 @@
:cellStyle="setCellStyle"
:cellHeaderStyle="setCellHeaderStyle"
:data="listData"
:formatter="columnFormatter"
@detail="handleDetail"
@pullUpLoading="pullUpLoadingAction"
></zb-table>
@@ -58,12 +57,13 @@ const column = reactive([
{
label: '开始使用人',
name: 'userName',
width: 100
width: 150
},
{
label: '开始时间',
name: 'useTimeStart',
width: 170
width: 170,
formatter: true
},
{
label: '结束使用人',
@@ -73,7 +73,8 @@ const column = reactive([
{
label: '结束时间',
name: 'useTimeEnd',
width: 170
width: 170,
formatter: true
},
{
label: '使用前状态',
@@ -94,10 +95,22 @@ const column = reactive([
{
name: 'operation',
type: 'operation',
width: 100,
label: '操作',
renders: [{ name: '详情', func: 'detail' }]
}
])
function columnFormatter(row, column, rowIndex, columnIndex) {
// 判断是哪一列需要格式化
if (column.name === 'useTimeStart') {
return nx.$helper.formateToDateTime(row.useTimeStart)
}
if (column.name === 'useTimeEnd') {
return nx.$helper.formateToDateTime(row.useTimeEnd)
}
// 对于不需要特殊格式化的列,返回原始值
return row[column.name]
}
let zbTableRef = ref(null)
const deviceId = ref('')
const deviceText = ref('')
@@ -148,10 +161,6 @@ function handleDetail(row) {
</script>
<style lang="scss" scoped>
.u-sticky {
top: 0 !important;
background-color: #fff !important;
}
:deep(.zb-table uni-button[type='primary']) {
background-color: $uni-color-primary !important;
}

View File

@@ -2,7 +2,7 @@ import request from '@/nx/request'
export function addUseRecord(data) {
return request({
url: '/lims/bus/device/use-record/create',
url: '/qms/resource/device-use-record/create',
method: 'POST',
data,
custom: {
@@ -12,8 +12,8 @@ export function addUseRecord(data) {
}
export function editUseRecord(data) {
return request({
url: '/lims/bus/device/use-record/edit',
method: 'POST',
url: '/qms/resource/device-use-record/update',
method: 'PUT',
data,
custom: {
showSuccess: true
@@ -22,15 +22,22 @@ export function editUseRecord(data) {
}
export function getList(params) {
return request({
url: '/lims/bus/device/use-record/list',
url: '/qms/resource/device-use-record/page',
method: 'GET',
params
})
}
export function getUseRecordById(id) {
return request({
url: '/lims/bus/device/use-record/queryLastUsingData',
url: '/qms/resource/device-use-record/queryLastUsingData',
method: 'GET',
params: { deviceId: id }
})
}
export function getDetailList(params) {
return request({
url: '/qms/resource/device-use-record-detail/getListByParentId',
method: 'GET',
params
})
}