<template>
|
<div class="home-container">
|
<div style="height: 100%">
|
<el-row class="homeCard">
|
<div class="basic-line">
|
<span>分类名称:</span>
|
<el-select class="input-box" v-model="tableData.listQuery.searchParams.bigClassifyId" placeholder="分类名称" filterable clearable>
|
<el-option
|
v-for="item in tableData.goodsBigClassifyList"
|
:key="item.id"
|
:value="item.id"
|
:label="item.materialClassifyName"
|
></el-option>
|
</el-select>
|
</div>
|
<div class="basic-line">
|
<span>物资名称:</span>
|
<el-input class="input-box" v-model="tableData.listQuery.searchParams.materialName" placeholder="物资名称" clearable> </el-input>
|
</div>
|
<div style="padding-bottom: 10px">
|
<el-button size="large" type="primary" class="ml10" v-throttle @click="refreshGoodsAndEquipmentData">
|
<el-icon>
|
<ele-Search />
|
</el-icon>
|
查询
|
</el-button>
|
<el-button size="large" type="success" class="ml10" @click="onOpenDialogRef('新增', '')">
|
<el-icon>
|
<ele-FolderAdd />
|
</el-icon>
|
新增
|
</el-button>
|
<!-- <el-button size="large" class="ml10" @click="openAddGoods()">-->
|
<!-- 管理分类-->
|
<!-- </el-button>-->
|
</div>
|
</el-row>
|
<div class="homeCard">
|
<div class="main-card">
|
<el-table :data="tableData.goodsAndEquipmentData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }">
|
<el-table-column type="index" label="序号" width="60" />
|
<el-table-column prop="bigClassifyName" label="大类物资类型名称" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="materialName" label="物资名称" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="serialNum" label="序列号" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="depName" label="部门名称" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="consumableName" label="是否是耗材" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="stockCount" label="库存" show-overflow-tooltip></el-table-column>
|
<el-table-column label="操作" width="250" align="center">
|
<template #default="scope">
|
<el-button size="small" text type="success" :icon="Edit" @click="openBatchInStorage('批量入库', scope.row)">批量入库</el-button>
|
<el-button size="small" text type="warning" :icon="Edit" @click="openBatchOutStorage('批量出库', scope.row)">批量出库</el-button>
|
<el-button size="small" text type="primary" :icon="Edit" @click="linkToGoodsDetail('查看明细', scope.row)">查看明细</el-button>
|
<!-- <el-button size="small" text :icon="Edit" @click="onOpenDialogRef('编辑', scope.row)">编辑</el-button>-->
|
<el-button size="small" text type="danger" :icon="Delete" @click="onDelGoodsEquipment(scope.row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<br />
|
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="tableData.listQuery.pageIndex" background v-model:page-size="tableData.listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" class="page-position"> </el-pagination>
|
</div>
|
</div>
|
</div>
|
<safety-goods-and-equipment-dialog ref="safetyGoodsAndEquipmentDialogRef" @refreshData="refreshGoodsAndEquipmentData"></safety-goods-and-equipment-dialog>
|
<batch-out-storage ref="batchOutStorageRef" @refreshData="refreshGoodsAndEquipmentData"></batch-out-storage>
|
<batch-in-storage ref="batchInStorageRef" @refreshData="refreshGoodsAndEquipmentData"></batch-in-storage>
|
<add-goods-dialog ref="addGoodsDialogRef" @refreshClassify="getAllSafetyEquipmentList"></add-goods-dialog>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import {onMounted, reactive, ref} from 'vue'
|
import {BigClassifyType, DataType, TableDataType} from "/@/views/facilityManagement/safetyGoodsAndEquipment/index";
|
import { Edit, View, Plus, Delete, Refresh, Search, Download } from '@element-plus/icons-vue';
|
import {goodsAndEquipmentApi} from "/@/api/facilityManagement/safetyGoodsAndEquipment";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
import SafetyGoodsAndEquipmentDialog from './components/safetyGoodsAndEquipmentDialog.vue'
|
import {departmentApi} from "/@/api/systemManage/department";
|
import router from "/@/router";
|
import BatchInStorage from './components/batchInStorage.vue'
|
import BatchOutStorage from './components/batchOutStorage.vue'
|
import AddGoodsDialog from "./components/addGoodsDialog.vue";
|
|
const safetyGoodsAndEquipmentDialogRef = ref()
|
const batchInStorageRef = ref()
|
const batchOutStorageRef = ref()
|
const addGoodsDialogRef = ref()
|
|
const tableData = reactive<TableDataType>({
|
goodsAndEquipmentData:[],
|
goodsBigClassifyList:[],
|
departmentList:[],
|
listQuery:{
|
pageSize: 10,
|
pageIndex: 1,
|
searchParams: {
|
bigClassifyId:null,
|
materialName:''
|
}
|
},
|
total:0,
|
})
|
|
const initGoodsAndEquipmentData = async () => {
|
let res = await goodsAndEquipmentApi().getGoodsEquipmentData(tableData.listQuery)
|
if(res.data.code === '200'){
|
tableData.goodsAndEquipmentData = res.data.data;
|
tableData.total = res.data.total;
|
}else{
|
ElMessage({
|
type:'warning',
|
message:res.data.msg
|
})
|
}
|
};
|
|
const onOpenDialogRef = (title: string, value: DataType) => {
|
safetyGoodsAndEquipmentDialogRef.value.openSafetyGoodsAndEquipmentDialog(title,value,tableData.goodsBigClassifyList, tableData.departmentList);
|
};
|
|
const openBatchInStorage = (title: string, value: DataType) => {
|
batchInStorageRef.value.openBatchInStorageDialog(value)
|
}
|
|
const openBatchOutStorage = (title: string, value: DataType) => {
|
batchOutStorageRef.value.openBatchOutStorageDialog(value)
|
}
|
|
// const openAddGoods = () => {
|
// addGoodsDialogRef.value.openAddGoodsDialog(tableData.goodsBigClassifyList)
|
// }
|
|
const linkToGoodsDetail = (title: string, value: DataType) => {
|
router.push({ path: '/goodsDetailManage', query:{ id: value.id } });
|
}
|
|
const onDelGoodsEquipment = (value: DataType) => {
|
ElMessageBox.confirm(`此操作将永久删除该:“${value.materialName}”,是否继续?`, '提示', {
|
confirmButtonText: '确认',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(async () => {
|
let res = await goodsAndEquipmentApi().deleteGoodsEquipment({ id: value.id });
|
if (res.data.code === '200') {
|
ElMessage({
|
type: 'success',
|
duration: 2000,
|
message: '删除成功'
|
});
|
await initGoodsAndEquipmentData();
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
})
|
.catch(() => {});
|
};
|
|
const refreshGoodsAndEquipmentData = () => {
|
initGoodsAndEquipmentData();
|
};
|
// 分页改变
|
const onHandleSizeChange = (val: number) => {
|
tableData.listQuery.pageSize = val;
|
initGoodsAndEquipmentData();
|
};
|
// 分页改变
|
const onHandleCurrentChange = (val: number) => {
|
tableData.listQuery.pageIndex = val;
|
initGoodsAndEquipmentData();
|
};
|
|
const getAllSafetyEquipmentList = async () => {
|
let res = await goodsAndEquipmentApi().getAllSafetyEquipment();
|
if(res.data.code === '200'){
|
tableData.goodsBigClassifyList = JSON.parse(JSON.stringify(res.data.data))
|
}else{
|
ElMessage({
|
message:res.data.msg,
|
type:'warning'
|
})
|
}
|
}
|
|
const getDepartmentData = async () => {
|
let res = await departmentApi().getDepartmentList();
|
if (res.data.code === '200') {
|
tableData.departmentList = res.data.data;
|
} else {
|
ElMessage({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
};
|
|
onMounted(() => {
|
initGoodsAndEquipmentData();
|
getAllSafetyEquipmentList();
|
getDepartmentData();
|
})
|
</script>
|
|
<style scoped lang="scss">
|
$homeNavLengh: 8;
|
.home-container {
|
height: calc(100vh - 144px);
|
box-sizing: border-box;
|
overflow: hidden;
|
.homeCard {
|
width: 100%;
|
padding: 20px;
|
box-sizing: border-box;
|
background: #fff;
|
border-radius: 4px;
|
|
.main-card {
|
width: 100%;
|
height: 100%;
|
.cardTop {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: 20px;
|
.mainCardBtn {
|
margin: 0;
|
}
|
}
|
.pageBtn {
|
height: 60px;
|
display: flex;
|
align-items: center;
|
justify-content: right;
|
|
.demo-pagination-block + .demo-pagination-block {
|
margin-top: 10px;
|
}
|
.demo-pagination-block .demonstration {
|
margin-bottom: 16px;
|
}
|
}
|
}
|
&:last-of-type {
|
height: calc(100% - 100px);
|
}
|
}
|
.el-row {
|
display: flex;
|
align-items: center;
|
margin-bottom: 20px;
|
&:last-child {
|
margin-bottom: 0;
|
}
|
.grid-content {
|
align-items: center;
|
min-height: 36px;
|
}
|
|
.topInfo {
|
display: flex;
|
align-items: center;
|
font-size: 16px;
|
font-weight: bold;
|
|
& > div {
|
white-space: nowrap;
|
margin-right: 20px;
|
}
|
}
|
}
|
}
|
.stepItem {
|
width: 100%;
|
display: flex;
|
align-items: flex-start;
|
margin-bottom: 30px;
|
margin-left: 30px;
|
padding-bottom: 30px;
|
border-left: 2px solid #ccc;
|
&:first-of-type {
|
margin-top: 30px;
|
}
|
&:last-of-type {
|
margin-bottom: 0;
|
border-left: none;
|
}
|
.stepNum {
|
width: 30px;
|
height: 30px;
|
border-radius: 15px;
|
box-sizing: border-box;
|
color: #333;
|
border: 1px solid #999;
|
line-height: 28px;
|
text-align: center;
|
margin-right: 10px;
|
margin-left: -16px;
|
margin-top: -30px;
|
}
|
.stepCard {
|
width: 100%;
|
margin-top: -30px;
|
|
.box-card {
|
width: 100%;
|
&:deep(.el-card__header) {
|
padding: 10px 15px;
|
}
|
.card-header {
|
width: 100%;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
& > div:first-of-type {
|
margin-right: 80px;
|
font-size: 18px;
|
font-weight: bold;
|
}
|
}
|
}
|
}
|
&:hover .card-header {
|
color: #0098f5;
|
}
|
&:hover .stepNum {
|
border: 2px solid #0098f5;
|
color: #0098f5;
|
}
|
}
|
|
:deep(.el-textarea.is-disabled .el-textarea__inner) {
|
background-color: var(--el-card-bg-color);
|
color: var(--el-input-text-color, var(--el-text-color-regular));
|
}
|
:deep(.el-input.is-disabled .el-input__inner) {
|
color: var(--el-input-text-color, var(--el-text-color-regular));
|
}
|
:deep(.el-input.is-disabled .el-input__wrapper) {
|
background-color: var(--el-card-bg-color);
|
}
|
</style>
|