From 3d8cb6c1787dec23cbc85d4b262fd1f00654f891 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 18 二月 2020 01:33:07 +0800 Subject: [PATCH] 2020-02-18 --- src/templates/comtableconfig/actionform/index.jsx | 33 ++- src/templates/tableshare/dragelement/index.jsx | 9 src/templates/comtableconfig/index.jsx | 9 src/templates/subtableconfig/index.jsx | 18 + src/tabviews/tableshare/actionList/index.jsx | 278 ++++++++++++++++++++++++++- src/templates/comtableconfig/settingform/index.jsx | 6 src/tabviews/subtable/index.jsx | 62 +----- src/locales/zh-CN/comtable.js | 1 src/tabviews/commontable/index.jsx | 68 +----- src/templates/subtableconfig/settingform/index.jsx | 6 src/locales/en-US/comtable.js | 1 src/templates/tableshare/verifycardexcelin/index.jsx | 1 src/templates/tableshare/formconfig.js | 14 + src/utils/utils.js | 8 src/templates/subtableconfig/actionform/index.jsx | 32 ++- 15 files changed, 393 insertions(+), 153 deletions(-) diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 0460f6d..90aa0a4 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -201,6 +201,7 @@ 'header.form.readin.tooltip': '鏄惁灏嗚〃鏍兼垨涓昏〃涓殑鏁版嵁鍐欏叆琛ㄥ崟', 'header.form.afterExecSuccess': '鎴愬姛鍚�', 'header.form.afterExecError': '澶辫触鍚�', + 'header.form.pagination': '鍒嗛〉', 'header.modal.form.edit': '琛ㄥ崟-缂栬緫', 'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫', 'header.modal.action.edit': '鎸夐挳-缂栬緫', diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index 51f1649..761fbf7 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -201,6 +201,7 @@ 'header.form.readin.tooltip': '鏄惁灏嗚〃鏍间腑鐨勬暟鎹啓鍏ヨ〃鍗�', 'header.form.afterExecSuccess': '鎴愬姛鍚�', 'header.form.afterExecError': '澶辫触鍚�', + 'header.form.pagination': '鍒嗛〉', 'header.modal.form.edit': '琛ㄥ崟-缂栬緫', 'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫', 'header.modal.action.edit': '鎸夐挳-缂栬緫', diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 4da0895..1ddb53e 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -121,6 +121,10 @@ if (col.field) { _arrField.push(col.field) + // if () { // 鏉冮檺榛戝悕鍗� + // col.Hide = 'true' + // } + _logcolumns.push(col) } if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 @@ -558,17 +562,15 @@ 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 === 'view' && type === 'pop') { this.reloadview() } else if (btn.popClose === 'grid' && type === 'pop') { this.reloadtable() - } else if (type === 'excelOut') { - this.handleDefaultExcelout(btn) } } @@ -597,59 +599,18 @@ } /** - * @description 浣跨敤榛樿瀛樺偍杩囩▼ sPC_Get_TableData 瀵煎嚭excel琛ㄦ牸 + * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - handleDefaultExcelout = (btn) => { + getexceloutparam = () => { const { MenuName } = this.props - const { arr_field, orderBy, search, setting, config } = this.state + const { arr_field, orderBy, search, setting} = this.state - let _arr_labels = [] // 鍒楀悕绉伴泦 - let _arr_label_field = [] // 鍒楀悕绉板瓧娈甸泦 - - config.columns.forEach(col => { - if (col.field) { - _arr_labels.push(col.label) - _arr_label_field.push(`${col.field} as ${col.label}`) - } - }) - - _arr_labels = _arr_labels.join(',') - _arr_label_field = _arr_label_field.join(',') - - let _search = Utils.joinMainSearchkey(search) - _search = _search ? 'where ' + _search : '' - - // 鑾峰彇excel鏁版嵁锛屼笌鑾峰彇鍒楄〃鏁版嵁涓嶅悓涓烘湭璁剧疆椤电爜绛夊弬鏁� - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: _arr_labels, - appkey: window.GLOB.appkey || '' + return { + arr_field: arr_field, + orderBy: orderBy || setting.order, + search: search, + menuName: MenuName } - - let _orderBy = orderBy || setting.order - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` - - param.LText = Utils.formatOptions(LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.DateCount = '' - - let name = `${MenuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` - - Api.getExcelOut(param, name).then(res => { - if (res && res.status === false) { - this.refs.mainButton.execError(res, btn) - } else { - this.refs.mainButton.execSuccess(btn) - } - }) } /** @@ -843,6 +804,7 @@ ContainerId={this.state.ContainerId} refreshdata={this.refreshbyaction} triggerPopview={this.triggerPopview} + getexceloutparam={this.getexceloutparam} gettableselected={this.gettableselected} /> : null } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index a88f0f8..8d1c0ca 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -506,65 +506,22 @@ this.props.handleMainTable() } else if (btn.popClose === 'subgrid' && type === 'pop') { this.reloadtable() - } else if (type === 'excelOut') { - this.handleDefaultExcelout(btn) } } /** - * @description 浣跨敤榛樿瀛樺偍杩囩▼ sPC_Get_TableData 瀵煎嚭excel琛ㄦ牸 + * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - handleDefaultExcelout = (btn) => { - const { MenuName } = this.props - const { arr_field, orderBy, search, setting, config } = this.state + getexceloutparam = () => { + const { Tab } = this.props + const { arr_field, orderBy, search, setting} = this.state - let _arr_labels = [] // 鍒楀悕绉伴泦 - let _arr_label_field = [] // 鍒楀悕绉板瓧娈甸泦 - - config.columns.forEach(col => { - if (col.field) { - _arr_labels.push(col.label) - _arr_label_field.push(`${col.field} as ${col.label}`) - } - }) - - _arr_labels = _arr_labels.join(',') - _arr_label_field = _arr_label_field.join(',') - - let _search = Utils.joinMainSearchkey(search) - _search = _search ? 'where (' + _search + ')' : '' - // 鑾峰彇鍒楄〃鏁版嵁 - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: _arr_labels, - BID: this.props.BID, - appkey: window.GLOB.appkey || '' + return { + arr_field: arr_field, + orderBy: orderBy || setting.order, + search: search, + menuName: Tab.label } - - let _orderBy = orderBy || setting.order - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - let LText = `select ${_arr_label_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` - - param.LText = Utils.formatOptions(LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.DateCount = '' - - let name = `${MenuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` - - Api.getExcelOut(param, name).then(res => { - if (res && res.status === false) { - this.refs.subButton.execError(res, btn) - } else { - this.refs.subButton.execSuccess(btn) - } - }) } /** @@ -656,6 +613,7 @@ ContainerId={this.props.ContainerId} refreshdata={this.refreshbyaction} triggerPopview={this.triggerPopview} + getexceloutparam={this.getexceloutparam} gettableselected={this.gettableselected} /> } diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx index 4b1444c..f8ae9a3 100644 --- a/src/tabviews/tableshare/actionList/index.jsx +++ b/src/tabviews/tableshare/actionList/index.jsx @@ -2,6 +2,7 @@ import PropTypes from 'prop-types' import moment from 'moment' import { Button, Affix, Modal, notification, Spin, message } from 'antd' +import * as XLSX from 'xlsx' import MutilForm from '@/tabviews/tableshare/mutilform' import ExcelIn from '../excelin' import Utils from '@/utils/utils.js' @@ -18,12 +19,13 @@ type: PropTypes.string, // 鍒ゆ柇褰撳墠涓轰富琛紙main锛夈�佸瓙琛紙sub锛夈�佸瓙琛ㄦ爣绛撅紙subtab锛� MenuID: PropTypes.string, // 鑿滃崟ID actions: PropTypes.array, // 鎸夐挳缁� - logcolumns: PropTypes.array, // 鏃ュ織涓樉绀哄垪 + logcolumns: PropTypes.array, // 鏄剧ず鍒� dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� triggerPopview: PropTypes.func, // 寮圭獥鏍囩椤佃Е鍙� + getexceloutparam: PropTypes.func, // 鑾峰彇excel瀵煎嚭鏁版嵁 gettableselected: PropTypes.func // 鑾峰彇琛ㄦ牸涓暟鎹� } @@ -114,8 +116,20 @@ this.improveAction(item) }) } else if (item.OpenType === 'excelOut') { - this.setState({loadingUuid: item.uuid}) - this.refreshdata(item, 'excelOut') + if ( + item.intertype === 'inner' && !item.innerFunc && + ((setting.interType === 'inner' && setting.innerFunc) || setting.interType === 'outer') + ) { + notification.warning({ + top: 92, + message: '瀵煎嚭鎸夐挳閰嶇疆閿欒锛�', + duration: 10 + }) + return + } + + this.triggerExcelout(item) + } else if (item.OpenType === 'excelIn') { if (item.verify && item.verify.sheet && item.verify.columns && item.verify.columns.length > 0) { let primaryId = '' // 瀵煎叆鏃惰Id @@ -543,15 +557,11 @@ * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� */ execSuccess = (btn, res) => { - if (btn.OpenType === 'excelOut' || btn.OpenType === 'excelIn') { // 瀵煎嚭excel - this.setState({ - loadingUuid: '' - }) - } else if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 + if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 notification.success({ top: 92, message: res.ErrMesg || this.props.dict['main.action.confirm.success'], - duration: 2 + duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 }) } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず @@ -570,7 +580,12 @@ this.setState({ visible: false }) + } else if (btn.OpenType === 'excelOut' || btn.OpenType === 'excelIn') { // 瀵煎嚭excel + this.setState({ + loadingUuid: '' + }) } + this.refreshdata(btn, 'success') } @@ -589,14 +604,14 @@ notification.error({ top: 92, message: res.message || res.ErrMesg, - duration: btn.errorTime || 15 + duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 15 }) } else if (res.ErrCode === 'F') { notification.error({ className: 'notification-custom-error', top: 92, message: res.message || res.ErrMesg, - duration: btn.errorTime || 15 + duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 15 }) } else if (res.ErrCode === 'NM') { message.error(res.message || res.ErrMesg) @@ -796,6 +811,9 @@ }) } + /** + * @description Excel 瀵煎叆 + */ getexceldata = (data, btn, errors, primaryId) => { if (errors) { if (errors === 'notexit') { @@ -946,6 +964,244 @@ } /** + * @description Excel 瀵煎嚭 + */ + triggerExcelout = (btn) => { + let viewParam = this.props.getexceloutparam() + let name = `${viewParam.menuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` + // let pageSize = 100 + + this.setState({loadingUuid: btn.uuid}) + + if (btn.pagination !== 'true') { + if (btn.intertype === 'inner' && !btn.innerFunc) { // 浣跨敤绯荤粺鍑芥暟 + if (!viewParam.arr_field) { + this.execError({ErrCode: 'N', message: '鏈缃樉绀哄垪锛�'}, btn) + return + } + + let param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search) + + Api.genericInterface(param).then(result => { + if (result.status) { + this.exportExcel(result.data, btn, name) + } else { + this.execError(result, btn) + } + }) + } else if (btn.intertype === 'inner' && btn.innerFunc) { // 浣跨敤鍐呴儴鍑芥暟 + let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) + param.func = btn.innerFunc + + Api.genericInterface(param).then(result => { + if (result.status) { + this.exportExcel(result.data, btn, name) + } else { + this.execError(result, btn) + } + }) + } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 浣跨敤澶栭儴鍑芥暟 + let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) + 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) { + this.exportExcel(result.data, btn, name) + } else { + this.execError(result, btn) + } + }) + } else if (btn.intertype === 'outer' && btn.innerFunc) { + let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) + 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) { + this.exportExcel(result.data, btn, name) + } else { + this.execError(result, btn) + } + }) + } else { + this.execError(res, btn) + } + }) + } else { + this.execError({ErrCode: 'N', message: '瀵煎嚭鎸夐挳璁剧疆閿欒锛�'}, btn) + } + } + } + + exportExcel = (data, btn, name) => { + const { logcolumns } = this.props + if (data && data.length > 0) { + try { + let _header = [] + let _topRow = {} + let colwidth = [] + logcolumns.forEach(col => { + if (col.Hide === 'true') return + + if (!data[0].hasOwnProperty(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 + } + + colwidth.push({width: _colwidth}) + }) + + let table = [] + + table.push(_topRow) + + data.forEach(item => { + let _row = {} + _header.forEach(field => { + _row[field] = item[field] + }) + + 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 + + const wb = XLSX.utils.book_new() + XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') + + XLSX.writeFile(wb, name) + + this.execSuccess(btn, {ErrCode: 'S', ErrMesg: '瀵煎嚭鎴愬姛锛�'}) + } catch { + this.execError({ErrCode: 'N', message: 'Excel鐢熸垚澶辫触锛�'}, btn) + } + + } else { + this.execError({ErrCode: 'N', message: '鏈煡璇㈠埌瀵煎嚭鏁版嵁锛�'}, btn) + } + } + + /** + * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� + */ + getExcelCustomParam = (orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { + let _search = Utils.formatCustomMainSearch(search) + + let param = { + OrderCol: orderBy, + ..._search + } + + if (pagination) { + param.PageIndex = pageIndex + param.PageSize = pageSize + } + + return param + } + + /** + * @description 鑾峰彇榛樿瀛樺偍杩囩▼璇锋眰鍙傛暟 + */ + getExcelDefaultParam = (arr_field, orderBy, search, pagination = false, pageIndex = 1, pageSize = 100) => { + const { setting } = this.props + + let _search = Utils.joinMainSearchkey(search) + + _search = _search ? 'where ' + _search : '' + + let param = { + func: 'sPC_Get_TableData', + obj_name: 'data', + arr_field: arr_field, + appkey: window.GLOB.appkey || '' + } + + let _dataresource = setting.dataresource + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } + + if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 + let fieldmap = new Map() + let options = search.map(item => { + let _field = item.key + + if (fieldmap.has(_field)) { + _field = _field + '1' + } + + fieldmap.set(item.key, true) + + return { + reg: new RegExp('@' + _field, 'ig'), + value: item.value + } + }) + + options.reverse() + + options.forEach(item => { + _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) + }) + + _search = '' + } + + let LText = '' + if (pagination) { + LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` + } else { + LText = `select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` + } + + param.LText = Utils.formatOptions(LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.DateCount = '' + + return param + } + + /** * @description 妯℃�佹锛堣〃鍗曪級锛岀‘璁� */ handleOk = () => { diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx index 158d78d..02b61bf 100644 --- a/src/templates/comtableconfig/actionform/index.jsx +++ b/src/templates/comtableconfig/actionform/index.jsx @@ -9,10 +9,11 @@ class MainSearch extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - formlist: PropTypes.any, // 琛ㄥ崟淇℃伅 - card: PropTypes.any, // 鎸夐挳淇℃伅 - tabs: PropTypes.array // 鎵�鏈夋爣绛鹃〉 + dict: PropTypes.object, // 瀛楀吀椤� + setting: PropTypes.object, // 椤甸潰璁剧疆 + formlist: PropTypes.any, // 琛ㄥ崟淇℃伅 + card: PropTypes.any, // 鎸夐挳淇℃伅 + tabs: PropTypes.array // 鎵�鏈夋爣绛鹃〉 } state = { @@ -102,9 +103,9 @@ _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] } else if (_opentype === 'excelOut') { // 瀵煎叆瀵煎嚭 if (_intertype === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } } else if (_opentype === 'excelIn') { // 瀵煎叆瀵煎嚭 if (_intertype === 'outer') { @@ -192,9 +193,9 @@ _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] } else if (value === 'excelOut') { if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } } else if (value === 'excelIn') { if (this.state.interType === 'outer') { @@ -303,9 +304,9 @@ let _options = null if (openType === 'excelOut') { if (value === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } } else if (openType === 'excelIn') { if (value === 'outer') { @@ -506,6 +507,7 @@ } handleConfirm = () => { + const { setting } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { @@ -516,6 +518,17 @@ if (values.OpenType === 'excelIn') { values.position = 'toolbar' } else if (values.OpenType === 'excelOut') { + if (values.intertype === 'inner' && !values.innerFunc) { + if ((setting.interType === 'inner' && setting.innerFunc) || setting.interType === 'outer') { + notification.warning({ + top: 92, + message: '琛ㄦ牸鏁版嵁鏌ヨ鏈娇鐢ㄦ暟鎹簮锛屽鍑篍xcel浣跨敤鍐呴儴鎺ュ彛鏃讹紝闇�鑷畾涔夊唴閮ㄥ嚱鏁帮紒', + duration: 10 + }) + return + } + } + values.position = 'toolbar' values.Ot = 'notRequired' } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 0b67ebd..ae94117 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -779,14 +779,11 @@ if (btn.verify && btn.verify.sheet && btn.verify.columns && btn.verify.columns.length > 0) { let _param = { funcName: btn.innerFunc, - name: config.setting.tableName || '', - fields: '', menuNo: menu.MenuNo } - newLText = Utils.formatOptions(Utils.getexcelInfunc(_param, btn, menu, config)) + newLText = Utils.formatOptions(Utils.getexcelInfunc(_param, btn, menu)) DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) - // resolve(true) - resolve(false) + resolve(true) } else { notification.warning({ top: 92, @@ -2476,6 +2473,7 @@ <DragElement type="action" list={this.state.config.action} + setting={this.state.config.setting} handleList={this.handleList} handleMenu={this.handleAction} copyElement={(val) => this.handleAction(val, 'copy')} @@ -2560,6 +2558,7 @@ card={this.state.card} tabs={this.state.tabviews} formlist={this.state.formlist} + setting={this.state.config.setting} wrappedComponentRef={(inst) => this.actionFormRef = inst} /> </Modal> diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx index b55e8b4..6751766 100644 --- a/src/templates/comtableconfig/settingform/index.jsx +++ b/src/templates/comtableconfig/settingform/index.jsx @@ -161,7 +161,7 @@ <Col span={12}> <Form.Item label="琛ㄥ悕"> {getFieldDecorator('tableName', { - initialValue: data.tableName, + initialValue: data.tableName || '', rules: [ { required: true, @@ -178,7 +178,7 @@ <Col span={12}> <Form.Item label="琛ㄦ牸灞炴��"> {getFieldDecorator('tableType', { - initialValue: data.tableType + initialValue: data.tableType || 'checkbox' })( <Select getPopupContainer={() => document.getElementById('commontable-setting-form')} @@ -276,7 +276,7 @@ </Tooltip> }> {getFieldDecorator('dataresource', { - initialValue: data.dataresource + initialValue: data.dataresource || '' })(<TextArea rows={4} />)} </Form.Item> </Col> : null} diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx index f4eabb0..c3e03a2 100644 --- a/src/templates/subtableconfig/actionform/index.jsx +++ b/src/templates/subtableconfig/actionform/index.jsx @@ -9,10 +9,11 @@ class MainSearch extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - formlist: PropTypes.any, // 琛ㄥ崟淇℃伅 - card: PropTypes.any, // 鎸夐挳淇℃伅 - tabs: PropTypes.array // 鎵�鏈夋爣绛鹃〉 + dict: PropTypes.object, // 瀛楀吀椤� + setting: PropTypes.object, // 椤甸潰璁剧疆 + formlist: PropTypes.any, // 琛ㄥ崟淇℃伅 + card: PropTypes.any, // 鎸夐挳淇℃伅 + tabs: PropTypes.array // 鎵�鏈夋爣绛鹃〉 } state = { @@ -96,9 +97,9 @@ _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] } else if (_opentype === 'excelOut') { if (_intertype === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } } else if (_opentype === 'excelIn') { if (_intertype === 'outer') { @@ -196,9 +197,9 @@ _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] } else if (value === 'excelOut') { if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } } else if (value === 'excelIn') { if (this.state.interType === 'outer') { @@ -325,9 +326,9 @@ if (openType === 'excelOut') { if (value === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError'] + _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination'] } } else if (openType === 'excelIn') { if (value === 'outer') { @@ -520,6 +521,7 @@ } handleConfirm = () => { + const { setting } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { @@ -530,6 +532,16 @@ if (values.OpenType === 'excelIn') { values.position = 'toolbar' } else if (values.OpenType === 'excelOut') { + if (values.intertype === 'inner' && !values.innerFunc) { + if ((setting.interType === 'inner' && setting.innerFunc) || setting.interType === 'outer') { + notification.warning({ + top: 92, + message: '琛ㄦ牸鏁版嵁鏌ヨ鏈娇鐢ㄦ暟鎹簮锛屽鍑篍xcel浣跨敤鍐呴儴鎺ュ彛鏃讹紝闇�鑷畾涔夊唴閮ㄥ嚱鏁帮紒', + duration: 10 + }) + return + } + } values.position = 'toolbar' values.Ot = 'notRequired' } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 12ecf47..d5ab747 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -638,6 +638,23 @@ }) } }) + } else if (btn.OpenType === 'excelIn') { + if (btn.verify && btn.verify.sheet && btn.verify.columns && btn.verify.columns.length > 0) { + let _param = { + funcName: btn.innerFunc, + menuNo: _config.tabNo + } + newLText = Utils.formatOptions(Utils.getexcelInfunc(_param, btn, {MenuID: _config.uuid, MenuName: _config.tabName})) + DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) + resolve(true) + } else { + notification.warning({ + top: 92, + message: '璇峰畬鍠勫鍏xcel楠岃瘉淇℃伅锛�', + duration: 10 + }) + resolve(false) + } } else { let _param = { funcName: btn.innerFunc, @@ -2113,6 +2130,7 @@ card={this.state.card} tabs={this.state.tabviews} formlist={this.state.formlist} + setting={this.state.config.setting} wrappedComponentRef={(inst) => this.actionFormRef = inst} /> </Modal> diff --git a/src/templates/subtableconfig/settingform/index.jsx b/src/templates/subtableconfig/settingform/index.jsx index 41a9c8a..8b4cc1b 100644 --- a/src/templates/subtableconfig/settingform/index.jsx +++ b/src/templates/subtableconfig/settingform/index.jsx @@ -140,7 +140,7 @@ <Col span={12}> <Form.Item label="琛ㄥ悕"> {getFieldDecorator('tableName', { - initialValue: data.tableName, + initialValue: data.tableName || '', rules: [ { required: true, @@ -157,7 +157,7 @@ <Col span={12}> <Form.Item label="琛ㄦ牸灞炴��"> {getFieldDecorator('tableType', { - initialValue: data.tableType + initialValue: data.tableType || 'checkbox' })( <Select getPopupContainer={() => document.getElementById('subtable-setting-form')} @@ -255,7 +255,7 @@ </Tooltip> } className="textarea"> {getFieldDecorator('dataresource', { - initialValue: data.dataresource + initialValue: data.dataresource || '' })(<TextArea rows={4} />)} </Form.Item> </Col> : null} diff --git a/src/templates/tableshare/dragelement/index.jsx b/src/templates/tableshare/dragelement/index.jsx index 5c3a12a..12a0f89 100644 --- a/src/templates/tableshare/dragelement/index.jsx +++ b/src/templates/tableshare/dragelement/index.jsx @@ -109,9 +109,16 @@ newcard.errorTime = 15 newcard.verify = null - if (item.subType === 'excelIn' || item.subType === 'excelOut') { + if (item.subType === 'excelIn') { // 瀵煎叆鍜屽鍑篹xcel锛屾寜閽悕绉扮洿鎺ヤ负瀵煎叆銆佸鍑� newcard.label = item.label + } else if (item.subType === 'excelOut') { + newcard.label = item.label + newcard.intertype = setting.interType + newcard.innerFunc = setting.innerFunc + newcard.sysInterface = setting.sysInterface + newcard.outerFunc = setting.outerFunc + newcard.interface = setting.interface } } else if (item.type === 'columns') { newcard.Align = 'left' diff --git a/src/templates/tableshare/formconfig.js b/src/templates/tableshare/formconfig.js index 77891d2..80b340e 100644 --- a/src/templates/tableshare/formconfig.js +++ b/src/templates/tableshare/formconfig.js @@ -509,6 +509,20 @@ tooltip: Formdict['header.form.actionhelp.sqlType'], required: false, options: [] + }, + { + type: 'radio', + key: 'pagination', + label: Formdict['header.form.pagination'], + initVal: card.pagination || 'false', + required: false, + options: [{ + value: 'true', + text: Formdict['header.form.true'] + }, { + value: 'false', + text: Formdict['header.form.false'] + }] } ] } diff --git a/src/templates/tableshare/verifycardexcelin/index.jsx b/src/templates/tableshare/verifycardexcelin/index.jsx index 395a1eb..4308e0a 100644 --- a/src/templates/tableshare/verifycardexcelin/index.jsx +++ b/src/templates/tableshare/verifycardexcelin/index.jsx @@ -307,7 +307,6 @@ return } } - console.log(_verify) resolve(_verify) } else { diff --git a/src/utils/utils.js b/src/utils/utils.js index ea8091e..70f0abd 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1309,20 +1309,20 @@ let Ltext = `create proc ${param.funcName} ( /*${menu.MenuName} ${btn.label}*/ @ID nvarchar(50)='', - @BID nvarchar(50)='', + @BID nvarchar(50)='', @Ltext nvarchar(max)='', @sEPTMenuNo nvarchar(50)='${param.menuNo}', @lang nvarchar(50)='', @LoginUID nvarchar(50)='', @SessionUid nvarchar(50)='', @UserID nvarchar(50), - @ErrorCode nvarchar(50) out, + @ErrorCode nvarchar(50) out, @retmsg nvarchar(4000) out ) as begin - declare @sEPTMenuNo ,@Begindate datetime,@Enddate datetime - select @sEPTMenuNo=@retmsg,@Begindate=getdate() + declare @BegindateTest datetime,@EnddateTest datetime + select @BegindateTest=getdate() set @ErrorCode='' set @retmsg='' BEGIN TRY -- Gitblit v1.8.0