From 769725931ef28d1a86b0fdd89cf5a44faf7bec27 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 03 八月 2020 12:07:57 +0800 Subject: [PATCH] 2020-08-03 --- src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx index 5a50093..89c7887 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' import { Form, Row, Col, Input, Button, notification, Modal, Icon, Tooltip, Radio, Select } from 'antd' import moment from 'moment' @@ -46,6 +47,31 @@ verifySql: _sql, usefulfields: fields.join(', ') }) + } + + UNSAFE_componentWillReceiveProps (nextProps) { + const { btn } = this.props + + if (nextProps.usefulfields && !is(fromJS(this.props.usefulfields), fromJS(nextProps.usefulfields))) { + + let fields = nextProps.usefulfields.map(item => item.Column) + if (!fields.includes('ID')) { + fields.unshift('ID') + } + if (!fields.includes('BID')) { + fields.unshift('BID') + } + + let _sql = `Declare @${btn.sheet} table (${nextProps.usefulfields.map(item => item.Column + ' ' + item.type).join(',')},jskey nvarchar(50) ) + Declare @UserName nvarchar(50),@FullName nvarchar(50),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) + Select @ErrorCode='', @retmsg='' + ` + + this.setState({ + verifySql: _sql, + usefulfields: fields.join(', ') + }) + } } edit = (record) => { @@ -230,7 +256,7 @@ </Col> {usefulfields ? <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> - {usefulfields} + {usefulfields}, jskey </Form.Item> </Col> : null} <Col span={8} style={{whiteSpace: 'nowrap'}}> -- Gitblit v1.8.0