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

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

Loading…
Cancel
Save