feat:样品标签打印
This commit is contained in:
2
App.vue
2
App.vue
@@ -4,7 +4,7 @@ import { onLaunch, onShow, onError } from '@dcloudio/uni-app'
|
|||||||
import { NxInit } from './nx'
|
import { NxInit } from './nx'
|
||||||
import $store from '@/nx/store'
|
import $store from '@/nx/store'
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
import * as urovo from '@/uni_modules/zzjc-urovo'
|
import * as urovo from './uni_modules/zzjc-urovo'
|
||||||
// #endif
|
// #endif
|
||||||
onLaunch(async () => {
|
onLaunch(async () => {
|
||||||
// 加载nx底层依赖
|
// 加载nx底层依赖
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// 在此不用配置接口前缀
|
// 在此不用配置接口前缀
|
||||||
const isDev = process.env.NODE_ENV === 'development'
|
const isDev = process.env.NODE_ENV === 'development'
|
||||||
const BaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.26.116:888/admin-api'
|
// const BaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.26.116:888/admin-api'
|
||||||
// const BaseUrl = isDev ? 'http://192.168.26.163:48080/admin-api' : 'http://192.168.26.116:888/admin-api'
|
const BaseUrl = isDev ? 'http://192.168.26.163:48080/admin-api' : 'http://192.168.26.116:888/admin-api'
|
||||||
//
|
//
|
||||||
// const BaseUrl = isDev ? 'http://localhost:9999' : ''
|
// const BaseUrl = isDev ? 'http://localhost:9999' : ''
|
||||||
const upgradeBaseUrl = 'http://192.168.26.116:888'
|
const upgradeBaseUrl = 'http://192.168.26.116:888'
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import request from '@/nx/request'
|
|
||||||
const taskPrefix = '/qms/bus/qmsBusAssayTask'
|
|
||||||
|
|
||||||
export const getConAssayTaskWithReportTemplateContent = id => {
|
|
||||||
return request({
|
|
||||||
url: '/qms/config/assay-task/getConTaskWithReportTemplateDataContent',
|
|
||||||
method: 'get',
|
|
||||||
params: {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
export const queryTaskDetailListByAssayTaskId = params => {
|
|
||||||
return request({
|
|
||||||
url: taskPrefix + '/getAssayTaskDataWithDetailData',
|
|
||||||
method: 'get',
|
|
||||||
params: params
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
getConAssayTaskWithReportTemplateContent,
|
|
||||||
queryTaskDetailListByAssayTaskId
|
|
||||||
}
|
|
||||||
23
nx/api/report.js
Normal file
23
nx/api/report.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import request from '@/nx/request'
|
||||||
|
|
||||||
|
export const getBusinessSubSample = id => {
|
||||||
|
return request({
|
||||||
|
url: '/qms/business-sub-sample/get',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export const getConfigReportTemplateByKey = params => {
|
||||||
|
return request({
|
||||||
|
url: '/qms/config-report-template/getByKey',
|
||||||
|
method: 'GET',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getBusinessSubSample,
|
||||||
|
getConfigReportTemplateByKey
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@ export default {
|
|||||||
// 按样品添加内部调拨数据
|
// 按样品添加内部调拨数据
|
||||||
addDispatchSample: data =>
|
addDispatchSample: data =>
|
||||||
request({
|
request({
|
||||||
url: '/qms/business-sample-dispatch/addBySampleCode',
|
url: '/qms/business-sample-dispatch/addBySampleReturnCode',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getConAssayTaskWithReportTemplateContent, queryTaskDetailListByAssayTaskId } from '@/nx/api/auncel'
|
import { getConfigReportTemplateByKey, getBusinessSubSample } from '@/nx/api/report'
|
||||||
export default {
|
export default {
|
||||||
//打印机Map对象
|
//打印机Map对象
|
||||||
printMap: new Map(),
|
printMap: new Map(),
|
||||||
@@ -178,36 +178,33 @@ export default {
|
|||||||
//不存在则打开
|
//不存在则打开
|
||||||
this.open(printServerIp)
|
this.open(printServerIp)
|
||||||
}
|
}
|
||||||
if (printer.socketTask) {
|
if (printer?.socketTask) {
|
||||||
printer.socketTask.send({
|
printer.socketTask.send({
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//获取打印模板并执行打印
|
//获取打印模板并执行打印
|
||||||
getPrintTemplateAndPrint(currentTask) {
|
getPrintTemplateAndPrint(businessSubId) {
|
||||||
const id = currentTask.taskTypeId
|
getBusinessSubSample(businessSubId)
|
||||||
getConAssayTaskWithReportTemplateContent(id)
|
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.print(currentTask, res)
|
this.print(res)
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//调用send方法执行打印
|
//调用send方法执行打印
|
||||||
print(currentTask, conAssayTask) {
|
print(businessSubData) {
|
||||||
|
const { printTemplate } = businessSubData
|
||||||
const me = this
|
const me = this
|
||||||
let id = currentTask.id
|
me.getReportData(printTemplate, function (res) {
|
||||||
const reportTemplate = conAssayTask.reportTemplateDataContent
|
|
||||||
me.getReportData(id, function (res) {
|
|
||||||
const data = res.data || []
|
|
||||||
const reportData = {
|
const reportData = {
|
||||||
data: data
|
data: [businessSubData]
|
||||||
}
|
}
|
||||||
let printData = {
|
let printData = {
|
||||||
type: 'print',
|
type: 'preview',
|
||||||
reportTemplate: reportTemplate,
|
reportTemplate: res.content,
|
||||||
reportData: JSON.stringify(reportData)
|
reportData: JSON.stringify(reportData)
|
||||||
}
|
}
|
||||||
//连接打印服务
|
//连接打印服务
|
||||||
@@ -220,12 +217,11 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
//获取打印模板
|
//获取打印模板
|
||||||
getReportData(id, onComplete) {
|
getReportData(templateKey, onComplete) {
|
||||||
const param = {
|
const param = {
|
||||||
taskId: id,
|
key: templateKey
|
||||||
hideResultFlag: 'true'
|
|
||||||
}
|
}
|
||||||
queryTaskDetailListByAssayTaskId(param).then(res => {
|
getConfigReportTemplateByKey(param).then(res => {
|
||||||
onComplete(res)
|
onComplete(res)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -204,7 +204,8 @@ http.interceptors.response.use(
|
|||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: msg || response.config.custom.errorMsg,
|
title: msg || response.config.custom.errorMsg,
|
||||||
icon: 'none'
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
})
|
})
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
userStore.logout(true)
|
userStore.logout(true)
|
||||||
|
|||||||
14
pages.json
14
pages.json
@@ -160,13 +160,6 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/analysis/sample/sample-receive",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "样品分析-收样",
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/analysis/sample/sample-work-list",
|
"path": "pages/analysis/sample/sample-work-list",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -196,13 +189,6 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "pages/analysis/sample/sample-report",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "数据上报",
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "pages/analysis/sample/sample-report-search",
|
"path": "pages/analysis/sample/sample-report-search",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ function printTask() {
|
|||||||
confirmColor: '#0055A2',
|
confirmColor: '#0055A2',
|
||||||
success: res => {
|
success: res => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
nx.$print.getPrintTemplateAndPrint(currentTask.value)
|
// nx.$print.getPrintTemplateAndPrint(currentTask.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,274 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<navbar-back :autoBack="false" title="样品分析-收样" @leftClick="customBack"></navbar-back>
|
|
||||||
|
|
||||||
<u-row gutter="16">
|
|
||||||
<u-col span="4">
|
|
||||||
<view class="content-title-name">
|
|
||||||
<text>任务列表</text>
|
|
||||||
<up-badge v-if="taskList.length > 0" class="ml5" :value="taskList.length" type="warning"></up-badge>
|
|
||||||
</view>
|
|
||||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
|
||||||
<scroll-view
|
|
||||||
style="height: 75vh"
|
|
||||||
scroll-y
|
|
||||||
scroll-with-animation
|
|
||||||
class="content-main-left"
|
|
||||||
:scroll-top="scrollTop"
|
|
||||||
>
|
|
||||||
<TaskItem
|
|
||||||
v-for="(task, index) in taskList"
|
|
||||||
:key="index"
|
|
||||||
:task="task"
|
|
||||||
:seq="index + 1"
|
|
||||||
:active="current === index"
|
|
||||||
@click="switchTask(index)"
|
|
||||||
/>
|
|
||||||
</scroll-view>
|
|
||||||
</u-col>
|
|
||||||
<u-col span="8">
|
|
||||||
<view class="content-title-name">
|
|
||||||
<text>样品列表</text>
|
|
||||||
</view>
|
|
||||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
|
||||||
<view>
|
|
||||||
<scroll-view scroll-y scroll-with-animation style="height: calc(75vh - 60px)">
|
|
||||||
<block v-for="(sample, index) in sampleList" :key="index">
|
|
||||||
<view sclass="p5 fs16">
|
|
||||||
<u-row>
|
|
||||||
<u-col span="3" class="text-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 class="pl10">{{ sample.sampleCode }}</text></view
|
|
||||||
>
|
|
||||||
<view>
|
|
||||||
<text class="pl10">
|
|
||||||
{{ 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 class="p5" 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'
|
|
||||||
import TaskItem from './components/task-item.vue'
|
|
||||||
import { getDataSourceTypeShow } from '../common'
|
|
||||||
|
|
||||||
// 响应式数据
|
|
||||||
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 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.assayTask
|
|
||||||
.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
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生命周期
|
|
||||||
onLoad(() => {
|
|
||||||
getDicSampleProcessCodeList()
|
|
||||||
// getAssayTask()
|
|
||||||
})
|
|
||||||
|
|
||||||
onBackPress(() => {
|
|
||||||
customBack()
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.content-title-name {
|
|
||||||
height: 50px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 300;
|
|
||||||
padding: 10px;
|
|
||||||
text-align: center;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-main-left {
|
|
||||||
background-color: #f6f6f6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-main-right-operation {
|
|
||||||
height: 50px;
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-operation {
|
|
||||||
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>
|
|
||||||
@@ -1,337 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<navbar-back :autoBack="false" title="数据上报" @leftClick="customBack"></navbar-back>
|
|
||||||
<u-row gutter="16">
|
|
||||||
<u-col span="4">
|
|
||||||
<view class="content-title-name">
|
|
||||||
<text>任务列表</text>
|
|
||||||
<up-badge v-if="taskList.length > 0" class="ml5" :value="taskList.length" type="warning"></up-badge>
|
|
||||||
</view>
|
|
||||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
|
||||||
<scroll-view
|
|
||||||
style="height: 75vh"
|
|
||||||
scroll-y
|
|
||||||
scroll-with-animation
|
|
||||||
class="content-main-left"
|
|
||||||
:scroll-top="scrollTop"
|
|
||||||
>
|
|
||||||
<TaskItem
|
|
||||||
v-for="(task, index) in taskList"
|
|
||||||
:key="index"
|
|
||||||
:task="task"
|
|
||||||
:seq="index + 1"
|
|
||||||
:active="current === index"
|
|
||||||
@click="switchTask(index)"
|
|
||||||
/>
|
|
||||||
</scroll-view>
|
|
||||||
</u-col>
|
|
||||||
<u-col span="8">
|
|
||||||
<view class="content-title-name">
|
|
||||||
<text>样品列表</text>
|
|
||||||
</view>
|
|
||||||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
|
||||||
<view>
|
|
||||||
<scroll-view scroll-y scroll-with-animation style="height: calc(75vh - 60px)">
|
|
||||||
<block v-for="(sample, index) in sampleList" :key="index">
|
|
||||||
<view class="p5 fs16">
|
|
||||||
<u-row
|
|
||||||
@click="showSampleDetail(sample.id, index)"
|
|
||||||
:class="selectedIndex === index ? 'selected_Sample' : ''"
|
|
||||||
>
|
|
||||||
<u-col span="2" class="text-center" :style="sampleStyle(sample)">
|
|
||||||
<view>
|
|
||||||
<text>【{{ sample.sort }}】</text>
|
|
||||||
</view>
|
|
||||||
</u-col>
|
|
||||||
<u-col span="5">
|
|
||||||
<view>
|
|
||||||
<text class="pl10">{{ sample.sampleCode }}</text>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<text class="pl10"
|
|
||||||
>{{ 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 class="p5" color="#bbb" />
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
</scroll-view>
|
|
||||||
<view class="content-main-right-operation">
|
|
||||||
<u-row :gutter="16">
|
|
||||||
<u-col span="4">
|
|
||||||
<u-button class="btn-operation" type="primary" @click="previewPDF" v-if="currentTaskId">
|
|
||||||
任务单预览
|
|
||||||
</u-button>
|
|
||||||
</u-col>
|
|
||||||
<u-col span="4">
|
|
||||||
<u-button
|
|
||||||
class="btn-operation"
|
|
||||||
v-if="currentTaskId"
|
|
||||||
type="warning"
|
|
||||||
:disabled="taskReviewDisabled"
|
|
||||||
@click="taskReview"
|
|
||||||
>
|
|
||||||
撤回任务单
|
|
||||||
</u-button>
|
|
||||||
</u-col>
|
|
||||||
<u-col span="4">
|
|
||||||
<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"
|
|
||||||
v-model: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 TaskItem from './components/task-item.vue'
|
|
||||||
import { getDataSourceTypeShow } from '../common'
|
|
||||||
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 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 switchTask = 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.assayTask
|
|
||||||
.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 printTask = () => {
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '数据上报成功!是否打印“原始记录单”?',
|
|
||||||
cancelColor: '#0055A2',
|
|
||||||
confirmColor: '#0055A2',
|
|
||||||
success: res => {
|
|
||||||
if (res.confirm) {
|
|
||||||
nx.$print.getPrintTemplateAndPrint(currentTask.value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生命周期
|
|
||||||
onMounted(() => {
|
|
||||||
getDicSampleProcessCodeList()
|
|
||||||
getAssayTask()
|
|
||||||
})
|
|
||||||
|
|
||||||
onBackPress(() => {
|
|
||||||
customBack()
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.content-title-name {
|
|
||||||
height: 50px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 300;
|
|
||||||
padding: 10px;
|
|
||||||
text-align: center;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-main-left {
|
|
||||||
background-color: #f6f6f6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content-main-right-operation {
|
|
||||||
height: 50px;
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-operation {
|
|
||||||
font-size: 18px;
|
|
||||||
width: 95%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.selected_Sample {
|
|
||||||
background-color: #d7e9fa;
|
|
||||||
}
|
|
||||||
.sample_desc_warn {
|
|
||||||
color: red;
|
|
||||||
padding-right: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -37,19 +37,19 @@
|
|||||||
<scroll-view style="height: 43vh" scroll-y scroll-with-animation>
|
<scroll-view style="height: 43vh" scroll-y scroll-with-animation>
|
||||||
<uni-card v-for="item in sampleList">
|
<uni-card v-for="item in sampleList">
|
||||||
<view
|
<view
|
||||||
>样品名称:<text>{{ item.sampleName }}</text></view
|
>样品名称:<text class="black">{{ item.sampleName }}</text></view
|
||||||
>
|
>
|
||||||
<view class="mt4"
|
<view class="mt4"
|
||||||
>归库编码:<text>{{ item.sampleReturnCode }}</text></view
|
>归库编码:<text class="black">{{ item.sampleReturnCode }}</text></view
|
||||||
>
|
>
|
||||||
<view class="mt4"
|
<view class="mt4"
|
||||||
>归库时间:<text>{{ nx.$dayjs(item.returnTime).format('YYYY-MM-DD HH:mm:ss') }}</text></view
|
>归库时间:<text class="black">{{ nx.$dayjs(item.returnTime).format('YYYY-MM-DD HH:mm:ss') }}</text></view
|
||||||
>
|
>
|
||||||
<view class="mt4"
|
<view class="mt4"
|
||||||
>样品库名称:<text>{{ item.warehouseName }}</text></view
|
>样品库名称:<text class="black">{{ item.warehouseName }}</text></view
|
||||||
>
|
>
|
||||||
<view class="mt4"
|
<view class="mt4"
|
||||||
>(原)库位码:<text>{{ item.warehouseLocationCode }}</text></view
|
>(原)库位码:<text class="black">{{ item.warehouseLocationCode }}</text></view
|
||||||
>
|
>
|
||||||
</uni-card>
|
</uni-card>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
@@ -120,6 +120,7 @@ async function handleSubmit() {
|
|||||||
if (changeType.value === 'sample') {
|
if (changeType.value === 'sample') {
|
||||||
params.sampleReturnCode = changeCode.value
|
params.sampleReturnCode = changeCode.value
|
||||||
} else {
|
} else {
|
||||||
|
if (changeCode.value === targetLocation.value) return uni.showToast({ title: '库位码相同', icon: 'none' })
|
||||||
params.warehouseLocationCode = changeCode.value
|
params.warehouseLocationCode = changeCode.value
|
||||||
}
|
}
|
||||||
btnLoading.value = true
|
btnLoading.value = true
|
||||||
|
|||||||
@@ -76,26 +76,26 @@ const userInfo = computed(() => nx.$store('user').userInfo)
|
|||||||
const goTo = url => {
|
const goTo = url => {
|
||||||
nx.$router.go(url)
|
nx.$router.go(url)
|
||||||
}
|
}
|
||||||
// onShow(() => {
|
onShow(() => {
|
||||||
// //连接打印服务
|
//连接打印服务
|
||||||
// let printList = uni.getStorageSync('KEY_PRINT_LIST')
|
let printList = uni.getStorageSync('KEY_PRINT_LIST')
|
||||||
// if (printList && printList.length > 0) {
|
if (printList && printList.length > 0) {
|
||||||
// for (let print of printList) {
|
for (let print of printList) {
|
||||||
// nx.$print.open(print.printIp, print.printPort)
|
nx.$print.open(print.printIp, print.printPort)
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// uni.showModal({
|
uni.showModal({
|
||||||
// title: '提示',
|
title: '提示',
|
||||||
// showCancel: false,
|
showCancel: false,
|
||||||
// content: '打印服务未配置,请在系统设置中配置打印服务',
|
content: '打印服务未配置,请在系统设置中配置打印服务',
|
||||||
// success: function (res) {
|
success: function (res) {
|
||||||
// uni.navigateTo({
|
uni.navigateTo({
|
||||||
// url: '/pages/setting/print'
|
url: '/pages/setting/print'
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// 生命周期
|
// 生命周期
|
||||||
onMounted(() => {})
|
onMounted(() => {})
|
||||||
// 动态设置 grid 列数
|
// 动态设置 grid 列数
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
prefixIcon="scan"
|
prefixIcon="scan"
|
||||||
fontSize="16"
|
fontSize="16"
|
||||||
prefixIconStyle="font-size: 30px;"
|
prefixIconStyle="font-size: 30px;"
|
||||||
|
@confirm="handleReturnToStock"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<view class="fs18 font-bold" style="color: red" v-if="successCount > 0">{{ successCount }}</view>
|
<view class="fs18 font-bold" style="color: red" v-if="successCount > 0">{{ successCount }}</view>
|
||||||
@@ -83,13 +84,14 @@ function handleReturnToStock() {
|
|||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
successCount.value++
|
successCount.value++
|
||||||
if (res.isPrint) {
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: `归库成功,归库码为【${res.code}】`,
|
title: `归库成功`,
|
||||||
duration: 3000,
|
duration: 3000,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
if (res.isPrint == 1) {
|
||||||
// 执行打印
|
// 执行打印
|
||||||
|
nx.$print.print(res)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
prefixIcon="scan"
|
prefixIcon="scan"
|
||||||
fontSize="16"
|
fontSize="16"
|
||||||
prefixIconStyle="font-size: 30px;"
|
prefixIconStyle="font-size: 30px;"
|
||||||
|
@confirm="debouncedHandleScan(sampleCode)"
|
||||||
>
|
>
|
||||||
</up-input>
|
</up-input>
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
import { computed, ref, toRefs, watch, onMounted } from 'vue'
|
import { computed, ref, toRefs, watch, onMounted } from 'vue'
|
||||||
import nx from '@/nx'
|
import nx from '@/nx'
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||||
|
import { debounce } from 'lodash'
|
||||||
|
|
||||||
const btnLoading = ref(false)
|
const btnLoading = ref(false)
|
||||||
let sampleCode = ref('')
|
let sampleCode = ref('')
|
||||||
@@ -103,22 +104,28 @@ async function handleSubmit() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
btnLoading.value = true
|
btnLoading.value = true
|
||||||
const receiver = range.value.find(item => item.value === receiverId.value)?.nickname
|
const receiver = range.value.find(item => item.value === receiverId.value)?.text
|
||||||
await nx.$api.sampleWarehouse
|
await nx.$api.sampleWarehouse
|
||||||
.execSampleDispatch({
|
.execSampleDispatch({
|
||||||
id: dispatchTempId.value,
|
id: dispatchTempId.value,
|
||||||
applyUserId: receiverId.value,
|
applyUserId: receiverId.value,
|
||||||
applyUser: receiver
|
applyUser: receiver,
|
||||||
|
warehouseUser: userInfo.value.nickname,
|
||||||
|
warehouseUserId: userInfo.value.id
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
btnLoading.value = false
|
btnLoading.value = false
|
||||||
})
|
})
|
||||||
|
handleReset()
|
||||||
|
setTimeout(() => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '调拨成功',
|
title: '调拨成功',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
|
}, 200)
|
||||||
}
|
}
|
||||||
function handleReset() {
|
function handleReset() {
|
||||||
|
receiverId.value = ''
|
||||||
sampleCode.value = ''
|
sampleCode.value = ''
|
||||||
sampleList.value = []
|
sampleList.value = []
|
||||||
createDispatchTempData()
|
createDispatchTempData()
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
</uni-section>
|
</uni-section>
|
||||||
<up-button
|
<up-button
|
||||||
v-if="sampleData.id"
|
v-if="sampleData.id"
|
||||||
|
:disabled="sampleData.returnStatus !== 'completed'"
|
||||||
type="primary"
|
type="primary"
|
||||||
style="width: 90%"
|
style="width: 90%"
|
||||||
text="打印归库标签"
|
text="打印归库标签"
|
||||||
@@ -109,7 +110,9 @@ async function getSampleDetail() {
|
|||||||
sampleData.value = list[0]
|
sampleData.value = list[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function handlePrint() {}
|
function handlePrint() {
|
||||||
|
nx.$print.print(sampleData.value)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ async function handleSubmit() {
|
|||||||
if (takeOffType.value === 'warehouseLocation') {
|
if (takeOffType.value === 'warehouseLocation') {
|
||||||
params.locationCode = targetCode.value
|
params.locationCode = targetCode.value
|
||||||
} else {
|
} else {
|
||||||
params.sampleReturnCodes = sampleList.value.map(item => item.sampleReturnCode)
|
params.sampleReturnCodes = sampleList.value.map(item => item.sampleReturnCode).join(',')
|
||||||
}
|
}
|
||||||
btnLoading.value = true
|
btnLoading.value = true
|
||||||
await nx.$api.sampleWarehouse.execTakeOff(params).finally(() => {
|
await nx.$api.sampleWarehouse.execTakeOff(params).finally(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user