<template>
|
<div>
|
<BasicTable @register="registerTable">
|
<template #toolbar>
|
<a-button preIcon="OutR|svg" ghost color="success" @click="aoaToExceldtl"> 导出 </a-button>
|
</template>
|
<template #action="{ record }">
|
<TableAction
|
:actions="[
|
{
|
icon: 'clarity:info-standard-line',
|
tooltip: bt('查看单据详情'),
|
onClick: handleEdit.bind(null, record),
|
},
|
{
|
ifShow:record.STATUS!=4&&isNullOrEmpty(record.ERP_BILL_CODE)&&is_active?true:false,
|
icon: 'Posted|svg',
|
color: 'success',
|
tooltip: bt('已手工过账'),
|
popConfirm: {
|
title: '确认T100已经过账?',
|
placement: 'left',
|
confirm: handlePost.bind(null, record),
|
},
|
},
|
{
|
ifShow:record.STATUS===4&&isNullOrEmpty(record.ERP_BILL_CODE)&&is_active2?true:false,
|
icon: 'Redo|svg',
|
color: 'warning',
|
tooltip: bt('重新过账'),
|
popConfirm: {
|
title: '是否要重新推T100过账?',
|
placement: 'left',
|
confirm: handleRe.bind(null, record),
|
},
|
},
|
]"
|
/>
|
</template>
|
|
</BasicTable>
|
<Loading :loading="compState.loading" :tip="compState.tip" />
|
</div>
|
</template>
|
<script lang="ts" setup>
|
import { ref, reactive } from 'vue';
|
import { aoaToSheetXlsx } from '/@/components/Excel';
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
import { columns, searchFormSchema } from './materialreq.data';
|
import { getMaterialReqListByPage,SaveProd,UpdateReq } from '/@/api/tigerapi/wms/materialreq';
|
import { isNullOrEmpty } from '/@/utils/is';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useGo } from '/@/hooks/web/usePage';
|
import { Loading } from '/@/components/Loading';
|
import { useUserStore } from '/@/store/modules/user';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
const { createMessage } = useMessage();
|
const { t:bt } = useI18n('WMS.Materialreq');
|
const compState = reactive({
|
absolute: false,
|
loading: false,
|
tip: '加载中...',
|
});
|
const go = useGo();
|
const [registerTable,{getForm: DataDtl,getPaginationRef: DataPDtl}] = useTable({
|
title: bt('领料单列表'),
|
api: getMaterialReqListByPage,
|
columns,
|
formConfig: {
|
labelWidth: 120,
|
schemas: searchFormSchema,
|
},
|
useSearchForm: true,
|
showTableSetting: true,
|
bordered: true,
|
canResize:true,
|
showIndexColumn: false,
|
actionColumn: {
|
width: 120,
|
title: bt('操作'),
|
dataIndex: 'action',
|
slots: { customRender: 'action' },
|
fixed: 'right',
|
},
|
});
|
const id='2cdb53515f754bd19c7a6ea2f58b16eb';
|
const roles = useUserStore().getUserInfo.roles
|
const is_active=roles.some(item=>item.MENU_CODE===id)
|
|
const id2='3531453fd4d0439cb0e8dcded601f3c0';
|
const roles2 = useUserStore().getUserInfo.roles
|
const is_active2=roles2.some(item=>item.MENU_CODE===id2)
|
//跳转到详情页
|
function handleEdit(record: Recordable) {
|
go('/materialreqDetail/' + record.BILLCODE);
|
|
}
|
|
let arrdtl: any[] = [];
|
function aoaToExceldtl() {
|
const totals = DataPDtl().total
|
if (totals < 30000) {
|
arrdtl = [];
|
compState.loading = true;
|
const col = DataDtl().getFieldsValue()
|
//col.BILLCODE = BILLCODE.value
|
getMaterialReqListByPage(col).then((data) => {
|
data.items.forEach(element => {
|
let type = ''
|
switch (element.BIZTYPE) {
|
case '0':
|
type = bt('自制');
|
break;
|
case '1':
|
type = bt('委外');
|
break;
|
default:
|
break;
|
}
|
let start_erp = ''
|
if(isNullOrEmpty(element.ERP_BILL_CODE)){
|
start_erp = '未完成'
|
}else{
|
start_erp = '完成'
|
}
|
let start = ''
|
switch (element.STATUS) {
|
case 0:
|
start = bt('初始化');
|
break;
|
case 1:
|
start = bt('清点中');
|
break;
|
case 2:
|
start = bt('作业中');
|
break;
|
case 3:
|
start = bt('超发');
|
break;
|
case 4:
|
start = bt('完成');
|
break;
|
default:
|
break;
|
}
|
arrdtl.push({
|
'单据代码': element.BILLCODE,
|
'单据日期': element.BILLDATE,
|
'创建时间': element.CREATE_TIME,
|
'操作时间': element.UPDATE_TIME,
|
'T100单据代码': element.ERP_BILL_CODE,
|
'单据类型': type,
|
'ERP提示信息': element.COMMIT_MSG,
|
'ERP状态': start_erp,
|
'状态': start,
|
'仓库名称': element.WAREHOUSECODE,
|
'创建人': element.CREATE_USER,
|
});
|
});
|
const arrHeader = columns.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('导出数据不能超过三万条,如需要更多的请联系管理员'));
|
}
|
})
|
}else{
|
createMessage.error(bt('导出数据不能超过三万条,如需要更多的请联系管理员'));
|
}
|
compState.loading=false;
|
}
|
|
//已手工过账,wms同步过账
|
async function handlePost(record: Recordable) {
|
var res = await SaveProd(record)
|
createMessage.info(bt('已手工过账,wms同步过账'));
|
}
|
//重新过账
|
function handleRe(record: Recordable) {
|
UpdateReq(record.BILLCODE)
|
createMessage.info(bt('已经推T100过账,请稍后查询'));
|
}
|
</script>
|