feat:分析值保留两位有效数字计算
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<span>{{ title }}</span>
|
||||
</view>
|
||||
<view class="x-c">
|
||||
<u-icon size="150" color="#0055A2" name="scan"></u-icon>
|
||||
<u-icon size="150" color="#0055A2" name="scan" @click="handleScan"></u-icon>
|
||||
</view>
|
||||
<!-- #ifdef H5 -->
|
||||
<up-search
|
||||
@@ -47,6 +47,14 @@ function iconMap(key) {
|
||||
return customIconsMap.get(key)
|
||||
}
|
||||
|
||||
function handleScan() {
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success: function (res) {
|
||||
emits('scanResult', res.result)
|
||||
}
|
||||
})
|
||||
}
|
||||
function handleInputSearch(e) {
|
||||
emits('deviceId', e)
|
||||
}
|
||||
|
||||
@@ -2,26 +2,26 @@ import request from '@/nx/request'
|
||||
export default {
|
||||
queryById: id =>
|
||||
request({
|
||||
url: '/lims/bus/deviceBusMaintain/getMaintainDetail',
|
||||
url: '/qms/resource/device-maintain/getMaintainDetail',
|
||||
method: 'GET',
|
||||
params: { id }
|
||||
}),
|
||||
list: params =>
|
||||
request({
|
||||
url: '/lims/bus/deviceBusMaintain/list',
|
||||
url: '/qms/resource/device-maintain/page',
|
||||
method: 'GET',
|
||||
params
|
||||
}),
|
||||
// 根据设备id或者维护和点检记录
|
||||
getCheckRecord: data =>
|
||||
request({
|
||||
url: '/lims/bus/deviceBusMaintain/createOrGet',
|
||||
url: '/qms/resource/device-maintain/createOrGet',
|
||||
method: 'POST',
|
||||
data
|
||||
}),
|
||||
submit: data =>
|
||||
request({
|
||||
url: '/lims/bus/deviceBusMaintain/saveMaintainVo',
|
||||
url: '/qms/resource/device-maintain/saveMaintainVo',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
@@ -30,13 +30,13 @@ export default {
|
||||
}),
|
||||
getLastDailyCheckOfToday: params =>
|
||||
request({
|
||||
url: '/lims/bus/deviceBusMaintain/getLastDailyCheckOfToday',
|
||||
url: '/qms/resource/device-maintain/getLastDailyCheckOfToday',
|
||||
method: 'GET',
|
||||
params,
|
||||
}),
|
||||
createDailyCheck: data =>
|
||||
request({
|
||||
url: '/lims/bus/deviceBusMaintain/create',
|
||||
url: '/qms/resource/device-maintain/create',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -674,7 +674,7 @@ const saveDetail = async () => {
|
||||
if (item.calcMethod === 'calculateAverageValue') {
|
||||
item.value = calcAverageValue(sourceKey, currentAssayType.value.tableData)
|
||||
} else {
|
||||
item.value = handleRoundFiveNumber(row[sourceKey].value, row.decimalPosition)
|
||||
item.value = handleRoundFiveNumber(row[sourceKey].value, row.decimalPosition, row.type === 'project')
|
||||
}
|
||||
// 如果处理后的值不为空,重新赋值该字段到其他样品类型下的样品上,并触发每一个样品的计算
|
||||
for (const col of currentAssayType.value.columns) {
|
||||
@@ -707,9 +707,10 @@ const saveDetail = async () => {
|
||||
function calcAverageValue(fieldIndex, tableData) {
|
||||
const rows = tableData.map(row => row[fieldIndex])
|
||||
const decimalPosition = rows[0].decimalPosition
|
||||
const isProject = rows[0].type === 'project'
|
||||
const values = rows.map(row => Number(row.value))
|
||||
if (values.some(item => item == null)) return null
|
||||
return handleRoundFiveNumber(math.mean(values), decimalPosition)
|
||||
return handleRoundFiveNumber(math.mean(values), decimalPosition, isProject)
|
||||
}
|
||||
|
||||
// 表格数据更新后重新计算
|
||||
@@ -1109,12 +1110,13 @@ const listenNumKeyboard = () => {
|
||||
}
|
||||
//自动补全小数位数
|
||||
const decimalPosition = selectedField.value.decimalPosition
|
||||
const isProject = selectedField.value.type === 'project'
|
||||
let val = res.val
|
||||
const symbol = res.symbol
|
||||
if (decimalPosition == null) {
|
||||
selectedField.value.value = val
|
||||
} else {
|
||||
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition)
|
||||
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition, isProject)
|
||||
}
|
||||
if (symbol) {
|
||||
selectedField.value.symbol = symbol
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -156,7 +156,7 @@ function getLastDailyCheckOfToday(id) {
|
||||
})
|
||||
}, 100)
|
||||
pageLoading.value = false
|
||||
nx.$router.go('/pages/deviceBusDailyCheck/index', { deviceId: id })
|
||||
nx.$router.go('/pages/device/deviceBusDailyCheck/index', { deviceId: id })
|
||||
} else {
|
||||
getDeviceInfo(id)
|
||||
await getUseIngRecord(id)
|
||||
|
||||
@@ -3,38 +3,37 @@
|
||||
<navbar-back title="实验室管理系统【设备管理】" :autoBack="false" leftIcon="" leftText="">
|
||||
<u-icon @click="popupShow = true" size="28" color="#FFF" name="setting-fill" />
|
||||
</navbar-back>
|
||||
<up-grid :border="false" :col="gridCol">
|
||||
<up-grid-item
|
||||
class="mb20 mt20"
|
||||
v-for="(item, listIndex) in list"
|
||||
:key="listIndex"
|
||||
@click="nx.$router.go(item.url)"
|
||||
>
|
||||
<image style="width: 80px; height: 80px" :src="`/static/images/menus/${item.icon}.png`"></image>
|
||||
<text class="grid-text">{{ item.name }}</text>
|
||||
<up-grid :col="gridCol" :border="false">
|
||||
<up-grid-item class="mb20 mt20" v-for="item in menuItemList" :key="item.id" @click="goTo(item.component)">
|
||||
<u-icon :name="`/static/images/menus/${item.path}.png`" color="#0055A2" size="80" />
|
||||
<view class="grid-text">{{ item.name }}</view>
|
||||
</up-grid-item>
|
||||
</up-grid>
|
||||
<mePopup v-model:show="popupShow" />
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { reactive, ref, computed } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import nx from '@/nx'
|
||||
import { useGridCol } from '@/nx/hooks/useGridCol'
|
||||
import mePopup from '@/pages/index/me-popup.vue'
|
||||
|
||||
const { gridCol } = useGridCol([400, 600], [2, 3, 4])
|
||||
let popupShow = ref(false)
|
||||
let list = reactive([
|
||||
{ url: '/pages/device/deviceBusDailyCheck/index', name: '点检', icon: 'dailyCheck' },
|
||||
{ url: '/pages/device/deviceBusMaintain/index', name: '维护保养', icon: 'maintain' },
|
||||
{ url: '/pages/device/deviceBusUseRecord/index', name: '使用', icon: 'useRecord' },
|
||||
{ url: '/pages/device/deviceBusInfo/index', name: '设备查询', icon: 'baseInfo' },
|
||||
{ url: '/pages/device/knowledge/index', name: '知识库查询', icon: 'knowledge' }
|
||||
])
|
||||
const menuItemList = computed(() => {
|
||||
let roleMenus = nx.$store('user').roleMenus
|
||||
const result = roleMenus.find(item => item.path === 'device')
|
||||
if (result) {
|
||||
return result.children
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
})
|
||||
|
||||
const roleMenus = computed(() => nx.$store('user').roleMenus)
|
||||
const userInfo = computed(() => nx.$store('user').userInfo)
|
||||
// 方法
|
||||
const goTo = url => {
|
||||
nx.$router.go(url)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
BIN
static/images/menus/device.png
Normal file
BIN
static/images/menus/device.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
Reference in New Issue
Block a user