feature/核算表格双击编辑
lys 2 months ago
parent 097d1127e1
commit 979c278bbf

@ -31,6 +31,7 @@ const index: FunctionComponent<Props> = (props) => {
const [i18n, setI18n] = useState<any>({});
const [showTotalCell, setShowTotalCell] = useState<boolean>(false);
const [isDetailTable, setIsDetailTable] = useState<boolean>(false);
const [showSee, setShowSee] = useState<boolean>(false);
const [sumRowlistUrl, setSumRowlistUrl] = useState<string>("");
const [tableScrollHeight, setTableScrollHeight] = useState<Number>(0);
const [payload, setPayload] = useState<string>("");
@ -57,6 +58,7 @@ const index: FunctionComponent<Props> = (props) => {
sumRowlistUrl = "",
payload = {},
calcDetail,
showSee = false,
fixed = true,
tableScrollHeight,
sumRow,
@ -65,6 +67,7 @@ const index: FunctionComponent<Props> = (props) => {
setSumRowlistUrl(sumRowlistUrl);
setShowTotalCell(showTotalCell);
setIsDetailTable(calcDetail);
setShowSee(showSee);
setI18n(i18nRes);
setPayload(payload);
setFixed(fixed);
@ -82,8 +85,8 @@ const index: FunctionComponent<Props> = (props) => {
width: optWidth || 120,
render: (__, record) => (
<Space>
<Button type="link" onClick={() => handleEdit(record?.id)}>
{i18nRes["编辑"]}
<Button type="link" onClick={() => handleEdit(record?.id, showSee)}>
{showSee ? i18nRes["查看"] : i18nRes["编辑"]}
</Button>
{optWidth && (
<>
@ -215,8 +218,8 @@ const index: FunctionComponent<Props> = (props) => {
const handleFormulaTd = (dataIndex: string) => {
window.parent.postMessage({ type: "turn", payload: { id: "FORMULA", params: { dataIndex } } }, "*");
};
const handleEdit = (id: string) => {
window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { id } } }, "*");
const handleEdit = (id: string, showSee: boolean) => {
window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { id, showSee } } }, "*");
};
const handleLockEmp = (params: any) => {
window.parent.postMessage({ type: "turn", payload: { id: "LOCKEMP", params } }, "*");
@ -264,7 +267,7 @@ const index: FunctionComponent<Props> = (props) => {
x: 1200,
y: `calc(100vh - ${tableScrollHeight || (!showTotalCell ? 165 : 200)}px)`
}}
columns={!isDetailTable ? columns : _.filter(columns, (o) => o.dataIndex !== "operate")}
columns={!isDetailTable || showSee ? columns : _.filter(columns, (o) => o.dataIndex !== "operate")}
footer={() => (!isDetailTable ? <CalcExplainFooter i18n={i18n} /> : null)}
pagination={
!_.isNil(pageInfo)

Loading…
Cancel
Save