From 176c6e1da22e96a1110fa91f8fc8eb8ad2881e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 08 八月 2022 18:13:37 +0800 Subject: [PATCH] 2022-08-08 --- src/components/normalform/modalform/index.jsx | 33 ++++-- src/mob/components/tabs/antv-tabs/index.jsx | 1 src/mob/components/tabs/antv-tabs/options.jsx | 23 ++++ src/templates/zshare/formconfig.jsx | 2 src/menu/components/share/actioncomponent/formconfig.jsx | 28 ++++- src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 16 ++ src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 2 src/menu/components/form/formaction/actionform/index.jsx | 4 src/menu/components/form/formaction/actionform/index.scss | 5 + src/menu/components/tabs/antv-tabs/options.jsx | 26 ++++ src/menu/components/share/actioncomponent/actionform/index.jsx | 2 src/tabviews/custom/index.jsx | 72 ++++++++++++- src/tabviews/zshare/actionList/normalbutton/index.jsx | 9 + src/views/mobdesign/index.jsx | 34 +++++- src/menu/components/tabs/antv-tabs/index.jsx | 1 15 files changed, 210 insertions(+), 48 deletions(-) diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx index 8bc59c5..ce8b71d 100644 --- a/src/components/normalform/modalform/index.jsx +++ b/src/components/normalform/modalform/index.jsx @@ -275,16 +275,29 @@ if (!content) return - fields.push( - <Col span={item.span || 12} key={index}> - <Form.Item label={label}> - {getFieldDecorator(item.field, { - initialValue: item.initval, - rules: item.rules - })(content)} - </Form.Item> - </Col> - ) + if (item.help) { + fields.push( + <Col span={item.span || 12} key={index}> + <Form.Item label={label} help={<span style={{fontSize: '12px'}}>{item.help}</span>}> + {getFieldDecorator(item.field, { + initialValue: item.initval, + rules: item.rules + })(content)} + </Form.Item> + </Col> + ) + } else { + fields.push( + <Col span={item.span || 12} key={index}> + <Form.Item label={label}> + {getFieldDecorator(item.field, { + initialValue: item.initval, + rules: item.rules + })(content)} + </Form.Item> + </Col> + ) + } }) return fields diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index dacfdd8..306130a 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -192,7 +192,7 @@ getFields() { const { getFieldDecorator } = this.props.form - const { interType } = this.state + const { interType, callbackType } = this.state const fields = [] this.state.formlist.forEach((item, index) => { @@ -219,7 +219,7 @@ message: formRule.func.maxMessage }] } else if (item.key === 'output') { - if (interType === 'system') { + if (interType === 'system' || ((interType === 'outer' || interType === 'custom') && callbackType === 'script')) { _rules = [{ pattern: /^@[0-9a-zA-Z_]+@?$/, message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' diff --git a/src/menu/components/form/formaction/actionform/index.scss b/src/menu/components/form/formaction/actionform/index.scss index ca43400..96f3526 100644 --- a/src/menu/components/form/formaction/actionform/index.scss +++ b/src/menu/components/form/formaction/actionform/index.scss @@ -4,6 +4,11 @@ color: #1890ff; cursor: pointer; } + >.ant-row >.ant-col { + float: none; + display: inline-block; + vertical-align: top; + } .textarea { .ant-col-sm-7 { width: 14%; diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 4bcfa1c..a92b985 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -722,7 +722,7 @@ { max: formRule.func.max, message: formRule.func.maxMessage } ) } else if (item.key === 'output') { - if (this.record.intertype === 'system') { + if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) { rules = [{ pattern: /^@[0-9a-zA-Z_]+@?$/, message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index d981ba5..25baad2 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -52,15 +52,28 @@ ] let getTabs = (list) => { - return list.filter(item => { - if (item.type !== 'tabs') return false + let _list = [] + list.forEach(item => { + if (item.type !== 'tabs') return - item.children = item.children.map(cell => { - cell.children = getTabs(cell.children) - return cell + _list.push({ + value: item.uuid, + label: item.name, + children: item.subtabs.map(cell => { + let children = getTabs(cell.components) + + if (children.length === 0) { + children = null + } + return { + value: cell.uuid, + label: cell.label, + children: children + } + }) }) - return item }) + return _list } // if (type === 'editable') { @@ -74,8 +87,7 @@ // } // ] // } - - let tabs = getTabs(JSON.parse(JSON.stringify(modules))) + let tabs = getTabs(JSON.parse(JSON.stringify(window.GLOB.customMenu.components))) let pageTemps = [ { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index a6feb86..fbcfe24 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/index.jsx @@ -318,6 +318,7 @@ editab.hide = res.hide || 'false' editab.backgroundColor = res.backgroundColor editab.controlVal = res.controlVal || '' + editab.selectVal = res.selectVal || '' editab.blacklist = res.blacklist if (editab.uuid) { diff --git a/src/menu/components/tabs/antv-tabs/options.jsx b/src/menu/components/tabs/antv-tabs/options.jsx index c0430ab..bc2db9d 100644 --- a/src/menu/components/tabs/antv-tabs/options.jsx +++ b/src/menu/components/tabs/antv-tabs/options.jsx @@ -52,9 +52,16 @@ field: 'controlVal', label: '闅愯棌鏍囪', initval: tab.controlVal || '', - tooltip: '褰撶鐢ㄥ瓧娈靛�间笌闅愯棌鏍囪鐩哥瓑鏃讹紝鏍囩椤典細闅愯棌銆�', + tooltip: '褰撶鐢ㄥ瓧娈靛�间笌闅愯棌鏍囪鐩哥瓑鏃讹紝鏍囩椤典細闅愯棌銆傛敞锛氬涓�艰鐢ㄩ�楀彿鍒嗛殧銆�', required: false, - // forbid: appType === 'mob', + }, + { + type: 'text', + field: 'selectVal', + label: '閫変腑鏍囪', + initval: tab.selectVal || '', + tooltip: '褰撻�変腑瀛楁鍊间笌閫変腑鏍囪鐩哥瓑鏃讹紝鏍囩椤甸粯璁ら�変腑銆�', + required: false }, { type: 'color', @@ -96,6 +103,10 @@ let roleList = sessionStorage.getItem('sysRoles') let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, uuid) || [] + modules.push({ + value: 'preview', + label: '涓婁竴椤碉紙url鍙傛暟锛�' + }) if (roleList) { try { @@ -198,13 +209,13 @@ label: '涓婄骇缁勪欢', initval: setting.supModule || [], tooltip: '鏍囩缁勫彲浠ラ�夋嫨涓婄骇缁勪欢锛屽~鍏ョ鐢ㄥ瓧娈碉紝鐢ㄤ簬鎺у埗鏍囩闅愯棌銆�', + help: '鐢ㄤ簬鎺у埗鏍囩椤甸殣钘忋��', required: false, allowClear: true, options: modules, controlFields: [ {field: 'controlField', notNull: true}, ], - // forbid: appType === 'mob', }, { type: 'text', @@ -213,7 +224,14 @@ initval: setting.controlField || '', tooltip: '鐢ㄤ簬鎺у埗鏍囩闅愯棌鐨勫瓧娈碉紝鍦ㄦ爣绛句腑濉叆闅愯棌鏍囪銆�', required: true, - // forbid: appType === 'mob', + }, + { + type: 'text', + field: 'selectField', + label: '閫変腑瀛楁', + initval: setting.selectField || '', + tooltip: '鐢ㄤ簬鎺у埗鏍囩椤靛垵濮嬪寲閫変腑锛屽湪鏍囩涓~鍏ラ�変腑鏍囪锛屾敞锛氭暟鎹簮浜巙rl鍙傛暟銆�', + required: false }, { type: 'color', diff --git a/src/mob/components/tabs/antv-tabs/index.jsx b/src/mob/components/tabs/antv-tabs/index.jsx index 108b32a..1ddf66c 100644 --- a/src/mob/components/tabs/antv-tabs/index.jsx +++ b/src/mob/components/tabs/antv-tabs/index.jsx @@ -341,6 +341,7 @@ editab.hide = res.hide || 'false' editab.backgroundColor = res.backgroundColor editab.controlVal = res.controlVal || '' + editab.selectVal = res.selectVal || '' editab.blacklist = res.blacklist if (editab.uuid) { diff --git a/src/mob/components/tabs/antv-tabs/options.jsx b/src/mob/components/tabs/antv-tabs/options.jsx index 74643d9..24271c3 100644 --- a/src/mob/components/tabs/antv-tabs/options.jsx +++ b/src/mob/components/tabs/antv-tabs/options.jsx @@ -52,7 +52,15 @@ field: 'controlVal', label: '闅愯棌鏍囪', initval: tab.controlVal || '', - tooltip: '褰撶鐢ㄥ瓧娈靛�间笌闅愯棌鏍囪鐩哥瓑鏃讹紝鏍囩椤典細闅愯棌銆�', + tooltip: '褰撶鐢ㄥ瓧娈靛�间笌闅愯棌鏍囪鐩哥瓑鏃讹紝鏍囩椤典細闅愯棌銆傛敞锛氬涓�艰鐢ㄩ�楀彿鍒嗛殧銆�', + required: false + }, + { + type: 'text', + field: 'selectVal', + label: '閫変腑鏍囪', + initval: tab.selectVal || '', + tooltip: '褰撻�変腑瀛楁鍊间笌閫変腑鏍囪鐩哥瓑鏃讹紝鏍囩椤甸粯璁ら�変腑銆�', required: false }, { @@ -92,6 +100,10 @@ */ export function getTabsSetForm(setting, uuid) { let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, uuid) || [] + modules.push({ + value: 'preview', + label: '涓婁竴椤碉紙url鍙傛暟锛�' + }) const tabForm = [ { @@ -146,6 +158,7 @@ label: '涓婄骇缁勪欢', initval: setting.supModule || [], tooltip: '鏍囩缁勫彲浠ラ�夋嫨涓婄骇缁勪欢锛屽~鍏ョ鐢ㄥ瓧娈碉紝鐢ㄤ簬鎺у埗鏍囩闅愯棌銆�', + help: '鐢ㄤ簬鎺у埗鏍囩椤甸殣钘忋��', required: false, allowClear: true, options: modules, @@ -162,6 +175,14 @@ required: true }, { + type: 'text', + field: 'selectField', + label: '閫変腑瀛楁', + initval: setting.selectField || '', + tooltip: '鐢ㄤ簬鎺у埗鏍囩椤靛垵濮嬪寲閫変腑锛屽湪鏍囩涓~鍏ラ�変腑鏍囪锛屾敞锛氭暟鎹簮浜巙rl鍙傛暟銆�', + required: false + }, + { type: 'color', field: 'backgroundColor', label: '鑳屾櫙(鏍囬鏍�)', diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx index 064a1d0..a5159a1 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -52,8 +52,13 @@ if (config.setting.autoSwitch === 'true' && config.subtabs.length > 1 && config.setting.interval) { this.autoSwitch(config.setting.interval) } - MKEmitter.addListener('resetSelectLine', this.resetParentParam) + if (config.activeKey) { + let node = document.getElementById('tab' + config.activeKey) + node && node.click() + } + + MKEmitter.addListener('resetSelectLine', this.resetParentParam) } /** @@ -81,13 +86,18 @@ tabs: {...tabs, subtabs: []} }) } else { - let val = data[tabs.setting.controlField] === undefined ? '' : data[tabs.setting.controlField] + '' + let val = '' + Object.keys(data).forEach(key => { + if (key.toLowerCase() === tabs.setting.controlField) { + val = data[key] + } + }) this.setState({ tabs: {...tabs, subtabs: this.props.config.subtabs.filter(tab => { if (tab.controlVal === val) { return false } else if (/,/ig.test(tab.controlVal)) { - return tab.controlVal.split(',').includes(val) + return !tab.controlVal.split(',').includes(val) } return true })} diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 63a6a2c..5b729ce 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -73,7 +73,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, param } = this.props + const { permAction } = this.props let _param = { func: 'sPC_Get_LongParam', @@ -138,7 +138,9 @@ let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID let balMap = new Map() let skip = config.permission === 'false' || window.GLOB.mkHS - config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip) + let param = this.props.param || {} // url鍙傛暟 + + config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip, param) // 鑾峰彇涓绘悳绱㈡潯浠� let mainSearch = [] @@ -147,7 +149,7 @@ component.search = component.search.map(item => { item.oriInitval = item.initval - if (['text', 'select', 'link'].includes(item.type) && param && param.$searchkey === item.field) { + if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { item.initval = param.$searchval } @@ -158,7 +160,7 @@ }) let params = [] - let BID = param && param.$BID ? param.$BID : '' + let BID = param.$BID || '' let inherit = {} if (config.cacheUseful === 'true') { // 缂撳瓨缁ф壙 @@ -188,7 +190,7 @@ } if (config.urlFields) { config.urlFields.forEach(field => { - let val = `'${param ? (param[field] || '') : ''}'` + let val = `'${param[field] || ''}'` regs.push({ reg: new RegExp('@' + field + '@', 'ig'), value: val @@ -441,7 +443,7 @@ }) } - filterComponent = (components, roleId, permAction, balMap, skip) => { + filterComponent = (components, roleId, permAction, balMap, skip, urlparam) => { return components.filter(item => { if (item.style && item.style.boxShadow) { @@ -473,8 +475,58 @@ return true }) + if (item.setting.supModule) { + let pid = item.setting.supModule.pop() + item.setting.supModule = pid || '' + + if (item.setting.supModule) { + item.setting.controlField = item.setting.controlField.toLowerCase() + + if (item.setting.supModule === 'preview') { + item.setting.supModule = '' + let val = '' + Object.keys(urlparam).forEach(key => { + if (key.toLowerCase() === item.setting.controlField) { + val = urlparam[key] + } + }) + + item.subtabs = item.subtabs.filter(tab => { + if (tab.controlVal === val) { + return false + } else if (/,/ig.test(tab.controlVal)) { + return !tab.controlVal.split(',').includes(val) + } + + return true + }) + } + } + } + + if (item.setting.selectField) { + item.setting.selectField = item.setting.selectField.toLowerCase() + + let val = '' + Object.keys(urlparam).forEach(key => { + if (key.toLowerCase() === item.setting.selectField) { + val = urlparam[key] + } + }) + + let activeKey = '' + + item.subtabs.forEach(tab => { + if (!activeKey && tab.selectVal === val) { + activeKey = tab.uuid + } + }) + + item.activeKey = activeKey + } + item.subtabs = item.subtabs.map(tab => { - tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip) + tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam) return tab }) @@ -489,6 +541,8 @@ }) }) item.parentIds = supIds + + return true } else if (item.type === 'group') { if ( item.setting.blacklist && item.setting.blacklist.length > 0 && @@ -497,7 +551,9 @@ return false } - item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip) + item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam) + + return true } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { if ( item.plot.blacklist && item.plot.blacklist.length > 0 && diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 53d9a8b..d58c19e 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1394,8 +1394,13 @@ } }) - _backCustomScript += ` - aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + if (btn.output) { + _backCustomScript += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` + } else { + _backCustomScript += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + } let sql = [...lineMap.values()].map(item => (` ${item.insert} diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index b2fb7b4..0a94c8d 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -549,7 +549,7 @@ { max: formRule.func.max, message: formRule.func.maxMessage } ) } else if (item.key === 'output') { - if (this.record.intertype === 'system') { + if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) { rules = [{ pattern: /^@[0-9a-zA-Z_]+@?$/, message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index d9700d5..b29b351 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2945,7 +2945,7 @@ type: 'text', key: 'separator', label: '杩炴帴绗�', - initVal: card.separator || card.separator === undefined ? '/' : '', + initVal: card.separator === undefined ? '/' : card.separator, tooltip: '琛ㄥ崟鎻愪氦鏃朵俊鎭箣闂寸殑杩炴帴绗︺�傛敞锛氳繛鎺ョ涓虹┖鏃讹紝鍒濆鍖栨椂濉厖鍏朵粬琛ㄥ崟鏃犳晥銆�', required: false, readonly: false diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index f22b547..424b0e0 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -1625,16 +1625,16 @@ let searchSum = 0 let swipes = [] - let check = (components) => { + let check = (components, level, sign) => { components.forEach(item => { if (error) return if (item.type === 'tabs') { item.subtabs.forEach(tab => { - check(tab.components) + check(tab.components, level + 1, tab.uuid) }) return } else if (item.type === 'group') { - check(item.components) + check(item.components, level, sign) return } else if (item.type === 'navbar' && !item.wrap.MenuNo) { error = `瀵艰埅鏍忋��${item.name}銆嬫湭璁剧疆鑿滃崟鍙傛暟锛乣 @@ -1649,7 +1649,8 @@ } } if (item.wrap && item.wrap.pagestyle === 'slide' && item.pageable && item.setting.laypage !== 'false') { - swipes.push(item.name) + // swipes.push(item.name) + swipes.push({level, name: item.name, sign}) } item.errors && item.errors.forEach(err => { @@ -1659,7 +1660,7 @@ }) } - check(config.components) + check(config.components, 1, 'view') // if (!error && viewType === 'userbind' && config.components.filter(item => item.type === 'login').length === 0) { // error = '鐢ㄦ埛缁戝畾椤甸潰蹇呴』娣诲姞鐧诲綍銆�' @@ -1667,8 +1668,27 @@ if (!error && searchSum > 1) { error = '鎼滅储缁勪欢涓庡鑸爮鐨勬悳绱㈠姛鑳戒笉鍙悓鏃朵娇鐢ㄣ��' - } else if (!error && swipes.length > 1) { - error = `椤甸潰涓笉鍙悓鏃朵娇鐢ㄥ涓粦鍔ㄥ姞杞界粍浠躲�傦紙${swipes.join('銆�')}锛塦 + } else if (!error && swipes.length > 0) { + swipes.forEach(cell => { + if (!error && cell.level > 2) { + error = `涓嶅彲鍦ㄥ灞傛爣绛鹃〉涓娇鐢ㄦ粦鍔ㄥ姞杞界粍浠躲�傦紙${cell.name}锛塦 + } + }) + if (!error) { + let levels = swipes.map(s => s.level) + levels = Array.from(new Set(levels)) + if (levels.length > 1) { + error = `涓嶅彲鍦ㄩ〉闈笌鏍囩椤典腑鍚屾椂浣跨敤婊戝姩鍔犺浇缁勪欢銆傦紙${swipes.map(s => s.name).join('銆�')}锛塦 + } + } + + if (!error) { + let signs = swipes.map(s => s.sign) + signs = Array.from(new Set(signs)) + if (signs.length !== swipes.length) { + error = `椤甸潰涓紙鎴栧悓涓�鏍囩椤典腑锛変笉鍙悓鏃朵娇鐢ㄥ涓粦鍔ㄥ姞杞界粍浠躲�傦紙${swipes.map(s => s.name).join('銆�')}锛塦 + } + } } if (show && error) { -- Gitblit v1.8.0