From 3659f0773a14b54c18ed0af8b64de4afe8227489 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 04 十二月 2020 19:31:12 +0800 Subject: [PATCH] 2020-12-04 --- src/tabviews/formtab/index.jsx | 1 src/tabviews/formtab/actionList/index.jsx | 9 src/components/header/index.jsx | 4 src/tabviews/verupmanage/actionList/index.jsx | 16 src/tabviews/verupmanage/subtabtable/index.jsx | 21 src/tabviews/zshare/topSearch/index.jsx | 2 src/tabviews/zshare/normalTable/index.jsx | 104 ++++-- src/tabviews/commontable/secretKeyTable/index.jsx | 14 src/tabviews/zshare/actionList/index.jsx | 6 src/tabviews/zshare/topSearch/index.scss | 2 src/views/billprint/index.jsx | 1 src/tabviews/subtable/index.jsx | 22 src/tabviews/subtabtable/index.jsx | 22 src/tabviews/commontable/index.jsx | 20 src/tabviews/custom/components/table/normal-table/index.scss | 199 ------------- src/tabviews/zshare/actionList/changeuserbutton/index.jsx | 2 src/utils/utils.js | 59 ++-- src/tabviews/custom/components/share/searchLine/index.jsx | 2 src/views/sso/index.jsx | 2 src/tabviews/custom/components/share/searchLine/index.scss | 2 src/tabviews/scriptmanage/actionList/index.jsx | 1 src/tabviews/custom/components/table/normal-table/index.jsx | 12 src/router/index.js | 2 src/tabviews/custom/components/share/tabtransfer/index.scss | 41 -- /dev/null | 41 -- src/tabviews/commontable/index.scss | 64 ---- src/tabviews/custom/index.jsx | 65 +++- src/tabviews/scriptmanage/index.jsx | 21 src/tabviews/verupmanage/index.jsx | 20 src/tabviews/zshare/cardcomponent/index.jsx | 14 src/views/login/index.jsx | 4 31 files changed, 249 insertions(+), 546 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index c9e352c..1d6a2b3 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -490,12 +490,8 @@ sessionStorage.setItem('CloudUserName', res.UserName) sessionStorage.setItem('CloudFullName', res.FullName) sessionStorage.setItem('CloudAvatar', res.icon) - sessionStorage.setItem('cloudDataM', res.dataM ? 'true' : '') - sessionStorage.setItem('localDataM', sessionStorage.setItem('dataM') || '') - sessionStorage.setItem('cloudRole_id', res.role_id || '') - sessionStorage.setItem('localRole_id', sessionStorage.getItem('role_id') || '') sessionStorage.setItem('role_id', res.role_id || '') sessionStorage.setItem('dataM', res.dataM ? 'true' : '') diff --git a/src/router/index.js b/src/router/index.js index a794081..e3d881c 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -47,8 +47,10 @@ _param.Full_Name && sessionStorage.setItem('Full_Name', _param.Full_Name) _param.debug && sessionStorage.setItem('debug', _param.debug) _param.dataM && sessionStorage.setItem('dataM', _param.dataM) + _param.dataM && sessionStorage.setItem('localDataM', _param.dataM) _param.avatar && sessionStorage.setItem('avatar', _param.avatar) _param.role_id && sessionStorage.setItem('role_id', _param.role_id) + _param.dataM && sessionStorage.setItem('localRole_id', _param.dataM) _param.Member_Level && sessionStorage.setItem('Member_Level', _param.Member_Level) if (_param.mainlogo) { diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 038a092..466aca2 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -51,7 +51,6 @@ searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� @@ -258,7 +257,6 @@ let _arrField = [] // 瀛楁闆� let _columns = [] // 鏄剧ず鍒� - let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 let statFields = [] // 鍚堣瀛楁淇℃伅 @@ -282,7 +280,6 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) - _logcolumns.push(col) col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { @@ -291,8 +288,6 @@ } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 _hideCol = _hideCol.concat(col.sublist) - } else if (col.Hide === 'true') { - _hideCol.push(col.uuid) } colMap.set(col.uuid, col) }) @@ -310,10 +305,14 @@ col.sort = index - if (col.type === 'colspan' && col.sublist) { + if (col.type === 'colspan') { + if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 + col.type = 'old_colspan' + } + let _col = fromJS(col).toJS() let subcols = [] - _col.sublist.forEach(sub => { + _col.sublist && _col.sublist.forEach(sub => { if (colMap.has(sub)) { subcols.push(colMap.get(sub)) } @@ -367,7 +366,6 @@ searchlist: config.search, actions: _actions, columns: _columns, - logcolumns: _logcolumns, arr_field: _arrField.join(','), search: Utils.initMainSearch(initSearch) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { @@ -946,11 +944,11 @@ BID={BID} setting={setting} actions={actions} + columns={columns} MenuName={MenuName} dict={this.state.dict} MenuID={this.props.MenuID} selectedData={selectedData} - logcolumns={this.state.logcolumns} ContainerId={this.state.ContainerId} refreshdata={this.refreshbyaction} getexceloutparam={this.getexceloutparam} @@ -974,7 +972,6 @@ tableId="mainTable" BID={BID} pickup={pickup} - config={config} setting={setting} columns={columns} MenuName={MenuName} @@ -985,7 +982,6 @@ MenuID={this.props.MenuID} loading={this.state.loading} refreshdata={this.refreshbytable} - logcolumns={this.state.logcolumns} statFValue={this.state.statFValue} handleTableId={this.handleTableId} ContainerId={this.state.ContainerId} @@ -1002,12 +998,12 @@ BID={BID} plot={item} config={config} + columns={columns} MenuName={MenuName} tableId="mainTable" data={this.state.data} MenuID={this.props.MenuID} loading={this.state.loading} - logcolumns={this.state.logcolumns} ContainerId={this.state.ContainerId} refreshdata={this.refreshbyaction} getexceloutparam={this.getexceloutparam} diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index 3d3f54b..f76ce06 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -171,67 +171,3 @@ } } } - -.commontable.bg-gray { - background: #f0f2f5; - >.top-search { - background: #ffffff; - padding: 10px 10px; - margin: 0 20px; - } - .chart-view { - margin-bottom: 20px; - .ant-col:last-child { - .line-chart-plot-box { - margin-bottom: 0px; - } - .card-row-box { - margin-bottom: 0px; - } - .normal-data-table { - margin-bottom: 0px; - } - } - >.ant-col { - min-height: 50px; - } - } - .line-chart-plot-box { - background: #ffffff; - padding: 10px; - margin-bottom: 20px; - } - .card-row-box { - min-height: 130px; - background: #ffffff; - padding-bottom: 10px; - margin-bottom: 20px; - } - .commontable-main-action { - padding: 0 10px; - background: #ffffff; - } - .normal-data-table { - padding: 0 10px 10px; - margin-bottom: 20px; - background: #ffffff; - } - .main-pickup { - right: 45px; - } - .custom-control { - right: 10px; - } - > .ant-tabs { - margin: 0px 20px 20px; - padding: 0px; - width: calc(100% - 40px); - background: #ffffff; - .top-search { - padding: 0 10px 10px; - } - .button-list.toolbar-button { - padding: 15px 10px 5px; - } - } -} \ No newline at end of file diff --git a/src/tabviews/commontable/secretKeyTable/index.jsx b/src/tabviews/commontable/secretKeyTable/index.jsx index 1f5aa55..ec09fb6 100644 --- a/src/tabviews/commontable/secretKeyTable/index.jsx +++ b/src/tabviews/commontable/secretKeyTable/index.jsx @@ -78,12 +78,9 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) - } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 _hideCol = _hideCol.concat(col.sublist) - } else if (col.Hide === 'true') { - _hideCol.push(col.uuid) } colMap.set(col.uuid, col) }) @@ -92,10 +89,14 @@ config.columns.forEach(col => { if (_hideCol.includes(col.uuid)) return - if (col.type === 'colspan' && col.sublist) { - let _col = JSON.parse(JSON.stringify(col)) + if (col.type === 'colspan') { + if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 + col.type = 'old_colspan' + } + + let _col = fromJS(col).toJS() let subcols = [] - _col.sublist.forEach(sub => { + _col.sublist && _col.sublist.forEach(sub => { if (colMap.has(sub)) { subcols.push(colMap.get(sub)) } @@ -346,7 +347,6 @@ <SubTable tableId={this.props.Tab.uuid} pickup={pickup} - config={config} setting={setting} columns={columns} dict={this.state.dict} diff --git a/src/tabviews/custom/components/share/searchLine/index.jsx b/src/tabviews/custom/components/share/searchLine/index.jsx index 03c31e6..ba3aaab 100644 --- a/src/tabviews/custom/components/share/searchLine/index.jsx +++ b/src/tabviews/custom/components/share/searchLine/index.jsx @@ -773,7 +773,7 @@ } return ( - <Form {...formItemLayout} className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}> + <Form {...formItemLayout} className="header-top-search" id={this.state.formId} onSubmit={this.handleSearch}> <Row gutter={24}>{this.getFields()}</Row> </Form> ) diff --git a/src/tabviews/custom/components/share/searchLine/index.scss b/src/tabviews/custom/components/share/searchLine/index.scss index ee84ed1..3ab24d8 100644 --- a/src/tabviews/custom/components/share/searchLine/index.scss +++ b/src/tabviews/custom/components/share/searchLine/index.scss @@ -1,4 +1,4 @@ -.ant-advanced-search-form.top-search { +.header-top-search { padding: 0px 24px 10px; border-bottom: 1px solid #efefef; .ant-form-item { diff --git a/src/tabviews/custom/components/share/tabtransfer/index.scss b/src/tabviews/custom/components/share/tabtransfer/index.scss index ee84ed1..e69de29 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.scss +++ b/src/tabviews/custom/components/share/tabtransfer/index.scss @@ -1,41 +0,0 @@ -.ant-advanced-search-form.top-search { - padding: 0px 24px 10px; - border-bottom: 1px solid #efefef; - .ant-form-item { - display: flex; - margin-bottom: 0px; - min-height: 60px; - .ant-form-explain { - white-space: nowrap; - } - } - .ant-form-item-control-wrapper { - flex: 1; - width: calc(100% - 100px); - } - .ant-form-item-label { - // width: 100px; - text-overflow: ellipsis; - } - .daterange .ant-calendar-picker-input { - padding: 4px 20px 4px 5px; - font-size: 13px; - } - .ant-select-dropdown { - z-index: 10 !important; - } - .ant-calendar-picker-container { - z-index: 10 !important; - } - .group-required { - label::before { - display: inline-block; - margin-right: 4px; - color: #f5222d; - font-size: 14px; - font-family: SimSun, sans-serif; - line-height: 1; - content: '*'; - } - } -} \ No newline at end of file diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index e073a75..6dc10dc 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -34,7 +34,6 @@ searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� @@ -83,8 +82,6 @@ } return item }) - } else if (column.type === 'colspan') { - column.unfold = 'true' } else if (column.type === 'action') { column.operations = column.elements } @@ -458,10 +455,10 @@ render() { const { MenuName } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, pickup, config, selectedData } = this.state + const { BID, setting, searchlist, pageSize, actions, config, columns, pickup, selectedData } = this.state return ( - <div className="commontable"> + <div className="custom-normal-table"> {searchlist && searchlist.length > 0 ? <MainSearch BID={BID} @@ -476,11 +473,11 @@ BID={BID} setting={setting} actions={actions} + columns={config.columns} MenuName={MenuName} dict={this.state.dict} MenuID={this.props.MenuID} selectedData={selectedData} - logcolumns={this.state.logcolumns} refreshdata={this.refreshbyaction} getexceloutparam={this.getexceloutparam} /> @@ -493,18 +490,17 @@ tableId="mainTable" BID={BID} pickup={pickup} - config={config} setting={setting} columns={columns} MenuName={MenuName} pageSize={pageSize} dict={this.state.dict} data={this.state.data} + fields={config.columns} total={this.state.total} MenuID={this.props.MenuID} loading={this.state.loading} refreshdata={this.refreshbytable} - logcolumns={this.state.logcolumns} statFValue={this.state.statFValue} handleTableId={this.handleTableId} refreshbyaction={this.refreshbyaction} diff --git a/src/tabviews/custom/components/table/normal-table/index.scss b/src/tabviews/custom/components/table/normal-table/index.scss index 3d3f54b..1d09da9 100644 --- a/src/tabviews/custom/components/table/normal-table/index.scss +++ b/src/tabviews/custom/components/table/normal-table/index.scss @@ -1,10 +1,8 @@ -.commontable { +.custom-normal-table { position: relative; - min-height: calc(100vh - 94px); - padding-top: 16px; - padding-bottom: 80px; - .box404 { - padding-top: 30px; + + .top-search { + padding: 0; } .commontable-main-action { min-height: 25px; @@ -25,41 +23,11 @@ max-height: calc(100vh - 265px); } } - > .ant-spin { - position: absolute; - z-index: 10; - left: calc(50% - 22px); - top: calc(50vh - 70px); - } - > .ant-card { - margin: 0 20px 20px; - > .ant-card-head { - border: 0; - padding: 0; - min-height: 30px; - .ant-card-head-title { - padding: 10px 0 0; - span { - color: #1890ff; - display: inline-block; - padding: 0 10px; - font-size: 15px; - border-bottom: 1px solid #1890ff; - i { - margin-right: 10px; - } - } - } - } - > .ant-card-body { - padding: 0; - } - } .main-table-box { position: relative; .main-pickup { position: absolute; - right: 35px; + right: 5px; top: -22px; z-index: 1; } @@ -76,162 +44,7 @@ line-height: 150px!important; } } - > .ant-tabs { - width: 100%; - padding: 0px 20px; - margin-bottom: 20px; - .ant-tabs-tab:not(.ant-tabs-tab-active) { - cursor: pointer; - } - .ant-tabs-tab.ant-tabs-tab-active { - cursor: default; - } - } - .common-table-copy { - position: fixed; - z-index: 2; - bottom: 65px; - right: 30px; - width: 40px; - height: 40px; - } - .ant-table-fixed-left, .ant-table-fixed-right { - z-index: 1; - } - > .chart-view { - position: relative; - padding: 0 20px; - >.ant-tabs { - .ant-tabs-bar { - position: relative; - z-index: 1; - margin: 0; - border: 0; - .ant-tabs-nav-scroll { - text-align: right; - padding-right: 20px; - .ant-tabs-ink-bar { - display: none!important; - } - .ant-tabs-tab { - padding: 6px 5px; - margin-right: 5px; - } - } - } - } - >.ant-col { - min-height: 100px; - } - >.card-view.ant-col-24 { - padding: 0!important; - .card-row-box { - padding: 0; - } - } - .chart-title { - position: relative; - color: rgba(0, 0, 0, 0.65); - font-weight: 400; - font-size: 16px; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - margin: 0px; - padding: 5px 10px; - float: left; - max-width: 50%; - } - .chart-table.chart-title { - position: absolute; - top: 0px; - } - .canvas { - clear: both; - } - } -} - -.menu-tree-modal { - .ant-modal-body { - min-height: 300px; - .menu-header { - text-align: center; - span { - font-weight: 600; - margin-right: 20px; - } - .ant-typography { - font-weight: 600; - display: inline-block; - } - } - .ant-tree li .ant-tree-node-content-wrapper { - cursor: default; - } - } -} - -.commontable.bg-gray { - background: #f0f2f5; - >.top-search { - background: #ffffff; - padding: 10px 10px; - margin: 0 20px; - } - .chart-view { - margin-bottom: 20px; - .ant-col:last-child { - .line-chart-plot-box { - margin-bottom: 0px; - } - .card-row-box { - margin-bottom: 0px; - } - .normal-data-table { - margin-bottom: 0px; - } - } - >.ant-col { - min-height: 50px; - } - } - .line-chart-plot-box { - background: #ffffff; - padding: 10px; - margin-bottom: 20px; - } - .card-row-box { - min-height: 130px; - background: #ffffff; - padding-bottom: 10px; - margin-bottom: 20px; - } - .commontable-main-action { - padding: 0 10px; - background: #ffffff; - } .normal-data-table { - padding: 0 10px 10px; - margin-bottom: 20px; - background: #ffffff; - } - .main-pickup { - right: 45px; - } - .custom-control { - right: 10px; - } - > .ant-tabs { - margin: 0px 20px 20px; - padding: 0px; - width: calc(100% - 40px); - background: #ffffff; - .top-search { - padding: 0 10px 10px; - } - .button-list.toolbar-button { - padding: 15px 10px 5px; - } + padding: 0; } } \ No newline at end of file diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 74a4302..23148b7 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -55,7 +55,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, param } = this.props + const { permAction, permMenus, param } = this.props let _param = { func: 'sPC_Get_LongParam', @@ -113,9 +113,7 @@ // 鏉冮檺杩囨护 let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID - if (this.props.menuType !== 'HS') { - config.components = this.filterComponent(config.components, roleId) - } + config.components = this.filterComponent(config.components, roleId, permAction, permMenus) // 鑾峰彇涓绘悳绱㈡潯浠� let mainSearch = [] @@ -150,7 +148,7 @@ inherit.cacheTime = config.cacheTime } - config.components = this.formatSetting(config.components, params, mainSearch, permAction, inherit) + config.components = this.formatSetting(config.components, params, mainSearch, inherit) this.setState({ BID: BID, @@ -181,7 +179,7 @@ } } - filterComponent = (components, roleId) => { + filterComponent = (components, roleId, permAction, permMenus) => { return components.filter(item => { if (item.type === 'tabs') { if ( @@ -192,7 +190,7 @@ } item.subtabs = item.subtabs.map(tab => { - tab.components = this.filterComponent(tab.components, roleId) + tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus) return tab }) @@ -222,6 +220,7 @@ return false } } + // 鎼滅储榛戝悕鍗曡繃婊� if (item.search && item.search.length > 0) { item.search = item.search.map(cell => { cell.oriInitval = cell.initval @@ -234,26 +233,57 @@ return item }) } + if (item.type === 'table' && item.subtype === 'normaltable') { + item.cols = item.cols.map(col => { + if (!col.blacklist || col.blacklist.length === 0) return col + if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { + col.Hide = 'true' + } + + if (col.Hide !== 'true' && col.linkmenu && col.linkmenu.length > 0) { + let menu_id = col.linkmenu.slice(-1)[0] + col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' + } else { + col.linkThdMenu = '' + } + + return col + }) + } + // 鏉冮檺杩囨护 + if (this.props.menuType !== 'HS') { + if (item.action && item.action.length > 0) { + item.action = item.action.filter(cell => permAction[cell.uuid]) + } + if (item.type === 'card') { + item.subcards.forEach(card => { + card.elements = card.elements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid]) + card.backElements = card.backElements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid]) + }) + } else if (item.type === 'table' && item.subtype === 'tablecard') { + item.subcards.forEach(card => { + card.elements = card.elements.filter(cell => cell.eleType !== 'button' || permAction[cell.uuid]) + }) + } else if (item.type === 'table' && item.subtype === 'normaltable') { + item.cols.forEach(col => { + if (col.type !== 'action') return + col.elements = col.elements.filter(cell => permAction[cell.uuid]) + }) + } + } return true }) } // 鏍煎紡鍖栭粯璁よ缃� - formatSetting = (components, params, mainSearch, permAction, inherit) => { + formatSetting = (components, params, mainSearch, inherit) => { return components.map(component => { if (component.type === 'tabs') { component.subtabs = component.subtabs.map(tab => { - tab.components = this.formatSetting(tab.components, [], [], permAction, inherit) + tab.components = this.formatSetting(tab.components, [], [], inherit) tab = {...tab, ...inherit} return tab }) - } - - // 鏉冮檺杩囨护 - if (this.props.menuType !== 'HS') { - if (component.action) { - component.action = component.action.filter(item => permAction[item.uuid]) - } } if (!component.setting) return component // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 @@ -613,7 +643,8 @@ return { menuType: state.editLevel, refreshTab: state.refreshTab, - permAction: state.permAction + permAction: state.permAction, + permMenus: state.permMenus } } diff --git a/src/tabviews/custom/tools/simpleSearch/index.jsx b/src/tabviews/custom/tools/simpleSearch/index.jsx deleted file mode 100644 index 03c31e6..0000000 --- a/src/tabviews/custom/tools/simpleSearch/index.jsx +++ /dev/null @@ -1,783 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Button, Select, DatePicker, notification } from 'antd' -import moment from 'moment' - -import Api from '@/api' -import options from '@/store/options.js' -import DateGroup from '@/tabviews/zshare/dategroup' -import Utils from '@/utils/utils.js' -import './index.scss' - -const {MonthPicker, WeekPicker, RangePicker} = DatePicker - -class MainSearch extends Component { - static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id锛岀敤浜庢煡璇笅鎷夐�夋嫨椤� - menuType: PropTypes.any, // 鑿滃崟鏉冮檺锛屾槸鍚︿负HS - searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 - dict: PropTypes.object // 瀛楀吀椤� - } - - state = { - match: null, // 鎼滅储鏉′欢鍖归厤瑙勫垯 - style: null, // 鎼滅储鏉′欢绫诲瀷 - label: null, // 鎻愮ず鏂囧瓧 - required: null, // 鏄惁蹇呭~ - searchlist: null, // 鎼滅储椤� - groups: null, // 缁勫悎鎼滅储椤� - formId: Utils.getuuid() // 鎼滅储琛ㄥ崟Id - } - - UNSAFE_componentWillMount () { - let searchlist = fromJS(this.props.searchlist).toJS() - let match = {} - let label = {} - let style = {} - let required = {} - let _list = [] - let fieldMap = new Map() - let mainItems = [] // 浜戠鎴栧崟鐐规暟鎹� - let localItems = [] // 鏈湴鏁版嵁 - let deForms = [] // 娴嬭瘯绯荤粺锛屽崟涓姹� - - searchlist.forEach(item => { - if (fieldMap.has(item.field)) { - item.field = item.field + '@tail@' - } - fieldMap.set(item.field, true) - - match[item.field] = item.match - label[item.field] = item.label - style[item.field] = item.type - required[item.field] = item.required === 'true' - - if (['select', 'link', 'multiselect'].includes(item.type)) { - if (item.setAll === 'true' && item.type !== 'multiselect') { - item.options.unshift({ - key: Utils.getuuid(), - Value: '', - Text: this.props.dict['main.all'] - }) - } - - // 鏁版嵁婧愭煡璇㈣鍙� - if (item.resourceType === '1' && item.dataSource) { - let _option = Utils.getSelectQueryOptions(item) - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _option.sql = _option.sql.replace(/\$@/ig, '/*') - _option.sql = _option.sql.replace(/@\$/ig, '*/') - } else { - _option.sql = _option.sql.replace(/@\$|\$@/ig, '') - } - - // 娴嬭瘯绯荤粺鍗曚釜璇锋眰 - if (this.props.menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { - deForms.push({ - ...item, - arr_field: _option.field, - data_sql: Utils.formatOptions(_option.sql) - }) - } else { // 鍚堝苟璇锋眰锛屽尯鍒嗘湰鍦板強绯荤粺 - if (item.database === 'sso') { - mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) - } else { - localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) - } - } - } - item.oriOptions = fromJS(item.options).toJS() - } - - _list.push(item) - }) - - let _groups = [] - _list = _list.map(item => { - if (item.type === 'link') { - let supItem = _list.filter(form => form.field === item.linkField)[0] - - if (!supItem) { - notification.warning({ - top: 92, - message: '鏈煡璇㈠埌鎼滅储鏉′欢銆�' + item.label + '銆嬪叧鑱斿瓧娈碉紒', - duration: 5 - }) - item.supInitVal = '' - } else { - item.supInitVal = supItem.initval - item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval) - } - } else if (item.type === 'group' && item.Hide !== 'true') { - _groups.push(fromJS(item).toJS()) - } - - return item - }) - - this.setState({ - match: match, - label: label, - style: style, - required: required, - searchlist: _list, - groups: _groups - }, () => { - if (this.props.menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { - this.improveSimpleSearch(deForms) - } else { - this.improveSearch(mainItems, localItems) - } - }) - } - - // 鏌ヨ涓嬫媺鑿滃崟 - improveSearch = (mainItems, localItems) => { - const { menuType, BID } = this.props - let deffers = [] - - if (menuType !== 'HS' && window.GLOB.systemType !== 'production') { - localItems = [...localItems, ...mainItems] - mainItems = [] - } - - // 鏈湴璇锋眰 - let param = { - func: 'sPC_Get_SelectedList', - LText: localItems.join(' union all '), - obj_name: '', - arr_field: '', - table_type: 'Y' - } - - if (BID) { - param.BID = BID - } - - if (param.LText) { - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } - - deffers.push( - new Promise(resolve => { - Api.getSystemCacheConfig(param).then(res => { - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - resolve(res) - }) - }) - ) - } - - // 绯荤粺璇锋眰 - let mainparam = { - func: 'sPC_Get_SelectedList', - LText: mainItems.join(' union all '), - obj_name: '', - arr_field: '', - table_type: 'Y' - } - - if (BID) { - mainparam.BID = BID - } - - if (mainparam.LText) { - mainparam.LText = Utils.formatOptions(mainparam.LText) - mainparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) - - if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - mainparam.open_key = Utils.encryptOpenKey(mainparam.secretkey, mainparam.timestamp) - if (options.cloudServiceApi) { - mainparam.rduri = options.cloudServiceApi - mainparam.userid = sessionStorage.getItem('CloudUserID') || '' - mainparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } - } else if (window.GLOB.mainSystemApi) { - mainparam.rduri = window.GLOB.mainSystemApi - } - - deffers.push( - new Promise(resolve => { - Api.getSystemCacheConfig(mainparam).then(res => { - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - resolve(res) - }) - }) - ) - } - - Promise.all(deffers).then(response => { - let result = {...response[0], ...(response[1] || {})} - - delete result.ErrCode - delete result.ErrMesg - delete result.message - delete result.status - - let _searchlist = this.state.searchlist.map(item => { - if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { - let options = result[item.field].map(cell => { - let _item = { - key: Utils.getuuid(), - Value: cell[item.valueField], - Text: cell[item.valueText] - } - - if (item.type === 'link') { - _item.ParentID = cell[item.linkField] - } - - return _item - }) - - item.oriOptions = [...item.oriOptions, ...options] - } - return item - }) - - this.setState({ - searchlist: _searchlist.map(item => { - if (item.type === 'link') { - if (item.supInitVal) { - item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) - } else { - item.options = item.oriOptions - } - } else if (item.type === 'select' || item.type === 'multiselect') { - item.options = item.oriOptions - } - - return item - }) - }) - }) - } - - // 娴嬭瘯绯荤粺鍗曚釜璇锋眰涓嬫媺閫夐」 - improveSimpleSearch = (deForms) => { - if (deForms.length === 0) return - - let deffers = deForms.map(item => { - let param = { - func: 'sPC_Get_SelectedList', - LText: item.data_sql, - obj_name: item.field, - arr_field: item.arr_field - } - - if (this.props.BID) { - param.BID = this.props.BID - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - return ( - new Promise(resolve => { - Api.getSystemCacheConfig(param).then(res => { - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - resolve(res) - }) - }) - ) - }) - - Promise.all(deffers).then(response => { - let result = {} - - response.forEach(res => { - result = {...result, ...res} - }) - - delete result.ErrCode - delete result.ErrMesg - delete result.message - delete result.status - - let _searchlist = this.state.searchlist.map(item => { - if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { - let options = result[item.field].map(cell => { - let _item = { - key: Utils.getuuid(), - Value: cell[item.valueField], - Text: cell[item.valueText] - } - - if (item.type === 'link') { - _item.ParentID = cell[item.linkField] - } - - return _item - }) - - item.oriOptions = [...item.oriOptions, ...options] - } - return item - }) - - this.setState({ - searchlist: _searchlist.map(item => { - if (item.type === 'link') { - if (item.supInitVal) { - item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) - } else { - item.options = item.oriOptions - } - } else if (item.type === 'select' || item.type === 'multiselect') { - item.options = item.oriOptions - } - - return item - }) - }) - }) - } - - resetform = (formlist, supfields, index, fieldsvalue) => { - index++ - let subfields = [] - - supfields.forEach(supfield => { - formlist = formlist.map(item => { - if (item.type === 'link' && item.linkField === supfield.field) { - item.options = item.oriOptions.filter(option => option.ParentID === supfield.initval) - item.initval = item.options[0] ? item.options[0].Value : '' - - if (this.props.form.getFieldValue(item.field) !== undefined) { - fieldsvalue[item.field] = item.initval - } - - subfields.push(item) - } - return item - }) - }) - - if (subfields.length === 0 || index > 6) { - return formlist - } else { - return this.resetform(formlist, subfields, index, fieldsvalue) - } - } - - selectChange = (_field, value) => { - let formlist = fromJS(this.state.searchlist).toJS() - - let subfields = [] - let fieldsvalue = {} - formlist = formlist.map(item => { - if (item.type === 'link' && item.linkField === _field.field) { - item.options = item.oriOptions.filter(option => option.ParentID === value) - item.initval = item.options[0] ? item.options[0].Value : '' - - if (this.props.form.getFieldValue(item.field) !== undefined) { - fieldsvalue[item.field] = item.initval - } - - subfields.push(item) - } - return item - }) - - if (subfields.length === 0) { - this.searchChange() - return - } - - formlist = this.resetform(formlist, subfields, 0, fieldsvalue) - - if (Object.keys(fieldsvalue).length > 0) { - this.props.form.setFieldsValue(fieldsvalue) - } - - this.setState({ - searchlist: formlist - }, () => { - this.searchChange() - }) - } - - getFields() { - const { getFieldDecorator } = this.props.form - const fields = [] - - this.state.searchlist.forEach((item, index) => { - if (item.Hide === 'true') return - - if (item.type === 'text') { // 鏂囨湰鎼滅储 - fields.push( - <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: item.initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.input'] + item.label + '!' - } - ] - })(<Input placeholder="" autoComplete="off" />)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺鎼滅储 - fields.push( - <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: item.initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <Select - showSearch - onChange={(value) => {this.selectChange(item, value)}} - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - getPopupContainer={() => document.getElementById(this.state.formId)} - > - {item.options.map((option, i) => - <Select.Option id={`${i}`} title={option.Text} key={`${i}`} value={option.Value}>{option.Text}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'multiselect') { // 涓嬫媺澶氶�� - let _initval = item.initval ? item.initval.split(',').filter(Boolean) : [] - fields.push( - <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: _initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <Select - showSearch - mode="multiple" - onChange={this.searchChange} - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - getPopupContainer={() => document.getElementById(this.state.formId)} - > - {item.options.map((option, i) => - <Select.Option id={`${i}`} title={option.Text} key={`${i}`} value={option.Value}>{option.Text}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'date') { // 鏃堕棿鎼滅储 - fields.push( - <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: item.initval ? moment().subtract(item.initval, 'days') : null, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <DatePicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'datemonth') { - fields.push( - <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: item.initval ? moment().subtract(item.initval, 'month') : null, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <MonthPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'dateweek') { - fields.push( - <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <WeekPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'daterange') { - let _defaultValue = [null, null] - - if (item.initval) { - try { - let _initval = JSON.parse(item.initval) - _defaultValue = [moment().subtract(_initval[0], 'days'), moment().subtract(_initval[1], 'days')] - } catch { - _defaultValue = [null, null] - } - } - - fields.push( - <Col className="daterange" span={item.ratio || 6} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, - { - initialValue: _defaultValue, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <RangePicker - placeholder={['寮�濮嬫棩鏈�', '缁撴潫鏃ユ湡']} - renderExtraFooter={() => 'extra footer'} - onChange={this.searchChange} - getCalendarContainer={() => document.getElementById(this.state.formId)} - /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'group') { - fields.push( - <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.label} className={item.required === 'true' ? 'group-required' : ''}> - <DateGroup ref={item.uuid} position={index} card={item} onGroupChange={this.searchChange} /> - </Form.Item> - </Col> - ) - } - }) - - fields.push( - <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> - <Form.Item label={' '} colon={false} style={{ minHeight: '40px' }}> - <Button type="primary" htmlType="submit"> - {this.props.dict['main.search']} - </Button> - <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> - {this.props.dict['main.reset']} - </Button> - </Form.Item> - </Col> - ) - - return fields - } - - addHideFieldValue = (values) => { - const { searchlist } = this.state - let hideValue = {} - searchlist.forEach(item => { - if (item.Hide === 'true') { - let value = '' - - if (item.type === 'multiselect') { // 涓嬫媺澶氶�� - value = item.initval ? item.initval.split(',').filter(Boolean) : [] - } else if (item.type === 'date') { // 鏃堕棿鎼滅储 - value = item.initval ? moment().subtract(item.initval, 'days') : '' - } else if (item.type === 'datemonth') { - value = item.initval ? moment().subtract(item.initval, 'month') : '' - } else if (item.type === 'dateweek') { - value = item.initval ? moment().subtract(item.initval * 7, 'days') : '' - } else if (item.type === 'daterange') { - if (item.initval) { - try { - let _initval = JSON.parse(item.initval) - value = [moment().subtract(_initval[0], 'days'), moment().subtract(_initval[1], 'days')] - } catch { - value = '' - } - } - } else if (item.type !== 'group') { - value = item.initval - } - - hideValue[item.field] = value - } - }) - - return {...hideValue, ...values} - } - - handleSearch = (e) => { - // 鍥炶溅鎴栫偣鍑绘悳绱� - e.preventDefault() - this.props.form.validateFields((err, values) => { - if (!err) { - values = this.addHideFieldValue(values) - let searches = this.getFieldsValues(values) - this.props.refreshdata(searches) - } - }) - } - - searchChange = () => { - this.setState({}, () => { - this.props.form.validateFields((err, values) => { - if (!err) { - values = this.addHideFieldValue(values) - let searches = this.getFieldsValues(values) - this.props.refreshdata(searches) - } - }) - }) - } - - /** - * @description 鎼滅储鏉′欢閲嶇疆 - */ - handleReset = () => { - const { groups } = this.state - - if (groups.length > 0) { - groups.forEach(item => { - this.refs[item.uuid].reset() - }) - } - - let searchlist = this.state.searchlist.map(item => { - item.initval = item.oriInitval - return item - }) - - this.setState({searchlist}, () => { - this.props.form.resetFields() - this.props.form.validateFields((err, values) => { - if (!err) { - // 寮傛鑾峰彇鏇存柊鍚庣殑鏃堕棿缁� - this.setState({}, () => { - values = this.addHideFieldValue(values) - let searches = this.getFieldsValues(values) - this.props.refreshdata(searches) - }) - } - }) - }) - } - - getFieldsValues = (values) => { - const { groups } = this.state - // 鑾峰彇鎼滅储鏉′欢鍊� - let search = [] - Object.keys(values).forEach(key => { - let _value = '' - if (this.state.style[key] === 'daterange') { - if (values[key].length > 0 && values[key][0] && values[key][1]) { - _value = [moment(values[key][0]).format('YYYY-MM-DD'), moment(values[key][1]).format('YYYY-MM-DD')] - } - } else if (this.state.style[key] === 'dateweek') { - if (values[key]) { - _value = [moment(values[key]).startOf('week').format('YYYY-MM-DD'), moment(values[key]).endOf('week').format('YYYY-MM-DD')] - } - } else if (this.state.style[key] === 'date') { - if (values[key]) { - _value = moment(values[key]).format('YYYY-MM-DD') - } - } else if (this.state.style[key] === 'datemonth') { - if (values[key]) { - _value = moment(values[key]).format('YYYY-MM') - } - } else if (this.state.style[key] === 'multiselect') { - _value = values[key] || [] - - } else { - _value = (values[key] || values[key] === 0) ? values[key] : '' - - _value = _value.replace(/(^\s*|\s*$)/ig, '') - } - - search.push({ - type: this.state.style[key], - key: key.replace(/@tail@$/, ''), - value: _value, - label: this.state.label[key], - match: this.state.match[key], - required: this.state.required[key] - }) - }) - - if (groups.length > 0) { - groups.forEach(item => { - let items = this.refs[item.uuid].getSearchItems() - search.push(...items) - }) - } - - return search - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <Form {...formItemLayout} className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}> - <Row gutter={24}>{this.getFields()}</Row> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/tabviews/custom/tools/simpleSearch/index.scss b/src/tabviews/custom/tools/simpleSearch/index.scss deleted file mode 100644 index ee84ed1..0000000 --- a/src/tabviews/custom/tools/simpleSearch/index.scss +++ /dev/null @@ -1,41 +0,0 @@ -.ant-advanced-search-form.top-search { - padding: 0px 24px 10px; - border-bottom: 1px solid #efefef; - .ant-form-item { - display: flex; - margin-bottom: 0px; - min-height: 60px; - .ant-form-explain { - white-space: nowrap; - } - } - .ant-form-item-control-wrapper { - flex: 1; - width: calc(100% - 100px); - } - .ant-form-item-label { - // width: 100px; - text-overflow: ellipsis; - } - .daterange .ant-calendar-picker-input { - padding: 4px 20px 4px 5px; - font-size: 13px; - } - .ant-select-dropdown { - z-index: 10 !important; - } - .ant-calendar-picker-container { - z-index: 10 !important; - } - .group-required { - label::before { - display: inline-block; - margin-right: 4px; - color: #f5222d; - font-size: 14px; - font-family: SimSun, sans-serif; - line-height: 1; - content: '*'; - } - } -} \ No newline at end of file diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx index e2a213e..4449627 100644 --- a/src/tabviews/formtab/actionList/index.jsx +++ b/src/tabviews/formtab/actionList/index.jsx @@ -15,7 +15,6 @@ MenuID: PropTypes.string, // 鑿滃崟ID primaryId: PropTypes.string, // 涓婚敭 actions: PropTypes.array, // 鎸夐挳缁� - logcolumns: PropTypes.array, // 鏄剧ず鍒� dict: PropTypes.object, // 瀛楀吀椤� data: PropTypes.any, // 鏁版嵁 setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 @@ -66,7 +65,7 @@ * @description 鎸夐挳鎻愪氦鎵ц */ execSubmit = (btn, data, _resolve, formdata) => { - const { setting, logcolumns, primaryId } = this.props + const { setting, primaryId } = this.props let _primaryId = primaryId @@ -121,7 +120,7 @@ if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid param.ID = Utils.getguid() - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data, logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) @@ -135,7 +134,7 @@ _primaryId = param.ID } else if (btn.sql && btn.sqlType === 'insertOrUpdate') { // 绯荤粺鍑芥暟娣诲姞鎴栦慨鏀规椂 param.ID = primaryId || Utils.getguid() - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data, logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) @@ -149,7 +148,7 @@ _primaryId = param.ID } else if (btn.sql) { param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data, logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index 3c78b98..6cae1de 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -649,7 +649,6 @@ {hasform ? <FormAction menuType={this.props.menuType} - logcolumns={[]} setting={setting} actions={actions} dict={this.state.dict} diff --git a/src/tabviews/scriptmanage/actionList/index.jsx b/src/tabviews/scriptmanage/actionList/index.jsx index c63750c..677751a 100644 --- a/src/tabviews/scriptmanage/actionList/index.jsx +++ b/src/tabviews/scriptmanage/actionList/index.jsx @@ -17,7 +17,6 @@ Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� MenuID: PropTypes.string, // 鑿滃崟ID actions: PropTypes.array, // 鎸夐挳缁� - logcolumns: PropTypes.array, // 鏄剧ず鍒� dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� diff --git a/src/tabviews/scriptmanage/index.jsx b/src/tabviews/scriptmanage/index.jsx index f9e24df..12d0fd9 100644 --- a/src/tabviews/scriptmanage/index.jsx +++ b/src/tabviews/scriptmanage/index.jsx @@ -34,7 +34,6 @@ actions: [], // 鎸夐挳闆� columns: [], // 鏄剧ず鍒� arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� - logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) setting: {}, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -56,7 +55,6 @@ let _arrField = [] // 瀛楁闆� let _columns = [] // 鏄剧ず鍒� - let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 @@ -64,13 +62,9 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) - - _logcolumns.push(col) } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 _hideCol = _hideCol.concat(col.sublist) - } else if (col.Hide === 'true') { - _hideCol.push(col.uuid) } colMap.set(col.uuid, col) }) @@ -79,10 +73,14 @@ config.columns.forEach(col => { if (_hideCol.includes(col.uuid)) return - if (col.type === 'colspan' && col.sublist) { - let _col = JSON.parse(JSON.stringify(col)) + if (col.type === 'colspan') { + if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 + col.type = 'old_colspan' + } + + let _col = fromJS(col).toJS() let subcols = [] - _col.sublist.forEach(sub => { + _col.sublist && _col.sublist.forEach(sub => { if (colMap.has(sub)) { subcols.push(colMap.get(sub)) } @@ -105,7 +103,6 @@ return item }), columns: _columns, - logcolumns: _logcolumns, arr_field: _arrField.join(','), search: Utils.initMainSearch(config.search) }, () => { @@ -305,7 +302,7 @@ } render() { - const { dict, searchlist, config, setting, actions, columns, pickup, selectedData } = this.state + const { dict, searchlist, setting, actions, columns, pickup, selectedData } = this.state return ( <div className="script-manage-table" id={this.state.ContainerId}> @@ -322,7 +319,6 @@ dict={this.state.dict} MenuID={this.props.MenuID} selectedData={selectedData} - logcolumns={this.state.logcolumns} ContainerId={this.state.ContainerId} refreshdata={this.refreshbyaction} /> @@ -335,7 +331,6 @@ <MainTable tableId="mainTable" pickup={pickup} - config={config} setting={setting} columns={columns} dict={this.state.dict} diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 589ed45..caab3be 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -48,7 +48,6 @@ searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� @@ -131,7 +130,6 @@ let _arrField = [] // 瀛楁闆� let _columns = [] // 鏄剧ず鍒� - let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() let statFields = [] // 鍚堣瀛楁淇℃伅 @@ -207,7 +205,6 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) - _logcolumns.push(col) col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { @@ -216,8 +213,6 @@ } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 _hideCol = _hideCol.concat(col.sublist) - } else if (col.Hide === 'true') { - _hideCol.push(col.uuid) } colMap.set(col.uuid, col) }) @@ -235,10 +230,14 @@ col.sort = index - if (col.type === 'colspan' && col.sublist) { - let _col = JSON.parse(JSON.stringify(col)) + if (col.type === 'colspan') { + if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 + col.type = 'old_colspan' + } + + let _col = fromJS(col).toJS() let subcols = [] - _col.sublist.forEach(sub => { + _col.sublist && _col.sublist.forEach(sub => { if (colMap.has(sub)) { subcols.push(colMap.get(sub)) } @@ -340,7 +339,6 @@ searchlist: config.search, actions: _actions, columns: _columns, - logcolumns: _logcolumns, arr_field: _arrField.join(','), search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { @@ -771,13 +769,13 @@ <SubAction setting={setting} actions={actions} + columns={columns} Tab={this.props.Tab} BID={this.props.BID} BData={this.props.BData} MenuID={this.props.MenuID} selectedData={selectedData} MenuName={this.props.Tab.label} - logcolumns={this.state.logcolumns} refreshdata={this.refreshbyaction} ContainerId={this.props.ContainerId} getexceloutparam={this.getexceloutparam} @@ -790,7 +788,6 @@ <SubTable tableId={this.props.Tab.uuid} pickup={pickup} - config={config} setting={setting} columns={columns} pageSize={pageSize} @@ -803,7 +800,6 @@ loading={this.state.loading} MenuName={this.props.Tab.label} refreshdata={this.refreshbytable} - logcolumns={this.state.logcolumns} statFValue={this.state.statFValue} handleTableId={this.handleTableId} ContainerId={this.props.ContainerId} @@ -819,6 +815,7 @@ <CardComponent plot={item} config={config} + columns={columns} Tab={this.props.Tab} BID={this.props.BID} BData={this.props.BData} @@ -827,7 +824,6 @@ loading={this.state.loading} tableId={this.props.Tab.uuid} MenuName={this.props.Tab.label} - logcolumns={this.state.logcolumns} refreshdata={this.refreshbyaction} handleTableId={this.handleTableId} getexceloutparam={this.getexceloutparam} diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 483d8b9..af5ce85 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -47,7 +47,6 @@ searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� @@ -105,7 +104,6 @@ let _arrField = [] // 瀛楁闆� let _columns = [] // 鏄剧ず鍒� - let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() let statFields = [] // 鍚堣瀛楁淇℃伅 @@ -186,7 +184,6 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) - _logcolumns.push(col) col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { @@ -195,8 +192,6 @@ } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 _hideCol = _hideCol.concat(col.sublist) - } else if (col.Hide === 'true') { - _hideCol.push(col.uuid) } colMap.set(col.uuid, col) }) @@ -207,10 +202,14 @@ col.linkThdMenu = '' // 寮圭獥涓笉鍙娇鐢ㄥ瓧娈甸�忚 - if (col.type === 'colspan' && col.sublist) { - let _col = JSON.parse(JSON.stringify(col)) + if (col.type === 'colspan') { + if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 + col.type = 'old_colspan' + } + + let _col = fromJS(col).toJS() let subcols = [] - _col.sublist.forEach(sub => { + _col.sublist && _col.sublist.forEach(sub => { if (colMap.has(sub)) { subcols.push(colMap.get(sub)) } @@ -296,7 +295,6 @@ searchlist: config.search, actions: _actions, columns: _columns, - logcolumns: _logcolumns, arr_field: _arrField.join(','), search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { @@ -590,20 +588,19 @@ <SubAction setting={setting} actions={actions} + columns={columns} BID={this.props.BID} dict={this.state.dict} BData={this.props.BData} selectedData={selectedData} MenuID={this.props.SupMenuID} MenuName={this.props.Tab.label} - logcolumns={this.state.logcolumns} refreshdata={this.refreshbyaction} getexceloutparam={this.getexceloutparam} /> </div> <SubTable tableId={this.props.Tab.uuid} - config={config} setting={setting} columns={columns} pageSize={pageSize} @@ -616,7 +613,6 @@ loading={this.state.loading} MenuName={this.props.Tab.label} refreshdata={this.refreshbytable} - logcolumns={this.state.logcolumns} statFValue={this.state.statFValue} refreshbyaction={this.refreshbyaction} chgSelectData={this.changeSelectedData} @@ -631,12 +627,12 @@ tableId="" plot={item} config={config} + columns={columns} BID={this.props.BID} data={this.state.data} BData={this.props.BData} loading={this.state.loading} MenuName={this.props.Tab.label} - logcolumns={this.state.logcolumns} refreshdata={this.refreshbyaction} handleTableId={() => {}} /> diff --git a/src/tabviews/verupmanage/actionList/index.jsx b/src/tabviews/verupmanage/actionList/index.jsx index 9deeecd..82c3b5f 100644 --- a/src/tabviews/verupmanage/actionList/index.jsx +++ b/src/tabviews/verupmanage/actionList/index.jsx @@ -18,7 +18,7 @@ type: PropTypes.string, // 鍒ゆ柇褰撳墠涓轰富琛紙main锛夈�佸瓙琛紙sub锛夈�佸瓙琛ㄦ爣绛撅紙subtab锛� MenuID: PropTypes.string, // 鑿滃崟ID actions: PropTypes.array, // 鎸夐挳缁� - logcolumns: PropTypes.array, // 鏄剧ず鍒� + columns: PropTypes.array, // 鏄剧ず鍒� dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� @@ -136,7 +136,7 @@ * @description 鎸夐挳鎻愪氦鎵ц */ execSubmit = (btn, data, _resolve, formdata) => { - const { setting, logcolumns } = this.props + const { setting, columns } = this.props if (btn.intertype === 'inner') { // 鎵ц鏂瑰紡涓哄琛屾嫾鎺ワ紝涓旀墦寮�鏂瑰紡涓鸿〃鍗曟椂锛屼細杞负寰幆鍙戦�佽姹� @@ -171,7 +171,7 @@ } } else if (btn.sql) { param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, '', param, data[0], logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, '', param, data[0], columns) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) @@ -203,7 +203,7 @@ } } param.ID = primaryId || Utils.getguid() - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], columns) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) @@ -215,7 +215,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) } else if (btn.sql) { param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], columns) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) @@ -265,7 +265,7 @@ } } else if (btn.sql) { param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, '', param, cell, logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, '', param, cell, columns) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) @@ -293,7 +293,7 @@ } } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid param.ID = _formPrimaryId || Utils.getguid() - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, columns) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) @@ -314,7 +314,7 @@ } param.ID = primaryId - param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, logcolumns) // 鏁版嵁婧� + param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, columns) // 鏁版嵁婧� let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) diff --git a/src/tabviews/verupmanage/index.jsx b/src/tabviews/verupmanage/index.jsx index 09955fb..4725c5f 100644 --- a/src/tabviews/verupmanage/index.jsx +++ b/src/tabviews/verupmanage/index.jsx @@ -37,7 +37,6 @@ actions: [], // 鎸夐挳闆� columns: [], // 鏄剧ず鍒� arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� - logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) setting: {}, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: [], // 鍒楄〃鏁版嵁闆� selectedData: [], // 宸查�夎〃鏍兼暟鎹� @@ -61,7 +60,6 @@ let _arrField = [] // 瀛楁闆� let _columns = [] // 鏄剧ず鍒� - let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 @@ -69,13 +67,9 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) - - _logcolumns.push(col) } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 _hideCol = _hideCol.concat(col.sublist) - } else if (col.Hide === 'true') { - _hideCol.push(col.uuid) } colMap.set(col.uuid, col) }) @@ -84,10 +78,14 @@ config.columns.forEach(col => { if (_hideCol.includes(col.uuid)) return - if (col.type === 'colspan' && col.sublist) { - let _col = JSON.parse(JSON.stringify(col)) + if (col.type === 'colspan') { + if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 + col.type = 'old_colspan' + } + + let _col = fromJS(col).toJS() let subcols = [] - _col.sublist.forEach(sub => { + _col.sublist && _col.sublist.forEach(sub => { if (colMap.has(sub)) { subcols.push(colMap.get(sub)) } @@ -110,7 +108,6 @@ return item }), columns: _columns, - logcolumns: _logcolumns, arr_field: _arrField.join(','), search: Utils.initMainSearch(config.search) }, () => { @@ -457,10 +454,10 @@ type="main" setting={setting} actions={actions} + columns={columns} dict={this.state.dict} MenuID={this.props.MenuID} selectedData={selectedData} - logcolumns={this.state.logcolumns} ContainerId={this.state.ContainerId} refreshdata={this.refreshbyaction} /> @@ -473,7 +470,6 @@ <MainTable tableId="mainTable" pickup={pickup} - config={config} setting={setting} columns={columns} dict={this.state.dict} diff --git a/src/tabviews/verupmanage/subtabtable/index.jsx b/src/tabviews/verupmanage/subtabtable/index.jsx index 522dfb7..46fafe4 100644 --- a/src/tabviews/verupmanage/subtabtable/index.jsx +++ b/src/tabviews/verupmanage/subtabtable/index.jsx @@ -39,7 +39,6 @@ searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� - logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� @@ -84,7 +83,6 @@ let _arrField = [] // 瀛楁闆� let _columns = [] // 鏄剧ず鍒� - let _logcolumns = [] // 鏃ュ織鏄剧ず鍒� let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() @@ -92,13 +90,9 @@ config.columns.forEach(col => { if (col.field) { _arrField.push(col.field) - - _logcolumns.push(col) } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 _hideCol = _hideCol.concat(col.sublist) - } else if (col.Hide === 'true') { - _hideCol.push(col.uuid) } colMap.set(col.uuid, col) }) @@ -107,10 +101,13 @@ config.columns.forEach(col => { if (_hideCol.includes(col.uuid)) return - if (col.type === 'colspan' && col.sublist) { - let _col = JSON.parse(JSON.stringify(col)) + if (col.type === 'colspan') { + if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 + col.type = 'old_colspan' + } + let _col = fromJS(col).toJS() let subcols = [] - _col.sublist.forEach(sub => { + _col.sublist && _col.sublist.forEach(sub => { if (colMap.has(sub)) { subcols.push(colMap.get(sub)) } @@ -137,7 +134,6 @@ return item }), columns: _columns, - logcolumns: _logcolumns, arr_field: _arrField.join(','), search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 }, () => { @@ -439,7 +435,7 @@ } render() { - const { config, setting, searchlist, actions, columns, pickup, selectedData } = this.state + const { setting, searchlist, actions, columns, pickup, selectedData } = this.state return ( <div className="verup-subtable" id={'subtable' + this.props.MenuID}> @@ -456,13 +452,13 @@ type="sub" setting={setting} actions={actions} + columns={columns} Tab={this.props.Tab} BID={this.props.BID} BData={this.props.BData} dict={this.state.dict} selectedData={selectedData} MenuID={this.props.SupMenuID} - logcolumns={this.state.logcolumns} refreshdata={this.refreshbyaction} ContainerId={this.props.ContainerId} getexceloutparam={this.getexceloutparam} @@ -477,7 +473,6 @@ <SubTable tableId={this.props.Tab.uuid} pickup={pickup} - config={config} setting={setting} columns={columns} dict={this.state.dict} diff --git a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx index 06ed6a5..596f327 100644 --- a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx +++ b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx @@ -114,8 +114,10 @@ sessionStorage.setItem('Full_Name', res.FullName) sessionStorage.setItem('avatar', res.icon || '') sessionStorage.setItem('dataM', res.dataM ? 'true' : '') + sessionStorage.setItem('localDataM', res.dataM ? 'true' : '') sessionStorage.setItem('debug', res.debug || '') sessionStorage.setItem('role_id', res.role_id || '') + sessionStorage.setItem('localRole_id', res.role_id || '') sessionStorage.removeItem('CloudAvatar') sessionStorage.removeItem('cloudDataM') diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 6fa7ed5..266c5a3 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -26,7 +26,7 @@ Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� MenuID: PropTypes.string, // 鑿滃崟ID actions: PropTypes.array, // 鎸夐挳缁� - logcolumns: PropTypes.array, // 鏄剧ず鍒� + columns: PropTypes.array, // 鏄剧ず鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� @@ -50,7 +50,7 @@ } getButtonList = (actions) => { - const { BID, BData, MenuID, Tab, logcolumns, setting, ContainerId, selectedData, getexceloutparam, MenuName } = this.props + const { BID, BData, MenuID, Tab, columns, setting, ContainerId, selectedData, getexceloutparam, MenuName } = this.props return actions.map(item => { if (['exec', 'prompt', 'pop'].includes(item.OpenType)) { @@ -63,8 +63,8 @@ btn={item} BData={BData} setting={setting} + columns={columns} MenuName={MenuName} - columns={logcolumns} ContainerId={ContainerId} selectedData={selectedData} updateStatus={this.updateStatus} diff --git a/src/tabviews/zshare/cardcomponent/index.jsx b/src/tabviews/zshare/cardcomponent/index.jsx index c611f51..9c55d1c 100644 --- a/src/tabviews/zshare/cardcomponent/index.jsx +++ b/src/tabviews/zshare/cardcomponent/index.jsx @@ -26,7 +26,7 @@ Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� MenuID: PropTypes.string, // 鑿滃崟ID setting: PropTypes.object, // 椤甸潰璁惧畾 - logcolumns: PropTypes.array, // 瀛楁鍒� + columns: PropTypes.array, // 鏄剧ず鍒� card: PropTypes.object, // 鍗$墖璁剧疆淇℃伅 data: PropTypes.object, // 鍗$墖鏁版嵁 selectKey: PropTypes.string, // 閫夋嫨鍗$墖鐨勫簭鍙� @@ -130,7 +130,7 @@ * @description 鑾峰彇鎸夐挳鍏冪礌 */ getActionList = (actions, show) => { - const { BID, BData, Tab, setting, logcolumns, ContainerId, data, MenuID, MenuName } = this.props + const { BID, BData, Tab, setting, columns, ContainerId, data, MenuID, MenuName } = this.props return actions.map(item => { if (['exec', 'prompt', 'pop'].includes(item.OpenType)) { @@ -143,8 +143,8 @@ show={show} BData={BData} setting={setting} + columns={columns} MenuName={MenuName} - columns={logcolumns} selectedData={[data]} ContainerId={ContainerId} updateStatus={this.props.refreshdata} @@ -499,7 +499,7 @@ BData={this.props.BData} setting={this.props.setting} MenuName={this.props.MenuName} - columns={this.props.logcolumns} + columns={this.props.columns} selectedData={[]} ContainerId={this.props.ContainerId} updateStatus={this.props.refreshdata} @@ -519,7 +519,7 @@ MenuID: PropTypes.string, // 鑿滃崟ID MenuName: PropTypes.any, // 鑿滃崟鍚嶇О config: PropTypes.object, // 椤甸潰閰嶇疆淇℃伅 - logcolumns: PropTypes.array, // 鏄剧ず鍒� + columns: PropTypes.array, // 鏄剧ず鍒� ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� plot: PropTypes.object, tableId: PropTypes.string, @@ -762,7 +762,7 @@ } render() { - const { plot, data, loading, BID, BData, Tab, MenuID, config, logcolumns, ContainerId, MenuName } = this.props + const { plot, data, loading, BID, BData, Tab, MenuID, config, columns, ContainerId, MenuName } = this.props const { card, colMap, selectKey, actionList } = this.state return ( @@ -820,9 +820,9 @@ BData={BData} MenuID={MenuID} colMap={colMap} + columns={columns} MenuName={MenuName} selectKey={selectKey} - logcolumns={logcolumns} setting={config.setting} ContainerId={ContainerId} switchCard={this.switchCard} diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 640c6ff..23a8e27 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -26,12 +26,11 @@ pageSize: PropTypes.any, // 姣忛〉鏁版嵁 MenuName: PropTypes.any, // 鑿滃崟鍚嶇О dict: PropTypes.object, // 瀛楀吀椤� - config: PropTypes.object, // 椤甸潰閰嶇疆 MenuID: PropTypes.string, // 鑿滃崟Id setting: PropTypes.object, // 琛ㄦ牸鍏ㄥ眬璁剧疆锛歵ableType锛堣〃鏍兼槸鍚﹀彲閫夈�佸崟閫夈�佸閫夛級銆乧olumnfixed锛堝垪鍥哄畾锛夈�乤ctionfixed锛堟寜閽浐瀹氾級 pickup: PropTypes.any, // 鏁版嵁鏀惰捣 columns: PropTypes.array, // 琛ㄦ牸鍒� - logcolumns: PropTypes.array, // 瀛楁鍒� + fields: PropTypes.array, // 缁勪欢瀛楁闆� BID: PropTypes.any, // 涓昏〃Id ContainerId: PropTypes.any, // 鏍囩椤靛灞侷d BData: PropTypes.any, // 涓昏〃鏁版嵁 @@ -57,8 +56,8 @@ } UNSAFE_componentWillMount () { - const { menuType, config, memberLevel, pageSize } = this.props - let columns = JSON.parse(JSON.stringify(this.props.columns)) + const { menuType, memberLevel, pageSize } = this.props + let columns = fromJS(this.props.columns).toJS() let lineMarks = [] let _columns = [] let radio = 5 // 铏氬寲姣斾緥 @@ -75,45 +74,28 @@ } } - // 鑾峰彇琛屾爣璁� - config.columns.forEach(col => { - if (!col.field) return - - col.marks && col.marks.forEach(mark => { - if (mark.signType === 'line') { - lineMarks.push(mark) - } - }) - }) - columns.forEach((item, index) => { if (item.hidden === true || item.Hide === 'true') return - - if (_format && !Math.floor(Math.random() * radio)) { - item.blur = true - } - - if (item.marks) { // 杩囨护琛屽拰鍗$墖鏍囪 - item.marks = item.marks.filter(mark => mark.signType !== 'line' && mark.signType !== 'card') - - if (item.marks.length === 0) { - item.marks = '' - } - } - let cell = null - if (item.type === 'colspan' && item.unfold === 'true') { + if (item.type === 'colspan') { cell = {title: item.label, children: []} item.subcols.forEach(col => { - if (col.rowspan === 'true') { rowspan = col } + if (_format && !Math.floor(Math.random() * radio)) { + col.blur = true + } if (col.marks) { // 杩囨护琛屽拰鍗$墖鏍囪 - col.marks = col.marks.filter(mark => mark.signType !== 'line' && mark.signType !== 'card') + col.marks = col.marks.filter(mark => { + if (mark.signType === 'line') { + lineMarks.push(mark) + } + return mark.signType !== 'line' && mark.signType !== 'card' + }) if (col.marks.length === 0) { col.marks = '' @@ -131,9 +113,51 @@ } }) }) + } else if (item.type === 'old_colspan') { + item.subcols.forEach(col => { + if (col.marks) { // 杩囨护琛屽拰鍗$墖鏍囪 + col.marks = col.marks.filter(mark => { + if (mark.signType === 'line') { + lineMarks.push(mark) + } + return mark.signType !== 'line' && mark.signType !== 'card' + }) + + if (col.marks.length === 0) { + col.marks = '' + } + } + }) + + cell = { + align: item.Align, + dataIndex: item.field || item.uuid, + title: item.label, + sorter: item.field && item.IsSort === 'true', + width: item.Width || 120, + render: (text, record) => { + return this.getContent(item, record) + } + } } else { if (item.rowspan === 'true') { rowspan = item + } + if (_format && !Math.floor(Math.random() * radio)) { + item.blur = true + } + + if (item.marks) { // 杩囨护琛屽拰鍗$墖鏍囪 + item.marks = item.marks.filter(mark => { + if (mark.signType === 'line') { + lineMarks.push(mark) + } + return mark.signType !== 'line' && mark.signType !== 'card' + }) + + if (item.marks.length === 0) { + item.marks = '' + } } cell = { @@ -426,11 +450,13 @@ } if (content !== '') { + let decimal = item.decimal || 0 if (item.format === 'percent') { content = content * 100 + decimal = decimal > 2 ? decimal - 2 : 0 } - content = content.toFixed(item.decimal || 0) + content = content.toFixed(decimal) if (item.format === 'thdSeparator') { content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') @@ -569,7 +595,7 @@ BData={this.props.BData} setting={this.props.setting} MenuName={this.props.MenuName} - columns={this.props.logcolumns} + columns={this.props.fields || this.props.columns} ContainerId={this.props.ContainerId} updateStatus={this.updateStatus} /> @@ -612,7 +638,7 @@ })} </div> ) - } else if (item.type === 'colspan') { + } else if (item.type === 'old_colspan') { if (item.subcols.length === 0) return '' let ordertype = item.order let contents = [] @@ -633,11 +659,13 @@ } if (content !== '') { + let decimal = col.decimal || 0 if (col.format === 'percent') { content = content * 100 + decimal = decimal > 2 ? decimal - 2 : 0 } - - content = content.toFixed(col.decimal || 0) + + content = content.toFixed(decimal) if (col.format === 'thdSeparator') { content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') @@ -686,7 +714,7 @@ content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}` } - content = (col.prefix || '') + record[col.field] + (col.postfix || '') + content = (col.prefix || '') + content + (col.postfix || '') } if (col.marks) { @@ -890,7 +918,7 @@ changeRow = (record, index) => { if (!this.props.setting.tableType || this.props.pickup) return - let newkeys = JSON.parse(JSON.stringify(this.state.selectedRowKeys)) + let newkeys = fromJS(this.state.selectedRowKeys).toJS() if (this.props.setting.tableType === 'radio') { newkeys = [index] diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 6d848f9..5b1dea1 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -777,7 +777,7 @@ } return ( - <Form {...formItemLayout} className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}> + <Form {...formItemLayout} className="top-search" id={this.state.formId} onSubmit={this.handleSearch}> <Row gutter={24}>{this.getFields()}</Row> </Form> ) diff --git a/src/tabviews/zshare/topSearch/index.scss b/src/tabviews/zshare/topSearch/index.scss index ee84ed1..b5087da 100644 --- a/src/tabviews/zshare/topSearch/index.scss +++ b/src/tabviews/zshare/topSearch/index.scss @@ -1,4 +1,4 @@ -.ant-advanced-search-form.top-search { +.top-search { padding: 0px 24px 10px; border-bottom: 1px solid #efefef; .ant-form-item { diff --git a/src/utils/utils.js b/src/utils/utils.js index 19713b8..4631294 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1048,7 +1048,7 @@ * @return {String} type 鎵ц绫诲瀷 * @return {String} table 琛ㄥ悕 */ - static getSysDefaultSql (btn, setting, formdata, param, data, logcolumns, tab) { + static getSysDefaultSql (btn, setting, formdata, param, data, columns, tab) { let primaryId = param.ID let BID = param.BID let verify = btn.verify || {} @@ -1150,38 +1150,29 @@ // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃) if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce') { _formFieldValue = {...data, ..._formFieldValue} + const setField = (col) => { + if (!col.field) return + let _key = col.field.toLowerCase() - if (logcolumns && logcolumns.length > 0) { - logcolumns.forEach(col => { - let _key = col.field.toLowerCase() + if (!_initvars.includes(_key)) { + let _val = data.hasOwnProperty(col.field) ? data[col.field] : '' - if (!_initvars.includes(_key)) { - _initvars.push(_key) + _initvars.push(_key) + _initColfields.push(`@${_key}='${_val}'`) + } + + if (!_vars.includes(_key)) { + _vars.push(_key) - let _val = data.hasOwnProperty(col.field) ? data[col.field] : '' - - if (col.type === 'number') { - if (typeof(_val) !== 'number') { - _val = parseFloat(_val) - if (isNaN(_val)) { - _val = 0 - } - } - _initColfields.push(`@${_key}=${_val}`) - } else { - _initColfields.push(`@${_key}='${_val}'`) - } - } - - if (!_vars.includes(_key)) { - _vars.push(_key) - + if (col.datatype) { + _declarefields.push(`@${_key} ${col.datatype}`) + } else { if (col.fieldlength && col.fieldlength > 2048) { col.fieldlength = 'max' } let _type = `nvarchar(${col.fieldlength || 50})` - + if (col.type === 'number') { let _length = col.decimal ? col.decimal : 0 _type = `decimal(18,${_length})` @@ -1190,6 +1181,18 @@ } _declarefields.push(`@${_key} ${_type}`) + } + } + } + + if (columns && columns.length > 0) { + columns.forEach(col => { + if (col.type === 'colspan' || col.type === 'old_colspan') { + col.subcols.forEach(cell => { + setField(cell) + }) + } else { + setField(col) } }) } @@ -1623,10 +1626,10 @@ } else if (_actionType === 'delete') { // 鐗╃悊鍒犻櫎 let _msg = '' - if (data && logcolumns && logcolumns.length > 0) { + if (data && columns && columns.length > 0) { let _index = 0 - logcolumns.forEach(col => { - if (col.Hide !== 'true' && _index < 4) { + columns.forEach(col => { + if (col.Hide !== 'true' && col.type !== 'colspan' && col.type !== 'old_colspan' && _index < 4) { _msg += col.label + '=' + data[col.field] + ',' _index++ } diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 2c5686e..3d201ab 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -36,6 +36,7 @@ let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) sessionStorage.setItem('dataM', param.dataM || '') + sessionStorage.setItem('localDataM', param.dataM || '') this.setState({ BID: param.id || '', tempId: param.tempId diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 51528d3..5bcfbb5 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -91,8 +91,10 @@ sessionStorage.setItem('Full_Name', res.FullName) sessionStorage.setItem('avatar', res.icon || '') sessionStorage.setItem('dataM', res.dataM ? 'true' : '') + sessionStorage.setItem('localDataM', res.dataM ? 'true' : '') sessionStorage.setItem('debug', res.debug || '') sessionStorage.setItem('role_id', res.role_id || '') + sessionStorage.setItem('localRole_id', res.role_id || '') localStorage.setItem('lang', param.lang || 'zh-CN') @@ -160,8 +162,10 @@ sessionStorage.setItem('Full_Name', res.FullName) sessionStorage.setItem('avatar', res.icon || '') sessionStorage.setItem('dataM', res.dataM ? 'true' : '') + sessionStorage.setItem('localDataM', res.dataM ? 'true' : '') sessionStorage.setItem('debug', res.debug || '') sessionStorage.setItem('role_id', res.role_id || '') + sessionStorage.setItem('localRole_id', res.role_id || '') localStorage.setItem('lang', param.lang || 'zh-CN') diff --git a/src/views/sso/index.jsx b/src/views/sso/index.jsx index 3734955..077a30b 100644 --- a/src/views/sso/index.jsx +++ b/src/views/sso/index.jsx @@ -22,8 +22,10 @@ _param.Full_Name && sessionStorage.setItem('Full_Name', _param.Full_Name) _param.debug && sessionStorage.setItem('debug', _param.debug) _param.dataM && sessionStorage.setItem('dataM', _param.dataM) + _param.dataM && sessionStorage.setItem('localDataM', _param.dataM) _param.avatar && sessionStorage.setItem('avatar', _param.avatar) _param.role_id && sessionStorage.setItem('role_id', _param.role_id) + _param.role_id && sessionStorage.setItem('localRole_id', _param.role_id) } else { this.props.history.replace('/login') } -- Gitblit v1.8.0