| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data) |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) |
| | | param.func = btn.innerFunc |
| | | |
| | | if (btn.recordUser === 'true') { |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data) |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 使用外部函数 |
| | | let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) |
| | | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { |
| | | param.rduri = window.GLOB.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | param.$token = btn.exProInterface || '' |
| | | } else { |
| | | param.$token = btn.exInterface || '' |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | param.$token = btn.exProInterface || '' |
| | | } else { |
| | | param.$token = btn.exInterface || '' |
| | | } |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { |
| | | param.$login = true |
| | | } |
| | | param.rduri = btn.interface |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { |
| | | param.$login = true |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data) |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { |
| | | res.rduri = window.GLOB.cloudServiceApi |
| | | res.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | } else { |
| | | res.rduri = btn.interface |
| | | } |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | res.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | res.$token = btn.exProInterface || '' |
| | | } else { |
| | | res.$token = btn.exInterface || '' |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | res.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | res.$token = btn.exProInterface || '' |
| | | } else { |
| | | res.$token = btn.exInterface || '' |
| | | } |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | } else { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | } else { |
| | | res.rduri = btn.interface |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) { |
| | | res.$login = true |
| | | } |
| | | res.rduri = btn.interface |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) { |
| | | res.$login = true |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | Api.genericInterface(res).then(result => { |
| | | if (result.status) { |
| | | this.exportExcel(result.data) |
| | | this.exportExcel(result.data, result.ErrCode, result.message) |
| | | } else { |
| | | this.execError(result) |
| | | } |
| | |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { |
| | | res.rduri = window.GLOB.cloudServiceApi |
| | | res.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | } else { |
| | | res.rduri = btn.interface |
| | | } |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | res.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | res.$token = btn.exProInterface || '' |
| | | } else { |
| | | res.$token = btn.exInterface || '' |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | res.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | res.$token = btn.exProInterface || '' |
| | | } else { |
| | | res.$token = btn.exInterface || '' |
| | | } |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | } else { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | } else { |
| | | res.rduri = btn.interface |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) { |
| | | res.$login = true |
| | | } |
| | | res.rduri = btn.interface |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) { |
| | | res.$login = true |
| | | } |
| | | } |
| | | |
| | |
| | | this.getExcelOutDoubleData(viewParam, pageIndex, pageSize, data) |
| | | } else { |
| | | data = data.concat(result.data) |
| | | this.exportExcel(data) |
| | | this.exportExcel(data, result.ErrCode, result.message) |
| | | } |
| | | } else { |
| | | this.execError(result) |
| | |
| | | param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | param.func = btn.innerFunc |
| | | |
| | | if (btn.recordUser === 'true') { |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | |
| | | } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 使用外部函数 |
| | | param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | |
| | | if (window.GLOB.mkHS) { |
| | | if (btn.sysInterface === 'true' && window.GLOB.cloudServiceApi) { |
| | | param.rduri = window.GLOB.cloudServiceApi |
| | | param.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } else if (btn.sysInterface !== 'true') { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | param.$token = btn.exProInterface || '' |
| | | } else { |
| | | param.$token = btn.exInterface || '' |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true') { |
| | | if (window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | } else if (btn.sysInterface === 'external') { |
| | | if (window.GLOB.systemType === 'production') { |
| | | param.$token = btn.exProInterface || '' |
| | | } else { |
| | | param.$token = btn.exInterface || '' |
| | | } |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | | if (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | param.rduri = btn.interface |
| | | } |
| | | |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { |
| | | param.$login = true |
| | | } |
| | | let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') |
| | | if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { |
| | | param.$login = true |
| | | } |
| | | } |
| | | |
| | |
| | | this.getExcelOutData(viewParam, pageIndex, pageSize, data) |
| | | } else { |
| | | data = data.concat(result.data) |
| | | this.exportExcel(data) |
| | | this.exportExcel(data, result.ErrCode, result.message) |
| | | } |
| | | } else { |
| | | this.execError(result) |
| | |
| | | /** |
| | | * @description Excel 生成 |
| | | */ |
| | | exportExcel = (data) => { |
| | | exportExcel = (data, ErrCode, msg) => { |
| | | const { btn } = this.props |
| | | |
| | | let imgCol = false |
| | | let columns = btn.verify.columns.filter(col => { |
| | | if (col.output === 'false') return false |
| | | |
| | | let columns = btn.verify.columns.map(col => { |
| | | if (col.type === 'image') { |
| | | imgCol = true |
| | | } |
| | |
| | | if (data && data[0]) { |
| | | let errors = [] |
| | | columns.forEach(col => { |
| | | if (col.output === 'false') return |
| | | if (col.Column && data[0][col.Column] === undefined) { |
| | | errors.push(col.Text) |
| | | } |
| | |
| | | |
| | | columns.forEach((col, i) => { |
| | | let val = item[col.Column] |
| | | if (col.type === 'number' && typeof(val) === 'number') { |
| | | if (col.output === 'false') { |
| | | if (col.type === 'number') { |
| | | val = 0 |
| | | } else { |
| | | val = '' |
| | | } |
| | | } else if (col.type === 'number' && typeof(val) === 'number') { |
| | | if (col.abs === 'true') { |
| | | val = Math.abs(val) |
| | | } |
| | |
| | | |
| | | this.table2excel(column, table) |
| | | |
| | | this.execSuccess({ErrCode: 'S', message: '导出成功!'}) |
| | | this.execSuccess({ErrCode: ErrCode || 'S', message: msg || '导出成功!'}) |
| | | } else { |
| | | let letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| | | let cols = [] |
| | |
| | | columns.forEach((col, i) => { |
| | | let val = item[col.Column] |
| | | |
| | | if (col.type === 'number' && typeof(val) === 'number') { |
| | | if (col.output === 'false') { |
| | | if (col.type === 'number') { |
| | | val = 0 |
| | | } else { |
| | | val = '' |
| | | } |
| | | } else if (col.type === 'number' && typeof(val) === 'number') { |
| | | if (col.abs === 'true') { |
| | | val = Math.abs(val) |
| | | } |
| | |
| | | |
| | | XLSX.writeFile(wb, `${btn.$menuName || ''}${moment().format('YYYYMMDDHHmmss')}.xlsx`) |
| | | |
| | | this.execSuccess({ErrCode: 'S', message: '导出成功!'}) |
| | | this.execSuccess({ErrCode: ErrCode || 'S', message: msg || '导出成功!'}) |
| | | } |
| | | } catch (e) { |
| | | this.execError({ErrCode: 'N', message: 'Excel生成失败!'}) |
| | |
| | | _setting.arr_field = _setting.arr_field.join(',') |
| | | _setting.execute = btn.verify.defaultSql !== 'false' |
| | | _setting.dataresource = btn.verify.dataresource || '' |
| | | _setting.primaryKey = _setting.primaryKey || setting.primaryKey || 'ID' |
| | | _setting.primaryKey = btn.verify.primaryKey || setting.primaryKey || 'ID' |
| | | |
| | | if (!_setting.execute) { |
| | | _setting.dataresource = '' |
| | |
| | | _orderBy = btn.verify.order || '' |
| | | } else { |
| | | _setting = {...setting} |
| | | _setting.$name = btn.logLabel |
| | | _setting.laypage = pagination |
| | | _setting.arr_field = _setting.all_field || _setting.arr_field |
| | | |
| | | delete _setting.sub_field |
| | | } |
| | | |
| | | let primaryId = '' |
| | |
| | | * 4、模态框执行成功后是否关闭 |
| | | * 5、通知主列表刷新 |
| | | */ |
| | | execSuccess = (res = {}) => { |
| | | execSuccess = (res) => { |
| | | const { btn } = this.props |
| | | |
| | | if (res.ErrCode === 'S' || !res.ErrCode) { // 执行成功 |
| | | if (res.ErrCode === 'S') { // 执行成功 |
| | | notification.success({ |
| | | top: 92, |
| | | message: res.message || '执行成功!', |
| | | message: res.message, |
| | | duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 |
| | | }) |
| | | } else if (res.ErrCode === 'Y') { // 执行成功 |
| | | Modal.success({ |
| | | title: res.message || '执行成功!' |
| | | title: res.message |
| | | }) |
| | | } else if (res.ErrCode === '-1') { // 完成后不提示 |
| | | |