清除所有命令

master
fanluyan 2 years ago
parent f25447d691
commit 92ccd9e0f8

@ -28,6 +28,30 @@ export function getqueryTermsApi(data) {
}, },
}); });
} }
//获取规约
export function getqueryProtocolApi(data) {
return request({
url: "api/queryProtocol.php",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//获取活动列表
export function getqueryActivityApi(data) {
return request({
url: "api/queryActivity.php",
method: "get",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//运维,快心跳 //运维,快心跳
export function getdoActionApi(data) { export function getdoActionApi(data) {
return request({ return request({

@ -25,6 +25,12 @@
multipleSelection.length multipleSelection.length
}}</el-tag></span }}</el-tag></span
> >
<span
>运维<el-tag type="primary">{{ ywNumber }}</el-tag></span
>
<span
>快心跳<el-tag type="primary">{{ kxtNumber }}</el-tag></span
>
<span <span
>在线<el-tag type="success">{{ onlineNum }}</el-tag></span >在线<el-tag type="success">{{ onlineNum }}</el-tag></span
> >
@ -89,7 +95,15 @@
<el-tag type="danger" v-else>线</el-tag> <el-tag type="danger" v-else>线</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="运维" prop="in_maintain" width="70" sortable> <el-table-column label="运维" prop="in_maintain" width="120" sortable>
<template slot="header" slot-scope="scope">
<el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAllYW"
@change="handlecheckAllYW"
>运维</el-checkbox
>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox <el-checkbox
v-model="scope.row.in_maintain" v-model="scope.row.in_maintain"
@ -99,7 +113,15 @@
></el-checkbox> ></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="快心跳" prop="quick_hb" width="88" sortable> <el-table-column label="快心跳" prop="quick_hb" width="128" sortable>
<template slot="header" slot-scope="scope">
<el-checkbox
:indeterminate="isIndeterminate"
v-model="checkAllKXT"
@change="handlecheckAllKXT"
>快心跳</el-checkbox
>
</template>
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox <el-checkbox
v-model="scope.row.quick_hb" v-model="scope.row.quick_hb"
@ -264,7 +286,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="CMA服务器" v-if="cmacheck" min-width="160"> <el-table-column label="CMA服务器" v-if="cmacheck" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
{{ {{
scope.row.raw_report.hasOwnProperty("msgs") scope.row.raw_report.hasOwnProperty("msgs")
@ -610,6 +632,12 @@ export default {
65290: "河南统一视频v2020", 65290: "河南统一视频v2020",
}, },
multipleSelection: [], multipleSelection: [],
isIndeterminate: false,
checkAllYW: false,
checkAllKXT: false,
ywNumber: 0,
kxtNumber: 0,
nowTime: new Date().getTime() / 1000, nowTime: new Date().getTime() / 1000,
gycheck: false, gycheck: false,
@ -771,18 +799,34 @@ export default {
}, },
mounted() { mounted() {
this.loadLocalStorage(); this.loadLocalStorage();
// this.$nextTick(() => {
// this.getNumber();
// });
}, },
watch: { watch: {
tableData: { tableData: {
handler(newVal) { handler(newVal) {
// //
console.log("数据已更新:", newVal); console.log("数据已更新:", newVal);
this.getNumber();
}, },
deep: true, deep: true,
}, },
}, },
methods: { methods: {
//
getNumber() {
console.log(this.tableData);
this.ywNumber = this.tableData.filter(
(item) => item.in_maintain == 1
).length;
this.kxtNumber = this.tableData.filter(
(item) => item.quick_hb == 1
).length;
console.log(this.ywNumber, this.kxtNumber);
},
// //
handleExport() { handleExport() {
htmlToExcel.getExcel("#ywTable", "设备运维信息"); htmlToExcel.getExcel("#ywTable", "设备运维信息");
@ -806,7 +850,50 @@ export default {
console.log(val); console.log(val);
this.$refs.rowMsgDialogref.display(val); this.$refs.rowMsgDialogref.display(val);
}, },
handlecheckAllYW(val) {
let totalCount = this.tableData.length;
let someStatusCount = 0;
console.log(val);
if (val) {
console.log("选中");
this.tableData.forEach((item) => {
item.in_maintain = 1;
console.log(item);
getdoActionApi({
act: "mntn",
termId: item.id,
mntn: 1,
})
.then((res) => {
console.log(res);
})
.catch((err) => {});
});
} else {
console.log("取消选中");
this.tableData.forEach((item) => {
item.in_maintain = 0;
someStatusCount = 0;
console.log(item);
getdoActionApi({
act: "mntn",
termId: item.id,
mntn: 0,
})
.then((res) => {
console.log(res);
})
.catch((err) => {});
});
}
localStorage.setItem("checkAllYW", this.checkAllYW);
this.checkAllYW = totalCount === this.ywNumber ? true : false;
this.isIndeterminate = this.ywNumber > 0 && this.ywNumber < totalCount;
// this.isIndeterminate = false;
},
// //
UpdateMaintainMode(val, row) { UpdateMaintainMode(val, row) {
console.log("运维"); console.log("运维");
@ -821,6 +908,51 @@ export default {
.catch((err) => {}); .catch((err) => {});
}, },
// //
handlecheckAllKXT(val) {
let totalCount = this.tableData.length;
let someStatusCount = 0;
console.log(val);
if (val) {
console.log("选中");
this.tableData.forEach((item) => {
item.quick_hb = 1;
someStatusCount++;
console.log(item);
getdoActionApi({
act: "quickhb",
termId: item.id,
quickhb: 1,
})
.then((res) => {
console.log(res);
})
.catch((err) => {});
});
} else {
console.log("取消选中");
this.tableData.forEach((item) => {
item.quick_hb = 0;
someStatusCount = 0;
console.log(item);
getdoActionApi({
act: "quickhb",
termId: item.id,
quickhb: 0,
})
.then((res) => {
console.log(res);
})
.catch((err) => {});
});
}
localStorage.setItem("checkAllKXT", this.checkAllKXT);
this.checkAllKXT = totalCount === this.kxtNumber ? true : false;
this.isIndeterminate = this.kxtNumber > 0 && this.kxtNumber < totalCount;
// this.isIndeterminate = false;
},
//
UpdateQuickHbMode(val, row) { UpdateQuickHbMode(val, row) {
console.log("快心跳"); console.log("快心跳");
getdoActionApi({ getdoActionApi({
@ -888,7 +1020,7 @@ export default {
console.log("上传日志"); console.log("上传日志");
var params = { var params = {
act: "upload-logs", act: "upload-logs",
url: "http://180.166.218.222:40102/upload/", url: "http://180.166.218.222:40101/upload/",
termIds: this.idArray.join("-"), termIds: this.idArray.join("-"),
}; };
this.changeIssue(params); this.changeIssue(params);
@ -1062,6 +1194,12 @@ export default {
localStorage.setItem("bbcheck", this.bbcheck); localStorage.setItem("bbcheck", this.bbcheck);
}, },
loadLocalStorage() { loadLocalStorage() {
this.checkAllKXT = localStorage.getItem("checkAllKXT", this.checkAllKXT)
? JSON.parse(localStorage.getItem("checkAllKXT"))
: false;
this.checkAllYW = localStorage.getItem("checkAllYW", this.checkAllYW)
? JSON.parse(localStorage.getItem("checkAllYW"))
: false;
this.gycheck = localStorage.getItem("gycheck") this.gycheck = localStorage.getItem("gycheck")
? JSON.parse(localStorage.getItem("gycheck")) ? JSON.parse(localStorage.getItem("gycheck"))
: false; : false;
@ -1141,6 +1279,9 @@ export default {
.el-table__cell { .el-table__cell {
text-align: center; text-align: center;
.cell {
padding: 0px;
}
} }
.bbStyle { .bbStyle {
text-align: left; text-align: left;

@ -44,6 +44,36 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否运维" class="ismntClass">
<el-select v-model="formdata.ismntend">
<el-option
v-for="item in mntendOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="规约" class="gybox">
<el-select v-model="formdata.protocolId" filterable>
<el-option
v-for="item in protocolOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="活动" class="activitybox">
<el-select v-model="formdata.activityId" filterable>
<el-option
v-for="item in activityOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</div> </div>
<div class="bottomSearch"> <div class="bottomSearch">
<el-form-item label="出厂ID" class="oidbox"> <el-form-item label="出厂ID" class="oidbox">
@ -153,7 +183,7 @@
</div> </div>
<div <div
class="tableBox" class="tableBox"
:style="{ height: showDiv ? 'calc(100% - 102px)' : 'calc(100% - 2px)' }" :style="{ height: showDiv ? 'calc(100% - 82px)' : 'calc(100% - 2px)' }"
> >
<tableMain <tableMain
:tableData="dataList" :tableData="dataList"
@ -166,7 +196,12 @@
</div> </div>
</template> </template>
<script> <script>
import { getqueryLineApi, getqueryTermsApi } from "@/utils/api/index"; import {
getqueryLineApi,
getqueryTermsApi,
getqueryProtocolApi,
getqueryActivityApi,
} from "@/utils/api/index";
import tableMain from "./components/tableMain"; import tableMain from "./components/tableMain";
export default { export default {
name: "home", name: "home",
@ -188,6 +223,9 @@ export default {
lineId: 0, lineId: 0,
towerId: 0, towerId: 0,
isonline: -1, isonline: -1,
protocolId: 0,
activityId: 0,
ismntend: 1,
oidInput: "", oidInput: "",
oidCheck: 0, oidCheck: 0,
cmdidInput: "", cmdidInput: "",
@ -197,11 +235,19 @@ export default {
versionInput: "", versionInput: "",
versionCheck: 0, versionCheck: 0,
}, },
protocolOptions: [{ id: 0, name: "全部" }], //
activityOptions: [{ id: 0, name: "全部" }], //
mntendOptions: [
{ id: 0, name: "全部" },
{ id: 1, name: "运维" },
{ id: 2, name: "未运维" },
], //
dataList: [], dataList: [],
tableLoaidng: false, tableLoaidng: true,
onlineNum: "", //线 onlineNum: "", //线
offlineNum: "", //线 offlineNum: "", //线
noPicNum: "", // noPicNum: "", //
intervalId: null, // ID
}; };
}, },
created() { created() {
@ -213,11 +259,12 @@ export default {
} }
}; };
//this.fetchData(); // //this.fetchData(); //
setInterval(this.fetchData, 60000); // 10 //setInterval(this.fetchData, 60000); // 10
}, },
mounted() { mounted() {
this.getLineList(); this.getLineList();
this.onSubmit(); this.getprotocolList();
this.getActivityList();
}, },
watch: {}, watch: {},
methods: { methods: {
@ -242,26 +289,111 @@ export default {
}) })
.catch((err) => {}); .catch((err) => {});
}, },
//linelist 线
getprotocolList() {
getqueryProtocolApi()
.then((res) => {
console.log(res);
this.protocolOptions = [{ id: 0, name: "全部" }];
this.protocolOptions = this.protocolOptions.concat(res.data);
this.formdata.protocolId = this.protocolOptions[0].id;
})
.catch((err) => {});
},
//
getActivityList() {
getqueryActivityApi({
act: "list",
})
.then((res) => {
console.log(res);
console.log("222222222222222");
this.activityOptions = [{ id: 0, name: "全部" }];
let activeArr = res.data.map((item) => ({
id: item.id,
name: item.title,
}));
this.activityOptions = this.activityOptions.concat(activeArr);
this.formdata.activityId = this.activityOptions[0].id;
this.onSubmit();
})
.catch((err) => {});
},
onSubmit() { onSubmit() {
this.tableLoaidng = true; this.tableLoaidng = true;
getqueryTermsApi({ this.dataList = [];
let params = {
lineId: this.formdata.lineId, lineId: this.formdata.lineId,
towerId: this.formdata.towerId, towerId: this.formdata.towerId,
isonLine: this.formdata.isonline, isonLine: this.formdata.isonline,
fc: 4, };
fn1: "oid", var nonmntnedObj = {
fv1: this.formdata.oidInput, name: "mntned",
frev1: this.formdata.oidCheck, value: this.formdata.ismntend,
fn2: "cmdid", invertVal: "",
fv2: this.formdata.cmdidInput, };
frev2: this.formdata.cmdidCheck, var protocolObj = {
fn3: "cma", name: "protocol",
fv3: this.formdata.cmaInput, value: this.formdata.protocolId,
frev3: this.formdata.cmaCheck, invertVal: 0,
fn4: "version", };
fv4: this.formdata.versionInput, var activityObj = {
frev4: this.formdata.versionCheck, name: "activity",
}) value: this.formdata.activityId,
invertVal: 0,
};
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 (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);
//
if (this.intervalId) {
clearInterval(this.intervalId);
this.intervalId = null;
}
const interval = 60000; // 60000
this.intervalId = setInterval(() => {
//
this.fetchData();
}, interval);
getqueryTermsApi(params)
.then((res) => { .then((res) => {
res.data = res.data.map((item) => { res.data = res.data.map((item) => {
if (!item.raw_report.pic) { if (!item.raw_report.pic) {
@ -300,24 +432,68 @@ export default {
.catch((err) => {}); .catch((err) => {});
}, },
fetchData() { fetchData() {
getqueryTermsApi({ let params = {
lineId: this.formdata.lineId, lineId: this.formdata.lineId,
towerId: this.formdata.towerId, towerId: this.formdata.towerId,
isonLine: this.formdata.isonline, isonLine: this.formdata.isonline,
fc: 4, };
fn1: "oid", var nonmntnedObj = {
fv1: this.formdata.oidInput, name: "mntned",
frev1: this.formdata.oidCheck, value: this.formdata.ismntend,
fn2: "cmdid", invertVal: "",
fv2: this.formdata.cmdidInput, };
frev2: this.formdata.cmdidCheck, var protocolObj = {
fn3: "cma", name: "protocol",
fv3: this.formdata.cmaInput, value: this.formdata.protocolId,
frev3: this.formdata.cmaCheck, invertVal: 0,
fn4: "version", };
fv4: this.formdata.versionInput, var activityObj = {
frev4: this.formdata.versionCheck, name: "activity",
}) value: this.formdata.activityId,
invertVal: 0,
};
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 (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);
getqueryTermsApi(params)
.then((res) => { .then((res) => {
console.log(res); console.log(res);
res.data = res.data.map((item) => { res.data = res.data.map((item) => {
@ -360,6 +536,8 @@ export default {
lineId: 0, lineId: 0,
towerId: 0, towerId: 0,
isonline: -1, isonline: -1,
protocolId: 0,
activityId: 0,
oidInput: "", oidInput: "",
oidCheck: 0, oidCheck: 0,
cmdidInput: "", cmdidInput: "",
@ -385,11 +563,21 @@ export default {
padding: 12px; padding: 12px;
.filterBox { .filterBox {
position: relative; position: relative;
font-size: 12px;
.el-form-item__label {
font-size: 12px;
}
.el-input__inner {
font-size: 12px;
}
.el-form { .el-form {
display: flex; display: flex;
// align-items: center; // align-items: center;
// flex-wrap: wrap; // flex-wrap: wrap;
flex-direction: column; flex-direction: column;
.el-form-item {
margin-bottom: 8px;
}
.topSearch { .topSearch {
display: flex; display: flex;
} }
@ -407,11 +595,21 @@ export default {
} }
} }
} }
.ismntClass {
.el-select {
width: 100px;
}
}
.isonLineClass { .isonLineClass {
.el-select { .el-select {
width: 80px; width: 80px;
} }
} }
.gybox {
.el-select {
width: 160px;
}
}
.oidbox, .oidbox,
.cmdibox, .cmdibox,
.cmabox, .cmabox,

@ -22,11 +22,18 @@
placeholder="请输入设备ID查询" placeholder="请输入设备ID查询"
@change="leftInputChange" @change="leftInputChange"
></el-input> ></el-input>
<span class="mlspan">命令:{{ leftCommand.length }}</span>
<span class="time" <span class="time"
>更新时间{{ >更新时间{{
$moment(updateTime).format("YYYY-MM-DD HH:mm:ss") $moment(updateTime).format("YYYY-MM-DD HH:mm:ss")
}}</span }}</span
> >
<el-button
class="deletebtn"
type="danger"
icon="el-icon-delete"
@click="deleteml"
></el-button>
</div> </div>
<div <div
class="commandList" class="commandList"
@ -73,11 +80,18 @@
placeholder="请输入设备ID查询" placeholder="请输入设备ID查询"
@change="rightInputChange" @change="rightInputChange"
></el-input> ></el-input>
<span class="mlspan">命令:{{ rightCommand.length }}</span>
<span class="time" <span class="time"
>更新时间{{ >更新时间{{
$moment(updateTime).format("YYYY-MM-DD HH:mm:ss") $moment(updateTime).format("YYYY-MM-DD HH:mm:ss")
}}</span }}</span
> >
<el-button
class="deletebtn"
type="danger"
icon="el-icon-delete"
@click="deletehis"
></el-button>
</div> </div>
<div class="commandList" v-if="rightCommand.length != 0"> <div class="commandList" v-if="rightCommand.length != 0">
<p class="comLi" v-for="(item, index) in rightCommand" :key="index"> <p class="comLi" v-for="(item, index) in rightCommand" :key="index">
@ -191,7 +205,7 @@ export default {
methods: { methods: {
getCmdList() { getCmdList() {
//this.leftComLoading = true; //this.leftComLoading = true;
getqueryCmdsApi({ p: 1, ps: 200 }) getqueryCmdsApi({ p: 1, ps: 10000 })
.then((res) => { .then((res) => {
console.log(res); console.log(res);
this.runCommand = res.data; this.runCommand = res.data;
@ -241,7 +255,7 @@ export default {
// //
getEndList() { getEndList() {
getqueryCmdsApi({ qt: "his", p: 1, ps: 200 }) getqueryCmdsApi({ qt: "his", p: 1, ps: 10000 })
.then((res) => { .then((res) => {
console.log(res); console.log(res);
//this.endCommand = res.data; //this.endCommand = res.data;
@ -382,6 +396,62 @@ export default {
item.cmdid.includes(value) item.cmdid.includes(value)
); );
}, },
deleteml() {
getdoActionApi({
act: "clear",
})
.then((res) => {
console.log(res);
this.$confirm("确定清除所有命令?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$message({
duration: 1500,
showClose: true,
message: "命令已清除",
type: "success",
});
this.commandShow = false;
this.getCmdList();
this.getEndList();
})
.catch(() => {
this.commandShow = false;
});
})
.catch((err) => {});
},
deletehis() {
getdoActionApi({
act: "clearHis",
})
.then((res) => {
console.log(res);
this.$confirm("确定清除所有命令?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$message({
duration: 1500,
showClose: true,
message: "命令已清除",
type: "success",
});
this.getCmdList();
this.getEndList();
})
.catch(() => {});
})
.catch((err) => {});
},
}, },
beforeDestroy() { beforeDestroy() {
// //
@ -423,10 +493,18 @@ export default {
.cmdidClass { .cmdidClass {
width: 180px; width: 180px;
} }
.mlspan {
font-size: 14px;
margin-left: 8px;
}
.time { .time {
font-size: 12px; font-size: 12px;
margin-left: 8px; margin-left: 8px;
} }
.deletebtn {
margin-left: auto;
padding: 4px;
}
} }
.commandList { .commandList {
width: 100%; width: 100%;

@ -20,7 +20,7 @@ module.exports = defineConfig({
proxy: { proxy: {
"/api": { "/api": {
//表示拦截以/api开头的请求路径 //表示拦截以/api开头的请求路径
target: "http://180.166.218.222:40102/", // target: "http://180.166.218.222:40101/", //
changOrigin: true, //是否开启跨域 changOrigin: true, //是否开启跨域
pathRewrite: { pathRewrite: {
"^/api": "/api", //重写api把api变成空字符因为我们真正请求的路径是没有api的 "^/api": "/api", //重写api把api变成空字符因为我们真正请求的路径是没有api的

Loading…
Cancel
Save