|
|
|
@ -15,15 +15,15 @@
|
|
|
|
|
<div class="tip">精度:0.01g±0.03g</div>
|
|
|
|
|
<div class="show-data">
|
|
|
|
|
<div class="top">
|
|
|
|
|
<span class="num">{{ weight }}</span>
|
|
|
|
|
<span class="num">{{ checkInputWeigh() ? parseFloat(inputWeigh) : weight }}</span>
|
|
|
|
|
<span class="unit">克(g)</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="bottom">
|
|
|
|
|
<el-radio v-model="radio" label="1">余量称重</el-radio>
|
|
|
|
|
<el-radio v-model="radio" label="2">用量称重</el-radio>
|
|
|
|
|
<el-button type="primary" @click="doWeigh">开始称重</el-button>
|
|
|
|
|
<el-button type="primary" plain>去皮(初始化天平)</el-button>
|
|
|
|
|
<el-input placeholder="手动输入" />
|
|
|
|
|
<el-button type="primary" plain @click="doTare">去皮(初始化天平)</el-button>
|
|
|
|
|
<el-input v-model="inputWeigh" placeholder="手动输入" />
|
|
|
|
|
<el-button type="warning">设置为空</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -61,7 +61,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
import stringify from '@/utils/stringify'
|
|
|
|
|
import Scannner from '@/components/Scannner/index'
|
|
|
|
|
import { update_drug_remain, weigh, get_drug_info } from '@/api/reagent/weight'
|
|
|
|
|
import { update_drug_remain, weigh, get_drug_info, tare, zero } from '@/api/reagent/weight'
|
|
|
|
|
import { set_drug_empty_bottle } from '@/api/reagent/management'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
@ -76,7 +76,9 @@ export default {
|
|
|
|
|
infoData: '',
|
|
|
|
|
statusMap: ['在库', '出库', '空瓶'],
|
|
|
|
|
statusColorMap: ['success', '', 'warning'],
|
|
|
|
|
weight: '0.00'
|
|
|
|
|
weight: '0.00',
|
|
|
|
|
timer: undefined,
|
|
|
|
|
inputWeigh: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
@ -89,10 +91,56 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
// 自动刷新获取数据(1000*60*60=>毫秒*秒*分钟,此时表示为60分钟)
|
|
|
|
|
this.timer = setInterval(() => {
|
|
|
|
|
this.doWeigh()
|
|
|
|
|
}, 200)
|
|
|
|
|
this.doZero()
|
|
|
|
|
},
|
|
|
|
|
destroyed() {
|
|
|
|
|
clearInterval(this.timer)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
checkInputWeigh() {
|
|
|
|
|
const w = parseFloat(this.inputWeigh)
|
|
|
|
|
return !!w
|
|
|
|
|
},
|
|
|
|
|
getCode(code) {
|
|
|
|
|
this.barCode = code
|
|
|
|
|
},
|
|
|
|
|
doWeigh() {
|
|
|
|
|
weigh().then(
|
|
|
|
|
res => {
|
|
|
|
|
let weigh = null
|
|
|
|
|
if (res.data) {
|
|
|
|
|
weigh = parseFloat(res.data)
|
|
|
|
|
// 余量称重
|
|
|
|
|
if (this.radio === '1') {
|
|
|
|
|
this.weight = weigh
|
|
|
|
|
} else {
|
|
|
|
|
// 用量称重
|
|
|
|
|
this.weight = parseFloat(this.infoData.remain) - weigh
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
doTare() {
|
|
|
|
|
tare().then(
|
|
|
|
|
res => {
|
|
|
|
|
this.$message.success('去皮操作成功')
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
doZero() {
|
|
|
|
|
zero().then(
|
|
|
|
|
res => {
|
|
|
|
|
this.$message.success('清零成功')
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
handleSetEmpty() {
|
|
|
|
|
if (this.infoData.medicament_id) {
|
|
|
|
|
const data = {
|
|
|
|
@ -105,16 +153,12 @@ export default {
|
|
|
|
|
this.$message.warning('请选择试剂!')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
doWeigh() {
|
|
|
|
|
weigh().then(
|
|
|
|
|
res => (this.weight = res.data)
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
updateDrugRemain() {
|
|
|
|
|
if (this.infoData.medicament_id) {
|
|
|
|
|
const w = this.checkInputWeigh()
|
|
|
|
|
const data = {
|
|
|
|
|
'medicament_id': this.infoData.medicament_id,
|
|
|
|
|
'reain': this.weight
|
|
|
|
|
'reain': w ? parseFloat(this.inputWeigh) : this.weight
|
|
|
|
|
}
|
|
|
|
|
update_drug_remain(stringify(data)).then(
|
|
|
|
|
res => {
|
|
|
|
|