import React from 'react' import ActDtmplView from "./../detail/view/act-dtmpl-view"; import DtmplEditModal from './dtmpl-edit-modal'; import { CodeSource } from "../tmpl/interface"; //以列表为入口的,页面内列表,基本原则是所有交互在页面内完成,不会触发路由。 export interface DtmplViewCardProps { title?: any, serverKey?: string, sourceId?: string, addTmplId?: string, code?: string; mainCode?: string; editable?: boolean; codeSource?: CodeSource, showHeader?: boolean, isAudit?: boolean, // 是否审计 }; export interface DtmplViewCardState { showDtmplEdit?: boolean; }; class DtmplViewCard extends React.PureComponent { state = { showDtmplEdit: false, } static defaultProps = { editable: true, showHeader: true, isAudit: false, } goDtmpl = () => { this.setState({ showDtmplEdit: true, }) } handleDtmplEdit = (code: string) => { this.setState({ showDtmplEdit: false, }) } render() { const { showDtmplEdit } = this.state; const { sourceId, code, mainCode, editable, serverKey, codeSource, title, showHeader, addTmplId, isAudit } = this.props; return <> {showDtmplEdit ? { this.setState({ showDtmplEdit: false, }) }} sourceId={sourceId} code={code} onOk={this.handleDtmplEdit} /> : null} } } export default DtmplViewCard;