From 2b84af9bed8f4b7da94a4bb85e7223d3b18e4fcb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 14 十二月 2019 23:03:26 +0800 Subject: [PATCH] 2019-12-14 --- src/templates/comtableconfig/settingform/index.scss | 4 + src/templates/comtableconfig/source.jsx | 4 + src/templates/comtableconfig/index.jsx | 55 +++++++---------- src/utils/utils.js | 23 +++++-- src/templates/comtableconfig/settingform/index.jsx | 59 +++++++++++++++---- 5 files changed, 94 insertions(+), 51 deletions(-) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 7ef6d02..75af4d9 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -1085,11 +1085,13 @@ } let _param = { + funcName: btn.innerFunc, name: _config.setting.tableName || '', - fields: fields + fields: fields, + menuNo: this.props.menu.MenuNo } LText = Utils.formatOptions(Utils.getfunc(_param)) - DelText = Utils.formatOptions(Utils.dropfunc(_param.name)) + DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) resolve(true) } else { resolve(false) @@ -1102,11 +1104,13 @@ }) } else { let _param = { + funcName: btn.innerFunc, name: _config.setting.tableName || '', - fields: '' + fields: '', + menuNo: this.props.menu.MenuNo } LText = Utils.formatOptions(Utils.getfunc(_param)) - DelText = Utils.formatOptions(Utils.dropfunc(_param.name)) + DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) resolve(true) } }).then(res => { @@ -1193,25 +1197,8 @@ } _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - return Api.getSystemConfig(_param) - }).then(res => { - console.log(res) - if (res === false) return res - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 10 - }) - return false - } else { - notification.success({ - top: 92, - message: '鍒涘缓鎴愬姛', - duration: 5 - }) - } + return Api.getSystemConfig(_param) }).then(res => { console.log(res) if (res === false) return res @@ -1237,9 +1224,9 @@ let isupdate = false _config.action = _config.action.map(item => { - if (item.uuid === res.values.uuid) { + if (item.uuid === btn.uuid) { isupdate = true - return res.values + return btn } else { return item } @@ -1248,7 +1235,7 @@ if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃 - _config.action.push(res.values) + _config.action.push(btn) } let gridbtn = _config.action.filter(act => act.position === 'grid') @@ -1449,13 +1436,17 @@ const { config } = this.state new Promise(resolve => { // 鍐呴儴璇锋眰 - Api.getSystemConfig(param).then(response => { - if (response.status) { - resolve('true') - } else { - resolve(response) - } - }) + if (param.LText) { + Api.getSystemConfig(param).then(response => { + if (response.status) { + resolve('true') + } else { + resolve(response) + } + }) + } else { + resolve('true') + } }).then(res => { console.log(res) if (res === 'true' && this.state.delActions.length > 0) { diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx index 98a1943..ff83ed6 100644 --- a/src/templates/comtableconfig/settingform/index.jsx +++ b/src/templates/comtableconfig/settingform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon } from 'antd' +import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd' import './index.scss' const { TextArea } = Input @@ -21,7 +21,16 @@ return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { - resolve(values) + + if (values.interType === 'inner' && !values.innerFunc && !values.dataresource) { + notification.warning({ + top: 92, + message: '璇疯嚜瀹氫箟鍑芥暟鎴栧~鍐欐暟鎹簮锛�', + duration: 10 + }) + } else { + resolve(values) + } } else { reject(err) } @@ -30,12 +39,15 @@ } onChange = (e) => { - console.log(e.target.value) + this.setState({ + interType: e.target.value + }) } render() { const { data, dict } = this.props const { getFieldDecorator } = this.props.form + const { interType } = this.state const formItemLayout = { labelCol: { @@ -66,7 +78,7 @@ rules: [ { required: true, - message: this.props.dict['form.required.input'] + '琛ㄥ悕!' + message: dict['form.required.input'] + '琛ㄥ悕!' } ] })(<Input placeholder="" autoComplete="off" />)} @@ -88,27 +100,47 @@ </Form.Item> </Col> <Col span={12}> - <Form.Item label="鎺ュ彛绫诲瀷"> + <Form.Item label={dict['header.form.intertype']}> {getFieldDecorator('interType', { initialValue: data.interType || 'inner' })( <Radio.Group onChange={this.onChange}> - <Radio value="inner">鍐呴儴</Radio> - <Radio value="outer">澶栭儴</Radio> + <Radio value="inner">{dict['header.form.interface.inner']}</Radio> + <Radio value="outer">{dict['header.form.interface.outer']}</Radio> </Radio.Group> )} </Form.Item> </Col> - <Col span={12}> - <Form.Item label="鍐呴儴鍑芥暟"> + {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.interface']}> + {getFieldDecorator('interface', { + initialValue: data.interface || '', + rules: [ + { + required: true, + message: dict['form.required.input'] + dict['header.form.interface'] + '!' + } + ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> : null} + {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.outerFunc']}> + {getFieldDecorator('outerFunc', { + initialValue: data.outerFunc || '' + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> : null} + {interType !== 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.innerFunc']}> {getFieldDecorator('innerFunc', { initialValue: data.innerFunc || '' })(<Input placeholder="" autoComplete="off" />)} </Form.Item> - </Col> + </Col> : null} <Col span={24}> <Form.Item label={ - <Tooltip placement="topLeft" title=""> + <Tooltip placement="topLeft" title="浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愶紝鑷畾涔夊嚱鏁版椂锛屽彲蹇界暐銆�"> <Icon type="question-circle" /> {'鏁版嵁婧�'} </Tooltip> @@ -145,12 +177,15 @@ <Col span={12}> <Form.Item label="涓婚敭"> {getFieldDecorator('primaryKey', { - initialValue: primaryKey + initialValue: primaryKey ? primaryKey : (this.props.columns.length === 0 ? 'ID' : '') })( <Select getPopupContainer={() => document.getElementById('commontable-setting-form')} > <Select.Option value="">涓嶈缃�</Select.Option> + {this.props.columns.length === 0 ? + <Select.Option value="ID">ID</Select.Option> : null + } {this.props.columns.map(option => <Select.Option id={option.uuid} title={option.label} key={option.uuid} value={option.field}>{option.label}</Select.Option> )} diff --git a/src/templates/comtableconfig/settingform/index.scss b/src/templates/comtableconfig/settingform/index.scss index bf9fa12..cd1a9f6 100644 --- a/src/templates/comtableconfig/settingform/index.scss +++ b/src/templates/comtableconfig/settingform/index.scss @@ -7,4 +7,8 @@ width: 83.33333333%; } } + .anticon-question-circle { + color: #c49f47; + margin-right: 3px; + } } \ No newline at end of file diff --git a/src/templates/comtableconfig/source.jsx b/src/templates/comtableconfig/source.jsx index 1b7d63e..6119305 100644 --- a/src/templates/comtableconfig/source.jsx +++ b/src/templates/comtableconfig/source.jsx @@ -17,7 +17,9 @@ order: '', dataresource: '', interType: 'inner', - innerFunc: '' + innerFunc: '', + interface: '', + outerFunc: '' }, tables: [], search: [ diff --git a/src/utils/utils.js b/src/utils/utils.js index d561d04..d76bdcd 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -330,10 +330,22 @@ */ static getfunc (param) { let form = '' + let formParam = '' + if (param.fields && param.fields.length > 0) { let _fields = [] param.fields.forEach(item => { if (item.field) { + let type = '' + if (item.type.match(/date/ig)) { + type = 'datetime is null' + } else if (item.type === 'number') { + type = `decimal(18,${item.decimal})=0` + } else { + type = 'nvarchar(50)=\'\'' + } + formParam = formParam + `mchr13k@${item.field} ${type},` + _fields.push(item.field) } }) @@ -348,18 +360,17 @@ field3 = field3.join(',') form = ` - insert into ${param.name} (${field1}) select ${field2},@UserID + insert into ${param.name} (${field1},createuserid) select ${field2},@UserID update ${param.name} set ${field3},modifydate=getdate(),modifyuserid=@UserID ` } - let Ltext = `create proc ${param.name} + let Ltext = `create proc ${param.funcName} ( @BID nvarchar(50)='', - @ID nvarchar(50)='', - 琛ㄥ崟浼犲��,鏂囨湰鐢╪varchar(50)='',鏃ユ湡鐢╠atetime is null ,鏁板�肩敤decimal(18,灏忔暟鐐逛綅鏁�)=0, - @sEPTMenuNo='', --浼犺彍鍗曞弬鏁� + @ID nvarchar(50)='',${formParam} + @sEPTMenuNo nvarchar(50)='${param.menuNo}', @lang nvarchar(50)='', @debug nvarchar(50)='', @LoginUID nvarchar(50)='', @@ -425,8 +436,8 @@ ROLLBACK TRAN END` - Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') console.log(Ltext) + Ltext = Ltext.replace(/\n\s{4}/ig, 'mchr13k') return Ltext } } \ No newline at end of file -- Gitblit v1.8.0