From 29c5821ce140e89a8b35e53f41672dd86da56982 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 18 二月 2020 18:43:38 +0800 Subject: [PATCH] 2020-02-18 --- src/tabviews/tableshare/mutilform/index.jsx | 2 src/tabviews/formtab/index.scss | 10 src/tabviews/formtab/index.jsx | 62 +- src/templates/formtabconfig/settingform/index.jsx | 46 -- src/tabviews/formtab/formgroup/index.jsx | 2 src/templates/tableshare/verifycardexcelout/index.jsx | 288 ++++++++++++++ src/templates/formtabconfig/index.jsx | 72 +- src/templates/comtableconfig/index.jsx | 132 +++-- src/templates/subtableconfig/index.jsx | 55 + src/tabviews/tableshare/actionList/index.jsx | 154 +++++++ src/templates/comtableconfig/settingform/index.jsx | 49 -- src/templates/tableshare/verifycardexcelout/columnform/index.scss | 0 src/templates/tableshare/dragelement/card.jsx | 2 src/templates/tableshare/tabform/index.jsx | 4 src/tabviews/subtable/index.jsx | 22 src/locales/zh-CN/comtable.js | 3 src/tabviews/commontable/index.jsx | 55 +- src/templates/tableshare/verifycardexcelout/index.scss | 53 ++ src/locales/en-US/comtable.js | 3 src/templates/tableshare/verifycardexcelout/columnform/index.jsx | 128 ++++++ src/utils/utils.js | 16 src/templates/subtableconfig/actionform/index.jsx | 25 + 22 files changed, 895 insertions(+), 288 deletions(-) diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 90aa0a4..9fbf495 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -77,6 +77,7 @@ 'header.form.refresh.view': 'Refresh the page', 'header.form.refresh.grid': 'Refresh the table', 'header.form.refresh.maingrid': '鍒锋柊涓昏〃', + 'header.form.refresh.equaltab': '鍒锋柊鍚岀骇鏍囩', 'header.form.refresh.subgrid': '鍒锋柊瀛愯〃', 'header.form.popClose': '鏍囩鍏抽棴', 'header.form.toolbar': 'The toolbar', @@ -125,6 +126,8 @@ 'header.form.tab': '鏍囩椤�', 'header.form.linkTab': '鍏宠仈鏍囩', 'header.form.subTab': '涓嬬骇鏍囩', + 'header.form.supTab': '涓婄骇鏍囩', + 'header.form.equalTab': '鍚岀骇鏍囩', 'header.form.currenttab': '褰撳墠鑿滃崟', 'header.form.excelIn': 'Excel瀵煎叆', 'header.form.excelOut': 'Excel瀵煎嚭', diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index 761fbf7..75e1c28 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -77,6 +77,7 @@ 'header.form.refresh.view': '鍒锋柊椤甸潰', 'header.form.refresh.grid': '鍒锋柊琛ㄦ牸', 'header.form.refresh.maingrid': '鍒锋柊涓昏〃', + 'header.form.refresh.equaltab': '鍒锋柊鍚岀骇鏍囩', 'header.form.refresh.subgrid': '鍒锋柊瀛愯〃', 'header.form.popClose': '鏍囩鍏抽棴', 'header.form.toolbar': '宸ュ叿鏍�', @@ -125,6 +126,8 @@ 'header.form.tab': '鏍囩椤�', 'header.form.linkTab': '鍏宠仈鏍囩', 'header.form.subTab': '涓嬬骇鏍囩', + 'header.form.supTab': '涓婄骇鏍囩', + 'header.form.equalTab': '鍚岀骇鏍囩', 'header.form.currenttab': '褰撳墠鑿滃崟', 'header.form.excelIn': '瀵煎叆Excel', 'header.form.excelOut': '瀵煎嚭Excel', diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 1ddb53e..544400a 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -59,7 +59,8 @@ popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 tabBtn: null, // 琛ㄥ崟鏍囩鎸夐挳 - tabParam: null // 琛ㄥ崟鏍囩鍙傛暟 + tabParam: null, // 琛ㄥ崟鏍囩鍙傛暟 + refreshtabs: null // 闇�瑕佸埛鏂扮殑鏍囩闆� } /** @@ -166,25 +167,14 @@ let _isLinkMain = false // 妫�鏌ユ槸鍚︽湁涓庝富琛ㄥ叧鑱旂殑瀛愯〃 - let supmenus = {} - config.tabgroups.forEach(group => { - if (config[group] && config[group].length > 0) { - config[group] = config[group].map(tab => { - if (tab.subtabs && tab.subtabs.length > 0) { - tab.subtabs.forEach(id => { - supmenus[id] = tab.uuid - }) - } - if (config.setting.subtabs.includes(tab.uuid)) { - tab.supMenu = 'mainTable' - _isLinkMain = true - } else if (supmenus[tab.uuid]) { - tab.supMenu = supmenus[tab.uuid] - } + config.tabgroups.forEach(groupId => { + if (!config[groupId] || config[groupId].length === 0) return - return tab - }) - } + config[groupId].forEach(tab => { + if (tab.supMenu === 'mainTable') { + _isLinkMain = true + } + }) }) this.setState({ @@ -594,8 +584,26 @@ /** * @description 瀛愯〃鎿嶄綔瀹屾垚鍚庡埛鏂颁富琛� */ - handleMainTable = () => { - this.reloadtable() + handleMainTable = (type, tab) => { + if (type === 'maingrid' && tab.supMenu === 'mainTable') { + this.reloadtable() + } else if (type === 'maingrid' && tab.supMenu) { + this.setState({ + refreshtabs: [tab.supMenu] + }, () => { + this.setState({ + refreshtabs: null + }) + }) + } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { + this.setState({ + refreshtabs: tab.equalTab + }, () => { + this.setState({ + refreshtabs: null + }) + }) + } } /** @@ -852,11 +860,12 @@ Tab={_tab} MenuID={_tab.linkTab} SupMenuID={this.props.MenuID} + refreshtabs={this.state.refreshtabs} ContainerId={this.state.ContainerId} BID={this.state.BIDs[_tab.supMenu] || ''} BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} handleTableId={this.handleTableId} - handleMainTable={this.handleMainTable} + handleMainTable={(type) => this.handleMainTable(type, _tab)} /> : null} </TabPane> ) @@ -873,7 +882,7 @@ visible={this.state.visible} onCancel={this.popclose} footer={[ - <Button key="cancel" onClick={this.popclose}>{this.state.dict['main.close']}</Button> + <Button key="close" onClick={this.popclose}>{this.state.dict['main.close']}</Button> ]} destroyOnClose > diff --git a/src/tabviews/formtab/formgroup/index.jsx b/src/tabviews/formtab/formgroup/index.jsx index 7260090..8e623f7 100644 --- a/src/tabviews/formtab/formgroup/index.jsx +++ b/src/tabviews/formtab/formgroup/index.jsx @@ -31,7 +31,7 @@ record: {} } - componentDidMount () { + UNSAFE_componentWillMount () { const { data, groups } = this.props let datatype = {} diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index f64cfe6..7e20e0a 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -44,10 +44,10 @@ BIDs: {}, // 涓婄骇琛╥d setsingle: false, // 涓昏〃鍗曢�夊閫夊垏鎹� pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - isLinkMain: false, // 鏄惁瀛樺湪涓庝富琛ㄥ叧鑱旂殑瀛愯〃 popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 - primaryId: null + primaryId: null, + refreshtabs: null } /** @@ -111,34 +111,11 @@ // if (!config[group]) return // config[group] = config[group].filter(tab => permAction[tab.uuid]) // }) - - let _isLinkMain = false // 妫�鏌ユ槸鍚︽湁涓庝富琛ㄥ叧鑱旂殑瀛愯〃 - let supmenus = {} - config.tabgroups.forEach(group => { - if (config[group] && config[group].length > 0) { - config[group] = config[group].map(tab => { - if (tab.subtabs && tab.subtabs.length > 0) { - tab.subtabs.forEach(id => { - supmenus[id] = tab.uuid - }) - } - if (config.setting.subtabs.includes(tab.uuid)) { - tab.supMenu = 'mainTable' - _isLinkMain = true - } else if (supmenus[tab.uuid]) { - tab.supMenu = supmenus[tab.uuid] - } - - return tab - }) - } - }) this.setState({ config: config, setting: config.setting, actions: config.action, - isLinkMain: _isLinkMain, arr_field: _arrField, primaryId: this.props.param.primaryId || '', data: config.setting.datatype === 'query' ? null : this.props.param.data, @@ -476,6 +453,34 @@ }) } + /** + * @description 瀛愯〃鎿嶄綔瀹屾垚鍚庡埛鏂颁富琛� + */ + handleMainTable = (type, tab) => { + if (type === 'maingrid' && tab.supMenu === 'mainTable') { + this.loadmaindata() + } else if (type === 'maingrid' && tab.supMenu) { + this.setState({ + refreshtabs: [tab.supMenu] + }, () => { + this.setState({ + refreshtabs: null + }) + }) + } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { + this.setState({ + refreshtabs: tab.equalTab + }, () => { + this.setState({ + refreshtabs: null + }) + }) + } + } + + /** + * @description 鑾峰彇琛ㄥ崟鍙傛暟 + */ getFormData = () => { return this.formGroupRef.handleConfirm() } @@ -499,7 +504,7 @@ } render() { - const { setting, actions, loadingview, viewlost, isLinkMain, config, groups, data } = this.state + const { setting, actions, loadingview, viewlost, config, groups, data } = this.state let hasform = false if (groups && (groups.length > 1 || groups[0].sublist.length > 0)) { @@ -507,7 +512,7 @@ } return ( - <div className={'formtab ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> + <div className="formtab" id={this.state.ContainerId}> {loadingview && <Spin size="large" />} {hasform ? <FormGroup @@ -550,11 +555,12 @@ Tab={_tab} MenuID={_tab.linkTab} SupMenuID={this.props.MenuID} + refreshtabs={this.state.refreshtabs} ContainerId={this.state.ContainerId} BID={this.state.BIDs[_tab.supMenu] || ''} BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} handleTableId={this.handleTableId} - handleMainTable={this.handleMainTable} + handleMainTable={(type) => this.handleMainTable(type, _tab)} /> : null} </TabPane> ) diff --git a/src/tabviews/formtab/index.scss b/src/tabviews/formtab/index.scss index 317f3dd..a68f76a 100644 --- a/src/tabviews/formtab/index.scss +++ b/src/tabviews/formtab/index.scss @@ -113,6 +113,7 @@ } > .ant-tabs { padding: 0px 20px; + margin-bottom: 20px; .ant-tabs-tab:not(.ant-tabs-tab-active) { cursor: pointer; } @@ -155,15 +156,8 @@ } } } - .ant-tabs + .ant-tabs { - margin-top: 20px; - } } -.formtab.pick-control { - >.button-list { - padding-right: 140px; - } -} + .popview-modal { .ant-modal-body { min-height: 300px; diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 8d1c0ca..924ba66 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -26,7 +26,8 @@ SupMenuID: PropTypes.string, // 涓婄骇鑿滃崟Id ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d - handleMainTable: PropTypes.func // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d + handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃 + refreshtabs:PropTypes.any } state = { @@ -60,6 +61,8 @@ UNSAFE_componentWillReceiveProps(nextProps) { if (this.props.Tab.supMenu && !is(fromJS(this.props.BID), fromJS(nextProps.BID))) { this.loadmaindata(nextProps.BID, 'refresh') + } else if (nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { + this.reloadtable() } } @@ -497,15 +500,20 @@ if (btn.execSuccess === 'grid' && type === 'success') { this.reloadtable() } else if (btn.execError === 'grid' && type === 'error') { - this.reloadview() - } else if (btn.execSuccess === 'view' && type === 'success') { this.reloadtable() + } else if (btn.execSuccess === 'view' && type === 'success') { + this.reloadview() } else if (btn.execError === 'view' && type === 'error') { this.reloadview() - } else if (btn.popClose === 'maingrid' && type === 'pop') { - this.props.handleMainTable() - } else if (btn.popClose === 'subgrid' && type === 'pop') { + } else if (btn.popClose === 'grid' && type === 'pop') { this.reloadtable() + } else if (btn.popClose === 'view' && type === 'pop') { + this.reloadview() + } else if (btn.popClose === 'maingrid' && type === 'pop') { + this.props.handleMainTable('maingrid') + } else if (btn.popClose === 'equaltab' && type === 'pop') { + this.reloadtable() + this.props.handleMainTable('equaltab') } } @@ -640,7 +648,7 @@ visible={this.state.visible} onCancel={this.popclose} footer={[ - <Button key="cancel" onClick={this.popclose}>{this.state.dict['main.close']}</Button> + <Button key="close" onClick={this.popclose}>{this.state.dict['main.close']}</Button> ]} destroyOnClose > diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index f8ae9a3..7e04f37 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -969,7 +969,7 @@ triggerExcelout = (btn) => { let viewParam = this.props.getexceloutparam() let name = `${viewParam.menuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` - // let pageSize = 100 + let pageSize = 100 this.setState({loadingUuid: btn.uuid}) @@ -1058,9 +1058,115 @@ } else { this.execError({ErrCode: 'N', message: '瀵煎嚭鎸夐挳璁剧疆閿欒锛�'}, btn) } + } else if (btn.intertype === 'outer' && btn.innerFunc) { // 鍒嗛〉锛屼笖涓ゆ璇锋眰 + this.getExcelOutDoubleData(btn, viewParam, 1, pageSize, [], name) + } else { // 鍒嗛〉锛屼竴姝ヨ姹� + this.getExcelOutData(btn, viewParam, 1, pageSize, [], name) } } + /** + * @description 涓ゆ鍒嗛〉璇锋眰 + */ + getExcelOutDoubleData = (btn, viewParam, pageIndex, pageSize, data, name) => { + let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) + param.func = btn.innerFunc + + Api.genericInterface(param).then(res => { + if (res.status) { + delete res.ErrCode + delete res.ErrMesg + delete res.message + delete res.status + + if (btn.sysInterface === 'true') { + res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + res.rduri = btn.interface + } + + if (btn.outerFunc) { + res.func = btn.outerFunc + } + + res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey + + Api.genericInterface(res).then(result => { + if (result.status) { + if (!result.data) { + this.execError({ErrCode: 'N', message: '鏈幏鍙栧埌鏁版嵁淇℃伅锛�'}, btn) + } else if (result.data.length >= pageSize) { + data = data.concat(result.data) + pageIndex++ + this.getExcelOutDoubleData(btn, viewParam, pageIndex, pageSize, data, name) + } else { + data = data.concat(result.data) + this.exportExcel(data, btn, name) + } + } else { + this.execError(result, btn) + } + }) + } else { + this.execError(res, btn) + } + }) + } + + /** + * @description 涓�姝ュ垎椤佃姹� + */ + getExcelOutData = (btn, viewParam, pageIndex, pageSize, data, name) => { + let param = null + if (btn.intertype === 'inner' && !btn.innerFunc) { // 浣跨敤绯荤粺鍑芥暟 + if (!viewParam.arr_field) { + this.execError({ErrCode: 'N', message: '鏈缃樉绀哄垪锛�'}, btn) + return + } + + param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) + + + } else if (btn.intertype === 'inner' && btn.innerFunc) { // 浣跨敤鍐呴儴鍑芥暟 + param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) + param.func = btn.innerFunc + + } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 浣跨敤澶栭儴鍑芥暟 + param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) + if (btn.sysInterface === 'true') { + param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi + } else { + param.rduri = btn.interface + } + + param.appkey = window.GLOB.appkey || '' + + if (btn.outerFunc) { + param.func = btn.outerFunc + } + } + + Api.genericInterface(param).then(result => { + if (result.status) { + if (!result.data) { + this.execError({ErrCode: 'N', message: '鏈幏鍙栧埌鏁版嵁淇℃伅锛�'}, btn) + } else if (result.data.length >= pageSize) { + data = data.concat(result.data) + pageIndex++ + this.getExcelOutData(btn, viewParam, pageIndex, pageSize, data, name) + } else { + data = data.concat(result.data) + this.exportExcel(data, btn, name) + } + } else { + this.execError(result, btn) + } + }) + } + + /** + * @description Excel 鐢熸垚 + */ exportExcel = (data, btn, name) => { const { logcolumns } = this.props if (data && data.length > 0) { @@ -1068,21 +1174,52 @@ let _header = [] let _topRow = {} let colwidth = [] + + let hidecolumns = [] + logcolumns.forEach(col => { + if (col.Hide === 'true') { + hidecolumns.push(col.field) + } + }) + + if (btn.verify && btn.verify.columns && btn.verify.columns.length > 0) { + btn.verify.columns.forEach(col => { + if (hidecolumns.includes(col.Column)) return + if (!data[0].hasOwnProperty(col.Column)) return + if (_topRow[col.Column]) return + + _header.push(col.Column) + _topRow[col.Column] = col.Text + + colwidth.push({width: col.Width}) + }) + } + logcolumns.forEach(col => { if (col.Hide === 'true') return - if (!data[0].hasOwnProperty(col.field)) return + if (_topRow[col.field]) return _header.push(col.field) _topRow[col.field] = col.label let _colwidth = Math.floor(col.Width / 6) - if (!_colwidth || _colwidth < 10) { - _colwidth = 10 + if (!_colwidth || _colwidth < 5) { + _colwidth = 5 } colwidth.push({width: _colwidth}) + }) + + Object.keys(data[0]).forEach(key => { + if (hidecolumns.includes(key)) return + if (_topRow[key]) return + + _header.push(key) + _topRow[key] = key + + colwidth.push({width: 12}) }) let table = [] @@ -1098,7 +1235,6 @@ table.push(_row) }) - // const ws = XLSX.utils.aoa_to_sheet(data) const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) ws['!cols'] = colwidth @@ -1129,6 +1265,10 @@ ..._search } + if (this.props.BID) { + param.BID = this.props.BID + } + if (pagination) { param.PageIndex = pageIndex param.PageSize = pageSize @@ -1153,6 +1293,10 @@ arr_field: arr_field, appkey: window.GLOB.appkey || '' } + + if (this.props.BID) { + param.BID = this.props.BID + } let _dataresource = setting.dataresource diff --git a/src/tabviews/tableshare/mutilform/index.jsx b/src/tabviews/tableshare/mutilform/index.jsx index 46e8a1c..aec1414 100644 --- a/src/tabviews/tableshare/mutilform/index.jsx +++ b/src/tabviews/tableshare/mutilform/index.jsx @@ -32,7 +32,7 @@ componentDidMount () { const { data, BData } = this.props let action = JSON.parse(JSON.stringify(this.props.action)) - + let datatype = {} let readtype = {} let readin = {} diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index ae94117..b5fbadb 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -25,6 +25,7 @@ import EditCard from '@/templates/tableshare/editcard' import VerifyCard from '@/templates/tableshare/verifycard' import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin' +import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout' import MenuForm from '@/templates/tableshare/menuform' import TabDragElement from '@/templates/tableshare/tabdragelement' import SourceElement from '@/templates/tableshare/dragelement/source' @@ -386,43 +387,40 @@ handleTab = (card) => { const { config } = this.state - let index = 0 // 绛涢�変笅涓�缁� + let menus = [{value: 'mainTable', text: '涓昏〃'}] + let equalTabs = [] + let supMenu = card.supMenu || '' + let equalTab = card.equalTab || [] + let isuptab = true + let equalTabIds = [] + config.tabgroups.forEach((groupId, i) => { if (groupId === card.groupId) { - index = i + isuptab = false + config[card.groupId].forEach(tab => { // 鍙叧鑱旂殑鍚岀骇鏍囩 + if (tab.uuid === card.uuid) return + + equalTabIds.push(tab.uuid) + equalTabs.push(tab) + }) + } else if (isuptab) { + config[groupId].forEach(tab => { + menus.push({ + value: tab.uuid, + text: tab.label + }) + }) } }) - let menus = [] - let subtabs = card.subtabs || [] - let nextTabId = config.tabgroups[index + 1] - - if (nextTabId) { - let _tabMap = new Map() - let _usedTabMap = new Map() - - config[nextTabId].forEach(tab => { // 涓嬬骇鎵�鏈夌殑鏍囩 - menus.push(tab) - _tabMap.set(tab.uuid, true) - }) - - config[card.groupId].forEach(tab => { // 鍚岀骇鏍囩宸查�夌殑涓嬬骇鏍囩 - if (tab.uuid === card.uuid) return - - tab.subtabs.forEach(subtab => { - _usedTabMap.set(subtab, true) - }) - }) - - config.setting.subtabs.forEach(subtab => { // 涓昏〃宸查�夌殑涓嬬骇鏍囩 - _usedTabMap.set(subtab, true) - }) - - subtabs = subtabs.filter(tabId => _tabMap.has(tabId) && !_usedTabMap.has(tabId)) - menus = menus.filter(tab => !_usedTabMap.has(tab.uuid)) - } else { - subtabs = [] + if (supMenu && menus.filter(menu => menu.value === supMenu).length === 0) { + supMenu = '' } + + if (equalTab.length > 0) { + equalTab = equalTab.filter(tabId => equalTabIds.includes(tabId)) + } + this.setState({ modaltype: 'tabs', @@ -478,12 +476,20 @@ }] }, { - type: 'mutilselect', - key: 'subtabs', - label: this.state.dict['header.form.subTab'], - initVal: subtabs, + type: 'select', + key: 'supMenu', + label: this.state.dict['header.form.supTab'], + initVal: supMenu, required: false, options: menus + }, + { + type: 'mutilselect', + key: 'equalTab', + label: this.state.dict['header.form.equalTab'], + initVal: equalTab, + required: false, + options: equalTabs } ] }) @@ -792,6 +798,14 @@ }) resolve(false) } + } else if (btn.OpenType === 'excelOut') { + let _param = { + innerFunc: btn.innerFunc + } + + newLText = Utils.formatOptions(Utils.getTableFunc(_param, menu, config )) + DelText = Utils.formatOptions(Utils.dropfunc(btn.innerFunc)) + resolve(true) } else { let _param = { funcName: btn.innerFunc, @@ -1301,10 +1315,27 @@ const { card } = this.state let config = JSON.parse(JSON.stringify(this.state.config)) - if (card.OpenType !== 'excelIn') { + if (card.OpenType === 'excelIn') { + this.verifyRef.handleConfirm().then(res => { + + config.action = config.action.map(item => { + if (item.uuid === card.uuid) { + item.verify = res + } + + return item + }) + + this.setState({ + profileVisible: false, + config: config, + card: '', + }) + }) + } else { let _verify = this.verifyRef.state.verify - if (_verify.default === 'false' && _verify.scripts.length === 0) { + if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { notification.warning({ top: 92, message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒', @@ -1325,23 +1356,6 @@ profileVisible: false, config: config, card: '', - }) - } else if (card.OpenType === 'excelIn') { - this.verifyRef.handleConfirm().then(res => { - - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = res - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '', - }) }) } } @@ -2662,7 +2676,7 @@ onCancel={() => { this.setState({ profileVisible: false }) }} destroyOnClose > - {this.state.card && this.state.card.OpenType !== 'excelIn' ? + {this.state.card && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ? <VerifyCard card={this.state.card} dict={this.state.dict} @@ -2672,6 +2686,13 @@ } {this.state.card && this.state.card.OpenType === 'excelIn' ? <VerifyCardExcelIn + card={this.state.card} + dict={this.state.dict} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> : null + } + {this.state.card && this.state.card.OpenType === 'excelOut' ? + <VerifyCardExcelOut card={this.state.card} dict={this.state.dict} wrappedComponentRef={(inst) => this.verifyRef = inst} @@ -2699,7 +2720,6 @@ <SettingForm dict={this.state.dict} menu={this.props.menu} - config={this.state.config} data={this.state.config.setting} columns={this.state.config.columns} usefulFields={this.props.permFuncField} diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx index 6751766..33c6b40 100644 --- a/src/templates/comtableconfig/settingform/index.jsx +++ b/src/templates/comtableconfig/settingform/index.jsx @@ -11,7 +11,6 @@ dict: PropTypes.object, // 瀛楀吀椤� menu: PropTypes.object, data: PropTypes.object, - config: PropTypes.object, columns: PropTypes.array, usefulFields: PropTypes.array } @@ -19,32 +18,12 @@ state = { interType: this.props.data.interType || 'inner', columns: this.props.columns.filter(item => item.field && item.type !== 'colspan'), - currentTabs: null, - selectTabs: [], interReadonly: false, primaryKey: '' } UNSAFE_componentWillMount() { - const { config, data, columns } = this.props - let _tabs = [] - let _select = [] - let _tabMap = new Map() - - config.tabgroups.forEach(groupname => { - config[groupname].forEach(tab => { - if (tab.origin) return - - _tabs.push(tab) - _tabMap.set(tab.uuid, true) - }) - }) - - data.subtabs && data.subtabs.forEach(tabId => { - if (_tabMap.has(tabId)) { - _select.push(tabId) - } - }) + const { data, columns } = this.props let primaryKey = data.primaryKey if (primaryKey) { @@ -62,8 +41,6 @@ } this.setState({ - currentTabs: _tabs, - selectTabs: _select, interReadonly: data.sysInterface === 'true', primaryKey: primaryKey }) @@ -139,7 +116,7 @@ render() { const { data, dict, menu, usefulFields } = this.props const { getFieldDecorator } = this.props.form - const { interType, columns, selectTabs, primaryKey } = this.state + const { interType, columns, primaryKey } = this.state const formItemLayout = { labelCol: { @@ -364,28 +341,6 @@ <Select> <Select.Option value="true">鍔犺浇鏁版嵁</Select.Option> <Select.Option value="false">涓嶅姞杞芥暟鎹�</Select.Option> - </Select> - )} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="涓昏〃鍙�夊彇鍏宠仈鏍囩锛屾爣绛惧叧鑱斿悗锛屼富琛ㄦ暟鎹垏鎹㈡椂锛屼笅绾ф爣绛句細璺熼殢涓昏〃涓婚敭鍊煎彉鍖栥��"> - <Icon type="question-circle" /> - {'涓嬬骇鏍囩'} - </Tooltip> - }> - {getFieldDecorator('subtabs', { - initialValue: selectTabs - })( - <Select - mode="multiple" - style={{ width: '100%' }} - placeholder="Please select" - > - {this.state.currentTabs.map((option, index) => - <Select.Option id={option.uuid} title={option.label} key={index} value={option.uuid}>{option.label}</Select.Option> - )} </Select> )} </Form.Item> diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index e2b0def..14f1533 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -374,42 +374,38 @@ handleTab = (card) => { const { config } = this.state - let index = 0 // 绛涢�変笅涓�缁� + let menus = [{value: 'mainTable', text: '涓绘暟鎹�'}] + let equalTabs = [] + let supMenu = card.supMenu || '' + let equalTab = card.equalTab || [] + let isuptab = true + let equalTabIds = [] + config.tabgroups.forEach((groupId, i) => { if (groupId === card.groupId) { - index = i + isuptab = false + config[card.groupId].forEach(tab => { // 鍙叧鑱旂殑鍚岀骇鏍囩 + if (tab.uuid === card.uuid) return + + equalTabIds.push(tab.uuid) + equalTabs.push(tab) + }) + } else if (isuptab) { + config[groupId].forEach(tab => { + menus.push({ + value: tab.uuid, + text: tab.label + }) + }) } }) - let menus = [] - let subtabs = card.subtabs || [] - let nextTabId = config.tabgroups[index + 1] + if (supMenu && menus.filter(menu => menu.value === supMenu).length === 0) { + supMenu = '' + } - if (nextTabId) { - let _tabMap = new Map() - let _usedTabMap = new Map() - - config[nextTabId].forEach(tab => { // 涓嬬骇鎵�鏈夌殑鏍囩 - menus.push(tab) - _tabMap.set(tab.uuid, true) - }) - - config[card.groupId].forEach(tab => { // 鍚岀骇鏍囩宸查�夌殑涓嬬骇鏍囩 - if (tab.uuid === card.uuid) return - - tab.subtabs.forEach(subtab => { - _usedTabMap.set(subtab, true) - }) - }) - - config.setting.subtabs.forEach(subtab => { // 涓昏〃宸查�夌殑涓嬬骇鏍囩 - _usedTabMap.set(subtab, true) - }) - - subtabs = subtabs.filter(tab => _tabMap.has(tab.uuid) && !_usedTabMap.has(tab.uuid)) - menus = menus.filter(tab => !_usedTabMap.has(tab.uuid)) - } else { - subtabs = [] + if (equalTab.length > 0) { + equalTab = equalTab.filter(tabId => equalTabIds.includes(tabId)) } this.setState({ @@ -466,12 +462,20 @@ }] }, { - type: 'mutilselect', - key: 'subtabs', - label: '涓嬬骇鏍囩', - initVal: subtabs, + type: 'select', + key: 'supMenu', + label: this.state.dict['header.form.supTab'], + initVal: supMenu, required: false, options: menus + }, + { + type: 'mutilselect', + key: 'equalTab', + label: this.state.dict['header.form.equalTab'], + initVal: equalTab, + required: false, + options: equalTabs } ] }) diff --git a/src/templates/formtabconfig/settingform/index.jsx b/src/templates/formtabconfig/settingform/index.jsx index 15b044f..f3eba02 100644 --- a/src/templates/formtabconfig/settingform/index.jsx +++ b/src/templates/formtabconfig/settingform/index.jsx @@ -17,8 +17,6 @@ state = { interType: (this.props.config.setting && this.props.config.setting.interType) || 'inner', columns: null, - currentTabs: null, - selectTabs: [], interReadonly: false, primaryKey: '' } @@ -26,9 +24,6 @@ UNSAFE_componentWillMount() { const { config } = this.props - let _tabs = [] - let _select = [] - let _tabMap = new Map() let _columns = [] let _setting = config.setting @@ -55,21 +50,6 @@ }) } - config.tabgroups.forEach(groupname => { - config[groupname].forEach(tab => { - if (tab.origin) return - - _tabs.push(tab) - _tabMap.set(tab.uuid, true) - }) - }) - - _setting.subtabs && _setting.subtabs.forEach(tabId => { - if (_tabMap.has(tabId)) { - _select.push(tabId) - } - }) - let primaryKey = _setting.primaryKey if (primaryKey) { let field = _columns.filter(column => column.field === primaryKey) @@ -86,8 +66,6 @@ } this.setState({ - currentTabs: _tabs, - selectTabs: _select, columns: _columns, setting: _setting, interType: _setting.interType || 'inner', @@ -174,7 +152,7 @@ render() { const { dict, usefulFields, menu } = this.props const { getFieldDecorator } = this.props.form - const { interType, columns, selectTabs, setting, datatype, primaryKey } = this.state + const { interType, columns, setting, datatype, primaryKey } = this.state const formItemLayout = { labelCol: { @@ -341,28 +319,6 @@ })(<Input placeholder="" autoComplete="off" />)} </Form.Item> </Col> : null} - <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="涓昏〃鍙�夊彇鍏宠仈鏍囩锛屾爣绛惧叧鑱斿悗锛屼富琛ㄦ暟鎹垏鎹㈡椂锛屼笅绾ф爣绛句細璺熼殢涓昏〃涓婚敭鍊煎彉鍖栥��"> - <Icon type="question-circle" /> - {'涓嬬骇鏍囩'} - </Tooltip> - }> - {getFieldDecorator('subtabs', { - initialValue: selectTabs - })( - <Select - mode="multiple" - style={{ width: '100%' }} - placeholder="Please select" - > - {this.state.currentTabs.map((option, index) => - <Select.Option id={option.uuid} title={option.label} key={index} value={option.uuid}>{option.label}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> </Row> </Form> ) diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx index c3e03a2..8335a8f 100644 --- a/src/templates/subtableconfig/actionform/index.jsx +++ b/src/templates/subtableconfig/actionform/index.jsx @@ -64,6 +64,22 @@ }, { value: 'delete', text: this.props.dict['header.form.action.delete'] + }], + closeOptions: [{ + value: 'never', + text: this.props.dict['header.form.refresh.never'] + }, { + value: 'grid', + text: this.props.dict['header.form.refresh.grid'] + }, { + value: 'view', + text: this.props.dict['header.form.refresh.view'] + }, { + value: 'maingrid', + text: this.props.dict['header.form.refresh.maingrid'] + }, { + value: 'equaltab', + text: this.props.dict['header.form.refresh.equaltab'] }] } @@ -168,7 +184,14 @@ text: this.props.dict['header.form.popview'] } ] + } else if (item.key === 'execSuccess') { + item.options = this.state.closeOptions + } else if (item.key === 'execError') { + item.options = this.state.closeOptions + } else if (item.key === 'popClose') { + item.options = this.state.closeOptions } + item.hidden = !_options.includes(item.key) return item }) @@ -253,7 +276,7 @@ formlist: this.state.formlist.map(item => { if (item.key === 'Ot') { item.hidden = false - } else if (item.key === 'sqlType' && ['prompt', 'exec', 'pop'].includes(value)) { + } else if (item.key === 'sqlType' && ['prompt', 'exec', 'pop'].includes(value) && this.state.interType === 'inner') { item.hidden = false } return item diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index d5ab747..8e5ae6a 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -24,6 +24,7 @@ import EditCard from '@/templates/tableshare/editcard' import VerifyCard from '@/templates/tableshare/verifycard' import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin' +import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout' import MenuForm from '@/templates/tableshare/menuform' import SourceElement from '@/templates/tableshare/dragelement/source' import Source from './source' @@ -655,6 +656,15 @@ }) resolve(false) } + } else if (btn.OpenType === 'excelOut') { + let _param = { + innerFunc: btn.innerFunc + } + + newLText = Utils.formatOptions(Utils.getTableFunc(_param, {MenuID: _config.uuid, MenuName: _config.tabName, MenuNo: _config.tabNo}, _config)) // 鍒涘缓瀛樺偍杩囩▼sql + DelText = Utils.formatOptions(Utils.dropfunc(btn.innerFunc)) + + resolve(true) } else { let _param = { funcName: btn.innerFunc, @@ -1141,10 +1151,27 @@ const { card } = this.state let config = JSON.parse(JSON.stringify(this.state.config)) - if (card.OpenType !== 'excelIn') { + if (card.OpenType === 'excelIn') { + this.verifyRef.handleConfirm().then(res => { + + config.action = config.action.map(item => { + if (item.uuid === card.uuid) { + item.verify = res + } + + return item + }) + + this.setState({ + profileVisible: false, + config: config, + card: '' + }) + }) + } else { let _verify = this.verifyRef.state.verify - if (_verify.default === 'false' && _verify.scripts.length === 0) { + if (card.OpenType !== 'excelOut' && _verify.default === 'false' && _verify.scripts.length === 0) { notification.warning({ top: 92, message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒', @@ -1165,23 +1192,6 @@ profileVisible: false, config: config, card: '' - }) - } else if (card.OpenType === 'excelIn') { - this.verifyRef.handleConfirm().then(res => { - - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = res - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '' - }) }) } } @@ -2232,6 +2242,13 @@ wrappedComponentRef={(inst) => this.verifyRef = inst} /> : null } + {this.state.card && this.state.card.OpenType === 'excelOut' ? + <VerifyCardExcelOut + card={this.state.card} + dict={this.state.dict} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> : null + } </Modal> {/* 璁剧疆鍏ㄥ眬閰嶇疆鍙婂垪琛ㄦ暟鎹簮 */} <Modal diff --git a/src/templates/tableshare/dragelement/card.jsx b/src/templates/tableshare/dragelement/card.jsx index 8e70cdc..5419ea0 100644 --- a/src/templates/tableshare/dragelement/card.jsx +++ b/src/templates/tableshare/dragelement/card.jsx @@ -79,7 +79,7 @@ if (type === 'action') { if (['pop', 'prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc) { hasProfile = true - } else if (card.OpenType === 'excelIn') { + } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') { hasProfile = true } } diff --git a/src/templates/tableshare/tabform/index.jsx b/src/templates/tableshare/tabform/index.jsx index d9372f7..dd25722 100644 --- a/src/templates/tableshare/tabform/index.jsx +++ b/src/templates/tableshare/tabform/index.jsx @@ -160,7 +160,7 @@ fields.push( <Col span={12} key={index}> <Form.Item label={ - <Tooltip placement="topLeft" title="鏍囩鍙叧鑱斾笅绾ф爣绛撅紝涓嬬骇鏍囩鍙�夎寖鍥达細鐩搁偦鐨勪笅渚ф爣绛剧粍涓湭琚悓绾ф垨涓昏〃鍏宠仈鐨勬爣绛俱��"> + <Tooltip placement="topLeft" title="鏍囩娣诲姞鍚岀骇鏍囩鍚庯紝鏍囩涓寜閽埛鏂颁富琛ㄦ椂锛屾坊鍔犵殑鍚岀骇鏍囩浼氬埛鏂般��"> <Icon type="question-circle" /> {item.label} </Tooltip> @@ -171,7 +171,7 @@ <Select mode="multiple" style={{ width: '100%' }} - placeholder="Please select" + placeholder="" > {item.options.map((option, index) => <Select.Option id={option.uuid} title={option.label} key={index} value={option.uuid}>{option.label}</Select.Option> diff --git a/src/templates/tableshare/verifycardexcelout/columnform/index.jsx b/src/templates/tableshare/verifycardexcelout/columnform/index.jsx new file mode 100644 index 0000000..5b89d76 --- /dev/null +++ b/src/templates/tableshare/verifycardexcelout/columnform/index.jsx @@ -0,0 +1,128 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Button, Input, InputNumber } from 'antd' +import './index.scss' + + +class UniqueForm extends Component { + static propTpyes = { + dict: PropTypes.object, // 瀛楀吀椤� + range: PropTypes.any, // 瀛楀吀椤� + columnChange: PropTypes.func // 淇敼鍑芥暟 + } + + state = { + editItem: null // 缂栬緫鍏冪礌 + } + + edit = (record) => { + this.setState({ + editItem: record + }) + + this.props.form.setFieldsValue({ + Column: record.Column, + Text: record.Text, + Width: record.Width, + }) + } + + + handleConfirm = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + values.uuid = this.state.editItem ? this.state.editItem.uuid : '' + + this.props.columnChange(values) + this.setState({ + editItem: null + }) + this.props.form.setFieldsValue({ + Column: '', + Text: '', + Width: 20, + }) + } + }) + } + + render() { + const { getFieldDecorator } = this.props.form + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout} className="verify-form"> + <Row gutter={24}> + <Col span={7}> + <Form.Item label={'Column'}> + {getFieldDecorator('Column', { + initialValue: '', + rules: [ + { + required: true, + message: this.props.dict['form.required.input'] + 'Column!' + } + ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> + <Col span={7}> + <Form.Item label={'Text'}> + {getFieldDecorator('Text', { + initialValue: '', + rules: [ + { + required: true, + message: this.props.dict['form.required.input'] + 'Text!' + } + ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> + <Col span={7}> + <Form.Item label={'Width'}> + {getFieldDecorator('Width', { + initialValue: 20, + rules: [ + { + required: true, + message: this.props.dict['form.required.input'] + 'Width!' + } + ] + })(<InputNumber min={5} max={200} precision={0} />)} + </Form.Item> + </Col> + <Col span={3} className="add"> + <Button onClick={this.handleConfirm} type="primary" className="add-row"> + 纭畾 + </Button> + </Col> + {/* <Col span={7}> + <Form.Item label={'绫诲瀷'}> + {getFieldDecorator('type', { + initialValue: 'text' + })( + <Select onChange={this.typeChange}> + <Select.Option value="text"> text </Select.Option> + <Select.Option value="number"> number </Select.Option> + </Select> + )} + </Form.Item> + </Col> */} + </Row> + </Form> + ) + } +} + +export default Form.create()(UniqueForm) \ No newline at end of file diff --git a/src/templates/tableshare/verifycardexcelout/columnform/index.scss b/src/templates/tableshare/verifycardexcelout/columnform/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/templates/tableshare/verifycardexcelout/columnform/index.scss diff --git a/src/templates/tableshare/verifycardexcelout/index.jsx b/src/templates/tableshare/verifycardexcelout/index.jsx new file mode 100644 index 0000000..522c8ed --- /dev/null +++ b/src/templates/tableshare/verifycardexcelout/index.jsx @@ -0,0 +1,288 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Tabs, Row, Col, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber } from 'antd' + +import Utils from '@/utils/utils.js' + +import ColumnForm from './columnform' +import './index.scss' + +const { TabPane } = Tabs + +class VerifyCard extends Component { + static propTpyes = { + dict: PropTypes.object, // 瀛楀吀椤� + card: PropTypes.object, + } + + state = { + verify: {}, + excelColumns: [ + { + title: 'Column', + dataIndex: 'Column', + width: '25%' + }, + { + title: 'Text', + dataIndex: 'Text', + width: '25%' + }, + { + title: 'Width', + dataIndex: 'Width', + width: '25%' + }, + { + title: '鎿嶄綔', + align: 'center', + dataIndex: 'operation', + render: (text, record) => + ( + <div> + <span className="operation-btn" title={this.props.dict['header.edit']} onClick={() => this.handleEdit(record, 'columns')} style={{color: '#1890ff'}}><Icon type="edit" /></span> + <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'columns', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> + <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'columns', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> + <Popconfirm + title={this.props.dict['header.form.query.delete']} + okText={this.props.dict['header.confirm']} + cancelText={this.props.dict['header.cancel']} + onConfirm={() => this.handleDelete(record, 'columns') + }> + <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> + </Popconfirm> + </div> + ) + } + ] + } + + UNSAFE_componentWillMount() { + let _verify = this.props.card.verify || {} + + this.setState({ + verify: { + ..._verify, + columns: _verify.columns || [], + } + }) + } + + columnChange = (values) => { + let verify = JSON.parse(JSON.stringify(this.state.verify)) + + if (values.uuid) { + verify.columns = verify.columns.map(item => { + if (item.uuid === values.uuid) { + return values + } else { + return item + } + }) + } else { + values.uuid = Utils.getuuid() + verify.columns.push(values) + } + + this.setState({ + verify: verify + }) + } + + handleDelete = (record, type) => { + const { verify } = this.state + + verify.columns = verify.columns.filter(item => item.uuid !== record.uuid) + + this.setState({ verify: verify }) + } + + handleEdit = (record, type) => { + this.columnForm.edit(record) + + let node = document.getElementById('verify-excelout-box-tab').parentNode + + if (node && node.scrollTop) { + node.scrollTop = 0 + } + } + + handleUpDown = (record, type, direction) => { + let verify = JSON.parse(JSON.stringify(this.state.verify)) + let index = 0 + + verify.columns = verify.columns.filter((item, i) => { + if (item.uuid === record.uuid) { + index = i + } + + return item.uuid !== record.uuid + }) + if ((index === 0 && direction === 'up') || (index === verify.columns.length && direction === 'down')) { + return + } + + if (direction === 'up') { + verify.columns.splice(index - 1, 0, record) + } else { + verify.columns.splice(index + 1, 0, record) + } + + this.setState({ + verify: verify + }) + } + + showError = (errorType) => { + if (errorType === 'S') { + notification.success({ + top: 92, + message: '鎵ц鎴愬姛锛�', + duration: 2 + }) + } else if (errorType === 'F') { + notification.error({ + className: 'notification-custom-error', + top: 92, + message: '鎵ц澶辫触锛�', + duration: 15 + }) + } else if (errorType === 'N') { + notification.error({ + top: 92, + message: '鎵ц澶辫触锛�', + duration: 15 + }) + } else if (errorType === 'E') { + Modal.error({ + title: '鎵ц澶辫触锛�' + }) + } else if (errorType === 'NM') { + message.error('鎵ц澶辫触锛�') + } + } + + timeChange = (val, type) => { + const { verify } = this.state + + this.setState({ + verify: {...verify, [type]: val} + }) + } + + render() { + const { verify, excelColumns } = this.state + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <div id="verify-excelout-box-tab"> + <Tabs defaultActiveKey="1" className="verify-card-box" onChange={this.tabchange}> + <TabPane tab="Excel瀵煎嚭鍒�" key="1"> + <ColumnForm + dict={this.props.dict} + range={verify.range} + columnChange={this.columnChange} + wrappedComponentRef={(inst) => this.columnForm = inst} + /> + <Table + bordered + rowKey="uuid" + className="custom-table" + dataSource={verify.columns} + columns={excelColumns} + pagination={false} + /> + </TabPane> + <TabPane tab="淇℃伅鎻愮ず" key="7"> + <Form {...formItemLayout}> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> S </span> + <Button onClick={() => {this.showError('S')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label={'鍋滅暀鏃堕棿'}> + <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> -1 </span> + 涓嶆彁绀� + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> N </span> + <Button onClick={() => {this.showError('N')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label={'鍋滅暀鏃堕棿'}> + <InputNumber defaultValue={verify.ntime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> F </span> + <Button onClick={() => {this.showError('F')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label={'鍋滅暀鏃堕棿'}> + <InputNumber defaultValue={verify.ftime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> E </span> + <Button onClick={() => {this.showError('E')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> NM </span> + <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + </Row> + </Form> + </TabPane> + </Tabs> + </div> + ) + } +} + +export default Form.create()(VerifyCard) \ No newline at end of file diff --git a/src/templates/tableshare/verifycardexcelout/index.scss b/src/templates/tableshare/verifycardexcelout/index.scss new file mode 100644 index 0000000..63ab4c0 --- /dev/null +++ b/src/templates/tableshare/verifycardexcelout/index.scss @@ -0,0 +1,53 @@ +.verify-card-box { + .ant-tabs-nav-scroll { + text-align: center; + } + .ant-tabs-content { + min-height: 40vh; + } + table tr td { + word-wrap: break-word; + word-break: break-word; + } + .ant-input-number { + width: 100%; + } + .verify-form { + .sql { + .ant-col-sm-8 { + width: 10.5%; + } + .ant-col-sm-16 { + width: 89.5%; + padding-top: 4px; + } + } + .sqlfield { + .ant-form-item { + margin-bottom: 5px; + } + .ant-col-sm-8 { + width: 10.5%; + } + .ant-col-sm-16 { + width: 89.5%; + } + } + .add { + padding-top: 4px; + } + } + .custom-table .ant-empty { + margin: 20px 8px!important; + } + .errorval { + display: inline-block; + width: 30px; + } + .operation-btn { + display: inline-block; + font-size: 16px; + padding: 0 5px; + cursor: pointer; + } +} \ No newline at end of file diff --git a/src/utils/utils.js b/src/utils/utils.js index 70f0abd..ea12648 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1287,24 +1287,20 @@ fields = fields.join(',') - let _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50) ) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000) + let _sql = `declare @${btn.sheet} table (${declarefields.join(',')},jskey nvarchar(50)) + Declare @UserName nvarchar(50),@FullName nvarchar(50) - Select @ErrorCode='',@retmsg='' - - select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID@ + select @UserName=UserName,@FullName=FullName from SUsers where UID=@UserID Insert into @${btn.sheet} (${fields},jskey) - exec s_KeyWords_Replace + exec s_KeyWords_Replace @LText=@LText, @BID=@BID,@LoginUID=@LoginUID,@SessionUid=@SessionUid,@UserID=@UserID,@ID=@ID Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid) - Select ${fields},@userid@,@username,@fullname,@BID@ From @${btn.sheet} + Select ${fields},@userid,@username,@fullname,@BID From @${btn.sheet} - Delete @${btn.sheet} - - aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + Delete @${btn.sheet}` let Ltext = `create proc ${param.funcName} ( /*${menu.MenuName} ${btn.label}*/ -- Gitblit v1.8.0