Commit 147527b4 by 潘建波

数据备份功能

1 parent e027c379
No preview for this file type
{"commit":"691991bbd1fc9a261aa46284893f29f6b4201135","commitDate":"2020-7-20 16:42","buildDate":"2020-7-20 16:43","version":"2.0.6","info":"✨ 事件检索和违法检索详情页加视频播放功能"}
\ No newline at end of file \ No newline at end of file
{"commit":"e027c3792443d9a0b2edf96e71ba985bc50bed6b","commitDate":"2020-7-21 14:31","buildDate":"2020-7-23 16:1","version":"2.0.6","info":"feat✨ video播放按钮移植到详情页"}
\ No newline at end of file \ No newline at end of file
import api from '../index' import api from "../index";
import baseUrl from '../baseUrl' import baseUrl from "../baseUrl";
export default { export default {
getUserList(params,id){ getUserList(params, id) {
return api.get(`${baseUrl}/api/v1/auth/users`, params) return api.get(`${baseUrl}/api/v1/auth/users`, params);
}, },
getRoleList(params,id) { getRoleList(params, id) {
return api.get(`${baseUrl}/api/v1/auth/roles`, params) return api.get(`${baseUrl}/api/v1/auth/roles`, params);
}, },
addUser(params){ addUser(params) {
return api.post(`${baseUrl}/api/v1/auth/users`, params) return api.post(`${baseUrl}/api/v1/auth/users`, params);
}, },
editUser(params,id) { editUser(params, id) {
return api.post(`${baseUrl}/api/v1/auth/users/${id}`, params) return api.post(`${baseUrl}/api/v1/auth/users/${id}`, params);
}, },
resetPwd(params,id) { resetPwd(params, id) {
return api.post(`${baseUrl}/api/v1/auth/users/${id}/password`, params) return api.post(`${baseUrl}/api/v1/auth/users/${id}/password`, params);
}, },
delUser(params,id){ delUser(params, id) {
return api.delete(`${baseUrl}/api/v1/auth/users/${id}`, params) return api.delete(`${baseUrl}/api/v1/auth/users/${id}`, params);
}, },
addRole(params){ addRole(params) {
return api.post(`${baseUrl}/api/v1/auth/roles`, params) return api.post(`${baseUrl}/api/v1/auth/roles`, params);
}, },
unbindRole(params,id,id2){ unbindRole(params, id, id2) {
return api.delete(`${baseUrl}/api/v1/auth/users/${id}/roles/${id2}`, params) return api.delete(
}, `${baseUrl}/api/v1/auth/users/${id}/roles/${id2}`,
logList(params){ params
return api.get(`${baseUrl}/api/v1/devconf_fx/logs`, params) );
}, },
bindperms(params,id){ logList(params) {
return api.post(`${baseUrl}/api/v1/auth/roles/${id}/perms`, params) return api.get(`${baseUrl}/api/v1/devconf_fx/logs`, params);
}, },
getPerms(params,id){ bindperms(params, id) {
return api.get(`${baseUrl}/api/v1/auth/roles/${id}/perms`, params) return api.post(`${baseUrl}/api/v1/auth/roles/${id}/perms`, params);
}, },
editRole(params,id){ getPerms(params, id) {
return api.post(`${baseUrl}/api/v1/auth/roles/${id}`, params) return api.get(`${baseUrl}/api/v1/auth/roles/${id}/perms`, params);
}, },
bindRole(params,id){ editRole(params, id) {
return api.post(`${baseUrl}/api/v1/auth/users/${id}/roles`, params) return api.post(`${baseUrl}/api/v1/auth/roles/${id}`, params);
}, },
getDevsTime(params,id,id2){ bindRole(params, id) {
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/time`, params) return api.post(`${baseUrl}/api/v1/auth/users/${id}/roles`, params);
}, },
manualTime(params,id,id2){ getDevsTime(params, id, id2) {
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/time`, params) return api.get(
}, `${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/time`,
getNtp(params,id,id2){ params
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/timing/ntp`, params) );
}, },
ntpTime(params,id,id2){ manualTime(params, id, id2) {
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/timing/ntp`, params) return api.post(
}, `${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/time`,
factoryReset(params,id,id2){ params
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/factory-reset`, params) );
}, },
importParams(params,id,id2){ getNtp(params, id, id2) {
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/parameters/import`, params,{'Content-Type': 'multipart/form-data'}) return api.get(
}, `${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/timing/ntp`,
exportParams(params,id,id2){ params
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/parameters/export`, params) );
}, },
manualReboot(params,id,id2){ ntpTime(params, id, id2) {
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/reboot/manual`, params) return api.post(
}, `${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/timing/ntp`,
intervalReboot(params,id,id2){ params
return api.post(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/reboot/auto`, params) );
}, },
getRebootSetting(params,id,id2){ factoryReset(params, id, id2) {
return api.get(`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/reboot/auto`, params) return api.post(
`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/factory-reset`,
params
);
},
importParams(params, id, id2) {
return api.post(
`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/parameters/import`,
params,
{ "Content-Type": "multipart/form-data" }
);
},
exportParams(params, id, id2) {
return api.get(
`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/parameters/export`,
params
);
},
manualReboot(params, id, id2) {
return api.post(
`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/reboot/manual`,
params
);
},
intervalReboot(params, id, id2) {
return api.post(
`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/reboot/auto`,
params
);
},
getRebootSetting(params, id, id2) {
return api.get(
`${baseUrl}/api/v1/devconf_fx/devs/${id}/fx_devs/${id2}/reboot/auto`,
params
);
}, },
downloadOcx(params) { downloadOcx(params) {
return api.get(`${baseUrl}/api/v1/devconf_fx/dlfile`, params) return api.get(`${baseUrl}/api/v1/devconf_fx/dlfile`, params);
},
exportback(params) {
return api.get(`${baseUrl}/api/v1/devconf_fx/backup`, params);
} }
}
\ No newline at end of file \ No newline at end of file
};
...@@ -34,8 +34,10 @@ ...@@ -34,8 +34,10 @@
:on-change="fileChange" :on-change="fileChange"
:multiple="false" :multiple="false"
:show-file-list="false" :show-file-list="false"
action="https://jsonplaceholder.typicode.com/posts/"
:auto-upload="false" :auto-upload="false"
:action="exurl"
:on-success="successback"
:on-error="onerrorback"
> >
<el-button <el-button
slot="trigger" slot="trigger"
...@@ -58,7 +60,11 @@ ...@@ -58,7 +60,11 @@
<div class="lineBox"> <div class="lineBox">
<span class="upTit">参数导出</span <span class="upTit">参数导出</span
><span class="upTit2" ><span class="upTit2"
><el-button size="small" type="primary" class="primaryButton" ><el-button
size="small"
type="primary"
class="primaryButton"
@click="exportparams"
>参数导出</el-button >参数导出</el-button
></span ></span
> >
...@@ -155,6 +161,7 @@ export default { ...@@ -155,6 +161,7 @@ export default {
openRestart: false, openRestart: false,
selectFilename: "", selectFilename: "",
timeArr: [], timeArr: [],
exurl: "http://" + location.host + "/api/v1/devconf_fx/restore",
file: null, file: null,
dev_unid: localStorage.getItem("dev_unid"), dev_unid: localStorage.getItem("dev_unid"),
device_id: sessionStorage.getItem("device_id") device_id: sessionStorage.getItem("device_id")
...@@ -193,32 +200,18 @@ export default { ...@@ -193,32 +200,18 @@ export default {
let importFileExt = this.file.name.substr( let importFileExt = this.file.name.substr(
this.file.name.lastIndexOf(".") this.file.name.lastIndexOf(".")
); );
if (importFileExt !== ".zip") {
this.$message({
type: "warning",
message: '只支持"*.zip"文件'
});
return;
}
this.$refs.upload.submit(); // 这里是执行文件上传的函数,其实也就是获取我们要上传的文件 this.$refs.upload.submit(); // 这里是执行文件上传的函数,其实也就是获取我们要上传的文件
// 最重要的就是这段代码 },
var importParams = new FormData(); // 首先创建FormData对象 successback() {
importParams.append("file", this.file);
this.$api.ops
.importParams(importParams, this.dev_unid, this.device_id)
.then(res => {
if (res.ecode != undefined && res.ecode != 200) {
this.$message({
type: "error",
message: "导入失败!" + res.enote
});
} else {
this.$message({ this.$message({
type: "success", type: "success",
message: "导入成功!" message: "上传成功!"
});
}
}); });
this.selectFilename = file.name;
this.file = null;
},
onerrorback() {
this.file = null;
}, },
fileChange(file, fileList) { fileChange(file, fileList) {
this.selectFilename = file.name; this.selectFilename = file.name;
...@@ -283,6 +276,19 @@ export default { ...@@ -283,6 +276,19 @@ export default {
}); });
} }
}, },
exportparams() {
this.$api.ops.exportback().then(res => {
if (res.ecode && res.ecode != 200) {
this.$message({
type: "error",
message: res.enote
});
} else {
let exportFileUrl = res.enote;
window.location.href = exportFileUrl;
}
});
},
manualRebootClick() { manualRebootClick() {
this.$confirm("此操作将重启设备, 是否继续?", "提示", { this.$confirm("此操作将重启设备, 是否继续?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
:action="uploadUrl" :action="uploadUrl"
:before-upload="beforeup" :before-upload="beforeup"
multiple multiple
:headers="setheader()"
:data="updata" :data="updata"
name="file" name="file"
:auto-upload="false" :auto-upload="false"
...@@ -117,6 +118,12 @@ export default { ...@@ -117,6 +118,12 @@ export default {
this.updata.vchan_type = "vfile"; this.updata.vchan_type = "vfile";
// this.updata.vchan_refid = new Date().getTime(); // this.updata.vchan_refid = new Date().getTime();
}, },
setheader(){
let head = {};
let atoken = localStorage.getItem("atoken");
head.authorization = atoken;
return head;
},
upsuccess(req) { upsuccess(req) {
if (req.ecode == 200) { if (req.ecode == 200) {
this.$message({ this.$message({
......
...@@ -300,7 +300,8 @@ export default { ...@@ -300,7 +300,8 @@ export default {
period: this.formData.period, period: this.formData.period,
plate_type: this.formData.plate_type, plate_type: this.formData.plate_type,
resource_use: this.formData.resource_use, resource_use: this.formData.resource_use,
task_type: "normal" task_type: "normal",
enable_status: true
// algo_comb_unid: this.formData.store_conf, // algo_comb_unid: this.formData.store_conf,
}; };
......
...@@ -313,6 +313,7 @@ export default { ...@@ -313,6 +313,7 @@ export default {
type: "info", type: "info",
message: "已取消删除" message: "已取消删除"
}); });
this.checkvckan();
this.$store.commit("setocxstate", 1); this.$store.commit("setocxstate", 1);
}); });
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!