<template>
|
<div class="app-container">
|
<div style="display: flex;justify-content: space-between">
|
<el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" >
|
<el-form-item>
|
<el-button
|
type="primary"
|
plain
|
icon="Plus"
|
@click="openDialog('add',{})"
|
>订单入库</el-button>
|
</el-form-item>
|
<el-form-item label="申购单号:" >
|
<el-input v-model="data.queryParams.subscribeNum" placeholder="请输入申购单号" clearable></el-input>
|
</el-form-item>
|
<el-form-item label="主柜:" prop="warehouseName" >
|
<el-select
|
clearable
|
v-model="data.warehouseName"
|
filterable
|
remote
|
reserve-keyword
|
placeholder="请输入所入主柜"
|
remote-show-suffix
|
:remote-method="getWareHouseList"
|
style="width: 100%"
|
@change="selectWareValue"
|
>
|
<el-option
|
v-for="item in data.wareHouseList"
|
:key="item.id"
|
:label="item.name"
|
:value="item.name"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="副柜:" prop="cupboardId" >
|
<el-select
|
clearable
|
v-model="data.queryParams.cupboardId"
|
placeholder="请选择副柜"
|
style="width: 100%"
|
>
|
<el-option
|
|
v-for="item in data.cupList"
|
:key="item.id"
|
:label="item.cupboardName"
|
:value="item.id"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item >
|
<el-button
|
type="primary"
|
@click="getList"
|
>查询</el-button>
|
<el-button
|
type="primary"
|
plain
|
@click="reset"
|
>重置</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<!-- 表格数据 -->
|
<el-table v-loading="loading" :data="dataList" :border="true">
|
<el-table-column label="序号" type="index" align="center" width="80" />
|
<el-table-column label="申购单号" prop="subscribeNum" align="center" />
|
<el-table-column label="危化品名称" align="center" class-name="subscribe-quantity-cell">
|
<template #default="scope">
|
<div style="width: 100%; height: 100%;display: flex; flex-direction: column;justify-content: center;align-items: center; ">
|
<div
|
v-for="(item, index) in scope.row.subscribe.subscribeHazmats"
|
:key="item.id"
|
style="
|
width: 100%;
|
text-align: center;
|
height: 70px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
border-bottom: 1px solid #ebeef5;"
|
:style="{
|
borderBottom: index === scope.row.subscribe.subscribeHazmats.length - 1 ? 'none' : '1px solid #ebeef5'
|
}"
|
>
|
<span>{{ item.hazmatName }}</span>
|
</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="入库数量" prop="num" align="center" class-name="subscribe-quantity-cell">
|
<template #default="scope">
|
<div style="width: 100%; height: 100%;display: flex; flex-direction: column;justify-content: center;align-items: center; ">
|
<div
|
v-for="(item, index) in scope.row.subscribe.subscribeHazmats"
|
style="
|
width: 100%;
|
text-align: center;
|
height: 70px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
border-bottom: 1px solid #ebeef5;"
|
:style="{
|
borderBottom: index === scope.row.subscribe.subscribeHazmats.length - 1 ? 'none' : '1px solid #ebeef5'
|
}"
|
>
|
{{ item.hazmatCount }}
|
</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="主柜" prop="warehouse.name" align="center" />
|
<el-table-column label="副柜" prop="cupboard.cupboardName" align="center" width="120" />
|
<el-table-column label="批号" prop="batchNo" align="center" width="120" />
|
<el-table-column label="状态" prop="state" align="center">
|
<template #default="scope">
|
<span>{{scope.row.state === 0 ? '未入库' : '已入库'}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" >
|
<template #default="scope">
|
<el-button link type="primary" v-if="scope.row.state == 1" @click="toDetail(scope.row)">查看详情</el-button>
|
<el-button link type="primary" v-if="scope.row.state == 0" @click="doEntry(scope.row)">入库</el-button>
|
<!-- <el-button link type="primary" v-if="scope.row.state == 1" @click="printCode(scope.row)">打印二维码</el-button>-->
|
<el-button link type="primary" @click="openDialog('edit',scope.row)" v-if="scope.row.state == 0">编辑</el-button>
|
<el-button link type="danger" @click="handleDelete(scope.row)" v-if="scope.row.state == 0">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<pagination
|
v-show="total > 0"
|
:total="total"
|
v-model:page="queryParams.pageNum"
|
v-model:limit="queryParams.pageSize"
|
@pagination="getList"
|
/>
|
|
<orderDialog ref="dialogRef" @getList=getList></orderDialog>
|
</div>
|
</template>
|
|
<script setup>
|
import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
import orderDialog from './components/orderDialog.vue'
|
import {delRawRecord, doEntryRaw, getRawRecord, getRawWarehouseRecord} from "@/api/hazardousChemicals/rawRecord";
|
import {useRoute, useRouter} from "vue-router";
|
import {getCupById, getWarehouse} from "@/api/hazardousChemicals/warehouse";
|
import {delOrder, getOrderList, intoOrder} from "@/api/hazardousChemicals/orderWarehouse";
|
const { proxy } = getCurrentInstance();
|
const loading = ref(false);
|
const dialogRef = ref();
|
const codeRef = ref();
|
const codeMoreRef = ref();
|
const router = useRouter()
|
const route = useRoute()
|
const dialogVisible =ref(false)
|
const data = reactive({
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
subscribeNum: '',
|
cupboardId: null,
|
warehouseId: null
|
},
|
warehouseName:'',
|
total: 0,
|
dataList: [],
|
wareHouseList: [],
|
cupList: []
|
|
});
|
|
const { queryParams, total, dataList } = toRefs(data);
|
const classHourRef = ref();
|
onMounted(()=>{
|
getList()
|
getWareHouseList("")
|
})
|
|
const getList = async () => {
|
loading.value = true
|
const res = await getOrderList(data.queryParams)
|
if(res.code == 200){
|
data.dataList = res.data.list.filter(i => i.subscribeNum )
|
data.total = res.data.total
|
}else{
|
ElMessage.warning(res.message)
|
}
|
loading.value = false
|
}
|
|
const openDialog = (type, value) => {
|
dialogRef.value.openDialog(type, value);
|
}
|
|
/** 重置新增的表单以及其他数据 */
|
function reset() {
|
data.queryParams = {
|
pageNum: 1,
|
pageSize: 10,
|
subscribeNum: '',
|
cupboardId: null,
|
warehouseId: null
|
}
|
data.warehouseName = ''
|
data.cupList = []
|
|
getList()
|
getWareHouseList("")
|
|
}
|
const handleDelete = (val) => {
|
ElMessageBox.confirm(
|
'确定删除此条数据?',
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
})
|
.then( async() => {
|
const res = await delOrder(val.id)
|
if(res.code == 200){
|
ElMessage.success('数据删除成功')
|
await getList()
|
}else{
|
ElMessage.warning(res.message)
|
}
|
})
|
}
|
|
const doEntry = (val) => {
|
ElMessageBox.confirm(
|
'确定入库该危化品?',
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
})
|
.then( async() => {
|
const res = await intoOrder(val.id)
|
if(res.code == 200){
|
ElMessage.success('入库成功')
|
await getList()
|
}else{
|
ElMessage.warning(res.message)
|
}
|
})
|
}
|
|
const entryItem = ref()
|
const printCode = (val) => {
|
console.log("val",val)
|
entryItem.value = val
|
dialogVisible.value = true
|
|
// codeRef.value.openDialog('raw',val);
|
|
}
|
const openPrint = (type) => {
|
if(type === 'one'){
|
codeRef.value.openDialog('raw',entryItem.value);
|
}else {
|
codeMoreRef.value.openDialog('raw',entryItem.value);
|
}
|
|
}
|
const toDetail = (val) => {
|
const obj = {
|
pageNum: data.queryParams.pageNum,
|
pageSize: data.queryParams.pageSize,
|
entryId: val.id,
|
}
|
const v = JSON.stringify(obj)
|
router.push({ path: "/whRawDetailNew", query: { val: v } });
|
}
|
|
const getWareHouseList = async (val) => {
|
let param = {}
|
if(val != ""){
|
param = {
|
name: val
|
}
|
}else {
|
param = {
|
pageNum: 1,
|
pageSize: 10
|
}
|
}
|
const res = await getWarehouse(param)
|
if(res.code == 200){
|
data.wareHouseList = res.data.list
|
}else{
|
ElMessage.warning(res.message)
|
}
|
}
|
const selectWareValue = (val) => {
|
data.queryParams.cupboardId = null
|
data.wareHouseList.forEach(item => {
|
if(item.name === val){
|
data.queryParams.warehouseId = item.id
|
getCupList(item.id)
|
}
|
})
|
}
|
const getCupList = async (val) => {
|
const res = await getCupById(val)
|
if(res.code == 200) {
|
data.cupList = res.data
|
}else {
|
ElMessage.warning(res.message)
|
}
|
}
|
const handlePrintClose = () => {
|
dialogVisible.value = false
|
}
|
|
defineExpose({
|
getList
|
});
|
|
</script>
|
<style scoped>
|
/* 只对申购数量这一列生效 */
|
:deep(.subscribe-quantity-cell .cell) {
|
padding: 0 !important; /* 关键:把默认的padding清零,优先级拉满 */
|
}
|
</style>
|