运维主站

jcbranch
fanluyan 1 year ago
parent 77b0afd0ee
commit ec6a14f79e

@ -0,0 +1,60 @@
<template>
<div class="error-page">
<div class="error-code">4<span>0</span>3</div>
<div class="error-desc">啊哦~ 你没有权限访问该页面哦</div>
<div class="error-handle">
<router-link to="/stritl">
<el-button type="primary" size="large">返回首页</el-button>
</router-link>
<el-button class="error-btn" type="primary" size="large" @click="goBack"
>返回上一页</el-button
>
</div>
</div>
</template>
<script>
export default {
methods: {
goBack() {
this.$router.go(-1);
},
},
};
</script>
<style lang="less">
.error-page {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 100%;
height: 100%;
background: #f3f3f3;
box-sizing: border-box;
.error-code {
line-height: 1;
font-size: 250px;
font-weight: bolder;
color: #f02d2d;
}
.error-code span {
color: #00a854;
}
.error-desc {
font-size: 30px;
color: #777;
}
.error-handle {
margin-top: 30px;
padding-bottom: 200px;
}
.el-button--primary {
width: auto !important;
}
.error-btn {
margin-left: 100px;
}
}
</style>

@ -27,12 +27,12 @@ export default {
},
{
path: "/upgradation",
name: "上传Apk",
},
{
path: "/upgradationOta",
name: "上传Ota",
name: "上传APK/OTA",
},
// {
// path: "/upgradationOta",
// name: "Ota",
// },
{
path: "/activity",
name: "活动列表",

@ -36,14 +36,41 @@ Vue.component(UTableColumn.name, UTableColumn);
//使用钩子函数对路由进行权限跳转
router.beforeEach((to, from, next) => {
document.title = `${to.meta.title} | 运维管理系统`;
// 获取用户的角色和token
const role = localStorage.getItem("role");
const token = localStorage.getItem("token");
// 如果没有token并且不是登录页面重定向到登录页面
if (!token && to.path !== "/login") {
next({
path: "/login",
});
} else {
next();
return next({ path: "/login" });
}
// 如果用户是超级管理员role == 0则允许访问任何页面
if (role === "0") {
return next();
}
// 如果用户从登录页面跳转到其他页面并且已经拥有token则允许通过
if (from.path === "/login" && token) {
return next();
}
// 获取权限列表这里假设permissions是从后端获取的权限数组
const permissions = JSON.parse(localStorage.getItem("menuPermission")) || [];
// 检查用户是否有访问当前路由的权限
const hasPermission = permissions.some(
(permission) => permission.key === to.path
);
// 如果路由需要权限,但用户没有权限,则重定向到无权限页面
if (to.meta.requiresAuth && !hasPermission) {
return next({ path: "/permission" });
}
// 如果路由在免登录白名单中,则直接通过
if (to.meta.noAuth) {
return next();
}
// 如果以上条件都不满足,正常通过
next();
});
new Vue({

@ -4,10 +4,20 @@ import VueRouter from "vue-router";
Vue.use(VueRouter);
const routes = [
{
path: "/login",
name: "login",
component: () => import("../views/login/index.vue"),
meta: { title: "登录" },
meta: { title: "登录", noAuth: true }, // 标记为免登录页面
},
{
// 权限页面
path: "/permission",
name: "permission",
component: () =>
import(/* webpackChunkName: "permission" */ "../Permission.vue"),
meta: { title: "权限测试" },
},
{
path: "/",
@ -21,6 +31,7 @@ const routes = [
meta: {
title: "首页",
keepAlive: true,
noAuth: true,
},
},
{
@ -50,15 +61,7 @@ const routes = [
keepAlive: true,
},
},
{
path: "/upgradationOta",
component: () => import("../views/upgradationOta/index.vue"),
name: "upgradationOta",
meta: {
title: "上传Ota",
keepAlive: true,
},
},
{
path: "/activity",
component: () => import("../views/activityList/index.vue"),

@ -6,11 +6,87 @@ Vue.use(Vuex);
export default new Vuex.Store({
state: {
//用户登录token 存储
token: "",
userName: "",
uid: "",
role: "",
currentData: "",
channelId: "",
termId: "",
protocol: "",
cmdId: "",
channelIdList: [],
isRenderTab: true,
},
getters: {},
getters: {
token: (state) => state.token,
userName: (state) => state.userName,
role: (state) => state.role,
menuPermission: (state) => state.resources,
},
mutations: {
//点击获取的左侧列表
currentData(state, currentData) {
state.currentData = currentData;
console.log("保存起来currentData", state.currentData);
localStorage.setItem("currentData", JSON.stringify(currentData));
},
channelId(state, channelId) {
state.channelId = channelId;
console.log("channelId", state.channelId);
localStorage.setItem("channelId", JSON.stringify(channelId));
},
termId(state, termId) {
state.termId = termId;
console.log("termId", state.termId);
localStorage.setItem("termId", JSON.stringify(termId));
},
protocol(state, protocol) {
state.protocol = protocol;
console.log("protocol", state.protocol);
localStorage.setItem("protocol", JSON.stringify(protocol));
},
cmdId(state, cmdId) {
state.cmdId = cmdId;
console.log("protocol", state.cmdId);
localStorage.setItem("protocol", JSON.stringify(cmdId));
},
channelIdList(state, channelIdList) {
state.channelIdList = channelIdList;
console.log("channelIdList", state.channelIdList);
localStorage.setItem("channelIdList", JSON.stringify(channelIdList));
},
SET_TOKEN(state, token) {
state.token = token;
localStorage.setItem("token", state.token);
},
SET_USERINFO(state, val) {
state.userName = val.userName;
state.uid = val.uid;
state.role = val.role;
if (val.role !== 0) {
state.resources = val.resources;
const menuArr = val.resources
.filter((item) => item.key.includes("/"))
.sort((a, b) => a.id - b.id);
const btnArr = val.resources
.filter((item) => item.key.includes("Btn"))
.sort((a, b) => a.id - b.id);
localStorage.setItem("menuPermission", JSON.stringify(menuArr));
localStorage.setItem("btnPermission", JSON.stringify(btnArr));
}
localStorage.setItem("userName", state.userName);
localStorage.setItem("uid", state.uid);
localStorage.setItem("role", state.role);
},
//退出清除locastorge
REMOVE_INFO(state) {
localStorage.clear();
},
setIsRenderTab(state, data) {
state.isRenderTab = data;
},

@ -2,171 +2,216 @@ import request from "../request";
//获取登录
export function loginJoggle(data) {
return request({
url: "api/login.php",
url: "/xymanager/login",
method: "post",
data,
});
}
//获取line
export function getqueryLineApi(data) {
//获取用户装置信息
export function getTerminalJoggle(data) {
return request({
url: "api/queryLine.php",
url: "/xymanager/terminal/listForMaintain",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
export function getqueryTermsApi(data) {
export function exportTerminalApi(data) {
return request({
url: "api/queryTerms.php",
url: "/xymanager/terminal/exportForMaintain",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
responseType: 'blob'
});
}
//获取规约
export function getqueryProtocolApi(data) {
//获取规约
export function getProtocolList(data) {
return request({
url: "api/queryProtocol.php",
url: "/xymanager/getProtocolList",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//获取 电压 线路 杆塔
export function getSearchInfo(data) {
return request({
url: "/xymanager/getLineAndGt",
method: "post",
data,
});
}
//运维,快心跳
export function getdoActionApi(data) {
//获取活动列表
export function getActivityApi(data) {
return request({
url: "api/doAction.php",
url: "/xymanager/activity/listAll",
method: "get",
params: data,
});
}
//新增活动列表
export function addActiveApi(data) {
return request({
url: "/xymanager/activity/add",
method: "post",
data,
});
}
//修改活动列表
export function updActiveApi(data) {
return request({
url: "/xymanager/activity/update",
method: "post",
data,
});
}
//删除活动列表
export function delActiveApi(data) {
return request({
url: "/xymanager/activity/delete",
method: "post",
data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//上传日志列表
export function getqueryUploadsApi(data) {
////运维,快心跳
export function cmdSendApi(data) {
return request({
url: "/xymanager/cmd/send",
method: "post",
data,
});
}
//获取命令列表
export function getCmdActionApi(data) {
return request({
url: "api/queryUploads.php",
url: "/xymanager/cmd/listAction",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//删除日志列表
export function updUploadApi(data) {
//查询正在下发的命令
export function cmdActlistApi(data) {
return request({
url: "api/updUpload.php",
url: "/xymanager/cmd/list",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//获取信息装置的信息
export function getqueryRawApi(data) {
//查询已经下发的命令
export function cmdActHislistApi(data) {
return request({
url: "api/queryRawData.php",
url: "/xymanager/cmd/listHistory",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//带下发状态
export function getqueryCmdsApi(data) {
//查询历史心跳信息
export function heartListApi(data) {
return request({
url: "api/queryCmds.php",
url: "/xymanager/terminal/listReport",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//上传apk
export function postuploadFileApi(data) {
//修改备注
export function updCommentApi(data) {
return request({
url: "api/uploadFile.php",
url: "/xymanager/terminal/updateComment",
method: "post",
params: data,
headers: {
"Content-Type": "multipart/form-data", // set the content type to multipart/form-data
},
data,
});
}
//获取上传列表
export function getqueryUpgradesApi(data) {
//日志列表相关接口
export function logListApi(data) {
return request({
url: "api/queryUpgrades.php",
url: "/xymanager/upload/listAll",
method: "get",
params: data,
});
}
//日志删除
export function logDeleteApi(data) {
return request({
url: "/xymanager/upload/delete",
method: "post",
data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//删除列表
export function getupdUpgradeApi(data) {
//获取升级列表
export function upgradeListApi(data) {
return request({
url: "api/updUpgrade.php",
url: "/xymanager/upgrade/listAll",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//新建活动和删除活动
export function updActivityApi(data) {
//修改备注
export function upgradeTitleApi(data) {
return request({
url: "api/updActivity.php",
url: "/xymanager/upgrade/updateTitle",
method: "post",
data,
headers: {
"Content-Type": "multipart/form-data", // set the content type to multipart/form-data
},
});
}
//获取活动列表和详细列表
export function getqueryActivityApi(data) {
//上传升级文件
export function upgradeUpLoadApi(data, onUploadProgress) {
return request({
url: "api/queryActivity.php",
method: "get",
params: data,
url: "/xymanager/upgrade/upload",
method: "post",
data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
"Content-Type": "multipart/form-data", // set the content type to multipart/form-data
},
onUploadProgress: onUploadProgress, // 允许外部传递进度回调函数
});
}
export function updComment(data) {
//删除升级的文件
export function upgradeDeleteApi(data) {
return request({
url: "api/updComment.php",
method: "get",
params: data,
url: "/xymanager/upgrade/delete",
method: "post",
data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}

@ -7,73 +7,68 @@ const service = axios.create({
// easy-mock服务挂了暂时不使用了
// baseURL: '',
// timeout: 5000
baseURL: "/web", //把原来的项目地址改成api解决跨域问题
baseURL: "api", //把原来的项目地址改成api解决跨域问题
timeout: 30000,
});
// 添加请求拦截器一下内容是axios的拦截器可以不用写
service.interceptors.request.use(
function (config) {
// 在发送请求之前做些什么
return config;
},
function (error) {
// 对请求错误做些什么
return Promise.reject(error);
service.interceptors.request.use((config) => {
if (localStorage.getItem("token")) {
// console.log("aaaaaaaaaaaaaa", localStorage.getItem("token"));
config.headers.Authorization = localStorage.getItem("token");
}
);
// 添加响应拦截器
return config;
});
service.interceptors.response.use(
function (response) {
// 对响应数据做点什么
return response.data;
(response) => {
const res = response.data;
if (res.code !== 200) {
if (res.code === 401) {
Message({
showClose: true,
message: res.msg,
type: "error",
duration: 1500,
});
localStorage.removeItem("token");
router.push("/login");
}
if (res.code === 400) {
Message({
showClose: true,
message: res.msg,
type: "error",
duration: 1500,
});
}
if (res.code === 500) {
//alert(res.msg || "Error");
Message({
showClose: true,
message: res.msg,
type: "error",
duration: 1500,
});
}
if (!res.code) { // 如果没有返回code可能是下载excel
// return resolve(response.data, res);
return res
}
return Promise.reject(new Error(res.msg || "Error"));
} else {
return res;
}
},
function (error) {
// 对响应错误做点什么
(error) => {
Message({
message: error.message,
showClose: true,
type: "error",
duration: 1500,
});
return Promise.reject(error);
}
);
export default service;
// service.interceptors.request.use((config) => {
// if (localStorage.getItem("token")) {
// config.headers.sessionId = localStorage.getItem("token");
// }
// return config;
// });
// service.interceptors.response.use(
// (response) => {
// const res = response.data;
// if (res.code !== 200) {
// if (res.code === 401) {
// Message({ message: res.msg, type: "error", duration: 1500 });
// router.push("/login");
// }
// if (res.code === 400) {
// Message({ message: res.msg, type: "error", duration: 1500 });
// }
// if (res.code === 500) {
// Message({
// showClose: true,
// message: 服务器错误(500),
// type: "error",
// duration: 1500,
// });
// }
// return Promise.reject(new Error(res.msg || "Error"));
// } else {
// return res;
// }
// },
// (error) => {
// Message({
// message: error.message,
// showClose: true,
// type: "error",
// duration: 1500,
// });
// return Promise.reject(error);
// }
// );
export default service;

@ -106,8 +106,8 @@
>
<el-table-column type="index" width="50" label="序号">
</el-table-column>
<el-table-column prop="line_name" label="线路名称"> </el-table-column>
<el-table-column prop="tower_name" label="杆塔名称"> </el-table-column>
<el-table-column prop="lineName" label="线路名称"> </el-table-column>
<el-table-column prop="towerName" label="杆塔名称"> </el-table-column>
<el-table-column prop="cmdid" label="装置编号">
<template slot="header" slot-scope="scope">
装置编号<el-tag
@ -130,7 +130,7 @@
</div>
</template>
<script>
import { updActivityApi, getqueryActivityApi } from "@/utils/api/index";
import { getActivityApi,addActiveApi,updActiveApi,delActiveApi } from "@/utils/api/index";
import htmlToExcel from "@/utils/htmlToExcel";
import { saveAs } from "file-saver";
import XLSX from "xlsx";
@ -145,6 +145,7 @@ export default {
title: "",
cmdidArr: "",
},
cmdObjects: [], //
titleFlag: false, //title
cmdidFlag: false, //cmdid
termsShow: false,
@ -162,15 +163,33 @@ export default {
65285: "河南全景",
65286: "河南郑州",
65290: "河南统一视频v2020",
65298:"宁夏",
2:"南网"
},
ActibityId: "", //
};
},
computed: {},
watch: {
'activityForm.cmdidArr': {
handler(newVal) {
// activityForm.cmdidArr convertToCmdObjects
this.cmdObjects = this.convertToCmdObjects(newVal);
},
deep: false, //
immediate: false, // handler
},
},
mounted() {
this.getactivityList();
},
methods: {
convertToCmdObjects(text) {
//
const cmdids = text.trim().split(/\r?\n/);
// cmdid
return cmdids.map(cmdid => ({ cmdid }));
},
async handleHeaderClick(column) {
console.log(column);
//
@ -215,9 +234,7 @@ export default {
getactivityList() {
this.activityloading = true;
this.activityData = [];
getqueryActivityApi({
act: "list",
})
getActivityApi()
.then((res) => {
console.log(res);
this.activityData = res.data;
@ -225,48 +242,22 @@ export default {
})
.catch((err) => {});
},
//
handleEditClick(row) {
console.log(row);
getqueryActivityApi({
act: "detail",
id: row.id,
})
.then((res) => {
console.log(res);
this.ActibityId = res.data.activity.id;
this.activityForm.title = res.data.activity.title;
console.log(this.activityForm.title);
const columnData = res.data.terms.map((item) => item.cmdid);
console.log(columnData);
this.activityForm.cmdidArr = columnData.join("\n");
})
.catch((err) => {});
},
//
handleLookClick(row) {
console.log(row)
this.termsShow = true;
this.termsLoading = true;
this.termsData = [];
getqueryActivityApi({
act: "detail",
id: row.id,
})
.then((res) => {
console.log(res);
this.termsLoading = false;
this.activityNameTitle = res.data.activity.title;
this.activityName =
res.data.activity.title + "(" + res.data.terms.length + ")";
this.termsData = res.data.terms;
})
.catch((err) => {});
},
this.termsData = row.terms;
this.activityNameTitle = row.title;
this.activityName =
row.title + "(" + row.terms.length + ")";
this.termsData = row.terms;
},
//
handleDeleteClick(row) {
console.log(row);
updActivityApi({
act: "del",
delActiveApi({
id: row.id,
})
.then((res) => {
@ -297,6 +288,14 @@ export default {
textfocus() {
this.cmdidFlag = false;
},
//
handleEditClick(row) {
console.log(row);
this.ActibityId = row.id;
this.activityForm.title = row.title;
const columnData = row.terms.map((item) => item.cmdid);
this.activityForm.cmdidArr = columnData.join("\n");
},
//
submitUpload() {
if (this.activityForm.title == "") {
@ -309,24 +308,30 @@ export default {
}
let actParams = {};
if (this.ActibityId !== "") {
//
console.log(this.ActibityId);
actParams = {
id: this.ActibityId,
title: this.activityForm.title,
cmdids: this.activityForm.cmdidArr,
act: "edt",
terms: this.cmdObjects,
};
updActiveApi(actParams)
.then((res) => {
console.log(res);
this.getactivityList();
this.activityForm.title = "";
this.activityForm.cmdidArr = "";
this.ActibityId = "";
})
.catch((err) => {});
} else {
//
console.log(this.cmdObjects);
actParams = {
title: this.activityForm.title,
cmdids: this.activityForm.cmdidArr,
act: "new",
terms: this.cmdObjects,
};
}
console.log(this.activityForm.title);
console.log(this.activityForm.cmdidArr);
//console.log(arrList);
updActivityApi(actParams)
addActiveApi(actParams)
.then((res) => {
console.log(res);
this.getactivityList();
@ -335,6 +340,7 @@ export default {
this.ActibityId = "";
})
.catch((err) => {});
}
},
},
};

@ -16,141 +16,108 @@
>
<el-table-column type="index" width="50" label="序号">
</el-table-column>
<el-table-column prop="createTime" label="时间"></el-table-column>
<el-table-column prop="createTime" label="时间">
<template slot-scope="scope">
{{ $moment(scope.row.createTime*1000).format("YYYY-MM-DD HH:mm:ss") }}
</template>
</el-table-column>
<el-table-column label="id">
<template slot-scope="scope">
{{ scope.row.raw_report.id }}
{{ scope.row.reportMap.id }}
</template>
</el-table-column>
<el-table-column label="i1服务器">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.cma
}}</span>
<span v-else>{{ scope.row.raw_report.msgs.cma }}</span>
<span>{{ scope.row.reportMap.cma }}</span>
</template>
</el-table-column>
<el-table-column label="心跳间隔" width="70">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.heartbeatDuration
}}</span>
<span v-else>{{
scope.row.raw_report.msgs.heartbeatDuration
}}</span>
<span>{{ scope.row.reportMap.heartbeatDuration }}</span>
</template>
</el-table-column>
<el-table-column label="电池">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.battary
}}</span>
<span v-else> {{ scope.row.raw_report.msgs.battery }}</span>
<span>{{ scope.row.reportMap.battery }}</span>
</template>
</el-table-column>
<el-table-column label="电池温度" width="70">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.batteryTmp
}}</span>
<span v-else>{{ scope.row.raw_report.msgs.batteryTmp }}</span>
<span>{{ scope.row.reportMap.batteryTmp }}</span>
</template>
</el-table-column>
<el-table-column label="主板温度" width="70">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.mainBoardTmp
}}</span>
<span v-else> {{ scope.row.raw_report.msgs.mainBoardTmp }}</span>
<span>{{ scope.row.reportMap.mainBoardTmp }}</span>
</template>
</el-table-column>
<el-table-column label="系统重启" width="70">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.rebootTimes
}}</span>
<span v-else>{{ scope.row.raw_report.msgs.rebootTimes }}</span>
<span>{{ scope.row.reportMap.rebootTimes }}</span>
</template>
</el-table-column>
<el-table-column label="i1重启" width="70">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.i1RebootTimes
}}</span>
<span v-else>{{ scope.row.raw_report.msgs.i1RebootTimes }}</span>
<span>{{ scope.row.reportMap.i1RebootTimes }}</span>
</template>
</el-table-column>
<el-table-column label="收" width="70">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.recv
}}</span>
<span v-else> {{ scope.row.raw_report.msgs.recv }}</span>
<span>{{ scope.row.reportMap.recv }}</span>
</template>
</el-table-column>
<el-table-column label="传图" width="70">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.pic
}}</span>
<span v-else> {{ scope.row.raw_report.pic }}</span>
<span>{{ scope.row.reportMap.pic }}</span>
</template>
</el-table-column>
<el-table-column label="拍" width="60">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.photoTimes
}}</span>
<span v-else> {{ scope.row.raw_report.msgs.photoTimes }}</span>
<span>{{ scope.row.reportMap.photoTimes }}</span>
</template>
</el-table-column>
<el-table-column label="成/败/传" width="70">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">
{{ scope.row.raw_report.success }}/{{
scope.row.raw_report.failure
}}/{{ scope.row.raw_report.uploads }}</span
>
<span v-else>
{{ scope.row.raw_report.msgs.success }}/{{
scope.row.raw_report.msgs.failure
}}/{{ scope.row.raw_report.msgs.uploads }}</span
>
<span> {{ scope.row.reportMap.success }}/{{
scope.row.reportMap.failure
}}/{{ scope.row.reportMap.uploads }}</span>
</template>
</el-table-column>
<el-table-column label="心跳累计" width="80">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.numberOfHb
}}</span>
<span v-else> {{ scope.row.raw_report.msgs.numberOfHb }}</span>
<span>{{ scope.row.reportMap.numberOfHb }}</span>
</template>
</el-table-column>
<el-table-column label="网络异常" width="80">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.networkError
}}</span>
<span v-else>{{ scope.row.raw_report.msgs.networkError }}</span>
<span>{{ scope.row.reportMap.networkError }}</span>
</template>
</el-table-column>
<el-table-column label="信号1" width="60">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.signature1
}}</span>
<span v-else>{{ scope.row.raw_report.msgs.signature1 }}</span>
<span>{{ scope.row.reportMap.signature1 }}</span>
</template>
</el-table-column>
<el-table-column label="信号2" width="60">
<template slot-scope="scope">
<span v-if="scope.row.raw_report.hasOwnProperty('XyDev')">{{
scope.row.raw_report.signature2
}}</span>
<span v-else> {{ scope.row.raw_report.msgs.signature2 }}</span>
<span>{{ scope.row.reportMap.signature2 }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="其他">
@ -192,7 +159,7 @@
</el-dialog>
</template>
<script>
import { getqueryRawApi } from "@/utils/api/index";
import { heartListApi } from "@/utils/api/index";
export default {
props: {},
data() {
@ -201,7 +168,7 @@ export default {
girdloading: true,
isShow: false,
page: 1, //
pageSize: 20, //
pageSize: 50, //
total: 0, //
termid: "",
};
@ -219,15 +186,16 @@ export default {
},
getQueryList() {
this.girdloading = true;
getqueryRawApi({
this.gridData = []
heartListApi({
termId: this.termid,
p: this.page,
ps: this.pageSize,
pageNum: this.page,
pageSize: this.pageSize,
})
.then((res) => {
console.log(res);
this.gridData = res.data;
this.total = Number(res.page.totalRecords);
this.gridData = res.data.list;
this.total = Number(res.data.total);
this.girdloading = false;
})
.catch((err) => {});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -8,6 +8,21 @@
class="demo-form-inline"
>
<div class="topSearch">
<el-form-item label="电压" class="dybox">
<el-select
v-model="formdata.dyId"
@change="getSearchxl"
filterable
>
<el-option
v-for="item in dyOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="线路" class="xlbox">
<el-select
v-model="formdata.lineId"
@ -20,7 +35,7 @@
:label="item.name"
:value="item.id"
>
{{ item.vname + item.name }}
</el-option>
</el-select>
</el-form-item>
@ -45,13 +60,15 @@
</el-select>
</el-form-item>
<el-form-item label="是否运维" class="ismntClass">
<el-select v-model="formdata.ismntend">
<el-select v-model="formdata.mntn">
<el-option
v-for="item in mntendOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="规约" class="gybox">
@ -61,7 +78,9 @@
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
>
{{ item.name }}-{{ item.id }}
</el-option>
</el-select>
</el-form-item>
<el-form-item label="活动" class="activitybox">
@ -79,10 +98,10 @@
</el-select>
</el-form-item>
</div>
<div class="bottomSearch">
<el-form-item label="出厂ID" class="oidbox">
<div class="bottomSearch">
<el-form-item label="出厂ID" class="oidbox">
<el-input
v-model="formdata.oidInput"
v-model="formdata.bsIdentifier"
placeholder="请输入出厂ID"
clearable
></el-input>
@ -94,8 +113,8 @@
placement="top"
>
<el-checkbox
v-model="formdata.oidCheck"
:checked="formdata.oidCheck == 1 ? true : false"
v-model="formdata.bsIdentifierExclude"
:checked="formdata.bsIdentifierExclude == 1 ? true : false"
true-label="1"
false-label="0"
></el-checkbox>
@ -104,7 +123,7 @@
<el-form-item label="装置编号" class="cmdibox">
<el-input
v-model="formdata.cmdidInput"
v-model="formdata.cmdid"
placeholder="请输入装置编号"
clearable
></el-input>
@ -115,8 +134,8 @@
placement="top"
>
<el-checkbox
v-model="formdata.cmdidCheck"
:checked="formdata.cmdidCheck == 1 ? true : false"
v-model="formdata.cmdidExclude"
:checked="formdata.cmdidExclude == 1 ? true : false"
true-label="1"
false-label="0"
></el-checkbox>
@ -125,7 +144,7 @@
<el-form-item label="CMA服务器" class="cmabox">
<el-input
v-model="formdata.cmaInput"
v-model="formdata.cma"
placeholder="请输入CMA服务器"
clearable
></el-input>
@ -136,8 +155,8 @@
placement="top"
>
<el-checkbox
v-model="formdata.cmaCheck"
:checked="formdata.cmaCheck == 1 ? true : false"
v-model="formdata.cmaExclude"
:checked="formdata.cmaExclude == 1 ? true : false"
true-label="1"
false-label="0"
></el-checkbox>
@ -146,7 +165,7 @@
<el-form-item label="版本" class="versionbox">
<el-input
v-model="formdata.versionInput"
v-model="formdata.version"
placeholder="请输入版本"
clearable
></el-input>
@ -157,8 +176,8 @@
placement="top"
>
<el-checkbox
v-model="formdata.versionCheck"
:checked="formdata.versionCheck == 1 ? true : false"
v-model="formdata.versionExclude"
:checked="formdata.versionExclude == 1 ? true : false"
true-label="1"
false-label="0"
></el-checkbox>
@ -168,7 +187,7 @@
<el-button type="primary" @click="onSubmit"></el-button>
<el-button type="primary" @click="onReset"></el-button>
</el-form-item>
</div>
</div>
</el-form>
<el-tooltip
class="item"
@ -203,11 +222,13 @@
</template>
<script>
import {
getqueryLineApi,
getqueryTermsApi,
getqueryProtocolApi,
getqueryActivityApi,
getqueryCmdsApi,
cmdActlistApi,
getTerminalJoggle,
getActivityApi,
getProtocolList,
getSearchInfo,
exportTerminalApi
} from "@/utils/api/index";
import tableMain from "./components/tableMain";
export default {
@ -218,37 +239,41 @@ export default {
data() {
return {
showDiv: true, // div
nowTime: new Date().getTime() / 1000,
xlOptions: [{ id: 0, name: "全部" }], //线
gtOptions: [{ id: 0, name: "全部" }], //
dyOptions: [{ id: -1, name: "全部" }], //
xlOptions: [{ id: -1, name: "全部" }], //线
gtOptions: [{ id: -1, name: "全部" }], //
onlineOptions: [
{ id: -1, name: "全部" },
{ id: 1, name: "在线" },
{ id: 0, name: "离线" },
],
formdata: {
lineId: 0,
towerId: 0,
isonline: -1,
protocolId: 0,
activityId: 0,
ismntend: 1,
oidInput: "",
oidCheck: 0,
cmdidInput: "",
cmdidCheck: 0,
cmaInput: "",
cmaCheck: 0,
versionInput: "",
versionCheck: 0,
},
protocolOptions: [{ id: 0, name: "全部" }], //
activityOptions: [{ id: 0, name: "全部" }], //
protocolOptions: [{ id: -1, name: "全部" }], //
activityOptions: [{ id: -1, name: "全部" }], //
mntendOptions: [
{ id: 0, name: "全部" },
{ id: -1, name: "全部" },
{ id: 1, name: "运维" },
{ id: 2, name: "未运维" },
], //
formdata: {
dyId:-1,
lineId:-1,
towerId:-1,
isonline: -1,
protocolId: -1,
mntn: 1,
activityId: -1,
bsIdentifier: "",
bsIdentifierExclude: 0,
cmdid: "",
cmdidExclude: 0,
cma: "",
cmaExclude: 0,
version: "",
versionExclude: 0,
},
dataList: [],
dataListNew: [],
tableLoaidng: true,
@ -262,13 +287,7 @@ export default {
};
},
created() {
var that = this;
document.onkeydown = function (e) {
var key = window.event.keyCode;
if (key === 13) {
that.onSubmit(); //
}
};
this.activityIdLoc =
JSON.parse(localStorage.getItem("activeId")) !== null
? JSON.parse(localStorage.getItem("activeId"))
@ -279,70 +298,143 @@ export default {
JSON.parse(localStorage.getItem("searchParams")) !== null
? JSON.parse(localStorage.getItem("searchParams"))
: {
lineId: 0,
towerId: 0,
isonline: -1,
protocolId: 0,
activityId: 0,
ismntend: 1,
oidInput: "",
oidCheck: 0,
cmdidInput: "",
cmdidCheck: 0,
cmaInput: "",
cmaCheck: 0,
versionInput: "",
versionCheck: 0,
dyId:-1,
lineId:-1,
towerId:-1,
isonline: -1,
protocolId: -1,
mntn: 1,
activityId: -1,
bsIdentifier: "",
bsIdentifierExclude: 0,
cmdid: "",
cmdidExclude: 0,
cma: "",
cmaExclude: 0,
version: "",
versionExclude: 0,
};
},
mounted() {
this.getActivityList();
this.getLineList();
this.getprotocolList();
this.getSearchdy();
this.getProtocol();
this.getactiveList()
},
watch: {},
methods: {
//linelist 线
getLineList() {
getqueryLineApi()
//
exportTable(){let params = {
pageindex:1,
pagesize:10000,
};
//
if (this.formdata.dyId !== -1) {
params.dyId = this.formdata.dyId;
}
if (this.formdata.lineId !== -1) {
params.lineId = this.formdata.lineId;
}
if (this.formdata.towerId !== -1) {
params.towerId = this.formdata.towerId;
}
if (this.formdata.isonline !== -1) {
params.isonline = this.formdata.isonline;
}
if (this.formdata.protocolId !== -1) {
params.protocolId = this.formdata.protocolId;
}
if (this.formdata.mntn !== -1) {
params.mntn = this.formdata.mntn;
}
if (this.formdata.activityId !== -1) {
params.activityId = this.formdata.activityId;
}
if (this.formdata.bsIdentifier !== "") {
params.bsIdentifier = this.formdata.bsIdentifier;
}
console.log(this.formdata.bsIdentifierExclude)
if (this.formdata.bsIdentifierExclude !== 0) {
params.bsIdentifierExclude = this.formdata.bsIdentifierExclude;
}
if (this.formdata.cma !== "") {
params.cma = this.formdata.cma;
}
if (this.formdata.cmaExclude !== 0) {
params.cmaExclude = this.formdata.cmaExclude;
}
if (this.formdata.cmdid !=="") {
params.cmdid = this.formdata.cmdid;
}
if (this.formdata.cmdidExclude !== 0) {
params.cmdidExclude = this.formdata.cmdidExclude;
}
if (this.formdata.version !== "") {
params.version = this.formdata.version;
}
if (this.formdata.versionExclude !== 0) {
params.versionExclude = this.formdata.versionExclude;
}
console.log(params)
exportTerminalApi(params)
.then((res) => {
console.log(res);
this.xlOptions = [{ id: 0, name: "全部", vname: "" }];
this.xlOptions = this.xlOptions.concat(res.data);
console.log(res)
const now = this.$moment(new Date());
const formattedTime = now.format("YYYY年MM月DD日HH时mm分"); // "2023-04-01_15_30_00"
const blob = new Blob([res])
const link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = `运维数据报表_${formattedTime}.xls`
link.click()
})
.catch((err) => {});
},
//
getSearchdy() {
getSearchInfo({ type: 1 })
.then((res) => {
this.dyOptions = this.dyOptions.concat(res.data.list);
console.log(this.dyOptions);
this.formdata.dyId = this.dyOptions[0].id;
this.getSearchxl();
})
.catch((err) => {});
},
//线
getSearchxl() {
getSearchInfo({ type: 2, id: this.formdata.dyId })
.then((res) => {
this.xlOptions = this.xlOptions.concat(res.data.list);
this.formdata.lineId = this.xlOptions[0].id;
this.getSearchgt();
})
.catch((err) => {});
},
//线
//
getSearchgt() {
getqueryLineApi({ lineId: this.formdata.lineId })
getSearchInfo({ type: 3, id: this.formdata.lineId })
.then((res) => {
this.gtOptions = [{ id: 0, name: "全部" }];
this.gtOptions = this.gtOptions.concat(res.data);
this.gtOptions = this.gtOptions.concat(res.data.list);
this.formdata.towerId = this.gtOptions[0].id;
})
.catch((err) => {});
},
//linelist 线
getprotocolList() {
getqueryProtocolApi()
getProtocol() {
//
getProtocolList()
.then((res) => {
console.log(res);
this.protocolOptions = [{ id: 0, name: "全部" }];
this.protocolOptions = this.protocolOptions.concat(res.data);
this.formdata.protocolId = this.protocolOptions[0].id;
this.protocolOptions = this.protocolOptions.concat(res.data.list);
this.formdata.protocol = this.protocolOptions[0].id;
})
.catch((err) => {});
},
//
getActivityList() {
getqueryActivityApi({
act: "list",
})
getactiveList(){
getActivityApi()
.then((res) => {
console.log(res);
console.log("222222222222222");
this.activityOptions = [{ id: 0, name: "全部" }];
// this.activityOptions = this.activityOptions.concat(res.data.list);
let activeArr = res.data.map((item) => ({
id: item.id,
name: item.title,
@ -363,236 +455,117 @@ export default {
},
onSubmit() {
this.tableLoaidng = true;
this.dataList = [];
console.log("我是查询", this.formdata);
localStorage.setItem("searchParams", JSON.stringify(this.formdata));
let params = {
lineId: this.formdata.lineId,
towerId: this.formdata.towerId,
isonLine: this.formdata.isonline,
};
var nonmntnedObj = {
name: "mntned",
value: this.formdata.ismntend,
invertVal: "",
};
var protocolObj = {
name: "protocol",
value: this.formdata.protocolId,
invertVal: 0,
};
var activityObj = {
name: "activity",
value: this.formdata.activityId,
invertVal: 0,
};
var oidObj = {
name: "oid",
value: this.formdata.oidInput.trim(),
invertVal: this.formdata.oidCheck,
};
var cmdidObj = {
name: "cmdid",
value: this.formdata.cmdidInput.trim(),
invertVal: this.formdata.cmdidCheck,
};
var cmaObj = {
name: "cma",
value: this.formdata.cmaInput.trim(),
invertVal: this.formdata.cmaCheck,
};
var versionObj = {
name: "version",
value: this.formdata.versionInput.trim(),
invertVal: this.formdata.versionCheck,
};
let arrayOfObjects = [nonmntnedObj, protocolObj, activityObj];
if (oidObj.value !== "") {
arrayOfObjects.push(oidObj);
}
if (cmaObj.value !== "") {
arrayOfObjects.push(cmaObj);
}
if (cmdidObj.value !== "") {
arrayOfObjects.push(cmdidObj);
}
if (versionObj.value !== "") {
arrayOfObjects.push(versionObj);
}
console.log(arrayOfObjects);
for (var k = 0; k < arrayOfObjects.length; k++) {
params["fc"] = arrayOfObjects.length;
params["fn" + (k + 1)] = arrayOfObjects[k].name;
params["fv" + (k + 1)] = arrayOfObjects[k].value;
params["frev" + (k + 1)] = arrayOfObjects[k].invertVal;
}
console.log(params);
this.dataList = [];
//
if (this.intervalId) {
clearInterval(this.intervalId);
this.intervalId = null;
}
this.fetchData();
const interval = 60000; // 60000
this.intervalId = setInterval(() => {
//
this.fetchData();
}, interval);
getqueryTermsApi(params)
.then((res) => {
res.data = res.data.map((item) => {
if (!item.raw_report.pic) {
item.raw_report.pic = 0;
}
return item;
});
if (this.formdata.isonline == "-1") {
//
this.dataList = res.data;
// console.log(this.dataList)
} else if (this.formdata.isonline == "1") {
//线
this.dataList = res.data.filter(
(item) => this.nowTime - item.last_heartbeat_ts <= 720
);
} else if (this.formdata.isonline == "0") {
//线
this.dataList = res.data.filter(
(item) => this.nowTime - item.last_heartbeat_ts > 720
);
}
this.onlineNum = this.dataList.filter(
(item) => this.nowTime - item.last_heartbeat_ts <= 720
).length;
this.offlineNum = this.dataList.length - this.onlineNum;
this.noPicNum = this.dataList.filter(
(item) =>
item.raw_report.pic == undefined ||
item.raw_report.pic == 0 ||
item.raw_report.pic == -1
).length;
this.freeNum = this.dataList.filter(
(item) => parseInt(item.raw_report.msgs.freeROM) < 50
).length;
console.log("我是磁盘", this.freeNum);
this.getCmdList();
this.tableLoaidng = false;
})
.catch((err) => {});
},
fetchData() {
let params = {
lineId: this.formdata.lineId,
towerId: this.formdata.towerId,
isonLine: this.formdata.isonline,
};
var nonmntnedObj = {
name: "mntned",
value: this.formdata.ismntend,
invertVal: "",
};
var protocolObj = {
name: "protocol",
value: this.formdata.protocolId,
invertVal: 0,
};
var activityObj = {
name: "activity",
value: this.formdata.activityId,
invertVal: 0,
pageindex:1,
pagesize:10000,
};
var oidObj = {
name: "oid",
value: this.formdata.oidInput,
invertVal: this.formdata.oidCheck,
};
var cmdidObj = {
name: "cmdid",
value: this.formdata.cmdidInput,
invertVal: this.formdata.cmdidCheck,
};
var cmaObj = {
name: "cma",
value: this.formdata.cmaInput,
invertVal: this.formdata.cmaCheck,
};
var versionObj = {
name: "version",
value: this.formdata.versionInput,
invertVal: this.formdata.versionCheck,
};
let arrayOfObjects = [nonmntnedObj, protocolObj, activityObj];
if (oidObj.value !== "") {
arrayOfObjects.push(oidObj);
//
if (this.formdata.dyId !== -1) {
params.dyId = this.formdata.dyId;
}
if (this.formdata.lineId !== -1) {
params.lineId = this.formdata.lineId;
}
if (this.formdata.towerId !== -1) {
params.towerId = this.formdata.towerId;
}
if (this.formdata.isonline !== -1) {
params.isonline = this.formdata.isonline;
}
if (this.formdata.protocolId !== -1) {
params.protocolId = this.formdata.protocolId;
}
if (this.formdata.mntn !== -1) {
params.mntn = this.formdata.mntn;
}
if (this.formdata.activityId !== -1) {
params.activityId = this.formdata.activityId;
}
if (this.formdata.bsIdentifier !== "") {
params.bsIdentifier = this.formdata.bsIdentifier;
}
console.log(this.formdata.bsIdentifierExclude)
if (this.formdata.bsIdentifierExclude !== 0) {
params.bsIdentifierExclude = this.formdata.bsIdentifierExclude;
}
if (this.formdata.cma !== "") {
params.cma = this.formdata.cma;
}
if (this.formdata.cmaExclude !== 0) {
params.cmaExclude = this.formdata.cmaExclude;
}
if (cmaObj.value !== "") {
arrayOfObjects.push(cmaObj);
if (this.formdata.cmdid !=="") {
params.cmdid = this.formdata.cmdid;
}
if (cmdidObj.value !== "") {
arrayOfObjects.push(cmdidObj);
if (this.formdata.cmdidExclude !== 0) {
params.cmdidExclude = this.formdata.cmdidExclude;
}
if (versionObj.value !== "") {
arrayOfObjects.push(versionObj);
if (this.formdata.version !== "") {
params.version = this.formdata.version;
}
console.log(arrayOfObjects);
for (var k = 0; k < arrayOfObjects.length; k++) {
params["fc"] = arrayOfObjects.length;
params["fn" + (k + 1)] = arrayOfObjects[k].name;
params["fv" + (k + 1)] = arrayOfObjects[k].value;
params["frev" + (k + 1)] = arrayOfObjects[k].invertVal;
if (this.formdata.versionExclude !== 0) {
params.versionExclude = this.formdata.versionExclude;
}
console.log(params);
getqueryTermsApi(params)
console.log(params)
getTerminalJoggle(params)
.then((res) => {
console.log(res);
res.data = res.data.map((item) => {
if (!item.raw_report.pic) {
item.raw_report.pic = 0;
}
return item;
});
if (this.formdata.isonline == "-1") {
//
this.dataList = res.data;
} else if (this.formdata.isonline == "1") {
//线
this.dataList = res.data.filter(
(item) => this.nowTime - item.last_heartbeat_ts <= 720
);
} else if (this.formdata.isonline == "0") {
//线
this.dataList = res.data.filter(
(item) => this.nowTime - item.last_heartbeat_ts > 720
);
}
console.log(res)
this.dataList = res.data;
this.getCmdList();
this.onlineNum = this.dataList.filter(
(item) => this.nowTime - item.last_heartbeat_ts <= 720
(item) => item.onlinestatus ==1
).length;
this.offlineNum = this.dataList.length - this.onlineNum;
this.tableLoaidng = false;
this.noPicNum = this.dataList.filter(
(item) =>
item.raw_report.pic == undefined ||
item.raw_report.pic == 0 ||
item.raw_report.pic == -1
(item) => item.mntnStatus.reportMap == null ||
item.mntnStatus.reportMap.pic == undefined ||
item.mntnStatus.reportMap.pic == 0 ||
item.mntnStatus.reportMap.pic == -1
).length;
this.freeNum = this.dataList.filter(
(item) => parseInt(item.raw_report.msgs.freeROM) < 50
).length;
console.log("我是磁盘", this.freeNum);
this.getCmdList();
this.freeNum = this.dataList.filter(item => {
// mntnStatusreportMapfreeROMnullundefined
const freeROM = item.mntnStatus?.reportMap?.freeROM;
// freeROM
if (freeROM !== null && freeROM !== undefined && !isNaN(parseInt(freeROM, 10))) {
// 50
return parseInt(freeROM, 10) < 50;
}
// freeROM
return false;
}).length;
console.log("我已经加载完数据")
})
.catch((err) => {});
},
//
getCmdList() {
getqueryCmdsApi({ p: 1, ps: 10000 })
cmdActlistApi({ p: 1, ps: 10000 })
.then((res) => {
console.log(res);
console.log("我是命令列表");
console.log(this.dataList);
this.runCommand = res.data;
this.runCommand = res.data.list;
// let array1 = [{ id: 0, name: "sss" },{ id: 1, name: "111" }];
// let array2 = [{ termid: 0, time: "aaaa" },{ termid: 1, time: "s1111ss" }];
@ -613,30 +586,28 @@ export default {
}
});
this.dataListNew = this.dataList;
console.log(this.dataList);
console.log(this.dataListNew);
})
.catch((err) => {});
},
//
onReset() {
this.formdata = {
lineId: 0,
towerId: 0,
dyId:-1,
lineId:-1,
towerId:-1,
isonline: -1,
protocolId: 0,
activityId:
JSON.parse(localStorage.getItem("activeId")) !== null
? JSON.parse(localStorage.getItem("activeId"))
: 0,
ismntend: 1,
oidInput: "",
oidCheck: 0,
cmdidInput: "",
cmdidCheck: 0,
cmaInput: "",
cmaCheck: 0,
versionInput: "",
versionCheck: 0,
protocolId: -1,
mntn: 1,
activityId: -1,
bsIdentifier: "",
bsIdentifierExclude: 0,
cmdid: "",
cmdidExclude: 0,
cma: "",
cmaExclude: 0,
version: "",
versionExclude: 0,
};
this.onSubmit();
@ -689,6 +660,11 @@ export default {
}
}
}
.dybox{
.el-select {
width: 120px;
}
}
.ismntClass {
.el-select {
width: 100px;
@ -722,6 +698,9 @@ export default {
}
}
}
.cmdibox {
background: #d0ece8;
}
.el-form-item__label,
.el-checkbox {
color: #333;

@ -13,27 +13,28 @@
<el-table-column type="index" width="50" label="序号">
</el-table-column>
<!-- <el-table-column prop="id" label="Id" width="80"> </el-table-column> -->
<el-table-column prop="line_name" label="线路"> </el-table-column>
<el-table-column prop="cmdid" label="装置编号"> </el-table-column>
<el-table-column label="规约" width="100">
<el-table-column prop="lineName" label="线路"> </el-table-column>
<el-table-column prop="cmdid" label="装置编号" width="160"> </el-table-column>
<el-table-column label="规约" width="140">
<template slot-scope="scope">
{{ protocolMap[scope.row.protocol] }}
</template>
</el-table-column>
<el-table-column prop="file_name" label="文件名">
<el-table-column prop="fileName" label="文件名">
<template slot-scope="scope">
<a :href="'/dl/?id=' + scope.row.id" class="buttonText">{{
scope.row.file_name
}}</a>
<!-- <a :href="'http://61.169.135.146:40085/dl/' + scope.row.path" class="buttonText"></a> -->
<el-button type="text" @click="downFile(scope.row)" class="buttonText">{{
scope.row.fileName
}}</el-button>
</template>
</el-table-column>
<el-table-column label="文件大小">
<el-table-column label="文件大小" width="100">
<template slot-scope="scope">
{{ scope.row.file_size | changeType }}
{{ scope.row.fileSize | changeType }}
</template>
</el-table-column>
<el-table-column prop="create_time" label="上传时间"> </el-table-column>
<el-table-column label="操作" class-name="editClass">
<el-table-column prop="createTime" label="上传时间" width="160"> </el-table-column>
<el-table-column label="操作" class-name="editClass" >
<template slot-scope="scope">
<el-link
type="danger"
@ -49,7 +50,7 @@
</div>
</template>
<script>
import { getqueryUploadsApi, updUploadApi } from "@/utils/api/index";
import { logListApi,logDeleteApi} from "@/utils/api/index";
export default {
name: "log",
components: {},
@ -67,6 +68,8 @@ export default {
65285: "河南全景",
65286: "河南郑州",
65290: "河南统一视频v2020",
65298:"宁夏",
2:"南网"
},
};
},
@ -88,7 +91,7 @@ export default {
methods: {
getLogList() {
this.logLoading = true;
getqueryUploadsApi()
logListApi()
.then((res) => {
this.tableData = res.data;
this.logLoading = false;
@ -102,8 +105,7 @@ export default {
type: "warning",
})
.then(() => {
updUploadApi({
act: "del",
logDeleteApi({
id: row.id,
})
.then((res) => {
@ -120,6 +122,24 @@ export default {
})
.catch(() => {});
},
//
downFile(row){
// a
const a = document.createElement('a');
// ahrefURL
a.href = '/dl/'+row.path;
console.log(a.href)
//
a.download = row.fileName; //
//
document.body.appendChild(a);
a.click();
// a
document.body.removeChild(a);
}
},
};
</script>
@ -147,9 +167,9 @@ export default {
}
.buttonText {
cursor: pointer;
color: #606266;
white-space: pre-wrap;
&:hover {
color: #337ab7;
text-decoration: underline;
}
}

@ -39,7 +39,9 @@
</template>
<script>
import { loginJoggle } from "@/utils/api/index";
import { mapMutations } from "vuex";
export default {
name: "login",
components: {},
data: function () {
return {
@ -59,47 +61,21 @@ export default {
token: "",
};
},
computed: {},
computed: {
...mapMutations(["SET_TOKEN", "SET_USERINFO"]),
},
methods: {
submitForm() {
this.$refs.loginForm.validate((valid) => {
if (valid) {
console.log(this.userInfo);
// if (
// (this.userInfo.userName == "admin" &&
// this.userInfo.password == "shxy123456") ||
// (this.userInfo.userName == "cacuser" &&
// this.userInfo.password == "cac123456")
// ) {
// localStorage.setItem("token", "13747c96ff9f434cb09ecf78e4b9a8bc");
// this.$message({
// duration: 1500,
// showClose: true,
// message: "",
// type: "success",
// });
// this.$router.push("/");
// return;
// } else {
// this.$message({
// duration: 1500,
// showClose: true,
// message: "",
// type: "warning",
// });
// return;
// }
//
loginJoggle(this.userInfo)
.then((res) => {
if (res.res == 1) {
// this.$store.commit("SET_TOKEN", res.data.sessionId); //tokenvuex
// this.$store.commit("SET_USERINFO", res.data); //vuex
localStorage.setItem(
"token",
"13747c96ff9f434cb09ecf78e4b9a8bc"
);
if (res.code == 200) {
console.log(res.data);
this.$store.commit("SET_TOKEN", res.data.token); //tokenvuex
this.$store.commit("SET_USERINFO", res.data); //vuex
this.$router.push("/");
this.$message({
duration: 1500,

@ -11,9 +11,9 @@
>
<el-option
v-for="item in operateOptions"
:key="item.id"
:label="item.name"
:value="item.id"
:key="item.key"
:label="item.desc"
:value="item.key"
></el-option>
</el-select>
<el-input
@ -36,10 +36,12 @@
@click="deleteml"
></el-button>
</div>
<div class="mlbpox" v-loading="leftComLoading">
<div
class="commandList"
v-loading="leftComLoading"
v-if="leftCommand.length != 0"
>
<p
class="comLi"
@ -50,11 +52,11 @@
<span class="indexClass">{{ index + 1 }}</span>
<span class="comMsg"
><b>时间{{ item.createTime }}</b>
<b>设备ID{{ item.cmdid }}</b>
<b v-if="item.cmd.fileName">apk{{ item.cmd.fileName }}</b>
<b v-if="item.cmdDesc == ''">{{ cmdCn[item.cmdName] }}</b
><b v-else>{{ item.cmdDesc }}</b>
<b v-if="item.terminal && item.terminal.cmdid">ID{{ item.terminal.cmdid }}</b>
<b v-if="item.cmdMap &&item.cmdMap.fileName">apk{{ item.cmdMap.fileName }}</b>
<b>命令{{ cmdCn[item.name] }}</b
>
<b v-if="item.estimatedPublishTime * 1000 - newupdatatime > 0"
>命令预计拿走时间
@ -72,6 +74,7 @@
<p>暂无下发命令</p>
</div>
</div>
</div>
<div class="commandRunRight commandClass">
<div class="headTitle">
<span class="title">已下发终端</span>
@ -82,9 +85,9 @@
>
<el-option
v-for="item in operateOptions"
:key="item.id"
:label="item.name"
:value="item.id"
:key="item.key"
:label="item.desc"
:value="item.key"
></el-option>
</el-select>
<el-input
@ -107,7 +110,8 @@
@click="deletehis"
></el-button>
</div>
<div class="commandList" v-if="rightCommand.length != 0">
<div class="mlbpox" v-loading="rightComLoading">
<div class="commandList" v-if="rightCommand.length != 0" >
<p class="comLi" v-for="(item, index) in rightCommand" :key="index">
<el-tooltip
class="item"
@ -122,13 +126,12 @@
>{{ index + 1 }}</span
>
</el-tooltip>
<span class="comMsg"
<span class="comMsg"
><b>下发时间{{ item.publishTime }}</b>
<b>设备ID{{ item.cmdid }}</b>
<b>命令{{ cmdCn[item.cmdName] }}</b>
<b v-if="item.cmd.fileName">apk{{ item.cmd.fileName }}</b>
<b v-else>cmd{{ item.cmd }}</b>
<b v-if="item.terminal && item.terminal.cmdid">ID{{ item.terminal.cmdid }}</b>
<b>命令{{ cmdCn[item.name] }}</b>
<b v-if="item.cmdMap &&item.cmdMap.fileName">apk{{ item.cmdMap.fileName }}</b>
<b v-else>cmd{{ item.cmdMap }}</b>
</span>
</p>
</div>
@ -136,6 +139,7 @@
<p>暂无已下发命令</p>
</div>
</div>
</div>
</div>
<el-dialog
class="MsgDialog"
@ -146,9 +150,9 @@
>
<div class="cmdMain">
<!-- {{ deveceMsg }} -->
<p>设备ID:{{ deveceMsg.cmdid }}</p>
<p>设备ID:{{ devCmdid }}</p>
<p>操作时间{{ deveceMsg.createTime }}</p>
<p>待执行操作{{ deveceMsg.cmdName }}</p>
<p>待执行操作{{cmdCn[deveceMsg.name]}} {{ deveceMsg.name }}</p>
<p>cmd{{ deveceMsg.cmd }}</p>
</div>
<div slot="footer" class="dialog-footer">
@ -158,19 +162,21 @@
</div>
</template>
<script>
import { getdoActionApi, getqueryCmdsApi } from "@/utils/api/index";
import { cmdSendApi,getCmdActionApi,cmdActlistApi,cmdActHislistApi } from "@/utils/api/index";
export default {
name: "report",
components: {},
data() {
return {
leftComLoading: false, //loading
runCommand: [],
endCommand: [],
rightComLoading:false,//loiading
// runCommand: [],
// endCommand: [],
leftCommand: [],
rightCommand: [],
commandShow: false,
deveceMsg: "",
deveceMsg: {},
devCmdid:'',
cmdCn: {
yw_cmd_android_reboot: "重启设备",
yw_cmd_mcu_reboot: "MCU单片机重启",
@ -179,7 +185,7 @@ export default {
i1_cmd_set_i1_heart_beat_time: "设置心跳周期",
yw_cmd_upload_i1_zip_log: "上传日志",
upgrade: "升级",
updOta: "Ota升级",
yw_upd_ota: "Ota升级",
yw_cmd_start_frpc: "开启frpc",
yw_cmd_stop_frpc: "停止frpc",
i1_cmd_stop_aging_test: "停止老化测试",
@ -190,21 +196,10 @@ export default {
newupdatatime: null,
//
operateOptions: [
{ id: 0, name: "全部" },
{ id: 1, name: "重启设备" },
{ id: 2, name: "MCU单片机重启" },
{ id: 3, name: "设置I1服务器" },
// { id: 4, name: "" },
{ id: 5, name: "设置心跳周期" },
{ id: 6, name: "上传日志" },
{ id: 7, name: "升级" },
{ id: 11, name: "OTA升级" },
{ id: 8, name: "开启frpc" },
{ id: 9, name: "停止frpc" },
{ id: 10, name: "停止老化测试" },
{id: 0, key: "all", desc: "全部"}
],
operateL: 0,
operateR: 0,
operateL: 'all',
operateR: 'all',
leftcmdVal: "",
rightcmdVal: "",
intervalId: null, // setIntervalID
@ -218,10 +213,20 @@ export default {
mounted() {
this.getCmdList();
this.getEndList();
this.getCmdOptionsFun()
this.startCountdown(); //
},
methods: {
getCmdOptionsFun(){
getCmdActionApi()
.then((res) => {
console.log(res);
this.operateOptions = this.operateOptions.concat(res.data);
// this.operateL = this.operateOptions[0].desc;
})
.catch((err) => {});
},
startCountdown() {
this.newupdatatime = new Date().getTime(); //
//
@ -254,13 +259,26 @@ export default {
}
},
getCmdList() {
//this.leftComLoading = true;
getqueryCmdsApi({ p: 1, ps: 10000 })
this.leftComLoading = true;
let params = {
pageNum:1,
pageSize:300,
};
console.log(this.operateL)
//
if (this.operateL!=='all') {
params.action = this.operateL;
}
if (this.leftcmdVal !== "") {
params.cmdid = this.leftcmdVal;
}
cmdActlistApi(params)
.then((res) => {
console.log(res);
this.runCommand = res.data;
//this.runCommand = res.data.list;
this.leftCommand = res.data.list;
this.leftComLoading = false;
this.selectLeftChanged(this.operateL);
this.updateTime = new Date();
})
.catch((err) => {});
@ -270,11 +288,56 @@ export default {
this.commandShow = true;
console.log(this.commandShow);
this.deveceMsg = val;
this.devCmdid = val.terminal.cmdid
},
//
getEndList() {
this.rightComLoading = true;
let params = {
pageNum:1,
pageSize:300,
};
//
if (this.operateR!== 'all') {
params.action = this.operateR;
}
if (this.rightcmdVal!== "") {
params.cmdid = this.rightcmdVal;
}
cmdActHislistApi(params)
.then((res) => {
console.log(res);
//this.endCommand = res.data;
//this.endCommand = res.data.list
this.rightCommand = res.data.list;
this.rightComLoading = false;
this.updateTime = new Date();
})
.catch((err) => {});
},
//
selectLeftChanged() {
this.getCmdList()
},
leftInputChange() {
console.log(this.leftcmdVal);
this.getCmdList()
},
//
selectRightChanged() {
this.getEndList()
},
rightInputChange() {
this.getEndList()
},
//
handleCancel(val) {
getdoActionApi({
act: "cancel",
//
handleCancel(val) {
console.log(val)
cmdSendApi({
action: "cancel",
id: val,
})
.then((res) => {
@ -303,166 +366,9 @@ export default {
.catch((err) => {});
},
//
getEndList() {
getqueryCmdsApi({ qt: "his", p: 1, ps: 10000 })
.then((res) => {
console.log(res);
//this.endCommand = res.data;
this.endCommand = res.data.filter((item) => item.status == "1");
this.selectRightChanged(this.operateR);
// this.leftComLoading = false;
this.updateTime = new Date();
})
.catch((err) => {});
},
//
selectLeftChanged(val) {
console.log(val);
switch (val) {
case 0:
this.leftCommand = this.runCommand;
return;
case 1:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "yw_cmd_android_reboot"
);
return;
case 2:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "yw_cmd_mcu_reboot"
);
return;
case 3:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "i1_cmd_set_i1_server_ip_port"
);
return;
case 4:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "i1_cmd_set_xy_yw_ip_port"
);
return;
case 5:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "i1_cmd_set_i1_heart_beat_time"
);
return;
case 6:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "yw_cmd_upload_i1_zip_log"
);
return;
case 7:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "upgrade"
);
return;
case 8:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "yw_cmd_start_frpc"
);
return;
case 9:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "yw_cmd_stop_frpc"
);
return;
case 10:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "i1_cmd_stop_aging_test"
);
return;
case 11:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "updOta"
);
return;
}
},
leftInputChange() {
console.log(this.leftcmdVal);
this.leftCommand = this.runCommand.filter((item) =>
item.cmdid.includes(this.leftcmdVal)
);
},
//
selectRightChanged(val) {
console.log(val);
switch (val) {
case 0:
this.rightCommand = this.endCommand;
console.log(this.rightCommand);
return;
case 1:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "yw_cmd_android_reboot"
);
console.log(this.rightCommand);
return;
case 2:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "yw_cmd_mcu_reboot"
);
return;
case 3:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "i1_cmd_set_i1_server_ip_port"
);
return;
case 4:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "i1_cmd_set_xy_yw_ip_port"
);
return;
case 5:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "i1_cmd_set_i1_heart_beat_time"
);
return;
case 6:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "yw_cmd_upload_i1_zip_log"
);
return;
case 7:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "upgrade"
);
return;
case 8:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "yw_cmd_start_frpc"
);
return;
case 9:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "yw_cmd_stop_frpc"
);
return;
case 10:
this.rightCommand = this.endCommand.filter(
(item) => item.cmdName == "i1_cmd_stop_aging_test"
);
return;
case 11:
this.leftCommand = this.runCommand.filter(
(item) => item.cmdName == "updOta"
);
return;
}
},
rightInputChange() {
console.log(this.rightcmdVal);
this.rightCommand = this.endCommand.filter((item) =>
item.cmdid.includes(this.rightcmdVal)
);
},
deleteml() {
getdoActionApi({
act: "clear",
cmdSendApi({
action: "clear",
})
.then((res) => {
console.log(res);
@ -490,8 +396,8 @@ export default {
.catch((err) => {});
},
deletehis() {
getdoActionApi({
act: "clearHis",
cmdSendApi({
action: "clearHis",
})
.then((res) => {
console.log(res);
@ -536,7 +442,7 @@ export default {
padding: 12px;
.commandBox {
display: flex;
height: 100%;
height: calc(100% - 18px);
.commandClass {
width: 50%;
padding: 12px;
@ -573,9 +479,12 @@ export default {
padding: 4px;
}
}
.mlbpox{
height: calc(100% - 40px);
}
.commandList {
width: 100%;
height: calc(100% - 32px);
height: calc(100% - 0px);
//background: #fcc;
overflow: auto;
p {

@ -1,19 +1,29 @@
<template>
<div class="upgradationBox">
<div class="uploadForm">
<div class="noteBox">
<h3 class="lableBox">文件类型</h3>
<el-select v-model="reportData.type" placeholder="请选择">
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
<div class="upgradeBox">
<h3 class="lableBox">文件上传</h3>
<el-upload
class="upload-demo"
ref="upload"
action="/web/api/uploadFile.php"
action="#"
:before-upload="beforeUpload"
:http-request="customUpload"
:limit="1"
:file-list="fileList"
:data="reportData"
:on-progress="handleProgress"
:auto-upload="false"
:on-success="handleAvatarSuccess"
@before-upload="beforeAvatarUpload"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
@ -35,6 +45,7 @@
>上传到服务器</el-button
>
</div>
</div>
<div class="uploadPressMask" v-if="progressLoading">
<div class="centerClass">
@ -60,8 +71,6 @@
<el-table-column prop="fileName" label="文件名称">
<template slot-scope="scope">
<span
@dblclick="handleDblClick(scope.row.path)"
style="cursor: pointer"
>
{{ scope.row.fileName }}</span
>
@ -70,18 +79,14 @@
<el-table-column prop="path" label="文件路径">
<template slot-scope="scope">
<span
@dblclick="handleDblClick(scope.row.path)"
style="cursor: pointer"
@click="handleClick(scope.row)"
class="buttonText"
>
{{ scope.row.path }}</span
>
</template>
</el-table-column>
<el-table-column prop="fileSize" label="文件大小">
<template slot-scope="scope">
{{ scope.row.fileSize | changeType }}
</template>
</el-table-column>
<el-table-column prop="title" label="备注"> </el-table-column>
<!-- <el-table-column prop="path" label="文件路径"> </el-table-column> -->
<el-table-column label="操作" width="300" class-name="editClass">
@ -130,13 +135,14 @@
</template>
<script>
import {
postuploadFileApi,
getqueryUpgradesApi,
getupdUpgradeApi,
upgradeListApi,
upgradeUpLoadApi,
upgradeDeleteApi,
upgradeTitleApi
} from "@/utils/api/index";
export default {
name: "upgradation",
name: "deviceUpgrade",
components: {},
data() {
return {
@ -144,8 +150,15 @@ export default {
fileList: [],
reportData: {
title: "",
upgradeType:0,
type:0,
},
typeOptions:[{
value: 0,
label: 'APK'
}, {
value:1,
label:'OTA'
}],
fileData: [], //
fileloading: false,
editShow: false,
@ -163,37 +176,26 @@ export default {
progressLoading: false,
};
},
filters: {
changeType(val) {
if (val == "0") return "0B";
var k = 1024;
var sizes = ["B", "KB", "MB", "GB", "TB"];
let i = Math.floor(Math.log(val) / Math.log(k)); //kB?MB
return (val / Math.pow(k, i)).toPrecision(3) + "" + sizes[i];
},
},
computed: {},
mounted() {
this.getUpgradeList();
},
methods: {
//
handleDblClick(val) {
// alert(val);
var input = document.createElement("input"); // input
input.value = val; //
document.body.appendChild(input); //
input.select(); //
document.execCommand("Copy"); //
document.body.removeChild(input); //
//this.$message.success("");
this.$message({
duration: 1500,
showClose: true,
message: "复制成功!" + val,
type: "success",
});
handleClick(row) {
console.log(row)
// a
const a = document.createElement('a');
// ahrefURL
a.href = '/apk/'+row.path;
console.log(a.href)
//
a.download = row.fileName; //
//
document.body.appendChild(a);
a.click();
// a
document.body.removeChild(a);
},
//
handleProgress(event, file, fileList) {
@ -204,57 +206,101 @@ export default {
} else {
this.progress = Math.round(event.percent);
}
//
console.log(this.progress); // 使使
},
//
beforeAvatarUpload(file) {
console.log(this.reportData.title);
console.log(this.reportData.title);
console.log(file);
beforeUpload(file) {
const fileName = file.name;
console.log(fileName);
if (fileName.toLowerCase().includes('apk')) {
this.reportData.type=0
}
if (fileName.toLowerCase().includes('zip')) {
this.reportData.type=1
}
if (fileName.length > 19) {
this.$message.error("文件名长度不能超过 19 个字符!");
return false; //
}
return true; //
},
//apk
submitUpload() {
//console.log();
this.$refs.upload.submit();
},
handleAvatarSuccess(res, file) {
this.progressLoading = false;
console.log(res);
this.$message({
duration: 1500,
showClose: true,
message: "文件上传成功",
type: "success",
});
this.reportData.title = "";
this.$refs.upload.clearFiles();
this.getUpgradeList();
customUpload(options) {
console.log(options);
const formData = new FormData();
formData.append("file", options.file);
formData.append("title", this.reportData.title); //
formData.append("type", this.reportData.type); //
console.log(formData);
upgradeUpLoadApi(formData, (progressEvent) => {
//
const percentCompleted = Math.round(
(progressEvent.loaded * 100) / progressEvent.total
);
this.progressLoading = true;
// UI
console.log(`上传进度: ${percentCompleted}%`);
this.progress = Math.round(percentCompleted);
// Vue
// this.uploadProgress = percentCompleted; // data
})
.then((res) => {
console.log(res);
// this.progressLoading = true;
if (res.code == 200) {
this.$message({
duration: 1500,
showClose: true,
message: "文件上传成功",
type: "success",
});
this.reportData.title = "";
this.$refs.upload.clearFiles();
this.getUpgradeList();
this.progressLoading = false;
} else {
this.$message({
duration: 1500,
showClose: true,
message: res.msg,
type: "error",
});
this.progressLoading = false;
this.reportData.title = "";
this.$refs.upload.clearFiles();
}
})
.catch((error) => {});
},
getUpgradeList() {
this.fileloading = true;
getqueryUpgradesApi()
upgradeListApi()
.then((res) => {
console.log(res);
this.fileData = res.data.filter(item => item.type === "0");
this.fileData = res.data;
this.fileloading = false;
})
.catch((err) => {});
},
handleDeleteClick(row) {
getupdUpgradeApi({
act: "del",
id: row.id,
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then((res) => {
console.log(res);
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
.then(() => {
upgradeDeleteApi({
id: row.id,
})
.then(() => {
.then((res) => {
console.log(res);
this.$message({
duration: 1500,
showClose: true,
@ -265,7 +311,7 @@ export default {
})
.catch(() => {});
})
.catch((err) => {});
.catch(() => {});
},
handleEditClick(row) {
console.log(row);
@ -277,8 +323,7 @@ export default {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
console.log(this.ruleForm.notesNewVal);
getupdUpgradeApi({
act: "edt",
upgradeTitleApi({
id: this.rowData.id,
title: this.ruleForm.notesNewVal,
})
@ -308,6 +353,7 @@ export default {
height: calc(100% - 24px);
width: calc(100% - 24px);
padding: 12px;
.upgradeBox {
height: 32px;
line-height: 32px;
@ -368,9 +414,15 @@ export default {
.uploadBtn {
margin-left: 12px;
}
.uploadForm {
.el-button--default,
.el-button--primary {
width: auto;
}
}
.uploadList {
margin-top: 20px;
height: calc(100% - 100px);
height: calc(100% - 148px);
.el-table {
.el-table__cell {
text-align: center;
@ -401,6 +453,17 @@ export default {
height: 100%;
}
}
.el-table::before {
height: 1px !important;
}
.buttonText{
color:#169e8c;
cursor: pointer;
&:hover {
text-decoration: underline;
}
}
}
.el-dialog__headerbtn {
top: 18px;

@ -1,413 +0,0 @@
<template>
<div class="upgradationOta">
<div class="uploadForm">
<div class="upgradeBox">
<h3 class="lableBox">文件上传</h3>
<el-upload
class="upload-demo"
ref="upload"
action="/web/api/uploadFile.php"
:limit="1"
:file-list="fileList"
:data="reportData"
:on-progress="handleProgress"
:auto-upload="false"
:on-success="handleAvatarSuccess"
@before-upload="beforeAvatarUpload"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
>
</el-upload>
</div>
<div class="noteBox">
<h3 class="lableBox">文件备注</h3>
<el-input
class="noteClass"
v-model="reportData.title"
placeholder="输入备注"
></el-input>
<el-button
class="uploadBtn"
size="small"
type="primary"
@click="submitUpload"
>上传到服务器</el-button
>
</div>
</div>
<div class="uploadPressMask" v-if="progressLoading">
<div class="centerClass">
<el-progress type="circle" :percentage="progress"></el-progress>
</div>
</div>
<div class="uploadList">
<el-table
:data="fileData"
style="width: 100%"
border
stripe
height="calc(100% - 0px)"
v-loading="fileloading"
>
<el-table-column type="index" width="50" label="序号">
</el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
width="180"
></el-table-column>
<el-table-column prop="fileName" label="文件名称">
<template slot-scope="scope">
<span
@dblclick="handleDblClick(scope.row.path)"
style="cursor: pointer"
>
{{ scope.row.fileName }}</span
>
</template>
</el-table-column>
<el-table-column prop="path" label="文件路径">
<template slot-scope="scope">
<span
@dblclick="handleDblClick(scope.row.path)"
style="cursor: pointer"
>
{{ scope.row.path }}</span
>
</template>
</el-table-column>
<el-table-column prop="fileSize" label="文件大小">
<template slot-scope="scope">
{{ scope.row.fileSize | changeType }}
</template>
</el-table-column>
<el-table-column prop="title" label="备注"> </el-table-column>
<!-- <el-table-column prop="path" label="文件路径"> </el-table-column> -->
<el-table-column label="操作" width="300" class-name="editClass">
<template slot-scope="scope">
<el-link
type="primary"
@click="handleEditClick(scope.row)"
size="small"
icon="el-icon-edit"
>修改</el-link
>
<el-link
type="danger"
@click="handleDeleteClick(scope.row)"
size="small"
icon="el-icon-delete"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog
class="titleDialog"
title="修改备注"
:visible.sync="titleShow"
:close-on-click-modal="false"
width="480px"
>
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="文件备注" prop="notesNewVal">
<el-input v-model="ruleForm.notesNewVal"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="confirmClick"></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
postuploadFileApi,
getqueryUpgradesApi,
getupdUpgradeApi,
} from "@/utils/api/index";
export default {
name: "upgradationOta",
components: {},
data() {
return {
//apk notesVal
fileList: [],
reportData: {
title: "",
upgradeType:1,
},
fileData: [], //
fileloading: false,
editShow: false,
titleShow: false,
ruleForm: {
notesNewVal: "",
},
rules: {
notesNewVal: [
{ required: true, message: "请输入备注信息", trigger: "blur" },
],
},
rowData: "", //
progress: 0,
progressLoading: false,
};
},
filters: {
changeType(val) {
if (val == "0") return "0B";
var k = 1024;
var sizes = ["B", "KB", "MB", "GB", "TB"];
let i = Math.floor(Math.log(val) / Math.log(k)); //kB?MB
return (val / Math.pow(k, i)).toPrecision(3) + "" + sizes[i];
},
},
computed: {},
mounted() {
this.getUpgradeList();
},
methods: {
//
handleDblClick(val) {
// alert(val);
var input = document.createElement("input"); // input
input.value = val; //
document.body.appendChild(input); //
input.select(); //
document.execCommand("Copy"); //
document.body.removeChild(input); //
//this.$message.success("");
this.$message({
duration: 1500,
showClose: true,
message: "复制成功!" + val,
type: "success",
});
},
//
handleProgress(event, file, fileList) {
this.progressLoading = true;
//
if (event.percent == 100) {
this.progress = 98;
} else {
this.progress = Math.round(event.percent);
}
//
console.log(this.progress); // 使使
},
//
beforeAvatarUpload(file) {
console.log(this.reportData.title);
console.log(file);
},
//apk
submitUpload() {
//console.log();
this.$refs.upload.submit();
},
handleAvatarSuccess(res, file) {
this.progressLoading = false;
console.log(res);
this.$message({
duration: 1500,
showClose: true,
message: "文件上传成功",
type: "success",
});
this.reportData.title = "";
this.$refs.upload.clearFiles();
this.getUpgradeList();
},
getUpgradeList() {
this.fileloading = true;
getqueryUpgradesApi()
.then((res) => {
console.log(res);
this.fileData = res.data.filter(item => item.type === "1");
this.fileloading = false;
})
.catch((err) => {});
},
handleDeleteClick(row) {
getupdUpgradeApi({
act: "del",
id: row.id,
})
.then((res) => {
console.log(res);
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$message({
duration: 1500,
showClose: true,
message: "文件删除成功",
type: "success",
});
this.getUpgradeList();
})
.catch(() => {});
})
.catch((err) => {});
},
handleEditClick(row) {
console.log(row);
this.titleShow = true;
this.ruleForm.notesNewVal = row.title;
this.rowData = row;
},
confirmClick() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
console.log(this.ruleForm.notesNewVal);
getupdUpgradeApi({
act: "edt",
id: this.rowData.id,
title: this.ruleForm.notesNewVal,
})
.then((res) => {
console.log(res);
this.$message({
duration: 1500,
showClose: true,
message: "修改备注成功",
type: "success",
});
this.titleShow = false;
this.getUpgradeList();
})
.catch((err) => {});
} else {
console.log("error submit!!");
return false;
}
});
},
},
};
</script>
<style lang="less">
.upgradationOta {
height: calc(100% - 24px);
width: calc(100% - 24px);
padding: 12px;
.upgradeBox {
height: 32px;
line-height: 32px;
display: flex;
margin-bottom: 16px;
// align-items: center;
// flex-direction: column;
.lableBox {
font-size: 14px;
font-weight: normal;
width: 78px;
}
.upload-demo {
position: relative;
display: flex;
flex-direction: row-reverse;
margin-right: 32px;
.el-upload-list {
width: 320px;
height: 32px;
line-height: 32px;
border: 1px solid #ddd;
margin-right: 12px;
border-radius: 4px;
.el-upload-list__item {
transition: none;
font-size: 14px;
color: #606266;
position: relative;
box-sizing: border-box;
border-radius: 4px;
width: 100%;
height: 32px;
line-height: 32px;
margin-top: 0px !important;
.el-icon-close {
top: 10px;
}
}
}
}
}
.noteBox {
height: 32px;
line-height: 32px;
display: flex;
margin-bottom: 16px;
.noteClass {
width: 322px;
}
.lableBox {
font-size: 14px;
font-weight: normal;
width: 78px;
}
}
.uploadBtn {
margin-left: 12px;
}
.uploadList {
margin-top: 20px;
height: calc(100% - 100px);
.el-table {
.el-table__cell {
text-align: center;
}
}
}
.editClass {
.el-link.el-link--primary {
margin-right: 14px;
}
}
.uploadPressMask {
position: fixed;
width: 100%;
height: 100%;
background-color: hsla(0, 0%, 100%, 0.9);
margin: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 3;
.centerClass {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
}
}
.el-dialog__headerbtn {
top: 18px;
.el-dialog__close {
font-size: 26px;
&:hover {
background: #e2e2e2;
}
}
}
</style>

@ -43,7 +43,7 @@
</template>
<script>
// import { addUserApi, updateUserApi } from "@/utils/api/index";
import { getqueryActivityApi } from "@/utils/api/index";
import { } from "@/utils/api/index";
export default {
props: {},

@ -16,11 +16,12 @@ module.exports = defineConfig({
transpileDependencies: true,
lintOnSave: false,
devServer: {
port: 1234, // 端口号的配置
port: 8989, // 端口号的配置
proxy: {
"/api": {
//表示拦截以/api开头的请求路径
target: "http://61.169.135.146:40101/", //
// target: "http://61.169.135.146:40101/", //
target: "http://61.169.135.146:40080/", //dell
changOrigin: true, //是否开启跨域
pathRewrite: {
"^/api": "/api", //重写api把api变成空字符因为我们真正请求的路径是没有api的

Loading…
Cancel
Save