<template>
|
<div>
|
<!-- 单详情 -->
|
<el-drawer v-model="drawerVisible" :title="`${detailForm.poId}详情`" direction="rtl" size="80%" @close="handleDrawerClose">
|
<template #title>
|
<div class="slot_title">
|
<div class="title_orderNo">{{ title }}</div>
|
<div>详情</div>
|
</div>
|
</template>
|
|
<div class="detailBoxWrap">
|
<!-- 详情组件 -->
|
<open-details ref="propDetailRef"></open-details>
|
<div class="msi-form">
|
<el-form :model="detailForm">
|
<el-row>
|
<el-col :span="6">
|
<el-form-item label="物料编号">
|
<el-input v-model="detailForm.materialCode" clearable placeholder="请输入物料编号" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="4">
|
<el-form-item label-width="20px">
|
<el-button type="primary" icon="el-icon-search" @click="getDetail">查询</el-button>
|
<el-button type="primary" style="margin-left: 5px" icon="ele-Download" @click="handleExportExcelWmsStockSnapshot" v-auth="'wmsStockSnapshot:exportExcel'"> 导出 </el-button>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
<div class="msi-content">
|
<el-table :data="drawerList" border striped :max-height="480" ref="tableRefWmsStockSnapshot" :summary-method="getExportTitle" show-summary>
|
<el-table-column type="index" label="序号" width="55" align="center" />
|
<el-table-column prop="materialCode" label="物料编号" show-overflow-tooltip="" />
|
<el-table-column prop="materialName" label="物料名称" show-overflow-tooltip="" />
|
<el-table-column prop="materialUnit" label="单位" show-overflow-tooltip="" />
|
<el-table-column prop="areaCode" label="库区编号" show-overflow-tooltip="" />
|
<el-table-column prop="areaName" label="库区名称" show-overflow-tooltip="" />
|
<el-table-column prop="quantity" label="数量" show-overflow-tooltip="" />
|
</el-table>
|
<Pagination :total="detailCount" v-model:page="detailForm.Page" v-model:limit="detailForm.PageSize" @pagination="getDetail" style="margin-top: 20px; text-align: center"></Pagination>
|
|
<div></div>
|
</div>
|
</div>
|
</el-drawer>
|
</div>
|
</template>
|
<script lang="ts" setup>
|
import Pagination from '/@/components/Pagination/index.vue';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ref, nextTick, computed, getCurrentInstance, watch, defineExpose, defineProps, onMounted } from 'vue';
|
import { exportPageExcel } from '/@/utils/exportPageExcel'; //引入导出方法
|
import { wmsStockWarning, historialStockPage } from '/@/api/main/inventoryWarning/inventoryWarning';
|
import OpenDetails from '/@/components/openDetails/openDetails.vue';
|
import { formatDate, formatDate_T_Date, formatDate_T_Time, defaultTimeRange } from '/@/utils/formatTime';
|
import commonFunction from '/@/utils/commonFunction';
|
import { ExcellTableDataExport } from '/@/hooks/exportTableDataExcell';
|
|
const jsonExcellTableExport = {
|
titleName: '', //导出表格名称
|
interfaceListName: '', //导出接口名称
|
};
|
|
const { getExportTitle, handleExportExcell, formExport, entozhExcell } = ExcellTableDataExport(jsonExcellTableExport);
|
|
const { proxy }: any = getCurrentInstance(); // 访问实例上下文 proxy同时支持开发 线上环境
|
const { getEnumDesc } = commonFunction();
|
const emits = defineEmits(['getTabelData']);
|
|
const props = defineProps({
|
titleAuthor: {
|
type: Number,
|
required: true,
|
},
|
hexiao: {
|
type: Number,
|
default: 1,
|
required: true,
|
},
|
});
|
//控制订单类型
|
const titleAuthor = computed(() => props.titleAuthor);
|
// 是否显示核销按钮
|
const hexiao = computed(() => props.hexiao);
|
const loading = ref(false);
|
|
//入库单下物料详情请求
|
const detailForm = ref({
|
materialCode: '',
|
begineTime: '',
|
snapshotId:'',
|
Page: 1,
|
PageSize: 10,
|
});
|
|
// 物料详情抽屉
|
const drawerVisible = ref(false);
|
const drawerType = ref('drawerAll');
|
// const
|
//单号
|
const purchaseNo = ref('');
|
function convertToDate(number:any) {
|
const year = Math.floor(number / 10000);
|
const month = Math.floor((number % 10000) / 100);
|
const day = number % 100;
|
|
const date = new Date(year, month - 1, day); // 月份是从0开始的,所以要减1
|
return date.toISOString().split('T')[0]; // 转换为字符串并去掉时间部分
|
}
|
let scopetrans = '';
|
//打开抽屉
|
const openDrawer = async (type: number, scope: any = {}, entozhExcell?: any) => {
|
detailForm.value.Page = 1; //bug:点编辑-再点详情
|
detailForm.value.PageSize = 10; //bug:点编辑-再点详情
|
if (scope.snapshotNo) {
|
title.value = `${scope.snapshotNo}`;
|
}
|
drawerType.value = 'drawerAll';
|
drawerVisible.value = true;
|
// detailForm.value.begineTime = convertToDate(scope.snapshotDate) + ' 00:00:00';
|
detailForm.value.snapshotId = scope.id;
|
debugger
|
purchaseNo.value = scope.snapshotNo;
|
//------------------获取物料列表物料明细
|
getDetail();
|
//------------------获取物料列表物料明细
|
|
scopetrans = JSON.parse(JSON.stringify(scope));
|
nextTick(() => {
|
proxy.$refs['propDetailRef'].openADialog(scopetrans, entozhExcell);
|
});
|
};
|
|
//关闭抽屉
|
const handleDrawerClose = () => {
|
detailForm.value = {
|
materialCode: '',
|
begineTime: '',
|
snapshotId:'',
|
Page: 1,
|
PageSize: 10,
|
};
|
deltailList.value = [];
|
detailCount.value = 0;
|
drawerList.value = [];
|
};
|
|
//物料详情类型
|
interface DetailType {
|
id: number;
|
}
|
|
//入库单详情列表
|
const deltailList = ref<DetailType[]>([]);
|
//弹出层数据
|
const drawerList = ref<DetailType[]>([]);
|
|
//入库单详情列表数据条数
|
const detailCount = ref(0);
|
|
//弹出层标题
|
let title = ref('');
|
//获取入库单下物料详情
|
const getDetail = async (callback?: any) => {
|
loading.value = true;
|
var res = await historialStockPage(Object.assign(detailForm.value));
|
drawerList.value = res.data.result?.items ?? [];
|
detailCount.value = res.data.result?.total;
|
loading.value = false;
|
};
|
|
const tableRefWmsStockSnapshot = ref(null);
|
const loadingWmsStockSnapshot = ref(false);
|
const disabled_btnWmsStockSnapshot = ref(false);
|
const queryParamsWmsStockSnapshot = ref<any>({});
|
const tableParamsWmsStockSnapshot = ref({
|
page: 1,
|
pageSize: 10,
|
total: 0,
|
});
|
|
//点击导出按钮
|
const handleExportExcelWmsStockSnapshot = async () => {
|
loadingWmsStockSnapshot.value = true;
|
disabled_btnWmsStockSnapshot.value = true;
|
var new_tableParamsWmsStockSnapshot = JSON.parse(JSON.stringify(tableParamsWmsStockSnapshot.value));
|
new_tableParamsWmsStockSnapshot.page = 1;
|
new_tableParamsWmsStockSnapshot.pageSize = 100000;
|
// new_tableParamsWmsStockSnapshot.begineTime = detailForm.value.begineTime;
|
new_tableParamsWmsStockSnapshot.snapshotId = detailForm.value.snapshotId;
|
var res = await historialStockPage(Object.assign(queryParamsWmsStockSnapshot.value, new_tableParamsWmsStockSnapshot));
|
if (res.data.type == 'success') {
|
exportExcelWmsStockSnapshot(res.data.result?.items ?? []);
|
}
|
loadingWmsStockSnapshot.value = false;
|
disabled_btnWmsStockSnapshot.value = false;
|
};
|
//导出
|
const exportExcelWmsStockSnapshot = async (exportDataList: Array) => {
|
exportPageExcel(exportDataList, tableRefWmsStockSnapshot, '库存快照', functionMapWmsStockSnapshot);
|
};
|
//定义当前页面的方法组
|
const functionMapWmsStockSnapshot = {
|
formatDate_T_Date,
|
formatDate_T_Time,
|
};
|
// 页面加载时
|
onMounted(async () => {});
|
|
// 暴露方法
|
defineExpose({ openDrawer });
|
</script>
|
<style lang="less" scoped>
|
.detailBoxWrap {
|
margin: 10px;
|
}
|
|
.msi-form {
|
margin-top: 10px;
|
}
|
.msi-form {
|
margin-bottom: 10px;
|
}
|
.slot_title {
|
display: flex;
|
align-items: center;
|
// margin-left: 20px;
|
.title_orderNo {
|
font-size: 18px;
|
color: #f18201;
|
font-weight: bold;
|
margin-right: 5px;
|
}
|
}
|
</style>
|