康来智慧冷链系统 - 前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

101 lines
3.0 KiB

<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary"
@click="() => {}"
>预览</a-button>
<a-button type="primary"
@click="handleAdd"
>新增</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="[
{
label: '设计',
icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record)
},
{
label: '删除',
color: 'error',
icon: 'ant-design:delete-outlined',
onClick: handleDel.bind(null, record)
}]"
/>
</template>
</BasicTable>
<!--弹出窗体区域-->
<AmapTaskModal @register="registerModal" @success="handleRefreshTable"/>
</div>
</template>
<script lang="ts" setup>
/**
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致
* 采用vben-动态表格表单封装组件编写,采用 setup 写法
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved.
* author entfrm开发团队-王翔
*/
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { columns, searchFormSchema } from './mapLogistic.data';
import { useMessage } from '/@/hooks/web/useMessage';
import AmapTaskModal from './MapLogisticModal.vue';
import { listMapLogistic, delMapLogistic } from '/@/api/platform/common/controller/mapLogistic';
const { createConfirm, createMessage } = useMessage();
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload }] = useTable({
title: '地图任务列表',
api: listMapLogistic,
rowKey: 'id',
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter: true
},
useSearchForm: true,
showTableSetting: true,
bordered: true,
clickToRowSelect: false,
actionColumn: {
width: 220,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
fixed: false
}
});
/** 新增按钮操作,行内新增与工具栏局域新增通用 */
function handleAdd() {
openModal(true,{ _tag: 'add' });
}
/** 编辑按钮操作,行内编辑 */
function handleEdit(record?: Recordable) {
openModal(true, { _tag: 'edit', record });
}
/** 删除按钮操作,行内删除 */
async function handleDel(record?: Recordable) {
const ids = record?.id;
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否确认删除机构编号为${ids}机构吗?`,
onOk: async () => {
await delMapLogistic(ids);
createMessage.success('删除成功!');
handleRefreshTable();
}
});
}
/** 处理表格刷新 */
function handleRefreshTable() {
reload();
}
</script>