| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { Button, notification, Modal } from 'antd' |
| | | |
| | | import zhCN from '@/locales/zh-CN/main.js' |
| | | import enUS from '@/locales/en-US/main.js' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MkIcon from '@/components/mk-icon' |
| | | import './index.scss' |
| | |
| | | |
| | | class NewPageButton extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // BID |
| | | BData: PropTypes.any, // 主表数据 |
| | | btn: PropTypes.object, // 按钮 |
| | | selectedData: PropTypes.any, // 子表中选择数据 |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | disabled: false, |
| | | hidden: false, |
| | | visible: false |
| | |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (triggerId, record, type) => { |
| | | const { btn, selectedData } = this.props |
| | | const { btn, selectedData, BID } = this.props |
| | | const { disabled } = this.state |
| | | |
| | | if (disabled) return |
| | |
| | | |
| | | let data = record || selectedData || [] |
| | | |
| | | if (btn.Ot && btn.Ot !== 'notRequired' && data.length === 0) { |
| | | if (btn.Ot !== 'notRequired' && data.length === 0) { |
| | | // 需要选择行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectline'], |
| | | message: '请选择行!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | // 需要选择单行时,校验数据 |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.selectSingleLine'], |
| | | message: '请选择单行数据!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | |
| | | |
| | | if (btn.pageTemplate === 'billprint') { |
| | | _name = '单据打印' |
| | | if (btn.Ot === 'required' && data && data.length > 0) { |
| | | data.forEach((item, i) => { |
| | | if (btn.Ot === 'required') { |
| | | data.forEach(item => { |
| | | let _id = item.$$uuid || '' |
| | | let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: _id, tempId: btn.printTemp, dataM: sessionStorage.getItem('dataM') }))) |
| | | let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: _id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') }))) |
| | | window.open(url) |
| | | }) |
| | | } else if (btn.Ot === 'requiredOnce') { |
| | | Id = data.map(item => item.$$uuid).filter(Boolean).join(',') |
| | | |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) |
| | | } else { |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, dataM: sessionStorage.getItem('dataM') })))) |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) |
| | | } |
| | | } else if (btn.pageTemplate === 'billprintTemp') { |
| | | let src = '#/menudesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'billPrint', MenuId: Id, MenuNo: MenuNo, MenuName: name || '打印', Remark: Remark }))) |
| | |
| | | window.open(url) |
| | | } else if (btn.pageTemplate === 'custom') { |
| | | let url = btn.url |
| | | if (window.GLOB.systemType === 'production' && btn.proUrl) { |
| | | url = btn.proUrl |
| | | } |
| | | |
| | | if (btn.Ot === 'notRequired' && BID) { |
| | | Id = BID |
| | | } |
| | | |
| | | if (/#\/iframe\//.test(url)) { |
| | | url = url.replace(/@loginuid@/ig, sessionStorage.getItem('LoginUID')) |
| | | |
| | | if (btn.joint === 'true' && Id) { |
| | | url = url + '/' + Id |
| | | } |
| | | |
| | | let menu = { |
| | | MenuID: btn.uuid, |
| | | MenuName: btn.label, |
| | | type: 'iframe', |
| | | OpenType: 'newtab', |
| | | src: url |
| | | } |
| | | MKEmitter.emit('modifyTabs', menu) |
| | | |
| | | return |
| | | } |
| | | |
| | | let con = '?' |
| | | |
| | | if (/\?/ig.test(url)) { |
| | | con = '&' |
| | | } |
| | | |
| | | if (btn.Ot === 'requiredSgl' && btn.joint !== 'false') { |
| | | if (btn.joint === 'true') { |
| | | url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` |
| | | } else if (btn.Ot === 'requiredSgl' && btn.joint === 'false') { |
| | | } else if (Id) { |
| | | url = url + `${con}id=${Id}` |
| | | } else if (btn.joint !== 'false') { |
| | | url = url + `${con}appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` |
| | | } |
| | | |
| | | window.open(url) |