库存判断功能

duizhaopin_ui
13507605001 2 years ago
parent 0e8d97225c
commit 43e8b89fc9

@ -0,0 +1,46 @@
import request from '@/utils/request'
// /api/stock/getlist
export function get_list(data) {
return request({
url: '/api/stock/getlist',
method: 'post',
data
})
}
// /api/stock/get_drug_list
export function get_drug_list(data) {
return request({
url: '/api/stock/get_drug_list',
method: 'post',
data
})
}
// /api/stock/set_stock
export function set_stock(data) {
return request({
url: '/api/stock/set_stock',
method: 'post',
data
})
}
// /api/stock/get_stock_info
export function get_stock_info(data) {
return request({
url: '/api/stock/get_stock_info',
method: 'post',
data
})
}
// /api/stock/del_stock
export function del_stock(data) {
return request({
url: '/api/stock/del_stock',
method: 'post',
data
})
}

@ -172,8 +172,16 @@ export default {
trigger: 'blur',
type: 'number'
}],
production_date: [],
expiration_date: [],
production_date: [{
required: true,
message: '请输入生产日期',
trigger: 'blur'
}],
expiration_date: [{
required: true,
message: '请输入过期日期',
trigger: 'blur'
}],
manufacturer: [],
distributor: [],
speci: [{
@ -181,7 +189,17 @@ export default {
message: '请输入规格',
trigger: 'blur'
}],
total: []
total: [{
required: true,
message: '请输入单位',
trigger: 'blur'
}],
net_weight_unit: [{
required: true,
message: '请输入预估质量',
trigger: 'blur'
}
]
},
extra_form: []
}
@ -219,7 +237,7 @@ export default {
},
createStateFilter(queryString) {
return (state) => {
return (state.name.toLowerCase().indexOf(queryString.toLowerCase()) >= 0)
return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) >= 1)
}
},
handleSelect(item) {

@ -377,6 +377,10 @@ export default {
},
destroyed() {
// client使
this.get_client_list()
},
methods: {
get_client_list() {
client_list().then(
res => {
const cls = this.$store.getters.clientOptions
@ -385,7 +389,6 @@ export default {
}
)
},
methods: {
handleDisUser() {
if (this.multipleUserSelection.length !== 1) {
this.$message.warning('请选择一个用户!')
@ -602,6 +605,8 @@ export default {
})
}
)
this.getList()
this.get_client_list()
}).catch(() => {
this.$message({
type: 'info',

@ -4,17 +4,21 @@
<div class="header">
<el-select v-model="client_id" placeholder="请选择柜体">
<el-option
v-for="item in $store.getters.clientOptions"
v-for="item in $store.getters.currentOptions"
:key="item.id"
:label="item.client_name"
:value="item.client_id"
/>
</el-select>
<el-button type="primary" plain @click="handleAddReagent"><i class="el-icon-edit" />录入库存</el-button>
<el-button type="primary" @click="handleCheck"></el-button>
<div class="header-right">
<el-button type="primary" @click="handleCheck"></el-button>
<!-- <div class="header-right">
<el-button type="primary" plain @click="handleHistory"></el-button>
<el-button icon="el-icon-refresh" circle @click="handleRefresh" />
</div> -->
<div class="header-right">
<el-button icon="el-icon-delete" circle @click="handleDel" />
<el-button icon="el-icon-refresh" circle @click="handleRefresh" />
</div>
</div>
<el-table
@ -24,54 +28,12 @@
height="69vh"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
align="center"
/>
<el-table-column
align="center"
type="index"
width="50"
label="序号"
/>
<el-table-column
prop="name"
show-overflow-tooltip
label="试剂名称"
align="center"
/>
<el-table-column
prop="purity"
label="纯度"
align="center"
/>
<el-table-column
show-overflow-tooltip
prop="address"
label="人工录入库存量"
align="center"
/>
<el-table-column
prop="address"
label="系统校验库存量"
align="center"
/>
<el-table-column
prop="address"
label="校验结果"
align="center"
/>
<el-table-column
prop="address"
label="操作用户"
align="center"
/>
<el-table-column
prop="address"
label="最新一次校验时间"
align="center"
/>
<el-table-column type="selection" width="55" align="center" />
<el-table-column align="center" type="index" width="50" label="序号" />
<el-table-column prop="create_date" show-overflow-tooltip label="录入时间" align="center" />
<el-table-column prop="user_name" show-overflow-tooltip label="录入人" align="center" />
<el-table-column prop="medicament_info" show-overflow-tooltip label="信息详情" align="center" />
<el-table-column prop="client_name" show-overflow-tooltip label="终端名称" align="center" />
</el-table>
<div class="my-pagination" style="text-align: center">
<el-pagination
@ -80,41 +42,46 @@
:current-page.sync="page"
:total="total"
:page-size.sync="page_size"
@current-change="pageChange"
/>
</div>
<el-dialog
:close-on-click-modal="false"
:visible.sync="dialogVisible"
width="30%"
height="500px"
title="录入库存"
@close="onClose"
>
<div v-for="item in multipleSelection" :key="item.id" class="add-item">
<div>{{ `${item.name} ${item.purity}` }}</div>
<el-input v-model.number="item.num" placement="请输入校验在库数量" />
<div class="box">
<el-scrollbar style="height: 100%">
<el-form>
<div v-for="(item, index) in multipleSelection" :key="index">
<el-col :span="24">
<el-form-item :label="item.name" prop="input_num">
<el-input
v-model="item.input_num"
placeholder="请输入数量"
clearable
type="number"
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
</div>
</el-form>
</el-scrollbar>
</div>
<div slot="footer" style="text-align: center">
<el-button @click="close"></el-button>
<el-button type="primary" @click="handelConfirm"></el-button>
</div>
</el-dialog>
<el-dialog :close-on-click-modal="false" :visible.sync="dialogHistoryVisible" width="60%" title="历史记录">
<!-- <el-dialog :close-on-click-modal="false" :visible.sync="dialogHistoryVisible" width="60%" title="历史记录">
<div class="header">
<div class="header-left">
<!-- <el-date-picker-->
<!-- v-model="value1"-->
<!-- type="date"-->
<!-- placeholder="选择日期">-->
<!-- </el-date-picker>-->
<!-- <el-time-picker-->
<!-- v-model="value2"-->
<!-- is-range-->
<!-- range-separator="至"-->
<!-- start-placeholder="开始时间"-->
<!-- end-placeholder="结束时间"-->
<!-- placeholder="选择时间范围">-->
<!-- </el-time-picker>-->
<el-date-picker
v-model="value2"
type="datetimerange"
@ -122,9 +89,9 @@
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
<el-select v-model="history_client_id" class="header-select" placeholder="请选择柜体">
<el-select v-model="client_id" class="header-select" placeholder="请选择柜体">
<el-option
v-for="item in $store.getters.clientOptions"
v-for="item in $store.getters.currentOptions"
:key="item.id"
:label="item.client_name"
:value="item.client_id"
@ -133,71 +100,56 @@
<el-input v-model="name" placeholder="搜索试剂名称" />
<el-button type="primary" icon="el-icon-search" @click="searchHistory"></el-button>
</div>
</div>
</div> -->
<el-dialog :close-on-click-modal="false" :visible.sync="dialogHistoryVisible" width="60%" title="库存详情">
<div class="box">
<el-scrollbar style="height: 100%">
<el-table
v-loading="loadingHistory"
element-loading-text="拼命加载中"
:header-cell-style="headerStyle"
:data="historyData"
height="420"
@close="dialogHistoryClose"
>
<el-table-column align="center" type="index" width="50" label="序号" />
<el-table-column align="center" property="name" label="试剂名称" />
<el-table-column align="center" property="english_name" label="英文名称" />
<el-table-column align="center" property="bar_code" label="试剂编码" />
<el-table-column align="center" property="purity" label="纯度" />
<el-table-column align="center" property="cas_number" label="CAS码" />
<el-table-column align="center" property="use_quantity" label="用量" />
<el-table-column align="center" property="create_date" label="归还时间" />
<el-table-column align="center" property="create_user_name" label="操作人员" />
<el-table-column align="center" property="client_id" label="所属终端" />
<el-table-column align="center" property="speci" label="规格" />
<el-table-column align="center" property="purity" label="纯度" />
<el-table-column align="center" property="input_num" label="录入量" />
<el-table-column align="center" property="stock_num" label="库存量" />
<el-table-column align="center" property="difference_num" label="相差值" />
</el-table>
<div class="my-pagination" style="text-align: center">
<el-pagination
background
layout="prev, pager, next"
:current-page.sync="history_page"
:total="history_total"
:page-size.sync="history_page_size"
@current-change="pageChange"
/>
</el-scrollbar>
</div>
</el-dialog>
</div>
</template>
<script>
import {
get_list,
get_drug_list,
set_stock,
del_stock,
get_stock_info
} from '@/api/reagent/drugStock'
import stringify from '@/utils/stringify'
export default {
name: 'Inventory',
data() {
return {
// drugStockForm:[],
page: 1,
page_size: 15,
total: 100,
total: 0,
client_id: '',
dialogVisible: false,
tableData: [
{
id: 1,
name: '硫酸',
purity: 'AR',
num: 0
},
{
id: 2,
name: '硼氢化钾',
purity: 'AR',
num: 0
},
{
id: 3,
name: '氢氧化1-(3-硫代丙基)-2-13-(3-硫代丙基)-2(3H)-苯并噻唑亚' +
'基]甲基}萘并[1.2-d]噻唑内盐,三乙基铵盐AR',
purity: 'AR',
num: 0
}
],
tableData: [],
headerStyle: { 'background': '#E6E6E6' },
multipleSelection: [],
handleSelectionSelection: [],
dialogHistoryVisible: false,
loadingHistory: false,
historyData: [],
@ -210,38 +162,112 @@ export default {
history_total: 100
}
},
created () {
this.client_id = this.$store.getters.currentOptions[0].client_id
this.get_stock_list()
},
methods: {
get_stock_list: function() {
const data = {
client_id: this.client_id,
page:this.page,
page_size: this.page_size
}
get_list(stringify(data)).then(rsp => {
this.tableData = rsp.data.data_list
this.total = rsp.data.total_count
})
},
pageChange(page) {
this.page = page
this.get_stock_list()
},
handleSelectionChange(val) {
this.multipleSelection = val
},
handleHistory() {
this.dialogHistoryVisible = true
this.handleSelectionSelection = val
},
// handleHistory() {
// this.dialogHistoryVisible = true
// },
handleRefresh() {
this.get_stock_list()
},
handleDel() {
if (this.handleSelectionSelection.length === 1) {
const data = {
id:this.handleSelectionSelection[0].id
}
del_stock(stringify(data)).then(rsp => {
if (rsp.status === 0) {
this.$message.success("删除成功!")
this.get_stock_list()
} else {
this.$message.error(rsp.msg)
}
})
} else {
this.$message.warning("选择一条记录操作")
}
},
//
handleAddReagent() {
if (this.multipleSelection.length === 0) {
this.$message.warning('请选择试剂!')
return
const data = {
client_id: this.client_id
}
get_drug_list(stringify(data)).then(rsp => {
this.multipleSelection = rsp.data
})
this.dialogVisible = true
},
//
//
handleCheck() {
if (this.handleSelectionSelection.length === 1) {
this.dialogHistoryVisible = true
const data = {
id:this.handleSelectionSelection[0].id
}
get_stock_info(stringify(data)).then(rsp => {
if (rsp.status === 0) {
this.historyData = rsp.data
} else {
this.$message.error(rsp.msg)
}
})
} else {
this.$message.warning("选择一条记录操作!")
}
},
dialogHistoryClose() {
this.dialogHistoryVisible = false
this.historyData = []
},
onClose() {
this.multipleSelection = []
},
close() {
this.dialogVisible = false
this.multipleSelection = []
},
handelConfirm() {
const stock_info = {}
for (let i = 0; i < this.multipleSelection.length; i++) {
stock_info[this.multipleSelection[i].name] = this.multipleSelection[i].input_num == "" ? 0: parseInt(this.multipleSelection[i].input_num)
}
const data = {
stock_info: JSON.stringify(stock_info),
client_id: this.client_id,
client_code: this.client_code
}
set_stock(stringify(data)).then(rsp => {
console.log(rsp)
if (rsp.status == 0) {
this.$message.success(rsp.msg)
this.dialogVisible = false
this.get_stock_list()
} else {
this.$message.error(rsp.msg)
}
})
},
searchHistory() {
@ -285,3 +311,20 @@ export default {
margin-bottom: 1rem;
}
</style>
<style>
/* 1,必须去掉scoped否则overflow-x: hidden失效 */
.box {
margin: 0 auto;
width: 95%;
height: 95%;
}
/* 2外包一个div,来减少对其他页面会有冲突此时缺少scoped */
.box .el-scrollbar__wrap {
overflow-x: hidden;
}
.el-dialog__body {
height: 500px;
}
</style>

@ -392,31 +392,6 @@
/>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="出库预警天数" prop="use_days_warning_value">-->
<!-- <el-input-->
<!-- v-model="formData.use_days_warning_value"-->
<!-- placeholder="请输入出库预警天数"-->
<!-- clearable-->
<!-- :style="{width: '100%'}"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="保质期预警天数" prop="shelf_life_warning_value">-->
<!-- <el-input-->
<!-- v-model="formData.shelf_life_warning_value"-->
<!-- placeholder="请输入保质期预警天数"-->
<!-- clearable-->
<!-- :style="{width: '100%'}"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="预警量" prop="inventory_warning_value">-->
<!-- <el-input v-model="formData.inventory_warning_value" placeholder="请输入预警量" clearable :style="{width: '100%'}" />-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="12">
<el-form-item label="规格" prop="speci">
<el-input v-model="formData.speci" placeholder="请输入规格" clearable :style="{width: '100%'}" />

Loading…
Cancel
Save