提交 e9b9e1a1 authored 作者: 钟是志's avatar 钟是志

26533 学生资助管理/助学贷款/助学贷款毕业生信息,2021020001 模块 按钮移动下位置

上级 16c8e292
import React, { useEffect, useRef, useState } from 'react';
import { Button } from 'antd';
import ImportUtil from '@/webPublic/one_stop_public/App/ImportUtil';
import ExportCurrentInfo from '@/webPublic/one_stop_public/App/ExportCurrentInfo';
import { Base16Encode } from '@/webPublic/one_stop_public/Base16';
export function FormListButtons(props) {
const [ConcatButtons, setConCatButtons] = useState([]);
const { btns, loading, importConfig, getPage, objId, query, custom, sql, exportConfig } = props;
const Before = btns && btns.before || [];
console.log(Before);
useEffect(() => {
let buttons = [];
buttons = Before.map((g) => {
g.ButtonType = 'Normal';
return g;
});
for (let item of importConfig) {
buttons.push({
...item,
ButtonType: 'import',
});
}
for (let item of exportConfig) {
buttons.push({
...item,
ButtonType: 'export',
});
}
buttons.sort((a, b) => {
let priorityA = a.priority || 0;
let priorityB = b.priority || 0;
return priorityA - priorityB;
});
setConCatButtons(buttons);
}, [exportConfig, importConfig, btns]);
if (!ConcatButtons || !ConcatButtons.length) {
return null;
}
return ConcatButtons.map((r, i) => {
if (r.ButtonType === 'Normal') {
return <Button {...r} loading={loading} key={r.children} />;
} else if (r.ButtonType === 'import') {
return (<ImportUtil
btn={r.btn}
key={r.btn?.name || '导入'}
ext={r.ext ? r.ext : 'xlsx'}
importConfig={r}
objId={objId}
callback={() => {
getPage();
if (r.callback && typeof r.callback === 'function') {
r.callback();
}
}}
/>);
} else if (r.ButtonType === 'export') {
return <ExportCurrentInfo
objId={objId}
key={r.children || '到处'}
query={query}
custom={custom}
index={i}
btn={r.btn}
ext={r.ext ? r.ext : 'xlsx'}
sql={Base16Encode(sql)}
/>;
}
});
// return Before.map((r) => <Button {...r} loading={loading} key={r.children} />);
}
......@@ -26,6 +26,8 @@ const text = [
'TIBYTEXT',
'VARBINARY',
'VARCHAR',
'VARCHAR2',
'NVARCHAR2',
];
const number = ['BIGINT', 'DOUBLE', 'FLOAT', 'INT', 'INTEGER', 'NUMERIC', 'SMALLINT', 'TINYINT'];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论