From 43a517b80f2803e0dcf6658113520c4a14c8c17f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 22 五月 2023 18:21:52 +0800 Subject: [PATCH] 2023-05-22 --- src/menu/components/table/edit-table/columns/tableIn/index.jsx | 117 ++++++++++------------------------------------------------ 1 files changed, 20 insertions(+), 97 deletions(-) diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx index b452acf..4bdb8d8 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { fromJS } from 'immutable' import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, InputNumber, Radio, Typography } from 'antd' -import { StopTwoTone, CheckCircleTwoTone, EditOutlined, SwapOutlined, DeleteOutlined, BorderOutlined, CheckCircleOutlined, StopOutlined } from '@ant-design/icons' +import { StopTwoTone, CheckCircleTwoTone, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' import moment from 'moment' import Api from '@/api' @@ -10,7 +10,6 @@ import MKEmitter from '@/utils/events.js' import UniqueForm from './uniqueform' import CustomScript from './customscript' -import MinView from '@/assets/img/minview.png' import asyncComponent from '@/utils/asyncComponent' import './index.scss' @@ -18,6 +17,7 @@ const { confirm } = Modal const { Paragraph } = Typography const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) +const FullScripts = asyncComponent(() => import('@/templates/zshare/verifycard/fullScripts')) class VerifyTableCard extends Component { static propTpyes = { @@ -26,8 +26,6 @@ } state = { - visible: false, - scriptId: '', verify: {}, fields: [], fieldLabel: {}, @@ -493,7 +491,7 @@ } render() { - const { verify, scriptsColumns, uniqueColumns, activeKey, fields, visible } = this.state + const { verify, scriptsColumns, uniqueColumns, activeKey, fields } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -582,17 +580,23 @@ {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} </span> } key="scripts"> - <BorderOutlined className="full-scripts" onClick={() => { - if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) { - notification.warning({ - top: 92, - message: '璇蜂繚瀛樿嚜瀹氫箟鑴氭湰锛�', - duration: 5 - }) - return - } - this.setState({visible: true, scriptId: ''}) - }}/> + <FullScripts + verify={verify} + getScriptsFullForm={() => this.scriptsFullForm} + getScriptsForm={() => this.scriptsForm} + handleStatus={this.handleStatus} + handleDelete={this.handleDelete} + > + <CustomScript + type="fullscreen" + btn={verify} + usefulfields={fields} + scripts={verify.scripts} + systemScripts={this.state.systemScripts} + scriptsChange={this.scriptsChange} + wrappedComponentRef={(inst) => this.scriptsFullForm = inst} + /> + </FullScripts> <CustomScript btn={verify} usefulfields={fields} @@ -691,87 +695,6 @@ </Form> </TabPane> </Tabs> - <Modal - wrapClassName="model-custom-scripts-modal" - title="鑷畾涔夎剼鏈�" - visible={visible} - width={'95vw'} - maskClosable={false} - destroyOnClose - > - <img className="unfull-scripts" src={MinView} onClick={() => this.setState({visible: false, scriptId: ''})} alt=""/> - <div className="script-table-wrap"> - {verify.scripts.map(item => { - let title = item.sql.match(/^\s*\/\*.+\*\//) - title = title && title[0] ? title[0] : '' - let _text = title ? item.sql.replace(title, '') : item.sql - - let position = null - if (item.position === 'init') { - position = <span style={{color: 'orange'}}>鍒濆鍖�</span> - } else if (item.position === 'front') { - position = <span style={{color: '#26C281'}}>sql鍓�</span> - } else { - position = <span style={{color: '#1890ff'}}>sql鍚�</span> - } - - if (item.status === 'false') { - return ( - <div className="script-item" key={item.uuid}> - <div style={{cursor: 'not-allowed'}}> - {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null} - <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph> - <div>{position} - <span style={{color: '#ff4d4f', marginLeft: '20px'}}> - 绂佺敤 - <StopOutlined style={{marginLeft: '5px'}} /> - </span> - </div> - </div> - <div style={{height: '24px'}}></div> - </div> - ) - } else { - return ( - <div className={'script-item ' + (this.state.scriptId === item.uuid ? 'active' : '') } key={item.uuid}> - <div style={{cursor: 'pointer'}} onClick={() => { - this.scriptsFullForm.edit(item) - this.setState({scriptId: item.uuid}) - }}> - {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null} - <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph> - <div>{position} - <span style={{color: '#26C281', marginLeft: '20px'}}> - 鍚敤 - <CheckCircleOutlined style={{marginLeft: '5px'}}/> - </span> - </div> - </div> - <div style={{textAlign: 'right'}}> - <span className="operation-btn" onClick={() => this.handleStatus(item, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span> - <Popconfirm - overlayClassName="popover-confirm" - title="纭畾鍒犻櫎鍚�?" - onConfirm={() => this.handleDelete(item, 'scripts') - }> - <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> - </Popconfirm> - </div> - </div> - ) - } - })} - </div> - <CustomScript - type="fullscreen" - btn={verify} - usefulfields={fields} - scripts={verify.scripts} - systemScripts={this.state.systemScripts} - scriptsChange={this.scriptsChange} - wrappedComponentRef={(inst) => this.scriptsFullForm = inst} - /> - </Modal> </div> ) } -- Gitblit v1.8.0