This commit is contained in:
houjunxiang
2025-10-09 18:19:55 +08:00
parent f2ffc65094
commit 386f1e7466
1553 changed files with 284685 additions and 32820 deletions

View File

@@ -0,0 +1,143 @@
<template>
<view>
<navbar-back title="任务单预览"></navbar-back>
<view></view>
<!-- #ifdef H5 -->
<web-view :src="pdfUrlH5"></web-view>
<!-- #endif -->
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { onLoad, onHide, onUnload } from '@dcloudio/uni-app'
import { getBaseUrl } from '@/defaultBaseUrl'
import nx from '@/nx'
// 响应式数据
const taskId = ref('')
const localFilePath = ref('')
const reportKey = ref('')
const hideResultFlag = ref('')
const viewerUrl = '/hybrid/html/web/viewer.html?file='
const pdfUrlH5 = ref('')
let wv = null // 计划创建的 webview
// 方法:下载 PDF
const downloadPdf = (pdfUrl, retryCount = 0) => {
const MAX_RETRY = 3 // 最多重试 3 次
return new Promise(resolve => {
if (retryCount >= MAX_RETRY) {
console.error('PDF 下载失败:超过最大重试次数')
return resolve(null)
}
uni.downloadFile({
url: pdfUrl,
success: res => {
if (res.statusCode !== 200) {
console.warn(`下载失败,状态码: ${res.statusCode},重试第 ${retryCount + 1}`)
return resolve(downloadPdf(pdfUrl, retryCount + 1))
}
const tempFilePath = res.tempFilePath
uni.getFileInfo({
filePath: tempFilePath,
success: fileInfo => {
if (fileInfo.size > 0) {
resolve(tempFilePath)
} else {
console.warn('文件为空,重试中...')
resolve(downloadPdf(pdfUrl, retryCount + 1))
}
},
fail: () => {
console.warn('获取文件信息失败,重试中...')
resolve(downloadPdf(pdfUrl, retryCount + 1))
}
})
},
fail: () => {
console.warn('网络请求失败,重试中...')
resolve(downloadPdf(pdfUrl, retryCount + 1))
}
})
})
}
// 方法Android 加载 PDF
const loadPdfOnAndroid = async pdfUrl => {
const tempFilePath = await downloadPdf(pdfUrl)
if (!tempFilePath) return
const localPath = plus.io.convertLocalFileSystemURL(tempFilePath)
localFilePath.value = localPath
const allUrl = viewerUrl + encodeURIComponent(localPath)
// 创建并加载 webview
wv = plus.webview.create('', 'custom-webview', {
top: uni.getSystemInfoSync().statusBarHeight + 44,
bottom: 0
})
wv.loadURL(allUrl)
const currentWebview = getCurrentPages().pop().$getAppWebview()
currentWebview.append(wv)
}
// 获取 PDF 预览 URL
const getPdf = async () => {
const printBaseUrl = getBaseUrl()
const baseUrl = getBaseUrl()
let dataUrl = `${baseUrl}/qms/bus/qmsBusAssayTask/getAssayTaskDataWithDetailData?taskId=${taskId.value}`
dataUrl += `&hideResultFlag=${hideResultFlag.value}`
const token = nx.$store('user').token
let url = `${printBaseUrl}/report/gridpp/report/previewDocs`
url += `?token=${token}`
url += `&type=PDF`
url += `&reportKey=${reportKey.value}`
url += `&dataUrl=${encodeURIComponent(dataUrl)}`
// #ifdef H5
pdfUrlH5.value = viewerUrl + encodeURIComponent(url)
// #endif
// #ifndef H5
await loadPdfOnAndroid(url)
// #endif
}
// 删除临时文件
const deleteTmpFile = () => {
if (!localFilePath.value) return
const dir = localFilePath.value.substring(0, localFilePath.value.lastIndexOf('/'))
plus.io.resolveLocalFileSystemURL(
dir,
entry => {
entry.removeRecursively(
() => console.log('删除成功'),
e => console.log('删除失败:' + e.message)
)
},
e => console.log('目录不存在:' + e.message)
)
}
// 生命周期
onLoad(param => {
if (param.taskId) {
taskId.value = param.taskId
reportKey.value = param.reportKey
hideResultFlag.value = param.hideResultFlag
}
getPdf()
})
onHide(() => {
deleteTmpFile()
})
onUnload(() => {
deleteTmpFile()
})
</script>
<style scoped></style>

View File

@@ -0,0 +1,237 @@
<template>
<view>
<navbar-back :autoBack="false" title="任 务 单" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']"
:data-current="index"
@tap.stop="swichTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view>
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
</view>
<view style="margin-top: 20rpx">
<text>{{ task.taskName }}</text>
</view>
<view class="x-f" style="margin-top: 20rpx">
<u-icon color="" name="clock"></u-icon>
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-height">
<block v-for="(sample, index) in sampleList" :key="index">
<view
v-if="index == 0 || (index > 0 && sampleList[index].sort != sampleList[index - 1].sort)"
style="padding: 10rpx; font-size: 36rpx"
>
<u-row>
<u-col span="2" style="text-align: center">
<view>
<text>{{ sample.sort }}</text>
</view>
</u-col>
<u-col span="10">
<view>
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
</view>
<view>
<text style="padding-left: 20rpx">{{ sample.sampleName }}</text>
</view>
</u-col>
</u-row>
<u-line style="padding: 10rpx" color="#bbb" />
</view>
</block>
</scroll-view>
</view>
</u-col>
</u-row>
</view>
</template>
<script>
export default {
data() {
return {
scrollTop: 0, //tab标题的滚动条位置
current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
taskList: [],
sampleList: []
}
},
onLoad() {
//获取任务列表
this.getAssayTask()
},
methods: {
//返回首页
customBack() {
uni.reLaunch({
url: '/pages/analysis/index/index'
})
},
//切换任务
async swichTask(index) {
if (index == this.current) return
this.current = index
// 如果为0意味着尚未初始化
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
await this.getElRect('menu-scroll-view', 'menuHeight')
await this.getElRect('u-tab-item', 'menuItemHeight')
}
// 将菜单菜单活动item垂直居中
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2
//获取任务详情
this.getAssayTaskDetail(this.taskList[index].taskNo)
},
// 获取一个目标元素的高度
getElRect(elClass, dataVal) {
new Promise((resolve, reject) => {
const query = uni.createSelectorQuery().in(this)
query
.select('.' + elClass)
.fields({ size: true }, res => {
// 如果节点尚未生成res值为null循环调用执行
if (!res) {
setTimeout(() => {
this.getElRect(elClass)
}, 10)
return
}
this[dataVal] = res.height
})
.exec()
})
},
getAssayTask() {
//显示loading
uni.showLoading({
title: '加载中...'
})
const param = {
assayOper: this.userInfo.realname,
operateType: 'task'
}
this.$u.api
.getAssayTaskList(param)
.then(res => {
this.taskList = res.result
if (this.taskList && this.taskList.length > 0) {
this.getAssayTaskDetail(this.taskList[0].taskNo)
} else {
uni.hideLoading()
}
})
.catch(err => {
uni.hideLoading()
console.log(err)
})
},
getAssayTaskDetail(taskNo) {
this.$u.api
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
.then(res => {
this.sampleList = res.result
uni.hideLoading()
})
.catch(err => {
uni.hideLoading()
console.log(err)
})
}
}
}
</script>
<style lang="scss" scoped>
.content-title {
height: 110rpx;
width: 100%;
font-size: 46rpx;
font-weight: 300;
}
.content-title-name {
padding: 20rpx;
text-align: center;
}
.content-main-height {
height: calc(100vh - 250rpx);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 10rpx;
height: 200rpx;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
color: #444;
font-weight: 400;
line-height: 1;
border-width: 4rpx;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-size: 36rpx;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 32rpx;
left: 0;
top: 39rpx;
}
</style>

View File

@@ -0,0 +1,318 @@
<template>
<view>
<navbar-back :autoBack="false" title="单据补打" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<!-- 左侧任务列表 -->
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
ref="menuScrollView"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="{ 'u-tab-item-active': current === index }"
@tap.stop="switchTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view>
<text style="font-size: 18px">{{ task.taskNo }}</text>
</view>
<view style="margin-top: 10px">
<text>{{ task.taskName }} {{ task.assayOper }}</text>
</view>
<view class="x-f" style="margin-top: 10px">
<u-icon name="clock"></u-icon>
<text style="margin-left: 5px">{{ task.taskOperTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<!-- 右侧样品列表 -->
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-right">
<block v-for="(sample, index) in sampleList" :key="index">
<view style="padding: 5px; font-size: 16px">
<u-row>
<u-col span="2" style="text-align: center">
<view>
<text>{{ sample.sort }}</text>
</view>
</u-col>
<u-col span="5">
<view>
<text style="padding-left: 10px">{{ sample.sampleCode }}</text>
</view>
<view>
<text style="padding-left: 10px">{{ sample.sampleName }}</text>
</view>
</u-col>
</u-row>
<u-line style="padding: 10rpx" color="#bbb" />
</view>
</block>
</scroll-view>
<!-- 操作按钮 -->
<view class="content-main-right-operation">
<u-row>
<u-col span="6"></u-col>
<u-col span="3">
<u-button class="btn-operation" type="primary" @click="previewPDF" v-if="currentTaskId">
预览任务单
</u-button>
</u-col>
<u-col span="3">
<u-button class="btn-operation" :disabled="taskList.length <= 0" type="success" @click="printTask">
打印任务单
</u-button>
</u-col>
</u-row>
</view>
</view>
</u-col>
</u-row>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import nx from '@/nx'
// refs
const scrollTop = ref(0)
const current = ref(0)
const menuHeight = ref(0)
const menuItemHeight = ref(0)
const currentTask = ref({})
const currentTaskId = ref('')
const currentTaskNo = ref('')
const conAssayTask = ref(null)
const taskList = ref([])
const sampleList = ref([])
const menuScrollView = ref(null)
// 生命周期
onMounted(() => {
getAssayTask()
})
checkPrintConfig()
// 方法
function customBack() {
uni.reLaunch({
url: '/pages/analysis/index/index'
})
}
function taskStyle(task) {
return task.weightTaskStatus === 3 ? 'green' : ''
}
// 切换任务
async function switchTask(index) {
if (index === current.value) return
current.value = index
// 初始化高度
if (menuHeight.value === 0 || menuItemHeight.value === 0) {
await getElRect('menu-scroll-view', 'menuHeight')
await getElRect('.u-tab-item', 'menuItemHeight')
}
// 滚动居中
scrollTop.value = index * menuItemHeight.value + menuItemHeight.value / 2 - menuHeight.value / 2
// 更新当前任务
const task = taskList.value[index]
currentTask.value = task
currentTaskNo.value = task.taskNo
currentTaskId.value = task.id
getAssayTaskDetail(currentTaskNo.value)
}
// 获取元素尺寸
function getElRect(selector, targetRef) {
return new Promise(resolve => {
const query = uni.createSelectorQuery().in(getCurrentInstance().proxy)
query
.select(selector)
.fields({ size: true }, res => {
if (!res) {
// 如果未获取到,稍后重试(可选)
setTimeout(() => resolve(getElRect(selector, targetRef)), 10)
return
}
if (targetRef === 'menuHeight') {
menuHeight.value = res.height
} else if (targetRef === 'menuItemHeight') {
menuItemHeight.value = res.height
}
resolve(res)
})
.exec()
})
}
// 获取任务列表
function getAssayTask() {
const param = {
operateType: 'print',
finishStatus: 'submited,finished'
}
nx.$api.auncel.getAssayTaskList(param).then(res => {
taskList.value = res || []
if (taskList.value.length > 0) {
const first = taskList.value[0]
currentTask.value = first
currentTaskNo.value = first.taskNo
currentTaskId.value = first.id
getAssayTaskDetail(currentTaskNo.value)
} else {
currentTask.value = {}
currentTaskNo.value = ''
currentTaskId.value = ''
}
})
}
// 获取任务详情
function getAssayTaskDetail(taskNo) {
if (!taskNo) return
nx.$api.assayTask.getAssayTaskDetailListByTaskNo({ taskNo }).then(res => {
sampleList.value = res.result || []
if (res.additionalProperties?.conAssayTask) {
conAssayTask.value = res.additionalProperties.conAssayTask
}
})
}
// 打印任务
function printTask() {
const task = currentTask.value
uni.showModal({
title: '提示',
content: `确定补打“${task.taskNo}的原始记录单”?`,
cancelColor: '#0055A2',
confirmColor: '#0055A2',
success: res => {
if (res.confirm) {
nx.$print.getPrintTemplateAndPrint(currentTask.value)
}
}
})
}
// 预览 PDF
function previewPDF() {
const url = `/pages/analysis/sample/pdf-preview?taskId=${currentTaskId.value}&reportKey=${conAssayTask.value?.assayTaskTemplateKey}&hideResultFlag=true`
uni.navigateTo({ url })
}
// 检查打印服务配置(模拟 onShow
function checkPrintConfig() {
const printList = uni.getStorageSync('KEY_PRINT_LIST')
if (!printList || printList.length <= 0) {
uni.showToast({
title: '打印服务未配置,请在系统设置中配置打印服务!',
icon: 'none'
})
}
}
</script>
<style lang="scss" scoped>
.content-title {
height: 50px;
width: 100%;
font-size: 20px;
font-weight: 300;
}
.content-title-name {
padding: 10px;
text-align: center;
}
.content-main-height {
height: calc(100vh - 125px);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 5px;
height: 100px;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #444;
line-height: 1;
border-width: 2px;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 16px;
left: 0;
top: 20px;
}
.content-main-right {
height: calc(100vh - 205px);
}
.content-main-right-operation {
height: 80px;
padding-top: 15px;
padding-right: 15px;
}
.btn-operation {
width: 95%;
}
</style>

View File

@@ -0,0 +1,339 @@
<template>
<view>
<navbar-back :autoBack="false" title="样品分析-收样" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<!-- 任务列表 -->
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="[current === index ? 'u-tab-item-active' : '']"
@tap.stop="switchTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view class="fs18">{{ task.taskNo }}</view>
<view style="margin-top: 10px">{{ task.taskName }}</view>
<view class="x-f" style="margin-top: 10px">
<u-icon name="clock"></u-icon>
<text style="margin-left: 5px">{{ task.taskOperTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<!-- 样品列表 -->
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-right">
<block v-for="(sample, index) in sampleList" :key="index">
<view style="padding: 5px; font-size: 16px">
<u-row>
<u-col span="3" style="text-align: center">
<u-row>
<u-col span="6" style="text-align: center">
<u-checkbox
v-model="sample.checked"
v-if="sample.sampleProcessNo === currentNode"
@change="selectSample(sample)"
></u-checkbox>
</u-col>
<u-col span="6" style="text-align: center">
<text>{{ sample.sort }}</text>
</u-col>
</u-row>
</u-col>
<u-col span="9" class="sample_desc">
<view>
<view
><text style="padding-left: 10px">{{ sample.sampleCode }}</text></view
>
<view>
<text style="padding-left: 10px">
{{ getDataSourceTypeShow(sample.dataSourceType) }}{{ sample.sampleName }}
</text>
</view>
</view>
<view class="sample_desc_warn" v-if="sample.sampleProcessNo !== currentNode">
当前节点{{ getProcessNameShow(sample.sampleProcessNo) }}
</view>
</u-col>
</u-row>
<u-line style="padding: 5px" color="#bbb" />
</view>
</block>
</scroll-view>
<view class="content-main-right-operation">
<u-row>
<u-col span="8"></u-col>
<u-col span="4">
<u-button class="btn-operation" :disabled="taskList.length <= 0" type="success" @click="confirmReceipt">
确认收样
</u-button>
</u-col>
</u-row>
</view>
</view>
</u-col>
</u-row>
</view>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import nx from '@/nx'
import { onLoad, onBackPress } from '@dcloudio/uni-app'
// 响应式数据
const currentNode = ref('F30')
const scrollTop = ref(0)
const current = ref(0)
const taskList = ref([])
const sampleList = ref([])
const dicSampleProcessCodeList = ref([])
// 计算属性
const userInfo = computed(() => nx.$store('user').userInfo)
// 方法
const customBack = () => {
uni.reLaunch({ url: '/pages/analysis/index/index' })
}
const selectSample = sample => {
sample.checked = !sample.checked
}
const taskStyle = task => {
if ((task.weightTaskStatus === 0 || task.weightTaskStatus === 1) && task.reviewCount > 0) {
return 'red'
}
if (task.weightTaskStatus === 2 && task.reviewCount > 0) {
return 'green'
}
return ''
}
const confirmReceipt = () => {
const errNodeList = sampleList.value.filter(item => item.sampleProcessNo !== currentNode.value)
if (errNodeList.length > 0) {
uni.showToast({
title: '存在异常节点,联系管理员处理!',
icon: 'none',
duration: 3000
})
return
}
const checkedSampleList = sampleList.value.filter(item => item.checked)
if (checkedSampleList.length !== sampleList.value.length) {
uni.showToast({ title: '样品未全部勾选,请检查!', icon: 'none' })
return
}
uni.showModal({
title: '提示',
content: '确认收样?',
cancelColor: '#0055A2',
confirmColor: '#0055A2',
success: res => {
if (res.cancel) return
const sampleIdList = checkedSampleList.map(item => item.busSubCsampleId)
const data = {
busAssayTaskId: taskList.value[current.value]?.id,
sampleSourceType: 2,
sampleProcessNo: currentNode.value,
isGenSampleHandover: false,
sampleIdList
}
nx.$api.assayTask
.execReceiveSample(data)
.then(() => {
getAssayTask()
})
.catch(err => {
console.error('收样失败:', err)
})
}
})
}
const switchTask = index => {
if (index === current.value) return
current.value = index
const task = taskList.value[index]
if (!task) return
getAssayTaskDetail(task.taskNo)
}
const getAssayTask = () => {
const param = {
finishStatus: 'waiting_receive',
assayOper: userInfo.value.nickname
}
nx.$api.auncel
.getAssayTaskList(param)
.then(res => {
taskList.value = res || []
if (taskList.value.length > 0) {
current.value = 0
getAssayTaskDetail(taskList.value[0].taskNo)
} else {
sampleList.value = []
}
})
.catch(err => {
console.error('获取任务列表失败:', err)
sampleList.value = []
})
}
const getAssayTaskDetail = taskNo => {
const param = {
taskNo,
waiting_receive: '1'
}
nx.$api.assayTask
.getAssayTaskDetailListByTaskNo(param)
.then(res => {
sampleList.value = (res.result || []).map(item => ({ ...item, checked: false }))
})
.catch(err => {
console.error('获取任务详情失败:', err)
sampleList.value = []
})
}
const getDicSampleProcessCodeList = () => {
nx.$api.assayTask.queryQmsDicSampleProcessCodeList().then(res => {
dicSampleProcessCodeList.value = res.records || []
})
}
const getProcessNameShow = val => {
const item = dicSampleProcessCodeList.value.find(i => i.processCode === val)
return item ? item.processName : val
}
const getDataSourceTypeShow = val => {
if (val === 2) return '【筛上】'
if (val === 3) return '【筛下】'
return ''
}
// 生命周期
onLoad(() => {
getDicSampleProcessCodeList()
getAssayTask()
})
onBackPress(() => {
customBack()
return true
})
</script>
<style lang="scss" scoped>
.content-title {
height: 50px;
width: 100%;
font-size: 20px;
font-weight: 300;
}
.content-title-name {
padding: 10px;
text-align: center;
}
.content-main-height {
height: calc(100vh - 125px);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 5px;
height: 100px;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #444;
line-height: 1;
border-bottom: 2px dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-weight: 600;
background: #fff;
}
.content-main-right {
height: calc(100vh - 205px);
}
.content-main-right-operation {
height: 80px;
padding-top: 15px;
padding-right: 15px;
}
.btn-operation {
height: 50px;
font-size: 18px;
}
.sample_desc {
width: 100%;
display: flex;
flex-wrap: nowrap;
justify-content: space-between !important;
padding-right: 15px !important;
}
.sample_desc_warn {
color: red;
}
</style>

View File

@@ -0,0 +1,299 @@
<template>
<view>
<navbar-back :autoBack="false" title="审核查询" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="[current.value === index ? 'u-tab-item-active' : '']"
@tap.stop="swichTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view>
<text style="font-size: 18px">{{ task.taskNo }}</text>
</view>
<view style="margin-top: 10px">
<text>{{ task.taskName }} {{ task.assayOper }}</text>
</view>
<view class="x-f" style="margin-top: 10px">
<u-icon color="" name="clock"></u-icon>
<text style="margin-left: 5px">{{ task.reportTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-right">
<block v-for="(sample, index) in sampleList" :key="index">
<view style="padding: 5px; font-size: 16px">
<u-row
@click="showSampleDetail(sample.id, index)"
:class="selectedIndex.value === index ? 'selected_Sample' : ''"
>
<u-col span="2" style="text-align: center" :style="sampleStyle(sample)">
<view>
<text>{{ sample.sort }}</text>
</view>
</u-col>
<u-col span="5">
<view>
<text style="padding-left: 10px">{{ sample.sampleCode }}</text>
</view>
<view>
<text style="padding-left: 10px">
{{ getDataSourceTypeShow(sample.dataSourceType) }}{{ sample.sampleName }}
</text>
</view>
<view v-if="sample.sampleWeight">
<text style="padding-left: 10px">{{ sample.sampleWeight }} g</text>
</view>
</u-col>
<u-col span="5">
<view>
<text style="padding-left: 10px">{{ sample.remarks }}</text>
</view>
</u-col>
</u-row>
<u-line style="padding: 5px" color="#bbb" />
</view>
</block>
</scroll-view>
<view class="content-main-right-operation">
<u-row>
<u-col span="3"></u-col>
<u-col span="6">
<u-button class="btn-operation" type="primary" @click="previewPDF" v-if="currentTaskId.value">
任务单预览
</u-button>
</u-col>
<u-col span="3"> </u-col>
</u-row>
</view>
</view>
</u-col>
</u-row>
<sample-detail-popup
ref="sampleDetailPopup"
:showPopup="showDetailPopup"
:detailPopupParam="detailPopupParam"
></sample-detail-popup>
</view>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { onLoad, onBackPress } from '@dcloudio/uni-app'
import SampleDetailPopup from '@/components/sample/sample-detail-popup.vue'
import nx from '@/nx'
// 响应式数据
const scrollTop = ref(0)
const current = ref(0)
const currentTask = ref({})
const currentTaskId = ref('')
const currentTaskNo = ref('')
const conAssayTask = ref('')
const reviewNum = ref(0)
const selectedIndex = ref(-1)
const taskList = ref([])
const sampleList = ref([])
const showDetailPopup = ref(false)
const detailPopupParam = ref({ taskDetailId: '' })
// 计算属性
const userInfo = computed(() => nx.$store('user').userInfo)
// 方法
const customBack = () => {
uni.reLaunch({ url: '/pages/analysis/index/index' })
}
const taskStyle = task => {
if ((task.weightTaskStatus === 0 || task.weightTaskStatus === 1) && task.reviewCount > 0) return 'red'
if (task.weightTaskStatus === 2 && task.reviewCount > 0) return 'green'
return ''
}
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 ''
}
const swichTask = async index => {
if (index === current.value) return
current.value = index
selectedIndex.value = -1
const task = taskList.value[index]
currentTask.value = task
currentTaskNo.value = task.taskNo
currentTaskId.value = task.id
getAssayTaskDetail(task.taskNo)
}
const showSampleDetail = (detailId, index) => {
selectedIndex.value = index
console.log('detailId', detailId)
detailPopupParam.value = { taskDetailId: detailId }
showDetailPopup.value = true
}
const getAssayTask = () => {
taskList.value = []
sampleList.value = []
const param = {
finishStatus: 'finished',
wfStatus: 'running',
assayOper: userInfo.value.realname
}
nx.$api.auncel.getAssayTaskList(param).then(res => {
taskList.value = res
if (taskList.value.length > 0) {
current.value = 0
currentTask.value = taskList.value[0]
currentTaskNo.value = taskList.value[0].taskNo
currentTaskId.value = taskList.value[0].id
getAssayTaskDetail(currentTaskNo.value)
} else {
current.value = 0
currentTask.value = {}
currentTaskNo.value = ''
currentTaskId.value = ''
}
})
}
const getAssayTaskDetail = taskNo => {
reviewNum.value = 0
nx.$api.assayTaskTemplateKey
.getAssayTaskDetailListByTaskNo({ taskNo })
.then(res => {
sampleList.value = res.result || []
if (res.additionalProperties?.conAssayTask) {
conAssayTask.value = res.additionalProperties.conAssayTask
}
})
.catch(err => {
console.error(err)
})
}
const previewPDF = () => {
const url = `/pages/analysis/sample/pdf-preview?taskId=${currentTaskId.value}&reportKey=${conAssayTask.value.assayTaskTemplateKey}`
uni.navigateTo({ url })
}
const getDataSourceTypeShow = val => {
if (val === 2) return '【筛上】'
if (val === 3) return '【筛下】'
return ''
}
// 生命周期
onMounted(() => {
getAssayTask()
uni.$on('sample-detail-popup_close', () => {
showDetailPopup.value = false
})
})
onBackPress(() => {
customBack()
return true
})
</script>
<style lang="scss" scoped>
/* 样式部分保持不变 */
.content-title {
height: 50px;
width: 100%;
font-size: 20px;
font-weight: 300;
}
.content-title-name {
padding: 10px;
text-align: center;
}
.content-main-height {
height: calc(100vh - 125px);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 5px;
height: 100px;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #444;
line-height: 1;
border-width: 2px;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 16px;
left: 0;
top: 20px;
}
.content-main-right {
height: calc(100vh - 205px);
}
.content-main-right-operation {
height: 80px;
padding-top: 15px;
padding-right: 15px;
}
.btn-operation {
width: 95%;
}
.selected_Sample {
background-color: #d7e9fa;
}
</style>

View File

@@ -0,0 +1,413 @@
<template>
<view>
<navbar-back :autoBack="false" title="数据上报" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="current === index ? 'u-tab-item-active' : ''"
@tap.stop="swichTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view>
<text style="font-size: 18px">{{ task.taskNo }}</text>
</view>
<view style="margin-top: 10px">
<text>{{ task.taskName }} {{ task.assayOper }}</text>
</view>
<view class="x-f" style="margin-top: 10px">
<u-icon color="" name="clock"></u-icon>
<text style="margin-left: 5px">{{ task.taskOperTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-right">
<block v-for="(sample, index) in sampleList" :key="index">
<view style="padding: 5px; font-size: 16px">
<u-row
@click="showSampleDetail(sample.id, index)"
:class="selectedIndex === index ? 'selected_Sample' : ''"
>
<u-col span="2" style="text-align: center" :style="sampleStyle(sample)">
<view>
<text>{{ sample.sort }}</text>
</view>
</u-col>
<u-col span="5">
<view>
<text style="padding-left: 10px">{{ sample.sampleCode }}</text>
</view>
<view>
<text style="padding-left: 10px"
>{{ getDataSourceTypeShow(sample.dataSourceType) }}{{ sample.sampleName }}</text
>
</view>
</u-col>
<u-col span="5">
<view class="sample_desc_warn" v-if="sample.sampleProcessNo !== currentNode">
当前节点{{ getProcessNameShow(sample.sampleProcessNo) }}
</view>
</u-col>
</u-row>
<u-line style="padding: 5px" color="#bbb" />
</view>
</block>
</scroll-view>
<view class="content-main-right-operation">
<u-row>
<u-col span="3"></u-col>
<u-col span="3">
<u-button class="btn-operation" type="primary" @click="previewPDF" v-if="currentTaskId">
任务单预览
</u-button>
</u-col>
<u-col span="3">
<u-button
class="btn-operation"
v-if="currentTaskId"
type="warning"
:disabled="taskReviewDisabled"
@click="taskReview"
>
撤回任务单
</u-button>
</u-col>
<u-col span="3">
<u-button class="btn-operation" :disabled="dataReportDisabled" type="success" @click="dataReport">
数据上报
</u-button>
</u-col>
</u-row>
</view>
</view>
</u-col>
</u-row>
<!-- 样品详情 -->
<sample-detail-popup
ref="sampleDetailPopup"
:showPopup="showDetailPopup"
:detailPopupParam="detailPopupParam"
></sample-detail-popup>
</view>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { onLoad, onBackPress } from '@dcloudio/uni-app'
import SampleDetailPopup from '@/components/sample/sample-detail-popup.vue'
import nx from '@/nx'
// 响应式数据
const scrollTop = ref(0)
const current = ref(0)
const currentTask = ref({})
const currentTaskId = ref('')
const currentTaskNo = ref('')
const conAssayTask = ref('')
const reviewNum = ref(0)
const selectedIndex = ref(-1)
const taskList = ref([])
const sampleList = ref([])
const showDetailPopup = ref(false)
const detailPopupParam = ref({ taskDetailId: '' })
const currentNode = ref('F31')
const dicSampleProcessCodeList = ref([])
// 计算属性
const taskReviewDisabled = computed(() => currentTask.value.finishStatus !== 'finished')
const dataReportDisabled = computed(() => currentTask.value.finishStatus !== 'finished')
const userInfo = computed(() => nx.$store('user').userInfo)
// 方法
const customBack = () => {
uni.reLaunch({ url: '/pages/analysis/index/index' })
}
const taskStyle = task => {
if ((task.weightTaskStatus === 0 || task.weightTaskStatus === 1) && task.reviewCount > 0) return 'red'
if (task.weightTaskStatus === 2 && task.reviewCount > 0) return 'green'
return ''
}
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 ''
}
const swichTask = async index => {
if (index === current.value) return
current.value = index
const task = taskList.value[index]
currentTask.value = task
currentTaskNo.value = task.taskNo
currentTaskId.value = task.id
getAssayTaskDetail(task.taskNo)
}
const showSampleDetail = (detailId, index) => {
selectedIndex.value = index
detailPopupParam.value = { taskDetailId: detailId }
showDetailPopup.value = true
}
const getAssayTask = () => {
taskList.value = []
sampleList.value = []
const param = {
finishStatus: 'finished',
wfStatus: '0,revoke',
assayOper: userInfo.value.nickname
}
nx.$api.auncel
.getAssayTaskList(param)
.then(res => {
taskList.value = res
if (taskList.value.length > 0) {
current.value = 0
currentTask.value = taskList.value[0]
currentTaskNo.value = taskList.value[0].taskNo
currentTaskId.value = taskList.value[0].id
getAssayTaskDetail(currentTaskNo.value)
} else {
current.value = 0
currentTask.value = {}
currentTaskNo.value = ''
currentTaskId.value = ''
}
})
.catch(err => {
console.error(err)
})
}
const getAssayTaskDetail = taskNo => {
reviewNum.value = 0
$u.api
.getAssayTaskDetailListByTaskNo({ taskNo })
.then(res => {
sampleList.value = res.result || []
if (res.additionalProperties?.conAssayTask) {
conAssayTask.value = res.additionalProperties.conAssayTask
}
})
.catch(err => {
console.error(err)
})
}
const previewPDF = () => {
const url = `/pages/analysis/sample/pdf-preview?taskId=${currentTaskId.value}&reportKey=${conAssayTask.value.assayTaskTemplateKey}&hideResultFlag=true`
uni.navigateTo({ url })
}
const taskReview = () => {
const errNodeList = sampleList.value.filter(item => item.sampleProcessNo !== currentNode.value)
if (errNodeList.length > 0) {
uni.showToast({ title: '存在异常节点,联系管理员处理!', icon: 'none', duration: 3000 })
return
}
uni.showModal({
title: '提示',
content: '撤回当前任务指派单,是否继续?',
cancelColor: '#0055A2',
confirmColor: '#0055A2',
success: res => {
if (res.confirm) {
nx.$api.assayTask.rollbackAssayTask(currentTaskId.value).then(() => {
currentTaskId.value = ''
currentTask.value = {}
uni.showToast({ title: '撤回成功!' })
uni.navigateTo({ url: '/pages/analysis/sample/sample-work-list' })
})
}
}
})
}
const dataReport = () => {
const errNodeList = sampleList.value.filter(item => item.sampleProcessNo !== currentNode.value)
if (errNodeList.length > 0) {
uni.showToast({ title: '存在异常节点,联系管理员处理!', icon: 'none', duration: 3000 })
return
}
uni.showModal({
title: '提示',
content: '确定上报数据?',
cancelColor: '#0055A2',
confirmColor: '#0055A2',
success: res => {
if (res.confirm) {
nx.$api.assayTask.reportAssayTask(currentTaskId.value).then(res => {
currentTaskId.value = ''
currentTask.value = {}
if (res.additionalProperties?.conAssayTask?.isPrint === 1) {
printTask()
}
getAssayTask()
})
}
}
})
}
const getDicSampleProcessCodeList = () => {
nx.$api.assayTask.queryQmsDicSampleProcessCodeList().then(res => {
dicSampleProcessCodeList.value = res.records
})
}
const getProcessNameShow = val => {
const item = dicSampleProcessCodeList.value.find(i => i.processCode === val)
return item ? item.processName : val
}
const getDataSourceTypeShow = val => {
if (val === 2) return '【筛上】'
if (val === 3) return '【筛下】'
return ''
}
const printTask = () => {
uni.showModal({
title: '提示',
content: '数据上报成功!是否打印“原始记录单”?',
cancelColor: '#0055A2',
confirmColor: '#0055A2',
success: res => {
if (res.confirm) {
nx.$print.getPrintTemplateAndPrint(currentTask.value)
}
}
})
}
// 生命周期
onMounted(() => {
getDicSampleProcessCodeList()
getAssayTask()
// 监听 popup 关闭
uni.$on('sample-detail-popup_close', () => {
showDetailPopup.value = false
})
})
onBackPress(() => {
customBack()
return true
})
</script>
<style lang="scss" scoped>
/* 样式保持不变 */
.content-title {
height: 50px;
width: 100%;
font-size: 20px;
font-weight: 300;
}
.content-title-name {
padding: 10px;
text-align: center;
}
.content-main-height {
height: calc(100vh - 125px);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 5px;
height: 100px;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #444;
line-height: 1;
border-width: 2px;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 16px;
left: 0;
top: 20px;
}
.content-main-right {
height: calc(100vh - 205px);
}
.content-main-right-operation {
height: 80px;
padding-top: 15px;
padding-right: 15px;
}
.btn-operation {
width: 95%;
}
.selected_Sample {
background-color: #d7e9fa;
}
.sample_desc_warn {
color: red;
padding-right: 10px;
}
</style>

View File

@@ -0,0 +1,423 @@
<template>
<view>
<navbar-back :autoBack="false" title="样重复核" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']"
:data-current="index"
@tap.stop="swichTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view>
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
</view>
<view style="margin-top: 20rpx">
<text>{{ task.taskName }}</text>
</view>
<view class="x-f" style="margin-top: 20rpx">
<u-icon name="clock"></u-icon>
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-right">
<u-checkbox-group @change="checkboxGroupChange" style="width: 100%">
<block v-for="(sample, index) in sampleList" :key="index">
<view style="width: 100%; padding: 10rpx; font-size: 36rpx">
<u-row>
<u-col span="2" style="text-align: center">
<view>
<text>{{ sample.sort }}</text>
</view>
</u-col>
<u-col span="4">
<view>
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
</view>
<view>
<text style="padding-left: 20rpx"
>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.sampleName }}</text
>
</view>
<view>
<text v-if="sample.sampleWeight" style="padding-left: 20rpx">{{ sample.sampleWeight }} g</text>
</view>
</u-col>
<u-col span="4">
<view>
<text style="padding-left: 20rpx">{{ sample.cupNum }}号杯</text>
</view>
<view>
<text style="padding-left: 20rpx">{{ sample.remarks }}</text>
</view>
<view>
<text style="padding-left: 20rpx">{{ sample.measureTime | getWeightTimeShow }}</text>
</view>
</u-col>
<u-col span="2">
<view>
<u-checkbox
@change="checkboxChange"
v-model="sample.checked"
:label="sample.id"
:name="sample.id"
>
</u-checkbox>
<!-- <block v-if="sample.reviewCount > 0 && sample.weightSubmitStatus == 0">
<u-button
type="warning"
@click="recovery(sample.id)"
>恢复</u-button>
</block>
<block v-else>
<u-button
type="default"
@click="review(sample.id)"
>复核</u-button>
</block> -->
</view>
</u-col>
</u-row>
<u-line style="padding: 10rpx" color="#bbb" />
</view>
</block>
</u-checkbox-group>
</scroll-view>
<view class="content-main-right-operation">
<u-row>
<u-col span="4"><!-- <u-button class="btn-operation" type="primary">原始记录单打印</u-button> --></u-col>
<u-col span="4"
><!-- <u-button class="btn-operation" :disabled="reviewNum > 0" type="success" >数据上报</u-button> --></u-col
>
<u-col span="4">
<!-- <u-button class="btn-operation" :disabled="reviewNum == 0" type="warning" @click="taskReview">任务单退回复核</u-button> -->
<u-button class="btn-operation" :disabled="reviewList.length <= 0" type="warning" @click="taskReviewAll"
>任务单退回复核</u-button
>
</u-col>
</u-row>
</view>
</view>
</u-col>
</u-row>
</view>
</template>
<script>
export default {
data() {
return {
scrollTop: 0, //tab标题的滚动条位置
current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
currentTaskId: '', //当前选择的任务单id
currentTaskNo: '', //当前选中的任务编号
reviewNum: 0, //复核数
reviewList: [],
taskList: [],
sampleList: []
}
},
onLoad(param) {
if (param.currentTaskNo) {
this.currentTaskNo = param.currentTaskNo
}
//获取任务列表
this.getAssayTask()
},
methods: {
//返回上一页
customBack() {
uni.redirectTo({
url: '/pages/analysis/sample/sample-report'
})
},
//开始秤样
startWeighSample() {
uni.navigateTo({
url: '/pages/auncel/auncel-weigh'
})
},
//切换任务
async swichTask(index) {
if (index == this.current) return
this.current = index
// 如果为0意味着尚未初始化
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
await this.getElRect('menu-scroll-view', 'menuHeight')
await this.getElRect('u-tab-item', 'menuItemHeight')
}
// 将菜单菜单活动item垂直居中
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2
//获取任务详情
this.currentTaskNo = this.taskList[index].taskNo
this.currentTaskId = this.taskList[index].id
this.getAssayTaskDetail(this.currentTaskNo)
},
// 获取一个目标元素的高度
getElRect(elClass, dataVal) {
new Promise((resolve, reject) => {
const query = uni.createSelectorQuery().in(this)
query
.select('.' + elClass)
.fields({ size: true }, res => {
// 如果节点尚未生成res值为null循环调用执行
if (!res) {
setTimeout(() => {
this.getElRect(elClass)
}, 10)
return
}
this[dataVal] = res.height
})
.exec()
})
},
getAssayTask() {
//显示loading
uni.showLoading({
title: '加载中...'
})
// this.$u.api
// .getAssayTaskListBy({taskStatus:2})
const param = {
operateType: 'review',
taskNo: this.currentTaskNo
}
this.$u.api
.getAssayTaskList(param)
.then(res => {
this.taskList = res.result
this.currentTaskNo = this.taskList[0].taskNo
this.currentTaskId = this.taskList[0].id
this.getAssayTaskDetail(this.currentTaskNo)
uni.hideLoading()
})
.catch(err => {
uni.hideLoading()
console.log(err)
})
},
getAssayTaskDetail(taskNo) {
this.reviewNum = 0
this.$u.api
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
.then(res => {
this.sampleList = res.result
this.showLoading = false
//统计需要复核的数量
this.sampleList.forEach(item => {
if (item.reviewCount > 0 && item.weightSubmitStatus == 0) {
item.checked = true
this.reviewNum += 1
}
})
})
.catch(err => {
this.showLoading = false
console.log(err)
})
},
review(id) {
this.$u.api
.assayTaskDetailReview(id)
.then(res => {
this.getAssayTaskDetail(this.currentTaskNo)
this.showLoading = false
})
.catch(err => {
this.showLoading = false
console.log(err)
})
},
recovery(id) {
this.$u.api
.assayTaskDetailRecovery(id)
.then(res => {
this.getAssayTaskDetail(this.currentTaskNo)
this.showLoading = false
})
.catch(err => {
this.showLoading = false
console.log(err)
})
},
//任务单退回复核
taskReview() {
this.$u.api
.assayTaskReview(this.currentTaskId)
.then(res => {
this.showLoading = false
uni.redirectTo({
url: '/pages/sample/sample-report'
})
})
.catch(err => {
this.showLoading = false
console.log(err)
})
},
//任务单及样品退回复核
taskReviewAll() {
uni.showModal({
title: '提示',
content: '确定复核当前选中的样品?',
cancelColor: '#0055A2',
confirmColor: '#0055A2',
success: res => {
if (res.cancel) {
console.log('用户点击取消')
return
}
console.log('确定。。。')
//显示loading
uni.showLoading({
title: '退回中...'
})
this.$u.api
.reviewWeightTaskByTaskIdAndSampleIds(this.currentTaskId, this.reviewList.join(','))
.then(res => {
uni.hideLoading()
uni.redirectTo({
url: '/pages/sample/sample-report'
})
})
.catch(err => {
uni.hideLoading()
console.log(err)
})
}
})
},
checkboxGroupChange(v) {
this.reviewList = v
this.reviewNum = v.length
//console.log('group change', v);
},
checkboxChange(e) {
/* if(e.value) {
this.review(e.name);
} else {
this.recovery(e.name);
} */
}
},
filters: {
getWeightTimeShow(time) {
if (time == null) return ''
return time.split(' ')[1]
},
getDataSourceTypeShow(val) {
if (val == 2) return '【筛上】'
if (val == 3) return '【筛下】'
return ''
}
}
}
</script>
<style lang="scss" scoped>
.content-title {
height: 110rpx;
width: 100%;
font-size: 46rpx;
font-weight: 300;
}
.content-title-name {
padding: 20rpx;
text-align: center;
}
.content-main-height {
height: calc(100vh - 250rpx);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 10rpx;
height: 200rpx;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
color: #444;
font-weight: 400;
line-height: 1;
border-width: 4rpx;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-size: 36rpx;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 32rpx;
left: 0;
top: 39rpx;
}
.content-main-right {
height: calc(100vh - 410rpx);
}
.content-main-right-operation {
height: 160rpx;
padding-top: 30rpx;
}
.btn-operation {
height: 100rpx;
font-size: 36rpx;
}
</style>

View File

@@ -0,0 +1,425 @@
<!--送样-->
<template>
<view class="page">
<navbar-back :autoBack="false" title="样品分析-送样" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']"
:data-current="index"
@tap.stop="swichTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view>
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
</view>
<view style="margin-top: 20rpx">
<text>{{ task.taskName }}</text>
</view>
<view class="x-f" style="margin-top: 20rpx">
<u-icon color="" name="clock"></u-icon>
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-right">
<block v-for="(sample, index) in sampleList" :key="index">
<view style="padding: 10rpx; font-size: 36rpx">
<u-row>
<u-col span="3" style="text-align: center">
<view>
<text>{{ sample.sort }}</text>
</view>
<!-- <u-row>-->
<!-- <u-col span="6" style="text-align: center;">-->
<!-- <u-checkbox v-model="sample.checked" v-if="sample.sampleProcessNo == 'F39'" @change="selectSample(sample)"></u-checkbox>-->
<!-- </u-col>-->
<!-- <u-col span="6" style="text-align: center;">-->
<!-- -->
<!-- </u-col>-->
<!-- </u-row>-->
</u-col>
<u-col span="9" class="sample_desc">
<view>
<view>
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
</view>
<view>
<text style="padding-left: 20rpx"
>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.sampleName }}</text
>
</view>
</view>
<view class="sample_desc_warn" v-if="sample.sampleProcessNo != 'F39'">
状态异常{{ sample.sampleProcessNo }}
</view>
</u-col>
</u-row>
<u-line style="padding: 10rpx" color="#bbb" />
</view>
</block>
</scroll-view>
<view class="content-main-right-operation">
<u-row>
<u-col span="4"></u-col>
<u-col span="4"></u-col>
<u-col span="4">
<u-button
class="btn-operation"
:disabled="this.taskList.length <= 0"
type="success"
@click="confirmReceipt"
>确认送样</u-button
>
</u-col>
</u-row>
</view>
</view>
</u-col>
</u-row>
</view>
</template>
<script>
export default {
data() {
return {
scrollTop: 0, //tab标题的滚动条位置
current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
currentTask: '', //当前选中任务
currentTaskNo: '', //当前选中的任务编号
currentTaskType: '', //当前任务类型
taskList: [],
sampleList: []
}
},
onLoad() {
//获取任务列表
this.getAssayTask()
},
methods: {
//返回首页
customBack() {
uni.reLaunch({
url: '/pages/analysis/index/index'
})
},
selectSample(sample) {
if (sample.checked) sample.checked = false
else sample.checked = true
},
taskStyle(task) {
if (task.weightTaskStatus == 0 && task.reviewCount > 0) {
return 'red'
}
if (task.weightTaskStatus == 1 && task.reviewCount > 0) {
return 'red'
}
if (task.weightTaskStatus == 2 && task.reviewCount > 0) {
return 'green'
}
return ''
},
sampleStyle(sample) {
//console.log(sample);
if (sample.weightSubmitStatus == 0 && sample.reviewCount > 0) {
return 'color: red'
}
if (sample.weightSubmitStatus == 1 && sample.reviewCount > 0) {
//return 'color: #e0861a';
return 'color: green'
}
if (sample.weightSubmitStatus == 2 && sample.reviewCount > 0) {
return 'color: green'
}
return ''
},
//确认送样
confirmReceipt() {
//检查是否选中所有
// let checkedSampleList = this.sampleList.filter(item => item.checked);
// if (checkedSampleList.length != this.sampleList.length) {
// this.$helper.showToast({
// title: '样品未全部勾选,请检查!'
// });
// return;
// }
//检查是否所有样品都在F39
const checkList = this.sampleList.filter(item => item.sampleProcessNo != 'F39')
if (checkList.length > 0) {
this.$helper.showToast({
title: '部分样品状态异常,请联系技术支持人员处理!'
})
return
}
const checkedSampleList = this.sampleList
uni.showModal({
title: '提示',
content: '确认送样?',
cancelColor: '#0055A2',
confirmColor: '#0055A2',
success: res => {
if (res.cancel) {
return
}
const sampleIdList = checkedSampleList.map(item => item.busSubCsampleId)
const data = {
busAssayTaskId: this.currentTask.id,
sampleSourceType: 2,
sampleProcessNo: 'F39',
isGenSampleHandover: false,
sampleIdList: sampleIdList
}
uni.showLoading({
title: '正在提交...'
})
this.$u.api
.execSendSample(data)
.then(res => {
let msg = '发生错误,请稍后再试!'
if (!res.success) {
if (res.message) {
msg = res.message
}
this.$helper.showToast({
title: msg
})
return
}
this.$helper.showToast({
title: '操作成功!'
})
this.getAssayTask()
})
.catch(err => {
this.$helper.showToast({
title: '提交失败!'
})
console.log(err)
})
.finally(() => {
uni.hideLoading()
})
}
})
},
//切换任务
async swichTask(index) {
if (index == this.current) return
this.current = index
// 如果为0意味着尚未初始化
// if (this.menuHeight == 0 || this.menuItemHeight == 0) {
// await this.getElRect('menu-scroll-view', 'menuHeight');
// await this.getElRect('u-tab-item', 'menuItemHeight');
// }
// // 将菜单菜单活动item垂直居中
// this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2;
//获取任务详情
this.currentTask = this.taskList[index]
this.currentTaskNo = this.taskList[index].taskNo
this.currentTaskType = this.taskList[index].taskType
this.getAssayTaskDetail(this.currentTaskNo)
},
// 获取一个目标元素的高度
getElRect(elClass, dataVal) {
new Promise((resolve, reject) => {
const query = uni.createSelectorQuery().in(this)
query
.select('.' + elClass)
.fields({ size: true }, res => {
// 如果节点尚未生成res值为null循环调用执行
if (!res) {
setTimeout(() => {
this.getElRect(elClass)
}, 10)
return
}
this[dataVal] = res.height
})
.exec()
})
},
getAssayTask() {
//显示loading
uni.showLoading({
title: '加载中...'
})
const param = {
operateType: 'send',
assayOper: this.userInfo.realname
}
this.$u.api
.getAssayTaskList(param)
.then(res => {
this.taskList = res.result
if (!this.taskList || this.taskList.length == 0) {
this.sampleList = []
return
}
if (this.taskList && this.taskList.length > 0) {
this.current = 0
this.currentTask = this.taskList[0]
this.currentTaskNo = this.taskList[0].taskNo
this.currentTaskType = this.taskList[0].taskType
this.getAssayTaskDetail(this.currentTaskNo)
}
})
.catch(err => {
console.log(err)
})
.finally(() => {
uni.hideLoading()
})
},
getAssayTaskDetail(taskNo) {
uni.showLoading({
title: '加载中...'
})
const param = {
taskNo: taskNo,
waiting_receive: '1' //标记是收样
}
this.$u.api
.getAssayTaskDetailListByTaskNo(param)
.then(res => {
const list = res.result
list.forEach(item => {
item.checked = false
})
this.sampleList = list
this.showLoading = false
})
.catch(err => {
this.showLoading = false
console.log(err)
})
.finally(() => {
uni.hideLoading()
})
}
},
filters: {
getDataSourceTypeShow(val) {
if (val == 2) return '【筛上】'
if (val == 3) return '【筛下】'
return ''
}
}
}
</script>
<style lang="scss" scoped>
.content-title {
height: 110rpx;
width: 100%;
font-size: 46rpx;
font-weight: 300;
}
.content-title-name {
padding: 20rpx;
text-align: center;
}
.content-main-height {
height: calc(100vh - 250rpx);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 10rpx;
height: 200rpx;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
color: #444;
font-weight: 400;
line-height: 1;
border-width: 4rpx;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-size: 36rpx;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 32rpx;
left: 0;
top: 39rpx;
}
.content-main-right {
height: calc(100vh - 410rpx);
}
.content-main-right-operation {
height: 160rpx;
padding-top: 30rpx;
}
.btn-operation {
height: 100rpx;
font-size: 36rpx;
}
.sample_desc {
width: 100%;
display: flex;
flex-wrap: nowrap; /* 禁止换行 */
justify-content: space-between !important;
padding-right: 15px !important;
}
.sample_desc_warn {
color: red;
}
</style>

View File

@@ -0,0 +1,319 @@
<template>
<view class="page">
<navbar-back :autoBack="false" title="样品称重" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="[current == index ? 'u-tab-item-active' : '']"
:data-current="index"
@tap.stop="swichTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view>
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
</view>
<view style="margin-top: 20rpx">
<text>{{ task.taskName }}</text>
</view>
<view class="x-f" style="margin-top: 20rpx">
<u-icon name="clock"></u-icon>
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-right">
<block v-for="(sample, index) in sampleList" :key="index">
<view v-if="currentTask.reviewCount == sample.reviewCount" style="padding: 10rpx; font-size: 36rpx">
<u-row>
<u-col span="2" style="text-align: center">
<view>
<text>{{ sample.sort }}</text>
</view>
</u-col>
<u-col span="10">
<view>
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
</view>
<view>
<text style="padding-left: 20rpx"
>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.sampleName }}</text
>
</view>
<block v-if="sample.sampleWeight && sample.weightSubmitStatus != 0">
<view>
<text v-if="sample.sampleWeight" style="padding-left: 20rpx">{{ sample.sampleWeight }} g</text>
</view>
</block>
</u-col>
</u-row>
<u-line style="padding: 10rpx" color="#bbb" />
</view>
</block>
</scroll-view>
<view class="content-main-right-operation">
<u-row>
<u-col span="4"></u-col>
<u-col span="4"></u-col>
<u-col span="4">
<u-button
class="btn-operation"
:disabled="this.taskList.length <= 0"
type="success"
@click="startWeighSample"
>开始秤样</u-button
>
</u-col>
</u-row>
</view>
</view>
</u-col>
</u-row>
</view>
</template>
<script>
export default {
data() {
return {
scrollTop: 0, //tab标题的滚动条位置
current: 0, // 预设当前项的值
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
currentTask: '', //当前选中任务
currentTaskNo: '', //当前选中的任务编号
currentTaskType: '', //当前任务类型
taskList: [],
sampleList: []
}
},
onLoad() {
//获取任务列表
this.getAssayTask()
},
methods: {
//返回首页
customBack() {
uni.reLaunch({
url: '/pages/analysis/index/index'
})
},
taskStyle(task) {
if (task.weightTaskStatus == 0 && task.reviewCount > 0) {
return 'red'
}
if (task.weightTaskStatus == 1 && task.reviewCount > 0) {
return 'red'
}
if (task.weightTaskStatus == 2 && task.reviewCount > 0) {
return 'green'
}
return ''
},
sampleStyle(sample) {
//console.log(sample);
if (sample.weightSubmitStatus == 0 && sample.reviewCount > 0) {
return 'color: red'
}
if (sample.weightSubmitStatus == 1 && sample.reviewCount > 0) {
//return 'color: #e0861a';
return 'color: green'
}
if (sample.weightSubmitStatus == 2 && sample.reviewCount > 0) {
return 'color: green'
}
return ''
},
//开始秤样
startWeighSample() {
uni.navigateTo({
url:
'/pages/auncel/auncel-weigh?currentTaskNo=' + this.currentTaskNo + '&currentTaskType=' + this.currentTaskType
})
},
//切换任务
async swichTask(index) {
if (index == this.current) return
this.current = index
// 如果为0意味着尚未初始化
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
await this.getElRect('menu-scroll-view', 'menuHeight')
await this.getElRect('u-tab-item', 'menuItemHeight')
}
// 将菜单菜单活动item垂直居中
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2
//获取任务详情
this.currentTask = this.taskList[index]
this.currentTaskNo = this.taskList[index].taskNo
this.currentTaskType = this.taskList[index].taskType
this.getAssayTaskDetail(this.currentTaskNo)
},
// 获取一个目标元素的高度
getElRect(elClass, dataVal) {
new Promise((resolve, reject) => {
const query = uni.createSelectorQuery().in(this)
query
.select('.' + elClass)
.fields({ size: true }, res => {
// 如果节点尚未生成res值为null循环调用执行
if (!res) {
setTimeout(() => {
this.getElRect(elClass)
}, 10)
return
}
this[dataVal] = res.height
})
.exec()
})
},
getAssayTask() {
//显示loading
uni.showLoading({
title: '加载中...'
})
const param = {
operateType: 'weight',
assayOper: this.userInfo.realname
}
this.$u.api
.getAssayTaskList(param)
.then(res => {
this.taskList = res.result
if (this.taskList && this.taskList.length > 0) {
this.currentTask = this.taskList[0]
this.currentTaskNo = this.taskList[0].taskNo
this.currentTaskType = this.taskList[0].taskType
this.getAssayTaskDetail(this.currentTaskNo)
}
uni.hideLoading()
})
.catch(err => {
uni.hideLoading()
console.log(err)
})
},
getAssayTaskDetail(taskNo) {
this.$u.api
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
.then(res => {
this.sampleList = res.result
this.showLoading = false
})
.catch(err => {
this.showLoading = false
console.log(err)
})
}
},
filters: {
getDataSourceTypeShow(val) {
if (val == 2) return '【筛上】'
if (val == 3) return '【筛下】'
return ''
}
}
}
</script>
<style lang="scss" scoped>
.content-title {
height: 110rpx;
width: 100%;
font-size: 46rpx;
font-weight: 300;
}
.content-title-name {
padding: 20rpx;
text-align: center;
}
.content-main-height {
height: calc(100vh - 250rpx);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 10rpx;
height: 200rpx;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
color: #444;
font-weight: 400;
line-height: 1;
border-width: 4rpx;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-size: 36rpx;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 32rpx;
left: 0;
top: 39rpx;
}
.content-main-right {
height: calc(100vh - 410rpx);
}
.content-main-right-operation {
height: 160rpx;
padding-top: 30rpx;
}
.btn-operation {
height: 100rpx;
font-size: 36rpx;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,746 @@
<template>
<view>
<navbar-back titleWidth="800" :title="title"></navbar-back>
<u-row>
<u-col span="1"></u-col>
<u-col span="10">
<scroll-view scroll-y scroll-with-animation :scroll-top="scrollTop">
<u-form :model="taskInstance" ref="uForm" label-width="210">
<view class="form-item-my" v-for="(field, index) in formFields" :key="'field_' + index">
<view
class="label-my"
:style="{ fontWeight: checkFeadToDetailField(field.headToDetailField) ? 'bold' : 'normal' }"
>{{ field.label }}</view
>
<view class="content-my">
<view v-if="field.type == 'title' && field.display" class="content-title">
{{ field.textValue }}
</view>
<!--普通输入框-->
<u-input
v-if="
field.type == 'input' &&
(field.decimalCount == null || field.decimalCount == '' || Number(field.decimalCount == null) < 0)
"
v-model="field.value"
clearable
:placeholder="field.placeholder"
:disabled="field.fillingWay != '1'"
/>
<!--数字,限制小数位数-->
<u-input
v-if="field.type == 'input' && field.decimalCount != null && Number(field.decimalCount == null) >= 0"
type="number"
clearable
@blur="event => checkDecimal(event, field)"
v-model="field.value"
:placeholder="field.placeholder"
:disabled="field.fillingWay != '1'"
/>
<!--select-->
<view v-if="field.type == 'select'" class="x-bc select-my" @click="handleFieldClick(field)">
<text v-if="field.valueText">{{ field.valueText }}</text>
<text v-else>请选择</text>
<u-icon name="arrow-down" size="20"></u-icon>
</view>
<u-picker
v-if="field.type == 'select'"
:show="field.showPicker"
:columns="[field.options]"
keyName="displayName"
@cancel="field.showPicker = false"
@confirm="event => pickerConfirm(event, field)"
/>
<!--日期-->
<view v-if="field.type == 'date'" class="x-bc select-my" @click="handleFieldClick(field)">
<text v-if="field.value">{{ field.value }}</text>
<text v-else>请选择</text>
<u-icon name="calendar-fill" size="20"></u-icon>
</view>
<u-datetime-picker
v-if="field.type == 'date'"
:show="field.showPicker"
v-model="curDate"
mode="date"
@cancel="field.showPicker = false"
@confirm="event => pickerConfirm(event, field)"
></u-datetime-picker>
</view>
</view>
</u-form>
</scroll-view>
<u-button type="primary" @click="saveHeadData">保存</u-button>
</u-col>
<u-col span="1"> </u-col>
</u-row>
</view>
</template>
<script>
import request from '@/nx/request'
import { cloneDeep } from 'lodash'
import { calcAnalysisValue } from '@/nx/helper/calcAnalysisValue'
import nx from '@/nx'
export default {
data() {
return {
title: '编辑指派单',
taskInstance: {},
scrollTop: 0, //tab标题的滚动条位置
currentTaskNo: '', //当前任务样品
showDicPicker: false,
curDate: Number(new Date()),
//字段值对象
formValue: {},
//后端返回的字段结构
sourceFormFields: [],
//处理后的字段结构
formFields: [],
sampleList: []
}
},
computed: {
dynamicFieldPlaceholder(field) {
return '请输入'
}
},
onLoad(param) {
if (param.currentTaskNo) {
this.currentTaskNo = param.currentTaskNo
}
this.title = '样品分析-任务指派单:' + this.currentTaskNo
this.loadHeadFieldsAndValueByTaskNo()
this.getSampleList(this.currentTaskNo)
},
methods: {
handleFieldClick(field) {
if (field.type == 'date') {
if (field.fillingWay == '1') {
field.showPicker = true
}
return
}
field.showPicker = true
},
checkFeadToDetailField(headToDetailField) {
if (headToDetailField && headToDetailField.trim() != '') {
return true
} else {
return false
}
},
getSampleList(taskNo) {
this.$u.api
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
.then(res => {
this.sampleList = res.result
})
.catch(err => {
console.error(err)
})
},
//返回上一页
// customBack() {
// uni.redirectTo({
// url: "/pages/sample/sample-work-detail"
// });
// },
navRightClick() {},
//处理小数位数补0或去除多余位数
checkDecimal(e, field) {
if (e == '') return
const decimalCount = field.decimalCount
if (decimalCount == null || decimalCount == '' || isNaN(decimalCount)) return
const count = Number(field.decimalCount)
const value = field.value
const pos = value.indexOf('.') + 1
let length = value.length - pos
if (pos == 0) {
length = 0
}
while (length < count) {
if (field.value.indexOf('.') < 0) field.value += '.'
field.value = field.value + '0'
length++
}
if (count === 0) {
field.value = parseInt(field.value) + ''
} else if (length > count) {
field.value = field.value.substring(0, pos + count)
}
},
updateFieldValue(name, val) {
for (const field of this.formFields) {
if (field.prop == name) {
field.value = val
break
}
}
},
assembleFields() {
const me = this
const formFields = []
for (const field of this.sourceFormFields) {
//日期类型的默认值
if (field.type == 'date') {
const value = field.value
field.showPicker = false
if (value == 'curDate') {
field.value = me.$helper.dateFormat(new Date(), 'yyyy-MM-dd')
}
}
if (field.type == 'select') {
field.showPicker = false
}
formFields.push(field)
}
//先序列化再转json避免json里定义的方法丢失
this.formFields = JSON.parse(JSON.stringify(formFields, replacer), reviver)
// this.formFields = formFields;
},
//绑定数据
bindFormValue() {
const me = this
//formValue
for (const field of me.formFields) {
const prop = field.prop
if (prop) {
const value = me.formValue[prop]
if (value) {
field.value = value
if (field.type == 'select') {
field.valueText = value
}
}
}
}
},
//获取表单字段和值(老数据)
loadHeadFieldsAndValueByTaskNo() {
const me = this
const currentTaskNo = me.currentTaskNo
this.$u.api
.queryHeadValueByTaskNo({ taskNo: currentTaskNo })
.then(res => {
const result = res.result
const formConf = result.formConf
me.sourceFormFields = eval(formConf)
me.formValue = JSON.parse(result.formValue)
//加载和处理表单字段
me.assembleFields()
//绑定数据
me.bindFormValue()
//读取字段里的动态选项
me.loadFieldApiData()
console.log('formFields', this.formFields)
})
.catch(err => {
//如果没有查到数据,按配置读取新的表单字段
me.getHeadFields()
})
},
// 获取表单字段(新数据)
getHeadFields() {
const me = this
const currentTaskNo = this.currentTaskNo
uni.showLoading({
title: '加载中...'
})
this.$u.api
.queryHeadFieldsByTaskNo({ taskNo: currentTaskNo })
.then(res => {
me.sourceFormFields = me.analysisFormAndFields(res)
//加载和处理表单字段
me.assembleFields()
//读取字段里的动态选项
me.loadFieldApiData()
})
.finally(() => {
uni.hideLoading()
})
},
analysisFormAndFields(formRet) {
const fieldsArray = []
for (const form of formRet) {
let content = cloneDeep(form.content)
content = eval('(' + content + ')')
const column = content.column
for (const field of column) {
fieldsArray.push(field)
}
}
return fieldsArray
},
//将抬头字段值同步保存到明细字段
saveHeadValueToDetail(onComplete) {
//循环抬头字段,提取需哟保存到明细的字段
const conf = []
for (const field of this.formFields) {
const prop = field.prop
const headToDetailField = field.headToDetailField
if (prop && headToDetailField && headToDetailField.trim() != '') {
const value = field.value
const r = {
prop: field.prop,
value: value,
headToDetailField: headToDetailField
}
conf.push(r)
}
}
const data = {
taskNo: this.currentTaskNo,
conf: conf
}
this.$u.api.saveHeadValueToDetail(data).then(res => {
if (onComplete) onComplete()
})
},
handleSave() {
//显示loading
uni.showLoading({
title: '正在保存...'
})
//组装数据
const formValue = {}
for (const field of this.formFields) {
const prop = field.prop
if (prop) {
formValue[prop] = field.value
}
}
const value = {
taskNo: this.currentTaskNo,
formValue: JSON.stringify(formValue),
formConf: JSON.stringify(this.sourceFormFields, replacer)
}
this.$u.api
.saveHeadValue(value)
.then(async res => {
await this.saveHeadValueToDetail(async () => {
if (this.checkPropertyEquality()) {
await this.processIds(this.sampleList, 100)
} else {
uni.hideLoading()
// this.$helper.showToast({
// title: '保存成功!'
// });
uni.redirectTo({
url: '/pages/analysis/sample/sample-work-detail?currentTaskNo=' + this.currentTaskNo
})
}
})
})
.catch(err => {
uni.hideLoading()
console.log(err)
})
},
// 检查字段修改前和修改后字段值是否相等
checkPropertyEquality() {
for (const field of this.formFields) {
const prop = field.prop
if (prop && field['headToDetailField'] && field['headToDetailField'].trim() !== '') {
const flag = this.formValue[prop] !== field.value ? true : false
if (flag) return true
}
}
return false
},
//保存抬头字段
saveHeadData() {
if (this.checkPropertyEquality()) {
uni.showModal({
title: '提示',
content: '您修改的字段将影响样品分析结果,系统将重新计算',
showCancel: false,
success: res => {
if (res.confirm) {
this.handleSave()
}
}
})
} else {
this.handleSave()
}
},
// 通过样品id查询明细
async getSampleDataById(taskDetailId) {
let fieldGroup = []
const { result, additionalProperties } = await this.$u.api.queryFieldsByTaskDetail({
taskDetailId,
isSearchSRange: '0'
})
fieldGroup = result
const conAssayTaskId = additionalProperties.conAssayTaskId
const busSubCSampleId = additionalProperties.busSubCSampleId
const detail = additionalProperties.taskDetail
//处理硫值、硫量:未保存过的数据,读取接口返回的硫值、硫量
// this.loadSValue(detail);
//按公式计算值,并检查原数据与计算后的数据是否一致
try {
calcAnalysisValue(fieldGroup)
} catch (error) {
console.log(error)
}
let valueList = []
let cupNum = 0
for (const g of fieldGroup) {
for (const f of g.fields) {
if (f.dicKey == 'bh' || f.dicKey == 'bh_up') cupNum = f.value
valueList.push({
id: f.detailId,
type: f.pOrE,
value: f.value,
name: f.name,
dataType: f.dataType
})
}
}
let params = {
busSubCSampleId,
conAssayTaskId,
// measureTime : this.curSample.measureTime,
elementParamValueList: valueList,
busAssayTaskDetailId: taskDetailId
}
if (typeof cupNum != 'undefined' && cupNum != null && cupNum != '' && cupNum != 0 && cupNum != '0') {
//提交杯号,保存到后台
params.cupNum = cupNum
}
return params
},
// 提交样品
async submitData(data) {
try {
await this.$u.api.saveDetailValue(data)
} catch (error) {
throw error
}
},
async processIds(list, interval) {
let index = 0
const intervalId = setInterval(async () => {
if (index < list.length) {
const item = list[index]
index++
const params = await this.getSampleDataById(item['id'])
await this.submitData(params)
} else {
clearInterval(intervalId) // 所有任务完成后清除定时器
uni.redirectTo({
url: '/pages/analysis/sample/sample-work-detail?currentTaskNo=' + this.currentTaskNo
})
}
}, interval)
},
async apiRequest(url) {
return request({
url: url,
method: 'GET',
custom: {
isApiEncryption: true
}
})
},
//读取字段里的API选项
async loadFieldApiData() {
const formFields = this.formFields
let changeFlag = false
for (const field of formFields) {
const dicUrl = field.dicUrl
const type = field.type
if (dicUrl && dicUrl != '') {
//读取API选项
try {
const res = await this.apiRequest(dicUrl)
const data = res
const confLabel = field.props.label
const confValue = field.props.value
const emptyItem = { name: '', displayName: '' }
emptyItem[confLabel] = ''
emptyItem[confValue] = ''
//设置valueText、displayName
for (const item of data) {
if (item[confValue] == field.value) {
changeFlag = true
field.valueText = item[confLabel]
}
}
// data.unshift(emptyItem) //添加空数据
field.options = data
} catch (e) {}
}
}
if (changeFlag) {
const formFields = this.formFields
// this.formFields = JSON.parse(JSON.stringify(formFields));
this.formFields = JSON.parse(JSON.stringify(formFields, replacer), reviver)
}
},
/*
* 选择器组件确认事件
* event 事件默认参数
* field 当前字段
* 处理逻辑:
* field.value = 选中的值
* field.valueText = 选中的文本
* todo 关联字段在动态字段的change事件处理
* */
pickerConfirm(event, field) {
const me = this
if (field.type == 'date') {
field.value = nx.$dayjs(event.value).format(field.format)
field.showPicker = false
return
}
const confLabel = field.props.label
const confValue = field.props.value
const selected = event.value[0]
const value = selected[confValue]
const displayName = selected[confLabel]
field.value = value
field.valueText = displayName
if (typeof field.change == 'function') {
field.change({ value }, selected, me)
}
field.showPicker = false
},
checkLoadSValue() {
const vKey = 'sRange'
const vF = this.getFieldByKey(vKey)
if (vF == null) return false
const v = vF.value
if (v == null || v == '') return true
try {
if (v == 0 || number(v) == 0) return true
} catch (e) {}
return false
},
//读取硫值、硫量
loadSValue(detail) {
let flag = this.checkLoadSValue()
if (!flag) return
const vKey = 'sValue'
const rKey = 'sRange'
const vF = this.getFieldByKey(vKey)
if (vF != null) {
vF.value = detail.svalue
}
const rF = this.getFieldByKey(rKey)
if (rF != null) {
rF.value = detail.srange
}
},
getFieldByKey(key) {
const group = this.fieldGroup
let field = null
for (let g of group) {
for (let f of g.fields) {
const dicKey = f.dicKey
if (dicKey && dicKey == key) {
field = f
break
}
}
}
// console.log('field', JSON.stringify(field));
return field
}
}
}
// 自定义 replacer将函数转换为字符串。json序列化和反序列化时避免函数丢失
function replacer(key, value) {
if (typeof value === 'function') {
return value.toString()
}
return value
}
// 自定义 reviver将字符串转换回函数.json序列化和反序列化时避免函数丢失
const functionKeys = ['change', 'dicFormatter']
function reviver(key, value) {
if (functionKeys.includes(key)) {
// 将字符串转换为函数
return new Function('return ' + value)()
}
return value
}
</script>
<style lang="scss" scoped>
.navbar-right {
font-size: 16px;
color: #fff;
margin-right: 20px;
}
.content-title {
width: 100%;
font-size: 20px;
font-weight: 300;
}
.content-title-name {
padding: 10px;
text-align: center;
}
.content-main-height {
height: calc(100vh - 125px);
}
.content-main-left {
height: calc(100vh - 205px);
background-color: #f6f6f6;
}
.form-item-my {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.label-my {
width: 170px; /* 标签宽度 */
padding-right: 10px;
text-align: right;
}
.label-my sub {
font-size: 0.6em; /* 调整下标字体大小 */
vertical-align: sub; /* 调整下标垂直对齐 */
}
.content-my {
flex: 1;
padding-left: 7px;
.select-my {
color: #303133;
font-size: 15px;
padding: 6px 8px;
border: 1px solid #dcdcdc;
border-radius: 5px;
}
}
.u-tab-item {
height: 80px;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
color: #444;
font-weight: 400;
line-height: 1;
border-width: 2px;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-size: 18px;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 16px;
left: 0;
top: 20px;
}
.content-main-left-operation {
height: 80px;
padding-top: 15px;
}
.content-main-right {
height: calc(100vh - 205px);
}
.content-main-right-operation {
height: 80px;
padding-top: 15px;
}
.auncel-container {
display: flex;
justify-content: center;
align-items: center;
}
.auncel {
width: 400px;
height: 400px;
background-image: url(/static/images/auncel.png);
background-repeat: no-repeat;
background-size: 100%;
}
.auncel-title {
width: 100%;
height: 210px;
}
.auncel-weight {
padding: 20px;
}
.weight {
width: 100%;
min-width: 200px;
height: 100px;
padding: 0 15px;
display: flex;
flex-direction: row;
//background-color: #2c405a;
}
.weight-data {
flex-grow: 1;
height: 100%;
color: #4cd964;
text-align: right;
line-height: 100px;
letter-spacing: 2px;
font-size: 75px;
font-family: zzjc-lcd;
}
.weight-data-yellow {
flex-grow: 1;
height: 100%;
color: #ffff00;
text-align: right;
line-height: 100px;
letter-spacing: 2px;
font-size: 75px;
font-family: zzjc-lcd;
}
.weight-data-warning {
flex-grow: 1;
height: 100%;
color: #ff3333;
text-align: right;
line-height: 100px;
font-size: 75px;
font-family: zzjc-lcd;
}
.weight-unit {
color: #ffffff;
font-size: 65px;
line-height: 100px;
padding-left: 10px;
}
</style>

View File

@@ -0,0 +1,379 @@
<template>
<view>
<navbar-back :autoBack="false" title="样品分析" @leftClick="customBack"></navbar-back>
<u-row class="content-title" gutter="16">
<u-col span="4">
<view class="content-title-name">
<text>任务列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
<u-col span="8">
<view class="content-title-name">
<text>样品列表</text>
</view>
<u-gap height="5" bg-color="#0055A2"></u-gap>
</u-col>
</u-row>
<u-row class="content-main-height" gutter="16" align="top">
<u-col span="4">
<scroll-view
scroll-y
scroll-with-animation
class="content-main-height content-main-left"
:scroll-top="scrollTop"
>
<view
v-for="(task, index) in taskList"
:key="index"
class="u-tab-item"
:class="[current === index ? 'u-tab-item-active' : '']"
@tap.stop="swichTask(index)"
>
<u-row style="width: 100%">
<u-col span="2" style="text-align: center">
<u-icon :color="taskStyle(task)" name="tags-fill" size="34"></u-icon>
</u-col>
<u-col span="10">
<view class="fs18">{{ task.taskNo }}</view>
<view style="margin-top: 10px">{{ task.taskName }}</view>
<view class="x-f" style="margin-top: 10px">
<u-icon color="" name="clock"></u-icon>
<text style="margin-left: 5px">{{ task.taskOperTime }}</text>
</view>
</u-col>
</u-row>
</view>
</scroll-view>
</u-col>
<u-col span="8">
<view class="content-main-height">
<scroll-view scroll-y scroll-with-animation class="content-main-right">
<block v-for="(sample, index) in sampleList" :key="index">
<view v-if="currentTask.reviewCount === sample.reviewCount" style="padding: 5px; font-size: 16px">
<u-row>
<u-col span="3" style="text-align: center">
<u-row>
<u-col span="6" style="text-align: center">
<u-checkbox
v-model="sample.checked"
v-if="
sample.sampleProcessNo === currentNode &&
sample.rollbackStatus !== 'running' &&
sample.rollbackStatus !== 'finished'
"
@change="() => selectSample(sample)"
></u-checkbox>
</u-col>
<u-col span="6" style="text-align: center">
<view
><text>【{{ sample.sort }}】</text></view
>
</u-col>
</u-row>
</u-col>
<u-col span="9">
<view class="sample_desc">
<view>
<view
><text style="padding-left: 10px">{{ sample.sampleCode }}</text></view
>
<view>
<text style="padding-left: 10px">
{{ getDataSourceTypeShow(sample.dataSourceType) }}{{ sample.sampleName }}
</text>
</view>
</view>
<view class="sample_desc_warn" v-if="sample.sampleProcessNo !== currentNode">
当前节点:{{ getProcessNameShow(sample.sampleProcessNo) }}
</view>
<view class="sample_desc_warn" v-if="sample.rollbackStatus === 'revoke'"> 样品退回被驳回 </view>
<view class="sample_desc_warn" v-if="sample.rollbackStatus === 'running'"> 样品退回审批中 </view>
<view class="sample_desc_warn" v-if="sample.rollbackStatus === 'finished'">
样品已退回,请联系管理员处理
</view>
</view>
</u-col>
</u-row>
<u-line style="padding: 5px" color="#bbb" />
</view>
</block>
</scroll-view>
<view class="content-main-right-operation">
<u-row>
<u-col span="3.5"></u-col>
<u-col span="4">
<u-button class="btn-operation" type="warning" @click="showRollbackModal">申请退回样品</u-button>
</u-col>
<u-col span="4">
<u-button class="btn-operation" :disabled="taskList.length === 0" type="success" @click="startWork">
开始分析
</u-button>
</u-col>
</u-row>
</view>
</view>
</u-col>
</u-row>
<!-- 退回样品弹窗 -->
<up-modal
:show="showRollbackModalFlag"
showCancelButton
@confirm="applyRollbackSample"
@cancel="showRollbackModalFlag = false"
title="退回说明"
width="500px"
>
<u--textarea v-model="rollbackContent" placeholder="请输入退回原因或说明"></u--textarea>
</up-modal>
</view>
</template>
<script setup>
import { ref, computed, onMounted } from 'vue'
import { onLoad, onBackPress } from '@dcloudio/uni-app'
import nx from '@/nx'
import { useScreenOrientation } from '@/nx/hooks/useScreenOrientation'
// 响应式数据
const currentNode = ref('F31')
const dicSampleProcessCodeList = ref([])
const showRollbackModalFlag = ref(false)
const rollbackContent = ref('')
const scrollTop = ref(0)
const current = ref(0)
const currentTask = ref({})
const currentTaskNo = ref('')
const currentTaskType = ref('')
const taskList = ref([])
const sampleList = ref([])
// 计算属性
const userInfo = computed(() => nx.$store('user').userInfo)
// 方法
const customBack = () => {
uni.reLaunch({ url: '/pages/analysis/index/index' })
}
const selectSample = sample => {
sample.checked = !sample.checked
}
const taskStyle = task => {
if ((task.weightTaskStatus === 0 || task.weightTaskStatus === 1) && task.reviewCount > 0) return 'red'
if (task.weightTaskStatus === 2 && task.reviewCount > 0) return 'green'
return ''
}
const showRollbackModal = () => {
const checkedSampleList = sampleList.value.filter(item => item.checked)
if (checkedSampleList.length === 0) {
uni.showToast({ title: '请选择要退回的样品!', icon: 'none' })
return
}
showRollbackModalFlag.value = true
}
const applyRollbackSample = () => {
const checkedSampleList = sampleList.value.filter(item => item.checked)
if (!rollbackContent.value.trim()) {
uni.showToast({ title: '请输入退回说明!', icon: 'none' })
return
}
showRollbackModalFlag.value = false
uni.showModal({
title: '提示',
content: '发起申请,退回已勾选的样品,是否继续?',
cancelColor: '#0055A2',
confirmColor: '#0055A2',
success: res => {
if (res.cancel) return
const detailIdList = checkedSampleList.map(item => item.id)
const data = {
remark: rollbackContent.value,
taskId: currentTask.value.id,
detailIds: detailIdList.join(',')
}
uni.showLoading({ title: '正在发起申请...' })
nx.$api.assayTask
.createRollbackApply(data)
.then(() => {
getAssayTaskDetail(currentTaskNo.value)
})
.catch(console.error)
.finally(() => {
uni.hideLoading()
})
}
})
}
const checkWork = () => {
let checkedSampleList = sampleList.value.filter(
item => item.rollbackStatus === 'running' || item.rollbackStatus === 'finished'
)
if (checkedSampleList.length > 0) {
uni.showToast({ title: '存在未处理的退回申请,请处理后再分析!', icon: 'none' })
return false
}
checkedSampleList = sampleList.value.filter(item => item.sampleProcessNo !== currentNode.value)
if (checkedSampleList.length > 0) {
uni.showToast({ title: '部分样品状态异常,请联系管理员处理!', icon: 'none', duration: 2300 })
return false
}
return true
}
const startWork = () => {
if (!checkWork()) return
uni.navigateTo({
url: `/pages/analysis/sample/sample-work-detail?currentTaskNo=${currentTaskNo.value}`
})
}
const swichTask = async index => {
if (index === current.value) return
current.value = index
rollbackContent.value = ''
const task = taskList.value[index]
currentTask.value = task
currentTaskNo.value = task.taskNo
currentTaskType.value = task.taskType
getAssayTaskDetail(task.taskNo)
}
const getAssayTask = () => {
rollbackContent.value = ''
const param = {
finishStatus: 'waiting',
assayOper: userInfo.value.nickname
}
nx.$api.auncel.getAssayTaskList(param).then(res => {
if (res) {
taskList.value = res
if (taskList.value.length > 0) {
const first = taskList.value[0]
currentTask.value = first
currentTaskNo.value = first.taskNo
currentTaskType.value = first.taskType
getAssayTaskDetail(first.taskNo)
}
}
})
}
const getAssayTaskDetail = taskNo => {
sampleList.value = []
nx.$api.assayTask.getAssayTaskDetailListByTaskNo({ taskNo }).then(res => {
const list = res.result || []
list.forEach(item => (item.checked = false))
sampleList.value = list
})
}
const getDicSampleProcessCodeList = () => {
nx.$api.assayTask.queryQmsDicSampleProcessCodeList().then(res => {
dicSampleProcessCodeList.value = res.records || []
})
}
const getProcessNameShow = val => {
const item = dicSampleProcessCodeList.value.find(i => i.processCode === val)
return item ? item.processName : val
}
const getDataSourceTypeShow = val => {
if (val === 2) return '【筛上】'
if (val === 3) return '【筛下】'
return ''
}
// 生命周期
onLoad(() => {
const { lockOrientation } = useScreenOrientation()
lockOrientation('landscape')
getDicSampleProcessCodeList()
getAssayTask()
})
onBackPress(() => {
customBack()
return true
})
</script>
<style lang="scss" scoped>
/* 样式保持不变 */
.content-title {
height: 50px;
width: 100%;
font-size: 20px;
font-weight: 300;
}
.content-title-name {
padding: 10px;
text-align: center;
}
.content-main-height {
height: calc(100vh - 125px);
}
.content-main-left {
background-color: #f6f6f6;
}
.u-tab-item {
padding: 5px;
height: 100px;
background: #f6f6f6;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #444;
line-height: 1;
border-width: 2px;
border-bottom: dotted;
}
.u-tab-item-active {
position: relative;
color: #0055a2;
font-weight: 600;
background: #fff;
}
.u-tab-item-active::before {
content: '';
position: absolute;
height: 16px;
left: 0;
top: 20px;
}
.content-main-right {
height: calc(100vh - 205px);
}
.content-main-right-operation {
height: 80px;
padding-top: 15px;
padding-right: 15px;
}
.btn-operation {
height: 50px;
font-size: 18px;
width: 95%;
}
.sample_desc {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
}
.sample_desc_warn {
color: red;
padding-right: 10px;
}
</style>