From f2f059007551e01399f4df1afc82ec0abc489a43 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 08 十一月 2023 21:44:19 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/components/chart/antv-bar/chartcompile/index.jsx | 4 src/menu/components/timeline/normal-timeline/options.jsx | 13 src/menu/datasource/verifycard/utils.jsx | 8 src/tabviews/custom/components/table/base-table/index.jsx | 13 src/menu/components/card/doublecardcomponent/options.jsx | 2 src/menu/components/chart/antv-dashboard/chartcompile/index.jsx | 4 src/menu/components/table/edit-table/columns/tableIn/index.jsx | 38 src/menu/components/share/markcomponent/index.jsx | 2 src/menu/components/chart/antv-X6/chartcompile/index.jsx | 4 src/tabviews/custom/components/card/double-data-card/index.jsx | 11 src/menu/components/form/formaction/actionform/index.jsx | 6 src/menu/components/chart/antv-scatter/chartcompile/index.jsx | 4 src/templates/comtableconfig/index.jsx | 750 +++++++------- src/templates/treepageconfig/index.jsx | 444 ++++---- src/tabviews/custom/popview/index.jsx | 25 src/tabviews/custom/components/table/edit-table/index.jsx | 24 src/tabviews/basetable/index.jsx | 13 src/templates/modalconfig/index.jsx | 214 ++-- src/menu/components/form/formaction/index.jsx | 4 src/tabviews/custom/components/form/simple-form/index.jsx | 4 src/tabviews/subtable/index.jsx | 12 src/tabviews/subtabtable/index.jsx | 12 src/tabviews/commontable/index.jsx | 12 src/tabviews/zshare/actionList/normalbutton/index.jsx | 426 +++++-- src/templates/sharecomponent/settingcomponent/settingform/utils.jsx | 8 src/menu/datasource/verifycard/index.jsx | 1 src/tabviews/custom/components/card/data-card/index.jsx | 15 src/utils/utils.js | 50 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 5 src/menu/components/form/formaction/formconfig.jsx | 78 + src/tabviews/custom/components/form/tab-form/index.jsx | 4 src/menu/components/chart/antv-G6/chartcompile/index.jsx | 4 src/tabviews/custom/components/timeline/normal-timeline/index.scss | 8 src/menu/components/share/actioncomponent/formconfig.jsx | 103 + src/menu/components/chart/antv-pie/chartcompile/index.jsx | 4 src/tabviews/custom/components/table/normal-table/index.jsx | 13 src/templates/zshare/verifycard/index.jsx | 44 src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 2 src/templates/subtableconfig/index.jsx | 589 +++++----- src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 58 src/menu/components/share/actioncomponent/actionform/index.jsx | 8 src/tabviews/custom/components/form/step-form/index.jsx | 4 src/tabviews/custom/index.jsx | 25 src/templates/zshare/verifycard/baseform/index.jsx | 22 src/menu/components/card/cardcomponent/options.jsx | 2 45 files changed, 1,785 insertions(+), 1,311 deletions(-) diff --git a/src/menu/components/card/cardcomponent/options.jsx b/src/menu/components/card/cardcomponent/options.jsx index 0e8c311..b8550d5 100644 --- a/src/menu/components/card/cardcomponent/options.jsx +++ b/src/menu/components/card/cardcomponent/options.jsx @@ -258,7 +258,7 @@ field: 'btnControl', label: '鎸夐挳鎺у埗', initval: setting.btnControl || 'show', - tooltip: '鍙缃寜閽樉绀鸿鍒欙紝涓�鐩存樉绀烘垨榧犳爣鎮诞鏃舵樉绀恒��', + tooltip: '鍙缃寜閽樉绀鸿鍒欙紝濮嬬粓鏄剧ず鎴栭紶鏍囨偓娴椂鏄剧ず銆�', required: false, options: [ {value: 'show', label: '姝e父鏄剧ず'}, diff --git a/src/menu/components/card/doublecardcomponent/options.jsx b/src/menu/components/card/doublecardcomponent/options.jsx index dfdd703..7100e7e 100644 --- a/src/menu/components/card/doublecardcomponent/options.jsx +++ b/src/menu/components/card/doublecardcomponent/options.jsx @@ -191,7 +191,7 @@ field: 'btnControl', label: '鎸夐挳鎺у埗', initval: setting.btnControl || 'show', - tooltip: '鍙缃寜閽樉绀鸿鍒欙紝涓�鐩存樉绀烘垨榧犳爣鎮诞鏃舵樉绀恒��', + tooltip: '鍙缃寜閽樉绀鸿鍒欙紝濮嬬粓鏄剧ず鎴栭紶鏍囨偓娴椂鏄剧ず銆�', required: false, options: [ {value: 'show', label: '姝e父鏄剧ず'}, diff --git a/src/menu/components/chart/antv-G6/chartcompile/index.jsx b/src/menu/components/chart/antv-G6/chartcompile/index.jsx index 4396a49..904b059 100644 --- a/src/menu/components/chart/antv-G6/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-G6/chartcompile/index.jsx @@ -19,7 +19,7 @@ } state = { - view: 'normal', + view: 'base', visible: false, plot: null, formlist: null, @@ -31,7 +31,7 @@ this.setState({ visible: true, - view: 'normal', + view: 'base', plot: fromJS(config.plot).toJS(), baseFormlist: getBaseForm(config.plot, config.columns), formlist: getOptionForm(config.plot, config.columns) diff --git a/src/menu/components/chart/antv-X6/chartcompile/index.jsx b/src/menu/components/chart/antv-X6/chartcompile/index.jsx index 6942006..6d1c8e7 100644 --- a/src/menu/components/chart/antv-X6/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-X6/chartcompile/index.jsx @@ -19,7 +19,7 @@ } state = { - view: 'normal', + view: 'base', visible: false, plot: null, formlist: null, @@ -31,7 +31,7 @@ this.setState({ visible: true, - view: 'normal', + view: 'base', plot: fromJS(config.plot).toJS(), baseFormlist: getBaseForm(config.plot, config.columns), formlist: getOptionForm(config.plot, config.uuid) diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx index f0bfcc6..9cd5008 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx @@ -23,7 +23,7 @@ } state = { - view: 'normal', + view: 'base', ramp: 'false', visible: false, datatype: '', @@ -301,7 +301,7 @@ this.setState({ visible: true, - view: 'normal', + view: 'base', ramp: plot.ramp || 'false', datatype: plot.datatype || 'query', fieldName: fieldName, diff --git a/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx b/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx index dd69b91..b25f286 100644 --- a/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-dashboard/chartcompile/index.jsx @@ -27,7 +27,7 @@ plot: null, formlist: null, baseFormlist: null, - view: 'normal', + view: 'base', colorColumns: [ { title: '鎸囨爣', @@ -54,7 +54,7 @@ this.setState({ visible: true, - view: 'normal', + view: 'base', plot: fromJS(config.plot).toJS(), baseFormlist: getBaseForm(config.plot), formlist: config.subtype === 'ratioboard' ? getRadioOptionForm(config.plot, config.columns) : getOptionForm(config.plot, config.columns) diff --git a/src/menu/components/chart/antv-pie/chartcompile/index.jsx b/src/menu/components/chart/antv-pie/chartcompile/index.jsx index 1a2ad2d..15eaae5 100644 --- a/src/menu/components/chart/antv-pie/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-pie/chartcompile/index.jsx @@ -27,7 +27,7 @@ plot: null, formlist: null, baseFormlist: null, - view: 'normal', + view: 'base', colorColumns: [ { title: '鎸囨爣', @@ -54,7 +54,7 @@ this.setState({ visible: true, - view: 'normal', + view: 'base', plot: fromJS(config.plot).toJS(), baseFormlist: getBaseForm(config.plot), formlist: getOptionForm(config.plot, config.columns) diff --git a/src/menu/components/chart/antv-scatter/chartcompile/index.jsx b/src/menu/components/chart/antv-scatter/chartcompile/index.jsx index 245d259..4d829ba 100644 --- a/src/menu/components/chart/antv-scatter/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-scatter/chartcompile/index.jsx @@ -20,7 +20,7 @@ } state = { - view: 'normal', + view: 'base', visible: false, plot: null, formlist: null, @@ -32,7 +32,7 @@ this.setState({ visible: true, - view: 'normal', + view: 'base', plot: fromJS(config.plot).toJS(), baseFormlist: getBaseForm(config.plot), formlist: getOptionForm(config.plot, config.columns) diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index b65157b..41ed2a2 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -57,7 +57,7 @@ } else if (this.record.type === 'close' || this.record.type === 'reset') { shows = ['typeName', 'label'] } else { - shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload'] // 閫夐」鍒楄〃 + shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 閫夐」鍒楄〃 if (this.record.intertype === 'custom') { shows.pop() @@ -288,8 +288,8 @@ allowClear={item.allowClear} > {item.options.map((option, index) => - <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> - {option.text} + <Select.Option title={option.text || option.label} key={index} value={option.value}> + {option.text || option.label} </Select.Option> )} </Select> diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index e90047a..978be6e 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -4,7 +4,7 @@ * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ -export function getActionForm (card, functip, tableName, usefulFields, modules, anchors) { +export function getActionForm (card, functip, tableName, usefulFields, modules, anchors, uuid) { const appType = sessionStorage.getItem('appType') let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview let _type = '鎻愪氦' @@ -44,6 +44,72 @@ menulist = [] } } + + let linkButtons = [] + let filterComponent = (components) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + filterComponent(tab.components) + }) + } else if (item.type === 'group') { + filterComponent(item.components) + } else { + item.action && item.action.forEach(cell => { + if (cell.hidden === 'true' || cell.uuid === uuid) return + if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return + + linkButtons.push({ + value: cell.uuid, + label: cell.label + '锛�' + item.name + '锛�' + }) + }) + + if (item.type === 'card' && item.subcards) { + item.subcards.forEach(m => { + if ((item.subtype === 'datacard' || item.subtype === 'dualdatacard') && m.$cardType !== 'extendCard') return + m.elements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === uuid) return + if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return + + linkButtons.push({ + value: cell.uuid, + label: cell.label + '锛�' + item.name + '锛�' + }) + }) + }) + } else if (item.type === 'balcony') { + item.elements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === uuid) return + if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return + + linkButtons.push({ + value: cell.uuid, + label: cell.label + '锛�' + item.name + '锛�' + }) + }) + } else if (item.type === 'form') { + item.subcards.forEach(group => { + if(group.uuid === uuid) return + + if (item.subcards.length > 1) { + linkButtons.push({ + value: group.uuid, + label: group.subButton.label + '锛�' + item.name + '-' + group.setting.title + '锛�' + }) + } else { + linkButtons.push({ + value: group.uuid, + label: group.subButton.label + '锛�' + item.name + '锛�' + }) + } + }) + } + } + }) + } + + filterComponent(window.GLOB.customMenu.components) let refresh = [] if (viewType === 'popview') { // 寮圭獥鏍囩 @@ -400,6 +466,16 @@ options: anchors }, { + type: 'select', + key: 'preButton', + label: '鍓嶇疆鎸夐挳', + tooltip: '褰撳墠鎸夐挳鎵ц鍓嶏紝闇�瑕佹墽琛岀殑鎸夐挳銆�', + initVal: card.preButton || '', + required: false, + allowClear: true, + options: linkButtons + }, + { type: 'radio', key: 'reload', label: '涓婁竴椤�', diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx index 015c25e..b86bc88 100644 --- a/src/menu/components/form/formaction/index.jsx +++ b/src/menu/components/form/formaction/index.jsx @@ -76,7 +76,7 @@ * @description 鎸夐挳缂栬緫锛岃幏鍙栨寜閽〃鍗曚俊鎭� */ handleAction = (card) => { - const { config } = this.props + const { config, group } = this.props let usefulFields = sessionStorage.getItem('permFuncField') if (usefulFields) { @@ -110,7 +110,7 @@ this.setState({ visible: true, card: card, - formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors) + formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors, group.uuid) }) } diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index c02a963..3c8a93c 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -14,9 +14,9 @@ const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) const acTyOptions = { - pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'], - prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden'], - exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden'], + pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], + prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hidden', 'preButton'], + exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hidden', 'preButton'], excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'], popview: ['label', 'Ot', 'OpenType', 'show', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'], @@ -874,7 +874,7 @@ getPopupContainer={() => document.getElementById('winter')} > {item.options.map((option, index) => - <Select.Option key={index} title={option.text || option.label} value={(option.value || option.field)}> + <Select.Option key={index} title={option.text || option.label} disabled={option.$disabled || false} value={(option.value || option.field)}> {(option.text || option.label)} </Select.Option> )} diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 0169f0f..7456bc4 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -7,7 +7,6 @@ * @param {*} functip 鐢熸垚瀛樺偍杩囩▼鎻愮ず * @param {*} setting 缁勪欢閰嶇疆 * @param {*} usefulFields 瀛樺偍杩囩▼鍙敤鐨勫紑濮嬪瓧娈� - * @param {*} type 鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡 */ export function getActionForm (card, functip, config, usefulFields, modules = [], anchors = [], side) { let appType = sessionStorage.getItem('appType') @@ -17,6 +16,7 @@ let appMenus = [] let menulist = [] let type = '' + let alltype = config.type + '_' + config.subtype if (card.eleType === 'button') { type = 'card' @@ -82,7 +82,73 @@ return _list } - let tabs = getTabs(JSON.parse(JSON.stringify(window.GLOB.customMenu.components))) + let tabs = getTabs(window.GLOB.customMenu.components) + + let linkButtons = [] + let filterComponent = (components) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + filterComponent(tab.components) + }) + } else if (item.type === 'group') { + filterComponent(item.components) + } else { + item.action && item.action.forEach(cell => { + if (cell.hidden === 'true' || cell.uuid === card.uuid) return + if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return + + linkButtons.push({ + value: cell.uuid, + label: cell.label + '锛�' + item.name + '锛�' + }) + }) + + if (item.type === 'card' && item.subcards) { + item.subcards.forEach(m => { + if ((item.subtype === 'datacard' || item.subtype === 'dualdatacard') && m.$cardType !== 'extendCard') return + m.elements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === card.uuid) return + if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return + + linkButtons.push({ + value: cell.uuid, + label: cell.label + '锛�' + item.name + '锛�' + }) + }) + }) + } else if (item.type === 'balcony') { + item.elements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true' || cell.uuid === card.uuid) return + if (!['exec', 'prompt', 'pop'].includes(cell.OpenType)) return + + linkButtons.push({ + value: cell.uuid, + label: cell.label + '锛�' + item.name + '锛�' + }) + }) + } else if (item.type === 'form') { + item.subcards.forEach(group => { + if(group.uuid === card.uuid) return + + if (item.subcards.length > 1) { + linkButtons.push({ + value: group.uuid, + label: group.subButton.label + '锛�' + item.name + '-' + group.setting.title + '锛�' + }) + } else { + linkButtons.push({ + value: group.uuid, + label: group.subButton.label + '锛�' + item.name + '锛�' + }) + } + }) + } + } + }) + } + + filterComponent(window.GLOB.customMenu.components) let pageTemps = [ { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, @@ -610,10 +676,15 @@ text: '涓嶅埛鏂�' }, { value: 'line', - text: '鍒锋柊琛�' + text: '鍒锋柊琛�', + $disabled: !['table_normaltable', 'table_editable', 'table_basetable', 'card_datacard', 'card_dualdatacard'].includes(alltype) }, { value: 'grid', text: '鍒锋柊褰撳墠缁勪欢' + }, { + value: 'line_grid', + text: '鍒锋柊琛� / 缁勪欢', + $disabled: !['table_normaltable', 'table_editable', 'table_basetable', 'card_datacard', 'card_dualdatacard'].includes(alltype) }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' @@ -633,10 +704,15 @@ text: '涓嶅埛鏂�' }, { value: 'line', - text: '鍒锋柊琛�' + text: '鍒锋柊琛�', + $disabled: !['table_normaltable', 'table_editable', 'table_basetable', 'card_datacard', 'card_dualdatacard'].includes(alltype) }, { value: 'grid', text: '鍒锋柊褰撳墠缁勪欢' + }, { + value: 'line_grid', + text: '鍒锋柊琛� / 缁勪欢', + $disabled: !['table_normaltable', 'table_editable', 'table_basetable', 'card_datacard', 'card_dualdatacard'].includes(alltype) }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' @@ -712,9 +788,6 @@ required: false, forbid: (type !== 'datacard' || appType !== 'mob'), options: [{ - // value: 'false', - // text: '鍚�' - // }, { value: 'left', text: '宸︽粦' }, { @@ -869,6 +942,16 @@ allowClear: true, options: appType === 'mob' || appType === 'pc' ? appMenus : menulist, forbid: viewType === 'popview' + }, + { + type: 'select', + key: 'preButton', + label: '鍓嶇疆鎸夐挳', + tooltip: '褰撳墠鎸夐挳鎵ц鍓嶏紝闇�瑕佹墽琛岀殑鎸夐挳銆�', + initVal: card.preButton || '', + required: false, + allowClear: true, + options: linkButtons }, { type: 'text', @@ -1725,6 +1808,9 @@ value: 'grid', text: '鍒锋柊褰撳墠缁勪欢' }, { + value: 'line_grid', + text: '鍒锋柊琛� / 缁勪欢', + }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' }, @@ -1747,6 +1833,9 @@ value: 'grid', text: '鍒锋柊褰撳墠缁勪欢' }, { + value: 'line_grid', + text: '鍒锋柊琛� / 缁勪欢', + }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' }, diff --git a/src/menu/components/share/markcomponent/index.jsx b/src/menu/components/share/markcomponent/index.jsx index c95abda..a88f98e 100644 --- a/src/menu/components/share/markcomponent/index.jsx +++ b/src/menu/components/share/markcomponent/index.jsx @@ -430,7 +430,7 @@ > <MarkForm field={this.props.field} signs={signs} columns={options} markChange={this.markChange}/> <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細浠庝笂鍒颁笅锛屽尮閰嶇涓�涓鍚堟潯浠剁殑鏍囪銆�</Col> - <EditTable actions={['edit', 'move', 'del']} data={marks} columns={markColumns} onChange={(marks) => this.setState({marks})}/> + <EditTable actions={['edit', 'move', 'del', 'copy']} type="marks" data={marks} columns={markColumns} onChange={(marks) => this.setState({marks})}/> </Modal> </div> ) diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index 0c32473..9f4eb5c 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -88,6 +88,11 @@ }) }) + editCols.push({ + field: '$next_' + card.uuid, + label: card.label + '锛堜笅涓�琛岋級' + }) + return [ { type: 'text', diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx index ec97661..ff8d86f 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, Cascader, Tooltip, InputNumber, Radio, Typography } from 'antd' +import { Form, Tabs, Row, Col, Input, Button, Popconfirm, notification, Modal, message, Select, Cascader, Tooltip, InputNumber, Radio, Typography } from 'antd' import { StopTwoTone, CheckCircleTwoTone, EditOutlined, SwapOutlined, DeleteOutlined, QuestionCircleOutlined } from '@ant-design/icons' import moment from 'moment' @@ -498,6 +498,7 @@ } render() { + const { config } = this.props const { verify, scriptsColumns, uniqueColumns, activeKey, fields, modules } = this.state const formItemLayout = { labelCol: { @@ -552,25 +553,34 @@ </Form.Item> </Col> : null} <Col span={8}> - <Form.Item label={'鎴愬姛鍚�'}> - <Radio.Group style={{whiteSpace: 'nowrap'}} value={verify.execSuccess} onChange={(e) => this.onOptionChange(e.target.value, 'execSuccess')}> - <Radio value="never">涓嶅埛鏂�</Radio> - <Radio value="grid">鍒锋柊琛ㄦ牸</Radio> - <Radio value="mainline">涓婄骇锛堣锛�</Radio> - </Radio.Group> + <Form.Item label={ + <Tooltip placement="topLeft" title="銆婂埛鏂拌銆嬩笌銆婂埛鏂拌 / 缁勪欢銆嬪彧鍦ㄦ暟鎹彁浜や负 淇敼椤� 鏃舵湁鏁堛��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鎴愬姛鍚� + </Tooltip> + }> + <Select value={verify.execSuccess} onChange={(val) => this.onOptionChange(val, 'execSuccess')}> + <Select.Option value="never">涓嶅埛鏂�</Select.Option> + <Select.Option value="line" disabled={config.wrap.commit !== 'change'}>鍒锋柊琛�</Select.Option> + <Select.Option value="grid">鍒锋柊缁勪欢</Select.Option> + <Select.Option value="line_grid" disabled={config.wrap.commit !== 'change'}>鍒锋柊琛� / 缁勪欢</Select.Option> + <Select.Option value="mainline">涓婄骇锛堣锛�</Select.Option> + </Select> </Form.Item> </Col> <Col span={8}> - <Form.Item label={'澶辫触鍚�'}> - <Radio.Group style={{whiteSpace: 'nowrap'}} value={verify.execError} onChange={(e) => this.onOptionChange(e.target.value, 'execError')}> - <Radio value="never">涓嶅埛鏂�</Radio> - <Radio value="grid">鍒锋柊琛ㄦ牸</Radio> - <Radio value="mainline">涓婄骇锛堣锛�</Radio> - </Radio.Group> + <Form.Item label="澶辫触鍚�"> + <Select value={verify.execError} onChange={(val) => this.onOptionChange(val, 'execError')}> + <Select.Option value="never">涓嶅埛鏂�</Select.Option> + <Select.Option value="line" disabled={config.wrap.commit !== 'change'}>鍒锋柊琛�</Select.Option> + <Select.Option value="grid">鍒锋柊缁勪欢</Select.Option> + <Select.Option value="line_grid" disabled={config.wrap.commit !== 'change'}>鍒锋柊琛� / 缁勪欢</Select.Option> + <Select.Option value="mainline">涓婄骇锛堣锛�</Select.Option> + </Select> </Form.Item> </Col> {isPop ? <Col span={8}> - <Form.Item label={'鎴愬姛鍚�'}> + <Form.Item label="鎴愬姛鍚�"> <Radio.Group style={{whiteSpace: 'nowrap'}} value={verify.closetab || 'false'} onChange={(e) => this.onOptionChange(e.target.value, 'closetab')}> <Radio value="false">鏍囩涓嶅叧闂�</Radio> <Radio value="true">鏍囩鍏抽棴</Radio> diff --git a/src/menu/components/timeline/normal-timeline/options.jsx b/src/menu/components/timeline/normal-timeline/options.jsx index 07cf759..a1ea98b 100644 --- a/src/menu/components/timeline/normal-timeline/options.jsx +++ b/src/menu/components/timeline/normal-timeline/options.jsx @@ -164,6 +164,19 @@ }, { type: 'radio', + field: 'btnControl', + label: '鎸夐挳鎺у埗', + initval: wrap.btnControl || 'show', + tooltip: '鍙缃寜閽樉绀鸿鍒欙紝濮嬬粓鏄剧ず鎴栭紶鏍囨偓娴椂鏄剧ず銆�', + required: false, + options: [ + {value: 'show', label: '姝e父鏄剧ず'}, + {value: 'hover', label: '鎮诞鏄剧ず'}, + ], + forbid: appType === 'mob' + }, + { + type: 'radio', field: 'permission', label: '鏉冮檺楠岃瘉', initval: wrap.permission || (!appType ? 'true' : 'false'), diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index ea27445..2849a5b 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -390,6 +390,7 @@ if (values.uuid) { scripts = scripts.map(item => { if (item.uuid === values.uuid) { + values.$index = item.$index || '' return values } else { return item diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx index 8d21423..3fc26be 100644 --- a/src/menu/datasource/verifycard/utils.jsx +++ b/src/menu/datasource/verifycard/utils.jsx @@ -195,13 +195,19 @@ }) arr.forEach(item => { + if (/@time_id@/ig.test(item)) return + let reg = new RegExp(item, 'i') if (reg.test(_dataresource)) { errors.push(`鏁版嵁婧愪腑瀛樺湪鏈浛鎹㈠��${item}`) } _scripts.forEach(script => { if (reg.test(script.sql)) { - errors.push(`鑷畾涔夎剼鏈�(${script.$index || ''})瀛樺湪鏈浛鎹㈠��${item}`) + if (script.$index) { + errors.push(`鑷畾涔夎剼鏈�(${script.$index})瀛樺湪鏈浛鎹㈠��${item}`) + } else { + errors.push(`鑷畾涔夎剼鏈腑瀛樺湪鏈浛鎹㈠��${item}`) + } } }) }) diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 565fea4..6e8b26f 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -484,6 +484,18 @@ } } + if (cell.verify && cell.verify.invalid === 'true') { + if (item.wrap && item.wrap.datatype === 'static') { + cell.verify.invalid = 'false' + } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { + cell.verify.invalid = 'false' + } else if (cell.sqlType === 'insert') { + cell.verify.invalid = 'false' + } else if (cell.Ot === 'notRequired') { + cell.verify.invalid = 'false' + } + } + if (cell.syncComponentId) { if (cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' @@ -557,6 +569,7 @@ if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 component.setting.sync = 'false' + component.setting.dataresource = '' component.setting.laypage = component.setting.laypage === 'true' return component } diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 77ef6c6..78fd480 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -282,6 +282,8 @@ config.setting.customScript = config.setting.customScript.replace(reg, val) }) } + } else { + config.setting.dataresource = '' } let _arrField = [] // 瀛楁闆� @@ -310,6 +312,16 @@ } } + if (item.verify && item.verify.invalid === 'true') { + if (item.sqlType === 'insert') { + item.verify.invalid = 'false' + } else if (item.Ot === 'notRequired') { + item.verify.invalid = 'false' + } else if (item.intertype !== 'system' && item.procMode !== 'system') { + item.verify.invalid = 'false' + } + } + if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 鎵撳嵃鏈鸿缃� let _item = window.GLOB.UserCacheMap.get(this.props.MenuID + item.uuid) diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 9cc9fcd..55ada26 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -398,9 +398,9 @@ }, i * 10) }) } else { - if (position === 'line') { + if (position === 'line' || position === 'line_grid') { if (lines && lines.length === 1) { - this.loadLinedata(lines[0].$$uuid) + this.loadLinedata(lines[0].$$uuid, position) } else { this.loadData(id) } @@ -417,9 +417,9 @@ } else { let supModule = config.setting.supModule - if (position === 'line') { + if (position === 'line' || position === 'line_grid') { if (lines && lines.length === 1) { - this.loadLinedata(lines[0].$$uuid) + this.loadLinedata(lines[0].$$uuid, position) } else { this.loadData(id) } @@ -870,7 +870,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadLinedata (id) { + async loadLinedata (id, position) { const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state if (config.forbidLine) { @@ -902,6 +902,11 @@ let result = await Api.genericInterface(param) if (result.status) { + if (position === 'line_grid' && (!result.data || !result.data[0])) { + this.loadData() + return + } + let data = fromJS(this.state.data).toJS() let selectedData = fromJS(this.state.selectedData).toJS() let selectKeys = fromJS(this.state.selectKeys).toJS() diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index bda5137..a7f73d6 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -336,9 +336,9 @@ let supModule = config.setting.supModule - if (position === 'line') { + if (position === 'line' || position === 'line_grid') { if (lines && lines.length === 1) { - this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid) + this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid, position) } else { this.loadData(id) } @@ -771,7 +771,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadLinedata (id) { + async loadLinedata (id, position) { const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state if (config.forbidLine) { @@ -803,6 +803,11 @@ let result = await Api.genericInterface(param) if (result.status) { + if (position === 'line_grid' && (!result.data || !result.data[0])) { + this.loadData() + return + } + let data = fromJS(this.state.data).toJS() let selectedData = fromJS(this.state.selectedData).toJS() let selectKeys = fromJS(this.state.selectKeys).toJS() diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 4491894..e3c340c 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -308,13 +308,15 @@ } } - mkFormSubmit = (btnId) => { + mkFormSubmit = (btnId, callback) => { const { group } = this.state if (group.uuid !== btnId) return this.formRef.handleConfirm().then(res => { MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) + }, () => { + callback && callback() }) } diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index 0ef5907..6e08986 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -388,13 +388,15 @@ } } - mkFormSubmit = (btnId) => { + mkFormSubmit = (btnId, callback) => { const { group } = this.state if (group.uuid !== btnId) return this.formRef.handleConfirm().then(res => { MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) + }, () => { + callback && callback() }) } diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 7151d62..1d19f3d 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -322,13 +322,15 @@ } } - mkFormSubmit = (btnId) => { + mkFormSubmit = (btnId, callback) => { const { group } = this.state if (group.uuid !== btnId) return this.formRef.handleConfirm().then(res => { MKEmitter.emit('triggerFormSubmit', {menuId: btnId, form: res}) + }, () => { + callback && callback() }) } diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index 91cbbff..538a792 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -261,7 +261,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadmainLinedata (id) { + async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (config.forbidLine) { @@ -289,6 +289,11 @@ let result = await Api.genericInterface(param) if (result.status) { + if (position === 'line_grid' && (!result.data || !result.data[0])) { + this.loadmaindata(true, 'false') + return + } + let data = fromJS(this.state.data).toJS() let selectedData = fromJS(this.state.selectedData).toJS() @@ -547,7 +552,7 @@ if (!id) { this.reloadtable() } else { - this.loadmainLinedata(id) + this.loadLinedata(id) } } @@ -578,9 +583,9 @@ if (config.uuid !== menuId) return - if (position === 'line') { + if (position === 'line' || position === 'line_grid') { if (lines && lines.length === 1) { - this.loadmainLinedata(lines[0].$$uuid) + this.loadLinedata(lines[0].$$uuid, position) } else { this.reloadtable(btn, id) } diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index bcc54c6..6cc0650 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -388,7 +388,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadmainLinedata (id) { + async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (config.forbidLine) { @@ -416,11 +416,25 @@ let result = await Api.genericInterface(param) if (result.status) { + if (position === 'line_grid' && (!result.data || !result.data[0])) { + this.loadmaindata(true, 'false') + return + } + if (!result.data || !result.data[0]) { + let data = fromJS(this.state.data).toJS() + let selectedData = fromJS(this.state.selectedData).toJS() + + data = data.filter(item => item.$$uuid !== id) + selectedData = selectedData.filter(item => item.$$uuid !== id) + + MKEmitter.emit('transferData' + setting.tableId, id, 'delete') + this.setState({ + data, + selectedData, loading: false }) - return } @@ -560,7 +574,7 @@ if (!id) { this.reloadtable() } else { - this.loadmainLinedata(id) + this.loadLinedata(id) } } @@ -592,9 +606,9 @@ if (config.uuid !== menuId) return - if (position === 'line') { + if (position === 'line' || position === 'line_grid') { if (lines && lines.length === 1) { - this.loadmainLinedata(lines[0].$$uuid) + this.loadLinedata(lines[0].$$uuid, position) } else { this.reloadtable(btn) } diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 4c039a7..fcdad35 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -1345,6 +1345,7 @@ timer = null focusId = '' blurId = '' + colId = '' UNSAFE_componentWillMount () { const { setting, fields, columns, BID, colsCtrls } = this.props @@ -1562,8 +1563,9 @@ }, 150) } - colFocus = (lineId) => { + colFocus = (lineId, colId) => { this.focusId = lineId + this.colId = colId } checkLine = () => { @@ -1705,9 +1707,11 @@ } transferData = (data, type) => { - const { edData } = this.state + const { edData, tableId } = this.state - if (type === 'line') { + if (type === 'delete') { + + } else if (type === 'line') { let value = '' Object.keys(data).sort().forEach(key => { if (/^\$/.test(key)) return @@ -1725,14 +1729,18 @@ }) } - if (type !== 'line') { - let index = edData.findIndex(item => !item.$origin && !item.$forbid) + if (type === 'delete') { + let _edData = this.state.edData.filter(item => item.$$uuid !== data) - if (index > -1) { - this.setState({visible: true, midData: data}) - } else { - this.updateMutil(data) - } + this.setState({edData: _edData, reseting: true}, () => { + this.setState({reseting: false}) + + if (this.focusId) { + setTimeout(() => { + MKEmitter.emit('setFocus' + tableId, this.focusId, this.colId) + }, 10) + } + }) } else if (type === 'line') { let _edData = this.state.edData.map(item => { if (item.$$uuid === data.$$uuid) { @@ -1744,7 +1752,21 @@ this.setState({edData: _edData, reseting: true}, () => { this.setState({reseting: false}) + + if (this.focusId) { + setTimeout(() => { + MKEmitter.emit('setFocus' + tableId, this.focusId, this.colId) + }, 10) + } }) + } else { + let index = edData.findIndex(item => !item.$origin && !item.$forbid) + + if (index > -1) { + this.setState({visible: true, midData: data}) + } else { + this.updateMutil(data) + } } } @@ -2298,9 +2320,9 @@ Api.genericInterface(param).then((res) => { if (res.status) { - this.execSuccess(res) + this.execSuccess(res, record) } else { - this.execError(res) + this.execError(res, record) } }, (error) => { if (error && error.ErrCode === 'LoginError') return @@ -2317,9 +2339,9 @@ Api.genericInterface(param).then((res) => { if (res.status) { - this.execSuccess(res) + this.execSuccess(res, record) } else { - this.execError(res) + this.execError(res, record) } }, (error) => { if (error && error.ErrCode === 'LoginError') return @@ -2329,7 +2351,7 @@ } } - execSuccess = (res) => { + execSuccess = (res, record) => { const { submit } = this.props const { edData } = this.state @@ -2379,13 +2401,13 @@ } if (submit.execSuccess !== 'never') { - MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit) + MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit, '', record ? [record] : null) } submit.syncComponentId && MKEmitter.emit('reloadData', submit.syncComponentId) } - execError = (res) => { + execError = (res, record) => { const { submit } = this.props if (res.ErrCode === 'E') { @@ -2414,7 +2436,7 @@ }) if (submit.execError !== 'never') { - MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit) + MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit, '', record ? [record] : null) } } diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 97af3a8..136a42c 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -539,7 +539,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadmainLinedata (id) { + async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (config.forbidLine) { @@ -567,6 +567,11 @@ let result = await Api.genericInterface(param) if (result.status) { + if (position === 'line_grid' && (!result.data || !result.data[0])) { + this.loadmaindata(true, 'false') + return + } + let data = fromJS(this.state.data).toJS() let selectedData = fromJS(this.state.selectedData).toJS() @@ -743,7 +748,7 @@ if (!id) { this.reloadtable() } else { - this.loadmainLinedata(id) + this.loadLinedata(id) } } @@ -774,9 +779,9 @@ if (config.uuid !== menuId) return - if (position === 'line') { + if (position === 'line' || position === 'line_grid') { if (lines && lines.length === 1) { - this.loadmainLinedata(lines[0].$$uuid) + this.loadLinedata(lines[0].$$uuid, position) } else { this.reloadtable(btn, id) } diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index 9801617..698328e 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -559,7 +559,7 @@ if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null return ( - <div className="normal-timeline-box" id={'anchor' + config.uuid} style={{...config.style}}> + <div className={'normal-timeline-box ' + (config.wrap.btnControl || '')} id={'anchor' + config.uuid} style={{...config.style}}> {loading ? <div className="loading-mask"> {data ? <div className="ant-spin-blur"></div> : null} diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.scss b/src/tabviews/custom/components/timeline/normal-timeline/index.scss index 7e0945c..2c45b35 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.scss +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.scss @@ -251,6 +251,14 @@ } } } +.normal-timeline-box.hover { + .card-item-box:not(:hover) { + button { + opacity: 0; + transition: opacity 0.3s; + } + } +} .normal-timeline-box::after { content: ' '; diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 373d6df..9fc21a2 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -801,6 +801,18 @@ } } + if (group.subButton.verify && group.subButton.verify.invalid === 'true') { + if (item.wrap.datatype === 'static') { + group.subButton.verify.invalid = 'false' + } else if (group.subButton.sqlType === 'insert') { + group.subButton.verify.invalid = 'false' + } else if (group.subButton.Ot === 'notRequired') { + group.subButton.verify.invalid = 'false' + } else if (group.subButton.intertype !== 'system' && group.subButton.procMode !== 'system') { + group.subButton.verify.invalid = 'false' + } + } + group.fields = group.fields.map(cell => { // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { @@ -914,6 +926,18 @@ cell.modal.$cache = item.$cache cell.modal.$time = item.$time cell.modal.uuid = cell.uuid + 'pop' + } + + if (cell.verify && cell.verify.invalid === 'true') { + if (item.wrap && item.wrap.datatype === 'static') { + cell.verify.invalid = 'false' + } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { + cell.verify.invalid = 'false' + } else if (cell.sqlType === 'insert') { + cell.verify.invalid = 'false' + } else if (cell.Ot === 'notRequired') { + cell.verify.invalid = 'false' + } } if (cell.syncComponentId) { @@ -1053,6 +1077,7 @@ if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 component.setting.sync = 'false' + component.setting.dataresource = '' component.setting.laypage = component.setting.laypage === 'true' return component } diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index f7e15a4..aa089dc 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -524,6 +524,18 @@ } } + if (group.subButton.verify && group.subButton.verify.invalid === 'true') { + if (item.wrap.datatype === 'static') { + group.subButton.verify.invalid = 'false' + } else if (group.subButton.intertype !== 'system' && group.subButton.procMode !== 'system') { + group.subButton.verify.invalid = 'false' + } else if (group.subButton.sqlType === 'insert') { + group.subButton.verify.invalid = 'false' + } else if (group.subButton.Ot === 'notRequired') { + group.subButton.verify.invalid = 'false' + } + } + group.fields = group.fields.map(cell => { // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { @@ -625,6 +637,18 @@ } else if (item.type === 'balcony' || item.subtype === 'propcard') { cell.errorType = 'error2' } + } + } + + if (cell.verify && cell.verify.invalid === 'true') { + if (item.wrap && item.wrap.datatype === 'static') { + cell.verify.invalid = 'false' + } else if (cell.sqlType === 'insert') { + cell.verify.invalid = 'false' + } else if (cell.Ot === 'notRequired') { + cell.verify.invalid = 'false' + } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { + cell.verify.invalid = 'false' } } @@ -740,6 +764,7 @@ if (component.setting.interType !== 'system') { // 涓嶄娇鐢ㄧ郴缁熷嚱鏁版椂 component.setting.sync = 'false' + component.setting.dataresource = '' component.setting.laypage = component.setting.laypage === 'true' return component } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 9f16abd..ffe6c3d 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -238,6 +238,16 @@ } } + if (item.verify && item.verify.invalid === 'true') { + if (item.sqlType === 'insert') { + item.verify.invalid = 'false' + } else if (item.Ot === 'notRequired') { + item.verify.invalid = 'false' + } else if (item.intertype !== 'system' && item.procMode !== 'system') { + item.verify.invalid = 'false' + } + } + if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 鎵撳嵃鏈鸿缃� let _item = window.GLOB.UserCacheMap.get(Tab.uuid + item.uuid) @@ -321,6 +331,8 @@ config.setting.dataresource = config.setting.dataresource.replace(cell.reg, cell.value) config.setting.customScript = config.setting.customScript.replace(cell.reg, cell.value) }) + } else { + config.setting.dataresource = '' } if (config.setting.selected !== 'init' && config.setting.selected !== 'always') { diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 0218924..8ba9910 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -210,6 +210,16 @@ } } + if (item.verify && item.verify.invalid === 'true') { + if (item.sqlType === 'insert') { + item.verify.invalid = 'false' + } else if (item.Ot === 'notRequired') { + item.verify.invalid = 'false' + } else if (item.intertype !== 'system' && item.procMode !== 'system') { + item.verify.invalid = 'false' + } + } + if (item.controlField) { if (/,/ig.test(item.controlVal)) { item.controlVals = item.controlVal.split(',') @@ -278,6 +288,8 @@ config.setting.dataresource = config.setting.dataresource.replace(cell.reg, cell.value) config.setting.customScript = config.setting.customScript.replace(cell.reg, cell.value) }) + } else { + config.setting.dataresource = '' } if (config.setting.selected !== 'init' && config.setting.selected !== 'always') { diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 4da4369..9de05d4 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -47,6 +47,7 @@ } moduleParams = null + preCallback = null UNSAFE_componentWillMount () { const { btn, selectedData, BData, disabled } = this.props @@ -180,33 +181,17 @@ } actionSubmit = (res) => { - const { btn, setting, BID } = this.props + const { btn } = this.props const { selines } = this.state if (btn.uuid !== res.menuId) return let data = selines || [] - if (setting.supModule && !BID) { - notification.warning({ - top: 92, - message: '闇�瑕佷笂绾т富閿�硷紒', - duration: 3 - }) - return - } else if (btn.Ot !== 'notRequired' && data.length === 0) { - notification.warning({ - top: 92, - message: '璇烽�夋嫨琛岋紒', - duration: 5 - }) - return - } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { - notification.warning({ - top: 92, - message: '璇烽�夋嫨鍗曡鏁版嵁锛�', - duration: 5 - }) + let valid = this.checkBtnData(data) + + if (!valid) { + this.preCallback && this.preCallback() return } @@ -214,122 +199,36 @@ this.execSubmit(data, () => {}, res.form) } - - /** - * @description 鎸夐挳鐘舵�佹敼鍙� - */ - updateStatus = () => { - this.setState({ - loading: false, - visible: false, - confirmLoading: false - }) - } /** * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ - actionTrigger = (triggerId, record, type) => { - const { BID, btn, selectedData, setting } = this.props + actionTrigger = (triggerId, record, type, callback) => { + const { btn, selectedData } = this.props const { loading, disabled } = this.state + + if (type === 'preButton') { + if (btn.uuid !== triggerId) return + + this.preTrigger(callback) + return + } else { + this.preCallback = null + } if (loading || disabled) return if (triggerId && btn.uuid !== triggerId) return - - if (setting.supModule && !BID) { - notification.warning({ - top: 92, - message: '闇�瑕佷笂绾т富閿�硷紒', - duration: 5 - }) - return - } else if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) { - return - } + if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) return + if (btn.OpenType === 'form' && btn.formType === 'count_line') return this.setState({autoMatic: type === 'autoMatic'}) let _this = this let data = record || selectedData || [] - if (btn.Ot !== 'notRequired' && data.length === 0) { - // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� - notification.warning({ - top: 92, - message: '璇烽�夋嫨琛岋紒', - duration: 5 - }) - return - } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { - // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 - notification.warning({ - top: 92, - message: '璇烽�夋嫨鍗曡鏁版嵁锛�', - duration: 5 - }) - return - } else if (btn.intertype === 'system') { - // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鎿嶄綔绫诲瀷鍜屾暟鎹簮涓嶅彲涓虹┖ - if (!btn.sql || !btn.sqlType) { - notification.warning({ - top: 92, - message: '鎸夐挳鎿嶄綔绫诲瀷閿欒锛�', - duration: 5 - }) - return - } 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) { - notification.warning({ - top: 92, - message: '鎸夐挳鍐呴儴鍑芥暟涓嶅彲涓虹┖锛�', - duration: 5 - }) - return - } - } else if (btn.intertype === 'custom' || btn.intertype === 'outer') { - if (btn.callbackType === 'script' && (!btn.verify || !btn.verify.cbScripts || !btn.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) { - notification.warning({ - top: 92, - message: '浣跨敤鑷畾涔夎剼鏈洖璋冩椂锛屽洖璋冭剼鏈笉鍙负绌猴紒', - duration: 5 - }) - return - } else if (btn.procMode === 'system' && data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { - notification.warning({ - top: 92, - message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', - duration: 5 - }) - return - } else if (btn.intertype === 'custom' && window.GLOB.systemType === 'production' && !btn.proInterface) { - notification.warning({ - top: 92, - message: '灏氭湭璁剧疆姝e紡绯荤粺鎺ュ彛鍦板潃锛�', - duration: 5 - }) - return - } - } else if (!['inner', 'outer', 'system', 'custom'].includes(btn.intertype)) { - if (btn.OpenType === 'form' && btn.formType === 'count_line') { - return - } - // 鎺ュ彛绫诲瀷閿欒 - notification.warning({ - top: 92, - message: '鎸夐挳鎺ュ彛绫诲瀷閿欒锛�', - duration: 5 - }) - return - } + let valid = this.checkBtnData(data) + + if (!valid) return this.setState({ selines: data @@ -339,7 +238,6 @@ this.setState({}, () => { MKEmitter.emit('mkFormSubmit', btn.uuid) }) - return } else if (btn.OpenType === 'prompt') { this.setState({loading: true}) confirm({ @@ -410,10 +308,158 @@ let _change = { prompt: '鎻愮ず妗�', exec: '鐩存帴鎵ц', - pop: '寮圭獥锛堣〃鍗曪級' + pop: '寮圭獥锛堣〃鍗曪級', + formSubmit: '琛ㄥ崟', + form: '琛ㄥ崟', } MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: _change[btn.OpenType]}) } + } + + preTrigger = (callback) => { + const { btn, selectedData } = this.props + const { loading, disabled } = this.state + + if (loading || disabled) { + callback() + return + } else if (btn.OpenType === 'form') { + callback() + return + } + + let _this = this + let data = selectedData || [] + + let valid = this.checkBtnData(data) + + if (!valid) { + callback() + return + } + + this.preCallback = callback + + this.setState({ + selines: data + }) + + if (btn.OpenType === 'formSubmit') { + this.setState({}, () => { + MKEmitter.emit('mkFormSubmit', btn.uuid, callback) + }) + } else if (btn.OpenType === 'prompt') { + this.setState({loading: true}) + confirm({ + title: btn.tipTitle || '纭畾瑕佹墽琛屽悧?', + onOk() { + return new Promise(resolve => { + _this.execSubmit(data, resolve) + }) + }, + onCancel() { + callback() + _this.setState({loading: false}) + } + }) + } else if (btn.OpenType === 'exec') { + this.setState({loading: true}) + this.execSubmit(data, () => { this.setState({loading: false})}) + } else if (btn.OpenType === 'pop') { + let modal = this.state.btnconfig + if (!modal && btn.modal) { + modal = this.handleModelConfig(btn.modal) + } + + this.setState({ + loading: true, + btnconfig: modal + }) + + if (modal) { + if (modal.setting.display === 'prompt' || modal.setting.display === 'exec') { + this.modelconfirm() + } else { + this.setState({ + visible: true + }) + } + } + } + } + + /** + * @description 鎸夐挳鐘舵�佹敼鍙� + */ + updateStatus = () => { + this.setState({ + loading: false, + visible: false, + confirmLoading: false + }) + } + + checkBtnData = (data) => { + const { BID, btn, setting } = this.props + + if (setting.supModule && !BID) { + notification.warning({ + top: 92, + message: '闇�瑕佷笂绾т富閿�硷紒', + duration: 5 + }) + return false + } else if (btn.Ot !== 'notRequired' && data.length === 0) { + // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� + notification.warning({ + top: 92, + message: '璇烽�夋嫨琛岋紒', + duration: 5 + }) + return false + } else if (btn.Ot === 'requiredSgl' && data.length !== 1) { + // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 + notification.warning({ + top: 92, + message: '璇烽�夋嫨鍗曡鏁版嵁锛�', + duration: 5 + }) + return false + } else if (btn.intertype === 'system') { + if (data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { + notification.warning({ + top: 92, + message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', + duration: 5 + }) + return false + } + } else if (btn.intertype === 'custom' || btn.intertype === 'outer') { + if (btn.callbackType === 'script' && (!btn.verify || !btn.verify.cbScripts || !btn.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) { + notification.warning({ + top: 92, + message: '浣跨敤鑷畾涔夎剼鏈洖璋冩椂锛屽洖璋冭剼鏈笉鍙负绌猴紒', + duration: 5 + }) + return false + } else if (btn.procMode === 'system' && data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { + notification.warning({ + top: 92, + message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', + duration: 5 + }) + return false + } else if (btn.intertype === 'custom' && window.GLOB.systemType === 'production' && !btn.proInterface) { + notification.warning({ + top: 92, + message: '灏氭湭璁剧疆姝e紡绯荤粺鎺ュ彛鍦板潃锛�', + duration: 5 + }) + return false + } + } + + return true } getSystemParam = (data, formdata, retmsg) => { @@ -441,11 +487,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg, this.moduleParams) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false, this.moduleParams) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -477,11 +523,11 @@ param.ID = primaryId || Utils.getguid() if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -503,11 +549,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -569,11 +615,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg, this.moduleParams) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -609,11 +655,11 @@ param.ID = Utils.getguid() if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -635,11 +681,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -971,21 +1017,92 @@ /** * @description 鎸夐挳鎻愪氦鎵ц */ - execSubmit = (data, _resolve, formdata) => { + execSubmit = (data, _resolve, formdata, force) => { const { setting, btn } = this.props this.moduleParams = null - if ( - (btn.intertype === 'system' || (btn.intertype === 'custom' && btn.procMode === 'system')) && - btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && btn.verify && btn.verify.invalid === 'true' && - setting.dataresource - ) { + if (btn.preButton && !force) { + this.trigger(btn.preButton, data, _resolve, formdata, 0) + } else if (btn.verify && btn.verify.invalid === 'true' && setting.dataresource) { MKEmitter.emit('queryModuleParam', btn.$menuId, (param) => { - this.moduleParams = param + let datasource = setting.dataresource + let customScript = setting.customScript || '' + let allSearch = Utils.getAllSearchOptions(param.search) + + let regoptions = allSearch.map(item => { + return { + reg: new RegExp('@' + item.key + '@', 'ig'), + value: `'${item.value}'` + } + }) + + regoptions.push({ + reg: new RegExp('@userName@', 'ig'), + value: `'${sessionStorage.getItem('User_Name') || ''}'` + }, { + reg: new RegExp('@fullName@', 'ig'), + value: `'${sessionStorage.getItem('Full_Name') || ''}'` + }, { + reg: new RegExp('@orderBy@', 'ig'), + value: setting.order + }, { + reg: new RegExp('@pageSize@', 'ig'), + value: 10 + }, { + reg: new RegExp('@pageIndex@', 'ig'), + value: 1 + }) + + regoptions.forEach(item => { + datasource = datasource.replace(item.reg, item.value) + customScript = customScript.replace(item.reg, item.value) + }) + + this.moduleParams = { + datasource, + customScript + } + this.execRealSubmit(data, _resolve, formdata) }) } else { this.execRealSubmit(data, _resolve, formdata) + } + } + + trigger = (btnId, data, resolve, formdata, times) => { + if (times > 50) { + notification.warning({ + top: 92, + message: '鍓嶇疆鎸夐挳鍔犺浇澶辫触锛�', + duration: 5 + }) + this.setState({loading: false}) + resolve() + return + } + times++ + + let node = document.getElementById('button' + btnId) + + if (node) { + MKEmitter.emit('triggerBtnId', btnId, null, 'preButton', (res) => { + if (!res) { + this.setState({loading: false}) + resolve() + return + } + + if (res.status) { + this.execSubmit(data, resolve, formdata, true) + } else { + this.execError(res) + } + }) + } else { + setTimeout(() => { + this.trigger(btnId, data, resolve, formdata, times) + }, 100) } } @@ -2059,7 +2176,14 @@ const { btn } = this.props const { autoMatic } = this.state - if (autoMatic) { + if (this.preCallback) { + this.setState({ + loading: false, + visible: false + }) + this.preCallback(res) + return + } else if (autoMatic) { this.setState({ loading: false, visible: false @@ -2554,7 +2678,14 @@ const { btn } = this.props const { autoMatic } = this.state - if (autoMatic) { + if (this.preCallback) { + this.setState({ + loading: false, + visible: false + }) + this.preCallback(res) + return + } else if (autoMatic) { notification.error({ top: 92, message: res.message || '鎵ц澶辫触锛�', @@ -2804,6 +2935,8 @@ visible: false, confirmLoading: false }) + + this.preCallback && this.preCallback() } modelconfirm = () => { @@ -2945,6 +3078,7 @@ }) }, onCancel() { + _this.preCallback && _this.preCallback() _this.setState({ loading: false }) } }) diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 7c55fb4..fc3b441 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -3,9 +3,8 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd' +import { Button, Card, Collapse, notification, Spin, Tooltip, Col } from 'antd' import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -22,14 +21,13 @@ import './index.scss' const { Panel } = Collapse -const { confirm } = Modal -const Versions = asyncComponent(() => import('@/menu/versions')) +// const Versions = asyncComponent(() => import('@/menu/versions')) const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) // const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) const UpdateTable = asyncComponent(() => import('./updatetable')) const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) -const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) +// const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) @@ -290,426 +288,428 @@ /** * @description 涓夌骇鑿滃崟淇濆瓨 */ - submitConfig = () => { - const { menu } = this.props - const { delActions, openEdition } = this.state + // submitConfig = () => { + // const { menu } = this.props + // const { delActions, openEdition } = this.state - let _config = fromJS(this.state.config).toJS() + // let _config = fromJS(this.state.config).toJS() - // 鍩烘湰淇℃伅楠岃瘉 - if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { - notification.warning({ - top: 92, - message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } + // // 鍩烘湰淇℃伅楠岃瘉 + // if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { + // notification.warning({ + // top: 92, + // message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', + // duration: 5 + // }) + // this.setState({activeKey: '0'}) + // return + // } - // 鏂板缓鑿滃崟锛屾竻闄ら粯璁ら」 - if (_config.isAdd) { - _config.search = _config.search.filter(item => !item.origin) - _config.action = _config.action.filter(item => !item.origin) - _config.columns = _config.columns.filter(item => !item.origin) - _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) - } + // // 鏂板缓鑿滃崟锛屾竻闄ら粯璁ら」 + // if (_config.isAdd) { + // _config.search = _config.search.filter(item => !item.origin) + // _config.action = _config.action.filter(item => !item.origin) + // _config.columns = _config.columns.filter(item => !item.origin) + // _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) + // } - // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id - if (_config.type === 'user') { - _config.action = _config.action.map(item => { - if (item.OpenType === 'popview' && !item.linkTab) { - item.linkTab = Utils.getuuid() - } - return item - }) + // // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id + // if (_config.type === 'user') { + // _config.action = _config.action.map(item => { + // if (item.OpenType === 'popview' && !item.linkTab) { + // item.linkTab = Utils.getuuid() + // } + // return item + // }) - _config.tabgroups.forEach(group => { - group.sublist = group.sublist.map(tab => { - if (!tab.linkTab) { - tab.linkTab = Utils.getuuid() - } - return tab - }) - }) - } + // _config.tabgroups.forEach(group => { + // group.sublist = group.sublist.map(tab => { + // if (!tab.linkTab) { + // tab.linkTab = Utils.getuuid() + // } + // return tab + // }) + // }) + // } - // 鎸夐挳涓嶅瓨鍦ㄦ椂锛屽幓鎺夌粦瀹氱殑鍙屽嚮鎸夐挳 - if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { - _config.setting.doubleClick = '' - } + // // 鎸夐挳涓嶅瓨鍦ㄦ椂锛屽幓鎺夌粦瀹氱殑鍙屽嚮鎸夐挳 + // if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { + // _config.setting.doubleClick = '' + // } - // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false - let vresult = this.verifyconfig(_config) - if (vresult !== true) { - _config.enabled = false - } + // // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false + // let vresult = this.verifyconfig(_config) + // if (vresult !== true) { + // _config.enabled = false + // } - if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� - this.setState({ - menucloseloading: true - }) - } else { - this.setState({ - menuloading: true - }) - } + // if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� + // this.setState({ + // menucloseloading: true + // }) + // } else { + // this.setState({ + // menuloading: true + // }) + // } - let _LongParam = '' + // let _LongParam = '' - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser - delete _config.type - delete _config.isAdd + // // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser + // delete _config.type + // delete _config.isAdd - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 5 - }) - this.setState({ - menucloseloading: false, - menuloading: false - }) - return - } + // try { + // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) + // } catch (e) { + // notification.warning({ + // top: 92, + // message: '缂栬瘧閿欒', + // duration: 5 + // }) + // this.setState({ + // menucloseloading: false, + // menuloading: false + // }) + // return + // } - let _sort = 0 - // let btntabs = [] + // let _sort = 0 + // // let btntabs = [] - let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 - func: 'sPC_Button_AddUpt', - Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 - ParentID: menu.MenuID, - MenuNo: _config.MenuNo, - Template: _config.Template || '', - PageParam: '', - LongParam: '', - LText: [] - } + // let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 + // func: 'sPC_Button_AddUpt', + // Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 + // ParentID: menu.MenuID, + // MenuNo: _config.MenuNo, + // Template: _config.Template || '', + // PageParam: '', + // LongParam: '', + // LText: [] + // } - _config.action.forEach(item => { - if (item.hidden === 'true') return - _sort++ - // if (item.OpenType === 'popview') { - // btntabs.push({ - // uuid: item.uuid, - // linkTab: item.linkTab, - // label: item.label, - // sort: _sort - // }) - // } + // _config.action.forEach(item => { + // if (item.hidden === 'true') return + // _sort++ + // // if (item.OpenType === 'popview') { + // // btntabs.push({ + // // uuid: item.uuid, + // // linkTab: item.linkTab, + // // label: item.label, + // // sort: _sort + // // }) + // // } - btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`) - }) + // btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`) + // }) - btnParam.LText = btnParam.LText.join(' union all ') - btnParam.LText = Utils.formatOptions(btnParam.LText) - btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) + // btnParam.LText = btnParam.LText.join(' union all ') + // btnParam.LText = Utils.formatOptions(btnParam.LText) + // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - // let tabParam = { // 娣诲姞鑿滃崟tab椤� - // func: 'sPC_sMenusTab_AddUpt', - // MenuID: menu.MenuID - // } + // // let tabParam = { // 娣诲姞鑿滃崟tab椤� + // // func: 'sPC_sMenusTab_AddUpt', + // // MenuID: menu.MenuID + // // } - // let _LText = [] + // // let _LText = [] - // btntabs.forEach(item => { - // _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) - // }) - // _config.tabgroups.forEach(group => { - // group.sublist.forEach(item => { - // _sort++ - // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) - // }) - // }) + // // btntabs.forEach(item => { + // // _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) + // // }) + // // _config.tabgroups.forEach(group => { + // // group.sublist.forEach(item => { + // // _sort++ + // // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) + // // }) + // // }) - // _LText = _LText.join(' union all ') + // // _LText = _LText.join(' union all ') - // 娓呯┖鑿滃崟涓嬪叧鑱旂殑鏍囩 - // if (!_LText) { - // _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort` - // } + // // 娓呯┖鑿滃崟涓嬪叧鑱旂殑鏍囩 + // // if (!_LText) { + // // _LText = `select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort` + // // } - // tabParam.LText = Utils.formatOptions(_LText) - // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) + // // tabParam.LText = Utils.formatOptions(_LText) + // // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) - let _vals = this.getFuncNames(_config) + // let _vals = this.getFuncNames(_config) - let param = { - func: 'sPC_TrdMenu_AddUpt', - FstID: _config.fstMenuId, - SndID: _config.ParentId, - ParentID: _config.ParentId, - MenuID: menu.MenuID, - MenuNo: _config.MenuNo, - EasyCode: _config.easyCode || '', - Template: _config.Template || '', - MenuName: _config.MenuName, - PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType, hidden: _config.hidden || 'false'}), - LongParam: _LongParam, - LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), - LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) - } + // let param = { + // func: 'sPC_TrdMenu_AddUpt', + // FstID: _config.fstMenuId, + // SndID: _config.ParentId, + // ParentID: _config.ParentId, + // MenuID: menu.MenuID, + // MenuNo: _config.MenuNo, + // EasyCode: _config.easyCode || '', + // Template: _config.Template || '', + // MenuName: _config.MenuName, + // PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType, hidden: _config.hidden || 'false'}), + // LongParam: _LongParam, + // LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), + // LTexttb: _vals.table.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) + // } - if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴� - param.Sort = menu.menuSort - } + // if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴� + // param.Sort = menu.menuSort + // } - param.LText = param.LText.join(' union all ') - param.LText = Utils.formatOptions(param.LText) - param.LTexttb = param.LTexttb.join(' union all ') - param.LTexttb = Utils.formatOptions(param.LTexttb) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + // param.LText = param.LText.join(' union all ') + // param.LText = Utils.formatOptions(param.LText) + // param.LTexttb = param.LTexttb.join(' union all ') + // param.LTexttb = Utils.formatOptions(param.LTexttb) + // param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // param.secretkey = Utils.encrypt(param.LText, param.timestamp) - if (openEdition) { // 鐗堟湰绠$悊 - param.open_edition = openEdition - } + // if (openEdition) { // 鐗堟湰绠$悊 + // param.open_edition = openEdition + // } - setTimeout(() => { - // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� - // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 - new Promise(resolve => { - if (delActions.length > 0) { - let deffers = delActions.map(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item.card ? item.card.uuid : item.uuid - } + // setTimeout(() => { + // // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� + // // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 + // new Promise(resolve => { + // if (delActions.length > 0) { + // let deffers = delActions.map(item => { + // let _param = { + // func: 'sPC_MainMenu_Del', + // MenuID: item.card ? item.card.uuid : item.uuid + // } - if (item.type === 'action') { - let _ParentParam = null + // if (item.type === 'action') { + // let _ParentParam = null - try { - _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) - } catch (e) { - console.warn('Stringify Failure') - _ParentParam = null - } + // try { + // _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) + // } catch (e) { + // console.warn('Stringify Failure') + // _ParentParam = null + // } - if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� - _param.ParentParam = _ParentParam - } - } + // if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� + // _param.ParentParam = _ParentParam + // } + // } - return new Promise(resolve => { - Api.getCloudConfig(_param).then(response => { - resolve(response) - }) - }) - }) - Promise.all(deffers).then(result => { - let error = null - result.forEach(response => { - if (!response.status) { - error = response - } - }) + // return new Promise(resolve => { + // Api.getCloudConfig(_param).then(response => { + // resolve(response) + // }) + // }) + // }) + // Promise.all(deffers).then(result => { + // let error = null + // result.forEach(response => { + // if (!response.status) { + // error = response + // } + // }) - if (error) { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - this.setState({ - delActions: [] - }) - resolve(true) - } - }) - } else if (delActions.length === 0) { - resolve(true) - } - }).then(resp => { - if (resp === false) return + // if (error) { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.warning({ + // top: 92, + // message: error.message, + // duration: 5 + // }) + // resolve(false) + // } else { + // this.setState({ + // delActions: [] + // }) + // resolve(true) + // } + // }) + // } else if (delActions.length === 0) { + // resolve(true) + // } + // }).then(resp => { + // if (resp === false) return - return true - }).then(res => { - if (res === true || res === false) return res + // return true + // }).then(res => { + // if (res === true || res === false) return res - let msg = res.filter(Boolean)[0] - if (msg) { - notification.warning({ - top: 92, - message: msg, - duration: 5 - }) - return false - } else { - return true - } - }).then(resp => { - if (resp === false) return - Api.getCloudConfig(param).then(response => { - if (response.status) { - this.setState({ - config: _config, - openEdition: response.open_edition || '', - originMenu: fromJS(_config).toJS() - }) + // let msg = res.filter(Boolean)[0] + // if (msg) { + // notification.warning({ + // top: 92, + // message: msg, + // duration: 5 + // }) + // return false + // } else { + // return true + // } + // }).then(resp => { + // if (resp === false) return + // Api.getCloudConfig(param).then(response => { + // if (response.status) { + // this.setState({ + // config: _config, + // openEdition: response.open_edition || '', + // originMenu: fromJS(_config).toJS() + // }) - this.submitAction(btnParam) - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - }) - }, +sessionStorage.getItem('mkDelay')) - } + // this.submitAction(btnParam) + // } else { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.warning({ + // top: 92, + // message: response.message, + // duration: 5 + // }) + // } + // }) + // }) + // }, +sessionStorage.getItem('mkDelay')) + // } /** * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽泦 */ - submitAction = (btnParam) => { - const { config } = this.state + // submitAction = (btnParam) => { + // const { config } = this.state - new Promise(resolve => { - if (btnParam.LText) { - Api.getCloudConfig(btnParam).then(result => { - if (result.status) { - this.setState({ // 淇濆瓨鎴愬姛鍚庢竻绌哄鍒跺垪琛� - copyActions: [] - }) - resolve(result) - } else { - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - resolve(false) - } - }) - } else { - resolve(true) - } - }).then(response => { - if (response === false) return response + // new Promise(resolve => { + // if (btnParam.LText) { + // Api.getCloudConfig(btnParam).then(result => { + // if (result.status) { + // this.setState({ // 淇濆瓨鎴愬姛鍚庢竻绌哄鍒跺垪琛� + // copyActions: [] + // }) + // resolve(result) + // } else { + // notification.warning({ + // top: 92, + // message: result.message, + // duration: 5 + // }) + // resolve(false) + // } + // }) + // } else { + // resolve(true) + // } + // }).then(response => { + // if (response === false) return response - if (!this.state.originActions || this.state.originActions.length === 0) return 'true' + // if (!this.state.originActions || this.state.originActions.length === 0) return 'true' - let oriActions = [] - this.state.originActions.forEach(item => { - let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� - if (!curBtn) return - if (curBtn.OpenType !== item.prebtn.OpenType) return - if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return + // let oriActions = [] + // this.state.originActions.forEach(item => { + // let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� + // if (!curBtn) return + // if (curBtn.OpenType !== item.prebtn.OpenType) return + // if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return - oriActions.push({ - prebtn: item.prebtn, - curBtn: curBtn - }) - }) + // oriActions.push({ + // prebtn: item.prebtn, + // curBtn: curBtn + // }) + // }) - if (oriActions.length === 0) return 'true' + // if (oriActions.length === 0) return 'true' - oriActions.forEach(action => { - if (!action.prebtn || !action.prebtn.uuid) return + // oriActions.forEach(action => { + // if (!action.prebtn || !action.prebtn.uuid) return - Api.getCloudConfig({ - func: 'sPC_Get_LongParam', - MenuID: action.prebtn.uuid - }).then(result => { - if (result.status && result.LongParam) { - let _temp = '' + // Api.getCloudConfig({ + // func: 'sPC_Get_LongParam', + // MenuID: action.prebtn.uuid + // }).then(result => { + // if (result.status && result.LongParam) { + // let _temp = '' - let _subconfig = '' - try { - _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - _temp = _subconfig.type - } catch (e) { - console.warn('Parse Failure') - _subconfig = '' - } + // let _subconfig = '' + // try { + // _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + // _temp = _subconfig.type + // } catch (e) { + // console.warn('Parse Failure') + // _subconfig = '' + // } - if (!_subconfig) return + // if (!_subconfig) return - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: this.props.menu.MenuID, - MenuID: action.curBtn.uuid, - MenuNo: config.MenuNo, - Template: _temp, - MenuName: action.curBtn.label, - PageParam: JSON.stringify({Template: _temp}), - LongParam: result.LongParam - } - Api.getCloudConfig(param).then(() => {}) - } - }) - }) - return 'true' - }).then(response => { - if (response === 'true') { - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - if (this.state.closeVisible) { - this.props.handleView() - } else { - this.setState({ - originActions: [], - menuloading: false, - menucloseloading: false - }) - } - this.props.reloadmenu() - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - } - }) - } + // let param = { + // func: 'sPC_ButtonParam_AddUpt', + // ParentID: this.props.menu.MenuID, + // MenuID: action.curBtn.uuid, + // MenuNo: config.MenuNo, + // Template: _temp, + // MenuName: action.curBtn.label, + // PageParam: JSON.stringify({Template: _temp}), + // LongParam: result.LongParam + // } + // Api.getCloudConfig(param).then(() => {}) + // } + // }) + // }) + // return 'true' + // }).then(response => { + // if (response === 'true') { + // notification.success({ + // top: 92, + // message: '淇濆瓨鎴愬姛', + // duration: 2 + // }) + // if (this.state.closeVisible) { + // this.props.handleView() + // } else { + // this.setState({ + // originActions: [], + // menuloading: false, + // menucloseloading: false + // }) + // } + // this.props.reloadmenu() + // } else { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // } + // }) + // } /** * @description 鐐瑰嚮杩斿洖鏃讹紝鍒ゆ柇閰嶇疆淇濆瓨鐘舵�� */ cancelConfig = () => { - const { config, originMenu } = this.state + // const { config, originMenu } = this.state - let _this = this + // let _this = this - if (config.isAdd) { - confirm({ - content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - onOk() { - _this.props.handleView() - }, - onCancel() {} - }) - } else { - if (!is(fromJS(originMenu), fromJS(config))) { - this.setState({ - closeVisible: true - }) - } else { - this.props.handleView() - } - } + // if (config.isAdd) { + // confirm({ + // content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', + // onOk() { + // _this.props.handleView() + // }, + // onCancel() {} + // }) + // } else { + // if (!is(fromJS(originMenu), fromJS(config))) { + // this.setState({ + // closeVisible: true + // }) + // } else { + // this.props.handleView() + // } + // } + + this.props.handleView() } /** @@ -1072,7 +1072,7 @@ render () { const { menu } = this.props - const { activeKey, config, chartview, openEdition } = this.state + const { activeKey, config, chartview } = this.state if (!config) return null @@ -1187,12 +1187,12 @@ } bordered={false} extra={ <div> <Unattended config={config} updateConfig={this.updateconfig}/> - <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> + {/* <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> */} {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */} - <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> + {/* <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> */} <UpdateTable config={config}/> - <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> - <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> + {/* <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> */} + {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> */} <Button onClick={this.cancelConfig}>鍏抽棴</Button> </div> } style={{ width: '100%' }}> @@ -1281,7 +1281,7 @@ </div> </DndProvider> {/* 杩斿洖鏃舵湭淇濆瓨鎻愮ず */} - <Modal + {/* <Modal bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} closable={false} maskClosable={false} @@ -1295,7 +1295,7 @@ destroyOnClose > 閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� - </Modal> + </Modal> */} {this.state.loading && <Spin size="large" />} </div> ) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 5343768..c8b2d92 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' +import { fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' import { Button, Card, Modal, Collapse, notification, Switch } from 'antd' @@ -20,11 +20,11 @@ const { Panel } = Collapse const { confirm } = Modal -const Versions = asyncComponent(() => import('@/menu/versions')) -const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +// const Versions = asyncComponent(() => import('@/menu/versions')) +// const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) -const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) +// const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const DragElement = asyncComponent(() => import('./dragelement')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) @@ -407,110 +407,110 @@ }) } - submitConfig = () => { - const { editAction } = this.props - const { config, menu, openEdition } = this.state + // submitConfig = () => { + // const { editAction } = this.props + // const { config, menu, openEdition } = this.state - if (config.fields[0] && config.fields[0].origin) { - notification.warning({ - top: 92, - message: '璇锋坊鍔犺〃鍗�', - duration: 10 - }) - return - } + // if (config.fields[0] && config.fields[0].origin) { + // notification.warning({ + // top: 92, + // message: '璇锋坊鍔犺〃鍗�', + // duration: 10 + // }) + // return + // } - let _LongParam = '' - let _config = fromJS(config).toJS() + // let _LongParam = '' + // let _config = fromJS(config).toJS() - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 10 - }) - return - } + // try { + // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) + // } catch (e) { + // notification.warning({ + // top: 92, + // message: '缂栬瘧閿欒', + // duration: 10 + // }) + // return + // } - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: menu.MenuID, - MenuID: editAction.uuid, - MenuNo: menu.MenuNo, - Template: 'Modal', - MenuName: editAction.label, - PageParam: JSON.stringify({Template: 'Modal'}), - LongParam: _LongParam - } + // let param = { + // func: 'sPC_ButtonParam_AddUpt', + // ParentID: menu.MenuID, + // MenuID: editAction.uuid, + // MenuNo: menu.MenuNo, + // Template: 'Modal', + // MenuName: editAction.label, + // PageParam: JSON.stringify({Template: 'Modal'}), + // LongParam: _LongParam + // } - if (openEdition) { - param.open_edition = openEdition - } + // if (openEdition) { + // param.open_edition = openEdition + // } - if (this.state.closeVisible) { - this.setState({ - closeloading: true - }) - } else { - this.setState({ - menuloading: true - }) - } + // if (this.state.closeVisible) { + // this.setState({ + // closeloading: true + // }) + // } else { + // this.setState({ + // menuloading: true + // }) + // } - Api.getCloudConfig(param).then(response => { - if (response.status) { - this.setState({ - openEdition: response.open_edition || '', - menuloading: false, - closeloading: false, - closeVisible: false, - originConfig: _config, - config: _config - }) - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - } else { - this.setState({ - closeloading: false, - menuloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 10 - }) - } - }) - } + // Api.getCloudConfig(param).then(response => { + // if (response.status) { + // this.setState({ + // openEdition: response.open_edition || '', + // menuloading: false, + // closeloading: false, + // closeVisible: false, + // originConfig: _config, + // config: _config + // }) + // notification.success({ + // top: 92, + // message: '淇濆瓨鎴愬姛', + // duration: 2 + // }) + // } else { + // this.setState({ + // closeloading: false, + // menuloading: false + // }) + // notification.warning({ + // top: 92, + // message: response.message, + // duration: 10 + // }) + // } + // }) + // } cancelConfig = () => { - const { config, originConfig } = this.state - let _this = this + // const { config, originConfig } = this.state + // let _this = this - let isOrigin = config.fields.filter(item => item.origin).length > 0 - if (isOrigin) { - confirm({ - content: '灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - onOk() { - _this.handleViewBack() - }, - onCancel() {} - }) - } else { - - if (!is(fromJS(config), fromJS(originConfig))) { - this.setState({ - closeVisible: true - }) - } else { - this.handleViewBack() - } - } + // let isOrigin = config.fields.filter(item => item.origin).length > 0 + // if (isOrigin) { + // confirm({ + // content: '灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', + // onOk() { + // _this.handleViewBack() + // }, + // onCancel() {} + // }) + // } else { + // if (!is(fromJS(config), fromJS(originConfig))) { + // this.setState({ + // closeVisible: true + // }) + // } else { + // this.handleViewBack() + // } + // } + this.handleViewBack() } /** @@ -681,8 +681,8 @@ } render () { - const { editAction } = this.props - const { config, openEdition } = this.state + // const { editAction } = this.props + const { config } = this.state if (!config) return null @@ -713,11 +713,11 @@ <div className="setting"> <Card title="琛ㄥ崟閰嶇疆" bordered={false} extra={ <div> - <Button type="danger" onClick={this.clearConfig}>娓呯┖</Button> - <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> - <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/> - <EditComponent options={['form']} type="formboard" config={this.state.config} plusFields={this.plusFields}/> - <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> + {/* <Button type="danger" onClick={this.clearConfig}>娓呯┖</Button> */} + {/* <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> */} + {/* <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/> */} + {/* <EditComponent options={['form']} type="formboard" config={this.state.config} plusFields={this.plusFields}/> */} + {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> */} <Button onClick={this.cancelConfig}>杩斿洖</Button> </div> } style={{ width: '100%' }}> @@ -792,7 +792,7 @@ wrappedComponentRef={(inst) => this.settingRef = inst} /> </Modal> - <Modal + {/* <Modal bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} closable={false} maskClosable={false} @@ -806,7 +806,7 @@ destroyOnClose > 閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� - </Modal> + </Modal> */} <StyleController /> </div> ) diff --git a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx index ca11a57..199a33e 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx @@ -118,13 +118,19 @@ let arr = sql.match(/@[0-9a-zA-Z_]+@/ig) arr.forEach(item => { + if (/@time_id@/ig.test(item)) return + let reg = new RegExp(item, 'i') if (reg.test(_dataresource)) { errors.push(`鏁版嵁婧愪腑瀛樺湪鏈浛鎹㈠��${item}`) } scripts && scripts.forEach(script => { if (reg.test(script.sql)) { - errors.push(`鑷畾涔夎剼鏈�(${script.$index || ''})瀛樺湪鏈浛鎹㈠��${item}`) + if (script.$index) { + errors.push(`鑷畾涔夎剼鏈�(${script.$index})瀛樺湪鏈浛鎹㈠��${item}`) + } else { + errors.push(`鑷畾涔夎剼鏈腑瀛樺湪鏈浛鎹㈠��${item}`) + } } }) }) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 3459581..8e48352 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -3,7 +3,7 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd' +import { Button, Card, Collapse, notification, Spin, Tooltip, Col } from 'antd' import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons' // import moment from 'moment' @@ -22,11 +22,11 @@ import './index.scss' const { Panel } = Collapse -const { confirm } = Modal +// const { confirm } = Modal -const Versions = asyncComponent(() => import('@/menu/versions')) +// const Versions = asyncComponent(() => import('@/menu/versions')) // const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) -const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) +// const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) @@ -282,331 +282,332 @@ /** * @description 鏍囩椤典繚瀛� */ - submitConfig = () => { - const { delActions, openEdition } = this.state - let _config = fromJS(this.state.config).toJS() - let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig + // submitConfig = () => { + // const { delActions, openEdition } = this.state + // let _config = fromJS(this.state.config).toJS() + // let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig - // 鍩烘湰淇℃伅楠岃瘉 - if (!_config.tabName || !_config.tabNo) { - notification.warning({ - top: 92, - message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } + // // 鍩烘湰淇℃伅楠岃瘉 + // if (!_config.tabName || !_config.tabNo) { + // notification.warning({ + // top: 92, + // message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', + // duration: 5 + // }) + // this.setState({activeKey: '0'}) + // return + // } - if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) { - notification.warning({ - top: 92, - message: '姝ゆ爣绛句负澶嶅埗鏍囩锛岃淇敼鏍囩鍚嶇О鍜屾爣绛惧弬鏁帮紝涓嶅彲浠ユ椂闂存牸寮� YYYY-MM-DD HH:mm:ss 缁撳熬锛�', - duration: 5 - }) - return - } + // if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) { + // notification.warning({ + // top: 92, + // message: '姝ゆ爣绛句负澶嶅埗鏍囩锛岃淇敼鏍囩鍚嶇О鍜屾爣绛惧弬鏁帮紝涓嶅彲浠ユ椂闂存牸寮� YYYY-MM-DD HH:mm:ss 缁撳熬锛�', + // duration: 5 + // }) + // return + // } - if (_config.isAdd) { - if (_config.search[0] && _config.search[0].origin) { - _config.search = _config.search.filter(item => !item.origin) - } - if (_config.action[0] && _config.action[0].origin) { - _config.action = _config.action.filter(item => !item.origin) - } - if (_config.columns[0] && _config.columns[0].origin) { - _config.columns = _config.columns.filter(item => !item.origin) - } - } + // if (_config.isAdd) { + // if (_config.search[0] && _config.search[0].origin) { + // _config.search = _config.search.filter(item => !item.origin) + // } + // if (_config.action[0] && _config.action[0].origin) { + // _config.action = _config.action.filter(item => !item.origin) + // } + // if (_config.columns[0] && _config.columns[0].origin) { + // _config.columns = _config.columns.filter(item => !item.origin) + // } + // } - if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { - _config.setting.doubleClick = '' - } + // if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { + // _config.setting.doubleClick = '' + // } - // 鏈缃暟鎹簮鎴栦富閿椂锛屽惎鐢ㄧ姸鎬佷负false - let result = this.verifyconfig(_config) + // // 鏈缃暟鎹簮鎴栦富閿椂锛屽惎鐢ㄧ姸鎬佷负false + // let result = this.verifyconfig(_config) - if (result !== true) { - _config.enabled = false - } + // if (result !== true) { + // _config.enabled = false + // } - if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� - this.setState({ - menucloseloading: true - }) - } else { - this.setState({ - menuloading: true - }) - } + // if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� + // this.setState({ + // menucloseloading: true + // }) + // } else { + // this.setState({ + // menuloading: true + // }) + // } - let _LongParam = '' + // let _LongParam = '' - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser - delete _config.type - delete _config.isAdd + // // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser + // delete _config.type + // delete _config.isAdd - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 5 - }) + // try { + // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) + // } catch (e) { + // notification.warning({ + // top: 92, + // message: '缂栬瘧閿欒', + // duration: 5 + // }) - this.setState({ - menucloseloading: false, - menuloading: false - }) - return - } + // this.setState({ + // menucloseloading: false, + // menuloading: false + // }) + // return + // } - // let btnParam = { - // func: 'sPC_Button_AddUpt', - // Type: 40, - // ParentID: _config.uuid, - // MenuNo: _config.tabNo, - // Template: 'SubTable', - // PageParam: '', - // LongParam: '', - // LText: [] - // } + // // let btnParam = { + // // func: 'sPC_Button_AddUpt', + // // Type: 40, + // // ParentID: _config.uuid, + // // MenuNo: _config.tabNo, + // // Template: 'SubTable', + // // PageParam: '', + // // LongParam: '', + // // LText: [] + // // } - // let btntabs = [] + // // let btntabs = [] - // _config.action.forEach((item, index) => { - // if (item.hidden === 'true') return - // if (item.OpenType === 'popview') { - // btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) - // } - // btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) - // }) + // // _config.action.forEach((item, index) => { + // // if (item.hidden === 'true') return + // // if (item.OpenType === 'popview') { + // // btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) + // // } + // // btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) + // // }) - // btnParam.LText = btnParam.LText.join(' union all ') - // btnParam.LText = Utils.formatOptions(btnParam.LText) - // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) + // // btnParam.LText = btnParam.LText.join(' union all ') + // // btnParam.LText = Utils.formatOptions(btnParam.LText) + // // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - // let tabParam = { // 娣诲姞鏍囩鎸夐挳tab椤� - // func: 'sPC_sMenusTab_AddUpt', - // MenuID: _config.uuid, - // LText: btntabs.join(' union all ') - // } + // // let tabParam = { // 娣诲姞鏍囩鎸夐挳tab椤� + // // func: 'sPC_sMenusTab_AddUpt', + // // MenuID: _config.uuid, + // // LText: btntabs.join(' union all ') + // // } - // tabParam.LText = Utils.formatOptions(tabParam.LText) - // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) + // // tabParam.LText = Utils.formatOptions(tabParam.LText) + // // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) - let param = { - func: 'sPC_Tab_AddUpt', - MenuID: _config.uuid, - MenuNo: _config.tabNo, - Template: 'SubTable', - MenuName: _config.tabName, - Remark: _config.Remark, - Sort: 0, - PageParam: JSON.stringify({Template: 'SubTable'}), - LongParam: _LongParam - } + // let param = { + // func: 'sPC_Tab_AddUpt', + // MenuID: _config.uuid, + // MenuNo: _config.tabNo, + // Template: 'SubTable', + // MenuName: _config.tabName, + // Remark: _config.Remark, + // Sort: 0, + // PageParam: JSON.stringify({Template: 'SubTable'}), + // LongParam: _LongParam + // } - if (openEdition) { - param.open_edition = openEdition - } + // if (openEdition) { + // param.open_edition = openEdition + // } - // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� - // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 - new Promise(resolve => { - if (delActions.length > 0) { - let deffers = delActions.map(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item.card.uuid - } + // // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� + // // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 + // new Promise(resolve => { + // if (delActions.length > 0) { + // let deffers = delActions.map(item => { + // let _param = { + // func: 'sPC_MainMenu_Del', + // MenuID: item.card.uuid + // } - let _ParentParam = null + // let _ParentParam = null - try { - _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) - } catch (e) { - console.warn('Stringify Failure') - _ParentParam = null - } + // try { + // _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) + // } catch (e) { + // console.warn('Stringify Failure') + // _ParentParam = null + // } - if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� - _param.ParentParam = _ParentParam - } + // if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� + // _param.ParentParam = _ParentParam + // } - return new Promise(resolve => { - Api.getCloudConfig(_param).then(response => { - resolve(response) - }) - }) - }) - Promise.all(deffers).then(result => { - let error = null - result.forEach(response => { - if (!response.status) { - error = response - } - }) + // return new Promise(resolve => { + // Api.getCloudConfig(_param).then(response => { + // resolve(response) + // }) + // }) + // }) + // Promise.all(deffers).then(result => { + // let error = null + // result.forEach(response => { + // if (!response.status) { + // error = response + // } + // }) - if (error) { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - this.setState({ - delActions: [] - }) - resolve(true) - } - }) - } else if (delActions.length === 0) { - resolve(true) - } - }).then(resp => { - if (resp === false) return + // if (error) { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.warning({ + // top: 92, + // message: error.message, + // duration: 5 + // }) + // resolve(false) + // } else { + // this.setState({ + // delActions: [] + // }) + // resolve(true) + // } + // }) + // } else if (delActions.length === 0) { + // resolve(true) + // } + // }).then(resp => { + // if (resp === false) return - return true - }).then(res => { - if (res === true || res === false) return res + // return true + // }).then(res => { + // if (res === true || res === false) return res - let msg = res.filter(Boolean)[0] - if (msg) { - notification.warning({ - top: 92, - message: msg, - duration: 5 - }) - return false - } else { - return true - } - }).then(resp => { - if (resp === false) return + // let msg = res.filter(Boolean)[0] + // if (msg) { + // notification.warning({ + // top: 92, + // message: msg, + // duration: 5 + // }) + // return false + // } else { + // return true + // } + // }).then(resp => { + // if (resp === false) return - Api.getCloudConfig(param).then(response => { - if (response.status) { - this.setState({ - openEdition: response.open_edition || '', - config: _config, - originConfig: fromJS(_config).toJS() - }, () => { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - if (this.state.closeVisible) { - this.handleViewBack() - } - }) - this.submitAction() - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - }) - } + // Api.getCloudConfig(param).then(response => { + // if (response.status) { + // this.setState({ + // openEdition: response.open_edition || '', + // config: _config, + // originConfig: fromJS(_config).toJS() + // }, () => { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.success({ + // top: 92, + // message: '淇濆瓨鎴愬姛', + // duration: 2 + // }) + // if (this.state.closeVisible) { + // this.handleViewBack() + // } + // }) + // this.submitAction() + // } else { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.warning({ + // top: 92, + // message: response.message, + // duration: 5 + // }) + // } + // }) + // }) + // } /** * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽� */ - submitAction = () => { - const { config } = this.state + // submitAction = () => { + // const { config } = this.state - let oriActions = [] - this.state.originActions.forEach(item => { - let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� - if (!curBtn) return - if (curBtn.OpenType !== item.prebtn.OpenType) return - if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return + // let oriActions = [] + // this.state.originActions.forEach(item => { + // let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� + // if (!curBtn) return + // if (curBtn.OpenType !== item.prebtn.OpenType) return + // if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return - oriActions.push({ - prebtn: item.prebtn, - curBtn: curBtn - }) - }) + // oriActions.push({ + // prebtn: item.prebtn, + // curBtn: curBtn + // }) + // }) - if (oriActions.length === 0) return + // if (oriActions.length === 0) return - oriActions.forEach(action => { - Api.getCloudConfig({ - func: 'sPC_Get_LongParam', - MenuID: action.prebtn ? action.prebtn.uuid : '' - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' + // oriActions.forEach(action => { + // Api.getCloudConfig({ + // func: 'sPC_Get_LongParam', + // MenuID: action.prebtn ? action.prebtn.uuid : '' + // }).then(result => { + // if (result.status && result.LongParam) { + // let _LongParam = '' - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } + // if (result.LongParam) { + // try { + // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + // } catch (e) { + // console.warn('Parse Failure') + // _LongParam = '' + // } + // } - if (_LongParam) { - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: config.uuid, - MenuID: action.curBtn.uuid, - MenuNo: config.tabNo, - Template: _LongParam.type, - MenuName: action.curBtn.label, - PageParam: JSON.stringify({Template: _LongParam.type}), - LongParam: result.LongParam - } - Api.getCloudConfig(param).then(() => {}) - } - } - }) - }) - } + // if (_LongParam) { + // let param = { + // func: 'sPC_ButtonParam_AddUpt', + // ParentID: config.uuid, + // MenuID: action.curBtn.uuid, + // MenuNo: config.tabNo, + // Template: _LongParam.type, + // MenuName: action.curBtn.label, + // PageParam: JSON.stringify({Template: _LongParam.type}), + // LongParam: result.LongParam + // } + // Api.getCloudConfig(param).then(() => {}) + // } + // } + // }) + // }) + // } cancelConfig = () => { - const { config, originConfig } = this.state + // const { config, originConfig } = this.state - let _this = this + // let _this = this - if (originConfig.isAdd) { - confirm({ - content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - onOk() { - _this.handleViewBack() - }, - onCancel() {} - }) - } else { - if (!is(fromJS(originConfig), fromJS(config))) { - this.setState({ - closeVisible: true - }) - } else { - this.handleViewBack() - } - } + // if (originConfig.isAdd) { + // confirm({ + // content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', + // onOk() { + // _this.handleViewBack() + // }, + // onCancel() {} + // }) + // } else { + // if (!is(fromJS(originConfig), fromJS(config))) { + // this.setState({ + // closeVisible: true + // }) + // } else { + // this.handleViewBack() + // } + // } + this.handleViewBack() } /** @@ -910,7 +911,7 @@ } render () { - const { activeKey, config, chartview, openEdition } = this.state + const { activeKey, config, chartview } = this.state if (!config) return null @@ -994,11 +995,11 @@ </div> } bordered={false} extra={ <div> - <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> + {/* <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> */} {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */} - <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} refresh={this.updateConfig}/> - <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> - <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> + {/* <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} refresh={this.updateConfig}/> */} + {/* <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> */} + {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> */} <Button onClick={this.cancelConfig}>杩斿洖</Button> </div> } style={{ width: '100%' }}> @@ -1080,7 +1081,7 @@ </Card> </div> </DndProvider> - <Modal + {/* <Modal bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} closable={false} maskClosable={false} @@ -1094,7 +1095,7 @@ destroyOnClose > 閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� - </Modal> + </Modal> */} {this.state.loading && <Spin size="large" />} </div> ) diff --git a/src/templates/treepageconfig/index.jsx b/src/templates/treepageconfig/index.jsx index 318adf1..af0d67b 100644 --- a/src/templates/treepageconfig/index.jsx +++ b/src/templates/treepageconfig/index.jsx @@ -3,9 +3,8 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Row, Col, Tree } from 'antd' +import { Button, Card, Collapse, notification, Spin, Tooltip, Row, Col, Tree } from 'antd' import { QuestionCircleOutlined, RedoOutlined, SearchOutlined, FileOutlined, FolderOpenOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -17,7 +16,7 @@ import './index.scss' const { Panel } = Collapse -const { confirm } = Modal +// const { confirm } = Modal const { TreeNode } = Tree const UpdateTable = asyncComponent(() => import('./updatetable')) @@ -215,255 +214,256 @@ /** * @description 涓夌骇鑿滃崟淇濆瓨 */ - submitConfig = () => { - const { menu } = this.props - const { delTabs, openEdition } = this.state + // submitConfig = () => { + // const { menu } = this.props + // const { delTabs, openEdition } = this.state - let _config = fromJS(this.state.config).toJS() + // let _config = fromJS(this.state.config).toJS() - // 鍩烘湰淇℃伅楠岃瘉 - if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { - notification.warning({ - top: 92, - message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } + // // 鍩烘湰淇℃伅楠岃瘉 + // if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { + // notification.warning({ + // top: 92, + // message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', + // duration: 5 + // }) + // this.setState({activeKey: '0'}) + // return + // } - // 鏂板缓楠岃瘉 - if (_config.isAdd) { - _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) - } + // // 鏂板缓楠岃瘉 + // if (_config.isAdd) { + // _config.tabgroups[0].sublist = _config.tabgroups[0].sublist.filter(item => !item.origin) + // } - // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id - if (_config.type === 'user') { - _config.tabgroups.forEach(group => { - group.sublist = group.sublist.map(tab => { - if (!tab.linkTab) { - tab.linkTab = Utils.getuuid() - } - return tab - }) - }) - } + // // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id + // if (_config.type === 'user') { + // _config.tabgroups.forEach(group => { + // group.sublist = group.sublist.map(tab => { + // if (!tab.linkTab) { + // tab.linkTab = Utils.getuuid() + // } + // return tab + // }) + // }) + // } - // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false - let vresult = this.verifyconfig(_config) - if (vresult !== true) { - _config.enabled = false - } + // // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false + // let vresult = this.verifyconfig(_config) + // if (vresult !== true) { + // _config.enabled = false + // } - if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� - this.setState({ - menucloseloading: true - }) - } else { - this.setState({ - menuloading: true - }) - } + // if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� + // this.setState({ + // menucloseloading: true + // }) + // } else { + // this.setState({ + // menuloading: true + // }) + // } - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser - delete _config.type - delete _config.isAdd + // // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser + // delete _config.type + // delete _config.isAdd - let _LongParam = '' + // let _LongParam = '' - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 5 - }) - this.setState({ - menucloseloading: false, - menuloading: false - }) - return - } + // try { + // _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) + // } catch (e) { + // notification.warning({ + // top: 92, + // message: '缂栬瘧閿欒', + // duration: 5 + // }) + // this.setState({ + // menucloseloading: false, + // menuloading: false + // }) + // return + // } - // let _sort = 0 - // let btntabs = [] + // // let _sort = 0 + // // let btntabs = [] - // let tabParam = { // 娣诲姞鑿滃崟tab椤� - // func: 'sPC_sMenusTab_AddUpt', - // MenuID: menu.MenuID - // } + // // let tabParam = { // 娣诲姞鑿滃崟tab椤� + // // func: 'sPC_sMenusTab_AddUpt', + // // MenuID: menu.MenuID + // // } - // let _LText = [] + // // let _LText = [] - // btntabs.forEach(item => { - // _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) - // }) - // _config.tabgroups.forEach(group => { - // group.sublist.forEach(item => { - // _sort++ - // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) - // }) - // }) + // // btntabs.forEach(item => { + // // _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`) + // // }) + // // _config.tabgroups.forEach(group => { + // // group.sublist.forEach(item => { + // // _sort++ + // // _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) + // // }) + // // }) - // _LText = _LText.join(' union all ') + // // _LText = _LText.join(' union all ') - // tabParam.LText = Utils.formatOptions(_LText) - // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) + // // tabParam.LText = Utils.formatOptions(_LText) + // // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) - let _funcs = [] - let _tables = [] + // let _funcs = [] + // let _tables = [] - if (_config.setting.tableName) { - _tables.push(_config.setting.tableName) - } - if (_config.setting.innerFunc) { - _funcs.push({func: _config.setting.innerFunc, label: _config.MenuName || ''}) - } - if (_config.setting.outerFunc) { - _funcs.push({func: _config.setting.outerFunc, label: _config.MenuName || ''}) - } + // if (_config.setting.tableName) { + // _tables.push(_config.setting.tableName) + // } + // if (_config.setting.innerFunc) { + // _funcs.push({func: _config.setting.innerFunc, label: _config.MenuName || ''}) + // } + // if (_config.setting.outerFunc) { + // _funcs.push({func: _config.setting.outerFunc, label: _config.MenuName || ''}) + // } - let param = { - func: 'sPC_TrdMenu_AddUpt', - FstID: _config.fstMenuId, - SndID: _config.ParentId, - ParentID: _config.ParentId, - MenuID: menu.MenuID, - MenuNo: _config.MenuNo, - EasyCode: _config.easyCode, - Template: _config.Template, - MenuName: _config.MenuName, - PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType}), - LongParam: _LongParam, - LText: _funcs.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), - LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) - } + // let param = { + // func: 'sPC_TrdMenu_AddUpt', + // FstID: _config.fstMenuId, + // SndID: _config.ParentId, + // ParentID: _config.ParentId, + // MenuID: menu.MenuID, + // MenuNo: _config.MenuNo, + // EasyCode: _config.easyCode, + // Template: _config.Template, + // MenuName: _config.MenuName, + // PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType}), + // LongParam: _LongParam, + // LText: _funcs.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), + // LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) + // } - if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴� - param.Sort = menu.menuSort - } + // if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴� + // param.Sort = menu.menuSort + // } - param.LText = param.LText.join(' union all ') - param.LText = Utils.formatOptions(param.LText) - param.LTexttb = param.LTexttb.join(' union all ') - param.LTexttb = Utils.formatOptions(param.LTexttb) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + // param.LText = param.LText.join(' union all ') + // param.LText = Utils.formatOptions(param.LText) + // param.LTexttb = param.LTexttb.join(' union all ') + // param.LTexttb = Utils.formatOptions(param.LTexttb) + // param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + // param.secretkey = Utils.encrypt(param.LText, param.timestamp) - if (openEdition) { // 鐗堟湰绠$悊 - param.open_edition = openEdition - } + // if (openEdition) { // 鐗堟湰绠$悊 + // param.open_edition = openEdition + // } - // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� - // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 - new Promise(resolve => { - if (delTabs.length > 0) { - let deffers = delTabs.map(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item.uuid - } + // // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� + // // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 + // new Promise(resolve => { + // if (delTabs.length > 0) { + // let deffers = delTabs.map(item => { + // let _param = { + // func: 'sPC_MainMenu_Del', + // MenuID: item.uuid + // } - return new Promise(resolve => { - Api.getCloudConfig(_param).then(response => { - resolve(response) - }) - }) - }) - Promise.all(deffers).then(result => { - let error = null - result.forEach(response => { - if (!response.status) { - error = response - } - }) + // return new Promise(resolve => { + // Api.getCloudConfig(_param).then(response => { + // resolve(response) + // }) + // }) + // }) + // Promise.all(deffers).then(result => { + // let error = null + // result.forEach(response => { + // if (!response.status) { + // error = response + // } + // }) - if (error) { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - this.setState({ - delTabs: [] - }) - resolve(true) - } - }) - } else if (delTabs.length === 0) { - resolve(true) - } - }).then(resp => { - if (resp === false) return + // if (error) { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.warning({ + // top: 92, + // message: error.message, + // duration: 5 + // }) + // resolve(false) + // } else { + // this.setState({ + // delTabs: [] + // }) + // resolve(true) + // } + // }) + // } else if (delTabs.length === 0) { + // resolve(true) + // } + // }).then(resp => { + // if (resp === false) return - Api.getCloudConfig(param).then(response => { - if (response.status) { - this.setState({ - config: _config, - openEdition: response.open_edition || '', - originMenu: fromJS(_config).toJS(), - menuloading: false, - menucloseloading: false - }) + // Api.getCloudConfig(param).then(response => { + // if (response.status) { + // this.setState({ + // config: _config, + // openEdition: response.open_edition || '', + // originMenu: fromJS(_config).toJS(), + // menuloading: false, + // menucloseloading: false + // }) - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) + // notification.success({ + // top: 92, + // message: '淇濆瓨鎴愬姛', + // duration: 2 + // }) - this.props.reloadmenu() + // this.props.reloadmenu() - if (this.state.closeVisible) { - this.props.handleView() - } - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - }) - } + // if (this.state.closeVisible) { + // this.props.handleView() + // } + // } else { + // this.setState({ + // menuloading: false, + // menucloseloading: false + // }) + // notification.warning({ + // top: 92, + // message: response.message, + // duration: 5 + // }) + // } + // }) + // }) + // } /** * @description 鐐瑰嚮杩斿洖鏃讹紝鍒ゆ柇閰嶇疆淇濆瓨鐘舵�� */ cancelConfig = () => { - const { config, originMenu } = this.state - let _this = this + // const { config, originMenu } = this.state + // let _this = this - if (config.isAdd) { - confirm({ - content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - onOk() { - _this.props.handleView() - }, - onCancel() {} - }) - } else { - if (!is(fromJS(originMenu), fromJS(config))) { - this.setState({ - closeVisible: true - }) - } else { - this.props.handleView() - } - } + // if (config.isAdd) { + // confirm({ + // content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', + // onOk() { + // _this.props.handleView() + // }, + // onCancel() {} + // }) + // } else { + // if (!is(fromJS(originMenu), fromJS(config))) { + // this.setState({ + // closeVisible: true + // }) + // } else { + // this.props.handleView() + // } + // } + this.props.handleView() } /** @@ -710,8 +710,8 @@ } bordered={false} extra={ <div> <UpdateTable config={config}/> - <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> - <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> + {/* <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> */} + {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> */} <Button onClick={this.cancelConfig}>鍏抽棴</Button> </div> } style={{ width: '100%' }}> @@ -765,7 +765,7 @@ </div> </DndProvider> {/* 杩斿洖鏃舵湭淇濆瓨鎻愮ず */} - <Modal + {/* <Modal bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} closable={false} maskClosable={false} @@ -779,7 +779,7 @@ destroyOnClose > 閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� - </Modal> + </Modal> */} {this.state.loading && <Spin size="large" />} </div> ) diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index 83c366d..533f446 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Row, Col, Select, Radio, Tooltip, Input, notification } from 'antd' +import { Form, Row, Col, Select, Radio, Tooltip, Input } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import Api from '@/api' @@ -146,7 +146,7 @@ } onOptionChange = (value, key) => { - const { verify, setting } = this.props + const { verify } = this.props let _verify = {...verify, [key]: value} @@ -173,15 +173,6 @@ if (this.state.selectTemp) { this.setState({selectTemp: null}) } - } - - if (verify.invalid !== 'true' && _verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) { - notification.warning({ - top: 92, - message: '鏁版嵁婧愪腑鑷畾涔夎剼鏈繃浜庡鏉傦紝涓嶈兘浣跨敤澶辨晥楠岃瘉锛�', - duration: 5 - }) - return } this.props.onChange(_verify) @@ -320,8 +311,13 @@ </Form.Item> </Col> : null} {card.intertype !== 'inner' ? <Col span={8}> - <Form.Item label={'澶辨晥楠岃瘉'}> - <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}> + <Form.Item label={ + verify.limitText ? <Tooltip placement="bottomLeft" title={verify.limitText}> + <QuestionCircleOutlined className="mk-form-tip" /> + 澶辨晥楠岃瘉 + </Tooltip> : '澶辨晥楠岃瘉' + }> + <Radio.Group value={verify.invalid} disabled={verify.limitInvalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}> <Radio value="true">寮�鍚�</Radio> <Radio value="false">涓嶅紑鍚�</Radio> </Radio.Group> diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index df7c6dc..0c16e8e 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -42,7 +42,6 @@ activeKey: 'base', appType: sessionStorage.getItem('appType'), notes: [], // 鐭俊妯℃澘 - setting: null, verify: {}, fields: [], usefulfields: '', @@ -540,15 +539,27 @@ const { appType } = this.state let _verify = fromJS(card.verify || {}).toJS() - let _invalid = _verify.invalid + let _invalid = _verify.invalid || 'true' - if (!_invalid) { // 閫夋嫨琛屾椂锛屽け鏁堥獙璇侀粯璁ゅ紑鍚� - if (config.setting && config.setting.maxScript && config.setting.maxScript >= 300) { - _invalid = 'false' - } else { - _invalid = card.Ot !== 'notRequired' ? 'true' : 'false' - } + _verify.limitInvalid = false + if (config.wrap && config.wrap.datatype === 'static') { + _verify.limitInvalid = true + _verify.limitText = '闈欐�佹暟鎹簮锛屼笉鍙娇鐢ㄥけ鏁堥獙璇�' + _invalid = 'false' + } else if (config.setting && config.setting.maxScript && config.setting.maxScript >= 300) { + _verify.limitInvalid = true + _verify.limitText = '鏁版嵁婧愪腑鑷畾涔夎剼鏈繃浜庡鏉傦紝涓嶈兘浣跨敤澶辨晥楠岃瘉锛�' + _invalid = 'false' + } else if (card.sqlType === 'insert') { + _verify.limitInvalid = true + _verify.limitText = '鎸夐挳鎿嶄綔绫诲瀷涓恒�婃坊鍔犮�嬫椂锛屼笉鑳戒娇鐢ㄥけ鏁堥獙璇侊紒' + _invalid = 'false' + } else if (card.Ot === 'notRequired') { + _verify.limitInvalid = true + _verify.limitText = '鎸夐挳銆婁笉閫夋嫨琛屻�嬫椂锛屼笉鑳戒娇鐢ㄥけ鏁堥獙璇侊紒' + _invalid = 'false' } + if (card.sqlType === 'custom') { // 鑷畾涔夐獙璇佹椂锛屼笉浣跨敤榛樿sql _verify.default = 'false' } @@ -621,7 +632,6 @@ this.setState({ activeKey: activeKey, verifyInter: verifyInter, - setting: config.setting || {}, verify: _verify, oriVerify: fromJS(_verify).toJS() }) @@ -1424,7 +1434,7 @@ handleConfirm = () => { const { card } = this.props - const { setting, activeKey } = this.state + const { activeKey } = this.state let verify = fromJS(this.state.verify).toJS() if (activeKey === 'base') { @@ -1446,13 +1456,6 @@ notification.warning({ top: 92, message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒', - duration: 5 - }) - return - } else if (verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) { - notification.warning({ - top: 92, - message: '鏁版嵁婧愪腑鑷畾涔夎剼鏈繃浜庡鏉傦紝涓嶈兘浣跨敤澶辨晥楠岃瘉锛�', duration: 5 }) return @@ -1485,6 +1488,9 @@ }) }) } + + delete verify.limitInvalid + delete verify.limitText if (msg) { confirm({ @@ -1549,7 +1555,7 @@ render() { const { card, columns } = this.props - const { activeKey, verifyInter, setting, verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state + const { activeKey, verifyInter, verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -1571,7 +1577,7 @@ {verify.default === 'false' ? <span className="count-tip"><ExclamationOutlined style={{color: 'orange'}}/></span> : null} </span> } key="base"> - <BaseForm card={card} appType={appType} columns={columns} unionFields={unionFields} setting={setting} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/> + <BaseForm card={card} appType={appType} columns={columns} unionFields={unionFields} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/> </TabPane> : null} {verifyInter === 'system' ? <TabPane tab={ <span> diff --git a/src/utils/utils.js b/src/utils/utils.js index 74db930..f2d3e00 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1372,7 +1372,7 @@ * @return {Array} columns 鏄剧ず鍒� * @return {Boolean} retmsg 鏄惁闇�瑕佹暟鎹繑鍥� */ -export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false, moduleParams, getOptions) { +export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false, moduleParams) { let primaryId = param.ID let BID = param.BID || '' let verify = btn.verify || {} @@ -1622,47 +1622,9 @@ } // 澶辨晥楠岃瘉锛屾坊鍔犳暟鎹椂涓嶇敤 - if (btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && verify.invalid === 'true' && setting.dataresource) { - let datasource = setting.dataresource - let customScript = setting.customScript || '' - let search = moduleParams ? moduleParams.search : null - let orderBy = moduleParams ? moduleParams.orderBy : setting.order - - if (/\s/.test(datasource) && !/tb$/.test(datasource)) { // 鎷兼帴鍒悕 - datasource = '(' + datasource + ') tb' - } - - if (getOptions && (setting.queryType === 'statistics' || customScript)) { - let allSearch = getOptions(search) - - let regoptions = allSearch.map(item => { - return { - reg: new RegExp('@' + item.key + '@', 'ig'), - value: `'${item.value}'` - } - }) - regoptions.push({ - reg: new RegExp('@userName@', 'ig'), - value: `'${userName}'` - }, { - reg: new RegExp('@fullName@', 'ig'), - value: `'${fullName}'` - }, { - reg: new RegExp('@orderBy@', 'ig'), - value: orderBy - }, { - reg: new RegExp('@pageSize@', 'ig'), - value: 999999 - }, { - reg: new RegExp('@pageIndex@', 'ig'), - value: 1 - }) - - regoptions.forEach(item => { - datasource = datasource.replace(item.reg, item.value) - customScript = customScript.replace(item.reg, item.value) - }) - } + if (verify.invalid === 'true' && moduleParams && moduleParams.dataresource) { + let datasource = moduleParams.dataresource + let customScript = moduleParams.customScript || '' if (customScript) { _sql += ` @@ -1872,7 +1834,7 @@ let hasvoucher = false // 鍑瘉-鏄剧ず鍒椾腑閫夊彇,蹇呴』閫夎 - if (verify.voucher && verify.voucher.enabled && data) { + if (verify.voucher && verify.voucher.enabled) { let _voucher = verify.voucher hasvoucher = true @@ -1880,7 +1842,7 @@ _sql += ` /* 鍒涘缓鍑瘉 */ exec s_BVoucher_Create - @Bill ='${_data[_voucher.linkField.toLowerCase()]}', + @Bill ='${_data[_voucher.linkField.toLowerCase()] || ''}', @BVoucherType ='${_voucher.BVoucherType}', @VoucherTypeOne ='${_voucher.VoucherTypeOne}', @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', -- Gitblit v1.8.0