From 4fb5eecdb2e4736bc31d676d67d617c53ed24ca2 Mon Sep 17 00:00:00 2001 From: houjunxiang Date: Thu, 13 Nov 2025 17:00:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=88=86=E6=9E=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/n-verify/n-verify.vue | 2 +- defaultBaseUrl.js | 7 +- manifest.json | 226 +++++++++--------- nx/helper/calcAnalysisValue.js | 10 +- pages/analysis/auncel/auncel-status.vue | 2 + pages/analysis/sample/sample-work-detail.vue | 139 +++++------ .../analysis/sample/sample-work-edit-task.vue | 11 +- 7 files changed, 202 insertions(+), 195 deletions(-) diff --git a/components/n-verify/n-verify.vue b/components/n-verify/n-verify.vue index 8c2a1fa..c01a44b 100644 --- a/components/n-verify/n-verify.vue +++ b/components/n-verify/n-verify.vue @@ -4,7 +4,7 @@ 安全验证 - × + diff --git a/defaultBaseUrl.js b/defaultBaseUrl.js index fa8c8e4..2cca3b3 100644 --- a/defaultBaseUrl.js +++ b/defaultBaseUrl.js @@ -1,9 +1,10 @@ // 在此不用配置接口前缀 const isDev = process.env.NODE_ENV === 'development' -const BaseUrl = isDev ? 'http://192.168.26.190:48080/admin-api' : 'http://172.33.199.28:8088/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.190:48080/admin-api' : 'http://192.168.26.116:888/admin-api' // const BaseUrl = isDev ? 'http://localhost:9999' : '' -const upgradeBaseUrl = 'http://172.33.199.28:8088' +const upgradeBaseUrl = 'http://192.168.26.116:888' const tenantId = '1' export const clientId = 'lsky_lims' @@ -31,5 +32,5 @@ export function getUpgradeBaseUrl() { } export function getWebSocketUrl() { // return uni.getStorageSync('base_url').replace('/api', '') + '/ws' - return 'ws://192.168.26.190:8330' + return 'ws://192.168.26.116:888/ws' } diff --git a/manifest.json b/manifest.json index 74e85af..5bc9b1f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,31 +1,31 @@ { - "name": "凉山矿业设备管理系统", - "appid": "__UNI__460BC4C", - "description": "凉山矿业设备管理系统", - "versionName": "1.0.0", - "versionCode": "100", - "transformPx": false, - "app-plus": { - "usingComponents": true, - "nvueCompiler": "uni-app", - "compilerVersion": 3, - "splashscreen": { - "alwaysShowBeforeRender": true, - "waiting": true, - "autoclose": true, - "delay": 0 + "name" : "实验室管理系统", + "appid" : "__UNI__4B3B4B0", + "description" : "实验室管理系统", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + "app-plus" : { + "usingComponents" : true, + "nvueCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 }, - "modules": { - "LivePusher": {}, - "Camera": {} + "modules" : { + "LivePusher" : {}, + "Camera" : {} }, - "distribute": { - "android": { - "packagename": "tech.zzjc.mas.lskylims", - "keystore": "zzjc_android.jks", - "password": "zzjc@20190226", - "aliasname": "app", - "permissions": [ + "distribute" : { + "android" : { + "packagename" : "tech.zzjc.mas.zgtylims", + "keystore" : "zzjc_android.jks", + "password" : "zzjc@20190226", + "aliasname" : "app", + "permissions" : [ "", "", "", @@ -50,134 +50,134 @@ "" ] }, - "ios": { - "dSYMs": false + "ios" : { + "dSYMs" : false }, - "sdkConfigs": {}, - "icons": { - "android": { - "hdpi": "unpackage/res/icons/72x72.png", - "xhdpi": "unpackage/res/icons/96x96.png", - "xxhdpi": "unpackage/res/icons/144x144.png", - "xxxhdpi": "unpackage/res/icons/192x192.png" + "sdkConfigs" : {}, + "icons" : { + "android" : { + "hdpi" : "unpackage/res/icons/72x72.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" }, - "ios": { - "appstore": "unpackage/res/icons/1024x1024.png", - "ipad": { - "app": "unpackage/res/icons/76x76.png", - "app@2x": "unpackage/res/icons/152x152.png", - "notification": "unpackage/res/icons/20x20.png", - "notification@2x": "unpackage/res/icons/40x40.png", - "proapp@2x": "unpackage/res/icons/167x167.png", - "settings": "unpackage/res/icons/29x29.png", - "settings@2x": "unpackage/res/icons/58x58.png", - "spotlight": "unpackage/res/icons/40x40.png", - "spotlight@2x": "unpackage/res/icons/80x80.png" + "ios" : { + "appstore" : "unpackage/res/icons/1024x1024.png", + "ipad" : { + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" }, - "iphone": { - "app@2x": "unpackage/res/icons/120x120.png", - "app@3x": "unpackage/res/icons/180x180.png", - "notification@2x": "unpackage/res/icons/40x40.png", - "notification@3x": "unpackage/res/icons/60x60.png", - "settings@2x": "unpackage/res/icons/58x58.png", - "settings@3x": "unpackage/res/icons/87x87.png", - "spotlight@2x": "unpackage/res/icons/80x80.png", - "spotlight@3x": "unpackage/res/icons/120x120.png" + "iphone" : { + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" } } } }, /* 可选,JSON对象,应用UserAgent相关配置 **/ - "useragent": { + "useragent" : { /* 可选,字符串类型,设置的默认userAgent值 */ - "value": "LIMS-PDA/1.0.8", + "value" : "LIMS-PDA/1.0.0", /* 可选,Boolean类型,是否将value值作为追加值连接到系统默认userAgent值之后 */ - "concatenate": true + "concatenate" : true }, /* 可选,JSON对象,Android平台应用UserAgent相关配置,优先级高于useragent配置 */ - "useragent_android": { + "useragent_android" : { /* 可选,字符串类型,设置的默认userAgent值 */ - "value": "LIMS-PDA/1.0.8", + "value" : "LIMS-PDA/1.0.0", /* 可选,Boolean类型,是否将value值作为追加值连接到系统默认userAgent值之后 */ - "concatenate": true + "concatenate" : true }, /* 可选,JSON对象,iOS平台应用UserAgent相关配置,优先级高于useragent配置 */ - "useragent_ios": { + "useragent_ios" : { /* 可选,字符串类型,设置的默认userAgent值 */ - "value": "LIMS-PDA/1.0.8", + "value" : "LIMS-PDA/1.0.0", /* 可选,Boolean类型,是否将value值作为追加值连接到系统默认userAgent值之后 */ - "concatenate": true + "concatenate" : true } }, - "quickapp": {}, - "mp-weixin": { - "appid": "", - "setting": { - "urlCheck": false, - "minified": false + "quickapp" : {}, + "mp-weixin" : { + "appid" : "", + "setting" : { + "urlCheck" : false, + "minified" : false }, - "optimization": { - "subPackages": true + "optimization" : { + "subPackages" : true }, - "usingComponents": true, - "mergeVirtualHostAttributes": true + "usingComponents" : true, + "mergeVirtualHostAttributes" : true }, - "mp-alipay": { - "usingComponents": true + "mp-alipay" : { + "usingComponents" : true }, - "mp-baidu": { - "usingComponents": true + "mp-baidu" : { + "usingComponents" : true }, - "mp-toutiao": { - "usingComponents": true + "mp-toutiao" : { + "usingComponents" : true }, - "uniStatistics": { - "enable": false + "uniStatistics" : { + "enable" : false }, - "vueVersion": "3", - "h5": { - "devServer": { - "port": 33888, - "https": false, - "proxy": { - "/api": { + "vueVersion" : "3", + "h5" : { + "devServer" : { + "port" : 33888, + "https" : false, + "proxy" : { + "/api" : { // "target" : "http://mas.new.will-way.cn/api/", //"target" : "http://192.168.31.180:9090/", - "target": "http://127.0.0.1:9999/", - "changeOrigin": true, - "ws": true, - "pathRewrite": { - "^/api": "" + "target" : "http://127.0.0.1:9999/", + "changeOrigin" : true, + "ws" : true, + "pathRewrite" : { + "^/api" : "" } }, - "/sys": { + "/sys" : { // "target" : "http://mas.new.will-way.cn/api/", //"target" : "http://192.168.31.180:9090/", - "target": "http://127.0.0.1:9999/sys", - "changeOrigin": true, - "ws": true, - "pathRewrite": { - "^/api": "" + "target" : "http://127.0.0.1:9999/sys", + "changeOrigin" : true, + "ws" : true, + "pathRewrite" : { + "^/api" : "" } }, - "/report": { - "target": "http://127.0.0.1:9999/report/", - "changeOrigin": true, - "ws": true, - "pathRewrite": { - "^/api": "" + "/report" : { + "target" : "http://127.0.0.1:9999/report/", + "changeOrigin" : true, + "ws" : true, + "pathRewrite" : { + "^/api" : "" } } } }, - "optimization": { - "treeShaking": { - "enable": true + "optimization" : { + "treeShaking" : { + "enable" : true } }, - "router": { - "base": "./" + "router" : { + "base" : "./" }, - "template": "template.h5.html" + "template" : "template.h5.html" } -} \ No newline at end of file +} diff --git a/nx/helper/calcAnalysisValue.js b/nx/helper/calcAnalysisValue.js index 32ebc77..30be8d5 100644 --- a/nx/helper/calcAnalysisValue.js +++ b/nx/helper/calcAnalysisValue.js @@ -46,12 +46,11 @@ export function calcAnalysisValue(group) { if (formulaVal.startsWith('Get')) { //计算公式为Get开头的,都是执行方法 v = eval(formulaVal) - } else if (formulaVal.startsWith('From')) { } else { v = math.evaluate(formulaVal).toString() v = isFinite(v) ? v.toString() : '' } - ele.value = handleRoundFiveNumber(v, ele.dataType) + ele.value = handleRoundFiveNumber(v, ele.decimalPosition) } } } catch (error) { @@ -86,7 +85,6 @@ export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) { if (formulaVal.startsWith('Get')) { formulaVal = formulaVal.replace(')', ",'" + row.conBaseSampleId + "')") v = eval(formulaVal) - } else if (formulaVal.startsWith('From')) { } else { v = math.evaluate(formulaVal).toString() v = isFinite(v) ? v : 0 @@ -330,10 +328,14 @@ function accAdd(arg1, arg2) { } // 通过配置项分组 -export function groupByField(list, groupKey = 'groupDictionaryBusinessKey') { +export function groupByField(list, cupNumFieldIndex, groupKey = 'groupDictionaryBusinessKey') { const groupMap = new Map() list.unshift({ groupDictionaryBusinessKey: 'all', groupDictionaryBusinessName: '全部' }) for (const item of list) { + // 赋值杯号fieldindex + if (item.title === '杯号') { + cupNumFieldIndex.value = item.fieldIndex + } const key = item[groupKey] if (!key) continue // 跳过没有 group 的项(可选) diff --git a/pages/analysis/auncel/auncel-status.vue b/pages/analysis/auncel/auncel-status.vue index 1a07855..7b9be1a 100644 --- a/pages/analysis/auncel/auncel-status.vue +++ b/pages/analysis/auncel/auncel-status.vue @@ -107,6 +107,8 @@ function handleDeviceData(res) { } function handleDeviceStatus(res) { + console.log(res) + if (res.deviceType === 'balance') { auncelList.value.forEach(item => { if (item.id === res.deviceId) { diff --git a/pages/analysis/sample/sample-work-detail.vue b/pages/analysis/sample/sample-work-detail.vue index 527c512..b868ada 100644 --- a/pages/analysis/sample/sample-work-detail.vue +++ b/pages/analysis/sample/sample-work-detail.vue @@ -75,7 +75,8 @@ > - {{ currentAuncel.code }} + {{ currentAuncel.code }} + 杯号:{{ currentCupNum }} { const autoNextSample = () => { if (sampleDataList.value.length <= currentSampleIndex.value + 1) return const index = currentSampleIndex.value + 1 - groupFieldIndex.value = '' - selectedField.value = {} switchSample(index, true) } //手动切换样品 const switchSample = async (index, autoFlag) => { - if (!autoFlag) { - const shouldContinue = await tools.showPromiseModal( - '提示', - `请确认样品【${currentSampleData.value.sampleCode}】数据已经保存,是否继续?` - ) - if (!shouldContinue) { - return // 用户点了取消,直接退出 - } - } + // if (!autoFlag) { + // const shouldContinue = await tools.showPromiseModal( + // '提示', + // `请确认样品【${currentSampleData.value.sampleCode}】数据已经保存,是否继续?` + // ) + // if (!shouldContinue) { + // return // 用户点了取消,直接退出 + // } + // } //重置天平归0 weightDataIsToZero.value = false if (index === currentSampleIndex.value) return - setValueToSample() currentSampleIndex.value = index // 如果为0,意味着尚未初始化 if (menuHeight.value === 0 || menuItemHeight.value === 0) { @@ -670,7 +668,7 @@ const saveAuncelData = () => { weightDataIsToZero.value = false }, 100) } -const dynamicFormData = {} +let dynamicFormData = reactive({}) const saveDetail = async () => { //检查杯号 if (!checkBh()) return @@ -713,7 +711,7 @@ const saveDetail = async () => { } await nx.$api.assayTask.saveBatchSmpleAndQcAnalysis(params) - getSampleAnalysisByTaskId() + // getSampleAnalysisByTaskId() autoNextSample() } // 计算表格列平均值 @@ -759,10 +757,6 @@ function setValueToSample() { ) { currentSampleData.value[item.fieldIndex].value = item.value } - // 初始化的时候保存杯号到样品中后续自动生成杯号用 - if (item.title === cupNumKey && currentSampleIndex.value == 0) { - currentSampleData.value.cupNum = item.value - } }) } @@ -782,7 +776,7 @@ const submitTask = () => { nx.$api.assayTask.submitTask(params).then(res => { uni.navigateTo({ - url: '/pages/analysis/sample/sample-report' + url: '/pages/analysis/sample/sample-report-search' }) }) } @@ -792,23 +786,22 @@ const submitTask = () => { //自动生成杯号(仅顺序称重):第一杯:手填,后续杯 = 上一杯 + 1 const autoGenerateCupNum = () => { let cupNum = 0 - let current = currentSampleIndex.value + let currentIndex = currentSampleIndex.value //第一杯 - if (current === 0) return + if (currentIndex === 0) return //取上一个样品的杯号 - const sample = sampleDataList.value[current - 1] - cupNum = sample.cupNum + const sample = sampleDataList.value[currentIndex - 1] + cupNum = sample[cupNumFieldIndex.value].value //杯号赋值到当前样品 - putCupNum(Number(cupNum) + 1, current, Number(cupNum)) + putCupNum(Number(cupNum) + 1, currentIndex, Number(cupNum)) } const putCupNum = (cupNum, sampleIndex, lastCupNum) => { - sampleDataList.value[sampleIndex].cupNum = cupNum for (const fields of fieldGroup.value) { if (typeof fields === 'undefined') continue //杯号 for (const field of fields.fields) { - if (field.title === cupNumKey) { + if (field.fieldIndex === cupNumFieldIndex.value) { if (typeof field.value === 'undefined' || field.value === null || field.value === '') { field.value = cupNum return true @@ -817,33 +810,32 @@ 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 - } - } - } - } - return false + // 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 = () => { @@ -880,6 +872,8 @@ const activeAssayTypeKey = ref('') const activeAssayTypeIndex = ref(0) //元素结果范围 let conRangeElementAnalysisList = ref([]) +// 杯号fieldIndex +const cupNumFieldIndex = ref('') const currentAssayType = computed(() => { return assayGroups.value.find(item => item.value === activeAssayTypeKey.value) }) @@ -894,12 +888,22 @@ watch( () => currentAssayType.value, () => { sampleDataList.value = currentAssayType.value.tableData - fieldGroup.value = groupByField(currentAssayType.value.columns) + fieldGroup.value = groupByField(currentAssayType.value.columns, cupNumFieldIndex) + setValueToField() // getDomHeight() activeCollapses.value = fieldGroup.value.map((_, index) => index) } ) +const currentCupNum = computed(() => { + for (const item of fieldGroup.value) { + const field = item.fields.find(field => field.fieldIndex === cupNumFieldIndex.value) + if (field) { + return field.value + } + } + return null +}) const currentGroup = computed(() => { if (!currentAssayType.value || curParameterKey.value === 'all') { return fieldGroup.value @@ -936,10 +940,11 @@ function handleAssayTypeChange({ index, value }) { } // 获取任务指派单数据 async function getSampleAnalysisByTaskId() { - const { assayTaskAnalysisDataList, configAssayMethodProjectRangeList, businessAssayTasNo } = + const { assayTaskAnalysisDataList, configAssayMethodProjectRangeList, businessAssayTasNo, formValue } = await nx.$api.assayTask.batchSampleAndQcAnalysisByTaskId(taskId.value) title.value = '样品分析-任务指派单:' + businessAssayTasNo // 处理分析数据 + assayGroups.value = assayTaskAnalysisDataList.map(group => { // 必须深拷贝 datas!防止多个表格共享引用 const tableData = JSON.parse(JSON.stringify(group.datas || [])) @@ -955,6 +960,7 @@ async function getSampleAnalysisByTaskId() { : [] } }) + dynamicFormData = formValue ? JSON.parse(formValue) : {} // 默认激活第一个 类型 if (!activeAssayTypeKey.value) { activeAssayTypeKey.value = assayGroups.value.length > 0 ? assayGroups.value[0].value : '' @@ -1120,19 +1126,7 @@ const listenNumKeyboard = () => { //自动补全小数位数 const decimalPosition = selectedField.value.decimalPosition || 0 let val = res.val - //判断val小数位,如果小于设定位数,则补全 - if (decimalPosition > 0) { - if (val === '') val = '0' - if (typeof val === 'number') val += '' - let dotLen = 0 - if (val.indexOf('.') > 0) dotLen = val.length - val.indexOf('.') - 1 - else val += '.' - while (dotLen < decimalPosition) { - dotLen++ - val += '0' - } - } - selectedField.value.value = val + selectedField.value.value = handleRoundFiveNumber(val, decimalPosition) const dicKey = selectedField.value.dicKey if (dicKey && dicKey === 'bh_down') { autoFillBhUp(val) @@ -1335,11 +1329,18 @@ onBackPress(() => { background-position: center; display: flex; flex-direction: column; + position: relative; + .code { + position: absolute; + top: 10px; + left: 50px; + } } .auncel-title { flex: 3; display: flex; + flex-direction: column; justify-content: center; align-items: center; font-size: 32px; diff --git a/pages/analysis/sample/sample-work-edit-task.vue b/pages/analysis/sample/sample-work-edit-task.vue index 71888ad..46ed7bc 100644 --- a/pages/analysis/sample/sample-work-edit-task.vue +++ b/pages/analysis/sample/sample-work-edit-task.vue @@ -101,7 +101,7 @@ const formFields = ref([]) const staticFormSchema = [ { label: '指派单号', fieldKey: 'businessAssayTaskId', hidden: true }, { type: 'title', value: '分析原始记录单' }, - { label: '检测方法', type: 'Input', fieldKey: 'configAssayMethodName', disabled: true }, + { label: '检测方法', type: 'Input', fieldKey: 'configAssayMethodName' }, { label: '分析人', type: 'Input', fieldKey: 'assayOperator', disabled: true }, { label: '检测时间', type: 'date', fieldKey: 'assayTime' } ] @@ -294,10 +294,11 @@ function getDynamicFormSchemaFormData(obj) { } // 检查动态字段值在空白样或者标样的(影响计算配置字段)中是否变化 function checkPropertyEquality() { - if (configQCSampleMethodInfos.value.length === 0) return false - for (const config of configQCSampleMethodInfos.value) { - const target = config.target - if (!target) continue + let allColumns = tabs.value.flatMap(tab => tab.columns) + for (const column of allColumns) { + const formula = column.formula + if (!formula) continue + const target = formula.split(':')[1] const originalValue = dynamicFormData.value[target] const currentValue = realFormData.value[target] console.log('checkPropertyEquality', originalValue, currentValue)