<template>
|
<div>
|
<BasicTable @register="registerTable">
|
<template #toolbar>
|
<a-button color="primary" @click="solderAdd" preIcon="add_02|svg"> 新增 </a-button>
|
</template>
|
<template #action="{ record }">
|
<TableAction
|
:actions="[
|
{
|
icon: 'clarity:info-standard-line',
|
tooltip: '报废',
|
onClick: handleEdit.bind(null, record),
|
},
|
]"
|
/>
|
</template>
|
</BasicTable>
|
<Loading :loading="compState.loading" :tip="compState.tip" />
|
<!-- <WmsItemDrawer @register="registerDrawer" @success="handleSuccess" /> -->
|
<SolderModal @register="registerSolder" @success="handleSuccess" />
|
</div>
|
</template>
|
<script lang="ts" setup>
|
import { reactive } from 'vue';
|
import { aoaToSheetXlsx } from '/@/components/Excel';
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
import SolderModal from './SolderModal.vue';
|
import { useModal } from '/@/components/Modal';
|
import { columns, searchFormSchema } from './smt_solder.data';
|
import { getsolderListByPage, SaveSolder } from '/@/api/tigerapi/mes/smt/solder';
|
import { useGo } from '/@/hooks/web/usePage';
|
import { Loading } from '/@/components/Loading';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
const { t } = useI18n();
|
const { createMessage } = useMessage();
|
const go = useGo();
|
const compState = reactive({
|
absolute: false,
|
loading: false,
|
tip: '加载中...',
|
});
|
const [registerSolder, { openModal: openSolderModal }] = useModal();
|
const [registerTable, { getForm, getPaginationRef, reload }] = useTable({
|
title: '锡膏胶水信息',
|
api: getsolderListByPage,
|
columns,
|
formConfig: {
|
labelWidth: 120,
|
schemas: searchFormSchema,
|
},
|
actionColumn: {
|
width: 80,
|
title: '操作',
|
dataIndex: 'action',
|
slots: { customRender: 'action' },
|
fixed: 'right', //undefined,
|
},
|
ellipsis: true,
|
useSearchForm: true,
|
showTableSetting: true,
|
bordered: true,
|
showIndexColumn: false,
|
});
|
let arr: any[] = [];
|
//导出
|
// function aoaToExcel() {
|
// const totals = getPaginationRef().total
|
// if (totals < 30000) {
|
// arr = [];
|
// compState.loading = true;
|
// const col = getForm().getFieldsValue()
|
// getWmsItemSumByPage(col).then((res) => {
|
// res.items.forEach(element => {
|
// arr.push({
|
// '仓库': element.WH_CODE,
|
// '物料代码': element.ITEM_CODE,
|
// '物料名称': element.ITEM_NAME,
|
// '数量': element.ZK_QTY,
|
// '单位': element.UNIT
|
// });
|
// });
|
// const arrHeader = columns.map((column) => column.title);
|
// const arrData = arr.map((item) => {
|
// return Object.keys(item).map((key) => item[key]);
|
// });
|
// // 保证data顺序与header一致
|
// if(arr.length<30000){
|
// aoaToSheetXlsx({
|
// data: arrData,
|
// header: arrHeader,
|
// filename: '汇总报表.xlsx',
|
// });
|
// }else{
|
// createMessage.error(t('导出数据不能超过三万条,如需要更多的请联系管理员'));
|
// }
|
|
// compState.loading = false;
|
|
// })
|
|
// } else {
|
// createMessage.error(t('导出数据不能超过三万条,如需要更多的请联系管理员'));
|
// }
|
|
// }
|
//跳转到实时库存
|
function handleEdit(record: any) {
|
//跳转页面
|
//go('/WmsItem/' + record.ITEM_CODE);
|
const apiAction = SaveSolder(record, true);
|
apiAction.then((action) => {
|
if (action) {
|
if (action.IsSuccessed) {
|
createMessage.success(t('已报废成功'));
|
}
|
} else {
|
createMessage.error(action.Message);
|
}
|
});
|
}
|
function solderAdd() {
|
//alert("新增")
|
openSolderModal(true, {
|
data: 'content',
|
info: 'Info',
|
});
|
}
|
|
function handleSuccess() {
|
reload();
|
}
|
</script>
|