| | |
| | | import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin' |
| | | import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout' |
| | | import MenuForm from '@/templates/tableshare/menuform' |
| | | import TransferForm from '@/components/transferform' |
| | | import SourceElement from '@/templates/tableshare/dragelement/source' |
| | | import Source from './source' |
| | | import './index.scss' |
| | |
| | | showColumnName: false, // 显示列字段名控制 |
| | | tabviews: [], // 所有标签页 |
| | | profileVisible: false, // 验证信息模态框 |
| | | optionLibs: null // 自定义下拉选项库 |
| | | optionLibs: null, // 自定义下拉选项库 |
| | | thawBtnVisible: false, // 解冻按钮弹窗 |
| | | thawbtnlist: null, // 解冻按钮列表 |
| | | thawButtons: [] // 已选择要解冻的按钮 |
| | | } |
| | | |
| | | /** |
| | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | // _config.uuid = Utils.getuuid() |
| | | // _config.action = _config.action.map(item => { |
| | | // let uuid = Utils.getuuid() |
| | | // if (item.OpenType === 'pop') { // 含有子配置项的按钮 |
| | | // _oriActions.push({ |
| | | // prebtn: JSON.parse(JSON.stringify(item)), |
| | | // curuuid: uuid, |
| | | // Template: 'Modal' |
| | | // }) |
| | | // } |
| | | |
| | | // item.uuid = uuid |
| | | // return item |
| | | // }) |
| | | |
| | | this.setState({ |
| | | originActions: _oriActions, |
| | |
| | | } |
| | | |
| | | deleteElement = (element) => { |
| | | const { thawButtons } = this.state |
| | | |
| | | let _this = this |
| | | confirm({ |
| | | content: `确定删除<<${element.card.label}>>吗?`, |
| | |
| | | // 删除按钮元素 |
| | | let _delActions = _this.state.delActions |
| | | if (element.type === 'action') { |
| | | _delActions.push(element.card.uuid) |
| | | _delActions.push(element) |
| | | } |
| | | |
| | | _this.setState({ |
| | | config: _config, |
| | | delActions: _delActions |
| | | delActions: _delActions, |
| | | thawButtons: thawButtons.filter(key => key !== element.card.uuid) |
| | | }) |
| | | }, |
| | | onCancel() {} |
| | |
| | | * @description 标签页保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { delActions, originConfig } = this.state |
| | | const { delActions, thawButtons, originConfig } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | |
| | | let deffers = delActions.map(item => { |
| | | let _param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: item |
| | | MenuID: item.card.uuid |
| | | } |
| | | |
| | | let _ParentParam = null |
| | | |
| | | try { |
| | | _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) |
| | | } catch (e) { |
| | | _ParentParam = null |
| | | } |
| | | |
| | | if (_ParentParam) { |
| | | _param.ParentParam = _ParentParam |
| | | } |
| | | |
| | | return new Promise(resolve => { |
| | | Api.getSystemConfig(_param).then(response => { |
| | | resolve(response) |
| | |
| | | }) |
| | | } else if (delActions.length === 0) { |
| | | resolve(true) |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | | |
| | | if (thawButtons.length > 0) { |
| | | let defers = thawButtons.map(item => { |
| | | return new Promise((resolve) => { |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_MainMenu_ReDel', |
| | | MenuID: item |
| | | }).then(res => { |
| | | if (res.status) { |
| | | resolve('') |
| | | } else { |
| | | resolve(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | return Promise.all(defers) |
| | | } else { |
| | | return true |
| | | } |
| | | }).then(res => { |
| | | if (res === true || res === false) return res |
| | | |
| | | let msg = res.filter(Boolean)[0] |
| | | if (msg) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: msg, |
| | | duration: 10 |
| | | }) |
| | | return false |
| | | } else { |
| | | this.setState({ |
| | | thawButtons: [] |
| | | }) |
| | | return true |
| | | } |
| | | }).then(resp => { |
| | | if (resp === false) return |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 解冻按钮 |
| | | */ |
| | | handleThaw = () => { |
| | | const { config } = this.state |
| | | |
| | | this.setState({ |
| | | thawBtnVisible: true |
| | | }) |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_FrozenMenu', |
| | | ParentID: config.uuid, |
| | | TYPE: 40 |
| | | }).then(res => { |
| | | if (res.status) { |
| | | let _list = [] |
| | | |
| | | res.data.forEach(menu => { |
| | | let _conf = '' |
| | | |
| | | if (menu.ParentParam) { |
| | | try { |
| | | _conf = JSON.parse(window.decodeURIComponent(window.atob(menu.ParentParam))) |
| | | } catch (e) { |
| | | _conf = '' |
| | | } |
| | | } |
| | | |
| | | if (_conf) { |
| | | _list.push({ |
| | | key: menu.MenuID, |
| | | title: menu.MenuName, |
| | | btnParam: _conf |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | thawbtnlist: _list |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 解冻按钮提交 |
| | | */ |
| | | thawBtnSubmit = () => { |
| | | const { thawButtons, config, thawbtnlist } = this.state |
| | | // 三级菜单解除冻结 |
| | | if (this.refs.trawmenu.state.targetKeys.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['form.required.select'] + this.state.dict['header.form.thawbutton'], |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | |
| | | thawbtnlist.forEach(item => { |
| | | if (this.refs.trawmenu.state.targetKeys.includes(item.key)) { |
| | | config.action.push(item.btnParam) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | thawButtons: [...thawButtons, ...this.refs.trawmenu.state.targetKeys], |
| | | config: config, |
| | | thawBtnVisible: false |
| | | }) |
| | | } |
| | | } |
| | | |
| | | render () { |
| | | const { modaltype } = this.state |
| | | const configAction = this.state.config.action.filter(_action => |
| | |
| | | {Source.actionItems.map((item, index) => { |
| | | return (<SourceElement key={index} content={item}/>) |
| | | })} |
| | | </div> |
| | | <div className="config-btn"> |
| | | {configAction.length > 0 ? |
| | | <p className="config-btn-title"> |
| | | <Tooltip placement="topLeft" title="点击按钮,可完成或查看按钮配置信息。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | {this.state.dict['header.menu.action.configurable']} |
| | | </p> : null |
| | | } |
| | | <div className="thawbutton" title={this.state.dict['header.form.thawbutton']} onClick={this.handleThaw}> |
| | | <Icon type="unlock" /> |
| | | </div> |
| | | </div> |
| | | {configAction.length > 0 ? |
| | | <p className="config-btn-title"> |
| | |
| | | > |
| | | {this.state.dict['header.menu.config.placeholder']} |
| | | </Modal> |
| | | {/* 解冻按钮模态框 */} |
| | | <Modal |
| | | title={this.state.dict['header.form.thawbutton']} |
| | | okText={this.state.dict['header.confirm']} |
| | | cancelText={this.state.dict['header.cancel']} |
| | | visible={this.state.thawBtnVisible} |
| | | onOk={this.thawBtnSubmit} |
| | | onCancel={() => {this.setState({thawBtnVisible: false, thawbtnlist: null})}} |
| | | destroyOnClose |
| | | > |
| | | {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} |
| | | {this.state.thawbtnlist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawbtnlist}/>} |
| | | </Modal> |
| | | {this.state.loading && <Spin size="large" />} |
| | | </div> |
| | | ) |