| | |
| | | import moment from 'moment' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, Modal, notification, message } from 'antd' |
| | | import * as XLSX from 'xlsx' |
| | | import * as XLSX from 'sheetjs-style' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | |
| | | static propTpyes = { |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | | btn: PropTypes.object, // 按钮 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | updateStatus: PropTypes.func, // 按钮状态更新 |
| | |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (triggerId, record, type) => { |
| | | const { setting, Tab, BID, btn } = this.props |
| | | const { setting, BID, btn } = this.props |
| | | const { loading, disabled } = this.state |
| | | |
| | | if (loading || disabled) return |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | | |
| | | if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { |
| | | if (setting.supModule && !BID) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '需要上级主键值!', |
| | |
| | | }) |
| | | viewParam.arr_field = viewParam.arr_field.join(',') |
| | | |
| | | viewParam.orderBy = btn.verify.order || viewParam.orderBy |
| | | viewParam.orderBy = btn.verify.order || '' |
| | | } |
| | | } |
| | | if (btn.intertype === 'system' && btn.verify.enable === 'true') { |
| | |
| | | } |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | 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 (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { |
| | | res.rduri = window.GLOB.mainSystemApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | 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 (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { |
| | | res.rduri = window.GLOB.mainSystemApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | 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 (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | res.rduri = btn.proInterface |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } else { |
| | | if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | 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 (window.GLOB.systemType === 'production' && btn.proInterface) { |
| | | param.rduri = btn.proInterface |
| | | } else { |
| | |
| | | let _header = [] |
| | | let _topRow = {} |
| | | let colwidth = [] |
| | | |
| | | columns.forEach(col => { |
| | | let requires = [] |
| | | |
| | | columns.forEach((col, i) => { |
| | | _header.push(col.Column) |
| | | _topRow[col.Column] = col.Text |
| | | colwidth.push({width: col.Width || 20}) |
| | | if (col.required === 'true') { |
| | | requires.push(i) |
| | | } |
| | | }) |
| | | |
| | | let table = [] |
| | |
| | | }) |
| | | |
| | | const ws = XLSX.utils.json_to_sheet(table, {header: _header, skipHeader: true}) |
| | | |
| | | |
| | | ws['!cols'] = colwidth |
| | | |
| | | if (requires.length) { |
| | | let cols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
| | | requires.forEach(col => { |
| | | if (cols[col]) { |
| | | ws[cols[col] + '1'].s = {font: { color: { rgb: 'F5222D' } }} |
| | | } |
| | | }) |
| | | } |
| | | // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA" }}, font: { color: { rgb: "1890FF" } }} |
| | | |
| | | const wb = XLSX.utils.book_new() |
| | | XLSX.utils.book_append_sheet(wb, ws, 'Sheet1') |
| | |
| | | let customScript = setting.customScript || '' |
| | | let _dataresource = setting.dataresource || '' |
| | | let queryType = setting.queryType |
| | | let transaction = setting.transaction |
| | | |
| | | if (btn.verify.dataType === 'custom') { |
| | | defaultSql = btn.verify.defaultSql || 'true' |
| | | _dataresource = btn.verify.dataresource || '' |
| | | queryType = btn.verify.queryType |
| | | transaction = btn.verify.transaction |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | |
| | | |
| | | if (window.GLOB.mkHS) { // 云端数据验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) |
| | | } |
| | | |
| | | if (transaction === 'true') { |
| | | param.func = 'sPC_Get_TableData_try' |
| | | } |
| | | |
| | | return param |