<template>
|
<PageWrapper :title="`收货单` + BILLCODE + `的资料`" content="这是收货单详情页面。" contentBackground @back="goBack">
|
<template #footer>
|
<a-tabs default-active-key="detail" v-model:activeKey="currentKey" @tabClick="tabClkcallback">
|
<a-tab-pane key="detail" tab="单据详情" />
|
<a-tab-pane key="detailsn" tab="条码详情" />
|
</a-tabs>
|
</template>
|
<div>
|
<div v-if="currentKey == 'detail'">
|
<BasicTable @register="detailTable">
|
<template #toolbar>
|
<a-button ghost color="success" preIcon="OutR|svg" @click="aoaToExceldtl"> 导出 </a-button>
|
</template>
|
<template #action="{ record }">
|
<TableAction :actions="[
|
{
|
icon: 'clarity:info-standard-line',
|
tooltip: '查看单据详情',
|
onClick: JumpSnDetail.bind(null, record),
|
}
|
]" />
|
</template>
|
</BasicTable>
|
</div>
|
<div v-if="currentKey == 'detailsn'">
|
<BasicTable @register="detailsnTable">
|
<template #toolbar>
|
<a-button ghost color="success" preIcon="OutR|svg" @click="aoaToExcelsn"> 导出 </a-button>
|
</template>
|
</BasicTable>
|
</div>
|
</div>
|
<Loading :loading="compState.loading" :tip="compState.tip" />
|
</PageWrapper>
|
</template>
|
|
<script lang="ts" setup>
|
import { aoaToSheetXlsx } from '/@/components/Excel';
|
import { ref ,reactive} from 'vue';
|
import { useRoute } from 'vue-router';
|
import { PageWrapper } from '/@/components/Page';
|
import { useTabs } from '/@/hooks/web/useTabs';
|
import { Tabs } from 'ant-design-vue';
|
import { useGo } from '/@/hooks/web/usePage';
|
//详情列表
|
import { BasicTable, useTable,TableAction } from '/@/components/Table';
|
import { getEnterWarehouseDetailListByPage,getEnterWarehouseDetailSNListByPage } from '/@/api/tigerapi/wms/enterwarehouse';
|
import { columns_D,columns_S, searchFormSchema_D,searchFormSchema_S } from './enterwarehouse.data';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
import { Loading } from '/@/components/Loading';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
|
const { createMessage } = useMessage();
|
const { t: bt } = useI18n('WMS.Otheroutorder');
|
const compState = reactive({
|
absolute: false,
|
loading: false,
|
tip: '加载中...',
|
});
|
//ATabs: Tabs, ATabPane: Tabs.TabPane
|
const ATabs = ref(Tabs)
|
const ATabPane = ref(Tabs.TabPane)
|
const route = useRoute();
|
var ITEM_CODE=ref('');
|
const go = useGo();
|
//获取JobId
|
const BILLCODE = ref(route.params?.BillCode);
|
const [detailTable,{getForm: DataDtl,getPaginationRef:PagDtl}] = useTable({
|
title: '单据详情列表',
|
api: getEnterWarehouseDetailListByPage,
|
columns: columns_D,
|
useSearchForm: true,
|
showTableSetting: true,
|
bordered: true,
|
canResize:true,
|
showIndexColumn: false,
|
formConfig: {
|
labelWidth: 120,
|
schemas: searchFormSchema_D,
|
},
|
actionColumn: {
|
width: 80,
|
title: '操作',
|
dataIndex: 'action',
|
slots: { customRender: 'action' },
|
fixed: 'right' //undefined,
|
},
|
searchInfo: { BILLCODE },
|
});
|
const [detailsnTable,{getForm: DataSn,getPaginationRef:PagSn}] = useTable({
|
title: '条码详情列表',
|
api: getEnterWarehouseDetailSNListByPage,
|
columns: columns_S,
|
formConfig: {
|
labelWidth: 120,
|
schemas: searchFormSchema_S,
|
model:{ITEM_CODE:ITEM_CODE}
|
},
|
useSearchForm: true,
|
searchInfo: { BILLCODE },
|
showTableSetting: false,
|
bordered: true,
|
canResize:true,
|
showIndexColumn: false,
|
});
|
|
let arrdtl: any[] = [];
|
let arrsn: any[] = [];
|
|
function aoaToExceldtl() {
|
const dtl = PagDtl().total
|
if(dtl<30000){
|
arrdtl=[]
|
compState.loading = true;
|
const data = DataDtl().getFieldsValue();
|
data.BILLCODE=BILLCODE.value
|
getEnterWarehouseDetailListByPage(data).then((res) => {
|
res.items.forEach(element => {
|
let start = ''
|
switch (element.LINESTATUS) {
|
case 0:
|
start = bt('新增');
|
break;
|
case 1:
|
start = bt('待检');
|
break;
|
case 2:
|
start = bt('检验中');
|
break;
|
case 3:
|
start = bt('待入库');
|
break;
|
case 4:
|
start = bt('K3审核通过');
|
break;
|
case 5:
|
start = bt('完成');
|
break;
|
default:
|
break;
|
}
|
arrdtl.push({
|
'序号': element.BILLLINE,
|
'料号': element.ITEM_CODE,
|
'来料数量': element.PRQTY,
|
'已入数量': element.INSTOCKQTY,
|
'差异数量': element.OWEIN_QTY,
|
//'物料名称': element.ITEM_NAME,
|
'操作时间': element.UPDATE_TIME,
|
'状态': start,
|
});
|
});
|
const arrHeader = columns_D.map((column) => column.title);
|
const arrData = arrdtl.map((item) => {
|
return Object.keys(item).map((key) => item[key]);
|
});
|
// 保证data顺序与header一致
|
if(arrdtl.length<30000){
|
aoaToSheetXlsx({
|
data: arrData,
|
header: arrHeader,
|
filename: '到货单单明细.xlsx',
|
});
|
}else{
|
createMessage.error(bt('导出数据不能超过三万条,如需要更多的请联系管理员'));
|
}
|
|
compState.loading = false;
|
|
})
|
|
}else{
|
createMessage.error(bt('导出数据不能超过三万条,如需要更多的请联系管理员'));
|
}
|
|
}
|
|
|
function aoaToExcelsn() {
|
const sn=PagSn().total
|
if(sn<30000){
|
arrsn = []
|
compState.loading = true
|
const data = DataSn().getFieldsValue();
|
data.BILLCODE=BILLCODE.value
|
data.ITEMc_CODE=ITEM_CODE.value==''?'':ITEM_CODE.value
|
getEnterWarehouseDetailSNListByPage(data).then((res) => {
|
res.items.forEach(element => {
|
let start = ''
|
switch (element.STATUS) {
|
case 0:
|
start = bt('不存在');
|
break;
|
case 10:
|
start = bt('送货中');
|
break;
|
case 20:
|
start = bt('待检验');
|
break;
|
case 30:
|
start = bt('待入库');
|
break;
|
case 40:
|
start = bt('在库中');
|
break;
|
case 50:
|
start = bt('已下架');
|
break;
|
case 60:
|
start = bt('已发料');
|
break;
|
case 70:
|
start = bt('已上料');
|
break;
|
case 80:
|
start = bt('已耗尽');
|
break;
|
case 90:
|
start = bt('已退料');
|
break;
|
case 100:
|
start = bt('已发货');
|
break;
|
default:
|
break;
|
}
|
arrsn.push({
|
'条码': element.SN,
|
'修改时间': element.UPDATE_TIME,
|
'状态': start,
|
'物料编码': element.ITEM_CODE,
|
'扫描数量': element.SCANQTY
|
});
|
|
});
|
const arrHeader = columns_S.slice(3).map((column) => column.title);
|
const arrData = arrsn.map((item) => {
|
return Object.keys(item).map((key) => item[key]);
|
});
|
// 保证data顺序与header一致
|
if(arrsn.length<30000){
|
aoaToSheetXlsx({
|
data: arrData,
|
header: arrHeader,
|
filename: '到货单条码.xlsx',
|
});
|
}else{
|
createMessage.error(bt('导出数据不能超过三万条,如需要更多的请联系管理员'));
|
}
|
|
compState.loading = false;
|
|
})
|
|
}else{
|
createMessage.error(bt('导出数据不能超过三万条,如需要更多的请联系管理员'));
|
}
|
|
|
}
|
|
// 此处可以得到用户ID
|
//const BILLCODE = ref(route.params?.BILLCODE.split(',')[1]);
|
var currentKey = ref('detail');
|
const { setTitle } = useTabs();
|
// TODO
|
// 本页代码仅作演示,实际应当通过userId从接口获得用户的相关资料
|
|
// 设置Tab的标题(不会影响页面标题)
|
setTitle('详情:单据' + BILLCODE.value);
|
|
// 页面左侧点击返回链接时的操作
|
function goBack() {
|
// 本例的效果时点击返回始终跳转到账号列表页,实际应用时可返回上一页
|
go('/enterwarehouse');
|
}
|
const tabClkcallback = (val: string) => {
|
if(val=='detail'){
|
ITEM_CODE.value='';
|
}
|
};
|
function JumpSnDetail(record: Recordable) {
|
currentKey.value = 'detailsn'
|
ITEM_CODE.value=record.ITEM_CODE
|
}
|
</script>
|