feat(src/views/reagent/weighing): 称重模块接口

duizhaopin_ui
duan 2 years ago
parent 768f4ce114
commit cfefe3f9eb

@ -0,0 +1,17 @@
import request from '@/utils/request'
export function weigh() {
return request({
url: '/api/weigh/',
method: 'get',
baseURL: process.env.VUE_APP_FACE_API
})
}
export function update_drug_remain(data) {
return request({
url: '/api/drug/update_drug_remain',
method: 'post',
data
})
}

@ -15,13 +15,13 @@
<div class="tip">精度0.01g±0.03g</div>
<div class="show-data">
<div class="top">
<span class="num">1042.56</span>
<span class="num">{{ 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">开始称重</el-button>
<el-button type="primary" @click="doWeigh"></el-button>
<el-button type="primary" plain>去皮初始化天平</el-button>
<el-input placeholder="手动输入" />
<el-button type="warning">设置为空</el-button>
@ -31,20 +31,26 @@
<div class="bottom">
<div class="title">详情信息</div>
<el-descriptions class="margin-top" :column="2" border>
<el-descriptions-item span="2" label="试剂名称">氢氧化1-(3-硫代丙基)-2-13-(3-硫代丙基)-2(3H)-苯并噻唑亚基]甲基}萘并[1.2-d]噻唑内盐,三乙基铵盐</el-descriptions-item>
<el-descriptions-item span="2" label="英文名称">1-(3-Sulfopropyl)-2-[3-(3-sulfopropyl)-2(3H)-benzothiazolylidene]methyl}naphtho1,2-djthiazolium</el-descriptions-item>
<el-descriptions-item label="条码编号">578104F3500104E0</el-descriptions-item>
<el-descriptions-item label="CAS码">226883-66-5</el-descriptions-item>
<el-descriptions-item label="试剂纯度">AR</el-descriptions-item>
<el-descriptions-item span="2" label="试剂名称">{{ infoData.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="CAS码">{{ infoData.cas_number }}</el-descriptions-item>
<el-descriptions-item label="试剂纯度">{{ infoData.purity }}</el-descriptions-item>
<el-descriptions-item label="试剂余量">578</el-descriptions-item>
<el-descriptions-item label="生产日期">2022-02-26 10:00:00</el-descriptions-item>
<el-descriptions-item label="过期日期">2023-02-26 10:00:00</el-descriptions-item>
<el-descriptions-item label="生产厂家">中国计量科学研究院</el-descriptions-item>
<el-descriptions-item label="经销商">中国计量科学研究院</el-descriptions-item>
<el-descriptions-item label="当前状态">出库</el-descriptions-item>
<el-descriptions-item label="是否监管"></el-descriptions-item>
<el-descriptions-item label="所属终端">1号柜-L2-A1</el-descriptions-item>
<el-descriptions-item label="最后使用人"><el-tag>陈小红</el-tag></el-descriptions-item>
<el-descriptions-item label="生产日期">{{ infoData.production_date }}</el-descriptions-item>
<el-descriptions-item label="过期日期">{{ infoData.expiration_date }}</el-descriptions-item>
<el-descriptions-item label="生产厂家">{{ infoData.manufacturer }}</el-descriptions-item>
<el-descriptions-item label="经销商">{{ infoData.distributor }}</el-descriptions-item>
<el-table-column align="center" property="status" label="状态">
<template slot-scope="scope">
<el-tag :type="statusColorMap[scope.row.status-1]">{{ statusMap[scope.row.status - 1] }}</el-tag>
</template>
</el-table-column>
<el-descriptions-item label="是否监管">{{ infoData.is_supervise }}</el-descriptions-item>
<el-descriptions-item label="所属终端">{{ infoData.client_id }}</el-descriptions-item>
<el-descriptions-item label="最后使用人">
<el-tag>{{ infoData.by_user_name }}</el-tag>
</el-descriptions-item>
</el-descriptions>
</div>
</div>
@ -56,6 +62,9 @@
import Scannner from '@/components/Scannner/index'
import { use } from '@/api/reagent/receivingReturn'
import stringify from '@/utils/stringify'
import { update_drug_remain, weigh } from '@/api/reagent/weight'
import { set_drug_empty_bottle } from '@/api/reagent/management'
export default {
name: 'Weighing',
components: { Scannner },
@ -64,7 +73,11 @@ export default {
headerStyle: { 'background': '#E6E6E6' },
tableData: [],
radio: '1',
barCode: ''
barCode: '',
infoData: '',
statusMap: ['在库', '出库', '空瓶'],
statusColorMap: ['success', '', 'warning'],
weight: '0.00'
}
},
watch: {
@ -73,8 +86,8 @@ export default {
barCode: function(newCode, oldCode) {
if (this.$route.name === 'Receiving') {
use(stringify({ 'bar_code': newCode })).then(res => {
this.tableData.push(res.data)
this.$message.success(res.data.name + ' 试剂领成功!')
this.infoData = res.data
this.$message.success(res.data.name + ' 试剂领扫描成功!')
})
} else {
this.dialogVisible = true
@ -87,6 +100,38 @@ export default {
methods: {
getCode(code) {
this.barCode = code
},
handleSetEmpty() {
if (this.infoData.medicament_id) {
const data = {
medicament_id: this.infoData.medicament_id
}
set_drug_empty_bottle(stringify(data)).then(res => {
this.$message.success(res.msg)
})
} else {
this.$message.warning('请选择试剂!')
}
},
doWeigh() {
weigh().then(
res => (this.weight = res.data)
)
},
updateDrugRemain() {
if (this.infoData.medicament_id) {
const data = {
'medicament_id': this.infoData.medicament_id,
'reain': this.weight
}
update_drug_remain(stringify(data)).then(
res => {
this.$message.success(res.msg)
}
)
} else {
this.$message.warning('请选择试剂!')
}
}
}
}
@ -96,16 +141,19 @@ export default {
.contents {
margin: 1rem;
display: flex;
.content {
width: 50%;
height: calc(100vh - 110px);
padding: 1rem;
background: white;
.title {
font-size: 1.25rem;
font-weight: bold;
color: #000000;
}
.tip {
width: 100%;
font-size: 0.875rem;
@ -113,13 +161,16 @@ export default {
color: #C0C4CC;
text-align: right;
}
.img {
text-align: center;
margin-top: 6rem;
img {
width: 25.25rem;
}
}
.text {
margin-top: 2rem;
text-align: center;
@ -127,8 +178,10 @@ export default {
font-weight: 400;
color: #909399;
}
.show-data {
margin-top: 1rem;
.top {
.num {
width: 660px;
@ -140,20 +193,25 @@ export default {
}
}
}
.page {
text-align: center;
}
}
.left {
margin-right: 1rem;
}
.right {
background-color: #F7F7F7;
padding: 0;
.top {
background: white;
margin-bottom: 1rem;
padding: 1rem;
.show-data {
.top {
.num {
@ -168,6 +226,7 @@ export default {
font-weight: 400;
color: #606266;
}
.unit {
font-size: 32px;
font-weight: 400;
@ -177,14 +236,17 @@ export default {
}
}
.bottom {
background: white;
padding: 1rem;
.el-input {
width: 6rem;
margin-right: 1rem;
margin-left: 1rem;
}
.title {
margin-bottom: 1rem;
}

Loading…
Cancel
Save