add wristband sort

This commit is contained in:
Jay 2017-04-05 16:45:58 +08:00
parent 8d8b4818ae
commit c132be1ed0
4 changed files with 18 additions and 9 deletions

View File

@ -87819,7 +87819,7 @@ var ListItem = function ListItem(_ref) {
_react2.default.createElement( _react2.default.createElement(
_semanticUiReact.Table.Cell, _semanticUiReact.Table.Cell,
null, null,
data.locname ? data.locname : data.last_locname data.locname
), ),
_react2.default.createElement( _react2.default.createElement(
_semanticUiReact.Table.Cell, _semanticUiReact.Table.Cell,
@ -87974,7 +87974,7 @@ var LocStatus = function (_React$Component) {
_this.getList(); _this.getList();
}); });
}, _this.renderSortIcon = function (tag) { }, _this.renderSortIcon = function (tag) {
if (_this.state.sort.field == tag) return _react2.default.createElement(_semanticUiReact.Icon, { size: 'mini', corner: true, name: sort_icon[_this.state.sort.order] }); if (_this.state.sort.field == tag) return _react2.default.createElement(_semanticUiReact.Icon, { size: 'large', name: sort_icon[_this.state.sort.order] });
return null; return null;
}, _temp), _possibleConstructorReturn(_this, _ret); }, _temp), _possibleConstructorReturn(_this, _ret);
} }
@ -88024,8 +88024,11 @@ var LocStatus = function (_React$Component) {
), ),
_react2.default.createElement( _react2.default.createElement(
_semanticUiReact.Table.HeaderCell, _semanticUiReact.Table.HeaderCell,
null, { className: 'pointer', onClick: function onClick() {
'\u5730\u9EDE' _this2.handlerSort('loc');
} },
'\u5730\u9EDE',
this.renderSortIcon('loc')
), ),
_react2.default.createElement( _react2.default.createElement(
_semanticUiReact.Table.HeaderCell, _semanticUiReact.Table.HeaderCell,

View File

@ -127,7 +127,7 @@ router
}) })
.post('/getstatus', (req, res, n) => { .post('/getstatus', (req, res, n) => {
let query = "select w.`name`, l.`name` as locname, l2.`name` as last_locname, ll.*\ let query = "select w.`name`, coalesce(l.`name`, l2.`name`) as locname, ll.*\
from ??.?? w\ from ??.?? w\
left join ( \ left join ( \
select * from ( \ select * from ( \
@ -169,6 +169,9 @@ router
case 'val11': case 'val11':
query += `order by ll.${sortfield} ${sortorder}`; query += `order by ll.${sortfield} ${sortorder}`;
break; break;
case 'loc':
query += `order by locname ${sortorder}`;
break;
default: default:
query += 'order by w.`uid`'; query += 'order by w.`uid`';
break; break;

View File

@ -7,7 +7,7 @@ const ListItem = ({i18n, data}) => {
return ( return (
<Table.Row> <Table.Row>
<Table.Cell>{data.mac}</Table.Cell> <Table.Cell>{data.mac}</Table.Cell>
<Table.Cell>{data.locname ? data.locname : data.last_locname}</Table.Cell> <Table.Cell>{data.locname}</Table.Cell>
<Table.Cell>{data.val3 ? parseInt(data.val3, 16) : ''}</Table.Cell> <Table.Cell>{data.val3 ? parseInt(data.val3, 16) : ''}</Table.Cell>
<Table.Cell>{data.val4 ? `${parseInt(data.val4, 16)}%` : ''}</Table.Cell> <Table.Cell>{data.val4 ? `${parseInt(data.val4, 16)}%` : ''}</Table.Cell>
<Table.Cell>{data.val2 ? `${parseInt(data.val2, 16)}` : ''}</Table.Cell> <Table.Cell>{data.val2 ? `${parseInt(data.val2, 16)}` : ''}</Table.Cell>

View File

@ -83,7 +83,7 @@ class LocStatus extends React.Component{
renderSortIcon = (tag) => { renderSortIcon = (tag) => {
if(this.state.sort.field == tag) if(this.state.sort.field == tag)
return (<Icon size="mini" corner name={sort_icon[this.state.sort.order]} />); return (<Icon size="large" name={sort_icon[this.state.sort.order]} />);
return null; return null;
} }
@ -102,7 +102,10 @@ class LocStatus extends React.Component{
this.renderSortIcon('mac') this.renderSortIcon('mac')
} }
</Table.HeaderCell> </Table.HeaderCell>
<Table.HeaderCell>地點</Table.HeaderCell> <Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('loc')}}>
地點
{this.renderSortIcon('loc')}
</Table.HeaderCell>
<Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val3')}}> <Table.HeaderCell className="pointer" onClick={()=>{this.handlerSort('val3')}}>
步數 步數
{ {