import React, { RefObject } from "react"; import "./index.css"; import { ActionConfig, ButtonName, CQueryConfig, DtmplConfig, DtmplData, TmplBase, } from "../../tmpl/interface"; import { Affix, Button, Popconfirm, Popover, Space } from "antd"; import { LeftOutlined, SaveOutlined } from "@ant-design/icons"; import CquickButton from "../../controls/cquery/cquick-button"; import { LocaleContext } from "../../locale/LocaleProvider"; interface CqueryButtonBarProps { serverKey?: string; dtmplConfig: DtmplConfig; mainCode: string; } interface CqueryButtonBarState { // stateSerial:number } class CqueryButtonBar extends React.PureComponent< CqueryButtonBarProps, CqueryButtonBarState > { state = { // stateSerial:0, }; static contextType = LocaleContext; context: React.ContextType; calcOffsetBottom = (cQuerys: CQueryConfig[]) => { if (cQuerys.length >= 3) { return 120; } else if (cQuerys.length == 2) { return 86; } else { return 80; } }; // async componentDidMount() { // console.log("SubmitButtonBar this.loadData()"); // // console.log("SubmitButtonBar this.loadData()1"); // // if(code!=preCode || (!code && preCode)){ // // await this.loadData(); // // }else{ // // formRef.current.resetFields(); // // } // } // loadData = async () => { // console.log("SubmitButtonBar this.loadData()2"); // this.setState({ // stateSerial: this.state.stateSerial + 1, // }) // } render() { const {} = this.state; const { dtmplConfig, mainCode, serverKey } = this.props; const { translate } = this.context; if (!dtmplConfig) { return null; } const { buttons, cQuerys } = dtmplConfig; const cardList: TmplBase[] = []; let content; if (cQuerys && cQuerys.length > 3) { content = (
{cQuerys.map((item, index) => { if (index > 2) { return ( ); } })}
); } //offsetBottom={this.calcOffsetBottom(cQuerys)} return cQuerys && cQuerys.length > 0 && mainCode ? (
    {cQuerys ? cQuerys.map((item, index) => { if (index < 3) { return (
  • ); } }) : ""} {//处理后面的 cQuerys && cQuerys.length > 2 ? ( ) : ( "" )}
) : ( "" ); } } export default CqueryButtonBar;