import React from 'react'; import { Button, Icon, Switch, Tooltip, message } from 'antd'; import { WeaTools, WeaDialog, WeaSearchGroup, WeaFormItem, WeaInput, WeaBrowser } from 'ecCom'; import './style/'; class WeaSystemSetting extends React.Component { state = { visible: false, data: {} }; fn ; //保存事件 constructor(props) { super(props); this.getButtons = this.getButtons.bind(this); this.getSettingData = this.getSettingData.bind(this); this.setMulitLangPermission = this.setMulitLangPermission.bind(this); this.onChange = this.onChange.bind(this); this.onSave = this.onSave.bind(this); this.onCancel = this.onCancel.bind(this); this.onShow = this.onShow.bind(this); } componentDidMount(){ const { fn } = this.props; this.fn = fn; } render() { const { data } = this.state; const { canEdit = false, enableMultiLang = false, oaaddress, licenseRemind, remindUserNames, remindDays, picturePath, filesystem, filesystembackup, filesystembackuptime, needzip, isaesencrypt, } = data; return ( this.onChange({ oaaddress: value })} /> { canEdit ? this.onChange({ licenseRemind: checked ? '1' : '0' })} /> : '' } { canEdit && licenseRemind == '1' ? this.onChange({ remindUsers: ids, remindUserNames: datas })} /> : '' } { canEdit && licenseRemind == '1' ? this.onChange({ remindDays: value })} /> : '' } this.onChange({ picturePath: value })} /> this.onChange({ filesystem: value })} /> this.onChange({ filesystembackup: value })} /> this.onChange({ filesystembackuptime: value })} /> this.onChange({ needzip: checked ? '1' : '0' })} /> this.onChange({ isaesencrypt: checked ? '1' : '0' })} /> { enableMultiLang ?
设置
: '' }
); } getButtons() { const { data } = this.state; let buttons = []; if (data.canEdit) { buttons.push(); } return buttons; } getSettingData() { WeaTools.callApi('/api/portal/systemInfo/getSettingData', 'GET', {}).then((result) => { const { data } = result; this.setState({ data }); }); } setMulitLangPermission() { const dialog = new window.top.Dialog(); dialog.currentWindow = window; dialog.Height = 650; dialog.Width = 600; dialog.Title = '多语言授权设置'; dialog.URL = '/docs/tabs/DocCommonTab.jsp?_fromURL=80&isdialog=1'; dialog.show(); } onChange(obj) { const { data } = this.state; this.setState({ data: { ...data, ...obj } }); } onSave() { const { data } = this.state; WeaTools.callApi('/api/portal/systemInfo/saveSettingData', 'POST', { ...data, }).then((result) => { typeof (this.fn)==='function'&&this.fn(data.oaaddress); this.onCancel(); }); } onCancel() { this.setState({ visible: false }); } onShow() { this.setState({ visible: true }); this.getSettingData(); } } export default WeaSystemSetting;