diff --git a/src/utils/api/index.js b/src/utils/api/index.js index a70650de..b37aef6f 100644 --- a/src/utils/api/index.js +++ b/src/utils/api/index.js @@ -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 //获取所有列表 export function ieddlServerApi(data) { diff --git a/src/views/iceserver/index.vue b/src/views/iceserver/index.vue index 9eb04032..5ba45573 100644 --- a/src/views/iceserver/index.vue +++ b/src/views/iceserver/index.vue @@ -3,32 +3,44 @@
IEC服务器状态
-

filename:{{ item.filename }}

-

端口:{{ item.port }}

+

+ filename:{{ + item.filename + }} +

+

+ 端口: +

服务器状态: - 开启 + 开启 关闭

+
@@ -97,34 +109,38 @@ export default { components: {}, data() { return { - port: "", - filename: "", //文件名 - serverStatus: false, - serverVal: true, - fileNameVal: "", icdFileOptions: [], - serveLoading: false, + serveLoading: null, ledList: [], ledLoading: false, + localStartStates: "", }; }, mounted() { - this.geticeStatus(); //获取iedName列表 - this.getIcdListFile(); - this.getLedList(); //获取LedList列表 + this.$nextTick(() => { + this.getIcdListFile(); + this.getLedList(); //获取LedList列表 + }); }, methods: { - //获取ice服务器状态 - geticeStatus() { - serverstatusApi() + //获取左侧服务器列表 + getIcdListFile() { + ieclistFileApi() .then((res) => { if (res.success) { - console.log(res); - this.port = res.data.port; - this.serverStatus = res.data.started; - this.serverVal = res.data.started; - this.filename = res.data.filename; - this.fileNameVal = res.data.fileId; + this.icdFileOptions = res.data; + this.icdFileOptions = res.data.map((item) => { + // 检查 port 是否为 null,如果是则设置为 102 + if (item.port === null) { + item.port = 102; + } + return item; + }); + this.localStartStates = this.icdFileOptions.map((item) => + item.start == "1" ? 1 : 0 + ); + console.log(this.localStartStates); + console.log("我是res", res); } else { this.$message({ duration: 1500, @@ -138,12 +154,16 @@ export default { console.log(err); //代码错误、请求失败捕获 }); }, - changeStatus() { - console.log(this.serverVal); - this.serveLoading = true; - if (this.serverVal) { + + changeStatus(item, index) { + this.serveLoading = index; // 设置当前项为加载状态 + console.log(item); // 此时 item.port 应该是已经处理过的值(102 或其他用户输入的值) + const port = item.port; // 获取当前 item 的 port 值 + + if (item.start == 0) { serverstartApi({ - fileId: this.fileNameVal, + fileId: item.id, + port: port, }) .then((res) => { if (res.success) { @@ -154,8 +174,8 @@ export default { message: "服务器开始成功", type: "success", }); - this.geticeStatus(); - this.serveLoading = false; + this.getIcdListFile(); + this.serveLoading = -1; } else { this.$message({ duration: 1500, @@ -163,22 +183,22 @@ export default { message: res.errorMsg, type: "error", }); - this.geticeStatus(); - this.serveLoading = false; + this.getIcdListFile(); + this.serveLoading = -1; } }) .catch((err) => { console.log(err); //代码错误、请求失败捕获 }); } else { - serverstopApi() + serverstopApi({ fileId: item.id }) .then((res) => { if (res.success) { console.log(res); - this.serveLoading = false; - this.geticeStatus(); + this.serveLoading = -1; + this.getIcdListFile(); } else { - this.serveLoading = false; + this.serveLoading = -1; this.$message({ duration: 1500, 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列表 getLedList() { listIedConfigApi() @@ -305,7 +303,7 @@ export default { .left { display: flex; flex-wrap: wrap; - justify-content: space-around; + //justify-content: space-around; align-content: flex-start; //加这个属性就能解决 height: 100%; overflow: auto; @@ -313,7 +311,8 @@ export default { .cardBox { width: 280px; margin-top: 20px; - height: 184px; + //height: 184px; + margin-right: 16px; .el-card__header { padding: 12px; } @@ -331,11 +330,22 @@ export default { } } p { + display: flex; + align-items: center; + .filename { + width: 180px; + overflow: hidden; /*超出部分隐藏*/ + text-overflow: ellipsis; /*超出部分省略号表示*/ + white-space: nowrap; /*强制单行显示*/ + } + .el-input { + width: 120px; + } &:nth-child(2) { margin-top: 12px; margin-bottom: 12px; } - &:nth-child(4) { + &:nth-child(3) { // margin-top: 12px; margin-bottom: 12px; } diff --git a/src/views/serverIcd/index.vue b/src/views/serverIcd/index.vue index deb9539d..7c9c0c19 100644 --- a/src/views/serverIcd/index.vue +++ b/src/views/serverIcd/index.vue @@ -45,6 +45,17 @@ 未启用 + + +
@@ -54,7 +65,7 @@