Files
myapp-full/myapp/ns_user/templates/users.html

97 lines
2.5 KiB
HTML
Raw Normal View History

2022-05-03 22:34:52 +03:00
{% extends "/private/skeleton.html" %}
2020-02-08 05:05:43 +03:00
{% block content %}
<h3>Список пользователей</h3>
<hr />
2022-05-03 22:34:52 +03:00
{% include '/inc/filter.html' %}
2022-05-03 22:34:52 +03:00
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getUsers"></pagination-component>
2022-05-03 22:34:52 +03:00
{% include '/inc/users.html' %}
2020-02-17 01:05:56 +03:00
<pagination-component v-bind:pagination="pagination" v-bind:click-handler="getUsers"></pagination-component>
<backtotop-component></backtotop-component>
{% endblock %}
{% block breadcrumb %}
<ol class="breadcrumb mt-3">
<li class="breadcrumb-item"><a href="/"><i class="fa fa-home"></i></a></li>
<li class="breadcrumb-item">Список пользователей</li>
</ol>
{% endblock %}
{% block script %}
<script type="text/javascript" src="/static/components/backtotop.js"></script>
<link rel="stylesheet" href="/static/components/backtotop.css"></link>
2020-02-17 01:05:56 +03:00
<script type="text/javascript" src="/static/components/pagination.js"></script>
<script type="text/javascript">
2022-05-03 22:34:52 +03:00
Object.assign(root.data, {
raw_users: [],
pagination: {{ pagedata['pagination']|tojson|safe }},
});
Object.assign(root.methods, {
getUsers: function() {
2019-12-12 17:45:27 +03:00
let vm = this;
2020-02-17 01:05:56 +03:00
axios.post(
'/api',
2022-05-03 22:34:52 +03:00
{
"jsonrpc": "2.0",
"method": "users",
"params": {
"page": vm.pagination.page
2020-02-17 01:05:56 +03:00
},
2022-05-03 22:34:52 +03:00
"id": 1
}
2020-02-17 01:05:56 +03:00
).then(
function(response) {
2022-05-03 22:34:52 +03:00
if ('result' in response.data) {
vm.raw_users = response.data['result'];
2020-02-17 01:05:56 +03:00
}
}
);
}
2022-05-03 22:34:52 +03:00
});
Object.assign(root.computed, {
users: function() {
let vm = this;
return vm.raw_users;
}
});
root.created = function() {
let vm = this;
axios.post(
'/api',
[
{
"jsonrpc": "2.0",
"method": 'users',
"params": {
"page": vm.pagination.page
},
"id": 1
},
{
"jsonrpc": "2.0",
"method": 'users.count',
"params": {},
"id": 1
}
]
).then(
function(response) {
if ('result' in response.data[0]) {
vm.raw_users = response.data[0]['result'];
}
if ('result' in response.data[1]) {
vm.pagination.size = response.data[1]['result'];
}
}
);
};
</script>
{% endblock %}