feat:设备使用记录

This commit is contained in:
houjunxiang
2026-03-05 16:54:47 +08:00
parent 749ac7f507
commit 9c88c45d66
357 changed files with 21486 additions and 5845 deletions

View File

@@ -32,7 +32,7 @@ export default {
request({
url: '/qms/resource/device-maintain/getLastDailyCheckOfToday',
method: 'GET',
params,
params
}),
createDailyCheck: data =>
request({

View File

@@ -2,21 +2,21 @@ import request from '@/nx/request'
export function getDeviceBusInfoById(id) {
return request({
url: '/lims/bus/deviceBusInfo/queryById',
url: '/qms/resource/device-infomation/get',
method: 'GET',
params: { id }
})
}
export function deviceList(params) {
return request({
url: '/lims/bus/deviceBusInfo/list',
url: '/qms/resource/device-infomation/page',
method: 'GET',
params
})
}
export function treeData(params) {
return request({
url: '/lims/bus/deviceBusProduct/listTree',
url: '/qms/resource/device-product/getProductTreeData',
method: 'GET',
params
})
@@ -74,6 +74,3 @@ export function stopList(params) {
params
})
}
export default{
getDeviceBusInfoById
}

View File

@@ -7,11 +7,79 @@ export default {
method: 'GET',
params
}),
// 查询大类
queryMaterialCategory: params =>
request({
url: '/qms/resource/material-product/category-data',
method: 'GET',
params
}),
// 查询物料实例
queryMaterialInformation: params =>
request({
url: '/qms/resource/material-infomation/page',
method: 'GET',
params
}),
// 物料出库
execMaterialOut: data =>
request({
url: '/qms/resource/material-inventory-outbound/add',
method: 'POST',
data
}),
// 新增使用记录
addUseRecord: data =>
request({
url: '/qms/resource/material-use-record/add',
method: 'POST',
data
}),
// 删除使用记录
deleteUseRecord: params =>
request({
url: '/qms/resource/material-use-record/delete',
method: 'DELETE',
params
}),
getUseRecord: params =>
request({
url: '/qms/resource/material-use-record/page',
method: 'GET',
params
}),
// 使用确认
confirmUseRecord: data =>
request({
url: '/qms/resource/material-use-record/review',
method: 'PUT',
data
}),
// 新增危化品配置信息
addHazardousMake: data =>
request({
url: '/qms/resource/material-use-record/hzrd-make',
method: 'POST',
data
}),
// 新增用完标记和清洗回收
addUseOver: data =>
request({
url: '/qms/resource/material-use-end-reuse/add',
method: 'POST',
data
}),
getMaterialUseEndReuseDetailPage: params =>
request({
url: `/qms/resource/material-use-end-reuse-detail/page`,
method: 'GET',
params
}),
// 试剂瓶回收
reuse: data =>
request({
url: '/qms/resource/material-use-end-reuse/reuse',
method: 'PUT',
data
})
}

View File

@@ -79,9 +79,10 @@ export default {
data
}),
// 根据权限查询样品库
querySampleLocation: () =>
querySampleLocation: params =>
request({
url: '/qms/config-warehouse-location/selectListWithPermission',
method: 'GET'
method: 'GET',
params
})
}

View File

@@ -35,5 +35,11 @@ export default {
isTransformResponse: false
}
})
},
getDataListByCategoryKey: key => {
return request({
url: `/qms/dictionary-business/getDataListByCategoryKey?key=` + key,
method: 'GET'
})
}
}

View File

@@ -327,6 +327,79 @@ export function handleRoundFiveNumber(number, fixed = 0) {
//偶不进,将取值的当前位数,直接截取字符即可
return number.substr(0, indexFixed)
}
export function handleEfficaciousNumber(number, fixed, effectiveDigit) {
// 1. 先将数字补全到 fixed 位小数
const numStr = String(number)
const dotIndex = numStr.indexOf('.') // dotIndex = 1
let actualFixed = fixed // 默认为 fixed
if (dotIndex !== -1) {
const decimalPart = numStr.slice(dotIndex + 1) // decimalPart = "0400"
console.log(`小数部分: ${decimalPart}`)
let nonZeroCount = 0
let targetEffectiveDigitPos = -1
// 2. 循环 "0400",寻找有效数字
for (let i = 0; i < decimalPart.length; i++) {
// i=0 to 3
const char = decimalPart[i]
console.log(`检查第 ${i + 1} 位: '${char}', 当前 nonZeroCount: ${nonZeroCount}`)
if (nonZeroCount === 0) {
// 寻找第一个非零数字
if (char !== '0') {
// i=0, '0' -> false; i=1, '4' -> true
nonZeroCount++ // nonZeroCount = 1
console.log(` -> 找到第 1 个有效数字: '${char}'`)
}
} else {
// 已经找到第一个非零数字,后续所有数字都算有效
if (nonZeroCount < effectiveDigit) {
// 1 < 2 -> true
nonZeroCount++ // nonZeroCount = 2
console.log(` -> 找到第 2 个有效数字: '${char}'`)
}
}
if (nonZeroCount === effectiveDigit) {
// 2 === 2 -> true when i=2
targetEffectiveDigitPos = i + 1 // i=2, so pos is 3
console.log(` -> 目标有效数字 (${effectiveDigit}) 已找到,位于第 ${targetEffectiveDigitPos}`)
break
}
}
console.log(`targetEffectiveDigitPos: ${targetEffectiveDigitPos}`)
// 3. 判断并设置最终精度
if (targetEffectiveDigitPos !== -1 && targetEffectiveDigitPos <= fixed) {
// 3 !== -1 and 3 <= 4 -> true
actualFixed = targetEffectiveDigitPos // actualFixed = 3
}
const finalNumber = handleRoundFiveNumber(Number(number), actualFixed)
// 获取整数部分
const finalIntegerPart = finalNumber.slice(0, dotIndex + 1) // 包含小数点
const finalDecimalPart = finalNumber.slice(dotIndex + 1)
// 截取指定长度的小数部分
let truncatedDecimalPart = ''
if (Number(finalDecimalPart) === 0) {
truncatedDecimalPart = finalDecimalPart.substring(0, effectiveDigit)
}else{
truncatedDecimalPart = finalDecimalPart.substring(0, actualFixed)
}
// 拼接最终结果
let result = finalIntegerPart + truncatedDecimalPart
// 特殊情况处理:如果截取后小数部分为空,则去掉小数点
if (actualFixed === 0) {
result = finalIntegerPart.slice(0, -1) // 去掉最后的 "."
}
return result
}
}
/**
** 除法函数,用来得到精确的除法结果

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
import test from './test.js'
import { round } from './digit.js'
import dayjs from 'dayjs'
/**
* @description 如果value小于min取min如果value大于max取max
* @param {number} min
@@ -741,7 +742,76 @@ function isJsonString(str) {
return false
}
}
/**
* 构造树型结构数据
* @param {*} data 数据源
* @param {*} id id字段 默认 'id'
* @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
*/
const handleTree = (data, id, parentId, children) => {
if (!Array.isArray(data)) {
console.warn('data must be an array')
return []
}
const config = {
id: id || 'id',
parentId: parentId || 'parentId',
childrenList: children || 'children'
}
const childrenListMap = {}
const nodeIds = {}
const tree = []
for (const d of data) {
const parentId = d[config.parentId]
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = []
}
nodeIds[d[config.id]] = d
childrenListMap[parentId].push(d)
}
for (const d of data) {
const parentId = d[config.parentId]
if (nodeIds[parentId] == null) {
tree.push(d)
}
}
for (const t of tree) {
adaptToChildrenList(t)
}
function adaptToChildrenList(o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]]
}
if (o[config.childrenList]) {
for (const c of o[config.childrenList]) {
adaptToChildrenList(c)
}
}
}
return tree
}
function formateToDate(date) {
if (date) {
return dayjs(date).format('YYYY-MM-DD')
} else {
return ''
}
}
function formateToDateTime(date) {
if (date) {
return dayjs(date).format('YYYY-MM-DD HH:mm:ss')
} else {
return ''
}
}
export default {
range,
getPx,
@@ -777,5 +847,8 @@ export default {
uuid,
replacer,
reviver,
isJsonString
isJsonString,
handleTree,
formateToDate,
formateToDateTime
}

View File

@@ -7,7 +7,7 @@ export function useListData({ searchParams, api, needInitListData = false, proce
const loadingData = ref(true)
const pageParams = reactive({
pageNo: 1,
pageSize: 10
pageSize: 15
})
const total = ref(0)
const loadStatus = ref('loadmore')
@@ -16,8 +16,8 @@ export function useListData({ searchParams, api, needInitListData = false, proce
// 模拟获取数据的方法
const getListData = async () => {
const params = {
...unref(searchParams),
...pageParams
...pageParams,
...unref(searchParams)
}
let { list, total: pageTotal } = await api(params)
total.value = pageTotal

View File

@@ -74,10 +74,7 @@ http.interceptors.request.use(
LoadingInstance.count === 1 &&
uni.showLoading({
title: config.custom.loadingMsg,
mask: true,
fail: () => {
uni.hideLoading()
}
mask: true
})
}
config.baseURL = getBaseUrl()

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