From 9cdad88740e869536593c66c35ec225801b684bc Mon Sep 17 00:00:00 2001 From: duan Date: Fri, 9 Sep 2022 08:38:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(src/views/reagent/weighing/index.vue):=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/reagent/weighing/index.vue | 29 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/views/reagent/weighing/index.vue b/src/views/reagent/weighing/index.vue index d6127a2..7104569 100644 --- a/src/views/reagent/weighing/index.vue +++ b/src/views/reagent/weighing/index.vue @@ -21,7 +21,7 @@
余量称重 用量称重 - 开始称重 + 更新重量 去皮(初始化天平) 设置为空 @@ -31,7 +31,10 @@
详情信息
- {{ infoData.name }} + {{ + infoData.name + }} + {{ infoData.english_name }} {{ infoData.bar_code }} {{ infoData.cas_number }} @@ -85,24 +88,29 @@ export default { // 如果 `barCode` 发生改变,这个函数就会运行 // 扫码后提交后台并自动选择下一行 barCode: function(newCode, oldCode) { - get_drug_info(stringify({ 'bar_code': newCode })).then(res => { - this.infoData = res.data - this.$message.success(res.data.name + ' 试剂领扫描成功!') - }) + this.getDrugInfo(newCode) } }, mounted() { // 自动刷新获取数据(1000*60*60=>毫秒*秒*分钟,此时表示为60分钟) this.timer = setInterval(() => { this.doWeigh() - }, 200) - this.doZero() + }, 500) + // this.doZero() }, destroyed() { - clearInterval(this.timer) + if (this.timer) { + clearInterval(this.timer) + } }, methods: { + getDrugInfo(code) { + get_drug_info(stringify({ 'bar_code': code })).then(res => { + this.infoData = res.data + this.$message.success(res.data.name + ' 试剂领扫描成功!') + }) + }, checkInputWeigh() { const w = parseFloat(this.inputWeigh) return !!w @@ -158,11 +166,12 @@ export default { const w = this.checkInputWeigh() const data = { '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( res => { this.$message.success(res.msg) + this.getDrugInfo(this.infoData.bar_code) } ) } else {