From f068c617b918fc7817c11724424cb1a9149ec3a2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 09 一月 2020 16:51:10 +0800 Subject: [PATCH] 2020-01-09 --- src/templates/tableshare/gridbtnform/index.scss | 1 src/templates/tableshare/columnform/index.jsx | 17 + src/templates/comtableconfig/index.jsx | 30 -- src/templates/tableshare/gridbtnform/index.jsx | 5 src/tabviews/tableshare/actionList/index.jsx | 52 +++-- src/templates/modalconfig/modalform/index.jsx | 74 ++++-- src/templates/modalconfig/index.jsx | 24 ++ src/templates/tableshare/menuform/index.jsx | 5 src/templates/tableshare/colspanform/index.scss | 1 src/templates/tableshare/searchform/index.jsx | 19 + src/templates/subtableconfig/settingform/index.jsx | 44 +++- src/templates/tableshare/columnform/index.scss | 1 src/templates/comtableconfig/tabform/index.jsx | 17 - src/utils/utils.js | 15 + src/templates/modalviewconfig/actionform/index.jsx | 23 + src/templates/subtableconfig/actionform/index.jsx | 23 + src/tabviews/tableshare/mutilform/index.jsx | 34 +++ src/templates/modalviewconfig/index.jsx | 14 - src/templates/comtableconfig/actionform/index.jsx | 23 + src/templates/modalconfig/settingform/index.jsx | 9 src/templates/subtableconfig/index.jsx | 14 - src/templates/comtableconfig/settingform/index.jsx | 44 +++- src/templates/tableshare/colspanform/index.jsx | 5 src/templates/modalviewconfig/settingform/index.jsx | 44 +++- src/templates/modalconfig/groupform/index.jsx | 5 src/utils/option.js | 24 ++ src/templates/modalviewconfig/tabform/index.jsx | 17 - 27 files changed, 396 insertions(+), 188 deletions(-) diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index f49ee91..7e7a439 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -154,10 +154,7 @@ func: 'sPC_TableData_InUpDe', BID: this.props.BID } - - if (setting.primaryKey) { // 涓婚敭鍊奸璁撅紝浠庤〃鏍兼暟鎹涓�椤归�夊彇 - param[setting.primaryKey] = (data[0] && data[0][setting.primaryKey]) || '' - } + let primaryId = setting.primaryKey && data[0] ? data[0][setting.primaryKey] : '' if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� let ID = '' @@ -170,13 +167,13 @@ ID = ids.join(',') } - if (setting.primaryKey) { - param[setting.primaryKey] = ID - } - if (btn.innerFunc) { // 浣跨敤鑷畾涔夊嚱鏁� param.func = btn.innerFunc + if (setting.primaryKey) { // 涓婚敭瀛樺湪鏃讹紝璁剧疆涓婚敭鍙傛暟 + param[setting.primaryKey] = ID + } } else if (btn.sql) { + param.ID = primaryId param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, data[0])) // 鏁版嵁婧� param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) @@ -185,19 +182,21 @@ if (btn.innerFunc) { param.func = btn.innerFunc + if (setting.primaryKey) { // 涓婚敭瀛樺湪鏃讹紝璁剧疆涓婚敭鍙傛暟 + param[setting.primaryKey] = primaryId + } + formdata.forEach(_data => { param[_data.key] = _data.value }) } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid - if (setting.primaryKey) { - param[setting.primaryKey] = Utils.getguid() - } - + param.ID = Utils.getguid() param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0])) // 鏁版嵁婧� param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) } else if (btn.sql) { + param.ID = primaryId param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, data[0])) // 鏁版嵁婧� param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) @@ -219,16 +218,17 @@ func: 'sPC_TableData_InUpDe', BID: this.props.BID } - - if (setting.primaryKey) { - param[setting.primaryKey] = cell[setting.primaryKey] || '' - } + let primaryId = setting.primaryKey ? cell[setting.primaryKey] : '' if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� if (btn.innerFunc) { param.func = btn.innerFunc + if (setting.primaryKey) { + param[setting.primaryKey] = primaryId + } } else if (btn.sql) { + param.ID = primaryId param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, '', param, cell)) // 鏁版嵁婧� param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) @@ -236,15 +236,17 @@ } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 if (btn.innerFunc) { param.func = btn.innerFunc - + + if (setting.primaryKey) { + param[setting.primaryKey] = primaryId + } + formdata.forEach(_data => { param[_data.key] = _data.value }) } else if (btn.sql) { - if (setting.primaryKey) { - param[setting.primaryKey] = cell[setting.primaryKey] - } + param.ID = primaryId param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata, param, cell)) // 鏁版嵁婧� param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) @@ -690,14 +692,14 @@ if (execAction.groups.length > 0) { execAction.groups.forEach(group => { group.sublist.forEach(field => { - if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1' && field.dataSource) { + if ((field.type === 'select' || field.type === 'link' || field.type === 'multiselect') && field.resourceType === '1' && field.dataSource) { subfields.push(field) } }) }) } else { execAction.fields.forEach(field => { - if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1' && field.dataSource) { + if ((field.type === 'select' || field.type === 'link' || field.type === 'multiselect') && field.resourceType === '1' && field.dataSource) { subfields.push(field) } }) @@ -716,6 +718,8 @@ if (item.type === 'link') { arrfield = arrfield + ',' + item.linkField + } else if (item.type === 'select' && item.linkSubField && item.linkSubField.length > 0) { + arrfield = arrfield + ',' + item.linkSubField.join(',') } let _sql = Utils.getSelectQuerySql(item) @@ -753,6 +757,10 @@ if (res.search.type === 'link') { item.parentId = cell[res.search.linkField] + } else if (res.search.type === 'select' && res.search.linkSubField && res.search.linkSubField.length > 0) { + res.search.linkSubField.forEach(_field => { + item[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' + }) } return item diff --git a/src/tabviews/tableshare/mutilform/index.jsx b/src/tabviews/tableshare/mutilform/index.jsx index a4750de..83fe6a0 100644 --- a/src/tabviews/tableshare/mutilform/index.jsx +++ b/src/tabviews/tableshare/mutilform/index.jsx @@ -2,6 +2,7 @@ import PropTypes from 'prop-types' import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd' import moment from 'moment' +import { formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' import FileUpload from '../fileupload' import './index.scss' @@ -57,6 +58,8 @@ }) } + let _inputfields = formlist.filter(item => item.type === 'text' || item.type === 'number') // 鐢ㄤ簬杩囨护涓嬫媺鑿滃崟鍏宠仈琛ㄥ崟 + formlist = formlist.map(item => { if (item.type === 'select' || item.type === 'link') { if (item.setAll === 'true') { @@ -72,6 +75,11 @@ } item.oriOptions = JSON.parse(JSON.stringify(item.options)) + + if (item.linkSubField && item.linkSubField.length > 0) { + let _fields = _inputfields.map(_item => _item.field) + item.linkSubField = item.linkSubField.filter(_item => _fields.includes(_item)) + } } if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { @@ -154,7 +162,7 @@ } } - selectChange = (_field, value) => { + selectChange = (_field, value, option) => { let formlist = JSON.parse(JSON.stringify(this.state.formlist)) let subfields = [] @@ -168,6 +176,16 @@ } return item }) + + // 琛ㄥ崟鍒囨崲鏃讹紝鏇存柊鍏宠仈瀛楁 + if (_field.type === 'select' && _field.linkSubField && _field.linkSubField.length > 0 && option.props.data) { + let _data = option.props.data + let fieldVal = {} + _field.linkSubField.forEach(subfield => { + fieldVal[subfield] = _data[subfield] + }) + this.props.form.setFieldsValue(fieldVal) + } if (subfields.length === 0) return @@ -225,6 +243,10 @@ { required: item.required === 'true', message: this.props.dict['form.required.input'] + item.label + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} />)} @@ -264,6 +286,11 @@ </Col> ) } else if (item.type === 'select' || item.type === 'link') { // 涓嬫媺鎼滅储 + let hasSubField = false + if (item.linkSubField && item.linkSubField.length > 0) { // 瀛樺湪鍏宠仈瀛楁锛屾暟鎹瓨鍌� + hasSubField = true + } + fields.push( <Col span={24 / cols} key={index}> <Form.Item label={item.label}> @@ -279,11 +306,10 @@ <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={(value) => {this.selectChange(item, value)}} - // getPopupContainer={() => document.getElementById('form-box')} + onChange={(value, option) => {this.selectChange(item, value, option)}} > {item.options.map(option => - <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option> + <Select.Option id={option.key} data={hasSubField ? option : ''} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option> )} </Select> )} diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx index cb6f923..94154e2 100644 --- a/src/templates/comtableconfig/actionform/index.jsx +++ b/src/templates/comtableconfig/actionform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' -import { btnIcons, btnClasses } from '@/utils/option.js' +import { btnIcons, btnClasses, formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' import './index.scss' @@ -327,13 +327,26 @@ let _rules = [] if (item.key === 'innerFunc') { let str = '^(' + item.fields.join('|') + ')' - let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') + let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') _rules = [{ pattern: _patten, - message: '鍚嶇О鍙厑璁稿寘鍚暟瀛椼�佸瓧姣嶅拰涓嬪垝绾匡紝涓斾互鎸囧畾瀛楃寮�濮嬨��' + message: formRule.func.innerMessage }, { - max: 50, - message: '鍐呴儴鍑芥暟鍚嶇О涓嶈秴杩�50涓瓧绗︺��' + max: formRule.func.max, + message: formRule.func.maxMessage + }] + } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') { + _rules = [{ + pattern: formRule.func.pattern, + message: formRule.func.message + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + }] + } else { + _rules = [{ + max: formRule.input.max, + message: formRule.input.message }] } fields.push( diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 0e46a74..f4ab260 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -366,13 +366,6 @@ tooltip: '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛屽瀛楁缁煎悎鎼滅储锛屾敞锛氱患鍚堟悳绱粎鍦ㄦ枃鏈被鍨嬫椂鏈夋晥', tooltipClass: 'middle', required: true, - rules: [{ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, - message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-' - }, { - max: 50, - message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒' - }], readonly: false }, { @@ -675,14 +668,6 @@ readonly: false }, { - type: 'text', - key: 'callbackFunc', - label: this.state.dict['header.form.callbackFunc'], - initVal: card.callbackFunc, - required: false, - readonly: false - }, - { type: 'select', key: 'position', label: this.state.dict['header.form.position'], @@ -695,6 +680,14 @@ value: 'grid', text: this.state.dict['header.form.grid'] }] + }, + { + type: 'text', + key: 'callbackFunc', + label: this.state.dict['header.form.callbackFunc'], + initVal: card.callbackFunc, + required: false, + readonly: false }, { type: 'select', @@ -813,13 +806,6 @@ label: this.state.dict['header.form.field'], initVal: card.field, required: true, - rules: [{ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, - message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-' - }, { - max: 50, - message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒' - }], readonly: false }, { diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx index 243ed97..24ce02c 100644 --- a/src/templates/comtableconfig/settingform/index.jsx +++ b/src/templates/comtableconfig/settingform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd' +import { formRule } from '@/utils/option.js' import './index.scss' const { TextArea } = Input @@ -114,7 +115,7 @@ } let str = '^(' + usefulFields.join('|') + ')' - let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') + let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') return ( <Form {...formItemLayout} className="ant-advanced-search-form commontable-setting-form" id="commontable-setting-form"> @@ -127,6 +128,10 @@ { required: true, message: dict['form.required.input'] + '琛ㄥ悕!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" />)} @@ -167,15 +172,12 @@ { required: true, message: dict['form.required.input'] + dict['header.form.interface'] + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] - })(<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} @@ -191,10 +193,10 @@ rules: [ { pattern: _patten, - message: '鍚嶇О鍙厑璁稿寘鍚暟瀛椼�佸瓧姣嶅拰涓嬪垝绾匡紝涓斾互鎸囧畾瀛楃寮�濮嬨��' + message: formRule.func.innerMessage }, { - max: 50, - message: '鍐呴儴鍑芥暟鍚嶇О涓嶈秴杩�50涓瓧绗︺��' + max: formRule.func.max, + message: formRule.func.maxMessage } ] })(<Input placeholder="" autoComplete="off" />)} @@ -224,6 +226,22 @@ )} </Form.Item> </Col> + {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.outerFunc']}> + {getFieldDecorator('outerFunc', { + initialValue: data.outerFunc || '', + rules: [ + { + pattern: formRule.func.pattern, + message: formRule.func.message + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + } + ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> : null} <Col span={12}> <Form.Item label="鍥哄畾鍒�"> {getFieldDecorator('columnfixed', { @@ -264,6 +282,10 @@ { required: true, message: dict['form.required.input'] + '榛樿鎺掑簭瀛楁!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="ID asc, UID desc" autoComplete="off" />)} diff --git a/src/templates/comtableconfig/tabform/index.jsx b/src/templates/comtableconfig/tabform/index.jsx index 1d598b0..c585f69 100644 --- a/src/templates/comtableconfig/tabform/index.jsx +++ b/src/templates/comtableconfig/tabform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Tooltip } from 'antd' +import { formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' import './index.scss' @@ -84,18 +85,6 @@ }) }) }) - - // this.setState({ - // formlist: this.state.formlist.map(form => { - // return form - // }) - // }, () => { - // this.setState({ - // formlist: this.state.formlist.map(form => { - // return form - // }) - // }) - // }) } } @@ -116,6 +105,10 @@ { required: !!item.required, message: this.props.dict['form.required.input'] + item.label + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} diff --git a/src/templates/modalconfig/groupform/index.jsx b/src/templates/modalconfig/groupform/index.jsx index 7f815e3..3fedb7b 100644 --- a/src/templates/modalconfig/groupform/index.jsx +++ b/src/templates/modalconfig/groupform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, InputNumber } from 'antd' +import { formRule } from '@/utils/option.js' import TransferForm from '../transferform' import Utils from '@/utils/utils.js' import './index.scss' @@ -97,6 +98,10 @@ { required: true, message: this.props.dict['form.required.input'] + '鍒嗙粍鍚嶇О!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off"/>)} diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index f32d956..d692cb9 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -314,6 +314,23 @@ * 3銆佽缃紪杈戝弬鏁伴」-formlist */ handleForm = (card) => { + const { config } = this.state + let _inputfields = [] + + // 璁剧疆涓嬫媺鑿滃崟鍙叧鑱斿瓧娈� + if (config.groups.length > 0) { + config.groups.forEach(group => { + let sublist = group.sublist.filter(item => item.type === 'text' || item.type === 'number') + _inputfields = [..._inputfields, ...sublist] + }) + } else { + _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number') + } + if (card.linkSubField && card.linkSubField.length > 0) { + let fields = _inputfields.map(item => item.field) + card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) + } + this.setState({ visible: true, card: card, @@ -513,6 +530,13 @@ value: 'false', text: this.state.dict['header.form.false'] }] + }, + { + type: 'multiselect', + key: 'linkSubField', + label: '鍏宠仈琛ㄥ崟', + initVal: card.linkSubField || [], + options: _inputfields } ] }) diff --git a/src/templates/modalconfig/modalform/index.jsx b/src/templates/modalconfig/modalform/index.jsx index 49ab211..ff106e1 100644 --- a/src/templates/modalconfig/modalform/index.jsx +++ b/src/templates/modalconfig/modalform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber } from 'antd' +import { formRule } from '@/utils/option.js' import { dateOptions } from '@/utils/option.js' import EditTable from '../editable' import './index.scss' @@ -37,15 +38,11 @@ _options = ['label', 'field', 'type', 'readonly', 'required'] } - if (type === 'select' || type === 'link') { - _options.push('setAll') - } - - if (type === 'link') { // 鍏宠仈绫诲瀷銆佸鍔犲叧鑱斿瓧娈� - _options = [..._options, 'linkField'] - } - - if (type === 'funcvar') { // 璁剧疆涓哄嚱鏁板彉閲忔椂锛屼笉闇�瑕佸叾浠栦俊鎭� + if (type === 'select') { + _options = [..._options, 'setAll', 'linkSubField'] + } else if (type === 'link') { // 鍏宠仈绫诲瀷銆佸鍔犲叧鑱斿瓧娈� + _options = [..._options, 'setAll', 'linkField'] + } else if (type === 'funcvar') { // 璁剧疆涓哄嚱鏁板彉閲忔椂锛屼笉闇�瑕佸叾浠栦俊鎭� _options = ['label', 'field', 'type'] } @@ -93,15 +90,11 @@ _options = ['label', 'field', 'type', 'readonly', 'required'] } - if (value === 'select' || value === 'link') { - _options.push('setAll') - } - - if (value === 'link') { - _options = [..._options, 'linkField'] - } - - if (value === 'funcvar') { + if (value === 'select') { + _options = [..._options, 'setAll', 'linkSubField'] + } else if (value === 'link') { + _options = [..._options, 'setAll', 'linkField'] + } else if (value === 'funcvar') { _options = ['label', 'field', 'type'] } @@ -149,12 +142,10 @@ _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] } - if (openType === 'select' || openType === 'link') { - _options.push('setAll') - } - - if (openType === 'link') { - _options = [..._options, 'linkField'] + if (openType === 'select') { + _options = [..._options, 'setAll', 'linkSubField'] + } else if (openType === 'link') { + _options = [..._options, 'setAll', 'linkField'] } this.setState({ @@ -178,12 +169,19 @@ let rules = [] if (item.key === 'field') { rules = [{ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, - message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-' + pattern: formRule.field.pattern, + message: formRule.field.message }, { - max: 50, - message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒' + max: formRule.field.max, + message: formRule.field.maxMessage }] + } else { + rules = [ + { + max: formRule.input.max, + message: formRule.input.message + } + ] } fields.push( <Col span={12} key={index}> @@ -264,6 +262,26 @@ </Form.Item> </Col> ) + } else if (item.type === 'multiselect') { // 澶氶�� + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal + })( + <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {item.options.map(option => + <Select.Option id={option.uuid} key={option.uuid} value={option.field}>{option.label}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + ) } else if (item.type === 'radio') { fields.push( <Col span={12} key={index}> diff --git a/src/templates/modalconfig/settingform/index.jsx b/src/templates/modalconfig/settingform/index.jsx index 2944e4d..71192b8 100644 --- a/src/templates/modalconfig/settingform/index.jsx +++ b/src/templates/modalconfig/settingform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Radio, InputNumber, Select } from 'antd' +import { formRule } from '@/utils/option.js' import './index.scss' class SettingForm extends Component { @@ -73,7 +74,13 @@ <Col span={12}> <Form.Item label="鏍囬"> {getFieldDecorator('title', { - initialValue: config.setting.title + initialValue: config.setting.title, + rules: [ + { + max: formRule.input.max, + message: formRule.input.message + } + ] })(<Input placeholder="" autoComplete="off"/>)} </Form.Item> </Col> diff --git a/src/templates/modalviewconfig/actionform/index.jsx b/src/templates/modalviewconfig/actionform/index.jsx index cb6f923..94154e2 100644 --- a/src/templates/modalviewconfig/actionform/index.jsx +++ b/src/templates/modalviewconfig/actionform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' -import { btnIcons, btnClasses } from '@/utils/option.js' +import { btnIcons, btnClasses, formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' import './index.scss' @@ -327,13 +327,26 @@ let _rules = [] if (item.key === 'innerFunc') { let str = '^(' + item.fields.join('|') + ')' - let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') + let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') _rules = [{ pattern: _patten, - message: '鍚嶇О鍙厑璁稿寘鍚暟瀛椼�佸瓧姣嶅拰涓嬪垝绾匡紝涓斾互鎸囧畾瀛楃寮�濮嬨��' + message: formRule.func.innerMessage }, { - max: 50, - message: '鍐呴儴鍑芥暟鍚嶇О涓嶈秴杩�50涓瓧绗︺��' + max: formRule.func.max, + message: formRule.func.maxMessage + }] + } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') { + _rules = [{ + pattern: formRule.func.pattern, + message: formRule.func.message + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + }] + } else { + _rules = [{ + max: formRule.input.max, + message: formRule.input.message }] } fields.push( diff --git a/src/templates/modalviewconfig/index.jsx b/src/templates/modalviewconfig/index.jsx index 0e46a74..98489b1 100644 --- a/src/templates/modalviewconfig/index.jsx +++ b/src/templates/modalviewconfig/index.jsx @@ -366,13 +366,6 @@ tooltip: '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛屽瀛楁缁煎悎鎼滅储锛屾敞锛氱患鍚堟悳绱粎鍦ㄦ枃鏈被鍨嬫椂鏈夋晥', tooltipClass: 'middle', required: true, - rules: [{ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, - message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-' - }, { - max: 50, - message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒' - }], readonly: false }, { @@ -813,13 +806,6 @@ label: this.state.dict['header.form.field'], initVal: card.field, required: true, - rules: [{ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, - message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-' - }, { - max: 50, - message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒' - }], readonly: false }, { diff --git a/src/templates/modalviewconfig/settingform/index.jsx b/src/templates/modalviewconfig/settingform/index.jsx index 243ed97..24ce02c 100644 --- a/src/templates/modalviewconfig/settingform/index.jsx +++ b/src/templates/modalviewconfig/settingform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd' +import { formRule } from '@/utils/option.js' import './index.scss' const { TextArea } = Input @@ -114,7 +115,7 @@ } let str = '^(' + usefulFields.join('|') + ')' - let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') + let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') return ( <Form {...formItemLayout} className="ant-advanced-search-form commontable-setting-form" id="commontable-setting-form"> @@ -127,6 +128,10 @@ { required: true, message: dict['form.required.input'] + '琛ㄥ悕!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" />)} @@ -167,15 +172,12 @@ { required: true, message: dict['form.required.input'] + dict['header.form.interface'] + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] - })(<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} @@ -191,10 +193,10 @@ rules: [ { pattern: _patten, - message: '鍚嶇О鍙厑璁稿寘鍚暟瀛椼�佸瓧姣嶅拰涓嬪垝绾匡紝涓斾互鎸囧畾瀛楃寮�濮嬨��' + message: formRule.func.innerMessage }, { - max: 50, - message: '鍐呴儴鍑芥暟鍚嶇О涓嶈秴杩�50涓瓧绗︺��' + max: formRule.func.max, + message: formRule.func.maxMessage } ] })(<Input placeholder="" autoComplete="off" />)} @@ -224,6 +226,22 @@ )} </Form.Item> </Col> + {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.outerFunc']}> + {getFieldDecorator('outerFunc', { + initialValue: data.outerFunc || '', + rules: [ + { + pattern: formRule.func.pattern, + message: formRule.func.message + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + } + ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> : null} <Col span={12}> <Form.Item label="鍥哄畾鍒�"> {getFieldDecorator('columnfixed', { @@ -264,6 +282,10 @@ { required: true, message: dict['form.required.input'] + '榛樿鎺掑簭瀛楁!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="ID asc, UID desc" autoComplete="off" />)} diff --git a/src/templates/modalviewconfig/tabform/index.jsx b/src/templates/modalviewconfig/tabform/index.jsx index 1d598b0..c585f69 100644 --- a/src/templates/modalviewconfig/tabform/index.jsx +++ b/src/templates/modalviewconfig/tabform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Tooltip } from 'antd' +import { formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' import './index.scss' @@ -84,18 +85,6 @@ }) }) }) - - // this.setState({ - // formlist: this.state.formlist.map(form => { - // return form - // }) - // }, () => { - // this.setState({ - // formlist: this.state.formlist.map(form => { - // return form - // }) - // }) - // }) } } @@ -116,6 +105,10 @@ { required: !!item.required, message: this.props.dict['form.required.input'] + item.label + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx index 4bc4b86..6f91fe3 100644 --- a/src/templates/subtableconfig/actionform/index.jsx +++ b/src/templates/subtableconfig/actionform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' -import { btnIcons, btnClasses } from '@/utils/option.js' +import { btnIcons, btnClasses, formRule } from '@/utils/option.js' import './index.scss' const { TextArea } = Input @@ -297,13 +297,26 @@ let _rules = [] if (item.key === 'innerFunc') { let str = '^(' + item.fields.join('|') + ')' - let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') + let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') _rules = [{ pattern: _patten, - message: '鍚嶇О鍙厑璁稿寘鍚暟瀛椼�佸瓧姣嶅拰涓嬪垝绾匡紝涓斾互鎸囧畾瀛楃寮�濮嬨��' + message: formRule.func.innerMessage }, { - max: 50, - message: '鍐呴儴鍑芥暟鍚嶇О涓嶈秴杩�50涓瓧绗︺��' + max: formRule.func.max, + message: formRule.func.maxMessage + }] + } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') { + _rules = [{ + pattern: formRule.func.pattern, + message: formRule.func.message + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + }] + } else { + _rules = [{ + max: formRule.input.max, + message: formRule.input.message }] } fields.push( diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index bace997..17e5f10 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -318,13 +318,6 @@ tooltip: '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛屽瀛楁缁煎悎鎼滅储锛屾敞锛氱患鍚堟悳绱粎鍦ㄦ枃鏈被鍨嬫椂鏈夋晥', tooltipClass: 'middle', required: true, - rules: [{ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, - message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-' - }, { - max: 50, - message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒' - }], readonly: false }, { @@ -738,13 +731,6 @@ label: this.state.dict['header.form.field'], initVal: card.field, required: true, - rules: [{ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, - message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-' - }, { - max: 50, - message: '瀛楁鍚嶆渶澶�50涓瓧绗︼紒' - }], readonly: false }, { diff --git a/src/templates/subtableconfig/settingform/index.jsx b/src/templates/subtableconfig/settingform/index.jsx index ba01c15..628ce92 100644 --- a/src/templates/subtableconfig/settingform/index.jsx +++ b/src/templates/subtableconfig/settingform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon, notification } from 'antd' +import { formRule } from '@/utils/option.js' import './index.scss' const { TextArea } = Input @@ -83,7 +84,7 @@ } let str = '^(' + usefulFields.join('|') + ')' - let _patten = new RegExp(str + '[0-9a-zA-Z_]*$', 'g') + let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') return ( <Form {...formItemLayout} className="ant-advanced-search-form subtable-setting-form" id="subtable-setting-form"> @@ -96,6 +97,10 @@ { required: true, message: dict['form.required.input'] + '琛ㄥ悕!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" />)} @@ -136,15 +141,12 @@ { required: true, message: dict['form.required.input'] + dict['header.form.interface'] + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] - })(<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} @@ -160,10 +162,10 @@ rules: [ { pattern: _patten, - message: '鍚嶇О鍙厑璁稿寘鍚暟瀛椼�佸瓧姣嶅拰涓嬪垝绾匡紝涓斾互鎸囧畾瀛楃寮�濮嬨��' + message: formRule.func.innerMessage }, { - max: 50, - message: '鍐呴儴鍑芥暟鍚嶇О涓嶈秴杩�50涓瓧绗︺��' + max: formRule.func.max, + message: formRule.func.maxMessage } ] })(<Input placeholder="" autoComplete="off" />)} @@ -201,6 +203,22 @@ )} </Form.Item> </Col> + {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.outerFunc']}> + {getFieldDecorator('outerFunc', { + initialValue: data.outerFunc || '', + rules: [ + { + pattern: formRule.func.pattern, + message: formRule.func.message + }, { + max: formRule.func.max, + message: formRule.func.maxMessage + } + ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> : null} <Col span={12}> <Form.Item label="榛樿鎺掑簭"> {getFieldDecorator('order', { @@ -209,6 +227,10 @@ { required: true, message: dict['form.required.input'] + '榛樿鎺掑簭瀛楁!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="ID asc, UID desc" autoComplete="off" />)} diff --git a/src/templates/tableshare/colspanform/index.jsx b/src/templates/tableshare/colspanform/index.jsx index eb54b51..c91c6b0 100644 --- a/src/templates/tableshare/colspanform/index.jsx +++ b/src/templates/tableshare/colspanform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, InputNumber, Select, Radio } from 'antd' +import { formRule } from '@/utils/option.js' import TransferForm from '../transferform' import './index.scss' @@ -81,6 +82,10 @@ { required: true, message: this.props.dict['form.required.input'] + this.props.dict['header.form.name'] + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" />)} diff --git a/src/templates/tableshare/colspanform/index.scss b/src/templates/tableshare/colspanform/index.scss index 4f7e976..11b9578 100644 --- a/src/templates/tableshare/colspanform/index.scss +++ b/src/templates/tableshare/colspanform/index.scss @@ -1,7 +1,6 @@ .ant-advanced-search-form.commontable-column-form { min-height: 190px; .ant-form-item { - margin-bottom: 15px; .ant-input-number { width: 100%; } diff --git a/src/templates/tableshare/columnform/index.jsx b/src/templates/tableshare/columnform/index.jsx index 849731b..a908637 100644 --- a/src/templates/tableshare/columnform/index.jsx +++ b/src/templates/tableshare/columnform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon } from 'antd' +import { formRule } from '@/utils/option.js' import './index.scss' class MainSearch extends Component { @@ -96,7 +97,21 @@ if (item.hidden) return if (item.type === 'text') { // 鏂囨湰鎼滅储 - let rules = item.rules || [] + let rules = [] + if (item.key === 'field') { + rules = [{ + pattern: formRule.field.pattern, + message: formRule.field.message + }, { + max: formRule.field.max, + message: formRule.field.maxMessage + }] + } else { + rules = [{ + max: formRule.input.max, + message: formRule.input.message + }] + } fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? diff --git a/src/templates/tableshare/columnform/index.scss b/src/templates/tableshare/columnform/index.scss index 8e195cf..cb34dac 100644 --- a/src/templates/tableshare/columnform/index.scss +++ b/src/templates/tableshare/columnform/index.scss @@ -1,7 +1,6 @@ .ant-advanced-search-form.commontable-column-form { min-height: 190px; .ant-form-item { - margin-bottom: 15px; .ant-input-number { width: 100%; } diff --git a/src/templates/tableshare/gridbtnform/index.jsx b/src/templates/tableshare/gridbtnform/index.jsx index 3f2ffbd..a1bb535 100644 --- a/src/templates/tableshare/gridbtnform/index.jsx +++ b/src/templates/tableshare/gridbtnform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, InputNumber, Radio } from 'antd' +import { formRule } from '@/utils/option.js' import './index.scss' class MainSearch extends Component { @@ -88,6 +89,10 @@ { required: !!item.required, message: this.props.dict['form.required.input'] + item.label + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} diff --git a/src/templates/tableshare/gridbtnform/index.scss b/src/templates/tableshare/gridbtnform/index.scss index 4f7e976..11b9578 100644 --- a/src/templates/tableshare/gridbtnform/index.scss +++ b/src/templates/tableshare/gridbtnform/index.scss @@ -1,7 +1,6 @@ .ant-advanced-search-form.commontable-column-form { min-height: 190px; .ant-form-item { - margin-bottom: 15px; .ant-input-number { width: 100%; } diff --git a/src/templates/tableshare/menuform/index.jsx b/src/templates/tableshare/menuform/index.jsx index 3fabaf0..f8d1866 100644 --- a/src/templates/tableshare/menuform/index.jsx +++ b/src/templates/tableshare/menuform/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select } from 'antd' +import { formRule } from '@/utils/option.js' import './index.scss' class MainSearch extends Component { @@ -23,6 +24,10 @@ { required: !!item.required, message: this.props.dict['form.required.input'] + item.label + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message } ] })(<Input placeholder="" autoComplete="off" disabled={item.readonly} />)} diff --git a/src/templates/tableshare/searchform/index.jsx b/src/templates/tableshare/searchform/index.jsx index 2585ba8..0fc9570 100644 --- a/src/templates/tableshare/searchform/index.jsx +++ b/src/templates/tableshare/searchform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip } from 'antd' -import { dateOptions, matchReg } from '@/utils/option.js' +import { dateOptions, matchReg, formRule } from '@/utils/option.js' import EditTable from '../editable' import './index.scss' @@ -201,7 +201,22 @@ if (item.hidden) return if (item.type === 'text') { // 鏂囨湰鎼滅储 - let rules = item.rules || [] + let rules = [] + if (item.key === 'field') { + rules = [{ + pattern: formRule.field.pattern, + message: formRule.field.message + }, { + max: formRule.field.max, + message: formRule.field.maxMessage + }] + } else { + rules = [{ + max: formRule.input.max, + message: formRule.input.message + }] + } + fields.push( <Col span={12} key={index}> <Form.Item label={item.tooltip ? diff --git a/src/utils/option.js b/src/utils/option.js index 1140ad2..8d529e6 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -5,6 +5,30 @@ const _dict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS +export const formRule = { + input: { + max: 100, + message: '杈撳叆妗嗘渶澶�100涓瓧绗︺��' + }, + field: { // 瀛楁鍚� + max: 50, + pattern: /^[\u4E00-\u9FA50-9a-zA-Z,_-]*$/ig, + message: '瀛楁鍚嶅彧鍏佽鍖呭惈鏁板瓧銆佸瓧姣嶃�佹眽瀛椾互鍙奯-', + maxMessage: '瀛楁鍚嶆渶澶�50涓瓧绗︺��' + }, + func: { // 鍑芥暟鍚� + max: 50, + pattern: /^[0-9a-zA-Z_]*$/, + message: '鍑芥暟鍚嶇О鍙厑璁稿寘鍚暟瀛椼�佸瓧姣嶅拰涓嬪垝绾裤��', + maxMessage: '鍑芥暟鍚嶇О涓嶈秴杩�50涓瓧绗︺��', + innerPattern: '[0-9a-zA-Z_]*', + innerMessage: '鍐呴儴鍑芥暟鍚嶇О鍙厑璁稿寘鍚暟瀛椼�佸瓧姣嶅拰涓嬪垝绾匡紝涓斾互鎸囧畾瀛楃寮�濮嬨��' + }, + textarea: { + max: 1024 + } +} + export const sysTemps = [ { title: '鍩虹琛ㄦ牸', diff --git a/src/utils/utils.js b/src/utils/utils.js index 4d2c968..ff237b6 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -433,7 +433,11 @@ if (item.type === 'link') { sql = 'select ' + item.valueField + ',' + item.valueText + ',' + item.linkField + ' from ' + _datasource } else { - sql = 'select ' + item.valueField + ',' + item.valueText + ' from ' + _datasource + let _linkSubField = '' // 涓嬫媺鑿滃崟鍏宠仈琛ㄥ崟 + if (item.linkSubField && item.linkSubField.length > 0) { + _linkSubField = ',' + item.linkSubField.join(',') + } + sql = 'select ' + item.valueField + ',' + item.valueText + _linkSubField + ' from ' + _datasource } if (item.orderBy) { @@ -449,7 +453,7 @@ * @return {String} table 琛ㄥ悕 */ static getSysDefaultSql (btn, setting, formdata, param, data) { - let primaryId = param[setting.primaryKey] + let primaryId = param.ID let BID = param.BID let verify = btn.verify let _formFieldValue = {} @@ -496,17 +500,18 @@ verify.uniques.forEach(item => { let _fieldValue = [] // 琛ㄥ崟閿�煎field=value let _value = [] // 琛ㄥ崟鍊硷紝鐢ㄤ簬閿欒鎻愮ず + let _labels = item.fieldlabel.split(',') - item.field.split(',').forEach(_field => { + item.field.split(',').forEach((_field, index) => { _fieldValue.push(`${_field}='${_formFieldValue[_field]}'`) - _value.push(_formFieldValue[_field]) + _value.push(`${_labels[index] || ''}锛�${_formFieldValue[_field] || ''}`) }) _sql += `Select @tbid='', @ErrorCode='',@retmsg='' Select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')} and ${primaryKey} !='${_primaryId}' If @tbid!='' Begin - select @ErrorCode='${item.errorCode}',@retmsg='${item.fieldlabel || ''}锛�${_value.join(' ')} 宸插瓨鍦�' + select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 宸插瓨鍦�' goto aaa end ` -- Gitblit v1.8.0