From 461e4fff4b51d067671244eec63b097cd9012b6e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 30 三月 2020 09:25:41 +0800 Subject: [PATCH] 2020-03-30 --- src/templates/zshare/verifycard/index.jsx | 138 ++++++++- src/components/sidemenu/editthdmenu/index.jsx | 85 ++++- src/templates/comtableconfig/index.jsx | 65 ++- src/templates/subtableconfig/index.jsx | 53 +++ src/templates/subtableconfig/index.scss | 2 src/store/options.js | 2 src/templates/zshare/dragelement/card.jsx | 2 src/templates/comtableconfig/index.scss | 2 src/tabviews/zshare/actionList/index.jsx | 148 ++++++---- src/templates/zshare/createinterface/index.jsx | 284 ++++++++++---------- src/locales/zh-CN/comtable.js | 1 src/locales/en-US/comtable.js | 1 src/views/login/index.jsx | 36 +- 13 files changed, 535 insertions(+), 284 deletions(-) diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index 45b631b..34483e1 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/src/components/sidemenu/editthdmenu/index.jsx @@ -130,23 +130,23 @@ delete _menu.src delete _menu.text - if (!this.state.fstMenuId) { - notification.warning({ - top: 92, - message: '鏈幏鍙栧埌涓�绾ц彍鍗曚俊鎭紝璇风◢绛夋垨鍒锋柊閲嶈瘯銆�', - duration: 10 - }) - return - } - - _menu.ParentID = this.props.supMenu.MenuID - _menu.supMenuList = this.props.supMenuList - _menu.fstMenuId = this.state.fstMenuId - _menu.fstMenuList = this.state.fstMenuList - _menu.roleList = this.state.roleList - if (_menu.PageParam && _menu.PageParam.Template === 'RolePermission') { // 鍗曢〉闈慨鏀� _menu.Template = _menu.PageParam.Template + + if (!this.state.fstMenuId) { + notification.warning({ + top: 92, + message: '鑿滃崟鍔犺浇涓紝璇风◢鍚庨噸璇曪紒', + duration: 10 + }) + return + } + + _menu.ParentID = this.props.supMenu.MenuID + _menu.supMenuList = this.props.supMenuList + _menu.fstMenuId = this.state.fstMenuId || '' + _menu.fstMenuList = this.state.fstMenuList || [] + _menu.roleList = this.state.roleList this.setState({ handleMVisible: true, @@ -179,7 +179,11 @@ } _menu.LongParam = _LongParam - + _menu.ParentID = this.props.supMenu.MenuID + _menu.supMenuList = this.props.supMenuList + _menu.fstMenuId = this.state.fstMenuId || '' + _menu.fstMenuList = this.state.fstMenuList || [] + _menu.roleList = this.state.roleList // 妫�娴嬫ā鏉挎槸鍚﹀瓨鍦� let _Template = this.state.sysTemplates.filter(temp => temp.type === _menu.PageParam.Template) @@ -200,7 +204,7 @@ }, () => { document.getElementById('root').style.overflowY = 'hidden' }) - } else { + } else if (_menu.fstMenuId) { this.setState({ type: 'edit', editMenu: _menu, @@ -209,6 +213,13 @@ tabview: _menu.PageParam.Template }, () => { document.getElementById('root').style.overflowY = 'hidden' + }) + } else { + _menu.loadingFstMenuId = true + this.setState({ + type: 'edit', + editMenu: _menu, + optionLibs: new Map() }) } } else { @@ -240,7 +251,7 @@ if (!this.state.fstMenuId) { notification.warning({ top: 92, - message: '鏈幏鍙栧埌涓�绾ц彍鍗曚俊鎭紝璇风◢绛夋垨鍒锋柊閲嶈瘯', + message: '鑿滃崟鍔犺浇涓紝璇风◢鍚庨噸璇曪紒', duration: 10 }) return @@ -418,11 +429,25 @@ * 2銆佷娇鐢ㄥ凡鏈夎彍鍗曟ā鏉挎椂锛岃幏鍙栬彍鍗曢厤缃俊鎭紝鏍囪涓簎ser锛堝鍒惰彍鍗曟寜閽級 */ useTemplate = (template, useType) => { - const { editMenu } = this.state + let editMenu = JSON.parse(JSON.stringify(this.state.editMenu)) + + if (!this.state.fstMenuId) { + notification.warning({ + top: 92, + message: '鑿滃崟鍔犺浇涓紝璇风◢鍚庨噸璇曪紒', + duration: 10 + }) + return + } + + if (!editMenu.fstMenuId) { + editMenu.fstMenuId = this.state.fstMenuId + editMenu.fstMenuList = this.state.fstMenuList + } if (useType === 'sys' && template.type === 'RolePermission') { // 鐙珛椤甸潰 let _menu = { - ...template, + ...editMenu, MenuID: Utils.getuuid(), MenuName: template.title, Template: template.type, @@ -711,6 +736,26 @@ Promise.all([menuDefer, roleDefer]).then(() => { this.setState({ loading: false + }, () => { + let _menu = JSON.parse(JSON.stringify(this.state.editMenu)) + + if (!_menu || !_menu.loadingFstMenuId) { + return + } + + delete _menu.loadingFstMenuId + _menu.fstMenuId = this.state.fstMenuId + _menu.fstMenuList = this.state.fstMenuList + + this.setState({ + type: 'edit', + editMenu: _menu, + loading: false, + optionLibs: new Map(), // 缂栬緫鏃讹紝鍒濆鍖栦负绌� + tabview: _menu.PageParam.Template + }, () => { + document.getElementById('root').style.overflowY = 'hidden' + }) }) }) } diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 85d6061..12d7e5d 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -46,6 +46,7 @@ 'header.menu.openType.newWindow': 'A new window', 'header.menu.newpage.service': 'Customer Service', 'header.menu.func.create': '鍒涘缓瀛樺偍杩囩▼', + 'header.menu.interface.create': '鍒涘缓鎺ュ彛', 'header.menu.tab': '鏍囩椤�', 'header.menu.tab.subtable': '瀛愯〃', 'header.menu.datasource': '鏁版嵁鏉ユ簮', diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index e83547b..2f3fdd7 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -46,6 +46,7 @@ 'header.menu.openType.newWindow': '鏂扮獥鍙�', 'header.menu.newpage.service': '瀹㈡湇', 'header.menu.func.create': '鍒涘缓瀛樺偍杩囩▼', + 'header.menu.interface.create': '鍒涘缓鎺ュ彛', 'header.menu.tab': '鏍囩椤�', 'header.menu.tab.subtable': '瀛愯〃', 'header.menu.datasource': '鏁版嵁鏉ユ簮', diff --git a/src/store/options.js b/src/store/options.js index 235c8f5..3bdae57 100644 --- a/src/store/options.js +++ b/src/store/options.js @@ -1,6 +1,6 @@ // 绯荤粺閰嶇疆 export default { - systemType: 'local', // Cloud 銆� SSO 銆� local, 浜戠浣跨敤绯荤粺閰嶇疆appId + systemType: 'local', // cloud 銆� SSO 銆� local, 浜戠浣跨敤绯荤粺閰嶇疆appId AppId: '201912040924165801464FF1788654BC5AC73', cloudServiceApi: 'http://cloud.mk9h.cn/webapi/dostars', cloudLoginApi: 'http://cloud.mk9h.cn/webapi/dologon' diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index db47fb5..70767bc 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -78,7 +78,7 @@ notification.warning({ top: 92, message: '闇�瑕佷笂绾т富閿�硷紒', - duration: 10 + duration: 5 }) return } @@ -95,7 +95,7 @@ notification.warning({ top: 92, message: this.props.dict['main.action.confirm.selectline'], - duration: 10 + duration: 5 }) return } else if (item.Ot === 'requiredSgl' && data.length !== 1) { @@ -103,7 +103,7 @@ notification.warning({ top: 92, message: this.props.dict['main.action.confirm.selectSingleLine'], - duration: 10 + duration: 5 }) return } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { @@ -111,7 +111,7 @@ notification.warning({ top: 92, message: '鏈缃富閿紒', - duration: 10 + duration: 5 }) return } @@ -154,7 +154,7 @@ notification.warning({ top: 92, message: '瀵煎嚭鎸夐挳閰嶇疆閿欒锛�', - duration: 10 + duration: 5 }) return } @@ -173,7 +173,7 @@ notification.warning({ top: 92, message: 'excel瀵煎叆楠岃瘉淇℃伅鏈缃紒', - duration: 10 + duration: 5 }) } } else if (item.OpenType === 'popview' && this.props.type !== 'subtab') { @@ -182,7 +182,7 @@ notification.warning({ top: 92, message: '寮圭獥椤甸潰涓嶆敮鎸佹璁剧疆锛�', - duration: 10 + duration: 5 }) } else if (item.OpenType === 'innerpage') { let Id = data[0][setting.primaryKey] @@ -196,7 +196,7 @@ notification.warning({ top: 92, message: '椤甸潰绫诲瀷璁剧疆閿欒锛�', - duration: 10 + duration: 5 }) } } else if (item.OpenType === 'outerpage') { @@ -245,7 +245,7 @@ notification.warning({ top: 92, message: '瀹屽杽涓�傘�傘��', - duration: 10 + duration: 5 }) } } @@ -267,7 +267,7 @@ notification.warning({ top: 92, message: '璇峰畬鍠勬墦鍗伴獙璇佷俊鎭紒', - duration: 15 + duration: 5 }) return } @@ -393,6 +393,12 @@ execCustomPrint = (item, printlist, formdata) => { this.setState({loadingUuid: ''}) + this.execSuccess(item, { + ErrCode: '-1', + message: '', + ErrMesg: '', + status: true + }) try { // eslint-disable-next-line @@ -400,11 +406,19 @@ func(printlist, formdata, item.verify, notification) } catch (e) { console.warn(e) - notification.warning({ - top: 92, - message: '鑷畾涔夊嚱鏁版墽琛岄敊璇紒', - duration: 10 - }) + + try { + // eslint-disable-next-line + let evalfunc = eval('(true && function (data, form, printer, notification) {' + item.verify.printFunc + '})') + evalfunc(printlist, formdata, item.verify, notification) + } catch (error) { + console.warn(error) + notification.warning({ + top: 92, + message: '鑷畾涔夊嚱鏁版墽琛岄敊璇紒', + duration: 5 + }) + } } } @@ -583,7 +597,6 @@ }).then(response => { if (!response) return - response = {"status":true,"message":"","ErrCode":"","ErrMesg":"","CpCode":"YTO","InsideBill":"202003261727348572C0D0C2C0E444FD0B42A","PrintData":"{\"data\":{\"CpCode\":\"YTO\",\"WayBillCode\":\"YT2045589280491\",\"InsideBill\":\"19042003260002\",\"RecvInfo\":\"寮犲厛鐢� 137147852 \\r\\n娌冲寳鐪佷繚瀹氬競绔炵鍖�001\",\"SendInfo\":\"瀹濇椂寰楃鎶�锛堜腑鍥斤級鏈夐檺鍏徃 0512-65152888-5147 \\r\\n瀹濇椂寰楃鎶�锛堜腑鍥斤級鏈夐檺鍏徃锛圔鍖猴級鑻忓窞宸ヤ笟鍥尯涓滄椇璺�18鍙穃",\"BigShot\":\"176淇濆畾\",\"GatherCenterCode\":\"311911\",\"GatherCenterName\":\"\",\"CustomData\":\"wu800*2\\\\r\\\\n\",\"Pin\":\"\"},\"templateURL\":\"http://css.positecgroup.com/template/yto.srt\",\"ectype\":\"jdpop\"}","CustomData":""} if (response.status) { _list.push(response) @@ -844,12 +857,13 @@ }) if (list.length === 0) { - notification.warning({ - top: 92, - message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�', - duration: 10 - }) this.setState({loadingUuid: ''}) + this.execError({ + ErrCode: 'N', + message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�', + ErrMesg: '', + status: false + }, item) return } else if (_errors.length > 0) { let lackerror = [] @@ -873,12 +887,13 @@ msg.push(emptyerror.join(' ; ')) } - notification.warning({ - top: 92, - message: msg.join(' ; ') + ' !', - duration: 10 - }) this.setState({loadingUuid: ''}) + this.execError({ + ErrCode: 'N', + message: msg.join(' ; ') + ' !', + ErrMesg: '', + status: false + }, item) return } @@ -900,10 +915,11 @@ }) this.setState({loadingUuid: ''}) - notification.success({ - top: 92, - message: '鎵撳嵃璇锋眰宸插彂鍑恒��', - duration: 2 + this.execSuccess(item, { + ErrCode: 'S', + message: '', + ErrMesg: '鎵撳嵃璇锋眰宸插彂鍑恒��', + status: true }) } } @@ -922,10 +938,11 @@ }) this.setState({loadingUuid: ''}) - notification.success({ - top: 92, - message: '鎵撳嵃璇锋眰宸插彂鍑恒��', - duration: 2 + this.execSuccess(item, { + ErrCode: 'S', + message: '', + ErrMesg: '鎵撳嵃璇锋眰宸插彂鍑恒��', + status: true }) } } @@ -937,12 +954,14 @@ try { data = JSON.parse(event.data) } catch { - notification.warning({ - top: 92, - message: event.data, - duration: 10 - }) this.setState({loadingUuid: ''}) + this.execError({ + ErrCode: 'N', + message: event.data, + ErrMesg: '', + status: false + }, item) + data = '' } } @@ -956,28 +975,31 @@ }) this.setState({loadingUuid: ''}) - notification.success({ - top: 92, - message: '鎵撳嵃璇锋眰宸插彂鍑恒��', - duration: 2 + this.execSuccess(item, { + ErrCode: 'S', + message: '', + ErrMesg: '鎵撳嵃璇锋眰宸插彂鍑恒��', + status: true }) } else if (data && data.message && !data.status) { - notification.warning({ - top: 92, - message: data.message, - duration: 10 - }) this.setState({loadingUuid: ''}) + this.execError({ + ErrCode: 'N', + message: data.message, + ErrMesg: '', + status: false + }, item) } } socket.onerror = () => { - notification.warning({ - top: 92, - message: '鏃犳硶杩炴帴鍒�:' + item.verify.linkUrl, - duration: 10 - }) this.setState({loadingUuid: ''}) + this.execError({ + ErrCode: 'N', + message: '鏃犳硶杩炴帴鍒�:' + item.verify.linkUrl, + ErrMesg: '', + status: false + }, item) } } @@ -1068,7 +1090,7 @@ notification.warning({ top: 92, message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', - duration: 10 + duration: 5 }) return } @@ -1534,7 +1556,7 @@ notification.warning({ top: 92, message: this.props.dict['main.action.settingerror'], - duration: 10 + duration: 5 }) } @@ -1572,7 +1594,7 @@ notification.warning({ top: 92, message: res.message, - duration: 10 + duration: 5 }) this.setState({ execAction: null, @@ -1583,7 +1605,7 @@ notification.warning({ top: 92, message: '鏈幏鍙栧埌鎸夐挳閰嶇疆淇℃伅锛�', - duration: 10 + duration: 5 }) this.setState({ execAction: null, @@ -1733,7 +1755,7 @@ notification.warning({ top: 92, message: error.message, - duration: 10 + duration: 5 }) } @@ -1757,19 +1779,19 @@ notification.warning({ top: 92, message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬩笉瀛樺湪锛�', - duration: 10 + duration: 5 }) } else if (errors === 'empty') { notification.warning({ top: 92, message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬩负绌猴紒', - duration: 10 + duration: 5 }) } else if (errors === 'headerError') { notification.warning({ top: 92, message: '宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬭〃澶磋缃敊璇紒', - duration: 10 + duration: 5 }) } @@ -1780,7 +1802,7 @@ notification.warning({ top: 92, message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + btn.verify.sheet + '銆嬫暟鎹紒', - duration: 10 + duration: 5 }) return } @@ -1790,7 +1812,7 @@ notification.warning({ top: 92, message: result.errors, - duration: 10 + duration: 5 }) return } diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 7f749bd..1b241b7 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -33,7 +33,7 @@ import TransferForm from '@/components/transferform' import SourceElement from '@/templates/zshare/dragelement/source' import CreateFunc from '@/templates/zshare/createfunc' -// import CreateInterface from '@/templates/zshare/createinterface' +import CreateInterface from '@/templates/zshare/createinterface' import Source from './source' import './index.scss' @@ -1098,30 +1098,47 @@ const { menu } = this.props const { config } = this.state - this.settingRef.handleConfirm().then(setting => { - if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { - let param = { - func: 's_DataSrc_Save', - LText: setting.dataresource, - MenuID: menu.MenuID + this.menuformRef.handleConfirm().then(res => { + this.settingRef.handleConfirm().then(setting => { + if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { + let param = { + func: 's_DataSrc_Save', + LText: setting.dataresource, + MenuID: menu.MenuID + } + + param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + Api.getLocalConfig(param) } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - Api.getLocalConfig(param) - } - - // let _config = {...config, setting: setting} - - // this.refs.tableCreatInterface.exec(setting.innerFunc, newLText, DelText).then(result => { - // if (result === 'success') { - // this.setState({ - // config: {...config, setting: setting} - // }) - // } - // }) + if (setting.interType !== 'inner' || setting.innerFunc) { + notification.warning({ + top: 92, + message: '鎺ュ彛绫诲瀷涓�-鍐呴儴锛屼笖涓嶅瓨鍦ㄥ唴閮ㄥ嚱鏁版椂锛屾墠鍙互鍒涘缓鎺ュ彛锛�', + duration: 10 + }) + return + } + + let _config = {...config, setting: setting} + let _menu = { + type: 'main', + MenuID: menu.MenuID, + menuName: res.menuName, + menuNo: res.menuNo + } + + this.refs.tableCreatInterface.exec(_menu, _config).then(result => { + if (result === 'success') { + this.setState({ + config: _config + }) + } + }) + }) }) } @@ -3092,7 +3109,7 @@ }) }} footer={[ - // <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, + <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>, <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> diff --git a/src/templates/comtableconfig/index.scss b/src/templates/comtableconfig/index.scss index 46ac2f6..fa41b5f 100644 --- a/src/templates/comtableconfig/index.scss +++ b/src/templates/comtableconfig/index.scss @@ -262,7 +262,7 @@ padding: 0px 20px 15px; min-height: 82px; > .ant-row { - min-height: 67px; + min-height: 80px; } .page-card { display: inline-block; diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 232fcc2..4cb409d 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -30,6 +30,7 @@ import TransferForm from '@/components/transferform' import SourceElement from '@/templates/zshare/dragelement/source' import CreateFunc from '@/templates/zshare/createfunc' +import CreateInterface from '@/templates/zshare/createinterface' import Source from './source' import './index.scss' @@ -2012,6 +2013,57 @@ } } + /** + * @description 鍒涘缓琛ㄦ牸鎺ュ彛 + */ + tableCreatInterface = () => { + const { config } = this.state + + this.menuformRef.handleConfirm().then(res => { + this.settingRef.handleConfirm().then(setting => { + + if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { + let param = { + func: 's_DataSrc_Save', + LText: setting.dataresource, + MenuID: config.uuid + } + + param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + Api.getLocalConfig(param) + } + + if (setting.interType !== 'inner' || setting.innerFunc) { + notification.warning({ + top: 92, + message: '鎺ュ彛绫诲瀷涓�-鍐呴儴锛屼笖涓嶅瓨鍦ㄥ唴閮ㄥ嚱鏁版椂锛屾墠鍙互鍒涘缓鎺ュ彛锛�', + duration: 10 + }) + return + } + + let _config = {...config, setting: setting} + let _menu = { + type: 'subtable', + MenuID: config.uuid, + menuName: res.tabName, + menuNo: res.tabNo + } + + this.refs.tableCreatInterface.exec(_menu, _config).then(result => { + if (result === 'success') { + this.setState({ + config: _config + }) + } + }) + }) + }) + } + pasteSubmit = () => { this.pasteFormRef.handleConfirm().then(res => { if (res.copyType !== 'action') { @@ -2386,6 +2438,7 @@ }) }} footer={[ + <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>, <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> diff --git a/src/templates/subtableconfig/index.scss b/src/templates/subtableconfig/index.scss index 59a199c..629477c 100644 --- a/src/templates/subtableconfig/index.scss +++ b/src/templates/subtableconfig/index.scss @@ -261,7 +261,7 @@ padding: 0px 20px 15px; min-height: 82px; > .ant-row { - min-height: 67px; + min-height: 80px; } .page-card { display: inline-block; diff --git a/src/templates/zshare/createinterface/index.jsx b/src/templates/zshare/createinterface/index.jsx index bb867db..aab31f6 100644 --- a/src/templates/zshare/createinterface/index.jsx +++ b/src/templates/zshare/createinterface/index.jsx @@ -17,27 +17,144 @@ loading: false, } - exec = (innerFunc, newLText, DelText) => { + exec = (menu, config) => { + let _grid = [] + let _fields = [] + let _index = 1 + + config.columns.forEach(item => { + if (!item.field || item.type === 'colspan') return + + let _type = `nvarchar(${item.fieldlength || 50})` + + if (item.type === 'number') { + _type = `decimal(18,${item.decimal ? item.decimal : 0})` + } else if (item.type === 'picture' || item.type === 'textarea') { + _type = `nvarchar(${item.fieldlength || 512})` + } + + _grid.push(item.field) + _fields.push(`select '${item.field}' as gridfield,'${_type}' as fieldtype,'${item.label}' as label,'${_index}' as Sort`) + _index++ + }) + + let _search = [] + _index = 1 + + if (menu.type !== 'main') { + if (config.setting.dataresource && /@BID@/ig.test(config.setting.dataresource)) { + _search.push(`select 'BID' as searchfield,'BID' as label,'0' as Sort,'' as defaultvalue,'required' as DefaultType`) + _index++ + } else { + _search.push(`select 'BID' as searchfield,'BID' as label,'0' as Sort,'' as defaultvalue,'' as DefaultType`) + _index++ + } + } + + let _fieldMap = new Map() + + config.search.forEach(item => { + let fields = [item.field] + let _val = item.initval + + if (item.type === 'text') { + fields = item.field.split(',') + } + if (/^date/ig.test(item.type)) { + _val = '' + } + + if (item.type === 'datemonth' || item.type === 'dateweek' || item.type === 'daterange') { + fields = [item.field, item.field] + } + + fields.forEach(cell => { + let _field = cell + if (_fieldMap.has(cell)) { + _field = _field + '1' + } + + _fieldMap.set(cell, true) + + _search.push(`select '${_field}' as searchfield,'${item.label}' as label,'${_index}' as Sort,'${_val}' as defaultvalue,'${item.required === 'true' ? 'required' : ''}' as DefaultType`) + _index++ + }) + }) + + let searchText = [] + _fieldMap = new Map() + + config.search.forEach((item, i) => { + if (item.type === 'text') { + let str = item.match === '=' ? '' : '\'%\'' + let _fields_ = item.field.split(',').map(field => { // 缁煎悎鎼滅储锛屾墍瀛楁鎷兼帴 + + return field + ' ' + item.match + ` ${str ? str + '+' : ''}@` + field + `@${str ? '+' + str : ''}` + }) + + if (_fields_.length === 1) { + searchText.push(_fields_[0]) + } else { + searchText.push('(' + _fields_.join(' OR ') + ')') + } + } else if (item.type === 'select') { + + searchText.push(item.field + ' ' + item.match + ' @' + item.field + '@') + } else if (item.type === 'multiselect') { + + searchText.push(`@${item.field}@ ` + item.match + ' \'%\'+' + item.field + '+\'%\'') + } else if (item.type === 'date') { + let _field = item.field + if (_fieldMap.has(item.field)) { + _field = _field + '1' + } + + _fieldMap.set(item.field, true) + + searchText.push(item.field + ' ' + item.match + ' @' + _field + '@') + } else if (item.type === 'datemonth' || item.type === 'dateweek' || item.type === 'daterange') { + + searchText.push('(' + item.field + ' >= @' + item.field + '@ AND ' + item.field + ' < @' + item.field + '1@)') + } else { + searchText.push(item.field + ' ' + item.match + ' @' + item.field + '@') + } + }) + + let param = { + func: 's_get_para_for_out', + Menuid: menu.MenuID, + Menuname: menu.menuName, + Menuno: menu.menuNo, + Ltextgridparam: _fields.join(' union all '), + Ltextsearchparam: _search.join(' union all '), + AppendWhere: config.setting.queryType === 'query' ? searchText.join(' AND ') : '', + Ltextgrid: _grid.join(','), + WhereType: config.setting.queryType === 'statistics' ? 'Statistics' : 'query', + OrderCol: config.setting.order + } + + param.Ltextsearchparam = Utils.formatOptions(param.Ltextsearchparam) + param.AppendWhere = Utils.formatOptions(param.AppendWhere) + + param.Ltextgridparam = Utils.formatOptions(param.Ltextgridparam) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.secretkey = Utils.encrypt(param.Ltextgridparam, param.timestamp) + this.setState({ loading: true }) return new Promise(resolve => { - this.createExec(resolve, innerFunc, newLText, DelText) + this.createExec(resolve, param) }) } - createExec = (_resolve, innerFunc, newLText, DelText) => { - let isExist = false // 瀛樺偍杩囩▼鏄惁瀛樺湪 - let cloudText = '' // 浜戠瀛樺偍缁撴灉 - let localfunc = '' // 鏈湴瀛樺偍杩囩▼ + createExec = (_resolve, param) => { + let _mainParam = JSON.parse(JSON.stringify(param)) new Promise(resolve => { // 鑾峰彇浜戠瀛樺偍杩囩▼淇℃伅 - Api.getSystemConfig({ - func: 'sPC_Get_TVP', - TVPName: innerFunc - }).then(result => { + Api.getLocalConfig(param).then(result => { if (!result.status) { notification.warning({ top: 92, @@ -46,156 +163,41 @@ }) resolve(false) } else { - cloudText = result.TVPText resolve(true) } }) }).then(res => { - if (!res) return res - // 鑾峰彇鏈湴瀛樺偍杩囩▼淇℃伅 + if (res === false) return res - let _param = { - func: 's_get_userproc', - LText: innerFunc + if (window.GLOB.mainSystemApi) { + _mainParam.rduri = window.GLOB.mainSystemApi + + return Api.getLocalConfig(_mainParam) } - _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) + return 'success' + }).then(result => { + if (result === false || result === 'success') return result - return Api.getLocalConfig(_param) - }).then(res => { - if (!res) return res - - // 澶勭悊鏈湴缁撴灉 - if (!res.status) { + if (!result.status) { notification.warning({ top: 92, - message: res.message, + message: result.message, duration: 10 }) return false } else { - isExist = true - localfunc = Utils.formatOptions(res.Ltext) - return true + return 'success' } }).then(res => { - if (!res) return res - - // 鏍规嵁鏈湴鍙婅繙绔粨鏋滃垽鏂墽琛屽姩浣� - if ((newLText === localfunc) && (newLText === cloudText)) { - return 'drop' - } else if (!localfunc || (cloudText === localfunc)) { - // 鏈湴瀛樺偍杩囩▼涓嶅瓨鍦紝鎴栦簯绔拰鏈湴瀛樺偍杩囩▼涓�鑷存椂锛屽皢鏂扮殑瀛樺偍杩囩▼鏇存柊鑷充簯绔� - return Api.getSystemConfig({ - func: 'sPC_TVP_InUp', - TVPName: innerFunc, - TVPText: newLText, - TypeName: 'P' - }) - } else { - return new Promise(resolve => { - Api.getSystemConfig({ // 娣诲姞鐜版湁鐨勬湰鍦板瓨鍌ㄨ繃绋嬭嚦浜戠 - func: 'sPC_TVP_InUp', - TVPName: innerFunc, - TVPText: localfunc, - TypeName: 'P' - }).then(result => { - if (result.status) { - Api.getSystemConfig({ - func: 'sPC_TVP_InUp', // 娣诲姞鏈�鏂扮殑瀛樺偍杩囩▼鑷充簯绔� - TVPName: innerFunc, - TVPText: newLText, - TypeName: 'P' - }).then(response => { - resolve(response) - }) - } else { - resolve(result) - } - }) - }) - } - }).then(res => { - if (!res || res === 'drop') return res - - // 澶勭悊浜戠鏇存柊缁撴灉 - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 10 - }) - return false - } else if (isExist) { - return 'drop' - } else { - return 'create' - } - }).then(res => { - if (!res || res === 'create') return res - - // 鍒犻櫎瀛樺偍杩囩▼ - let _param = { - func: 'sPC_TableData_InUpDe', - LText: DelText, - TypeCharOne: 'proc' // 鍒犻櫎鎴栧垱寤哄瓨鍌ㄨ繃绋嬫爣蹇� - } - - _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - - return Api.getLocalConfig(_param) - }).then(res => { - if (!res || res === 'create') return res - - // 鍒犻櫎缁撴灉澶勭悊 - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 10 - }) - return false - } else { - return true - } - }).then(res => { - if (!res) return res - - // 鏂板缓瀛樺偍杩囩▼ - let _param = { - func: 'sPC_TableData_InUpDe', - LText: newLText, - TypeCharOne: 'proc' - } - _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - - return Api.getLocalConfig(_param) - }).then(res => { - if (!res) return res - - // 澶勭悊鏂板缓缁撴灉 - if (!res.status) { - notification.warning({ - top: 92, - message: res.message, - duration: 10 - }) - return false + // 缁撴灉澶勭悊 + if (res === false) { + _resolve('error') } else { notification.success({ top: 92, message: '鍒涘缓鎴愬姛', duration: 2 }) - return true - } - }).then(res => { - // 缁撴灉澶勭悊 - if (!res) { - _resolve('error') - } else { _resolve('success') } @@ -209,11 +211,11 @@ return ( <Button - className="mk-btn mk-purple" + className="mk-btn mk-green" onClick={this.props.trigger} loading={this.state.loading} > - {this.props.dict['header.menu.func.create']} + {this.props.dict['header.menu.interface.create']} </Button> ) } diff --git a/src/templates/zshare/dragelement/card.jsx b/src/templates/zshare/dragelement/card.jsx index 9037fc1..6cb7159 100644 --- a/src/templates/zshare/dragelement/card.jsx +++ b/src/templates/zshare/dragelement/card.jsx @@ -77,7 +77,7 @@ let hasProfile = false if (type === 'action') { - if (['pop', 'prompt', 'exec'].includes(card.OpenType) && card.intertype === 'inner' && !card.innerFunc) { + if (['pop', 'prompt', 'exec'].includes(card.OpenType)) { hasProfile = true } else if (card.OpenType === 'excelIn' || card.OpenType === 'excelOut') { hasProfile = true diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 6924e96..1d453bc 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -366,22 +366,27 @@ } UNSAFE_componentWillMount() { - const { columns, config } = this.props + const { columns, config, card } = this.props let _verify = this.props.card.verify || {} + let _invalid = _verify.invalid + + if (!_invalid) { // 閫夋嫨琛屾椂锛屽け鏁堥獙璇侀粯璁ゅ紑鍚� + _invalid = card.Ot !== 'notRequired' ? 'true' : 'false' + } + + _verify.default = _verify.default || 'true' + _verify.invalid = _invalid + _verify.uniques = _verify.uniques || [] + _verify.contrasts = _verify.contrasts || [] + _verify.accountdate = _verify.accountdate || 'false' + _verify.customverifys = _verify.customverifys || [] + _verify.billcodes = _verify.billcodes || [] + _verify.voucher = _verify.voucher || {enabled: false} + _verify.scripts = _verify.scripts || [] + this.setState({ - verify: { - ..._verify, - default: _verify.default || 'true', - invalid: _verify.invalid || 'false', - uniques: _verify.uniques || [], - contrasts: _verify.contrasts || [], - accountdate: _verify.accountdate || 'false', - customverifys: _verify.customverifys || [], - billcodes: _verify.billcodes || [], - voucher: _verify.voucher || {enabled: false}, - scripts: _verify.scripts || [], - } + verify: _verify }) if (this.props.card.btnType) { // 鎸夐挳-琛ㄥ崟鏍囩椤� @@ -996,6 +1001,15 @@ }) } + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + render() { const { verify, fields, uniqueColumns, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state const formItemLayout = { @@ -1009,9 +1023,14 @@ } } + let display = false + if (this.props.card.intertype === 'inner' && !this.props.card.innerFunc) { + display = true + } + return ( <div id="verify-card-box-tab"> - <Tabs defaultActiveKey="1" className="verify-card-box"> + {display ? <Tabs defaultActiveKey="1" className="verify-card-box"> <TabPane tab="鍩虹楠岃瘉" key="1"> <Form {...formItemLayout}> <Row gutter={24}> @@ -1229,7 +1248,96 @@ </Row> </Form> </TabPane> - </Tabs> + </Tabs> : null} + {!display ? <Tabs defaultActiveKey="7" className="verify-card-box"> + <TabPane tab="淇℃伅鎻愮ず" key="7"> + <Form {...formItemLayout}> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> S </span> + <Button onClick={() => {this.showError('S')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label={'鍋滅暀鏃堕棿'}> + <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> Y </span> + <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> N </span> + <Button onClick={() => {this.showError('N')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label={'鍋滅暀鏃堕棿'}> + <InputNumber defaultValue={verify.ntime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> F </span> + <Button onClick={() => {this.showError('F')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label={'鍋滅暀鏃堕棿'}> + <InputNumber defaultValue={verify.ftime || 15} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> E </span> + <Button onClick={() => {this.showError('E')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> NM </span> + <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label={'鎻愮ず缂栫爜'}> + <span className="errorval"> -1 </span> + 涓嶆彁绀� + </Form.Item> + </Col> + </Row> + </Form> + </TabPane> + </Tabs> : null} </div> ) } diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index cba3791..cd7dc49 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -95,29 +95,31 @@ let timeStamp = new Date().getTime() let _appId = window.GLOB.appId - if (options.systemType === 'Cloud') { // 浜戠浣跨敤绯荤粺閰嶇疆appid + if (options.systemType === 'cloud') { // 浜戠浣跨敤绯荤粺閰嶇疆appid _appId = options.AppId } let str = md5('MK19' + _appId + timeStamp) Api.systemauth(_appId, timeStamp).then(res => { - if (res.status && res.EPC === str) { - let box = [] - for (let i = 0; i < 15; i++) { - let s = 'mksoft' + moment().add(i, 'days').format('YYYYMMDD') - box.push(md5(s)) + if (res.status) { + if (res.EPC === str) { + let box = [] + for (let i = 0; i < 15; i++) { + let s = 'mksoft' + moment().add(i, 'days').format('YYYYMMDD') + box.push(md5(s)) + } + box = box.join(',') + localStorage.setItem('AuthCode', box) + + this.setState({ + auth: true + }) + } else { + localStorage.removeItem('AuthCode') + this.setState({ + auth: false + }) } - box = box.join(',') - localStorage.setItem('AuthCode', box) - - this.setState({ - auth: true - }) - } else { - localStorage.removeItem('AuthCode') - this.setState({ - auth: false - }) } }) -- Gitblit v1.8.0