From 2652a3c1485dbbf3b003e13e5c5d1c0205e7c324 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 09 九月 2020 09:19:46 +0800 Subject: [PATCH] 2020-09-09 --- src/menu/actioncomponent/formconfig.jsx | 10 src/menu/actioncomponent/actionform/index.jsx | 18 - src/templates/comtableconfig/index.jsx | 80 ---- src/tabviews/zshare/actionList/excelInbutton/index.jsx | 2 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 24 src/locales/zh-CN/model.js | 9 src/locales/en-US/model.js | 9 src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx | 69 +++- src/tabviews/subtable/index.jsx | 32 - src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 4 src/tabviews/subtabtable/index.jsx | 32 - src/tabviews/commontable/index.jsx | 50 -- src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx | 7 src/tabviews/zshare/actionList/normalbutton/index.jsx | 18 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 6 src/utils/utils.js | 2 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 6 src/templates/formtabconfig/settingform/index.jsx | 4 src/utils/utils-update.js | 155 +++++++++ src/templates/zshare/formconfig.jsx | 33 +- src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 251 +++++---------- src/templates/zshare/verifycard/index.jsx | 9 src/templates/calendarconfig/index.jsx | 7 src/templates/formtabconfig/actionform/index.jsx | 4 src/templates/subtableconfig/index.jsx | 57 --- src/tabviews/zshare/actionList/printbutton/index.jsx | 2 src/templates/sharecomponent/settingcalcomponent/verifycard/customscript/index.jsx | 4 src/templates/sharecomponent/actioncomponent/dragaction/index.jsx | 2 28 files changed, 395 insertions(+), 511 deletions(-) diff --git a/src/locales/en-US/model.js b/src/locales/en-US/model.js index 817210d..f3aec6a 100644 --- a/src/locales/en-US/model.js +++ b/src/locales/en-US/model.js @@ -106,8 +106,9 @@ 'header.form.intertype': 'Interface type', 'header.form.interface': 'Address of the interface', 'header.form.sysInterface': 'The system interface', - 'header.form.interface.inner': 'Internal', - 'header.form.interface.outer': 'External', + 'model.interface.system': '绯荤粺', + 'model.interface.inner': 'Internal', + 'model.interface.outer': 'External', 'header.form.pageTemplate': 'The page template', 'model.form.type': 'Type', 'model.form.text': 'Text', @@ -171,8 +172,6 @@ 'header.form.custom': '鑷畾涔�', 'header.form.datasource': '鏁版嵁婧�', 'model.form.tablename': 'Table name', - 'header.form.actionhelp.tablename': '浣跨敤绯荤粺鍑芥暟鏃讹紝璇峰~鍐欐暟鎹簮銆�', - 'header.form.actionhelp.sqlType': '浣跨敤绯荤粺鍑芥暟鏃讹紝璇烽�夋嫨绫诲瀷銆�', 'header.form.action.type': '鎿嶄綔绫诲瀷', 'header.form.action.insert': '娣诲姞', 'header.form.action.update': '淇敼', @@ -254,6 +253,6 @@ 'model.tooltip.action.guide': '鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�', 'model.tooltip.column.guide': '鍦ㄥ乏渚у伐鍏锋爮銆婃樉绀哄垪銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬樉绀哄垪鎷栬嚦姝ゅ娣诲姞锛涙垨鐐瑰嚮銆婃坊鍔犳樉绀哄垪銆嬫寜閽壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ�傛敞锛氭坊鍔犲悎骞跺垪鏃讹紝闇�璁剧疆鍙�夊垪銆�', 'model.tooltip.tabs.guide': '鍦ㄥ乏渚у伐鍏锋爮銆婃爣绛鹃〉銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬爣绛鹃〉鎷栬嚦姝ゅ娣诲姞銆�', - 'model.tooltip.func.innerface': '鍐呴儴鎺ュ彛: 鍙嚜瀹氫箟鏁版嵁澶勭悊鍑芥暟锛屽嚱鏁板悕绉伴渶浠ableField绛夊瓧绗﹀紑濮嬶紱鏈缃椂浼氳皟鐢ㄧ郴缁熷嚱鏁帮紝浣跨敤绯荤粺鍑芥暟闇�瀹屽杽鏁版嵁婧愬強鎿嶄綔绫诲瀷;', + 'model.tooltip.func.innerface': '鍐呴儴鎺ュ彛: 鍙嚜瀹氫箟鏁版嵁澶勭悊鍑芥暟锛屽嚱鏁板悕绉伴渶浠ableField绛夊瓧绗﹀紑濮�;', 'model.tooltip.func.outface': '澶栭儴鎺ュ彛: 鍙嚜瀹氫箟鏁版嵁澶勭悊鍑芥暟锛屾彁浜ゆ暟鎹粡杩囧唴閮ㄥ嚱鏁板鐞嗗悗锛屼紶鍏ュ閮ㄦ帴鍙o紝鏈缃椂锛屾暟鎹細鐩存帴浼犲叆澶栭儴鎺ュ彛銆�', } \ No newline at end of file diff --git a/src/locales/zh-CN/model.js b/src/locales/zh-CN/model.js index 80b2856..036056b 100644 --- a/src/locales/zh-CN/model.js +++ b/src/locales/zh-CN/model.js @@ -106,8 +106,9 @@ 'header.form.intertype': '鎺ュ彛绫诲瀷', 'header.form.interface': '鎺ュ彛鍦板潃', 'header.form.sysInterface': '绯荤粺鎺ュ彛', - 'header.form.interface.inner': '鍐呴儴', - 'header.form.interface.outer': '澶栭儴', + 'model.interface.system': '绯荤粺', + 'model.interface.inner': '鍐呴儴', + 'model.interface.outer': '澶栭儴', 'header.form.pageTemplate': '椤甸潰妯℃澘', 'model.form.type': '绫诲瀷', 'model.form.text': '鏂囨湰', @@ -171,8 +172,6 @@ 'header.form.custom': '鑷畾涔�', 'header.form.datasource': '鏁版嵁婧�', 'model.form.tablename': '琛ㄥ悕', - 'header.form.actionhelp.tablename': '浣跨敤绯荤粺鍑芥暟鏃讹紝璇峰~鍐欒〃鍚嶏紝浣跨敤鑷畾涔夊嚱鏁版椂锛屽彲蹇界暐銆�', - 'header.form.actionhelp.sqlType': '浣跨敤绯荤粺鍑芥暟鏃讹紝璇烽�夋嫨鎿嶄綔绫诲瀷锛屼娇鐢ㄨ嚜瀹氫箟鍑芥暟鏃讹紝鍙拷鐣ャ��', 'header.form.action.type': '鎿嶄綔绫诲瀷', 'header.form.action.insert': '娣诲姞', 'header.form.action.update': '淇敼', @@ -254,6 +253,6 @@ 'model.tooltip.action.guide': '鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�', 'model.tooltip.column.guide': '鍦ㄥ乏渚у伐鍏锋爮銆婃樉绀哄垪銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬樉绀哄垪鎷栬嚦姝ゅ娣诲姞锛涙垨鐐瑰嚮銆婃坊鍔犳樉绀哄垪銆嬫寜閽壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ�傛敞锛氭坊鍔犲悎骞跺垪鏃讹紝闇�璁剧疆鍙�夊垪銆�', 'model.tooltip.tabs.guide': '鍦ㄥ乏渚у伐鍏锋爮銆婃爣绛鹃〉銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬爣绛鹃〉鎷栬嚦姝ゅ娣诲姞銆�', - 'model.tooltip.func.innerface': '鍐呴儴鎺ュ彛: 鍙嚜瀹氫箟鏁版嵁澶勭悊鍑芥暟锛屽嚱鏁板悕绉伴渶浠ableField绛夊瓧绗﹀紑濮嬶紱鏈缃椂浼氳皟鐢ㄧ郴缁熷嚱鏁帮紝浣跨敤绯荤粺鍑芥暟闇�瀹屽杽鏁版嵁婧愬強鎿嶄綔绫诲瀷;', + 'model.tooltip.func.innerface': '鍐呴儴鎺ュ彛: 鍙嚜瀹氫箟鏁版嵁澶勭悊鍑芥暟锛屽嚱鏁板悕绉伴渶浠ableField绛夊瓧绗﹀紑濮�;', 'model.tooltip.func.outface': '澶栭儴鎺ュ彛: 鍙嚜瀹氫箟鏁版嵁澶勭悊鍑芥暟锛屾彁浜ゆ暟鎹粡杩囧唴閮ㄥ嚱鏁板鐞嗗悗锛屼紶鍏ュ閮ㄦ帴鍙o紝鏈缃椂锛屾暟鎹細鐩存帴浼犲叆澶栭儴鎺ュ彛銆�', } \ No newline at end of file diff --git a/src/menu/actioncomponent/actionform/index.jsx b/src/menu/actioncomponent/actionform/index.jsx index 921703d..a3e887b 100644 --- a/src/menu/actioncomponent/actionform/index.jsx +++ b/src/menu/actioncomponent/actionform/index.jsx @@ -720,22 +720,8 @@ }) values.linkThdMenu = linkThdMenu } - - if (values.innerFunc === '' && values.sql === '') { - notification.warning({ - top: 92, - message: this.props.dict['header.form.actionhelp.tablename'], - duration: 5 - }) - } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') { - notification.warning({ - top: 92, - message: this.props.dict['header.form.actionhelp.sqlType'], - duration: 5 - }) - } else { - resolve(values) - } + + resolve(values) } else { reject(err) } diff --git a/src/menu/actioncomponent/formconfig.jsx b/src/menu/actioncomponent/formconfig.jsx index 985a7e8..3f590d9 100644 --- a/src/menu/actioncomponent/formconfig.jsx +++ b/src/menu/actioncomponent/formconfig.jsx @@ -119,10 +119,10 @@ text: '绯荤粺' }, { value: 'inner', - text: Formdict['header.form.interface.inner'] + text: Formdict['model.interface.inner'] }, { value: 'outer', - text: Formdict['header.form.interface.outer'] + text: Formdict['model.interface.outer'] }] }, { @@ -130,8 +130,7 @@ key: 'sqlType', label: Formdict['header.form.action.type'], initVal: card.sqlType || '', - tooltip: Formdict['header.form.actionhelp.sqlType'], - required: false, + required: true, options: [] }, { @@ -147,8 +146,7 @@ key: 'sql', label: Formdict['model.form.tablename'], initVal: card.sql || setting.tableName || '', - tooltip: Formdict['header.form.actionhelp.tablename'], - required: false + required: true }, { type: 'text', diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index ce2b81d..4d7f825 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -10,6 +10,7 @@ import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' +import UtilsUpdate from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' import asyncSpinComponent from '@/utils/asyncSpinComponent' import { refreshTabView } from '@/store/action' @@ -128,53 +129,8 @@ return } - if (!config.version || config.version < '1.0') { - // 鍏煎鏍囩 - if (!config.tabgroups) { - config.tabgroups = [{ uuid: 'tabs', sublist: [] }] - } else if (typeof(config.tabgroups[0]) === 'string') { - let _tabgroups = [] - config.tabgroups.forEach(groupId => { - let _group = { - uuid: groupId, - sublist: fromJS(config[groupId]).toJS() - } - - delete config[groupId] - - _tabgroups.push(_group) - }) - - config.tabgroups = _tabgroups - } - - // 鍏煎鍥捐〃 - if (!config.charts) { - config.expand = true - config.charts = [{ uuid: Utils.getuuid(), label: '', title: '', chartType: 'table', icon: 'table', Hide: 'false', blacklist: [] }] - } else { - config.charts.forEach(card => { - if (card.chartType === 'card') { - card.details = card.details.map(_cell => { - _cell.fontSize = _cell.fontSize || 14 - if (!_cell.width) { - _cell.width = 100 - } else if (_cell.width === 'helf') { - _cell.width = 50 - } else if (_cell.width === 'third') { - _cell.width = 33 - } - if (!_cell.fontWeight && _cell.bold === 'true') { - _cell.fontWeight = 'normal' - } - _cell.height = _cell.height || 1 - - return _cell - }) - } - }) - } - } + // 鐗堟湰鍏煎 + config = UtilsUpdate.updateCommonTable(config) // 鏉冮檺杩囨护 if (this.props.menuType !== 'HS') { diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index ff9948e..982e15b 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -9,6 +9,7 @@ import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' +import UtilsUpdate from '@/utils/utils-update.js' import { modifyTabview } from '@/store/action' import SubSearch from '@/tabviews/zshare/topSearch' @@ -145,35 +146,8 @@ let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() - // 鏃х増鏈吋瀹� - if (!config.version || config.version < '1.0') { - // 鍏煎鍥捐〃 - if (!config.charts) { - config.expand = true - config.charts = [{ uuid: Utils.getuuid(), label: '', title: '', chartType: 'table', icon: 'table', Hide: 'false', blacklist: [] }] - } else { - config.charts.forEach(card => { - if (card.chartType === 'card') { - card.details = card.details.map(_cell => { - _cell.fontSize = _cell.fontSize || 14 - if (!_cell.width) { - _cell.width = 100 - } else if (_cell.width === 'helf') { - _cell.width = 50 - } else if (_cell.width === 'third') { - _cell.width = 33 - } - if (!_cell.fontWeight && _cell.bold === 'true') { - _cell.fontWeight = 'normal' - } - _cell.height = _cell.height || 1 - - return _cell - }) - } - }) - } - } + // 鐗堟湰鍏煎 + config = UtilsUpdate.updateSubTable(config) // 鏉冮檺杩囨护 if (this.props.menuType !== 'HS') { diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 19835b5..2d2de9c 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -9,6 +9,7 @@ import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' +import UtilsUpdate from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' import asyncSpinComponent from '@/utils/asyncSpinComponent' @@ -107,35 +108,8 @@ let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� let colMap = new Map() - // 鏃х増鏈吋瀹� - if (!config.version || config.version < '1.0') { - // 鍏煎鍥捐〃 - if (!config.charts) { - config.expand = true - config.charts = [{ uuid: Utils.getuuid(), label: '', title: '', chartType: 'table', icon: 'table', Hide: 'false', blacklist: [] }] - } else { - config.charts.forEach(card => { - if (card.chartType === 'card') { - card.details = card.details.map(_cell => { - _cell.fontSize = _cell.fontSize || 14 - if (!_cell.width) { - _cell.width = 100 - } else if (_cell.width === 'helf') { - _cell.width = 50 - } else if (_cell.width === 'third') { - _cell.width = 33 - } - if (!_cell.fontWeight && _cell.bold === 'true') { - _cell.fontWeight = 'normal' - } - _cell.height = _cell.height || 1 - - return _cell - }) - } - }) - } - } + // 鐗堟湰鍏煎 + config = UtilsUpdate.updateSubTable(config) // 浠呮敮鎸乪xec銆乸rompt銆乸op 涓夌绫诲瀷鎸夐挳 if (type === 'calendar') { diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 3b995e5..efb3173 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -251,7 +251,7 @@ param.BID = this.props.BID } - if (btn.intertype === 'inner' && !btn.innerFunc) { // 绯荤粺瀛樺偍杩囩▼ + if (btn.intertype === 'system') { // 绯荤粺瀛樺偍杩囩▼ param.func = 'sPC_TableData_InUpDe' if (this.props.dataManager) { // 鏁版嵁鏉冮檺 diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 4429f0e..a54ec86 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -78,10 +78,14 @@ return } - if ( - btn.intertype === 'inner' && !btn.innerFunc && - ((setting.interType === 'inner' && setting.innerFunc) || setting.interType === 'outer') - ) { + if (btn.intertype === 'system' && setting.interType !== 'system') { + notification.warning({ + top: 92, + message: '瀵煎嚭鎸夐挳閰嶇疆閿欒锛�', + duration: 5 + }) + return + } else if (btn.intertype === 'inner' && !btn.innerFunc) { notification.warning({ top: 92, message: '瀵煎嚭鎸夐挳閰嶇疆閿欒锛�', @@ -129,21 +133,21 @@ } } - if (btn.intertype === 'inner' && !btn.innerFunc && !viewParam.arr_field) { // 浣跨敤绯荤粺鍑芥暟 + if (btn.intertype === 'system' && !viewParam.arr_field) { // 浣跨敤绯荤粺鍑芥暟 notification.warning({ top: 92, message: '鏈缃樉绀哄垪锛�', duration: 5 }) return - } else if (btn.intertype === 'inner' && !btn.innerFunc && btn.verify && btn.verify.enable === 'true') { + } else if (btn.intertype === 'system' && btn.verify && btn.verify.enable === 'true') { this.setState({search: fromJS(viewParam.search).toJS()}) } this.updateStatus('start', name) if (btn.pagination !== 'true') { - if (btn.intertype === 'inner' && !btn.innerFunc) { // 浣跨敤绯荤粺鍑芥暟 + if (btn.intertype === 'system') { // 浣跨敤绯荤粺鍑芥暟 let param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search) Api.genericInterface(param).then(result => { @@ -155,7 +159,7 @@ }, () => { this.execError({}) }) - } else if (btn.intertype === 'inner' && btn.innerFunc) { // 浣跨敤鍐呴儴鍑芥暟 + } else if (btn.intertype === 'inner') { // 浣跨敤鍐呴儴鍑芥暟 let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) param.func = btn.innerFunc @@ -320,14 +324,14 @@ getExcelOutData = (viewParam, pageIndex, pageSize, data) => { const { btn } = this.props let param = null - if (btn.intertype === 'inner' && !btn.innerFunc) { // 浣跨敤绯荤粺鍑芥暟 + if (btn.intertype === 'system') { // 浣跨敤绯荤粺鍑芥暟 if (!viewParam.arr_field) { this.execError({ErrCode: 'N', message: '鏈缃樉绀哄垪锛�'}) return } param = this.getExcelDefaultParam(viewParam.arr_field, viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) - } else if (btn.intertype === 'inner' && btn.innerFunc) { // 浣跨敤鍐呴儴鍑芥暟 + } else if (btn.intertype === 'inner') { // 浣跨敤鍐呴儴鍑芥暟 param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) param.func = btn.innerFunc diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 1fd16f9..6128753 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -126,17 +126,23 @@ // 鏁版嵁閫夋嫨绫诲瀷鏍¢獙 this.actionSettingError() return - } else if (btn.intertype === 'inner') { - // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鍐呴儴鍑芥暟鍜屾暟鎹簮涓嶅彲鍚屾椂涓虹┖, 浣跨敤绯荤粺鍑芥暟鏃讹紝绫诲瀷涓嶅彲涓虹┖ - if (!btn.innerFunc && (!btn.sql || (btn.sql && !btn.sqlType))) { + } else if (btn.intertype === 'system') { + // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鎿嶄綔绫诲瀷鍜屾暟鎹簮涓嶅彲涓虹┖ + if (!btn.sql || !btn.sqlType) { this.actionSettingError() return - } else if (data.length === 0 && !btn.innerFunc && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { + } else if (data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { notification.warning({ top: 92, message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', duration: 5 }) + return + } + } else if (btn.intertype === 'inner') { + // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鍐呴儴鍑芥暟涓嶅彲涓虹┖ + if (!btn.innerFunc) { + this.actionSettingError() return } } else if (btn.intertype === 'outer') { @@ -145,7 +151,7 @@ this.actionSettingError() return } - } else if (!['inner', 'outer'].includes(btn.intertype)) { + } else if (!['inner', 'outer', 'system'].includes(btn.intertype)) { // 鎺ュ彛绫诲瀷閿欒 this.actionSettingError() return @@ -182,7 +188,7 @@ */ execSubmit = (data, _resolve, formdata) => { const { setting, columns, btn } = this.props - if (btn.intertype === 'inner') { + if (btn.intertype === 'inner' || btn.intertype === 'system') { // 鎵ц鏂瑰紡涓哄琛屾嫾鎺ワ紝涓旀墦寮�鏂瑰紡涓鸿〃鍗曟椂锛屼細杞负寰幆鍙戦�佽姹� // 鎵撳紑鏂瑰紡涓烘ā鎬佹锛屼娇鐢ㄥ唴閮ㄥ嚱鏁版坊鍔�(鏈夋壒閲忔坊鍔犲満鏅紝宸插幓闄�) if ( diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index ac12a98..ddd5cfc 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -180,7 +180,7 @@ } new Promise(resolve => { - if (btn.intertype === 'inner' && !btn.innerFunc) { + if (btn.intertype === 'system') { // 浣跨敤绯荤粺鏃讹紝鐩存帴浠庤〃鏍兼垨琛ㄥ崟涓�夊彇鏁版嵁 let printcell = {} printcell.printType = formdata.printType || '' diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx index 6a0b83f..2ac2e2c 100644 --- a/src/templates/calendarconfig/index.jsx +++ b/src/templates/calendarconfig/index.jsx @@ -105,6 +105,11 @@ _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : '' _config.easyCode = _config.easyCode || '' + // 鏁版嵁婧� + if (_config.setting.interType === 'inner' && !_config.setting.innerFunc) { + _config.setting.interType = 'system' + } + this.setState({ openEdition: menu.open_edition || '', optionLibs: optionLibs, @@ -682,7 +687,7 @@ calvaild = false } - if (((config.setting.interType === 'inner' && !config.setting.innerFunc) || config.setting.interType === 'system') && config.setting.default !== 'false' && !config.setting.dataresource) { + if (config.setting.interType === 'system' && config.setting.default !== 'false' && !config.setting.dataresource) { return '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�' } else if (config.columns.length === 0) { return '鑿滃崟灏氭湭璁剧疆鏁版嵁瀛楁锛屼笉鍙惎鐢紒' diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 2793a2e..c3f085b 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -9,6 +9,7 @@ import Api from '@/api' import Utils from '@/utils/utils.js' +import UtilsUpdate from '@/utils/utils-update.js' import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' @@ -107,83 +108,8 @@ _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : '' _config.easyCode = _config.easyCode || '' - if (!_config.version || _config.version < '1.0') { - // 閰嶇疆榛樿鍊硷紝鍏煎 - _config.version = '1.0' - _config.Template = 'CommonTable' - - if (!_config.tabgroups) { - _config.tabgroups = [{ uuid: 'tabs', sublist: [] }] - } else if (typeof(_config.tabgroups[0]) === 'string') { - let _tabgroups = [] - _config.tabgroups.forEach(groupId => { - let _group = { - uuid: groupId, - sublist: fromJS(_config[groupId]).toJS() - } - - delete _config[groupId] - - _tabgroups.push(_group) - }) - - _config.tabgroups = _tabgroups - } - - // 鍏煎鍥捐〃 - if (!_config.charts) { - _config.expand = false - _config.charts = [{ - uuid: Utils.getuuid(), - label: '', - title: '', - chartType: 'table', - icon: 'table', - Hide: 'false', - blacklist: [] - }] - } else { - _config.charts.forEach(card => { - if (card.chartType === 'card') { - card.details = card.details.map(_cell => { - if (!_cell.fontSize) { - _cell.fontSize = 14 - } - if (!_cell.width) { - _cell.width = 100 - } else if (_cell.width === 'helf') { - _cell.width = 50 - } else if (_cell.width === 'third') { - _cell.width = 33 - } - - if (_cell.bold === 'true') { - _cell.fontWeight = 'normal' - } - - if (!_cell.height) { - _cell.height = 1 - } - - return _cell - }) - - if (card.widthType === 'ratio' && card.avatar && card.avatar.widthType !== 'ratio') { - card.avatar.widthType = 'ratio' - card.avatar.width = 32 - } - } - }) - } - - // // 鍏煎鎺ュ彛绫诲瀷 - // _config.action = _config.action.map(item => { - // if (item.intertype === 'inner' && !item.innerFunc) { - // item.intertype = 'system' - // } - // return item - // }) - } + // 鐗堟湰鍏煎 + _config = UtilsUpdate.updateCommonTable(_config) let _oriActions = [] if (_config.type === 'user') { diff --git a/src/templates/formtabconfig/actionform/index.jsx b/src/templates/formtabconfig/actionform/index.jsx index cebb652..8ff11bf 100644 --- a/src/templates/formtabconfig/actionform/index.jsx +++ b/src/templates/formtabconfig/actionform/index.jsx @@ -408,13 +408,13 @@ if (values.innerFunc === '' && values.sql === '') { notification.warning({ top: 92, - message: this.props.dict['header.form.actionhelp.tablename'], + message: '浣跨敤绯荤粺鍑芥暟鏃讹紝璇峰~鍐欒〃鍚嶏紝浣跨敤鑷畾涔夊嚱鏁版椂锛屽彲蹇界暐銆�', duration: 5 }) } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') { notification.warning({ top: 92, - message: this.props.dict['header.form.actionhelp.sqlType'], + message: '浣跨敤绯荤粺鍑芥暟鏃讹紝璇烽�夋嫨鎿嶄綔绫诲瀷锛屼娇鐢ㄨ嚜瀹氫箟鍑芥暟鏃讹紝鍙拷鐣ャ��', duration: 5 }) } else { diff --git a/src/templates/formtabconfig/settingform/index.jsx b/src/templates/formtabconfig/settingform/index.jsx index f28b73f..a807e3d 100644 --- a/src/templates/formtabconfig/settingform/index.jsx +++ b/src/templates/formtabconfig/settingform/index.jsx @@ -231,8 +231,8 @@ initialValue: interType })( <Radio.Group onChange={this.onChange}> - <Radio value="inner">{dict['header.form.interface.inner']}</Radio> - <Radio value="outer">{dict['header.form.interface.outer']}</Radio> + <Radio value="inner">{dict['model.interface.inner']}</Radio> + <Radio value="outer">{dict['model.interface.outer']}</Radio> </Radio.Group> )} </Form.Item> diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index e159cec..aa499a5 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' +import { fromJS } from 'immutable' import { Form, Row, Col, Input, Select, Icon, Radio, notification, Tooltip, InputNumber, Cascader } from 'antd' import { btnIcons, btnClasses, formRule } from '@/utils/option.js' @@ -9,6 +10,17 @@ import './index.scss' const { TextArea } = Input +const actionTypeOptions = { + pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'], + prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'], + exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError'], + excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError'], + excelOut: ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'], + popview: ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'], + tab: ['label', 'Ot', 'OpenType', 'tabTemplate', 'icon', 'class', 'position'], + innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'], + funcbutton: ['label', 'OpenType', 'funcType', 'icon', 'class'] +} class MainSearch extends Component { static propTpyes = { @@ -40,9 +52,6 @@ text: this.props.dict['header.form.requiredOnce'] }], insertUpdateOptions: [{ - value: '', - text: this.props.dict['model.empty'] - }, { value: 'insert', text: this.props.dict['header.form.action.insert'] }, { @@ -53,9 +62,6 @@ text: this.props.dict['header.form.action.audit'] }], deleteOptions: [{ - value: '', - text: this.props.dict['model.empty'] - }, { value: 'LogicDelete', text: this.props.dict['header.form.action.LogicDelete'] }, { @@ -72,11 +78,13 @@ const { card } = this.props let _menulist = this.props.formlist.filter(form => form.key === 'linkmenu')[0] || '' - let _opentype = card.OpenType // 鎵撳紑鏂瑰紡 - let _tabType = card.tabType || 'SubTable' // 鎸夐挳涓哄脊绐楋紙鏍囩锛夋椂锛屾爣绛剧殑绫诲瀷 - let _options = null // 閫夐」鍒楄〃 + let _opentype = card.OpenType // 鎵撳紑鏂瑰紡 + let _tabType = card.tabType || 'SubTable' // 鎸夐挳涓哄脊绐楋紙鏍囩锛夋椂锛屾爣绛剧殑绫诲瀷 + let _intertype = card.intertype || 'system' // 鎺ュ彛绫诲瀷 + let _funcType = card.funcType || '' // 鍔熻兘鎸夐挳榛樿绫诲瀷 + let _tabTemplate = card.tabTemplate // 鎸夐挳涓烘爣绛鹃〉鏃讹紝鏍囩绫诲瀷锛氫笁绾ц彍鍗曟垨琛ㄥ崟鏍囩椤� - if (card.execMode) { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡 + if (card.execMode) { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡 _opentype = 'funcbutton' } else if (_opentype === 'outerpage') { card.pageTemplate = 'custom' @@ -84,56 +92,14 @@ } let _tabs = this.props.tabs.filter(tab => tab.type === _tabType) - - if (_opentype === 'innerpage') { // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴) - _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] - if (card.pageTemplate === 'custom') { - _options.push('url', 'joint') - } - } else if (_opentype === 'blank' || _opentype === 'tab') { // 鏂版爣绛炬垨褰撳墠椤甸潰鏇挎崲 - _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabTemplate'] - if (card.tabTemplate === 'ThdMenu') { - _options.push('linkmenu') - } - } else if (_opentype === 'popview') { // 妯℃�佹鏍囩椤� - _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabType', 'linkTab', 'popClose'] - } else if (_opentype === 'excelOut') { // 瀵煎叆瀵煎嚭 - if (card.intertype === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] - } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] - } - } else if (_opentype === 'excelIn') { // 瀵煎叆瀵煎嚭 - if (card.intertype === 'outer') { - _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] - } else { - _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] - } - } else if (_opentype === 'funcbutton') { - if (!card.funcType) { - _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] - } else if (card.funcType === 'changeuser') { - _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] - } else if (card.funcType === 'print') { - if (card.intertype === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } else { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } - } - } else { - if (card.intertype === 'outer') { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } else { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] - } - } + let _options = this.getOptions(_opentype, _intertype, _funcType, card.pageTemplate, _tabTemplate) + this.setState({ openType: _opentype, menulist: _menulist.options || [], - interType: card.intertype || 'inner', + interType: _intertype, position: card.position || 'toolbar', - funcType: card.funcType, + funcType: _funcType, formlist: this.props.formlist.map(item => { if (item.key === 'class') { item.options = btnClasses @@ -186,6 +152,52 @@ } } + getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _tabTemplate) => { + let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 閫夐」鍒楄〃 + + if (_opentype === 'innerpage') { // 鏂伴〉闈紝鍙�夋ā鏉�(鑷畾涔夋椂锛屽彲濉叆澶栭儴閾炬帴) + if (_pageTemplate === 'custom') { + _options.push('url', 'joint') + } + } else if (_opentype === 'blank' || _opentype === 'tab') { // 鏂版爣绛炬垨褰撳墠椤甸潰鏇挎崲 + if (_tabTemplate === 'ThdMenu') { + _options.push('linkmenu') + } + } else if (_opentype === 'excelOut') { // 瀵煎叆瀵煎嚭 + if (_intertype === 'outer') { + _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc') + } else if (_intertype === 'inner') { + _options.push('innerFunc') + } + } else if (_opentype === 'excelIn') { // 瀵煎叆瀵煎嚭 + if (_intertype === 'outer') { + _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') + } else if (_intertype === 'inner') { + _options.push('innerFunc') + } + } else if (_opentype === 'funcbutton') { + if (_funcType === 'print') { + if (_intertype === 'outer') { + _options.push('execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'execSuccess', 'execError') + } else if (_intertype === 'inner') { + _options.push('execMode', 'intertype', 'innerFunc', 'Ot', 'execSuccess', 'execError') + } else if (_intertype === 'system') { + _options.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError') + } + } + } else if (_opentype !== 'popview') { // 鎵撳紑鏂瑰紡涓嶆槸寮圭獥椤甸潰鏃� + if (_intertype === 'outer') { + _options.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') + } else if (_intertype === 'inner') { + _options.push('innerFunc') + } else { + _options.push('sql', 'sqlType') + } + } + + return _options + } + /** * @description 涓嬫媺鍒囨崲 * 1銆佹墦寮�鏂瑰紡鍒囨崲锛岄噸缃彲瑙佽〃鍗曞拰琛ㄥ崟鍊� @@ -196,53 +208,8 @@ const { card } = this.props if (key === 'OpenType') { - let _options = null - if (value === 'innerpage') { - _options = ['label', 'Ot', 'OpenType', 'pageTemplate', 'icon', 'class', 'position'] - if (card.pageTemplate === 'custom') { - _options.push('url', 'joint') - } - } else if (value === 'blank' || value === 'tab') { - _options = ['label', 'Ot', 'OpenType', 'icon', 'class', 'position', 'tabTemplate'] - if (card.tabTemplate === 'ThdMenu') { - _options.push('linkmenu') - } - } else if (value === 'popview') { - _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', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] - } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] - } - } else if (value === 'excelIn') { - if (this.state.interType === 'outer') { - _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] - } else { - _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] - } - } else if (value === 'funcbutton') { - if (!this.state.funcType) { - _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] - } else if (this.state.funcType === 'changeuser') { - _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] - } else if (this.state.funcType === 'print') { - if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } else { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } - } - } else { - if (this.state.interType === 'inner') { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] - } else { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc'] - } - } - + let _options = this.getOptions(value, this.state.interType, this.state.funcType, card.pageTemplate, card.tabTemplate) let _fieldval = {} - let _formlist = this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -332,21 +299,11 @@ this.props.form.setFieldsValue(_fieldval) }) } else if (key === 'funcType') { - let _options = null - if (!value) { - _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] - } else if (value === 'changeuser') { - _options = ['label', 'OpenType', 'funcType', 'icon', 'class'] - } else if (value === 'print') { - if (this.state.interType === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } else { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } - } + let _options = this.getOptions('funcbutton', this.state.interType, value, card.pageTemplate, card.tabTemplate) let _fieldval = {} this.setState({ + funcType: value, formlist: this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -442,43 +399,20 @@ } onChange = (e, key) => { - const { openType } = this.state + const { openType, funcType } = this.state let value = e.target.value if (key === 'intertype') { - let _options = null - if (openType === 'excelOut') { - if (value === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] - } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'pagination', 'search'] - } - } else if (openType === 'excelIn') { - if (value === 'outer') { - _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] - } else { - _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError'] - } - } else if (openType === 'funcbutton') { - if (value === 'outer') { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } else { - _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError'] - } - } else { - if (value === 'inner') { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] - } else { - _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc'] - } - } + let _options = this.getOptions(openType, value, funcType, '', '') this.setState({ interType: value, formlist: this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) - if (item.key === 'interface') { + if (item.key === 'innerFunc') { + item.required = value === 'inner' + } else if (item.key === 'interface') { item.readonly = false } else if (item.key === 'sysInterface') { item.initVal = 'false' @@ -756,15 +690,13 @@ 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: 5 - }) - return - } + if (values.intertype === 'system' && setting.interType !== 'system') { // 瀵煎嚭excel闇�浣跨敤鏌ヨ鏁版嵁婧� + notification.warning({ + top: 92, + message: '琛ㄦ牸鏁版嵁鏌ヨ鏈娇鐢ㄧ郴缁熷嚱鏁帮紝瀵煎嚭Excel涓嶅彲浣跨敤绯荤粺鍑芥暟锛�', + duration: 5 + }) + return } values.position = 'toolbar' @@ -803,22 +735,7 @@ }) values.linkThdMenu = linkThdMenu } - - if (values.innerFunc === '' && values.sql === '') { - notification.warning({ - top: 92, - message: this.props.dict['header.form.actionhelp.tablename'], - duration: 5 - }) - } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') { - notification.warning({ - top: 92, - message: this.props.dict['header.form.actionhelp.sqlType'], - duration: 5 - }) - } else { - resolve(values) - } + resolve(values) } else { reject(err) } diff --git a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx index a30105b..e5edf64 100644 --- a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx @@ -112,7 +112,7 @@ newcard.tabType = 'SubTable' newcard.icon = '' newcard.class = 'default' - newcard.intertype = 'inner' + newcard.intertype = 'system' newcard.method = 'POST' newcard.position = 'toolbar' newcard.execSuccess = 'grid' diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index 5a44338..803a073 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -761,7 +761,7 @@ })(<InputNumber min={0} max={100} precision={0} />)} </Form.Item> </Col> - {card.intertype === 'inner' && !card.innerFunc ? <Col span={8}> + {card.intertype === 'system' ? <Col span={8}> <Form.Item label={'榛樿sql'}> <Radio.Group value={verify.default} onChange={this.onOptionChange}> <Radio value="true">鎵ц</Radio> @@ -799,7 +799,7 @@ pagination={false} /> </TabPane> - {card.intertype === 'inner' && !card.innerFunc ? <TabPane tab={ + {card.intertype === 'system' ? <TabPane tab={ <span> 鍞竴鎬ч獙璇� {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null} @@ -820,7 +820,7 @@ pagination={false} /> </TabPane> : null} - {card.intertype === 'inner' && !card.innerFunc ? <TabPane tab={ + {card.intertype === 'system' ? <TabPane tab={ <span> 鑷畾涔夎剼鏈� {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index 721fbcf..d463ef7 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -88,12 +88,12 @@ }) } - if (card.intertype !== 'inner' || card.innerFunc) { + if (card.intertype !== 'system') { _verify.enable = 'false' } let defaultscript = '' - if (!_verify.script && card.intertype === 'inner' && !card.innerFunc) { + if (!_verify.script && card.intertype === 'system') { let search = this.formatSearch(config.search) search = Utils.joinMainSearchkey(search) search = search ? 'where ' + search : '' @@ -471,7 +471,7 @@ pagination={false} /> </TabPane> - {card.intertype === 'inner' && !card.innerFunc ? <TabPane tab={ + {card.intertype === 'system' ? <TabPane tab={ <span> 鑷畾涔夎剼鏈� {verify.enable === 'true' ? <span className="count-tip">1</span> : null} diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/customscript/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/customscript/index.jsx index 996e2ff..5376305 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/customscript/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/customscript/index.jsx @@ -131,6 +131,10 @@ sql: '' }) this.props.scriptSubmit(values) + }, () => { + this.setState({ + loading: false + }) }) } }) diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx index 69fb0fd..ee48c94 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx @@ -312,29 +312,62 @@ } changeTab = (val) => { - const { activeKey } = this.state + const { activeKey, setting } = this.state this.setState({loading: true}) if (activeKey === 'setting') { this.settingForm.handleConfirm().then(res => { + if (res.interType !== 'system' && val === 'scripts') { + notification.warning({ + top: 92, + message: '浣跨敤绯荤粺鎺ュ彛鏃讹紝鎵嶅彲浠ヨ缃嚜瀹氫箟鑴氭湰锛�', + duration: 5 + }) + this.setState({loading: false}) + return + } + this.setState({ setting: res }, () => { - this.sqlverify(() => { // 楠岃瘉鎴愬姛 + if (res.interType === 'system') { // 绯荤粺鎺ュ彛锛宻ql楠岃瘉 + this.sqlverify(() => { // 楠岃瘉鎴愬姛 + this.setState({ + activeKey: val, + loading: false + }) + }, () => { // 楠岃瘉澶辫触 + this.setState({ + loading: false + }) + }, activeKey) + } else { this.setState({ activeKey: val, loading: false }) - }, () => { // 楠岃瘉澶辫触 - this.setState({ - loading: false - }) - }, true) + } }) }, () => { this.setState({loading: false}) }) } else if (activeKey === 'columns') { + if (setting.interType !== 'system' && val === 'scripts') { + notification.warning({ + top: 92, + message: '浣跨敤绯荤粺鎺ュ彛鏃讹紝鎵嶅彲浠ヨ缃嚜瀹氫箟鑴氭湰锛�', + duration: 5 + }) + this.setState({loading: false}) + return + } else if (setting.interType !== 'system') { + this.setState({ + activeKey: val, + loading: false + }) + return + } + this.sqlverify(() => { // 楠岃瘉鎴愬姛 this.setState({ activeKey: val, @@ -344,7 +377,7 @@ this.setState({ loading: false }) - }, true) + }, activeKey) } else if (activeKey === 'scripts') { let _loading = false if (this.scriptsForm && this.scriptsForm.state.editItem) { @@ -374,7 +407,7 @@ this.setState({ loading: false }) - }, true) + }, activeKey) } } @@ -387,13 +420,13 @@ this.setState({ setting: res }, () => { - this.sqlverify(() => { resolve({setting: res, columns, scripts }) }, reject, false) + this.sqlverify(() => { resolve({setting: res, columns, scripts }) }, reject, 'submit') }) }, () => { reject() }) } else if (activeKey === 'columns') { - this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, false) + this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, 'submit') } else if (activeKey === 'scripts') { let _loading = false if (this.scriptsForm && this.scriptsForm.state.editItem) { @@ -412,14 +445,14 @@ return } - this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, false) + this.sqlverify(() => { resolve({setting, columns, scripts }) }, reject, 'submit') } }) } - sqlverify = (resolve, reject, change = false, testScripts) => { + sqlverify = (resolve, reject, type, testScripts) => { const { searches } = this.props - const { columns, setting, scripts, activeKey } = this.state + const { columns, setting, scripts } = this.state let _scripts = [] if (testScripts) { @@ -428,7 +461,7 @@ _scripts = scripts.filter(item => item.status !== 'false') } - if (!change && setting.interType === 'system' && !setting.innerFunc && setting.execute === 'false' && _scripts.length === 0) { + if (type === 'submit' && setting.interType === 'system' && setting.execute === 'false' && _scripts.length === 0) { notification.warning({ top: 92, message: '涓嶆墽琛岄粯璁ql鏃讹紝璇锋坊鍔犺嚜瀹氫箟鑴氭湰锛�', @@ -439,11 +472,11 @@ } // 涓嶄娇鐢ㄩ粯璁ql鍒囨崲 - if (change && activeKey === 'setting' && setting.interType === 'system' && setting.execute === 'false') { + if (type === 'setting' && setting.interType === 'system' && setting.execute === 'false') { resolve() - } else if (change && activeKey === 'scripts' && _scripts.length === 0) { + } else if (type === 'scripts' && _scripts.length === 0) { resolve() - } else if ((setting.interType === 'system' && setting.execute !== 'false') || _scripts.length > 0) { + } else if (setting.interType === 'system' && (setting.execute !== 'false' || _scripts.length > 0)) { let param = { func: 's_debug_sql', LText: SettingUtils.getDebugSql(setting, _scripts, columns, searches) diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx index ef1f4cc..a391de7 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx @@ -33,7 +33,7 @@ if (values.interType === 'system' && values.execute !== 'false' && !values.dataresource) { notification.warning({ top: 92, - message: '璇峰~鍐欏唴閮ㄥ嚱鏁版垨鏁版嵁婧愶紒', + message: '璇峰~鍐欐暟鎹簮锛�', duration: 5 }) reject() @@ -147,6 +147,9 @@ let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') rules.push({ + required: true, + message: this.props.dict['form.required.input'] + '鍐呴儴鍑芥暟!' + }, { pattern: _patten, message: formRule.func.innerMessage }) @@ -164,7 +167,7 @@ { required: true, message: this.props.dict['form.required.input'] + '琛ㄥ悕!' - }, + } ] })(<Input placeholder={''} autoComplete="off" />)} </Form.Item> diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index 661b2c0..50ca2a2 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -96,10 +96,6 @@ _setting.sysInterface = _setting.sysInterface || 'false' // 鏄惁涓虹郴缁熸帴鍙� _setting.interface = _setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (_setting.interface || '') - if (_setting.interType === 'inner' && !_setting.innerFunc) { // 淇敼宸叉湁鏁版嵁 - _setting.interType = 'system' - } - // 鏄剧ず鍒楀瓧娈碉紝鐢ㄤ簬鏌ヨ let columns = [] let arr_field = [] diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 8c5fe1c..a63de25 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -11,6 +11,7 @@ import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' import Utils from '@/utils/utils.js' +import UtilsUpdate from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' import SearchComponent from '@/templates/sharecomponent/searchcomponent' @@ -123,56 +124,8 @@ let _activeKey = editSubTab ? editSubTab.activeKey : editTab.activeKey - if (!_config.version || _config.version < '1.0') { - // 閰嶇疆榛樿鍊硷紝鍏煎 - _config.version = '1.0' - - // 鍏煎鍥捐〃 - if (!_config.charts) { - _config.expand = false - _config.charts = [{ - uuid: Utils.getuuid(), - label: '', - title: '', - chartType: 'table', - icon: 'table', - Hide: 'false', - blacklist: [] - }] - } else { - _config.charts.forEach(card => { - if (card.chartType === 'card') { - card.details = card.details.map(_cell => { - if (!_cell.fontSize) { - _cell.fontSize = 14 - } - if (!_cell.width) { - _cell.width = 100 - } else if (_cell.width === 'helf') { - _cell.width = 50 - } else if (_cell.width === 'third') { - _cell.width = 33 - } - - if (_cell.bold === 'true') { - _cell.fontWeight = 'normal' - } - - if (!_cell.height) { - _cell.height = 1 - } - - return _cell - }) - - if (card.widthType === 'ratio' && card.avatar && card.avatar.widthType !== 'ratio') { - card.avatar.widthType = 'ratio' - card.avatar.width = 32 - } - } - }) - } - } + // 鐗堟湰鍏煎 + _config = UtilsUpdate.updateSubTable(_config) this.setState({ openEdition: editSubTab ? (editSubTab.open_edition || '') : (editTab.open_edition || ''), @@ -349,7 +302,7 @@ type: 'view', subtype: 'view', uuid: _config.uuid, - intertype: _config.setting.interType || 'inner', + intertype: _config.setting.interType || 'system', interface: _config.setting.interface || '', tableName: _config.setting.tableName || '', innerFunc: _config.setting.innerFunc || '', @@ -359,7 +312,7 @@ _config.action.forEach(item => { let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') - if (item.OpenType === 'excelOut' && item.intertype === 'inner' && !item.innerFunc) { + if (item.OpenType === 'excelOut' && item.intertype === 'system') { tablename = _config.setting.tableName || '' } diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index d3bf4f2..6eec582 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -51,8 +51,8 @@ required: false, readonly: false, options: [ - { value: 'inner', text: Formdict['header.form.interface.inner'] }, - { value: 'outer', text: Formdict['header.form.interface.outer'] } + { value: 'inner', text: Formdict['model.interface.inner'] }, + { value: 'outer', text: Formdict['model.interface.outer'] } ] }, { @@ -699,14 +699,17 @@ type: 'radio', key: 'intertype', label: Formdict['header.form.intertype'], - initVal: card.intertype || 'inner', + initVal: card.intertype || 'system', required: true, options: [{ + value: 'system', + text: Formdict['model.interface.system'] + }, { value: 'inner', - text: Formdict['header.form.interface.inner'] + text: Formdict['model.interface.inner'] }, { value: 'outer', - text: Formdict['header.form.interface.outer'] + text: Formdict['model.interface.outer'] }] }, { @@ -714,9 +717,15 @@ key: 'sqlType', label: Formdict['header.form.action.type'], initVal: card.sqlType || '', - tooltip: Formdict['header.form.actionhelp.sqlType'], - required: false, + required: true, options: [] + }, + { + type: 'text', + key: 'sql', + label: Formdict['model.form.tablename'], + initVal: card.sql || config.setting.tableName || '', + required: true }, { type: 'text', @@ -728,21 +737,13 @@ }, { type: 'text', - key: 'sql', - label: Formdict['model.form.tablename'], - initVal: card.sql || config.setting.tableName || '', - tooltip: Formdict['header.form.actionhelp.tablename'], - required: false - }, - { - type: 'text', key: 'innerFunc', label: Formdict['header.form.innerFunc'], initVal: card.innerFunc || '', tooltip: functip, fields: permFuncField, tooltipClass: 'middle', - required: false, + required: card.intertype === 'inner', readonly: false }, { diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index cd682da..134a5ce 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -1595,14 +1595,9 @@ } } - let display = false - if (card.intertype === 'inner' && !card.innerFunc) { - display = true - } - return ( <div id="verify-card-box-tab"> - {display ? <Tabs defaultActiveKey="1" className="verify-card-box"> + {card.intertype === 'system' ? <Tabs defaultActiveKey="1" className="verify-card-box"> <TabPane tab="鍩虹楠岃瘉" key="1"> <Form {...formItemLayout}> <Row gutter={24}> @@ -1858,7 +1853,7 @@ </Form> </TabPane> </Tabs> : null} - {!display ? <Tabs defaultActiveKey="7" className="verify-card-box"> + {!card.intertype !== 'system' ? <Tabs defaultActiveKey="7" className="verify-card-box"> <TabPane tab="淇℃伅鎻愮ず" key="7"> <Form {...formItemLayout}> <Row gutter={24}> diff --git a/src/utils/utils-update.js b/src/utils/utils-update.js new file mode 100644 index 0000000..ba77678 --- /dev/null +++ b/src/utils/utils-update.js @@ -0,0 +1,155 @@ +import { fromJS } from 'immutable' +import Utils from './utils.js' + +export default class UpdateUtils { + /** + * @description 鍗囩骇涓昏〃淇℃伅 + * @param {Object} config 椤甸潰閰嶇疆淇℃伅 + * @return {Object} config + */ + static updateCommonTable (config) { + if (!config.version || config.version < '1.0') { + // 鍏煎鏍囩 + if (!config.tabgroups) { + config.tabgroups = [{ uuid: 'tabs', sublist: [] }] + } else if (typeof(config.tabgroups[0]) === 'string') { + let _tabgroups = [] + config.tabgroups.forEach(groupId => { + let _group = { + uuid: groupId, + sublist: fromJS(config[groupId]).toJS() + } + + delete config[groupId] + + _tabgroups.push(_group) + }) + + config.tabgroups = _tabgroups + } + + // 鍏煎鍥捐〃 + if (!config.charts) { + config.expand = true + config.charts = [{ uuid: Utils.getuuid(), label: '', title: '', chartType: 'table', icon: 'table', Hide: 'false', blacklist: [] }] + } else { + config.charts.forEach(card => { + if (card.chartType === 'card') { + card.details = card.details.map(_cell => { + _cell.fontSize = _cell.fontSize || 14 + if (!_cell.width) { + _cell.width = 100 + } else if (_cell.width === 'helf') { + _cell.width = 50 + } else if (_cell.width === 'third') { + _cell.width = 33 + } + if (!_cell.fontWeight && _cell.bold === 'true') { + _cell.fontWeight = 'normal' + } + _cell.height = _cell.height || 1 + + return _cell + }) + + if (card.widthType === 'ratio' && card.avatar && card.avatar.widthType !== 'ratio') { + card.avatar.widthType = 'ratio' + card.avatar.width = 32 + } + } + }) + } + } + + if (config.version < '1.1') { + if (config.setting.interType === 'inner' && !config.setting.innerFunc) { + config.setting.interType = 'system' + } + // 鍏煎鎺ュ彛绫诲瀷 + config.action = config.action.map(item => { + if (item.intertype === 'inner' && !item.innerFunc) { + item.intertype = 'system' + } + return item + }) + } + + config.version = '1.1' + config.Template = 'CommonTable' + + return config + } + + /** + * @description 鍗囩骇瀛愯〃淇℃伅 + * @param {Object} config 椤甸潰閰嶇疆淇℃伅 + * @return {Object} config + */ + static updateSubTable (config) { + if (!config.version || config.version < '1.0') { + // 鍏煎鍥捐〃 + if (!config.charts) { + config.expand = false + config.charts = [{ + uuid: Utils.getuuid(), + label: '', + title: '', + chartType: 'table', + icon: 'table', + Hide: 'false', + blacklist: [] + }] + } else { + config.charts.forEach(card => { + if (card.chartType === 'card') { + card.details = card.details.map(_cell => { + if (!_cell.fontSize) { + _cell.fontSize = 14 + } + if (!_cell.width) { + _cell.width = 100 + } else if (_cell.width === 'helf') { + _cell.width = 50 + } else if (_cell.width === 'third') { + _cell.width = 33 + } + + if (_cell.bold === 'true') { + _cell.fontWeight = 'normal' + } + + if (!_cell.height) { + _cell.height = 1 + } + + return _cell + }) + + if (card.widthType === 'ratio' && card.avatar && card.avatar.widthType !== 'ratio') { + card.avatar.widthType = 'ratio' + card.avatar.width = 32 + } + } + }) + } + } + + if (config.version < '1.1') { + if (config.setting.interType === 'inner' && !config.setting.innerFunc) { + config.setting.interType = 'system' + } + // 鍏煎鎺ュ彛绫诲瀷 + config.action = config.action.map(item => { + if (item.intertype === 'inner' && !item.innerFunc) { + item.intertype = 'system' + } + return item + }) + } + + config.version = '1.1' + config.Template = 'SubTable' + + return config + } +} \ No newline at end of file diff --git a/src/utils/utils.js b/src/utils/utils.js index 497baee..c1e26a8 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -849,7 +849,7 @@ let _sqlInsert = '' let _sqlBottom = '' - if (item.intertype === 'inner' && !item.innerFunc) { + if (item.intertype === 'system') { let _uniquesql = '' if (btn.uniques && btn.uniques.length > 0) { btn.uniques.forEach(unique => { -- Gitblit v1.8.0