Appearance
导入 Excel
导入 Excel 按钮配置
WARNING
由于导入 Excel 接口 api 需要使用到 token, 所以使用 导入 Excel 功能的模板 options 必须配置 token;
vue
<script setup lang="ts">
const { token } = useGlobalStoreWithDefaultValue();
// 配置
const options = reactive<Partial<GlobalPageLayoutTypes.EditPageLayoutProps>>({
// 有导入excel 操作的必填
token: token.value,
localConfig: {
groups: [
{
groupName: "行信息",
groupCode: "inspectionPlanItemList",
groupType: "item",
sortOrder: "2",
buttons: [
{
...BUTTON_IMPORT_ROW,
args: {
url: "", // 必填
excelCode: "ElsInspectionPlanListItemExcel", // 有 excelCode 配置值的时候必填
},
},
],
},
],
},
});
</script>
vue
<script setup lang="ts">
const { token } = useGlobalStoreWithDefaultValue();
// 配置
const options = reactive<Partial<GlobalPageLayoutTypes.EditPageLayoutProps>>({
// 有导入excel 操作的必填
token: token.value,
localConfig: {
groups: [
{
groupName: "行信息",
groupCode: "inspectionPlanItemList",
groupType: "item",
sortOrder: "2",
buttons: [
{
...BUTTON_IMPORT_ROW,
args: {
url: "", // 必填
// 假设没有 excelCode 值, 须配置 handlerName, roleCode, fileName 属性
handlerName: "purchaseBomItemRpcImportImpl", // 没有 excelCode 必填
roleCode: "purchase", // 没有 excelCode 必填
fileName: "Bom行导入模板", // 没有 excelCode 必填
},
},
],
},
],
},
});
</script>
vue
<script setup lang="ts">
const { token } = useGlobalStoreWithDefaultValue();
// 配置
const options = reactive<Partial<GlobalPageLayoutTypes.EditPageLayoutProps>>({
// 有导入excel 操作的必填
token: token.value,
localConfig: {
groups: [
{
groupName: "行信息",
groupCode: "inspectionPlanItemList",
groupType: "item",
sortOrder: "2",
buttons: [
{
...BUTTON_IMPORT_ROW,
args: {
url: "", // 必填
excelCode: "ElsInspectionPlanListItemExcel", // 有 excelCode 配置值的时候必填
},
// 可以不配置, 默认值到当前分组表行数据
callback({ pageData, tableData }) {
// 自定义业务逻辑
},
},
],
},
],
},
});
</script>