| | |
| | | columns: PropTypes.any, // 字段列 |
| | | setting: PropTypes.any, // 页面通用设置 |
| | | disabled: PropTypes.any, // 行按钮禁用 |
| | | name: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | |
| | | /** |
| | | * @description 触发按钮操作 |
| | | */ |
| | | actionTrigger = (triggerId, record, type, callback) => { |
| | | const { btn, selectedData } = this.props |
| | | actionTrigger = (triggerId, record, type, lid, callback) => { |
| | | const { btn, selectedData, LID } = this.props |
| | | const { loading, disabled } = this.state |
| | | |
| | | if (type === 'preButton') { |
| | |
| | | |
| | | if (loading || disabled) return |
| | | if (triggerId && btn.uuid !== triggerId) return |
| | | if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) return |
| | | if (type === 'linkbtn' && !btn.$toolbtn && LID !== lid) return |
| | | if (btn.OpenType === 'form' && btn.formType === 'count_line') return |
| | | |
| | | this.setState({autoMatic: type === 'autoMatic'}) |
| | |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | if (btn.dataM === 'true') { |
| | | param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | |
| | | let primaryId = '' |
| | | |
| | |
| | | if (btn.recordUser === 'true') { |
| | | param.username = sessionStorage.getItem('User_Name') || '' |
| | | param.fullname = sessionStorage.getItem('Full_Name') || '' |
| | | } |
| | | if (btn.dataM === 'true') { |
| | | param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : '' |
| | | } |
| | | |
| | | let primaryId = setting.primaryKey ? cell[setting.primaryKey] || '' : '' |
| | |
| | | let node = document.getElementById('button' + btnId) |
| | | |
| | | if (node) { |
| | | MKEmitter.emit('triggerBtnId', btnId, null, 'preButton', (res) => { |
| | | MKEmitter.emit('triggerBtnId', btnId, null, 'preButton', null, (res) => { |
| | | if (!res) { |
| | | this.setState({loading: false}) |
| | | resolve() |
| | |
| | | }) |
| | | |
| | | keys = keys.join(',') |
| | | vals = vals.join(',') |
| | | |
| | | lines.push({ |
| | | table: md5(tb + keys), |
| | | insert: `Insert into ${tbName} (${keys},[mk_level],[mk_id],[mk_bid])`, |
| | | select: `Select ${vals.join(',')},'${level}','${id}','${bid}'` |
| | | insert: `Insert into ${tbName} (${keys ? keys + ',' : ''}[mk_level],[mk_id],[mk_bid])`, |
| | | select: `Select ${keys ? vals + ',' : ''}'${level}','${id}','${bid}'` |
| | | }) |
| | | |
| | | subObjs.forEach(item => { |
| | |
| | | sql = sql.replace(/@typename@/ig, `'admin'`) |
| | | |
| | | if (sessionStorage.getItem('dataM') === 'true') { // 数据权限 |
| | | sql = sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') |
| | | sql = sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, `'Y'`) |
| | | } else { |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) |
| | | } |
| | | |
| | | if (window.GLOB.debugger === true) { |
| | |
| | | tabId = btn.refreshTab[btn.refreshTab.length - 1] |
| | | } |
| | | |
| | | if (btn.formCache === 'clear') { // 清除表单缓存 |
| | | window.GLOB.CacheMap = new Map() |
| | | } |
| | | // if (btn.formCache === 'clear') { // 清除表单缓存 |
| | | // window.GLOB.CacheMap = new Map() |
| | | // } |
| | | |
| | | if (tabId && btn.$MenuID === tabId) { // 刷新当前菜单时,停止其他操作 |
| | | MKEmitter.emit('reloadMenuView', tabId, 'table') |
| | |
| | | if (btn.execSuccess === 'popclose' && btn.$tabId) { // 标签关闭刷新 |
| | | MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | |
| | | if (btn.verify && btn.verify.linkEnable === 'true') { |
| | | let url = '' |
| | | if (window.GLOB.systemType === 'production') { |
| | | url = btn.verify.linkProUrl |
| | | if (!url) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '尚未添加正式系统链接地址!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | } else { |
| | | url = btn.verify.linkUrl |
| | | } |
| | | window.open(url) |
| | | } |
| | | } |
| | | |
| | | triggerNote = (res, ID) => { |
| | |
| | | |
| | | if (!id) return |
| | | |
| | | setTimeout(() => { |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: id, tempId: btn.verify.printTempId, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) |
| | | }, 500) |
| | | if (btn.verify.preHandle === 'true' && btn.verify.pre_func && /#position-print/.test(btn.verify.pre_func)) { |
| | | MKEmitter.emit('queryModuleParam', btn.$menuId, (res) => { |
| | | let searches = {} |
| | | res.search && res.search.forEach(item => { |
| | | searches[item.key] = item.value |
| | | }) |
| | | let _param = { id: id || '', tempId: btn.verify.printTempId, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM')} |
| | | |
| | | try { |
| | | // eslint-disable-next-line |
| | | let func = new Function('btn', 'searches', 'param', 'systemType', btn.verify.pre_func) |
| | | _param = func(btn, searches, _param, window.GLOB.systemType) |
| | | } catch (e) { |
| | | console.warn(e) |
| | | } |
| | | |
| | | if (!_param || _param.error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: _param ? _param.error : '未获取到打印参数,自定义脚本错误!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify(_param)))) |
| | | }) |
| | | } else { |
| | | setTimeout(() => { |
| | | window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: id, tempId: btn.verify.printTempId, pageId: btn.$MenuID || '', dataM: sessionStorage.getItem('dataM') })))) |
| | | }, 200) |
| | | } |
| | | } |
| | | |
| | | sendWxMessage = (verify, id) => { |
| | |
| | | } |
| | | |
| | | modelconfirm = () => { |
| | | const { btn, BID } = this.props |
| | | const { BID } = this.props |
| | | const { btnconfig, selines } = this.state |
| | | let _this = this |
| | | |
| | |
| | | console.warn(e) |
| | | _item.value = '' |
| | | } |
| | | } else if (item.interception === 'charTure') { |
| | | let str = _item.value.replace(/(^\s*|\s*$)/g, '') |
| | | let result = '' |
| | | for (let i = 0 ; i < str.length; i++) { |
| | | let code = str.charCodeAt(i) |
| | | if (code >= 65281 && code <= 65373) { |
| | | result += String.fromCharCode(str.charCodeAt(i) - 65248) |
| | | } else if (code === 12288) { |
| | | result += String.fromCharCode(str.charCodeAt(i) - 12288 + 32) |
| | | } else { |
| | | result += str.charAt(i) |
| | | } |
| | | } |
| | | _item.value = result |
| | | } else { |
| | | _item.value = _item.value.replace(/(^\s*|\s*$)/g, '') |
| | | } |
| | |
| | | this.execSubmit(selines, () => {}, result) |
| | | } else { |
| | | confirm({ |
| | | title: btn.tipTitle || '确定要执行吗?', |
| | | title: btnconfig.setting.tipTitle || '确定要执行吗?', |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | _this.execSubmit(selines, resolve, result) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { btn } = this.props |
| | | const { btn, name } = this.props |
| | | const { loadingNumber, loadingTotal, loading, disabled, hidden, check, count } = this.state |
| | | |
| | | if (hidden) return null |
| | |
| | | } |
| | | |
| | | let label = '' |
| | | let icon = '' |
| | | let type = 'link' |
| | | let className = '' |
| | | |
| | | if (btn.show === 'button') { |
| | | label = btn.label |
| | | icon = btn.icon || '' |
| | | } else if (btn.show === 'link') { |
| | | label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> |
| | | icon = '' |
| | | if (btn.show === 'link') { |
| | | label = <span>{name || btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon} /> : ''}</span> |
| | | } else if (btn.show === 'icon') { |
| | | icon = btn.icon || '' |
| | | } else if (!btn.$toolbtn) { |
| | | icon = btn.icon || '' |
| | | label = btn.label |
| | | className = 'mk-btn mk-' + (btn.class || 'unset') |
| | | label = !loading ? <MkIcon type={btn.icon} /> : null |
| | | } else if (btn.$toolbtn) { |
| | | label = <span>{!loading && btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{loadingNumber && !loadingTotal ? `(${loadingNumber})` : ''}{btn.label}</span> |
| | | } else { |
| | | type = '' |
| | | icon = btn.icon || '' |
| | | label = btn.label |
| | | className = 'mk-btn mk-' + (btn.class || 'unset') |
| | | } |
| | | |
| | | if (loadingNumber && btn.progress !== 'progressbar' && btn.$toolbtn && (!btn.show || btn.show === 'button')) { |
| | | label = (loadingNumber ? `(${loadingNumber})` : '') + btn.label |
| | | label = <span>{!loading && btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{name || btn.label}</span> |
| | | } |
| | | |
| | | let BTN = <Button |
| | | type={type} |
| | | icon={icon} |
| | | type="link" |
| | | id={'button' + btn.uuid} |
| | | title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} |
| | | loading={loading} |
| | | disabled={disabled} |
| | | style={btn.style} |
| | | className={className} |
| | | className={btn.hover || ''} |
| | | onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} |
| | | >{label}</Button> |
| | | |