feat:样品库管理

This commit is contained in:
houjunxiang
2025-11-20 17:23:48 +08:00
parent 0494d224be
commit 7ee3df9ab9
32 changed files with 910 additions and 235 deletions

View File

@@ -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.190:48080/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 BaseUrl = isDev ? 'http://localhost:9999' : ''
const upgradeBaseUrl = 'http://192.168.26.116:888' const upgradeBaseUrl = 'http://192.168.26.116:888'

View File

@@ -1,9 +1,66 @@
import request from '@/nx/request' import request from '@/nx/request'
export default { export default {
// 查询归库样品
queryReturnToStockSample: params =>
request({
url: '/qms/business-sub-sample/page-stock',
method: 'GET',
params
}),
// 样品归库
execReturnToStock: data => execReturnToStock: data =>
request({ request({
url: '/qms/business-sub-sample/execReturnToStock', url: '/qms/business-sub-sample/execReturnToStock',
method: 'GET', method: 'GET',
data data
}),
// 库位变更
execChangeLocation: data =>
request({
url: '/qms/business-sub-sample/execChangeLocation',
method: 'POST',
data
}),
// 样品调拨申请列表
querySampleDispatchApply: params =>
request({
url: '/qms/business-sample-dispatch/page',
method: 'GET',
params
}),
// 调拨申请明细列表
querySampleDispatchApplyDetail: params =>
request({
url: '/qms/business-sample-dispatch-detail/page',
method: 'GET',
params
}),
// 调拨执行
execSampleDispatch: data =>
request({
url: '/qms/business-sample-dispatch/execDispatch',
method: 'POST',
data
}),
// 查询待归还样品
searchBySampleCode: params =>
request({
url: 'qms/business-sample-dispatch-detail/searchBySampleCode',
method: 'GET',
params
}),
//调拨归还执行
execGiveback: data =>
request({
url: '/qms/business-sample-dispatch/execGiveback',
method: 'POST',
data
}),
// 样品下架
execTakeOff: data =>
request({
url: 'qms/business-sub-sample/execTakeOff',
method: 'POST',
data
}) })
} }

View File

@@ -8,6 +8,12 @@ export { math }
/* /*
* 计算当前样品分析值*/ * 计算当前样品分析值*/
export function calcAnalysisValue(group) { export function calcAnalysisValue(group) {
const MAX_ITERATIONS = 5 // 防止无限循环
let iterations = 0
let changed = true
while (changed && iterations < MAX_ITERATIONS) {
changed = false
iterations++
try { try {
for (const g of group) { for (const g of group) {
for (const ele of g.fields) { for (const ele of g.fields) {
@@ -15,30 +21,25 @@ export function calcAnalysisValue(group) {
let formula = ele.formula let formula = ele.formula
let formulas = formula.split('|') let formulas = formula.split('|')
let formulaVal = '' let formulaVal = ''
let hasNullVal = false console.log(formulas)
formulas.forEach(f => { formulas.forEach(f => {
let value = '' let value = ''
if (f.charAt(0) === 'p') { if (f.charAt(0) === 'p') {
let o = findFieldInGroup(f, group, 'p') let o = findFieldInGroup(f, group, 'p')
value = o.value value = o.value || 0
} else if (f.charAt(0) === 'e') { } else if (f.charAt(0) === 'e') {
let o = findFieldInGroup(f, group, 'e') let o = findFieldInGroup(f, group, 'e')
value = o.value value = o.value || 0
} else if (f.charAt(0) === '<' || f.charAt(0) === '>') { } else if (f.charAt(0) === '<' || f.charAt(0) === '>') {
value = "'" + f + "'" value = "'" + f + "'"
} else { } else {
value = f value = f
} }
if (typeof value == 'undefined' || value == null) {
hasNullVal = true
return true
}
formulaVal += value formulaVal += value
}) })
if (hasNullVal) { console.log(formulaVal)
ele.value = null
continue
}
let v let v
if (formulaVal.startsWith('Get')) { if (formulaVal.startsWith('Get')) {
//计算公式为Get开头的都是执行方法 //计算公式为Get开头的都是执行方法
@@ -47,12 +48,16 @@ export function calcAnalysisValue(group) {
v = math.evaluate(formulaVal).toString() v = math.evaluate(formulaVal).toString()
v = isFinite(v) ? v.toString() : 0 v = isFinite(v) ? v.toString() : 0
} }
console.log(v)
ele.value = handleRoundFiveNumber(v, ele.decimalPosition) ele.value = handleRoundFiveNumber(v, ele.decimalPosition)
changed = true
} }
} }
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
}
} }
// 根据样品和配置列计算分析值 // 根据样品和配置列计算分析值
@@ -69,7 +74,7 @@ export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) {
let formulaVal = '' let formulaVal = ''
formulas.forEach(f => { formulas.forEach(f => {
if (f.charAt(0) === 'p') { if (f.charAt(0) === 'p') {
let o = dynamicsColumns.find(i => 'p' + i.paramNo === f) let o = dynamicsColumns.find(i => 'p' + i.paramNo === f && i.type !== 'project')
formulaVal += row[o.fieldIndex]?.value ? row[o.fieldIndex].value : 0 formulaVal += row[o.fieldIndex]?.value ? row[o.fieldIndex].value : 0
} else if (f.charAt(0) === 'e') { } else if (f.charAt(0) === 'e') {
let o = dynamicsColumns.find(i => 'e' + i.paramNo === f) let o = dynamicsColumns.find(i => 'e' + i.paramNo === f)
@@ -95,6 +100,7 @@ export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) {
const findFieldInGroup = function (paramNo, group, p) { const findFieldInGroup = function (paramNo, group, p) {
for (const g of group) { for (const g of group) {
for (const f of g.fields) { for (const f of g.fields) {
if (p === 'p' && f.type == 'project') continue
if (p + f.paramNo === paramNo) { if (p + f.paramNo === paramNo) {
return f return f
} }

View File

@@ -731,6 +731,17 @@ function reviver(key, value) {
return value return value
} }
function isJsonString(str) {
if (typeof str !== 'string') return false
try {
const parsed = JSON.parse(str)
return typeof parsed === 'object' && parsed !== null
} catch (e) {
return false
}
}
export default { export default {
range, range,
getPx, getPx,
@@ -765,5 +776,6 @@ export default {
showToast, showToast,
uuid, uuid,
replacer, replacer,
reviver reviver,
isJsonString
} }

View File

@@ -110,6 +110,9 @@ page {
.white{ .white{
color:#fff ; color:#fff ;
} }
.black{
color:#000 ;
}
.bg-w{ .bg-w{
background-color: #fff; background-color: #fff;
} }
@@ -173,5 +176,5 @@ page {
font-weight:bold font-weight:bold
} }
.border-b{ .border-b{
border-bottom: 2px solid rgba(#707070,0.11); border-bottom: 1px solid #dadbde;
} }

View File

@@ -6,12 +6,10 @@ const biz = defineStore({
state: () => ({ state: () => ({
deviceInfo: {}, deviceInfo: {},
scanQRInfo: null, scanQRInfo: null,
flagInfo: {}
}), }),
actions: { actions: {}
}
}) })
export default biz export default biz

View File

@@ -260,6 +260,41 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "pages/sampleWarehouse/sampleDispatchExternal/index",
"style": {
"navigationBarTitleText": "外部调拨",
"navigationStyle": "custom"
}
},
{
"path": "pages/sampleWarehouse/sampleDispatchExternal/detail",
"style": {
"navigationBarTitleText": "调拨详情",
"navigationStyle": "custom"
}
},
{
"path": "pages/sampleWarehouse/sampleDispatchInternal/index",
"style": {
"navigationBarTitleText": "内部调拨",
"navigationStyle": "custom"
}
},
{
"path": "pages/sampleWarehouse/dispatchGiveBack/index",
"style": {
"navigationBarTitleText": "调拨归还",
"navigationStyle": "custom"
}
},
{
"path": "pages/sampleWarehouse/sampleTakeOff/index",
"style": {
"navigationBarTitleText": "样品下架",
"navigationStyle": "custom"
}
},
{ {
"path": "pages/setting/SelectBaseData", "path": "pages/setting/SelectBaseData",
"style": { "style": {

View File

@@ -33,17 +33,17 @@ const popupShow = ref(false)
const menuItemList = ref([ const menuItemList = ref([
{ {
url: '/pages/analysis/sample/sample-work-list', url: '/pages/analysis/sample/sample-work-list',
otherConf: { icon: '/static/images/menus/sampleAnalysis.png' }, otherConf: { icon: '/static/images/menus/样品分析.png' },
name: '样品分析' name: '样品分析'
}, },
{ {
url: '/pages/analysis/sample/sample-report-search', url: '/pages/analysis/sample/sample-report-search',
otherConf: { icon: '/static/images/menus/records.png' }, otherConf: { icon: '/static/images/menus/记录.png' },
name: '分析记录' name: '分析记录'
}, },
{ {
url: '/pages/analysis/auncel/auncel-status', url: '/pages/analysis/auncel/auncel-status',
otherConf: { icon: '/static/images/menus/balance.png' }, otherConf: { icon: '/static/images/menus/天平查看.png' },
name: '天平查看' name: '天平查看'
} }
]) ])

View File

@@ -366,6 +366,7 @@ const parameterClassifyChange = v => {
const fieldClick = (field, key) => { const fieldClick = (field, key) => {
if (!field.isEdit) return if (!field.isEdit) return
currentFillingIndex.value = 0
if (currentFillingWay.value === 'input') { if (currentFillingWay.value === 'input') {
inputValue.value = field.value inputValue.value = field.value
} }

View File

@@ -13,9 +13,9 @@ import { reactive, ref, computed, onMounted } from 'vue'
import nx from '@/nx' import nx from '@/nx'
import { useGridCol } from '@/nx/hooks/useGridCol' import { useGridCol } from '@/nx/hooks/useGridCol'
let list = reactive([ let list = reactive([
{ url: '/pages/lims/index/index', name: '设备管理', icon: 'device' }, { url: '/pages/lims/index/index', name: '设备管理', icon: '设备管理' },
{ url: '/pages/analysis/index/index', name: '分析管理', icon: 'analyse' }, { url: '/pages/analysis/index/index', name: '分析管理', icon: '分析管理' },
{ url: '/pages/sampleWarehouse/index/index', name: '样品库管理', icon: 'sampleWarehouse' } { url: '/pages/sampleWarehouse/index/index', name: '样品库管理', icon: '样品库管理' }
]) ])
// const sysMenus = computed(() => nx.$store('user').sysMenus) // const sysMenus = computed(() => nx.$store('user').sysMenus)

Some files were not shown because too many files have changed in this diff Show More