| | |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Tabs, Popconfirm, Icon, notification, Modal, Typography, Spin, message } from 'antd' |
| | | import { StopOutlined, CheckCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | width: '13%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Tabs, Row, Col, Input, Button, Table, Popconfirm, Icon, Tooltip, notification, Modal, message, InputNumber, Radio, Typography } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | import { Form, Tabs, Row, Col, Input, Button, Popconfirm, Icon, Tooltip, notification, Modal, message, InputNumber, Radio, Typography } from 'antd' |
| | | import { QuestionCircleOutlined, StopOutlined, CheckCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | dataIndex: 'position', |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | let _text = '' |
| | | if (record.position === 'front') { |
| | | _text = 'sql前' |
| | | } else if (record.position === 'init') { |
| | | _text = '初始化' |
| | | if (record.position === 'init') { |
| | | return <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (record.position === 'front') { |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | _text = 'sql后' |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | return _text |
| | | } |
| | | }, |
| | | { |
| | |
| | | width: '10%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '20%', |
| | | width: '140px', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div> |
| | | (<div style={{textAlign: 'center'}}> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | |
| | | }) |
| | | } |
| | | |
| | | handleUpDown = (record, type, direction) => { |
| | | let verify = JSON.parse(JSON.stringify(this.state.verify)) |
| | | let index = 0 |
| | | |
| | | if (type === 'columns') { |
| | | verify.columns = verify.columns.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.columns.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.columns.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.columns.splice(index + 1, 0, record) |
| | | } |
| | | } else if (type === 'unique') { |
| | | verify.uniques = verify.uniques.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.uniques.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.uniques.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.uniques.splice(index + 1, 0, record) |
| | | } |
| | | } else if (type === 'scripts') { |
| | | verify.scripts = verify.scripts.filter((item, i) => { |
| | | if (item.uuid === record.uuid) { |
| | | index = i |
| | | } |
| | | |
| | | return item.uuid !== record.uuid |
| | | }) |
| | | if ((index === 0 && direction === 'up') || (index === verify.scripts.length && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | verify.scripts.splice(index - 1, 0, record) |
| | | } else { |
| | | verify.scripts.splice(index + 1, 0, record) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: verify |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { verify } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | |
| | | scriptsChange={this.scriptsChange} |
| | | wrappedComponentRef={(inst) => this.scriptsForm = inst} |
| | | /> |
| | | <Table |
| | | <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/> |
| | | {/* <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | className="custom-table" |
| | | dataSource={verify.scripts} |
| | | columns={scriptsColumns} |
| | | pagination={false} |
| | | /> |
| | | /> */} |
| | | </TabPane> : null} |
| | | <TabPane tab="信息提示" key="tip"> |
| | | <Form {...formItemLayout}> |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Icon, Button, notification, Select, Popconfirm, Typography, Modal, Radio } from 'antd' |
| | | import { StopOutlined, CheckCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | width: '13%', |
| | | render: (text, record) => { |
| | | if (record.position === 'front') { |
| | | return 'sql前' |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | return 'sql后' |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | } |
| | | }, |
| | |
| | | width: '12%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Icon, Button, notification, Select, Popconfirm, Typography } from 'antd' |
| | | import { StopOutlined, CheckCircleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | width: '12%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" /> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | inputType: 'switch', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | width: '9%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.position === 'init') { |
| | | return '初始化' |
| | | return <span style={{color: 'orange'}}>初始化</span> |
| | | } else if (record.position === 'front') { |
| | | return 'sql前' |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | return 'sql后' |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | } |
| | | }, |
| | |
| | | width: '10%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '20%', |
| | | width: '140px', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div style={{textAlign: 'center'}}> |
| | |
| | | width: '10%', |
| | | render: (text, record) => { |
| | | if (record.position === 'front') { |
| | | return 'sql前' |
| | | return <span style={{color: '#26C281'}}>sql前</span> |
| | | } else { |
| | | return 'sql后' |
| | | return <span style={{color: '#1890ff'}}>sql后</span> |
| | | } |
| | | } |
| | | }, |
| | |
| | | width: '10%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | width: '8%', |
| | | render: (text, record) => record.status === 'false' ? |
| | | ( |
| | | <div> |
| | | <div style={{color: '#ff4d4f'}}> |
| | | {this.props.dict['model.status.forbidden']} |
| | | <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} /> |
| | | <StopOutlined style={{marginLeft: '5px'}} /> |
| | | </div> |
| | | ) : |
| | | ( |
| | | <div> |
| | | <div style={{color: '#26C281'}}> |
| | | {this.props.dict['model.status.open']} |
| | | <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/> |
| | | <CheckCircleOutlined style={{marginLeft: '5px'}}/> |
| | | </div> |
| | | ) |
| | | }, |
| | |
| | | padding: 0 5px; |
| | | cursor: pointer; |
| | | } |
| | | .operation-btn:not(:first-child) { |
| | | margin-left: 5px; |
| | | } |
| | | } |