From d33d00cafeea2c4f980ea3af268d9260269edcc1 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 25 一月 2021 18:24:20 +0800 Subject: [PATCH] 2021-01-25 --- src/tabviews/subtable/index.jsx | 45 +++++++++++---------------------------------- 1 files changed, 11 insertions(+), 34 deletions(-) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 6e798b6..b709835 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -74,14 +74,12 @@ }, () => { if (this.state.setting) { this.loadmaindata(nextProps.BID, 'refresh') - this.getStatFieldsValue(nextProps.BID, 'refresh') } }) } else if (!this.props.Tab.supMenu && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { if (this.state.setting) { this.setState({}, () => { this.loadmaindata() - this.getStatFieldsValue() }) } } @@ -103,6 +101,7 @@ try { // 閰嶇疆淇℃伅瑙f瀽 config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + config.setting.MenuName = Tab.label } catch (e) { console.warn('Parse Failure') config = '' @@ -274,7 +273,7 @@ config.setting.execute = config.setting.default !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 config.setting.customScript = '' // 鑷畾涔夎剼鏈� - if (config.setting.interType === 'system') { + if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { if (config.setting.scripts && config.setting.scripts.length > 0) { let _customScript = '' config.setting.scripts.forEach(item => { @@ -321,7 +320,6 @@ }, () => { if (config.setting.onload !== 'false' && (!Tab.supMenu || BID || Tab.isTreeNode) && valid) { // 鍒濆鍖栧彲鍔犺浇 this.loadmaindata() - this.getStatFieldsValue() } }) } else { @@ -371,6 +369,7 @@ if (!bid) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃 this.setState({ data: [], + statFValue: [], total: 0 }) return @@ -378,6 +377,7 @@ _BID = bid } } + this.setState({ selectedData: [], loading: true @@ -393,6 +393,9 @@ } let result = await Api.genericInterface(param) + + this.getStatFieldsValue(_BID, searches) + if (result.status) { this.setState({ data: result.data.map((item, index) => { @@ -501,36 +504,13 @@ /** * @description 鑾峰彇鍚堣瀛楁鍊� */ - getStatFieldsValue = (bid, type) => { - const { mainSearch } = this.props - const { setting, search, orderBy, statFields } = this.state + getStatFieldsValue = (bid, searches) => { + const { setting, orderBy, statFields } = this.state - let _BID = this.props.BID - let searches = fromJS(search).toJS() - if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 - searches = [...mainSearch, ...searches] - } - - if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return - - let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) - if (requireFields.length > 0) { - return - } - - if (type === 'refresh') { - if (!bid) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃鍚堣鍊� - this.setState({ - statFValue: [] - }) - return - } else { - _BID = bid - } - } + if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, _BID, this.props.menuType) + let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, bid, this.props.menuType) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.Tab.label || '' @@ -580,7 +560,6 @@ search: searches, }, () => { this.loadmaindata() - this.getStatFieldsValue() }) } @@ -615,12 +594,10 @@ pageIndex: 1 }, () => { this.loadmaindata() - this.getStatFieldsValue() }) } else { MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid, 'false') // 鍒楄〃閲嶇疆 this.loadmaindata() - this.getStatFieldsValue() } } -- Gitblit v1.8.0