From b35e3f0bacdbadf5823e06fe8dc6e047089aae38 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 19 一月 2020 00:25:45 +0800 Subject: [PATCH] 2020-01-19 --- src/components/header/index.jsx | 3 src/templates/formtabconfig/index.jsx | 2 src/components/sidemenu/editthdmenu/index.jsx | 101 ++++++++++++------- src/templates/subtableconfig/index.jsx | 7 src/tabviews/tableshare/actionList/index.jsx | 12 ++ src/templates/comtableconfig/settingform/index.jsx | 35 +++++- src/tabviews/subtable/index.jsx | 30 +++++ src/tabviews/subtabtable/index.jsx | 16 +++ src/locales/zh-CN/comtable.js | 3 src/tabviews/commontable/index.jsx | 23 ++++ src/templates/subtableconfig/settingform/index.jsx | 29 +++++ src/components/header/loginform.jsx | 20 +++- src/locales/en-US/comtable.js | 3 src/templates/subtableconfig/actionform/index.jsx | 3 14 files changed, 222 insertions(+), 65 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 3071e27..1442179 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -263,6 +263,9 @@ this.loadmenu() this.props.resetEditState(true) } else { + this.setState({ + loginLoading: false + }) notification.error({ top: 92, message: res.message, diff --git a/src/components/header/loginform.jsx b/src/components/header/loginform.jsx index 680c392..e887b12 100644 --- a/src/components/header/loginform.jsx +++ b/src/components/header/loginform.jsx @@ -27,10 +27,20 @@ }) } - handleSubmit = e => { - // 鐧诲綍鍙傛暟妫�楠� + handleSubmit = (e, key) => { e.preventDefault() - this.props.handleSubmit() + if (e.target.value) { + if (!this.props.form.getFieldValue(key)) { + const input = document.getElementById(key) + if (input) { + input.focus() + } + return + } + this.props.handleSubmit() + } else { + this.handleConfirm() + } } componentDidMount () { @@ -54,7 +64,7 @@ prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder={this.state.dict['login.username']} autoComplete="off" - onPressEnter={this.handleSubmit} + onPressEnter={(e) => {this.handleSubmit(e, 'password')}} /> )} </Form.Item> @@ -67,7 +77,7 @@ message: this.state.dict['login.password.empty'], } ] - })(<Input.Password onPressEnter={this.handleSubmit} placeholder={this.state.dict['login.password']} prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} />)} + })(<Input.Password onPressEnter={(e) => {this.handleSubmit(e, 'username')}} placeholder={this.state.dict['login.password']} prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} />)} </Form.Item> </Form> ) diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index b747b99..65d02ee 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/src/components/sidemenu/editthdmenu/index.jsx @@ -449,55 +449,78 @@ } handleSubConfig = (item, originMenu, config, type) => { - if (type === 'button') { // 涓夌骇鑿滃崟椤甸潰锛屾寜閽厤缃� - if (item.OpenType === 'pop') { + this.setState({ + tabview: '' + }, () => { + if (type === 'button') { // 涓夌骇鑿滃崟椤甸潰锛屾寜閽厤缃� + if (item.OpenType === 'pop') { + let pageParam = '' + if (config && config.type === 'Modal') { + pageParam = config + } + + this.setState({ + editMenu: originMenu, + editTab: '', + editAction: item, + btnParam: pageParam, + tabview: 'Modal' + }) + } + } else if (type === 'tab') { // 涓夌骇鑿滃崟椤甸潰锛屾爣绛鹃厤缃� + if (item.type === 'SubTable' || item.tabType === 'SubTable') { + this.setState({ + editMenu: originMenu, + editTab: config, + editAction: '', + tabview: 'SubTable' + }) + } + } else if (type === 'tabButton') { // 涓夌骇鑿滃崟涓嬶紝鏍囩涓嬶紝鎸夐挳閰嶇疆 + console.log(item) let pageParam = '' - if (config && config.type === 'Modal') { + if (item.OpenType === 'popview') { + if (config && config.Template === 'SubTable') { + pageParam = config + } else { + pageParam = { + ...item, + uuid: item.linkTab, + create: true + } + } + + this.setState({ + editMenu: originMenu, + editTab: pageParam, + editAction: item, + tabview: 'SubTable' + }) + } else { + if (config && config.type === 'Modal') { + pageParam = config + } + this.setState({ + editTab: originMenu, + editAction: item, + btnParam: pageParam, + tabview: 'Modal' + }) + } + } else if (type === 'tabview') { // 涓夌骇鑿滃崟涓嬶紝鎵撳紑鏂版爣绛鹃〉鎴栧綋鍓嶉〉璺宠浆锛岀被鍨嬬殑鎸夐挳閰嶇疆 + let pageParam = '' + if (config && config.type === 'FormTab') { pageParam = config } this.setState({ editMenu: originMenu, - editTab: '', editAction: item, btnParam: pageParam, - tabview: 'Modal' + tabview: 'FormTab' }) } - } else if (type === 'tab') { // 涓夌骇鑿滃崟椤甸潰锛屾爣绛鹃厤缃� - if (item.type === 'SubTable' || item.tabType === 'SubTable') { - this.setState({ - editMenu: originMenu, - editTab: config, - editAction: '', - tabview: 'SubTable' - }) - } - } else if (type === 'tabButton') { // 涓夌骇鑿滃崟涓嬶紝鏍囩涓嬶紝鎸夐挳閰嶇疆 - let pageParam = '' - if (config && config.type === 'Modal') { - pageParam = config - } - - this.setState({ - editTab: originMenu, - editAction: item, - btnParam: pageParam, - tabview: 'Modal' - }) - } else if (type === 'tabview') { // 涓夌骇鑿滃崟涓嬶紝鎵撳紑鏂版爣绛鹃〉鎴栧綋鍓嶉〉璺宠浆锛岀被鍨嬬殑鎸夐挳閰嶇疆 - let pageParam = '' - if (config && config.type === 'FormTab') { - pageParam = config - } - - this.setState({ - editMenu: originMenu, - editAction: item, - btnParam: pageParam, - tabview: 'FormTab' - }) - } + }) } UNSAFE_componentWillMount () { diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 0dce9ee..19881e4 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -173,6 +173,9 @@ 'header.form.readonly': '鏄惁鍙', 'header.form.field.required': '鏄惁蹇呭~', 'header.form.field.ishidden': '鏄惁闅愯棌', + 'header.form.queryType': '鏌ヨ绫诲瀷', + 'header.form.query': '鏌ヨ', + 'header.form.statistics': '缁熻', 'header.modal.form.edit': '琛ㄥ崟-缂栬緫', 'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫', 'header.modal.action.edit': '鎸夐挳-缂栬緫', diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index cb7c839..b5f9cd9 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -173,6 +173,9 @@ 'header.form.readonly': '鏄惁鍙', 'header.form.field.required': '鏄惁蹇呭~', 'header.form.field.ishidden': '鏄惁闅愯棌', + 'header.form.queryType': '鏌ヨ绫诲瀷', + 'header.form.query': '鏌ヨ', + 'header.form.statistics': '缁熻', 'header.modal.form.edit': '琛ㄥ崟-缂栬緫', 'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫', 'header.modal.action.edit': '鎸夐挳-缂栬緫', diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 14b1a3a..b76243f 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -182,12 +182,14 @@ columns: _columns, isLinkMain: _isLinkMain, arr_field: _arrField.join(','), - search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 - loading: true + search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { this.improveSearch() if (config.setting.onload !== 'false') { // 鍒濆鍖栧彲鍔犺浇 + this.setState({ + loading: true + }) this.loadmaindata() } }) @@ -406,6 +408,22 @@ if (/\s/.test(_dataresource)) { _dataresource = '(' + _dataresource + ') tb' + } + + if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 + let fieldmap = new Map() + search.forEach(item => { + let _field = item.key + + if (fieldmap.has(_field)) { + _field = _field + '1' + } + + fieldmap.set(item.key, true) + + let reg = new RegExp('@' + _field, 'ig') + _dataresource = _dataresource.replace(reg, `'${item.value}'`) + }) } let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` @@ -661,7 +679,6 @@ * @description 瑙﹀彂鎸夐挳寮圭獥锛堟爣绛鹃〉锛� */ triggerPopview = (btn, data) => { - console.log(btn) if (btn.OpenType === 'popview') { this.setState({ popAction: btn, diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index ee5fa1e..3ed8c99 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -65,7 +65,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction } = this.props + const { permAction, Tab, BID } = this.props let param = { func: 'sPC_Get_LongParam', @@ -159,11 +159,16 @@ actions: _actions, columns: _columns, arr_field: _arrField.join(','), - search: Utils.initMainSearch(config.search), // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 - loading: true + search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { this.improveSearch() - this.loadmaindata() + + if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 鍒濆鍖栧彲鍔犺浇 + this.setState({ + loading: true + }) + this.loadmaindata() + } }) } else { this.setState({ @@ -364,6 +369,22 @@ if (/\s/.test(_dataresource)) { _dataresource = '(' + _dataresource + ') tb' + } + + if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 + let fieldmap = new Map() + search.forEach(item => { + let _field = item.key + + if (fieldmap.has(_field)) { + _field = _field + '1' + } + + fieldmap.set(item.key, true) + + let reg = new RegExp('@' + _field, 'ig') + _dataresource = _dataresource.replace(reg, `'${item.value}'`) + }) } let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` @@ -612,6 +633,7 @@ type="sub" setting={setting} actions={actions} + Tab={this.props.Tab} BID={this.props.BID} dict={this.state.dict} MenuID={this.props.SupMenuID} diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index ebc4cf5..cb71290 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -333,6 +333,22 @@ _dataresource = '(' + _dataresource + ') tb' } + if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 + let fieldmap = new Map() + search.forEach(item => { + let _field = item.key + + if (fieldmap.has(_field)) { + _field = _field + '1' + } + + fieldmap.set(item.key, true) + + let reg = new RegExp('@' + _field, 'ig') + _dataresource = _dataresource.replace(reg, `'${item.value}'`) + }) + } + let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` let DateCount = `select count(1) as total from ${_dataresource} ${_search}` diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index 5fb6b00..a688782 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -12,6 +12,7 @@ class MainAction extends Component { static propTpyes = { BID: PropTypes.string, + Tab: PropTypes.any, type: PropTypes.string, MenuID: PropTypes.string, actions: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 @@ -39,7 +40,16 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (item, record) => { - const { setting } = this.props + const { setting, type, Tab, BID } = this.props + + if (type === 'sub' && Tab && Tab.supMenu && !BID) { + notification.warning({ + top: 92, + message: '闇�瑕佷笂绾т富閿�硷紒', + duration: 10 + }) + return + } let _this = this let data = this.props.gettableselected() || [] diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx index 6a41881..bcf491c 100644 --- a/src/templates/comtableconfig/settingform/index.jsx +++ b/src/templates/comtableconfig/settingform/index.jsx @@ -213,15 +213,32 @@ })(<TextArea rows={4} />)} </Form.Item> </Col> : null} + {interType !== 'outer' ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鏌ヨ鏃讹紝鎼滅储鏉′欢浠here鏉′欢鎷兼帴杩涘叆sql锛岀粺璁℃椂锛屽皢鏁版嵁婧愪腑浠モ�淍+鎼滅储瀛楁鈥濈殑鍐呭锛屼互鎼滅储鏉′欢涓殑鍊艰繘琛屾浛鎹㈠悗锛屾彁浜ゆ煡璇紝娉細鏌ヨ绫诲瀷浠呭湪浣跨敤绯荤粺鍑芥暟鏃舵湁鏁堛��"> + <Icon type="question-circle" /> + {dict['header.form.queryType']} + </Tooltip> + }> + {getFieldDecorator('queryType', { + initialValue: data.queryType || 'query' + })( + <Radio.Group> + <Radio value="query">{dict['header.form.query']}</Radio> + <Radio value="statistics">{dict['header.form.statistics']}</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} <Col span={12}> <Form.Item label="鍥哄畾鎸夐挳"> {getFieldDecorator('actionfixed', { initialValue: data.actionfixed ? 'true' : 'false' })( - <Select> - <Select.Option value="true">鏄�</Select.Option> - <Select.Option value="false">鍚�</Select.Option> - </Select> + <Radio.Group> + <Radio value="true">{dict['header.form.true']}</Radio> + <Radio value="false">{dict['header.form.false']}</Radio> + </Radio.Group> )} </Form.Item> </Col> @@ -242,14 +259,14 @@ </Form.Item> </Col> : null} <Col span={12}> - <Form.Item label="鍥哄畾鍒�"> + <Form.Item label="鍥哄畾琛ㄥご"> {getFieldDecorator('columnfixed', { initialValue: data.columnfixed ? 'true' : 'false' })( - <Select> - <Select.Option value="true">鏄�</Select.Option> - <Select.Option value="false">鍚�</Select.Option> - </Select> + <Radio.Group> + <Radio value="true">{dict['header.form.true']}</Radio> + <Radio value="false">{dict['header.form.false']}</Radio> + </Radio.Group> )} </Form.Item> </Col> diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index 081cc1f..a059ebf 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -74,7 +74,7 @@ */ UNSAFE_componentWillMount () { const { menu, editAction, config } = this.props - console.log(menu) + let _config = '' let _originMenu = '' diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx index 767f8bd..b3918cd 100644 --- a/src/templates/subtableconfig/actionform/index.jsx +++ b/src/templates/subtableconfig/actionform/index.jsx @@ -2,6 +2,7 @@ import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber } from 'antd' import { btnIcons, btnClasses, formRule } from '@/utils/option.js' +import Utils from '@/utils/utils.js' import './index.scss' const { TextArea } = Input @@ -486,6 +487,8 @@ if (values.OpenType === 'excelIn' || values.OpenType === 'excelOut') { values.position = 'toolbar' values.Ot = 'notRequired' + } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d + values.linkTab = Utils.getuuid() } if (values.innerFunc === '' && values.sql === '') { diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index d0cfec9..7877567 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -510,8 +510,8 @@ creatFunc = () => { let _config = JSON.parse(JSON.stringify(this.state.config)) - this.formRef.handleConfirm().then(res => { - let btn = res // 鎸夐挳淇℃伅 + this.actionFormRef.handleConfirm().then(res => { + let btn = res // 鎸夐挳淇℃伅 let newLText = '' // 鍒涘缓瀛樺偍杩囩▼sql let DelText = '' // 鍒犻櫎瀛樺偍杩囩▼sql let isExit = false // 瀛樺偍杩囩▼鏄惁瀛樺湪 @@ -1718,7 +1718,7 @@ }) Api.getSystemConfig({ func: 'sPC_Get_LongParam', - MenuID: btn.uuid + MenuID: btn.OpenType === 'popview' ? btn.linkTab : btn.uuid }).then(res => { if (res.status) { this.setState({ @@ -1733,6 +1733,7 @@ _LongParam = '' } } + this.props.handleSubConfig(btn, config, _LongParam, 'tabButton') } else { this.setState({ diff --git a/src/templates/subtableconfig/settingform/index.jsx b/src/templates/subtableconfig/settingform/index.jsx index 628ce92..0bb4886 100644 --- a/src/templates/subtableconfig/settingform/index.jsx +++ b/src/templates/subtableconfig/settingform/index.jsx @@ -183,6 +183,23 @@ })(<TextArea rows={4} />)} </Form.Item> </Col> : null} + {interType !== 'outer' ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鏌ヨ鏃讹紝鎼滅储鏉′欢浠here鏉′欢鎷兼帴杩涘叆sql锛岀粺璁℃椂锛屽皢鏁版嵁婧愪腑浠モ�淍+鎼滅储瀛楁鈥濈殑鍐呭锛屼互鎼滅储鏉′欢涓殑鍊艰繘琛屾浛鎹㈠悗锛屾彁浜ゆ煡璇紝娉細鏌ヨ绫诲瀷浠呭湪浣跨敤绯荤粺鍑芥暟鏃舵湁鏁堛��"> + <Icon type="question-circle" /> + {dict['header.form.queryType']} + </Tooltip> + }> + {getFieldDecorator('queryType', { + initialValue: data.queryType || 'query' + })( + <Radio.Group> + <Radio value="query">{dict['header.form.query']}</Radio> + <Radio value="statistics">{dict['header.form.statistics']}</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} <Col span={12}> <Form.Item label="涓婚敭"> {getFieldDecorator('primaryKey', { @@ -236,6 +253,18 @@ })(<Input placeholder="ID asc, UID desc" autoComplete="off" />)} </Form.Item> </Col> + <Col span={12}> + <Form.Item label="鍒濆鍖�"> + {getFieldDecorator('onload', { + initialValue: data.onload || 'true' + })( + <Select> + <Select.Option value="true">鍔犺浇鏁版嵁</Select.Option> + <Select.Option value="false">涓嶅姞杞芥暟鎹�</Select.Option> + </Select> + )} + </Form.Item> + </Col> </Row> </Form> ) -- Gitblit v1.8.0