From cc20b3cfe18b36c7b0f75937f88679eb031ecc6f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 14 八月 2023 13:41:20 +0800 Subject: [PATCH] 2023-08-14 --- src/tabviews/custom/components/card/table-card/index.jsx | 6 src/tabviews/custom/components/card/prop-card/index.jsx | 14 +- src/tabviews/custom/components/chart/antv-scatter/index.jsx | 12 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 12 src/tabviews/custom/components/code/sand-box/index.jsx | 8 src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 12 src/tabviews/custom/components/tree/antd-tree/index.jsx | 12 src/tabviews/custom/components/card/double-data-card/index.jsx | 6 src/tabviews/custom/components/chart/antv-G6/index.jsx | 8 src/tabviews/custom/components/table/normal-table/index.jsx | 6 src/templates/zshare/verifycard/index.jsx | 17 + src/tabviews/custom/components/chart/antv-pie/index.jsx | 12 src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 12 public/options.json | 15 +- src/tabviews/custom/components/carousel/data-card/index.jsx | 6 src/menu/components/share/actioncomponent/actionform/index.jsx | 10 + src/tabviews/custom/components/carousel/prop-card/index.jsx | 6 src/api/index.js | 7 src/tabviews/custom/components/calendar/index.jsx | 90 +++++++++--- src/tabviews/custom/components/card/balcony/index.jsx | 12 src/templates/zshare/verifycard/baseform/index.jsx | 49 ++++++ src/tabviews/zshare/actionList/normalbutton/index.jsx | 32 +++- src/tabviews/custom/components/chart/custom-chart/index.jsx | 12 src/tabviews/custom/components/card/data-card/index.jsx | 6 24 files changed, 248 insertions(+), 134 deletions(-) diff --git a/public/options.json b/public/options.json index f031142..0c165ca 100644 --- a/public/options.json +++ b/public/options.json @@ -1,16 +1,16 @@ { - "appId": "202108312122504607B107A83F55B40C98CCF", - "appkey": "20210831212235413F287EC3BF489424496C8", + "appId": "201912040924165801464FF1788654BC5AC73", + "appkey": "20191106103859640976D6E924E464D029CF0", "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", "systemType": "", "externalDatabase": "", "lineColor": "", "filter": "false", - "defaultApp": "mkindustry", + "defaultApp": "mk", "defaultLang": "zh-CN", - "WXAppID": "", + "WXAppID": "wx4d8a34c8d4494872", "WXminiAppID": "", - "WXNotice": "false", + "WXNotice": "true", "nginx": "true", "debugger": false, "licenseKey": "", @@ -18,6 +18,7 @@ "transfer": "false", "keepPassword": "true", "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], - "host": "http://demo.mk9h.cn", - "service": "erp_new/" + "host": "http://qingqiumarket.cn", + "service": "MKWMS/" + } \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index eb138b3..abcfa0b 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -333,14 +333,17 @@ if (!menuid) return let date = moment().format('YYYY-MM-DD HH:mm:ss') let _data = data ? JSON.stringify(data) : '' + let userid = sessionStorage.getItem('UserID') || '' - CacheUtils.writeCacheInIndexDB({menuid, CreateDate: date, LongParam: _data}) + CacheUtils.writeCacheInIndexDB({menuid: md5(menuid + userid), CreateDate: date, LongParam: _data}) } getLCacheConfig (menuid, minutes) { return new Promise((resolve, reject) => { let limit = minutes ? moment().subtract(minutes, 'minutes').format('YYYY-MM-DD HH:mm:ss') : '' - CacheUtils.getIndexDBCacheConfig(menuid).then(res => { + let userid = sessionStorage.getItem('UserID') || '' + + CacheUtils.getIndexDBCacheConfig(md5(menuid + userid)).then(res => { if (res && res.LongParam) { resolve({data: JSON.parse(res.LongParam), valid: !limit || res.CreateDate > limit}) } else { diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index bcba0e8..b79847b 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -174,14 +174,16 @@ shows.push('innerFunc') } if (this.record.callbackType === 'func') { - shows.push('callbackFunc') + shows.push('callbackFunc', 'output') + } else if (this.record.callbackType === 'script') { + shows.push('cbTable', 'output') } else if (this.record.callbackType !== 'none') { shows.push('cbTable') } reReadonly.interface = false reRequired.interface = true } else if (intertype === 'outer') { - shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType', 'output') + shows.push('procMode', 'sysInterface', 'outerFunc', 'callbackType') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { @@ -189,7 +191,9 @@ shows.push('innerFunc') } if (this.record.callbackType === 'func') { - shows.push('callbackFunc') + shows.push('callbackFunc', 'output') + } else if (this.record.callbackType === 'script') { + shows.push('cbTable', 'output') } else if (this.record.callbackType !== 'none') { shows.push('cbTable') } diff --git a/src/tabviews/custom/components/calendar/index.jsx b/src/tabviews/custom/components/calendar/index.jsx index 43b7021..7b1f9d6 100644 --- a/src/tabviews/custom/components/calendar/index.jsx +++ b/src/tabviews/custom/components/calendar/index.jsx @@ -69,12 +69,6 @@ config: _config, arr_field: _config.columns.map(col => col.field).join(','), search: _config.$searches - }, () => { - if (_config.setting.onload === 'true') { - setTimeout(() => { - this.loadData() - }, _config.setting.delay || 0) - } }) } @@ -89,25 +83,7 @@ MKEmitter.addListener('searchRefresh', this.searchRefresh) } - if (config.$cache && !this.loaded) { - Api.getLCacheConfig(config.uuid).then(res => { - if (!res.data || this.loaded) return - - let data = [] - res.data.forEach((item, index) => { - item.key = index - item.$$uuid = item[config.setting.primaryKey] || '' - - let pass = this.resetLine(item) - - if (pass) { - data.push(item) - } - }) - - this.setState({data: data}) - }) - } + this.initExec() } shouldComponentUpdate (nextProps, nextState) { @@ -122,6 +98,66 @@ MKEmitter.removeListener('searchRefresh', this.searchRefresh) MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + } + + initExec = () => { + const { config } = this.state + + if (config.$cache) { + if (config.$time) { + Api.getLCacheConfig(config.uuid, config.$time).then(res => { + if (!res.valid && config.setting.onload === 'true') { + setTimeout(() => { + this.loadData('init') + }, config.setting.delay || 0) + } + + if (!res.data) return + + let _data = [] + res.data.forEach((item, index) => { + item.key = index + item.$$uuid = item[config.setting.primaryKey] || '' + + let pass = this.resetLine(item) + + if (pass) { + _data.push(item) + } + }) + + this.setState({data: _data}) + }) + } else { + Api.getLCacheConfig(config.uuid, 0).then(res => { + if (!res.data || this.loaded) return + + let _data = [] + res.data.forEach((item, index) => { + item.key = index + item.$$uuid = item[config.setting.primaryKey] || '' + + let pass = this.resetLine(item) + + if (pass) { + _data.push(item) + } + }) + + this.setState({data: _data}) + }) + + if (config.setting.onload === 'true') { + setTimeout(() => { + this.loadData('init') + }, config.setting.delay || 0) + } + } + } else if (config.setting.onload === 'true') { + setTimeout(() => { + this.loadData() + }, config.setting.delay || 0) + } } searchRefresh = (searchId) => { @@ -171,7 +207,7 @@ this.loadData() } - async loadData () { + async loadData (type) { const { config, arr_field, BID, search, year } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -207,7 +243,7 @@ let result = await Api.genericInterface(param) if (result.status) { this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index fa7d47a..a383d6d 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -144,7 +144,7 @@ if (config.wrap.datatype === 'dynamic') { if (config.timer) { this.timer = new TimerTask() - this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData('timer')}) } this.initExec() @@ -180,7 +180,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -206,7 +206,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } } @@ -354,7 +354,7 @@ this.loadData() } - async loadData (hastimer) { + async loadData (type) { const { config, arr_field, BID, BData } = this.state if (config.wrap.datatype === 'public') { @@ -377,7 +377,7 @@ let searches = [] - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -391,7 +391,7 @@ let _data = {} this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index f629d61..c727c59 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -263,7 +263,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('', 'init') }, config.setting.delay || 0) } @@ -311,7 +311,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('', 'init') }, config.setting.delay || 0) } } @@ -764,7 +764,7 @@ } this.loaded = true - if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } 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 4ae9acd..6738f88 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -288,7 +288,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid) { setTimeout(() => { - this.loadData() + this.loadData('', 'init') }, config.setting.delay || 0) } @@ -304,7 +304,7 @@ }) setTimeout(() => { - this.loadData() + this.loadData('', 'init') }, config.setting.delay || 0) } } else { @@ -608,7 +608,7 @@ } this.loaded = true - if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index dbb8131..2dcd2c2 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -146,7 +146,7 @@ if (config.timer && config.wrap.datatype === 'dynamic') { this.timer = new TimerTask() - this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData('timer')}) } this.initExec() @@ -182,7 +182,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -221,7 +221,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { if (config.wrap.goback === 'true' && data.$$empty) { @@ -429,7 +429,7 @@ if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠� MKEmitter.emit('reloadData', config.setting.supModule, BID) } else { - this.loadData(false, btn) + this.loadData('', btn) } } @@ -487,7 +487,7 @@ this.loadData() } - async loadData (hastimer, btn) { + async loadData (type, btn) { const { config, arr_field, BID, BData, selected } = this.state if (config.wrap.datatype === 'public') { @@ -521,7 +521,7 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -535,7 +535,7 @@ let _data = {} this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 694ea66..f0af9bf 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -163,7 +163,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -197,7 +197,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } } @@ -376,7 +376,7 @@ } this.loaded = true - if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index bd06661..da5ef60 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -150,7 +150,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -188,7 +188,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.openModal() @@ -356,7 +356,7 @@ let result = await Api.genericInterface(param) if (result.status) { this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index bf810fa..3c91f7b 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -149,7 +149,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -177,7 +177,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.openModal() @@ -358,7 +358,7 @@ let _data = {} this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/chart/antv-G6/index.jsx b/src/tabviews/custom/components/chart/antv-G6/index.jsx index d009353..e0084f9 100644 --- a/src/tabviews/custom/components/chart/antv-G6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-G6/index.jsx @@ -1034,7 +1034,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -1058,7 +1058,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -1125,7 +1125,7 @@ } } - async loadData () { + async loadData (type) { const { config, arr_field, BID } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -1155,7 +1155,7 @@ let result = await Api.genericInterface(param) if (result.status) { - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 0057c07..36cdc3f 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -374,7 +374,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -407,7 +407,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -431,7 +431,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -544,7 +544,7 @@ /** * @description 鏁版嵁鍔犺浇 */ - async loadData (hastimer) { + async loadData (type) { const { config, arr_field, BID, search } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -571,7 +571,7 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -582,7 +582,7 @@ let result = await Api.genericInterface(param) if (result.status) { - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index d60f344..e60f4cf 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -146,7 +146,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -177,7 +177,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -217,7 +217,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -300,7 +300,7 @@ }, 100) } - async loadData (hastimer) { + async loadData (type) { const { config, arr_field, BID } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -329,7 +329,7 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -340,7 +340,7 @@ let result = await Api.genericInterface(param) if (result.status) { - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 3ccda37..ab5d785 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -118,7 +118,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -149,7 +149,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -173,7 +173,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -259,7 +259,7 @@ } } - async loadData (hastimer) { + async loadData (type) { const { config, arr_field, search, BID } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -286,7 +286,7 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -297,7 +297,7 @@ let result = await Api.genericInterface(param) if (result.status) { - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } this.loaded = true diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index 3fb8d8b..a5a495f 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -112,7 +112,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -145,7 +145,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -173,7 +173,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -288,7 +288,7 @@ /** * @description 鏁版嵁鍔犺浇 */ - async loadData (hastimer) { + async loadData (type) { const { config, arr_field, BID, search } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -318,7 +318,7 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -329,7 +329,7 @@ let result = await Api.genericInterface(param) if (result.status) { - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } this.loaded = true diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index e98f37f..de60a68 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -101,7 +101,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -134,7 +134,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -162,7 +162,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -279,7 +279,7 @@ /** * @description 鏁版嵁鍔犺浇 */ - async loadData (hastimer) { + async loadData (type) { const { config, arr_field, BID, search } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -311,7 +311,7 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -322,7 +322,7 @@ let result = await Api.genericInterface(param) if (result.status) { - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } this.loaded = true diff --git a/src/tabviews/custom/components/code/sand-box/index.jsx b/src/tabviews/custom/components/code/sand-box/index.jsx index 560976e..4119dea 100644 --- a/src/tabviews/custom/components/code/sand-box/index.jsx +++ b/src/tabviews/custom/components/code/sand-box/index.jsx @@ -116,7 +116,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -142,7 +142,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.renderView() @@ -204,7 +204,7 @@ this.loadData() } - async loadData () { + async loadData (type) { const { config, arr_field, BID } = this.state if (config.wrap.datatype === 'static') { @@ -243,7 +243,7 @@ let _data = result.data || [] this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index ae27a14..9b114c1 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -217,7 +217,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadmaindata() + this.loadmaindata(false, 'true', '', 'init') }, config.setting.delay || 0) } @@ -279,7 +279,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadmaindata() + this.loadmaindata(false, 'true', '', 'init') this.getStatFieldsValue() }, config.setting.delay || 0) } @@ -400,7 +400,7 @@ let result = await Api.genericInterface(param) if (result.status) { this.loaded = true - if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index ccff669..46af8a6 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -123,7 +123,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -158,7 +158,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -190,7 +190,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } } @@ -317,7 +317,7 @@ }) } - async loadData (hastimer) { + async loadData (type) { const { config, arr_field, BID, BData } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -343,7 +343,7 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -355,7 +355,7 @@ let result = await Api.genericInterface(param) if (result.status) { this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx index a4fd24f..1d974f3 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.jsx +++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx @@ -105,7 +105,7 @@ if (config.timer) { this.timer = new TimerTask() this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { - this.loadData(true) + this.loadData('timer') }) } @@ -138,7 +138,7 @@ Api.getLCacheConfig(config.uuid, config.$time).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } @@ -164,7 +164,7 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadData() + this.loadData('init') }, config.setting.delay || 0) } else if (this.loaded) { this.handleData() @@ -272,7 +272,7 @@ /** * @description 鏁版嵁鍔犺浇 */ - async loadData (hastimer) { + async loadData (type) { const { config, arr_field, BID } = this.state if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -294,7 +294,7 @@ return } - if (!hastimer) { + if (type !== 'timer') { this.setState({ loading: true }) @@ -306,7 +306,7 @@ let result = await Api.genericInterface(param) if (result.status) { this.loaded = true - if (config.$cache && config.setting.onload !== 'false') { + if (config.$cache && type === 'init') { Api.writeCacheConfig(config.uuid, result.data || []) } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index a871951..21b4dc9 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1081,7 +1081,7 @@ }, 600) } - this.triggerNote(res) // 娑堟伅 + this.triggerNote(res, _param.ID) // 娑堟伅 this.execSuccess(res) } else { this.execError(res) @@ -1098,7 +1098,7 @@ setTimeout(() => { Api.genericInterface(param).then(res => { if (res.status) { - this.triggerNote(res) // 娑堟伅 + this.triggerNote(res, param.ID) // 娑堟伅 } resolve(res) }, (error) => { @@ -1449,6 +1449,8 @@ Api.genericInterface(param).then(res => { if (res.status) { + this.triggerNote(res, param.ID) // 娑堟伅 + if (params.length === 0) { this.execSuccess(res) _resolve() @@ -1662,7 +1664,7 @@ Api.genericInterface(param).then(res => { if (res.status) { - this.triggerNote(res) // 娑堟伅 + this.triggerNote(res, param.ID) // 娑堟伅 if (params.length === 0) { this.execSuccess(res) @@ -1696,7 +1698,7 @@ Api.genericInterface(param).then(res => { if (res.status) { - this.triggerNote(res) // 娑堟伅 + this.triggerNote(res, param.ID) // 娑堟伅 if (params.length === 0) { this.execSuccess(res) @@ -1718,7 +1720,7 @@ return new Promise(resolve => { Api.genericInterface(unCheckParam).then(result => { if (result.status) { - _this.triggerNote(result) // 娑堟伅 + _this.triggerNote(result, param.ID) // 娑堟伅 if (params.length === 0) { _this.execSuccess(result) @@ -1960,6 +1962,8 @@ Api.genericInterface(param).then(res => { if (res.status) { + this.triggerNote(res, param.ID) // 娑堟伅 + // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� if (params.length === 0) { this.execSuccess(res) @@ -2210,15 +2214,19 @@ } } - triggerNote = (res) => { + triggerNote = (res, ID) => { const { btn } = this.props if (!btn.verify) return - if (btn.verify.noteEnable !== 'true' && btn.verify.wxNote !== 'true') return + if (btn.verify.noteEnable !== 'true' && btn.verify.wxNote !== 'true' && btn.verify.printEnable !== 'true') return let id = '' if (btn.output) { id = res.mk_b_id || res[btn.output] || '' + } + + if (btn.verify.printEnable === 'true') { + this.billPrint(id || ID) } if (!id) return @@ -2242,6 +2250,16 @@ } } + billPrint = (id) => { + const { btn } = this.props + + if (!id) return + + setTimeout(() => { + window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: id, tempId: btn.verify.printTempId, dataM: sessionStorage.getItem('dataM') })))) + }, 500) + } + sendWxMessage = (verify, id) => { if (!window.GLOB.nginx) { notification.warning({ diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index 00171d3..1395bea 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -15,6 +15,7 @@ verify: PropTypes.object, unionFields: PropTypes.array, notes: PropTypes.array, + appType: PropTypes.any, onChange: PropTypes.func } @@ -22,6 +23,7 @@ wxTemps: [], selectTemp: null, miniTemps: [], + printTemps: [] } componentDidMount() { @@ -76,6 +78,11 @@ this.resetTemps(wxTemps) } + + let printTemps = sessionStorage.getItem('printTemps') + printTemps = printTemps ? JSON.parse(printTemps) : [] + + this.setState({printTemps}) } resetTemps = (wxTemps) => { @@ -126,6 +133,8 @@ let error = '' if (verify.noteEnable === 'true' && !verify.noteCode) { // 寮�鍚煭淇℃椂锛岄渶瑕佹ā鏉跨紪鐮� error = '寮�鍚煭淇℃椂锛岄渶瑕侀�夋嫨鐭俊妯℃澘锛�' + } else if (verify.printEnable === 'true' && !verify.printTempId) { + error = '浣跨敤鍗曟嵁鎵撳嵃鏃讹紝闇�瑕侀�夋嫨鎵撳嵃妯℃澘锛�' } else if (verify.accountdate === 'true' && !verify.accountfield) { error = '寮�鍚处鏈熸椂锛岄渶瑕侀�夋嫨楠岃瘉鍏徃锛�' } else if (verify.wxNote === 'true') { @@ -148,6 +157,9 @@ if (_verify.noteEnable !== 'true') { _verify.noteCode = '' + } + if (_verify.printEnable !== 'true') { + _verify.printTempId = '' } if (_verify.accountdate !== 'true') { _verify.accountfield = '' @@ -184,6 +196,14 @@ const { verify } = this.props let _verify = {...verify, noteCode: val, noteId: option.props.id} + + this.props.onChange(_verify) + } + + onPrintIdChange = (val) => { + const { verify } = this.props + + let _verify = {...verify, printTempId: val} this.props.onChange(_verify) } @@ -264,8 +284,8 @@ } render() { - const { unionFields, verify, notes, card } = this.props - const { wxTemps, selectTemp } = this.state + const { unionFields, verify, notes, card, appType } = this.props + const { wxTemps, selectTemp, printTemps } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -393,6 +413,31 @@ </Form.Item> </Col> : null} <Col span={24}></Col> + {appType !== 'mob' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title="浣跨敤鍗曟嵁鎵撳嵃鏃堕渶閫夋嫨鎵撳嵃妯℃澘锛岃烦杞墦鍗扮晫闈㈡椂ID浼樺厛浠庤繑鍥炲�间腑鑾峰彇锛岃繑鍥炲�兼病鏈夋椂浠庤閲岃幏鍙栥��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍗曟嵁鎵撳嵃 + </Tooltip> + }> + <Radio.Group value={verify.printEnable} onChange={(e) => {this.onOptionChange(e.target.value, 'printEnable')}}> + <Radio value="true">寮�鍚�</Radio> + <Radio value="false">涓嶅紑鍚�</Radio> + </Radio.Group> + </Form.Item> + </Col> : null} + {verify.printEnable === 'true' ? <Col span={8}> + <Form.Item label="鎵撳嵃妯℃澘" required> + <Select value={verify.printTempId} onSelect={this.onPrintIdChange}> + {printTemps.map(option => + <Select.Option key={option.value} value={option.value}> + {option.text} + </Select.Option> + )} + </Select> + </Form.Item> + </Col> : null} + <Col span={24}></Col> <Col span={8}> <Form.Item label={ <Tooltip placement="bottomLeft" title={'璇峰湪鏈嶅姟鍣ㄥ畬鎴愬叕浼楀彿閰嶇疆銆�'}> diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 6529f44..cffd4a9 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -537,6 +537,7 @@ UNSAFE_componentWillMount() { const { columns, config, card, btnTab } = this.props + const { appType } = this.state let _verify = fromJS(card.verify || {}).toJS() let _invalid = _verify.invalid @@ -553,10 +554,11 @@ } _verify.default = _verify.default || 'true' - _verify.wxNote = _verify.wxNote || 'false' // 鍏紬鍙锋秷鎭帹閫佹槸鍚﹀紑鍚� - _verify.noteEnable = _verify.noteEnable || 'false' // 鐭俊鍙戦�佹槸鍚﹀紑鍚� - _verify.noteType = _verify.noteType || 'N' // 鐭俊鍙戦�佹ā寮忥細Y锛堝疄鏃讹級銆丯锛堝畾鏃讹級 - _verify.noteTemp = _verify.noteTemp || 'Y' // 鐭俊鍙戦�佹ā鏉匡細Y锛堢浉鍚岋級銆丯锛堜笉鍚岋級 + _verify.wxNote = _verify.wxNote || 'false' // 鍏紬鍙锋秷鎭帹閫佹槸鍚﹀紑鍚� + _verify.noteEnable = _verify.noteEnable || 'false' // 鐭俊鍙戦�佹槸鍚﹀紑鍚� + _verify.printEnable = _verify.printEnable || 'false' // 鍗曟嵁鎵撳嵃鏄惁寮�鍚� + _verify.noteType = _verify.noteType || 'N' // 鐭俊鍙戦�佹ā寮忥細Y锛堝疄鏃讹級銆丯锛堝畾鏃讹級 + _verify.noteTemp = _verify.noteTemp || 'Y' // 鐭俊鍙戦�佹ā鏉匡細Y锛堢浉鍚岋級銆丯锛堜笉鍚岋級 _verify.invalid = _invalid _verify.uniques = _verify.uniques || [] _verify.contrasts = _verify.contrasts || [] @@ -568,6 +570,11 @@ _verify.voucher = _verify.voucher || {enabled: false} _verify.scripts = _verify.scripts || [] _verify.cbScripts = _verify.cbScripts || [] + + if (appType === 'mob') { + _verify.printEnable = 'false' + _verify.printTempId = '' + } if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { window.GLOB.funcs.forEach(m => { @@ -1559,7 +1566,7 @@ {verify.default === 'false' ? <span className="count-tip"><ExclamationOutlined style={{color: 'orange'}}/></span> : null} </span> } key="base"> - <BaseForm card={card} unionFields={unionFields} setting={setting} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/> + <BaseForm card={card} appType={appType} unionFields={unionFields} setting={setting} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/> </TabPane> : null} {verifyInter === 'system' ? <TabPane tab={ <span> -- Gitblit v1.8.0