Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da01e1efcd | ||
|
|
e10c70e819 |
@@ -7,7 +7,7 @@
|
|||||||
<span>{{ title }}</span>
|
<span>{{ title }}</span>
|
||||||
</view>
|
</view>
|
||||||
<view class="x-c">
|
<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>
|
</view>
|
||||||
<!-- #ifdef H5 -->
|
<!-- #ifdef H5 -->
|
||||||
<up-search
|
<up-search
|
||||||
@@ -47,6 +47,14 @@ function iconMap(key) {
|
|||||||
return customIconsMap.get(key)
|
return customIconsMap.get(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleScan() {
|
||||||
|
uni.scanCode({
|
||||||
|
onlyFromCamera: true,
|
||||||
|
success: function (res) {
|
||||||
|
emits('scanResult', res.result)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
function handleInputSearch(e) {
|
function handleInputSearch(e) {
|
||||||
emits('deviceId', e)
|
emits('deviceId', e)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,26 +2,26 @@ import request from '@/nx/request'
|
|||||||
export default {
|
export default {
|
||||||
queryById: id =>
|
queryById: id =>
|
||||||
request({
|
request({
|
||||||
url: '/lims/bus/deviceBusMaintain/getMaintainDetail',
|
url: '/qms/resource/device-maintain/getMaintainDetail',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: { id }
|
params: { id }
|
||||||
}),
|
}),
|
||||||
list: params =>
|
list: params =>
|
||||||
request({
|
request({
|
||||||
url: '/lims/bus/deviceBusMaintain/list',
|
url: '/qms/resource/device-maintain/page',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params
|
params
|
||||||
}),
|
}),
|
||||||
// 根据设备id或者维护和点检记录
|
// 根据设备id或者维护和点检记录
|
||||||
getCheckRecord: data =>
|
getCheckRecord: data =>
|
||||||
request({
|
request({
|
||||||
url: '/lims/bus/deviceBusMaintain/createOrGet',
|
url: '/qms/resource/device-maintain/createOrGet',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
}),
|
}),
|
||||||
submit: data =>
|
submit: data =>
|
||||||
request({
|
request({
|
||||||
url: '/lims/bus/deviceBusMaintain/saveMaintainVo',
|
url: '/qms/resource/device-maintain/saveMaintainVo',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
custom: {
|
custom: {
|
||||||
@@ -30,13 +30,13 @@ export default {
|
|||||||
}),
|
}),
|
||||||
getLastDailyCheckOfToday: params =>
|
getLastDailyCheckOfToday: params =>
|
||||||
request({
|
request({
|
||||||
url: '/lims/bus/deviceBusMaintain/getLastDailyCheckOfToday',
|
url: '/qms/resource/device-maintain/getLastDailyCheckOfToday',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params,
|
params,
|
||||||
}),
|
}),
|
||||||
createDailyCheck: data =>
|
createDailyCheck: data =>
|
||||||
request({
|
request({
|
||||||
url: '/lims/bus/deviceBusMaintain/create',
|
url: '/qms/resource/device-maintain/create',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -60,14 +60,14 @@ const Get_C_KNO3_bySValue = function (sValue, weight, operator) {
|
|||||||
|
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
const Get_C_KNO3 = function (sValue, weight, operator) {
|
const Get_C_KNO3 = function (weight, sValue, operator) {
|
||||||
//判断sValue是数字
|
//判断sValue是数字
|
||||||
|
const S = number(sValue)
|
||||||
if (sValue === 0 || weight === 0) {
|
const W = number(weight)
|
||||||
|
//如果样重为0就不计算
|
||||||
|
if (W === 0) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
let S = number(sValue)
|
|
||||||
const W = number(weight)
|
|
||||||
if (W === 0) return ''
|
if (W === 0) return ''
|
||||||
const V = ((W * S) / 100) * 22 - 75
|
const V = ((W * S) / 100) * 22 - 75
|
||||||
if (operator === '<' && V < 0) {
|
if (operator === '<' && V < 0) {
|
||||||
@@ -127,7 +127,7 @@ export function calcAnalysisValue(group, externalFormData, taskIngredientsWay) {
|
|||||||
v = math.evaluate(formulaVal).toString()
|
v = math.evaluate(formulaVal).toString()
|
||||||
v = isFinite(v) ? v.toString() : 0
|
v = isFinite(v) ? v.toString() : 0
|
||||||
}
|
}
|
||||||
ele.value = handleRoundFiveNumber(v, ele.decimalPosition)
|
ele.value = handleRoundFiveNumber(v, ele.decimalPosition, ele.type === 'project')
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,13 +149,11 @@ export function evaluateGetFromFormula(formula, parse, externalFormData, current
|
|||||||
relFormulaVal = relFormulaVal.replace(key, value || 0)
|
relFormulaVal = relFormulaVal.replace(key, value || 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(relFormulaVal)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let v = math.evaluate(relFormulaVal).toString()
|
let v = math.evaluate(relFormulaVal).toString()
|
||||||
v = isFinite(v) ? v : 0
|
v = isFinite(v) ? v : 0
|
||||||
if (parse) {
|
if (parse) {
|
||||||
return handleRoundFiveNumber(v, currentColumn.decimalPosition)
|
return handleRoundFiveNumber(v, currentColumn.decimalPosition, currentColumn.type === 'project')
|
||||||
}
|
}
|
||||||
return v
|
return v
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -209,7 +207,8 @@ export function calcRowAnalysisValue(row, columnObj, dynamicsColumns, externalFo
|
|||||||
v = math.evaluate(formulaVal).toString()
|
v = math.evaluate(formulaVal).toString()
|
||||||
v = isFinite(v) ? v : 0
|
v = isFinite(v) ? v : 0
|
||||||
}
|
}
|
||||||
row[curItem.fieldIndex].value = handleRoundFiveNumber(Number(v), row[curItem.fieldIndex].decimalPosition)
|
let rowObj = row[curItem.fieldIndex]
|
||||||
|
rowObj.value = handleRoundFiveNumber(Number(v), rowObj.decimalPosition, rowObj.type === 'project')
|
||||||
calcRowAnalysisValue(row, curItem, dynamicsColumns, externalFormData)
|
calcRowAnalysisValue(row, curItem, dynamicsColumns, externalFormData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,24 +231,56 @@ const findFieldInGroup = function (paramNo, group, p) {
|
|||||||
* 3.四舍,六入
|
* 3.四舍,六入
|
||||||
* 传入数值和保留位数
|
* 传入数值和保留位数
|
||||||
*/
|
*/
|
||||||
export function handleRoundFiveNumber(number, fixed = 0) {
|
export function handleRoundFiveNumber(number, fixed = 0, useTwoSignificantDigits = false) {
|
||||||
if (number == null || number === '' || isNaN(number)) return number
|
if (number == null || number === '' || isNaN(number)) return number
|
||||||
if (fixed === -1) return number
|
if (fixed === -1) return number
|
||||||
number = String(number)
|
number = String(number)
|
||||||
//可以考虑清掉末尾的0,暂时限制了不会有,因为传入数值,末尾0是去掉的
|
//可以考虑清掉末尾的0,暂时限制了不会有,因为传入数值,末尾0是去掉的
|
||||||
|
// 保留2位有效数字:小数点后面大于0的才叫有效数字,从小数点后面查找两位有效数字 ,如果末尾的有效数字的位数大于所设置的精度 以及 如果查找的有效数字没有两位的 ,就按照所设置的精度逻辑来计算,两位有效数字的最后 一位是在第几位,就用这个位数充当精度来按照原来精度的逻辑计算,
|
||||||
|
// ===== 新增:按小数点后前两个非零数字确定精度 =====
|
||||||
|
let actualFixed = fixed
|
||||||
|
if (useTwoSignificantDigits) {
|
||||||
|
const numStr = String(number)
|
||||||
|
const dotIndex = numStr.indexOf('.')
|
||||||
|
|
||||||
|
if (dotIndex !== -1) {
|
||||||
|
const decimalPart = numStr.slice(dotIndex + 1)
|
||||||
|
let nonZeroCount = 0
|
||||||
|
let secondNonZeroPos = -1
|
||||||
|
|
||||||
|
for (let i = 0; i < decimalPart.length; i++) {
|
||||||
|
if (decimalPart[i] !== '0') {
|
||||||
|
nonZeroCount++
|
||||||
|
if (nonZeroCount === 2) {
|
||||||
|
secondNonZeroPos = i + 1 // 小数点后第几位(从1开始)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只有同时满足:
|
||||||
|
// 1. 找到两个非零数字
|
||||||
|
// 2. 第二个的位置 <= 用户指定的 fixed
|
||||||
|
// 才使用该位置作为精度
|
||||||
|
if (secondNonZeroPos !== -1 && secondNonZeroPos <= fixed) {
|
||||||
|
actualFixed = secondNonZeroPos
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(actualFixed)
|
||||||
const index = number.indexOf('.')
|
const index = number.indexOf('.')
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
if (fixed > 0) {
|
if (actualFixed > 0) {
|
||||||
number += '.'
|
number += '.'
|
||||||
}
|
}
|
||||||
for (let i = 0; i < fixed; i++) {
|
for (let i = 0; i < actualFixed; i++) {
|
||||||
number += '0'
|
number += '0'
|
||||||
}
|
}
|
||||||
//补0返回
|
//补0返回
|
||||||
return number
|
return number
|
||||||
}
|
}
|
||||||
//取到保留小数位的下一位,5.5555取保留俩位,那就是小数点后第三位
|
//取到保留小数位的下一位,5.5555取保留俩位,那就是小数点后第三位
|
||||||
const indexFixed = index + fixed + 1
|
const indexFixed = index + actualFixed + 1
|
||||||
if (indexFixed >= number.length) {
|
if (indexFixed >= number.length) {
|
||||||
//如果小数位数不够, 补0直接返回
|
//如果小数位数不够, 补0直接返回
|
||||||
const zerolen = indexFixed - number.length
|
const zerolen = indexFixed - number.length
|
||||||
@@ -262,16 +293,16 @@ export function handleRoundFiveNumber(number, fixed = 0) {
|
|||||||
const endNumber = number.substr(indexFixed, 1)
|
const endNumber = number.substr(indexFixed, 1)
|
||||||
if (endNumber != '5') {
|
if (endNumber != '5') {
|
||||||
//如果做判断的数不是五,就按正常的四舍五入,即忽略了5,后面补0的那些由于是数字传进来,0已经去掉,此处不做处理
|
//如果做判断的数不是五,就按正常的四舍五入,即忽略了5,后面补0的那些由于是数字传进来,0已经去掉,此处不做处理
|
||||||
return Number(number).toFixed(fixed)
|
return Number(number).toFixed(actualFixed)
|
||||||
}
|
}
|
||||||
if (indexFixed != number.length - 1) {
|
if (indexFixed != number.length - 1) {
|
||||||
//由于当前判断位不是最后一位,而又去除了0,那么后面后的位数应该直接入位,五后不为0时入,由于会有小于五的,四舍五入肯定不行,那么只能截取到当前保留位数,然后转成数字加上10的负fixed的次方即可
|
//由于当前判断位不是最后一位,而又去除了0,那么后面后的位数应该直接入位,五后不为0时入,由于会有小于五的,四舍五入肯定不行,那么只能截取到当前保留位数,然后转成数字加上10的负fixed的次方即可
|
||||||
number = number.substring(0, indexFixed)
|
number = number.substring(0, indexFixed)
|
||||||
if (number.indexOf('-') != -1) {
|
if (number.indexOf('-') != -1) {
|
||||||
//需要考虑到负数的情况
|
//需要考虑到负数的情况
|
||||||
return (Number(number) - Number(Math.pow(10, -fixed))).toFixed(fixed)
|
return (Number(number) - Number(Math.pow(10, -actualFixed))).toFixed(actualFixed)
|
||||||
}
|
}
|
||||||
return (Number(number) + Number(Math.pow(10, -fixed))).toFixed(fixed)
|
return (Number(number) + Number(Math.pow(10, -actualFixed))).toFixed(actualFixed)
|
||||||
//return this.accAdd(number,Math.pow(10,-fixed))
|
//return this.accAdd(number,Math.pow(10,-fixed))
|
||||||
}
|
}
|
||||||
//接下来就时五后没有值也就是0的需要看前面的奇入偶不入了,取当前位的上一位
|
//接下来就时五后没有值也就是0的需要看前面的奇入偶不入了,取当前位的上一位
|
||||||
@@ -285,9 +316,9 @@ export function handleRoundFiveNumber(number, fixed = 0) {
|
|||||||
number = number.substring(0, indexFixed)
|
number = number.substring(0, indexFixed)
|
||||||
if (number.indexOf('-') != -1) {
|
if (number.indexOf('-') != -1) {
|
||||||
//需要考虑到负数的情况
|
//需要考虑到负数的情况
|
||||||
return (Number(number) - Math.pow(10, -fixed)).toFixed(fixed)
|
return (Number(number) - Math.pow(10, -actualFixed)).toFixed(actualFixed)
|
||||||
}
|
}
|
||||||
return (Number(number) + Math.pow(10, -fixed)).toFixed(fixed)
|
return (Number(number) + Math.pow(10, -actualFixed)).toFixed(actualFixed)
|
||||||
}
|
}
|
||||||
//偶不进,将取值的当前位数,直接截取字符即可
|
//偶不进,将取值的当前位数,直接截取字符即可
|
||||||
return number.substr(0, indexFixed)
|
return number.substr(0, indexFixed)
|
||||||
|
|||||||
@@ -54,9 +54,8 @@
|
|||||||
class="u-tab-item"
|
class="u-tab-item"
|
||||||
:class="[currentSampleIndex === index ? 'u-tab-item-active' : '']"
|
:class="[currentSampleIndex === index ? 'u-tab-item-active' : '']"
|
||||||
:data-current="index"
|
:data-current="index"
|
||||||
@tap.stop="switchSample(index, false)"
|
@tap.stop="switchSample(index)"
|
||||||
>
|
>
|
||||||
<!-- sample.rollbackStatus === 'in_progress' ? 'u-tab-item-disabled' : '' 退回disabled暂不显示 -->
|
|
||||||
<u-badge type="warning" :value="index + 1"></u-badge>
|
<u-badge type="warning" :value="index + 1"></u-badge>
|
||||||
<view class="ml20">
|
<view class="ml20">
|
||||||
<view>
|
<view>
|
||||||
@@ -151,18 +150,6 @@
|
|||||||
<view class="pt10">
|
<view class="pt10">
|
||||||
<scroll-view class="content-right-scroll" scroll-y scroll-with-animation :scroll-top="scrollFieldTop">
|
<scroll-view class="content-right-scroll" scroll-y scroll-with-animation :scroll-top="scrollFieldTop">
|
||||||
<view>
|
<view>
|
||||||
<!-- <template v-for="(fields, groupIndex) in fieldGroup" :key="'group_' + groupIndex"> -->
|
|
||||||
<!-- <view> -->
|
|
||||||
<!-- 组名 -->
|
|
||||||
<!-- <view class="my-collapse" @click="fields.open = !fields.open">
|
|
||||||
<text class="title">{{ fields.title }}</text>
|
|
||||||
<u-icon :name="fields.open ? 'arrow-up' : 'arrow-down'"></u-icon>
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
class="content"
|
|
||||||
:id="'elId' + groupIndex"
|
|
||||||
:style="{ height: fields.open ? collaHeights[groupIndex] + 'px' : '0' }"
|
|
||||||
> -->
|
|
||||||
<up-collapse ref="collapseRef" :value="activeCollapses" :border="false">
|
<up-collapse ref="collapseRef" :value="activeCollapses" :border="false">
|
||||||
<template v-for="(fields, groupIndex) in currentGroup">
|
<template v-for="(fields, groupIndex) in currentGroup">
|
||||||
<up-collapse-item v-if="fields.label !== '全部'">
|
<up-collapse-item v-if="fields.label !== '全部'">
|
||||||
@@ -185,32 +172,6 @@
|
|||||||
v-html="field.title"
|
v-html="field.title"
|
||||||
></view>
|
></view>
|
||||||
<view class="content-my">
|
<view class="content-my">
|
||||||
<!--
|
|
||||||
如果是select,渲染2个组件:1个input、1个picker.
|
|
||||||
field.valueText用于显示picker选中的文本
|
|
||||||
1,键盘输入,2、天平,3、自动计算,4、文本输入
|
|
||||||
-->
|
|
||||||
<!-- <u-input
|
|
||||||
border="bottom"
|
|
||||||
style="width: 120px"
|
|
||||||
v-if="field.fillingWay == 'input'"
|
|
||||||
v-model="field.value"
|
|
||||||
placeholder="请输入"
|
|
||||||
/> -->
|
|
||||||
|
|
||||||
<!-- <view v-if="field.type === 'select'" class="x-bc select-my" @click="field.showPicker = true">
|
|
||||||
<text v-if="field.valueText">{{ field.valueText }}</text>
|
|
||||||
<text v-else>请选择</text>
|
|
||||||
<u-icon name="arrow-down" size="20"></u-icon>
|
|
||||||
</view>
|
|
||||||
<u-picker
|
|
||||||
v-if="field.type === 'select'"
|
|
||||||
:show="field.showPicker"
|
|
||||||
:columns="[field.options]"
|
|
||||||
keyName="dictValue"
|
|
||||||
@cancel="field.showPicker = false"
|
|
||||||
@confirm="event => dicPickerConfirm(event, field)"
|
|
||||||
/> -->
|
|
||||||
<!--普通输入框 使用文本显示-->
|
<!--普通输入框 使用文本显示-->
|
||||||
<view class="content-my-text" v-if="field.dataType != 'select'">
|
<view class="content-my-text" v-if="field.dataType != 'select'">
|
||||||
<text v-if="!field.value" class="content-my-text-placeholder">{{
|
<text v-if="!field.value" class="content-my-text-placeholder">{{
|
||||||
@@ -239,9 +200,6 @@
|
|||||||
</up-collapse-item>
|
</up-collapse-item>
|
||||||
</template>
|
</template>
|
||||||
</up-collapse>
|
</up-collapse>
|
||||||
<!-- </view>
|
|
||||||
</view> -->
|
|
||||||
<!-- </template> -->
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<u-button class="btn-operation" type="success" @click="saveDetail()">保存样品数据</u-button>
|
<u-button class="btn-operation" type="success" @click="saveDetail()">保存样品数据</u-button>
|
||||||
@@ -467,7 +425,7 @@ const autoNextSample = indexParam => {
|
|||||||
|
|
||||||
if (sample.rollbackStatus !== 'in_progress') {
|
if (sample.rollbackStatus !== 'in_progress') {
|
||||||
// 找到了合法的样品,切换
|
// 找到了合法的样品,切换
|
||||||
switchSample(index, true)
|
switchSample(index)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
index++
|
index++
|
||||||
@@ -475,16 +433,7 @@ const autoNextSample = indexParam => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//手动切换样品
|
//手动切换样品
|
||||||
const switchSample = async (index, autoFlag) => {
|
const switchSample = async index => {
|
||||||
// if (!autoFlag) {
|
|
||||||
// const shouldContinue = await tools.showPromiseModal(
|
|
||||||
// '提示',
|
|
||||||
// `请确认样品【${currentSampleData.value.sampleCode}】数据已经保存,是否继续?`
|
|
||||||
// )
|
|
||||||
// if (!shouldContinue) {
|
|
||||||
// return // 用户点了取消,直接退出
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//重置天平归0
|
//重置天平归0
|
||||||
weightDataIsToZero.value = false
|
weightDataIsToZero.value = false
|
||||||
if (index === currentSampleIndex.value) return
|
if (index === currentSampleIndex.value) return
|
||||||
@@ -725,7 +674,7 @@ const saveDetail = async () => {
|
|||||||
if (item.calcMethod === 'calculateAverageValue') {
|
if (item.calcMethod === 'calculateAverageValue') {
|
||||||
item.value = calcAverageValue(sourceKey, currentAssayType.value.tableData)
|
item.value = calcAverageValue(sourceKey, currentAssayType.value.tableData)
|
||||||
} else {
|
} 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) {
|
for (const col of currentAssayType.value.columns) {
|
||||||
@@ -758,9 +707,10 @@ const saveDetail = async () => {
|
|||||||
function calcAverageValue(fieldIndex, tableData) {
|
function calcAverageValue(fieldIndex, tableData) {
|
||||||
const rows = tableData.map(row => row[fieldIndex])
|
const rows = tableData.map(row => row[fieldIndex])
|
||||||
const decimalPosition = rows[0].decimalPosition
|
const decimalPosition = rows[0].decimalPosition
|
||||||
|
const isProject = rows[0].type === 'project'
|
||||||
const values = rows.map(row => Number(row.value))
|
const values = rows.map(row => Number(row.value))
|
||||||
if (values.some(item => item == null)) return null
|
if (values.some(item => item == null)) return null
|
||||||
return handleRoundFiveNumber(math.mean(values), decimalPosition)
|
return handleRoundFiveNumber(math.mean(values), decimalPosition, isProject)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表格数据更新后重新计算
|
// 表格数据更新后重新计算
|
||||||
@@ -991,9 +941,18 @@ function setValueToField() {
|
|||||||
field.value = value
|
field.value = value
|
||||||
let symbol = getFieldSymbol(field)
|
let symbol = getFieldSymbol(field)
|
||||||
field.symbol = symbol
|
field.symbol = symbol
|
||||||
|
if (!getField(field)) {
|
||||||
|
field.hidden = 1
|
||||||
|
} else {
|
||||||
|
field.hidden = 0
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function getField(field) {
|
||||||
|
const fieldObj = currentSampleData.value[field.fieldIndex]
|
||||||
|
return fieldObj
|
||||||
|
}
|
||||||
function getFieldValue(field) {
|
function getFieldValue(field) {
|
||||||
const fieldValue = currentSampleData.value[field.fieldIndex]?.value
|
const fieldValue = currentSampleData.value[field.fieldIndex]?.value
|
||||||
if (fieldValue) {
|
if (fieldValue) {
|
||||||
@@ -1151,12 +1110,13 @@ const listenNumKeyboard = () => {
|
|||||||
}
|
}
|
||||||
//自动补全小数位数
|
//自动补全小数位数
|
||||||
const decimalPosition = selectedField.value.decimalPosition
|
const decimalPosition = selectedField.value.decimalPosition
|
||||||
|
const isProject = selectedField.value.type === 'project'
|
||||||
let val = res.val
|
let val = res.val
|
||||||
const symbol = res.symbol
|
const symbol = res.symbol
|
||||||
if (decimalPosition == null) {
|
if (decimalPosition == null) {
|
||||||
selectedField.value.value = val
|
selectedField.value.value = val
|
||||||
} else {
|
} else {
|
||||||
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition)
|
selectedField.value.value = handleRoundFiveNumber(val, decimalPosition, isProject)
|
||||||
}
|
}
|
||||||
if (symbol) {
|
if (symbol) {
|
||||||
selectedField.value.symbol = symbol
|
selectedField.value.symbol = symbol
|
||||||
|
|||||||
@@ -331,10 +331,10 @@ function checkPropertyEquality() {
|
|||||||
for (const column of allColumns) {
|
for (const column of allColumns) {
|
||||||
const formula = column.formula
|
const formula = column.formula
|
||||||
if (!formula) continue
|
if (!formula) continue
|
||||||
for (const [key, value] of Object.entries(dynamicFormData.value)) {
|
for (const [key, value] of Object.entries(realFormData.value)) {
|
||||||
if (formula.includes(key)) {
|
if (formula.includes(key)) {
|
||||||
const originalValue = value
|
const currentValue = value
|
||||||
const currentValue = realFormData.value[key]
|
const originalValue = dynamicFormData.value[key]
|
||||||
if (!looseEqual(originalValue, currentValue)) {
|
if (!looseEqual(originalValue, currentValue)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<up-sticky>
|
<up-sticky>
|
||||||
<navbar-back title="点检">
|
<navbar-back title="设备巡检">
|
||||||
<up-button
|
<up-button
|
||||||
v-if="detailInfo.id"
|
v-if="detailInfo.id"
|
||||||
type="primary"
|
type="primary"
|
||||||
:plain="true"
|
:plain="true"
|
||||||
icon="list"
|
icon="list"
|
||||||
size="small"
|
size="small"
|
||||||
text="设备点检记录"
|
text="设备巡检记录"
|
||||||
@click="handleCheckRecord"
|
@click="handleCheckRecord"
|
||||||
></up-button>
|
></up-button>
|
||||||
</navbar-back>
|
</navbar-back>
|
||||||
@@ -16,18 +16,19 @@
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<n-scanTemp
|
<n-scanTemp
|
||||||
v-if="!detailInfo.id"
|
v-if="!detailInfo.id"
|
||||||
title="请扫描设备条码进行点检"
|
title="请扫描设备条码进行巡检"
|
||||||
icon="dailyCheck"
|
icon="dailyCheck"
|
||||||
@deviceId="id => getDailyCheckRecord(id)"
|
@deviceId="id => getDailyCheckRecord(id)"
|
||||||
|
@scanResult="result => handleScanResult(result)"
|
||||||
/>
|
/>
|
||||||
<view v-else class="content">
|
<view v-else class="content">
|
||||||
<view>
|
<view>
|
||||||
<uni-section titleFontSize="22px" type="line" title="设备点检信息">
|
<uni-section titleFontSize="22px" type="line" title="设备巡检信息">
|
||||||
<template v-slot:right>
|
<template v-slot:right>
|
||||||
<up-button
|
<up-button
|
||||||
v-if="detailInfo.submitFlag == '1'"
|
v-if="detailInfo.submitFlag == '1'"
|
||||||
type="success"
|
type="success"
|
||||||
text="新建点检"
|
text="新建巡检"
|
||||||
@click="handleCreateDailyCheck"
|
@click="handleCreateDailyCheck"
|
||||||
></up-button>
|
></up-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -43,7 +44,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<uni-section titleFontSize="22px" type="line" title="检查项"> </uni-section>
|
<uni-section titleFontSize="22px" type="line" title="检查项"> </uni-section>
|
||||||
<up-row class="p10 font-bold" style="background-color: #f5f5f5">
|
<up-row class="p10 font-bold" style="background-color: #f5f5f5">
|
||||||
<up-col span="4">点检项目</up-col>
|
<up-col span="4">巡检项目</up-col>
|
||||||
<up-col span="3">检查标准</up-col>
|
<up-col span="3">检查标准</up-col>
|
||||||
<up-col span="2"> 频次</up-col>
|
<up-col span="2"> 频次</up-col>
|
||||||
<up-col style="text-align: center" span="3">是否正常</up-col>
|
<up-col style="text-align: center" span="3">是否正常</up-col>
|
||||||
@@ -75,10 +76,10 @@
|
|||||||
<up-textarea v-model="detailInfo.content" placeholder="请输入内容"></up-textarea>
|
<up-textarea v-model="detailInfo.content" placeholder="请输入内容"></up-textarea>
|
||||||
<view class="p10">附件照片:</view>
|
<view class="p10">附件照片:</view>
|
||||||
<n-upload v-model="detailInfo.attachment" />
|
<n-upload v-model="detailInfo.attachment" />
|
||||||
<view class="p10">点检人:</view>
|
<view class="p10">巡检人:</view>
|
||||||
<up-input v-model="detailInfo.checkUserName"></up-input>
|
<up-input v-model="detailInfo.checkUserName"></up-input>
|
||||||
<view v-if="detailInfo.submitFlag == '1'">
|
<view v-if="detailInfo.submitFlag == '1'">
|
||||||
<view class="p10">点检日期:</view>
|
<view class="p10">巡检日期:</view>
|
||||||
<uni-datetime-picker type="datetime" v-model="detailInfo.checkDate" />
|
<uni-datetime-picker type="datetime" v-model="detailInfo.checkDate" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -129,32 +130,37 @@ const { lockOrientation } = useScreenOrientation()
|
|||||||
|
|
||||||
const pageLoading = ref(false)
|
const pageLoading = ref(false)
|
||||||
let detailInfo = ref({})
|
let detailInfo = ref({})
|
||||||
|
function handleScanResult(result) {
|
||||||
const { scanQRInfo } = toRefs(nx.$store('biz'))
|
const codeObj = JSON.parse(result)
|
||||||
watch(scanQRInfo, newVal => {
|
|
||||||
if (newVal && nx.$router.getCurrentPage().route == 'pages/device/deviceBusDailyCheck/index') {
|
|
||||||
try {
|
|
||||||
const codeObj = JSON.parse(newVal)
|
|
||||||
if (!pageLoading.value) {
|
if (!pageLoading.value) {
|
||||||
getDailyCheckRecord(codeObj.id)
|
getDailyCheckRecord(codeObj.id)
|
||||||
}
|
}
|
||||||
scanQRInfo.value = ''
|
}
|
||||||
} catch (error) {
|
// const { scanQRInfo } = toRefs(nx.$store('biz'))
|
||||||
scanQRInfo.value = ''
|
// watch(scanQRInfo, newVal => {
|
||||||
uni.showToast({
|
// if (newVal && nx.$router.getCurrentPage().route == 'pages/device/deviceBusDailyCheck/index') {
|
||||||
title: '请扫描设备码',
|
// try {
|
||||||
icon: 'none'
|
// const codeObj = JSON.parse(newVal)
|
||||||
})
|
// if (!pageLoading.value) {
|
||||||
}
|
// getDailyCheckRecord(codeObj.id)
|
||||||
}
|
// }
|
||||||
})
|
// scanQRInfo.value = ''
|
||||||
|
// } catch (error) {
|
||||||
|
// scanQRInfo.value = ''
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '请扫描设备码',
|
||||||
|
// icon: 'none'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
const modalText = computed(() => {
|
const modalText = computed(() => {
|
||||||
return `确定${modalType.value == '0' ? '暂存' : '提交'}吗?${modalType.value == '0' ? '' : '提交后不能修改'} `
|
return `确定${modalType.value == '0' ? '暂存' : '提交'}吗?${modalType.value == '0' ? '' : '提交后不能修改'} `
|
||||||
})
|
})
|
||||||
onShow(() => {
|
// onShow(() => {
|
||||||
scanQRInfo.value = ''
|
// scanQRInfo.value = ''
|
||||||
})
|
// })
|
||||||
let goBack = ref(false)
|
let goBack = ref(false) //设备使用前进行点检操作标记
|
||||||
onLoad(options => {
|
onLoad(options => {
|
||||||
if (options.deviceId) {
|
if (options.deviceId) {
|
||||||
goBack.value = true
|
goBack.value = true
|
||||||
@@ -211,7 +217,7 @@ function handleSubmit(type) {
|
|||||||
}
|
}
|
||||||
if (!detailInfo.value.checkUserName) {
|
if (!detailInfo.value.checkUserName) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: '请输入点检人',
|
title: '请输入巡检人',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -246,11 +252,11 @@ function handleCheckRecord() {
|
|||||||
nx.$store('biz').deviceInfo = deviceInfo
|
nx.$store('biz').deviceInfo = deviceInfo
|
||||||
nx.$router.go('/pages/device/deviceBusDailyCheck/list')
|
nx.$router.go('/pages/device/deviceBusDailyCheck/list')
|
||||||
}
|
}
|
||||||
// 新建点检
|
// 新建巡检
|
||||||
function handleCreateDailyCheck() {
|
function handleCreateDailyCheck() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '确定新建点检吗?',
|
content: '确定新建巡检吗?',
|
||||||
success: async function (res) {
|
success: async function (res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
const res = await dailyCheckApi.createDailyCheck({
|
const res = await dailyCheckApi.createDailyCheck({
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ function getLastDailyCheckOfToday(id) {
|
|||||||
})
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
pageLoading.value = false
|
pageLoading.value = false
|
||||||
nx.$router.go('/pages/deviceBusDailyCheck/index', { deviceId: id })
|
nx.$router.go('/pages/device/deviceBusDailyCheck/index', { deviceId: id })
|
||||||
} else {
|
} else {
|
||||||
getDeviceInfo(id)
|
getDeviceInfo(id)
|
||||||
await getUseIngRecord(id)
|
await getUseIngRecord(id)
|
||||||
|
|||||||
@@ -3,38 +3,37 @@
|
|||||||
<navbar-back title="实验室管理系统【设备管理】" :autoBack="false" leftIcon="" leftText="">
|
<navbar-back title="实验室管理系统【设备管理】" :autoBack="false" leftIcon="" leftText="">
|
||||||
<u-icon @click="popupShow = true" size="28" color="#FFF" name="setting-fill" />
|
<u-icon @click="popupShow = true" size="28" color="#FFF" name="setting-fill" />
|
||||||
</navbar-back>
|
</navbar-back>
|
||||||
<up-grid :border="false" :col="gridCol">
|
<up-grid :col="gridCol" :border="false">
|
||||||
<up-grid-item
|
<up-grid-item class="mb20 mt20" v-for="item in menuItemList" :key="item.id" @click="goTo(item.component)">
|
||||||
class="mb20 mt20"
|
<u-icon :name="`/static/images/menus/${item.path}.png`" color="#0055A2" size="80" />
|
||||||
v-for="(item, listIndex) in list"
|
<view class="grid-text">{{ item.name }}</view>
|
||||||
: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-item>
|
</up-grid-item>
|
||||||
</up-grid>
|
</up-grid>
|
||||||
<mePopup v-model:show="popupShow" />
|
<mePopup v-model:show="popupShow" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref, computed } from 'vue'
|
import { 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'
|
||||||
import mePopup from '@/pages/index/me-popup.vue'
|
import mePopup from '@/pages/index/me-popup.vue'
|
||||||
|
|
||||||
const { gridCol } = useGridCol([400, 600], [2, 3, 4])
|
const { gridCol } = useGridCol([400, 600], [2, 3, 4])
|
||||||
let popupShow = ref(false)
|
let popupShow = ref(false)
|
||||||
let list = reactive([
|
const menuItemList = computed(() => {
|
||||||
{ url: '/pages/device/deviceBusDailyCheck/index', name: '点检', icon: 'dailyCheck' },
|
let roleMenus = nx.$store('user').roleMenus
|
||||||
{ url: '/pages/device/deviceBusMaintain/index', name: '维护保养', icon: 'maintain' },
|
const result = roleMenus.find(item => item.path === 'device')
|
||||||
{ url: '/pages/device/deviceBusUseRecord/index', name: '使用', icon: 'useRecord' },
|
if (result) {
|
||||||
{ url: '/pages/device/deviceBusInfo/index', name: '设备查询', icon: 'baseInfo' },
|
return result.children
|
||||||
{ url: '/pages/device/knowledge/index', name: '知识库查询', icon: 'knowledge' }
|
} else {
|
||||||
])
|
return []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const roleMenus = computed(() => nx.$store('user').roleMenus)
|
// 方法
|
||||||
const userInfo = computed(() => nx.$store('user').userInfo)
|
const goTo = url => {
|
||||||
|
nx.$router.go(url)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<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