From 76a4300654a18d228838c3f27455dc8e7a8cd616 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 15 一月 2021 17:04:42 +0800 Subject: [PATCH] Merge branch 'master' into bms --- src/tabviews/subtable/index.jsx | 138 +++++++++++++++++++++------------------------- 1 files changed, 63 insertions(+), 75 deletions(-) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 874d125..6e798b6 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -35,7 +35,6 @@ mainSearch: PropTypes.any, // 涓昏〃鎼滅储鏉′欢 ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d - userConfig: PropTypes.any, // 鐢ㄦ埛鑷畾涔夎缃� } state = { @@ -49,7 +48,7 @@ columns: null, // 鏄剧ず鍒� arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: null, // 鍒楄〃鏁版嵁闆� + data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� total: 0, // 鎬绘暟 loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� @@ -92,7 +91,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, permMenus, Tab, BID, userConfig } = this.props + const { permAction, permMenus, Tab, BID } = this.props let param = { func: 'sPC_Get_LongParam', @@ -176,28 +175,6 @@ let chartId = config.charts[0] ? config.charts[0].uuid : '' - if (userConfig) { - config.action = config.action.map(item => { - if (userConfig.action[item.uuid]) { - delete userConfig.action[item.uuid].label - item = {...item, ...userConfig.action[item.uuid]} - } - - if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify && item.printer) { - item.verify.defaultPrinter = item.printer.defaultPrinter || '' - if (item.verify.printerTypeList && item.printer.printerList) { - item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { - cell.printer = item.printer.printerList[cell.Value] || '' - - return cell - }) - } - } - - return item - }) - } - // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid config.columns.forEach(col => { if (col.field) { @@ -242,8 +219,10 @@ subcols.push(colMap.get(sub)) } }) - _col.subcols = subcols - _columns.push(_col) + if (subcols.length > 0) { + _col.subcols = subcols + _columns.push(_col) + } } else { _columns.push(col) } @@ -256,6 +235,20 @@ item.logLabel = Tab.label + '-' + item.label // 鐢ㄤ簬sPC_TableData_InUpDe璁板綍鎿嶄綔鎸夐挳 item.$menuId = this.props.MenuID + if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 鎵撳嵃鏈鸿缃� + let _item = window.GLOB.UserCacheMap.get(Tab.uuid + item.uuid) + + if (_item) { + item.verify.defaultPrinter = _item.printer || '' + if (item.verify.printerTypeList && _item.printerList) { + item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { + cell.printer = _item.printerList[cell.Value] || '' + + return cell + }) + } + } + } if (item.position === 'toolbar') { _actions.push(item) } else if (item.position === 'grid') { @@ -274,22 +267,6 @@ valid = false } }) - - // 娣诲姞鐢ㄦ埛鏄剧ず鍒楄缃� - if (userConfig) { - _columns = _columns.map(item => { - if (userConfig.columns[item.uuid]) { - delete userConfig.columns[item.uuid].label - item = {...item, ...userConfig.columns[item.uuid]} - } - - return item - }) - - _columns.sort((pre, next) => { - return pre.sort - next.sort - }) - } config.setting.tabType = 'sub' // 鏁版嵁婧愪俊鎭澶勭悊 @@ -428,6 +405,9 @@ }) } item.key = index + item.$$uuid = item[setting.primaryKey] || '' + item.$$BID = _BID || '' + return item }), total: result.total, @@ -489,6 +469,9 @@ data = data.map(item => { if (item[setting.primaryKey] === _data[setting.primaryKey]) { _data.key = item.key + _data.$$uuid = _data[setting.primaryKey] || '' + _data.$$BID = BID || '' + return _data } else { return item @@ -642,31 +625,6 @@ } /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (position, btn) => { - const { Tab, SupMenuID, BID } = this.props - - if (position === 'grid' || position === 'view') { - this.reloadtable(btn) - } else if (position === 'maingrid' || position === 'mainline') { - this.reloadtable(btn) - if (Tab.supMenu === 'mainTable') { - MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 涓昏〃閲嶇疆 - } else if (Tab.supMenu) { - MKEmitter.emit('reloadData', Tab.supMenu, (BID || 'empty')) // 涓昏〃閲嶇疆 - } else if (!Tab.supMenu && Tab.level === 0) { - MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 鏍戝舰缁撴瀯锛�0绾ф爣绛� - } - } else if (position === 'equaltab') { - this.reloadtable(btn) - if (Tab.equalTab && Tab.equalTab.length > 0) { - MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 鍚岀骇鏍囩閲嶇疆 - } - } - } - - /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ getexceloutparam = (menuId, btnId) => { @@ -720,7 +678,7 @@ this.setState({chartId: uuid}) } - reloadData = (menuId, id) => { + reloadData = (menuId, id) => { // Id瀛樺湪鏃讹紝鍒锋柊琛� const { MenuID } = this.props if (menuId.indexOf(MenuID) === -1) return @@ -730,6 +688,38 @@ this.reloadtable() } else { this.loadmainLinedata(id) + } + } + + /** + * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂� + * @param {*} menuId // 鑿滃崟Id + * @param {*} position // 鍒锋柊浣嶇疆 + * @param {*} btn // 鎵ц鐨勬寜閽� + */ + refreshByButtonResult = (menuId, position, btn) => { + const { MenuID } = this.props + + if (MenuID !== menuId) return + + const { Tab, SupMenuID, BID } = this.props + + if (position === 'grid' || position === 'view') { + this.reloadtable(btn) + } else if (position === 'maingrid' || position === 'mainline') { + this.reloadtable(btn) + if (Tab.supMenu === 'mainTable') { + MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 涓昏〃閲嶇疆 + } else if (Tab.supMenu) { + MKEmitter.emit('reloadData', Tab.supMenu, (BID || 'empty')) // 涓昏〃閲嶇疆 + } else if (!Tab.supMenu && Tab.level === 0) { + MKEmitter.emit('reloadData', SupMenuID, (BID || 'empty')) // 鏍戝舰缁撴瀯锛�0绾ф爣绛� + } + } else if (position === 'equaltab') { + this.reloadtable(btn) + if (Tab.equalTab && Tab.equalTab.length > 0) { + MKEmitter.emit('reloadData', Tab.equalTab.join(',')) // 鍚岀骇鏍囩閲嶇疆 + } } } @@ -745,6 +735,7 @@ componentDidMount () { MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('getexceloutparam', this.getexceloutparam) + MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) } /** @@ -756,6 +747,7 @@ } MKEmitter.removeListener('reloadData', this.reloadData) MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) + MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) } render() { @@ -790,7 +782,6 @@ BData={this.props.BData} MenuID={this.props.MenuID} selectedData={selectedData} - refreshdata={this.refreshbyaction} ContainerId={this.props.ContainerId} /> </div> @@ -804,18 +795,16 @@ setting={setting} columns={columns} pageSize={pageSize} - BID={this.props.BID} dict={this.state.dict} data={this.state.data} BData={this.props.BData} total={this.state.total} MenuID={this.props.MenuID} loading={this.state.loading} - refreshdata={this.refreshbytable} statFValue={this.state.statFValue} - handleTableId={this.handleTableId} ContainerId={this.props.ContainerId} - refreshbyaction={this.refreshbyaction} + refreshdata={this.refreshbytable} + handleTableId={this.handleTableId} chgSelectData={this.changeSelectedData} /> </div> @@ -835,7 +824,6 @@ MenuID={this.props.MenuID} loading={this.state.loading} tableId={this.props.Tab.uuid} - refreshdata={this.refreshbyaction} handleTableId={this.handleTableId} /> </Col> -- Gitblit v1.8.0