| | |
| | | import MutilForm from '@/tabviews/tableshare/mutilform' |
| | | import ExcelIn from '../excelin' |
| | | import Utils from '@/utils/utils.js' |
| | | import options from '@/store/options.js' |
| | | import Api from '@/api' |
| | | import './index.scss' |
| | | |
| | |
| | | |
| | | class MainAction extends Component { |
| | | static propTpyes = { |
| | | menuType: PropTypes.any, // 菜单类型,普通菜单或HS |
| | | BID: PropTypes.string, // 主表ID |
| | | BData: PropTypes.any, // 主表数据 |
| | | Tab: PropTypes.any, // 如果当前元素为标签时,tab为标签信息 |
| | |
| | | window.open(url) |
| | | } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { |
| | | this.props.triggerPopview(item, data) |
| | | } else if (item.OpenType === 'funcbutton') { |
| | | if (item.funcType === 'changeuser') { |
| | | this.changeUser(item, data) |
| | | } else if (item.funcType === 'print') { |
| | | this.triggerPrint(item, data) |
| | | } |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 触发打印 |
| | | */ |
| | | triggerPrint = (item, data) => { |
| | | // socket = new WebSocket('ws://127.0.0.1:13529') |
| | | |
| | | // // 打开Socket |
| | | // socket.onopen = function(event) { |
| | | // // 监听消息 |
| | | // socket.onmessage = function(event) |
| | | // { |
| | | // //取打印机信息的返回是在这里,所以第一次的打印比较麻烦,看是不是可以在调打印前先判断你有没有存打印机名 |
| | | // //,没有就调getPrinters来取打印机去设置,要是调了打印再调取打印机,第一条打印任务就要在这里重发,就太麻烦了 |
| | | // //提前取打印机就只能用127.0.0.1:13529来取,这个地址就要写死了 |
| | | // console.log('Client received a message',event); |
| | | // }; |
| | | |
| | | // // 监听Socket的关闭 |
| | | // socket.onclose = function(event) |
| | | // { |
| | | // console.log('Client notified socket has closed',event); |
| | | // }; |
| | | |
| | | // }; |
| | | } |
| | | |
| | | /** |
| | | * @description 切换用户 |
| | | */ |
| | | changeUser = (btn, data) => { |
| | | const { setting } = this.props |
| | | |
| | | let param = { |
| | | BID: this.props.BID, |
| | | func: 'webapi_ChangeUser', |
| | | appkey: window.GLOB.appkey || '', |
| | | rduri: window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } |
| | | |
| | | param[setting.primaryKey] = data[0][setting.primaryKey] |
| | | |
| | | confirm({ |
| | | title: this.props.dict['main.action.confirm.tip'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.genericInterface(param).then(res => { |
| | | resolve() |
| | | if (res.status) { |
| | | sessionStorage.setItem('avatar', res.icon || '') |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('SessionUid', Utils.getuuid()) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | | sessionStorage.setItem('User_Name', res.UserName) |
| | | |
| | | window.location.reload() |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: res.message || res.ErrMesg, |
| | | duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 15 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } |
| | | |
| | | /** |
| | |
| | | // 外部请求 |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | |
| | | if (btn.sysInterface === 'true') { |
| | | res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | if (this.props.menuType === 'HS') { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | param.rduri = btn.interface |
| | | } |
| | | } else { |
| | | res.rduri = btn.interface |
| | | if (btn.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | } |
| | | |
| | | // res.method = btn.method |
| | | if (btn.outerFunc) { |
| | | res.func = btn.outerFunc |
| | |
| | | }) |
| | | } else if (res && res.ErrCode === '-1') { // 完成后不提示 |
| | | |
| | | } else if (res.Relogin === 'true') { // 切换用户功能 |
| | | sessionStorage.setItem('avatar', res.icon || '') |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('SessionUid', Utils.getuuid()) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | | sessionStorage.setItem('User_Name', res.UserName) |
| | | // } else if (res.Relogin === 'true') { // 切换用户功能 |
| | | // sessionStorage.setItem('avatar', res.icon || '') |
| | | // sessionStorage.setItem('UserID', res.UserID) |
| | | // sessionStorage.setItem('SessionUid', Utils.getuuid()) |
| | | // sessionStorage.setItem('LoginUID', res.LoginUID) |
| | | // sessionStorage.setItem('User_Name', res.UserName) |
| | | |
| | | window.location.reload() |
| | | return |
| | | // window.location.reload() |
| | | // return |
| | | } |
| | | |
| | | if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { |
| | |
| | | // 外部请求 |
| | | _outParam = JSON.parse(JSON.stringify(res)) |
| | | |
| | | if (btn.sysInterface === 'true') { |
| | | res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | if (this.props.menuType === 'HS') { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | param.rduri = btn.interface |
| | | } |
| | | } else { |
| | | res.rduri = btn.interface |
| | | if (btn.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | } |
| | | |
| | | if (btn.outerFunc) { |
| | |
| | | }) |
| | | } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 使用外部函数 |
| | | let param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search) |
| | | if (btn.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | |
| | | if (this.props.menuType === 'HS') { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | param.rduri = btn.interface |
| | | } |
| | | } else { |
| | | param.rduri = btn.interface |
| | | if (btn.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | } |
| | | |
| | | param.appkey = window.GLOB.appkey || '' |
| | |
| | | delete res.message |
| | | delete res.status |
| | | |
| | | if (btn.sysInterface === 'true') { |
| | | res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | if (this.props.menuType === 'HS') { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | param.rduri = btn.interface |
| | | } |
| | | } else { |
| | | res.rduri = btn.interface |
| | | if (btn.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | } |
| | | |
| | | if (btn.outerFunc) { |
| | |
| | | |
| | | } else if (btn.intertype === 'outer' && !btn.innerFunc) { // 使用外部函数 |
| | | param = this.getExcelCustomParam(viewParam.orderBy, viewParam.search, true, pageIndex, pageSize) |
| | | if (btn.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | |
| | | if (this.props.menuType === 'HS') { |
| | | if (btn.sysInterface === 'true' && options.cloudServiceApi) { |
| | | param.rduri = options.cloudServiceApi |
| | | } else if (btn.sysInterface !== 'true') { |
| | | param.rduri = btn.interface |
| | | } |
| | | } else { |
| | | param.rduri = btn.interface |
| | | if (btn.sysInterface === 'true') { |
| | | param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi |
| | | } else { |
| | | param.rduri = btn.interface |
| | | } |
| | | } |
| | | |
| | | |
| | | param.appkey = window.GLOB.appkey || '' |
| | | |
| | |
| | | let colwidth = [] |
| | | |
| | | let hidecolumns = [] |
| | | |
| | | let verifyColumn = {} // 记录验证信息中的Excel列配置 |
| | | if (btn.verify && btn.verify.columns && btn.verify.columns.length > 0) { |
| | | btn.verify.columns.forEach(col => { |
| | | verifyColumn[col.Column] = col |
| | | }) |
| | | } |
| | | |
| | | logcolumns.forEach(col => { |
| | | if (col.Hide === 'true') { |
| | | hidecolumns.push(col.field) |
| | | return |
| | | } |
| | | if (!data[0].hasOwnProperty(col.field)) return |
| | | if (_topRow[col.field]) return |
| | | |
| | | if (verifyColumn[col.field]) { // 优先使用验证信息中的列设置 |
| | | _header.push(col.field) |
| | | _topRow[col.field] = verifyColumn[col.field].Text |
| | | |
| | | colwidth.push({width: verifyColumn[col.field].Width}) |
| | | } else { |
| | | _header.push(col.field) |
| | | _topRow[col.field] = col.label |
| | | |
| | | let _colwidth = Math.floor(col.Width / 6) |
| | | |
| | | if (!_colwidth || _colwidth < 5) { |
| | | _colwidth = 5 |
| | | } |
| | | |
| | | colwidth.push({width: _colwidth}) |
| | | } |
| | | }) |
| | | |
| | |
| | | colwidth.push({width: col.Width}) |
| | | }) |
| | | } |
| | | |
| | | logcolumns.forEach(col => { |
| | | if (col.Hide === 'true') return |
| | | if (!data[0].hasOwnProperty(col.field)) return |
| | | if (_topRow[col.field]) return |
| | | |
| | | _header.push(col.field) |
| | | _topRow[col.field] = col.label |
| | | |
| | | let _colwidth = Math.floor(col.Width / 6) |
| | | |
| | | if (!_colwidth || _colwidth < 5) { |
| | | _colwidth = 5 |
| | | } |
| | | |
| | | colwidth.push({width: _colwidth}) |
| | | }) |
| | | |
| | | Object.keys(data[0]).forEach(key => { |
| | | if (hidecolumns.includes(key)) return |