库存判断功能

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

@ -377,15 +377,18 @@ export default {
}, },
destroyed() { destroyed() {
// client使 // client使
client_list().then( this.get_client_list()
res => {
const cls = this.$store.getters.clientOptions
cls[this.$store.getters.classification] = res.data.data_list
this.$store.commit('app/SET_COPTS', cls)
}
)
}, },
methods: { methods: {
get_client_list() {
client_list().then(
res => {
const cls = this.$store.getters.clientOptions
cls[this.$store.getters.classification] = res.data.data_list
this.$store.commit('app/SET_COPTS', cls)
}
)
},
handleDisUser() { handleDisUser() {
if (this.multipleUserSelection.length !== 1) { if (this.multipleUserSelection.length !== 1) {
this.$message.warning('请选择一个用户!') this.$message.warning('请选择一个用户!')
@ -602,6 +605,8 @@ export default {
}) })
} }
) )
this.getList()
this.get_client_list()
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',

@ -4,17 +4,21 @@
<div class="header"> <div class="header">
<el-select v-model="client_id" placeholder="请选择柜体"> <el-select v-model="client_id" placeholder="请选择柜体">
<el-option <el-option
v-for="item in $store.getters.clientOptions" v-for="item in $store.getters.currentOptions"
:key="item.id" :key="item.id"
:label="item.client_name" :label="item.client_name"
:value="item.client_id" :value="item.client_id"
/> />
</el-select> </el-select>
<el-button type="primary" plain @click="handleAddReagent"><i class="el-icon-edit" />录入库存</el-button> <el-button type="primary" plain @click="handleAddReagent"><i class="el-icon-edit" />录入库存</el-button>
<el-button type="primary" @click="handleCheck"></el-button> <el-button type="primary" @click="handleCheck"></el-button>
<div class="header-right"> <!-- <div class="header-right">
<el-button type="primary" plain @click="handleHistory"></el-button> <el-button type="primary" plain @click="handleHistory"></el-button>
<el-button icon="el-icon-refresh" circle @click="handleRefresh" /> <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>
</div> </div>
<el-table <el-table
@ -24,54 +28,12 @@
height="69vh" height="69vh"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column <el-table-column type="selection" width="55" align="center" />
type="selection" <el-table-column align="center" type="index" width="50" label="序号" />
width="55" <el-table-column prop="create_date" show-overflow-tooltip label="录入时间" align="center" />
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 <el-table-column prop="client_name" show-overflow-tooltip label="终端名称" align="center" />
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> </el-table>
<div class="my-pagination" style="text-align: center"> <div class="my-pagination" style="text-align: center">
<el-pagination <el-pagination
@ -80,41 +42,46 @@
:current-page.sync="page" :current-page.sync="page"
:total="total" :total="total"
:page-size.sync="page_size" :page-size.sync="page_size"
@current-change="pageChange" @current-change="pageChange"
/> />
</div> </div>
<el-dialog <el-dialog
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="30%" width="30%"
height="500px"
title="录入库存" title="录入库存"
@close="onClose" @close="onClose"
> >
<div v-for="item in multipleSelection" :key="item.id" class="add-item"> <div class="box">
<div>{{ `${item.name} ${item.purity}` }}</div> <el-scrollbar style="height: 100%">
<el-input v-model.number="item.num" placement="请输入校验在库数量" /> <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>
<div slot="footer" style="text-align: center"> <div slot="footer" style="text-align: center">
<el-button @click="close"></el-button> <el-button @click="close"></el-button>
<el-button type="primary" @click="handelConfirm"></el-button> <el-button type="primary" @click="handelConfirm"></el-button>
</div> </div>
</el-dialog> </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">
<div class="header-left"> <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 <el-date-picker
v-model="value2" v-model="value2"
type="datetimerange" type="datetimerange"
@ -122,82 +89,67 @@
start-placeholder="开始日期" start-placeholder="开始日期"
end-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 <el-option
v-for="item in $store.getters.clientOptions" v-for="item in $store.getters.currentOptions"
:key="item.id" :key="item.id"
:label="item.client_name" :label="item.client_name"
:value="item.client_id" :value="item.client_id"
/> />
</el-select> </el-select>
<el-input v-model="name" placeholder="搜索试剂名称" /> <el-input v-model="name" placeholder="搜索试剂名称" />
<el-button type="primary" icon="el-icon-search" @click="searchHistory"></el-button> <el-button type="primary" icon="el-icon-search" @click="searchHistory"></el-button>
</div> </div>
</div> </div> -->
<el-table <el-dialog :close-on-click-modal="false" :visible.sync="dialogHistoryVisible" width="60%" title="库存详情">
v-loading="loadingHistory" <div class="box">
element-loading-text="拼命加载中" <el-scrollbar style="height: 100%">
:header-cell-style="headerStyle" <el-table
:data="historyData" v-loading="loadingHistory"
height="420" element-loading-text="拼命加载中"
> :header-cell-style="headerStyle"
<el-table-column align="center" property="name" label="试剂名称" /> :data="historyData"
<el-table-column align="center" property="english_name" label="英文名称" /> height="420"
<el-table-column align="center" property="bar_code" label="试剂编码" /> @close="dialogHistoryClose"
<el-table-column align="center" property="purity" label="纯度" /> >
<el-table-column align="center" property="cas_number" label="CAS码" /> <el-table-column align="center" type="index" width="50" label="序号" />
<el-table-column align="center" property="use_quantity" label="用量" /> <el-table-column align="center" property="name" label="试剂名称" />
<el-table-column align="center" property="create_date" label="归还时间" /> <el-table-column align="center" property="purity" label="纯度" />
<el-table-column align="center" property="create_user_name" label="操作人员" /> <el-table-column align="center" property="speci" label="规格" />
<el-table-column align="center" property="client_id" label="所属终端" /> <el-table-column align="center" property="purity" label="纯度" />
</el-table> <el-table-column align="center" property="input_num" label="录入量" />
<div class="my-pagination" style="text-align: center"> <el-table-column align="center" property="stock_num" label="库存量" />
<el-pagination <el-table-column align="center" property="difference_num" label="相差值" />
background </el-table>
layout="prev, pager, next" </el-scrollbar>
:current-page.sync="history_page"
:total="history_total"
:page-size.sync="history_page_size"
@current-change="pageChange"
/>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <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 { export default {
name: 'Inventory', name: 'Inventory',
data() { data() {
return { return {
// drugStockForm:[],
page: 1, page: 1,
page_size: 15, page_size: 15,
total: 100, total: 0,
client_id: '', client_id: '',
dialogVisible: false, dialogVisible: false,
tableData: [ 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
}
],
headerStyle: { 'background': '#E6E6E6' }, headerStyle: { 'background': '#E6E6E6' },
multipleSelection: [], multipleSelection: [],
handleSelectionSelection: [],
dialogHistoryVisible: false, dialogHistoryVisible: false,
loadingHistory: false, loadingHistory: false,
historyData: [], historyData: [],
@ -210,38 +162,112 @@ export default {
history_total: 100 history_total: 100
} }
}, },
created () {
this.client_id = this.$store.getters.currentOptions[0].client_id
this.get_stock_list()
},
methods: { 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) { pageChange(page) {
this.page = page this.page = page
this.get_stock_list()
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val this.handleSelectionSelection = val
},
handleHistory() {
this.dialogHistoryVisible = true
}, },
// handleHistory() {
// this.dialogHistoryVisible = true
// },
handleRefresh() { 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() { handleAddReagent() {
if (this.multipleSelection.length === 0) { const data = {
this.$message.warning('请选择试剂!') client_id: this.client_id
return
} }
get_drug_list(stringify(data)).then(rsp => {
this.multipleSelection = rsp.data
})
this.dialogVisible = true this.dialogVisible = true
}, },
// //
handleCheck() { 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() { onClose() {
this.multipleSelection = []
}, },
close() { close() {
this.dialogVisible = false this.dialogVisible = false
this.multipleSelection = []
}, },
handelConfirm() { 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() { searchHistory() {
@ -285,3 +311,20 @@ export default {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
</style> </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-form-item>
</el-col> </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-col :span="12">
<el-form-item label="规格" prop="speci"> <el-form-item label="规格" prop="speci">
<el-input v-model="formData.speci" placeholder="请输入规格" clearable :style="{width: '100%'}" /> <el-input v-model="formData.speci" placeholder="请输入规格" clearable :style="{width: '100%'}" />

Loading…
Cancel
Save