feat:查询条件调整
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<view>
|
||||
<navbar-back title="任务单预览"></navbar-back>
|
||||
<view></view>
|
||||
<!-- #ifdef H5 -->
|
||||
<web-view :src="pdfUrlH5"></web-view>
|
||||
<u-button v-if="showConfirmBtn" class="confirm-btn" type="success" @click="handleConfirm()">数据确认</u-button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
@@ -21,9 +21,21 @@ const reportKey = ref('')
|
||||
const hideResultFlag = ref('')
|
||||
const viewerUrl = '/hybrid/html/web/viewer.html?file='
|
||||
const pdfUrlH5 = ref('')
|
||||
const showConfirmBtn = ref(false)
|
||||
let confirmButtonRef = null // 用于保存按钮实
|
||||
|
||||
let wv = null // 计划创建的 webview
|
||||
|
||||
function handleConfirm() {
|
||||
const params = {
|
||||
businessAssayTaskId: businessAssayTaskId.value
|
||||
}
|
||||
nx.$api.assayTask.submitTask(params).then(res => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/analysis/sample/sample-work-list'
|
||||
})
|
||||
})
|
||||
}
|
||||
// 方法:下载 PDF
|
||||
const downloadPdf = (pdfUrl, retryCount = 0) => {
|
||||
const MAX_RETRY = 3 // 最多重试 3 次
|
||||
@@ -79,10 +91,59 @@ const loadPdfOnAndroid = async pdfUrl => {
|
||||
bottom: 0
|
||||
})
|
||||
wv.loadURL(allUrl)
|
||||
|
||||
confirmButtonRef = createConfirmButton()
|
||||
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
||||
currentWebview.append(wv)
|
||||
currentWebview.append(confirmButtonRef)
|
||||
|
||||
if (!showConfirmBtn.value) {
|
||||
hideNativeButton()
|
||||
}
|
||||
}
|
||||
const createConfirmButton = () => {
|
||||
const sysInfo = uni.getSystemInfoSync()
|
||||
const btnWidth = 100
|
||||
const btnHeight = 40
|
||||
const margin = 10
|
||||
const left = sysInfo.windowWidth - btnWidth - margin
|
||||
const top = sysInfo.windowHeight - btnHeight - margin
|
||||
|
||||
const buttonView = new plus.nativeObj.View('confirm-btn-native', {
|
||||
left: left,
|
||||
top: top,
|
||||
width: btnWidth,
|
||||
height: btnHeight
|
||||
})
|
||||
|
||||
buttonView.drawRect({ color: '#5ac725', radius: '4px' }, { top: 0, left: 0, width: btnWidth, height: btnHeight })
|
||||
|
||||
buttonView.drawText(
|
||||
'确认上报',
|
||||
{ top: 11, left: 0, width: btnWidth, height: 18 },
|
||||
{ size: '14px', color: '#ffffff', align: 'center' }
|
||||
)
|
||||
|
||||
buttonView.interceptTouchEvent(true)
|
||||
buttonView.addEventListener('click', () => {
|
||||
handleConfirm()
|
||||
})
|
||||
|
||||
return buttonView
|
||||
}
|
||||
|
||||
// 隐藏按钮
|
||||
function hideNativeButton() {
|
||||
if (confirmButtonRef) {
|
||||
confirmButtonRef.hide()
|
||||
}
|
||||
}
|
||||
function destroyNativeButton() {
|
||||
if (confirmButtonRef) {
|
||||
confirmButtonRef.close() // 或 remove()
|
||||
confirmButtonRef = null
|
||||
}
|
||||
}
|
||||
// 获取 PDF 预览 URL
|
||||
const getPdf = async () => {
|
||||
const printBaseUrl = getBaseUrl()
|
||||
@@ -128,6 +189,9 @@ onLoad(param => {
|
||||
reportKey.value = param.reportKey
|
||||
hideResultFlag.value = param.hideResultFlag
|
||||
}
|
||||
if (param.showConfirmBtn && param.showConfirmBtn === 'true') {
|
||||
showConfirmBtn.value = true
|
||||
}
|
||||
getPdf()
|
||||
})
|
||||
|
||||
@@ -137,7 +201,16 @@ onHide(() => {
|
||||
|
||||
onUnload(() => {
|
||||
deleteTmpFile()
|
||||
destroyNativeButton()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped>
|
||||
.confirm-btn {
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
width: 10%;
|
||||
z-index: 9999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<u-button class="btn-operation" type="primary" @click="submitTask()">提交任务单</u-button>
|
||||
<u-button class="btn-operation" type="primary" @click="submitTask()">数据上报</u-button>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<view class="field-name" v-html="selectedField.title" />
|
||||
@@ -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)
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user