Files
qhmes/jeecgboot-vue3/src/views/mes/material/MesMaterialErpMapList.vue
2026-04-08 16:53:25 +08:00

37 lines
2.0 KiB
Vue

<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button type="primary" v-auth="'mes:mes_material_erp_map:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">新增</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="[{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_material_erp_map:edit' }]" :dropDownActions="getDropDownAction(record)" />
</template>
</BasicTable>
<MesMaterialErpMapModal @register="registerModal" @success="reload" />
</div>
</template>
<script lang="ts" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import MesMaterialErpMapModal from './modules/MesMaterialErpMapModal.vue';
import { columns, searchFormSchema } from './MesMaterialErpMap.data';
import { list, deleteOne } from './MesMaterialErpMap.api';
const [registerModal, { openModal }] = useModal();
const { tableContext } = useListPage({
tableProps: { title: '物料ERP映射', api: list, columns, canResize: true, formConfig: { labelWidth: 120, schemas: searchFormSchema, autoSubmitOnEnter: true }, actionColumn: { width: 120 } },
});
const [registerTable, { reload }, { rowSelection }] = tableContext;
function handleAdd() { openModal(true, { isUpdate: false, showFooter: true }); }
function handleEdit(record: Recordable) { openModal(true, { record, isUpdate: true, showFooter: true }); }
function handleDetail(record: Recordable) { openModal(true, { record, isUpdate: true, showFooter: false }); }
async function handleDelete(record) { await deleteOne({ id: record.id }, reload); }
function getDropDownAction(record) {
return [
{ label: '详情', onClick: handleDetail.bind(null, record) },
{ label: '删除', popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) }, auth: 'mes:mes_material_erp_map:delete' },
];
}
</script>