From d3f6ad4bf63427d359de1975d0f147c6c69a977f Mon Sep 17 00:00:00 2001 From: houjunxiang Date: Fri, 14 Nov 2025 17:46:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/sample/auncel-select-popup.vue | 26 +- nx/helper/calcAnalysisValue.js | 20 +- nx/request/index.js | 9 +- package-lock.json | 247 ++++++++++++++++++- package.json | 5 +- pages/analysis/sample/pdf-preview.vue | 77 +++++- pages/analysis/sample/sample-work-detail.vue | 159 ++++-------- pages/analysis/sample/sample-work-list.vue | 5 +- 8 files changed, 412 insertions(+), 136 deletions(-) diff --git a/components/sample/auncel-select-popup.vue b/components/sample/auncel-select-popup.vue index 5733e4d..b8e86ed 100644 --- a/components/sample/auncel-select-popup.vue +++ b/components/sample/auncel-select-popup.vue @@ -3,7 +3,7 @@ 天平选择 - + @@ -18,6 +18,7 @@ {{ auncel.weightUnit }} + 天平断开 @@ -164,7 +165,7 @@ const handleDeviceStatus = res => { if (item.id === res.deviceId) { item.isConnected = res.connected if (res.connected == 0) { - item.weightData = '天平断开' + item.weightData = '' item.weightUnit = '' item.weightStable = 0 } @@ -199,7 +200,7 @@ onUnmounted(() => { }) function getWeightText(auncel) { if (auncel.isConnected !== 1) { - return '天平断开' + return '' } return auncel.weightData || '' } @@ -227,8 +228,9 @@ function getWeightStyle(auncel) { + diff --git a/pages/analysis/sample/sample-work-detail.vue b/pages/analysis/sample/sample-work-detail.vue index 441970f..1dc5ed4 100644 --- a/pages/analysis/sample/sample-work-detail.vue +++ b/pages/analysis/sample/sample-work-detail.vue @@ -64,7 +64,7 @@ - 提交任务单 + 数据上报 @@ -248,6 +248,7 @@ const { proxy } = getCurrentInstance() // 响应式数据定义 const taskId = ref('') +const configReportTemplateKey = ref('') const elId = nx.$helper.uuid() const scrollTop = ref(0) //tab标题的滚动条位置 const menuHeight = ref(0) // 左边菜单的高度 @@ -270,7 +271,6 @@ const currentAuncel = ref({ }) let selectedField = ref({}) const groupFieldIndex = ref('') //分组的索引 -const curSample = ref({}) const curParameterTitle = ref('选择字段分类') const curParameterKey = ref('all') const conAssayTaskId = ref('') @@ -546,36 +546,6 @@ const fitUpValues = () => { return val } -const clearFieldVal = () => { - uni.showModal({ - title: '提示', - content: '清空当前字段的值,是否继续?', - cancelColor: '#0055A2', - confirmColor: '#0055A2', - success: res => { - if (res.cancel) { - return - } - selectedField.value.value = '' - //重新计算 - calcAnalysisValue(fieldGroup.value) - } - }) -} - -//自动填写筛上杯号 -const autoFillBhUp = val => { - const bh = Number(val) + 1 - for (const g of fieldGroup.value) { - for (const f of g.fields) { - if (f.dicKey && f.dicKey === 'bh_up') { - f.value = bh + '' - return - } - } - } -} - const checkBh = () => { //检查杯号 let hasHb = true @@ -625,36 +595,7 @@ const saveAuncelData = () => { } //获取当前重量 let weight = currentAuncel.value.weightData - selectedField.value.value = weight - const curFieldDicKey = selectedField.dicKey - let upDownFlag = '' - if (curFieldDicKey && curFieldDicKey !== '' && curFieldDicKey.indexOf('_') > 0) { - upDownFlag = curFieldDicKey.substring(curFieldDicKey.lastIndexOf('_') + 1) - } - - //这里不修改weightDataIsToZero,在切换样品是修改 - // weightDataIsToZero.value = false; - - //保存天平编号、天平名称、称重时间。支持筛上、筛下 - if (curFieldDicKey && curFieldDicKey.indexOf('sampleWeight') >= 0) { - let auncelNoFieldKey = 'auncelNo' - let measureTimeFieldKey = 'measureTime' - if (upDownFlag && upDownFlag !== '') { - auncelNoFieldKey += '_' + upDownFlag - measureTimeFieldKey += '_' + upDownFlag - } - const auncelNoField = getFieldByKey(auncelNoFieldKey) - if (auncelNoField !== null) { - auncelNoField.value = currentAuncel.value.code - } - const measureTimeField = getFieldByKey(measureTimeFieldKey) - if (measureTimeField !== null) { - measureTimeField.value = nx.$dayjs().format('YYYY-MM-DD HH:mm:ss') - } - } - //指派单明细上的称重时间 - curSample.value.measureTime = nx.$dayjs().format('YYYY-MM-DD HH:mm:ss') //计算 try { calcAnalysisValue(fieldGroup.value) @@ -760,29 +701,6 @@ function setValueToSample() { }) } -//提交任务单 -const submitTask = () => { - const params = { - businessAssayTaskId: taskId.value - } - const msg = '请确认所有样品数据都已保存,然后再提交指派单!是否继续?' - uni.showModal({ - title: '提示', - content: msg, - cancelColor: '#0055A2', - confirmColor: '#0055A2', - success: res => { - if (res.cancel) return - - nx.$api.assayTask.submitTask(params).then(res => { - uni.navigateTo({ - url: '/pages/analysis/sample/sample-report-search' - }) - }) - } - }) -} - //自动生成杯号(仅顺序称重):第一杯:手填,后续杯 = 上一杯 + 1 const autoGenerateCupNum = () => { let cupNum = 0 @@ -809,33 +727,6 @@ const putCupNum = (cupNum, sampleIndex, lastCupNum) => { } } } - //处理筛上筛下 - // if (lastCupNum && lastCupNum === sampleIndex) { - // //上一个杯号 == 默认杯号 - // cupNum = sampleIndex * 2 + 1 - // } - // for (const fields of fieldGroup.value) { - // if (typeof fields === 'undefined') continue - // //杯号-筛下 - // for (const field of fields.fields) { - // if (field.dicKey === cupNumKey + '_down') { - // if (typeof field.value === 'undefined' || field.value === null || field.value === '') { - // field.value = cupNum - // cupNum++ - // break - // } - // } - // } - // //杯号-筛上 - // for (const field of fields.fields) { - // if (field.dicKey === cupNumKey + '_up') { - // if (typeof field.value === 'undefined' || field.value === null || field.value === '') { - // field.value = cupNum - // return true - // } - // } - // } - // } } const loadConRecoveryList = () => { @@ -1127,10 +1018,6 @@ const listenNumKeyboard = () => { const decimalPosition = selectedField.value.decimalPosition || 0 let val = res.val selectedField.value.value = handleRoundFiveNumber(val, decimalPosition) - const dicKey = selectedField.value.dicKey - if (dicKey && dicKey === 'bh_down') { - autoFillBhUp(val) - } calcAnalysisValue(fieldGroup.value) //自动跳转下一个字段 setTimeout(() => { @@ -1138,6 +1025,22 @@ const listenNumKeyboard = () => { }, 60) }) } +const clearFieldVal = () => { + uni.showModal({ + title: '提示', + content: '清空当前字段的值,是否继续?', + cancelColor: '#0055A2', + confirmColor: '#0055A2', + success: res => { + if (res.cancel) { + return + } + selectedField.value.value = '' + //重新计算 + calcAnalysisValue(fieldGroup.value) + } + }) +} const closeNumKeyBoardListener = () => { uni.$off('keyboardOK') } @@ -1178,6 +1081,31 @@ const auncelDoSelect = res => { } } +//提交任务单 +const submitTask = () => { + // const params = { + // businessAssayTaskId: taskId.value + // } + // const msg = '请确认所有样品数据都已保存,然后再提交指派单!是否继续?' + // uni.showModal({ + // title: '提示', + // content: msg, + // cancelColor: '#0055A2', + // confirmColor: '#0055A2', + // success: res => { + // if (res.cancel) return + + // nx.$api.assayTask.submitTask(params).then(res => { + // uni.navigateTo({ + // url: '/pages/analysis/sample/sample-report-search' + // }) + // }) + // } + // }) + + const url = `/pages/analysis/sample/pdf-preview?businessAssayTaskId=${taskId.value}&reportKey=${configReportTemplateKey.value}&showConfirmBtn=true` + uni.navigateTo({ url }) +} // 生命周期 const { lockOrientation } = useScreenOrientation() @@ -1185,6 +1113,7 @@ onLoad(param => { lockOrientation('landscape') if (param.currentTaskId) { taskId.value = param.currentTaskId + configReportTemplateKey.value = param.configReportTemplateKey getSampleAnalysisByTaskId() } loadFieldApiData(fieldGroup.value) diff --git a/pages/analysis/sample/sample-work-list.vue b/pages/analysis/sample/sample-work-list.vue index b636a2d..1e566e7 100644 --- a/pages/analysis/sample/sample-work-list.vue +++ b/pages/analysis/sample/sample-work-list.vue @@ -188,7 +188,7 @@ const checkWork = () => { const startWork = () => { // if (!checkWork()) return uni.navigateTo({ - url: `/pages/analysis/sample/sample-work-detail?currentTaskId=${currentTask.value.id}` + url: `/pages/analysis/sample/sample-work-detail?currentTaskId=${currentTask.value.id}&configReportTemplateKey=${currentTask.value.configReportTemplateKey}` }) } @@ -205,7 +205,8 @@ const switchTask = async index => { const getAssayTask = () => { rollbackContent.value = '' const param = { - taskStatus: 'submit' + taskAssignStatus: 'submitted', + taskAssayStatusList: ['not_start', 'saved'] // assayOper: userInfo.value.nickname } nx.$api.assayTask.getAssayTaskList(param).then(res => {