add locStatus with location

This commit is contained in:
Jay
2017-04-10 15:40:40 +08:00
parent 108e7db8f3
commit 59331f9b1c
7 changed files with 346 additions and 10 deletions
+210
View File
@@ -87816,6 +87816,11 @@ var ListItem = function ListItem(_ref) {
null,
data.wristband
),
_react2.default.createElement(
_semanticUiReact.Table.Cell,
null,
data.name
),
_react2.default.createElement(
_semanticUiReact.Table.Cell,
null,
@@ -88022,6 +88027,14 @@ var LocStatus = function (_React$Component) {
'\u624B\u74B0ID',
this.renderSortIcon('mac')
),
_react2.default.createElement(
_semanticUiReact.Table.HeaderCell,
{ className: 'pointer', onClick: function onClick() {
_this2.handlerSort('name');
} },
'\u624B\u74B0\u540D\u7A31',
this.renderSortIcon('name')
),
_react2.default.createElement(
_semanticUiReact.Table.HeaderCell,
{ className: 'pointer', onClick: function onClick() {
@@ -88895,6 +88908,10 @@ var _Location = __webpack_require__(1110);
var _Location2 = _interopRequireDefault(_Location);
var _LocStatusWloc = __webpack_require__(1149);
var _LocStatusWloc2 = _interopRequireDefault(_LocStatusWloc);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -88929,6 +88946,8 @@ var WristbandPage = function (_React$Component) {
switch (_this.state.page) {
case 'locstatus':
return _react2.default.createElement(_LocStatus2.default, null);
case 'locstatus_wloc':
return _react2.default.createElement(_LocStatusWloc2.default, null);
case 'wristband':
return _react2.default.createElement(_WristbandInfo2.default, null);
case 'location':
@@ -88989,6 +89008,13 @@ var WristbandPage = function (_React$Component) {
_this2.changePage('locstatus');
} },
'\u4F4D\u7F6E\u8CC7\u8A0A'
),
_react2.default.createElement(
_semanticUiReact.Menu.Item,
{ active: this.state.page == 'locstatus_wloc', onClick: function onClick() {
_this2.changePage('locstatus_wloc');
} },
'\u4F4D\u7F6E\u8CC7\u8A0A - \u5730\u9EDE\u5206\u985E'
)
)
)
@@ -93716,5 +93742,189 @@ var PageRoot = function (_React$Component) {
_reactDom2.default.render(_react2.default.createElement(PageRoot, null), document.getElementById('app'));
/***/ }),
/* 1147 */,
/* 1148 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(0);
var _react2 = _interopRequireDefault(_react);
var _semanticUiReact = __webpack_require__(8);
var _actions = __webpack_require__(20);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var LocStatusWloc = function (_React$Component) {
_inherits(LocStatusWloc, _React$Component);
function LocStatusWloc() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, LocStatusWloc);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = LocStatusWloc.__proto__ || Object.getPrototypeOf(LocStatusWloc)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
loc: []
}, _this.getLocList = function () {
var _this$props = _this.props,
toggleLoading = _this$props.toggleLoading,
showDialog = _this$props.showDialog;
toggleLoading(1);
fetch('/api/wristband/getlocationlist', (0, _actions.getRequest)()).then(function (response) {
return response.json();
}).then(function (json) {
toggleLoading(0);
if (json.status != 1) return showDialog(json.message);
_this.setState({
loc: json.data.record || []
}, function () {
_this.getStatus();
});
});
}, _this.getStatus = function () {
var _this$props2 = _this.props,
toggleLoading = _this$props2.toggleLoading,
showDialog = _this$props2.showDialog;
fetch('/api/wristband/getstatus', (0, _actions.getRequest)()).then(function (response) {
return response.json();
}).then(function (json) {
if (json.status != 1) return showDialog(json.message);
var record = json.data.record || [];
var locs = _this.state.loc;
for (var i in locs) {
locs[i].list = [];
}
for (var _i in record) {
var tmp = record[_i];
if (!tmp.locid) continue;
for (var j in locs) {
if (locs[j].serialnumber == tmp.locid) {
locs[j].list.push(tmp);
}
}
}
_this.setState({
loc: locs
});
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(LocStatusWloc, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.getLocList();
}
}, {
key: 'render',
value: function render() {
return _react2.default.createElement(
_semanticUiReact.Container,
{ fluid: true },
_react2.default.createElement(
_semanticUiReact.Grid,
{ columns: 3 },
this.state.loc.map(function (t, idx) {
return _react2.default.createElement(
_semanticUiReact.Grid.Column,
{ key: idx, className: 'clearfix' },
_react2.default.createElement(_semanticUiReact.Header, { as: 'h5', content: t.name }),
_react2.default.createElement(
_semanticUiReact.Segment,
{ style: { height: '400px', overflow: 'auto' } },
_react2.default.createElement(
_semanticUiReact.List,
null,
t.list ? t.list.map(function (tt, idx) {
return _react2.default.createElement(
_semanticUiReact.List.Item,
{ key: idx },
tt.name ? _react2.default.createElement(_semanticUiReact.Label, { basic: true, color: 'blue', size: 'tiny', content: tt.name }) : null,
_react2.default.createElement(_semanticUiReact.Label, { basic: true, color: 'teal', size: 'tiny', content: tt.mac })
);
}) : null
)
)
);
})
)
);
}
}]);
return LocStatusWloc;
}(_react2.default.Component);
exports.default = LocStatusWloc;
/***/ }),
/* 1149 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _reactRedux = __webpack_require__(24);
var _actions = __webpack_require__(20);
var _LocStatusWloc = __webpack_require__(1148);
var _LocStatusWloc2 = _interopRequireDefault(_LocStatusWloc);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var mapStateToProps = function mapStateToProps(state) {
return {
i18n: state.i18n
};
};
var mapDispatchToProps = function mapDispatchToProps(dispatch, ownProps) {
return {
showDialog: function showDialog(msg) {
dispatch((0, _actions.add_dialog_msg)(msg));
},
toggleLoading: function toggleLoading() {
var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
dispatch((0, _actions.toggle_loading)(flag));
}
};
};
exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_LocStatusWloc2.default);
/***/ })
/******/ ]);