From 24842b40de5cd60700bf69dfd38a0332f5431e36 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 23 五月 2025 10:55:07 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/tabviews/custom/components/card/double-data-card/index.jsx | 120 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 85 insertions(+), 35 deletions(-) diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index 8ee5097..3aa3097 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -116,6 +116,12 @@ }) _config.subcards = null + + if (!_config.wrap.cardType) { + _config.wrap.selStyle = 'none' + _config.wrap.selected = 'false' + _config.wrap.pickup = 'false' + } let selected = 'false' if (_config.wrap.selected === 'always' || _config.wrap.selected === 'init' || _config.wrap.selected === 'sign') { @@ -124,26 +130,29 @@ _config.wrap.selected = 'false' } - _config.wrap.selStyle = _config.wrap.selStyle || 'active' + _config.wrap.selStyle = _config.wrap.selStyle || 'check' _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' - _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''}` + _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${config.wrap.empSign === 'hidden' ? 'mk-empty-hide' : ''}` if (_config.wrap.zHeight || _config.wrap.minWidth) { + _config.wrap.zoomStyle = { + maxHeight: 'none', + '--mk-data-zoom-width': _config.wrap.minWidth ? _config.wrap.minWidth + 'px' : '100%' + } + if (_config.wrap.zHeight) { if (_config.wrap.zHeight <= 100) { if (_config.wrap.zHeight < 0) { - _config.wrap.zHeight = `calc(100vh - ${-_config.wrap.zHeight}px)` + _config.wrap.zoomStyle.maxHeight = `calc(100vh - ${-_config.wrap.zHeight}px)` + _config.wrap.zoomStyle.minHeight = '100px' } else { - _config.wrap.zHeight = _config.wrap.zHeight + 'vh' + _config.wrap.zoomStyle.maxHeight = _config.wrap.zHeight + 'vh' } + } else { + _config.wrap.zoomStyle.maxHeight = _config.wrap.zHeight + 'px' } _config.wrap.wrapClass += ' fix-height' - } - _config.wrap.minWidth = _config.wrap.minWidth ? _config.wrap.minWidth + 'px' : '100%' - _config.wrap.zoomStyle = { - maxHeight: _config.wrap.zHeight || 'none', - '--mk-data-zoom-width': _config.wrap.minWidth } } else { _config.wrap.zoomStyle = null @@ -175,8 +184,10 @@ }) } - _config.setting.sub_field = subconfig.columns.map(col => col.field).join(',') - _config.setting.all_field = _config.setting.arr_field + ',' + _config.setting.sub_field + if (_config.setting.subdata !== 'sub_data_string') { + _config.setting.sub_field = subconfig.columns.map(col => col.field).join(',') + _config.setting.all_field = _config.setting.arr_field + ',' + _config.setting.sub_field + } let pageOptions = ['10', '25', '50', '100', '500', '1000'] @@ -193,6 +204,10 @@ if (_config.wrap.maxPageSize) { pageOptions = pageOptions.filter(item => item <= _config.wrap.maxPageSize) } + } + + if (_config.setting.supModule && !BID && _config.wrap.supKey !== 'false') { + _config.setting.onload = 'false' } this.setState({ @@ -267,13 +282,18 @@ if (config.$cache) { let getData = (res) => { return res.map((item, index) => { + let _children = item[config.setting.subdata] + + delete item[config.setting.subdata] + if (config.setting.subdata === 'sub_data_string') { + _children = this.parseSubData(_children) + } else if (item.sub_data_string) { + _children = this.parseSubData(item.sub_data_string) + } + let children = [] - if (item[config.setting.subdata]) { - let _children = item[config.setting.subdata] - - delete item[config.setting.subdata] - + if (_children) { _children.forEach((cell, i) => { cell.key = i cell.$$uuid = cell[config.setting.subKey] || '' @@ -332,6 +352,21 @@ this.loadData() }, config.setting.delay || 0) } + } + + parseSubData = (data) => { + try { + data = JSON.parse(data) + if (typeof(data) !== 'object') { + data = [] + } else if (!Array.isArray(data)) { + data = [data] + } + } catch(e) { + console.warn('Data parsing error.') + data = [] + } + return data } autoExec = (times) => { @@ -645,12 +680,17 @@ if (type === 'plus') { let _data = (this.state.data || []).concat(result.data || []) data = _data.map((item, index) => { - if (item[config.setting.subdata]) { - let children = [] - let _children = item[config.setting.subdata] + let _children = item[config.setting.subdata] + + delete item[config.setting.subdata] + if (config.setting.subdata === 'sub_data_string') { + _children = this.parseSubData(_children) + } else if (item.sub_data_string) { + _children = this.parseSubData(item.sub_data_string) + } - delete item[config.setting.subdata] - + let children = [] + if (_children) { _children.forEach((cell, i) => { cell.key = i cell.$$uuid = cell[config.setting.subKey] || '' @@ -663,10 +703,9 @@ children.push(cell) } }) - item.children = children - } else if (!item.children) { - item.children = [] } + + item.children = children item.key = index item.$$uuid = item[config.setting.primaryKey] || '' @@ -684,13 +723,18 @@ }) } else { data = result.data.map((item, index) => { + let _children = item[config.setting.subdata] + + delete item[config.setting.subdata] + if (config.setting.subdata === 'sub_data_string') { + _children = this.parseSubData(_children) + } else if (item.sub_data_string) { + _children = this.parseSubData(item.sub_data_string) + } + let children = [] - if (item[config.setting.subdata]) { - let _children = item[config.setting.subdata] - - delete item[config.setting.subdata] - + if (_children) { _children.forEach((cell, i) => { cell.key = i cell.$$uuid = cell[config.setting.subKey] || '' @@ -810,13 +854,19 @@ data = data.map(item => { if (item.$$uuid === _data.$$uuid) { + let _children = _data[config.setting.subdata] + + delete _data[config.setting.subdata] + + if (config.setting.subdata === 'sub_data_string') { + _children = this.parseSubData(_children) + } else if (_data.sub_data_string) { + _children = this.parseSubData(_data.sub_data_string) + } + let children = [] - if (_data[config.setting.subdata]) { - let _children = _data[config.setting.subdata] - - delete _data[config.setting.subdata] - + if (_children) { _children.forEach((cell, i) => { cell.key = i cell.$$uuid = cell[config.setting.subKey] || '' @@ -952,7 +1002,7 @@ if (config.setting.supModule && !BID && config.wrap.supKey !== 'false') { notification.warning({ top: 92, - message: window.GLOB.dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒', + message: config.setting.supModTip || window.GLOB.dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒', duration: 5 }) this.setState({ -- Gitblit v1.8.0