| | |
| | | { |
| | | "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": "", |
| | |
| | | "transfer": "false", |
| | | "keepPassword": "true", |
| | | "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], |
| | | "host": "http://demo.mk9h.cn", |
| | | "service": "erp_new/" |
| | | "host": "http://qingqiumarket.cn", |
| | | "service": "MKWMS/" |
| | | |
| | | } |
| | |
| | | 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 { |
| | |
| | | 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') { |
| | |
| | | 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') |
| | | } |
| | |
| | | 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) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | 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) { |
| | |
| | | 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) => { |
| | |
| | | this.loadData() |
| | | } |
| | | |
| | | async loadData () { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, search, year } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | 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() |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | |
| | | this.loadData() |
| | | } |
| | | |
| | | async loadData (hastimer) { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, BData } = this.state |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | |
| | | |
| | | let searches = [] |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | let _data = {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && config.setting.onload !== 'false') { |
| | | if (config.$cache && type === 'init') { |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('', 'init') |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') { |
| | | if (config.$cache && type === 'init') { |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | } |
| | | |
| | |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res.valid) { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('', 'init') |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('', 'init') |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } else { |
| | |
| | | } |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') { |
| | | if (config.$cache && type === 'init') { |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | } |
| | | |
| | |
| | | |
| | | 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() |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | 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) { |
| | |
| | | if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 刷新源组件时,附带刷新上级行与当前组件 |
| | | MKEmitter.emit('reloadData', config.setting.supModule, BID) |
| | | } else { |
| | | this.loadData(false, btn) |
| | | this.loadData('', btn) |
| | | } |
| | | } |
| | | |
| | |
| | | this.loadData() |
| | | } |
| | | |
| | | async loadData (hastimer, btn) { |
| | | async loadData (type, btn) { |
| | | const { config, arr_field, BID, BData, selected } = this.state |
| | | |
| | | if (config.wrap.datatype === 'public') { |
| | |
| | | return |
| | | } |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | let _data = {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && config.setting.onload !== 'false') { |
| | | if (config.$cache && type === 'init') { |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && pageIndex === 1 && config.setting.onload !== 'false') { |
| | | if (config.$cache && type === 'init') { |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.openModal() |
| | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.openModal() |
| | |
| | | let _data = {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && config.setting.onload !== 'false') { |
| | | if (config.$cache && type === 'init') { |
| | | Api.writeCacheConfig(config.uuid, result.data || []) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | |
| | | } |
| | | } |
| | | |
| | | async loadData () { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | |
| | | /** |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData (hastimer) { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | return |
| | | } |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | |
| | | }, 100) |
| | | } |
| | | |
| | | async loadData (hastimer) { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | return |
| | | } |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | |
| | | } |
| | | } |
| | | |
| | | async loadData (hastimer) { |
| | | async loadData (type) { |
| | | const { config, arr_field, search, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | return |
| | | } |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | |
| | | 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 |
| | |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | |
| | | /** |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData (hastimer) { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | return |
| | | } |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | |
| | | 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 |
| | |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | |
| | | /** |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData (hastimer) { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, search } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | return |
| | | } |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | |
| | | 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 |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.renderView() |
| | |
| | | this.loadData() |
| | | } |
| | | |
| | | async loadData () { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | |
| | | if (config.wrap.datatype === 'static') { |
| | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata() |
| | | this.loadmaindata(false, 'true', '', 'init') |
| | | this.getStatFieldsValue() |
| | | }, config.setting.delay || 0) |
| | | } |
| | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | async loadData (hastimer) { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID, BData } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | return |
| | | } |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | this.loadData('init') |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | |
| | | /** |
| | | * @description 数据加载 |
| | | */ |
| | | async loadData (hastimer) { |
| | | async loadData (type) { |
| | | const { config, arr_field, BID } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | |
| | | return |
| | | } |
| | | |
| | | if (!hastimer) { |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | 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 || []) |
| | | } |
| | | |
| | |
| | | }, 600) |
| | | } |
| | | |
| | | this.triggerNote(res) // 消息 |
| | | this.triggerNote(res, _param.ID) // 消息 |
| | | this.execSuccess(res) |
| | | } else { |
| | | this.execError(res) |
| | |
| | | setTimeout(() => { |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res) // 消息 |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | } |
| | | resolve(res) |
| | | }, (error) => { |
| | |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | | _resolve() |
| | |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res) // 消息 |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res) // 消息 |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | |
| | | 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) |
| | |
| | | |
| | | Api.genericInterface(param).then(res => { |
| | | if (res.status) { |
| | | this.triggerNote(res, param.ID) // 消息 |
| | | |
| | | // 一次请求成功,进行下一项请求 |
| | | if (params.length === 0) { |
| | | this.execSuccess(res) |
| | |
| | | } |
| | | } |
| | | |
| | | 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 |
| | |
| | | } |
| | | } |
| | | |
| | | 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({ |
| | |
| | | verify: PropTypes.object, |
| | | unionFields: PropTypes.array, |
| | | notes: PropTypes.array, |
| | | appType: PropTypes.any, |
| | | onChange: PropTypes.func |
| | | } |
| | | |
| | |
| | | wxTemps: [], |
| | | selectTemp: null, |
| | | miniTemps: [], |
| | | printTemps: [] |
| | | } |
| | | |
| | | componentDidMount() { |
| | |
| | | |
| | | this.resetTemps(wxTemps) |
| | | } |
| | | |
| | | let printTemps = sessionStorage.getItem('printTemps') |
| | | printTemps = printTemps ? JSON.parse(printTemps) : [] |
| | | |
| | | this.setState({printTemps}) |
| | | } |
| | | |
| | | resetTemps = (wxTemps) => { |
| | |
| | | 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') { |
| | |
| | | |
| | | if (_verify.noteEnable !== 'true') { |
| | | _verify.noteCode = '' |
| | | } |
| | | if (_verify.printEnable !== 'true') { |
| | | _verify.printTempId = '' |
| | | } |
| | | if (_verify.accountdate !== 'true') { |
| | | _verify.accountfield = '' |
| | |
| | | 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) |
| | | } |
| | |
| | | } |
| | | |
| | | 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 }, |
| | |
| | | </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={'请在服务器完成公众号配置。'}> |
| | |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { columns, config, card, btnTab } = this.props |
| | | const { appType } = this.state |
| | | let _verify = fromJS(card.verify || {}).toJS() |
| | | |
| | | let _invalid = _verify.invalid |
| | |
| | | } |
| | | |
| | | _verify.default = _verify.default || 'true' |
| | | _verify.wxNote = _verify.wxNote || 'false' // 公众号消息推送是否开启 |
| | | _verify.noteEnable = _verify.noteEnable || 'false' // 短信发送是否开启 |
| | | _verify.noteType = _verify.noteType || 'N' // 短信发送模式:Y(实时)、N(定时) |
| | | _verify.noteTemp = _verify.noteTemp || 'Y' // 短信发送模板:Y(相同)、N(不同) |
| | | _verify.wxNote = _verify.wxNote || 'false' // 公众号消息推送是否开启 |
| | | _verify.noteEnable = _verify.noteEnable || 'false' // 短信发送是否开启 |
| | | _verify.printEnable = _verify.printEnable || 'false' // 单据打印是否开启 |
| | | _verify.noteType = _verify.noteType || 'N' // 短信发送模式:Y(实时)、N(定时) |
| | | _verify.noteTemp = _verify.noteTemp || 'Y' // 短信发送模板:Y(相同)、N(不同) |
| | | _verify.invalid = _invalid |
| | | _verify.uniques = _verify.uniques || [] |
| | | _verify.contrasts = _verify.contrasts || [] |
| | |
| | | _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 => { |
| | |
| | | {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> |