From 655ac8aef54bc134c1420c19975023182a10cae4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 08 十二月 2020 19:25:27 +0800 Subject: [PATCH] 2020-12-08 --- src/menu/datasource/verifycard/index.jsx | 89 +++++++++++--------------------------------- 1 files changed, 22 insertions(+), 67 deletions(-) diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index e5de13b..87cda19 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Tabs, Table, Popconfirm, Icon, notification, Modal, Typography, Spin } from 'antd' +import { Form, Tabs, Popconfirm, Icon, notification, Modal, Typography, Spin } from 'antd' import moment from 'moment' import Api from '@/api' @@ -94,15 +94,24 @@ { title: 'SQL', dataIndex: 'sql', - width: '65%', - render: (text) => ( - <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> - ) + width: '72%', + render: (text) => { + let title = text.match(/^\s*\/\*.+\*\//) + title = title && title[0] ? title[0] : '' + text = title ? text.replace(title, '') : text + + return ( + <div> + {title ? <span style={{color: '#a50'}}>{title}</span> : null} + <Paragraph copyable ellipsis={{ rows: 4, expandable: true }}>{text}</Paragraph> + </div> + ) + } }, { title: '鐘舵��', dataIndex: 'status', - width: '15%', + width: '13%', render: (text, record) => record.status === 'false' ? ( <div> @@ -120,13 +129,11 @@ { title: '鎿嶄綔', align: 'center', - width: '20%', + width: '15%', dataIndex: 'operation', render: (text, record) => - (<div> + (<div style={{textAlign: 'center'}}> <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><Icon type="edit" /></span> - <span className="operation-btn" onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> - <span className="operation-btn" onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> <span className="operation-btn" title={this.props.dict['model.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><Icon type="swap" /></span> <Popconfirm overlayClassName="popover-confirm" @@ -178,10 +185,6 @@ let _setting = fromJS(config.setting).toJS() - // if (_setting.varMark === undefined) { - // _setting.varMark = this.getMark(Marks) - // } - this.setState({ columns: fromJS(config.columns).toJS(), setting: _setting, @@ -191,27 +194,6 @@ }) this.getsysScript() - } - - getMark = (varMarks) => { - let m = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] - let i = 0 - let n = 25 - - let name = '' - while (!name) { - name = `${m[n]}${m[i]}_` - if (varMarks.includes(name) && n > 0) { - i++ - if (i >= 26) { - n-- - i = 0 - } - name = '' - } - } - - return name } getsysScript = () => { @@ -313,30 +295,6 @@ this.setState({ scripts }) } - handleUpDown = (record, direction) => { - let scripts = fromJS(this.state.scripts).toJS() - let index = 0 - - scripts = scripts.filter((item, i) => { - if (item.uuid === record.uuid) { - index = i - } - - return item.uuid !== record.uuid - }) - if ((index === 0 && direction === 'up') || (index === scripts.length && direction === 'down')) { - return - } - - if (direction === 'up') { - scripts.splice(index - 1, 0, record) - } else { - scripts.splice(index + 1, 0, record) - } - - this.setState({ scripts }) - } - scriptsChange = (values) => { let scripts = fromJS(this.state.scripts).toJS() @@ -355,6 +313,10 @@ return new Promise((resolve, reject) => { this.sqlverify(resolve, reject, false, scripts) }) + } + + changeScripts = (scripts) => { + this.setState({ scripts }) } scriptSubmit = (values) => { @@ -624,14 +586,7 @@ scriptSubmit={this.scriptSubmit} wrappedComponentRef={(inst) => this.scriptsForm = inst} /> - <Table - bordered - rowKey="uuid" - className="custom-table" - dataSource={scripts} - columns={scriptsColumns} - pagination={false} - /> + <EditTable data={scripts} actions={[]} columns={scriptsColumns} onChange={this.changeScripts}/> </TabPane> </Tabs> </div> -- Gitblit v1.8.0