控制台修改

newCac1.0
fanluyan 8 months ago
parent b527c0f6b7
commit bc0948da9e

@ -1077,6 +1077,18 @@ export function clearTransformApi(data) {
}); });
} }
/// /iecserver/delete 删除
export function serverDeleteApi(data) {
return request({
url: "/iecserver/delete",
method: "post",
params: data,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
},
});
}
//61850下载文件相关接口 Ied Dl Controller //61850下载文件相关接口 Ied Dl Controller
//获取所有列表 //获取所有列表
export function ieddlServerApi(data) { export function ieddlServerApi(data) {

@ -3,32 +3,44 @@
<div class="left"> <div class="left">
<div <div
class="cardBox" class="cardBox"
v-loading="serveLoading" v-for="(item, index) in icdFileOptions"
:key="item.id"
v-loading="serveLoading === index"
element-loading-text="请稍等" element-loading-text="请稍等"
element-loading-spinner="el-icon-loading" element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.7)" element-loading-background="rgba(0, 0, 0, 0.7)"
v-for="item in icdFileOptions"
:key="item.id"
> >
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span> IEC服务器状态</span> <span> IEC服务器状态</span>
</div> </div>
<div class="concard"> <div class="concard">
<p>filename{{ item.filename }}</p> <p>
<p>端口{{ item.port }}</p> filename<span class="filename" :title="item.filename">{{
item.filename
}}</span>
</p>
<p>
端口<el-input
v-model="item.port"
placeholder="请输入内容"
></el-input>
</p>
<p> <p>
服务器状态 服务器状态
<el-tag type="success" v-if="serverStatus"></el-tag> <el-tag type="success" v-if="item.start == 1"></el-tag>
<el-tag type="danger" v-else></el-tag> <el-tag type="danger" v-else></el-tag>
</p> </p>
<el-switch <el-switch
v-model="serverVal" v-model="localStartStates[index]"
:active-value="1"
:inactive-value="0"
active-text="服务器开启" active-text="服务器开启"
inactive-text="服务器关闭" inactive-text="服务器关闭"
active-color="#13ce66" active-color="#13ce66"
inactive-color="#ff4949" inactive-color="#ff4949"
@change="changeStatus" @change="changeStatus(item, index)"
> >
</el-switch> </el-switch>
</div> </div>
@ -97,34 +109,38 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
port: "",
filename: "", //
serverStatus: false,
serverVal: true,
fileNameVal: "",
icdFileOptions: [], icdFileOptions: [],
serveLoading: false, serveLoading: null,
ledList: [], ledList: [],
ledLoading: false, ledLoading: false,
localStartStates: "",
}; };
}, },
mounted() { mounted() {
this.geticeStatus(); //iedName this.$nextTick(() => {
this.getIcdListFile(); this.getIcdListFile();
this.getLedList(); //LedList this.getLedList(); //LedList
});
}, },
methods: { methods: {
//ice //
geticeStatus() { getIcdListFile() {
serverstatusApi() ieclistFileApi()
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
console.log(res); this.icdFileOptions = res.data;
this.port = res.data.port; this.icdFileOptions = res.data.map((item) => {
this.serverStatus = res.data.started; // port null 102
this.serverVal = res.data.started; if (item.port === null) {
this.filename = res.data.filename; item.port = 102;
this.fileNameVal = res.data.fileId; }
return item;
});
this.localStartStates = this.icdFileOptions.map((item) =>
item.start == "1" ? 1 : 0
);
console.log(this.localStartStates);
console.log("我是res", res);
} else { } else {
this.$message({ this.$message({
duration: 1500, duration: 1500,
@ -138,12 +154,16 @@ export default {
console.log(err); // console.log(err); //
}); });
}, },
changeStatus() {
console.log(this.serverVal); changeStatus(item, index) {
this.serveLoading = true; this.serveLoading = index; //
if (this.serverVal) { console.log(item); // item.port 102
const port = item.port; // item port
if (item.start == 0) {
serverstartApi({ serverstartApi({
fileId: this.fileNameVal, fileId: item.id,
port: port,
}) })
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
@ -154,8 +174,8 @@ export default {
message: "服务器开始成功", message: "服务器开始成功",
type: "success", type: "success",
}); });
this.geticeStatus(); this.getIcdListFile();
this.serveLoading = false; this.serveLoading = -1;
} else { } else {
this.$message({ this.$message({
duration: 1500, duration: 1500,
@ -163,22 +183,22 @@ export default {
message: res.errorMsg, message: res.errorMsg,
type: "error", type: "error",
}); });
this.geticeStatus(); this.getIcdListFile();
this.serveLoading = false; this.serveLoading = -1;
} }
}) })
.catch((err) => { .catch((err) => {
console.log(err); // console.log(err); //
}); });
} else { } else {
serverstopApi() serverstopApi({ fileId: item.id })
.then((res) => { .then((res) => {
if (res.success) { if (res.success) {
console.log(res); console.log(res);
this.serveLoading = false; this.serveLoading = -1;
this.geticeStatus(); this.getIcdListFile();
} else { } else {
this.serveLoading = false; this.serveLoading = -1;
this.$message({ this.$message({
duration: 1500, duration: 1500,
showClose: true, showClose: true,
@ -192,29 +212,7 @@ export default {
}); });
} }
}, },
getIcdListFile() { //
ieclistFileApi()
.then((res) => {
if (res.success) {
console.log(res);
this.icdFileOptions = res.data;
if (this.filename == null) {
this.fileNameVal = this.icdFileOptions[0].id;
}
} else {
this.$message({
duration: 1500,
showClose: true,
message: res.errorMsg,
type: "error",
});
}
})
.catch((err) => {
console.log(err); //
});
},
//ledList //ledList
getLedList() { getLedList() {
listIedConfigApi() listIedConfigApi()
@ -305,7 +303,7 @@ export default {
.left { .left {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-around; //justify-content: space-around;
align-content: flex-start; // align-content: flex-start; //
height: 100%; height: 100%;
overflow: auto; overflow: auto;
@ -313,7 +311,8 @@ export default {
.cardBox { .cardBox {
width: 280px; width: 280px;
margin-top: 20px; margin-top: 20px;
height: 184px; //height: 184px;
margin-right: 16px;
.el-card__header { .el-card__header {
padding: 12px; padding: 12px;
} }
@ -331,11 +330,22 @@ export default {
} }
} }
p { p {
display: flex;
align-items: center;
.filename {
width: 180px;
overflow: hidden; /*超出部分隐藏*/
text-overflow: ellipsis; /*超出部分省略号表示*/
white-space: nowrap; /*强制单行显示*/
}
.el-input {
width: 120px;
}
&:nth-child(2) { &:nth-child(2) {
margin-top: 12px; margin-top: 12px;
margin-bottom: 12px; margin-bottom: 12px;
} }
&:nth-child(4) { &:nth-child(3) {
// margin-top: 12px; // margin-top: 12px;
margin-bottom: 12px; margin-bottom: 12px;
} }

@ -45,6 +45,17 @@
<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="操作" class-name="editClass">
<template slot-scope="scope">
<el-link
type="danger"
@click="deleteServer(scope.row)"
size="small"
icon="el-icon-delete"
>删除</el-link
>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
<div class="icdTableBox" v-else> <div class="icdTableBox" v-else>
@ -54,7 +65,7 @@
</div> </div>
</template> </template>
<script> <script>
import { ieclistFileApi } from "@/utils/api/index"; import { ieclistFileApi, serverDeleteApi } from "@/utils/api/index";
export default { export default {
components: {}, components: {},
@ -113,6 +124,26 @@ export default {
console.log(err); // console.log(err); //
}); });
}, },
//
deleteServer(row) {
serverDeleteApi({ fileId: row.id })
.then((res) => {
if (res.success) {
console.log(res);
this.geticdList();
} else {
this.$message({
duration: 1500,
showClose: true,
type: "error",
message: res.errorMsg,
});
}
})
.catch((err) => {
console.log(err); //
});
},
}, },
}; };
</script> </script>

Loading…
Cancel
Save