feat(src/views/reagent/weighing/index.vue): 修改交互逻辑

duizhaopin_ui
duan 2 years ago
parent 81349b956f
commit 9cdad88740

@ -21,7 +21,7 @@
<div class="bottom"> <div class="bottom">
<el-radio v-model="radio" label="1"></el-radio> <el-radio v-model="radio" label="1"></el-radio>
<el-radio v-model="radio" label="2"></el-radio> <el-radio v-model="radio" label="2"></el-radio>
<el-button type="primary" @click="doWeigh"></el-button> <el-button type="primary" @click="updateDrugRemain"></el-button>
<el-button type="primary" plain @click="doTare"></el-button> <el-button type="primary" plain @click="doTare"></el-button>
<el-input v-model="inputWeigh" placeholder="手动输入" /> <el-input v-model="inputWeigh" placeholder="手动输入" />
<el-button type="warning">设置为空</el-button> <el-button type="warning">设置为空</el-button>
@ -31,7 +31,10 @@
<div class="bottom"> <div class="bottom">
<div class="title">详情信息</div> <div class="title">详情信息</div>
<el-descriptions class="margin-top" :column="2" border> <el-descriptions class="margin-top" :column="2" border>
<el-descriptions-item label-style="width:100px" span="2" label="试剂名称">{{ infoData.name }}</el-descriptions-item> <el-descriptions-item label-style="width:100px" span="2" label="试剂名称">{{
infoData.name
}}
</el-descriptions-item>
<el-descriptions-item span="2" label="英文名称">{{ infoData.english_name }}</el-descriptions-item> <el-descriptions-item span="2" label="英文名称">{{ infoData.english_name }}</el-descriptions-item>
<el-descriptions-item label="条码编号">{{ infoData.bar_code }}</el-descriptions-item> <el-descriptions-item label="条码编号">{{ infoData.bar_code }}</el-descriptions-item>
<el-descriptions-item label-style="width:100px" label="CAS码">{{ infoData.cas_number }}</el-descriptions-item> <el-descriptions-item label-style="width:100px" label="CAS码">{{ infoData.cas_number }}</el-descriptions-item>
@ -85,24 +88,29 @@ export default {
// `barCode` // `barCode`
// //
barCode: function(newCode, oldCode) { barCode: function(newCode, oldCode) {
get_drug_info(stringify({ 'bar_code': newCode })).then(res => { this.getDrugInfo(newCode)
this.infoData = res.data
this.$message.success(res.data.name + ' 试剂领扫描成功!')
})
} }
}, },
mounted() { mounted() {
// (1000*60*60=>**60) // (1000*60*60=>**60)
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.doWeigh() this.doWeigh()
}, 200) }, 500)
this.doZero() // this.doZero()
}, },
destroyed() { destroyed() {
if (this.timer) {
clearInterval(this.timer) clearInterval(this.timer)
}
}, },
methods: { methods: {
getDrugInfo(code) {
get_drug_info(stringify({ 'bar_code': code })).then(res => {
this.infoData = res.data
this.$message.success(res.data.name + ' 试剂领扫描成功!')
})
},
checkInputWeigh() { checkInputWeigh() {
const w = parseFloat(this.inputWeigh) const w = parseFloat(this.inputWeigh)
return !!w return !!w
@ -158,11 +166,12 @@ export default {
const w = this.checkInputWeigh() const w = this.checkInputWeigh()
const data = { const data = {
'medicament_id': this.infoData.medicament_id, 'medicament_id': this.infoData.medicament_id,
'reain': w ? parseFloat(this.inputWeigh) : this.weight 'remain': w ? parseFloat(this.inputWeigh) : this.weight
} }
update_drug_remain(stringify(data)).then( update_drug_remain(stringify(data)).then(
res => { res => {
this.$message.success(res.msg) this.$message.success(res.msg)
this.getDrugInfo(this.infoData.bar_code)
} }
) )
} else { } else {

Loading…
Cancel
Save