HanvonAttendanceService/device-api-dump/sys_init.html

582 lines
16 KiB
HTML

<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title class="lang" key="device_setting">sys init</title>
<link href="resources/plugins/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet"/>
<link href="resources/plugins/jquery-confirm/jquery-confirm.min.css" rel="stylesheet"/>
<script src="resources/plugins/jquery.1.12.4.min.js"></script>
<script src="resources/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>
<script src="resources/plugins/bootstrap-table-1.17.0/bootstrap-table.min.js"></script>
<script src="resources/plugins/waves-0.7.5/waves.min.js"></script>
<script src="resources/plugins/jquery-confirm/jquery-confirm.min.js"></script>
<script src="resources/plugins/jquery.cookie.js"></script>
<link href="resources/plugins/jquery-toastmessage/resources/css/jquery.toastmessage.css" rel="stylesheet"/>
<script src="resources/plugins/jquery-toastmessage/javascript/jquery.toastmessage.js"></script>
<script src="resources/js/notify.js"></script>
<script src="resources/js/common.js"></script>
<script src="resources/js/lang.js"></script>
<script src="resources/js/crypto-js.min.js"></script>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
}
.AdduserDialog {
display: flex;
margin-left:25%;
flex-direction: column;
flex-grow: 1;
max-width: 50%;
width: 50%;
padding: 2rem;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.input-group {
flex: 1;
text-align: right;
}
.input-group, .btn {
margin: 0 10px;
}
.button-spacing {
margin-top: 10px;
margin-bottom: 10px;
width: 200px;
}
@media (max-width: 768px) {
.AdduserDialog {
display: flex;
margin-left:25%;
flex-direction: column;
flex-grow: 1;
width: 700px;
padding: 2rem;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
}
</style>
</head>
<body>
<div class="container">
<div class="AdduserDialog d-flex flex-column align-items-center">
<div class="panel text-center">
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="clean_all_user" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_ENROLL_DELETEALL"
href="javascript:;" onclick="cleanuserAction()">cleanuser</button>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="clean_all_log" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_ALLLOG_DELETE"
href="javascript:;" onclick="clealogAction()">clealog</button>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="clean_database" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_CLEAR_DATABASE"
href="javascript:;" onclick="cleandatabaseAction()">cleandatabase</button>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="init_menu" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_InitSystem"
href="javascript:;" onclick="initmenuAction()">initmenu</button>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="clean_admin" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_BenumbAllManager"
href="javascript:;" onclick="cleaadminAction()">cleaadmin</button>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="clean_inactive_user" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_CLEAR_INACTIVE_USERS"
href="javascript:;" onclick="cleaninactiveuserAction()">cleaninactiveuser</button>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="clean_all_snop" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_PHOTO_DELETE"
href="javascript:;" onclick="cleanlogphotoAction()">cleanlogphoto</button>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="factory_default" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_QUESTION_SETDEFAULT"
href="javascript:;" onclick="resetAction()">Reset to default setting</button>
</div>
</div>
<div class="row">
<div class="col-md-12 d-flex justify-content-center">
<button id="factory_default" type="" class="btn btn-danger waves-effect waves-float lang button-spacing"
key="UISTR_REBOOT"
href="javascript:;" onclick="rebootAction()">Reboot</button>
</div>
</div>
</div>
</div>
<div id="resetDialog" class="crudDialog" hidden>
<form>
</form>
</div>
</div>
<script>
check_permission();
lang_load();
function resetAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_QUESTION_SETDEFAULT,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = new Object()
send["password"] = $.cookie("pwd")
send["cmd"] = 'initsys'
console.log(send)
$.ajax({
url: debugserver+'/api',
type: 'POST',
async: false,
contentType:"application/json",
dataType: "json",
data: JSON.stringify(send),
beforeSend: function() {
},
success: function(json){
console.log(json)
notify(lang.UISTR_SUCCESSFUL);
},
error: function(error){
console.log("reset error::::",error);
notify(lang.UISTR_ERRNONESUCCESS)
},
always: function () {
}
})
}
},
cancel:{
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
}
}
}
});
}
function cleanuserAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_ENROLL_DELETEALL,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = new Object()
send["password"] = $.cookie("pwd")
send["cmd"] = 'cleanuser'
console.log(send)
$.ajax({
url: debugserver+'/api',
type: 'POST',
async: false,
contentType:"application/json",
dataType: "json",
data: JSON.stringify(send),
beforeSend: function() {
},
success: function(json){
console.log(json)
notify(lang.UISTR_SUCCESSFUL);
onUploadSuccess();
},
error: function(error){
console.log("reset error::::",error);
notify(lang.UISTR_ERRNONESUCCESS)
},
always: function () {
}
})
}
},
cancel:{
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
}
}
}
});
}
function clealogAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_ALLLOG_DELETE,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = new Object()
send["password"] = $.cookie("pwd")
send["cmd"] = 'cleanlog'
console.log(send)
$.ajax({
url: debugserver+'/api',
type: 'POST',
async: false,
contentType:"application/json",
dataType: "json",
data: JSON.stringify(send),
beforeSend: function() {
},
success: function(json){
console.log(json)
notify(lang.UISTR_SUCCESSFUL);
onUploadSuccess();
},
error: function(error){
console.log("reset error::::",error);
notify(lang.UISTR_ERRNONESUCCESS)
},
always: function () {
}
})
}
},
cancel:{
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
}
}
}
});
}
function cleaadminAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_BenumbAllManager,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = new Object()
send["password"] = $.cookie("pwd")
send["cmd"] = 'cleanadmin'
console.log(send)
$.ajax({
url: debugserver+'/api',
type: 'POST',
async: false,
contentType:"application/json",
dataType: "json",
data: JSON.stringify(send),
beforeSend: function() {
},
success: function(json){
console.log(json)
notify(lang.UISTR_SUCCESSFUL);
},
error: function(error){
console.log("reset error::::",error);
notify(lang.UISTR_ERRNONESUCCESS)
},
always: function () {
}
})
}
},
cancel:{
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
}
}
}
});
}
function cleaninactiveuserAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_CLEAR_INACTIVE_USERS,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = new Object()
send["password"] = $.cookie("pwd")
send["cmd"] = 'cleaninactiveuser'
console.log(send)
$.ajax({
url: debugserver+'/api',
type: 'POST',
async: false,
contentType:"application/json",
dataType: "json",
data: JSON.stringify(send),
beforeSend: function() {
},
success: function(json){
console.log(json)
notify(lang.UISTR_SUCCESSFUL);
onUploadSuccess();
},
error: function(error){
console.log("reset error::::",error);
notify(lang.UISTR_ERRNONESUCCESS)
},
always: function () {
}
})
}
},
cancel:{
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
}
}
}
});
}
function cleanlogphotoAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_PHOTO_DELETE,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = new Object()
send["password"] = $.cookie("pwd")
send["cmd"] = 'cleanlogphoto'
console.log(send)
$.ajax({
url: debugserver+'/api',
type: 'POST',
async: false,
contentType:"application/json",
dataType: "json",
data: JSON.stringify(send),
beforeSend: function() {
},
success: function(json){
console.log(json)
notify(lang.UISTR_SUCCESSFUL);
onUploadSuccess();
},
error: function(error){
console.log("reset error::::",error);
notify(lang.UISTR_ERRNONESUCCESS)
},
always: function () {
}
})
}
},
cancel:{
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
}
}
}
});
}
function initmenuAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_InitSystem,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = new Object()
send["password"] = $.cookie("pwd")
send["cmd"] = 'initmenu'
console.log(send)
$.ajax({
url: debugserver+'/api',
type: 'POST',
async: false,
contentType:"application/json",
dataType: "json",
data: JSON.stringify(send),
beforeSend: function() {
},
success: function(json){
console.log(json)
notify(lang.UISTR_SUCCESSFUL);
onUploadSuccess();
},
error: function(error){
console.log("reset error::::",error);
notify(lang.UISTR_ERRNONESUCCESS)
},
always: function () {
}
})
}
},
cancel:{
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
}
}
}
});
}
function rebootAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_REBOOT,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = {
password: $.cookie("pwd"),
cmd: 'reboot'
};
console.log(send);
// 发送请求到服务器
$.ajax({
url: debugserver + '/api',
type: 'POST',
async: true, // 使用默认的异步请求
contentType: "application/json",
data: JSON.stringify(send),
beforeSend: function () {
},
always: function () {
notify(lang.UISTR_SUCCESSFUL);
}
});
}
},
cancel: {
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
// 取消操作
}
}
}
});
}
function cleandatabaseAction() {
$.confirm({
type: 'dark',
animationSpeed: 300,
title: window.lang.UISTR_CLEAR_DATABASE,
content: $('#resetDialog').html(),
buttons: {
confirm: {
text: lang.UISTR_YES_OK,
btnClass: 'waves-effect waves-button',
action: function () {
let send = new Object()
send["password"] = $.cookie("pwd")
send["cmd"] = 'cleandatebase'
console.log(send)
$.ajax({
url: debugserver+'/api',
type: 'POST',
async: false,
contentType:"application/json",
dataType: "json",
data: JSON.stringify(send),
beforeSend: function() {
},
success: function(json){
console.log(json)
$.alert(lang.UISTR_SUCCESSFUL);
},
error: function(error){
console.log("reset error::::",error);
notify(lang.UISTR_ERRNONESUCCESS)
},
always: function () {
}
})
}
},
cancel:{
text: lang.UISTR_NO_ESC,
btnClass: 'waves-effect waves-button',
action: function () {
}
}
}
});
}
function onUploadSuccess() {
const homeChannel = new BroadcastChannel('home_refresh_channel');
homeChannel.postMessage({type: 'refresh_home'});
homeChannel.close();
}
</script>
</body>
</html>