feat:样品库管理
This commit is contained in:
@@ -1,9 +1,66 @@
|
||||
import request from '@/nx/request'
|
||||
export default {
|
||||
// 查询归库样品
|
||||
queryReturnToStockSample: params =>
|
||||
request({
|
||||
url: '/qms/business-sub-sample/page-stock',
|
||||
method: 'GET',
|
||||
params
|
||||
}),
|
||||
// 样品归库
|
||||
execReturnToStock: data =>
|
||||
request({
|
||||
url: '/qms/business-sub-sample/execReturnToStock',
|
||||
method: 'GET',
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,50 +8,55 @@ export { math }
|
||||
/*
|
||||
* 计算当前样品分析值*/
|
||||
export function calcAnalysisValue(group) {
|
||||
try {
|
||||
for (const g of group) {
|
||||
for (const ele of g.fields) {
|
||||
if (!ele.formula || ele.formula == '' || ele.formula.startsWith('From')) continue
|
||||
let formula = ele.formula
|
||||
let formulas = formula.split('|')
|
||||
let formulaVal = ''
|
||||
let hasNullVal = false
|
||||
formulas.forEach(f => {
|
||||
let value = ''
|
||||
if (f.charAt(0) === 'p') {
|
||||
let o = findFieldInGroup(f, group, 'p')
|
||||
value = o.value
|
||||
} else if (f.charAt(0) === 'e') {
|
||||
let o = findFieldInGroup(f, group, 'e')
|
||||
value = o.value
|
||||
} else if (f.charAt(0) === '<' || f.charAt(0) === '>') {
|
||||
value = "'" + f + "'"
|
||||
const MAX_ITERATIONS = 5 // 防止无限循环
|
||||
let iterations = 0
|
||||
let changed = true
|
||||
while (changed && iterations < MAX_ITERATIONS) {
|
||||
changed = false
|
||||
iterations++
|
||||
try {
|
||||
for (const g of group) {
|
||||
for (const ele of g.fields) {
|
||||
if (!ele.formula || ele.formula == '' || ele.formula.startsWith('From')) continue
|
||||
let formula = ele.formula
|
||||
let formulas = formula.split('|')
|
||||
let formulaVal = ''
|
||||
console.log(formulas)
|
||||
formulas.forEach(f => {
|
||||
let value = ''
|
||||
if (f.charAt(0) === 'p') {
|
||||
let o = findFieldInGroup(f, group, 'p')
|
||||
value = o.value || 0
|
||||
} else if (f.charAt(0) === 'e') {
|
||||
let o = findFieldInGroup(f, group, 'e')
|
||||
value = o.value || 0
|
||||
} else if (f.charAt(0) === '<' || f.charAt(0) === '>') {
|
||||
value = "'" + f + "'"
|
||||
} else {
|
||||
value = f
|
||||
}
|
||||
|
||||
formulaVal += value
|
||||
})
|
||||
console.log(formulaVal)
|
||||
|
||||
let v
|
||||
if (formulaVal.startsWith('Get')) {
|
||||
//计算公式为Get开头的,都是执行方法
|
||||
v = eval(formulaVal)
|
||||
} else {
|
||||
value = f
|
||||
v = math.evaluate(formulaVal).toString()
|
||||
v = isFinite(v) ? v.toString() : 0
|
||||
}
|
||||
if (typeof value == 'undefined' || value == null) {
|
||||
hasNullVal = true
|
||||
return true
|
||||
}
|
||||
formulaVal += value
|
||||
})
|
||||
if (hasNullVal) {
|
||||
ele.value = null
|
||||
continue
|
||||
console.log(v)
|
||||
|
||||
ele.value = handleRoundFiveNumber(v, ele.decimalPosition)
|
||||
changed = true
|
||||
}
|
||||
let v
|
||||
if (formulaVal.startsWith('Get')) {
|
||||
//计算公式为Get开头的,都是执行方法
|
||||
v = eval(formulaVal)
|
||||
} else {
|
||||
v = math.evaluate(formulaVal).toString()
|
||||
v = isFinite(v) ? v.toString() : 0
|
||||
}
|
||||
ele.value = handleRoundFiveNumber(v, ele.decimalPosition)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +74,7 @@ export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) {
|
||||
let formulaVal = ''
|
||||
formulas.forEach(f => {
|
||||
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
|
||||
} else if (f.charAt(0) === 'e') {
|
||||
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) {
|
||||
for (const g of group) {
|
||||
for (const f of g.fields) {
|
||||
if (p === 'p' && f.type == 'project') continue
|
||||
if (p + f.paramNo === paramNo) {
|
||||
return f
|
||||
}
|
||||
|
||||
@@ -731,6 +731,17 @@ function reviver(key, 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 {
|
||||
range,
|
||||
getPx,
|
||||
@@ -765,5 +776,6 @@ export default {
|
||||
showToast,
|
||||
uuid,
|
||||
replacer,
|
||||
reviver
|
||||
reviver,
|
||||
isJsonString
|
||||
}
|
||||
|
||||
@@ -110,6 +110,9 @@ page {
|
||||
.white{
|
||||
color:#fff ;
|
||||
}
|
||||
.black{
|
||||
color:#000 ;
|
||||
}
|
||||
.bg-w{
|
||||
background-color: #fff;
|
||||
}
|
||||
@@ -173,5 +176,5 @@ page {
|
||||
font-weight:bold
|
||||
}
|
||||
.border-b{
|
||||
border-bottom: 2px solid rgba(#707070,0.11);
|
||||
border-bottom: 1px solid #dadbde;
|
||||
}
|
||||
@@ -6,12 +6,10 @@ const biz = defineStore({
|
||||
state: () => ({
|
||||
deviceInfo: {},
|
||||
scanQRInfo: null,
|
||||
|
||||
flagInfo: {}
|
||||
}),
|
||||
|
||||
actions: {
|
||||
|
||||
}
|
||||
actions: {}
|
||||
})
|
||||
|
||||
export default biz
|
||||
|
||||
Reference in New Issue
Block a user