This commit is contained in:
Jay 2017-03-31 18:10:37 +08:00
parent e529794956
commit 7cfdf4f2af
2 changed files with 34 additions and 13 deletions

View File

@ -92615,7 +92615,7 @@ var _react = __webpack_require__(0);
var _react2 = _interopRequireDefault(_react); var _react2 = _interopRequireDefault(_react);
__webpack_require__(8); var _semanticUiReact = __webpack_require__(8);
var _actions = __webpack_require__(22); var _actions = __webpack_require__(22);
@ -92642,15 +92642,16 @@ var TimezoneForm = function (_React$Component) {
} }
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TimezoneForm.__proto__ || Object.getPrototypeOf(TimezoneForm)).call.apply(_ref, [this].concat(args))), _this), _this.state = { return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TimezoneForm.__proto__ || Object.getPrototypeOf(TimezoneForm)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
zone: [], zones: [],
zoneset: '' zone: '',
loc: ''
}, _this.getZones = function () { }, _this.getZones = function () {
fetch('/api/system/gettimezonelist', (0, _actions.getRequest)()).then(function (response) { fetch('/api/system/gettimezonelist', (0, _actions.getRequest)()).then(function (response) {
return response.json(); return response.json();
}).then(function (json) { }).then(function (json) {
if (json.status != 1) return _this.props.showDialog(json.message); if (json.status != 1) return _this.props.showDialog(json.message);
_this.setState({ _this.setState({
zone: json.data.record || [] zones: json.data.record || []
}); });
}); });
}, _this.getZoneSet = function () { }, _this.getZoneSet = function () {
@ -92658,8 +92659,10 @@ var TimezoneForm = function (_React$Component) {
return response.json(); return response.json();
}).then(function (json) { }).then(function (json) {
if (json.status != 1) return _this.props.showDialog(json.message); if (json.status != 1) return _this.props.showDialog(json.message);
var tz = (json.data.record[0].value || '').split('/');
_this.setState({ _this.setState({
zoneset: json.data.record[0].value || '' zone: tz[0] || '',
loc: tz[1] || ''
}); });
}); });
}, _temp), _possibleConstructorReturn(_this, _ret); }, _temp), _possibleConstructorReturn(_this, _ret);
@ -92674,7 +92677,16 @@ var TimezoneForm = function (_React$Component) {
}, { }, {
key: 'render', key: 'render',
value: function render() { value: function render() {
return null; return _react2.default.createElement(
_semanticUiReact.Form,
null,
_react2.default.createElement(
_semanticUiReact.Form.Field,
null,
_react2.default.createElement(_semanticUiReact.Input, { label: '\u7CFB\u7D71Timezone',
value: '' + this.state.zone + (this.state.zone.length > 0 ? '/' : '') + this.state.loc })
)
);
} }
}]); }]);

View File

@ -1,11 +1,12 @@
import React from 'react'; import React from 'react';
import {} from 'semantic-ui-react'; import {Form, Input, Button} from 'semantic-ui-react';
import {getRequest} from '../../../actions'; import {getRequest} from '../../../actions';
class TimezoneForm extends React.Component { class TimezoneForm extends React.Component {
state = { state = {
zone: [], zones: [],
zoneset: '' zone: '',
loc: ''
} }
componentDidMount(){ componentDidMount(){
@ -19,7 +20,7 @@ class TimezoneForm extends React.Component {
.then(json => { .then(json => {
if(json.status != 1) return this.props.showDialog(json.message); if(json.status != 1) return this.props.showDialog(json.message);
this.setState({ this.setState({
zone: json.data.record || [] zones: json.data.record || []
}) })
}) })
} }
@ -29,15 +30,23 @@ class TimezoneForm extends React.Component {
.then(response=>response.json()) .then(response=>response.json())
.then(json => { .then(json => {
if(json.status != 1) return this.props.showDialog(json.message); if(json.status != 1) return this.props.showDialog(json.message);
let tz = (json.data.record[0].value || '').split('/');
this.setState({ this.setState({
zoneset: json.data.record[0].value || '' zone: tz[0] || '',
}) loc: tz[1] || ''
});
}) })
} }
render(){ render(){
return ( return (
null <Form>
<Form.Field>
<Input label="系統Timezone"
value={`${this.state.zone}${this.state.zone.length > 0 ? '/' : ''}${this.state.loc}`} />
</Form.Field>
</Form>
) )
} }
} }