From fbe8b1adf4b50323b7ea6ad09c810cb3e07a69b9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 04 二月 2020 11:47:38 +0800 Subject: [PATCH] 2020-02-04 --- src/index.js | 4 src/templates/formtabconfig/modalform/index.jsx | 15 +++ src/api/index.js | 6 src/tabviews/subtable/index.jsx | 9 ++ src/tabviews/subtabtable/index.jsx | 9 ++ src/tabviews/commontable/index.jsx | 9 ++ src/templates/comtableconfig/source.jsx | 1 src/templates/subtableconfig/settingform/index.jsx | 83 ++++++++++++++++---- src/tabviews/tableshare/actionList/index.jsx | 3 src/templates/comtableconfig/settingform/index.jsx | 84 ++++++++++++++++---- src/templates/ushare/modalform/index.jsx | 17 +++- 11 files changed, 188 insertions(+), 52 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 117c6e1..45b2e26 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -230,9 +230,9 @@ param.SessionUid = sessionStorage.getItem('SessionUid') || '' param.LoginUID = sessionStorage.getItem('LoginUID') || '' - if (param.func === 'RolesAdd') { // 瑙掕壊娣诲姞鏃讹紝浼燼ppkey - param.appkey = window.GLOB.appkey || '' - } + // if (param.func === 'RolesAdd') { // 瑙掕壊娣诲姞鏃讹紝浼燼ppkey(澶栭儴鎺ュ彛缁熶竴娣诲姞) + // param.appkey = window.GLOB.appkey || '' + // } param.nonc = Utils.getuuid() diff --git a/src/index.js b/src/index.js index f688691..24e776d 100644 --- a/src/index.js +++ b/src/index.js @@ -36,9 +36,9 @@ if (process.env.NODE_ENV === 'production') { let service = window.GLOB.service ? (/\/$/.test(window.GLOB.service) ? window.GLOB.service : window.GLOB.service + '/') : '' - window.GLOB.subSystemApi = document.location.origin + '/' + service + 'webapi/dostar' + window.GLOB.subSystemApi = document.location.origin + '/' + service + 'webapi/dostars' } else { - window.GLOB.subSystemApi = 'http://qingqiumarket.cn/mkwms/webapi/dostar' + window.GLOB.subSystemApi = 'http://qingqiumarket.cn/mkwms/webapi/dostars' } diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 418a487..efc7193 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -360,7 +360,14 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - param.rduri = setting.interface + if (setting.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = setting.interface + } + + param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey + if (setting.outerFunc) { param.func = setting.outerFunc } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 85b41b9..42dd426 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -331,7 +331,14 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - param.rduri = setting.interface + if (setting.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = setting.interface + } + + param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey + if (setting.outerFunc) { param.func = setting.outerFunc } diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 79c3949..bfe8cee 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -294,7 +294,14 @@ if (setting.interType === 'inner') { param.func = setting.innerFunc } else { - param.rduri = setting.interface + if (setting.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = setting.interface + } + + param.appkey = window.GLOB.appkey || '' // 璋冪敤澶栭儴鎺ュ彛澧炲姞appkey + if (setting.outerFunc) { param.func = setting.outerFunc } diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index 351af34..0bf9060 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -380,6 +380,9 @@ if (!res) return // 澶栭儴璇锋眰 _outParam = JSON.parse(JSON.stringify(res)) + + res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey + return Api.genericInterface(res) }).then(response => { if (!response) return diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx index bcf491c..4d3b356 100644 --- a/src/templates/comtableconfig/settingform/index.jsx +++ b/src/templates/comtableconfig/settingform/index.jsx @@ -20,7 +20,8 @@ interType: this.props.data.interType || 'inner', columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'), currentTabs: null, - selectTabs: [] + selectTabs: [], + interReadonly: false } UNSAFE_componentWillMount() { @@ -46,7 +47,8 @@ this.setState({ currentTabs: _tabs, - selectTabs: _select + selectTabs: _select, + interReadonly: data.sysInterface === 'true' }) } @@ -77,7 +79,38 @@ onChange = (e) => { this.setState({ interType: e.target.value + }, () => { + if (e.target.value === 'inner') return + + let _type = this.props.form.getFieldValue('sysInterface') + if (_type === 'true') { + this.props.form.setFieldsValue({ + interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + }) + this.setState({ + interReadonly: true + }) + } else { + this.setState({ + interReadonly: false + }) + } }) + } + + onSysChange = (e) => { + if (e.target.value === 'true') { + this.props.form.setFieldsValue({ + interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + }) + this.setState({ + interReadonly: true + }) + } else { + this.setState({ + interReadonly: false + }) + } } selectChange = (val) => { @@ -164,9 +197,21 @@ </Form.Item> </Col> {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.sysInterface']}> + {getFieldDecorator('sysInterface', { + initialValue: data.sysInterface || 'false' + })( + <Radio.Group onChange={this.onSysChange}> + <Radio value="true">{dict['header.form.true']}</Radio> + <Radio value="false">{dict['header.form.false']}</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {interType === 'outer' ? <Col span={12}> <Form.Item label={dict['header.form.interface']}> {getFieldDecorator('interface', { - initialValue: data.interface || '', + initialValue: data.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (data.interface || ''), rules: [ { required: true, @@ -175,6 +220,22 @@ { max: formRule.input.max, message: formRule.input.message + } + ] + })(<Input placeholder="" autoComplete="off" disabled={this.state.interReadonly} />)} + </Form.Item> + </Col> : null} + {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" />)} @@ -242,22 +303,7 @@ )} </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', { diff --git a/src/templates/comtableconfig/source.jsx b/src/templates/comtableconfig/source.jsx index 709cbf0..7280caf 100644 --- a/src/templates/comtableconfig/source.jsx +++ b/src/templates/comtableconfig/source.jsx @@ -18,6 +18,7 @@ order: '', dataresource: '', interType: 'inner', + sysInterface: 'false', innerFunc: '', interface: '', outerFunc: '', diff --git a/src/templates/formtabconfig/modalform/index.jsx b/src/templates/formtabconfig/modalform/index.jsx index 9ed3ea8..f21bf57 100644 --- a/src/templates/formtabconfig/modalform/index.jsx +++ b/src/templates/formtabconfig/modalform/index.jsx @@ -39,7 +39,10 @@ } if (type === 'select') { - _options = [..._options, 'setAll', 'linkSubField'] + _options = [..._options, 'setAll'] + if (resourceType === '1') { + _options.push('linkSubField') + } } else if (type === 'link') { // 鍏宠仈绫诲瀷銆佸鍔犲叧鑱斿瓧娈� _options = [..._options, 'setAll', 'linkField'] } else if (type === 'funcvar') { // 璁剧疆涓哄嚱鏁板彉閲忔椂锛屼笉闇�瑕佸叾浠栦俊鎭� @@ -90,7 +93,10 @@ } if (value === 'select') { - _options = [..._options, 'setAll', 'linkSubField'] + _options = [..._options, 'setAll'] + if (this.state.resourceType === '1') { + _options.push('linkSubField') + } } else if (value === 'link') { _options = [..._options, 'setAll', 'linkField'] } else if (value === 'funcvar') { @@ -142,7 +148,10 @@ } if (openType === 'select') { - _options = [..._options, 'setAll', 'linkSubField'] + _options = [..._options, 'setAll'] + if (value === '1') { + _options.push('linkSubField') + } } else if (openType === 'link') { _options = [..._options, 'setAll', 'linkField'] } diff --git a/src/templates/subtableconfig/settingform/index.jsx b/src/templates/subtableconfig/settingform/index.jsx index 0bb4886..a67d205 100644 --- a/src/templates/subtableconfig/settingform/index.jsx +++ b/src/templates/subtableconfig/settingform/index.jsx @@ -17,7 +17,8 @@ state = { interType: this.props.data.interType || 'inner', - columns: this.props.columns.filter(item => item.field && item.type !== 'colspan') + columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'), + interReadonly: this.props.data.sysInterface === 'true' } handleConfirm = () => { @@ -44,10 +45,44 @@ }) } + /** + * @description 鍒囨崲鎺ュ彛绫诲瀷 + */ onChange = (e) => { this.setState({ interType: e.target.value + }, () => { + if (e.target.value === 'inner') return + + let _type = this.props.form.getFieldValue('sysInterface') + if (_type === 'true') { + this.props.form.setFieldsValue({ + interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + }) + this.setState({ + interReadonly: true + }) + } else { + this.setState({ + interReadonly: false + }) + } }) + } + + onSysChange = (e) => { + if (e.target.value === 'true') { + this.props.form.setFieldsValue({ + interface: window.GLOB.mainSystemApi || window.GLOB.subSystemApi + }) + this.setState({ + interReadonly: true + }) + } else { + this.setState({ + interReadonly: false + }) + } } selectChange = (val) => { @@ -134,9 +169,21 @@ </Form.Item> </Col> {interType === 'outer' ? <Col span={12}> + <Form.Item label={dict['header.form.sysInterface']}> + {getFieldDecorator('sysInterface', { + initialValue: data.sysInterface || 'false' + })( + <Radio.Group onChange={this.onSysChange}> + <Radio value="true">{dict['header.form.true']}</Radio> + <Radio value="false">{dict['header.form.false']}</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {interType === 'outer' ? <Col span={12}> <Form.Item label={dict['header.form.interface']}> {getFieldDecorator('interface', { - initialValue: data.interface || '', + initialValue: data.sysInterface === 'true' ? (window.GLOB.mainSystemApi || window.GLOB.subSystemApi) : (data.interface || ''), rules: [ { required: true, @@ -145,6 +192,22 @@ { max: formRule.input.max, message: formRule.input.message + } + ] + })(<Input placeholder="" autoComplete="off" disabled={this.state.interReadonly} />)} + </Form.Item> + </Col> : null} + {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" />)} @@ -220,22 +283,6 @@ )} </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', { diff --git a/src/templates/ushare/modalform/index.jsx b/src/templates/ushare/modalform/index.jsx index d0a7029..4151053 100644 --- a/src/templates/ushare/modalform/index.jsx +++ b/src/templates/ushare/modalform/index.jsx @@ -39,7 +39,10 @@ } if (type === 'select') { - _options = [..._options, 'setAll', 'linkSubField'] + _options = [..._options, 'setAll'] + if (resourceType === '1') { + _options.push('linkSubField') + } } else if (type === 'link') { // 鍏宠仈绫诲瀷銆佸鍔犲叧鑱斿瓧娈� _options = [..._options, 'setAll', 'linkField'] } else if (type === 'funcvar') { // 璁剧疆涓哄嚱鏁板彉閲忔椂锛屼笉闇�瑕佸叾浠栦俊鎭� @@ -92,7 +95,10 @@ } if (value === 'select') { - _options = [..._options, 'setAll', 'linkSubField'] + _options = [..._options, 'setAll'] + if (this.state.resourceType === '1') { + _options.push('linkSubField') + } } else if (value === 'link') { _options = [..._options, 'setAll', 'linkField'] } else if (value === 'funcvar') { @@ -136,7 +142,7 @@ const { openType } = this.state let value = e.target.value if (key === 'resourceType') { - let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required'] + let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required', 'hidden'] if (value === '0') { _options = [..._options, 'options'] } else if (value === '1') { @@ -144,7 +150,10 @@ } if (openType === 'select') { - _options = [..._options, 'setAll', 'linkSubField'] + _options = [..._options, 'setAll'] + if (value === '1') { + _options.push('linkSubField') + } } else if (openType === 'link') { _options = [..._options, 'setAll', 'linkField'] } -- Gitblit v1.8.0