From 42ce278c36c3ccf64c6969d899717ebd92e85a0c Mon Sep 17 00:00:00 2001
From: wu <2468489804@qq.com>
Date: Sat, 20 Aug 2022 14:34:31 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E9=99=A4=E6=9C=8D=E5=8A=A1=E8=B4=A6?=
=?UTF-8?q?=E5=8F=B7=E5=AF=86=E7=A0=81=E8=BE=93=E5=85=A5=E6=A1=86=EF=BC=8C?=
=?UTF-8?q?env=E6=96=87=E4=BB=B6=E9=85=8D=E7=BD=AE=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E5=AF=86=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env | 1 +
.../edgeServer/edgeServerConfigure/device.vue | 69 +++----------------
.../edgeServer/edgeServerConfigure/index.vue | 53 ++------------
.../edgeServer/edgeServerMonitor/index.vue | 62 ++---------------
4 files changed, 20 insertions(+), 165 deletions(-)
diff --git a/.env b/.env
index e560c2c..10e25a0 100644
--- a/.env
+++ b/.env
@@ -15,3 +15,4 @@ VUE_APP_I18N_FALLBACK_LOCALE=en
# element 颜色
VUE_APP_ELEMENT_COLOR=#409EFF
+VUE_APP_HSLSERVER_PASSWORD=123456
\ No newline at end of file
diff --git a/src/views/edgeServer/edgeServerConfigure/device.vue b/src/views/edgeServer/edgeServerConfigure/device.vue
index 1ac8de1..8623ae6 100644
--- a/src/views/edgeServer/edgeServerConfigure/device.vue
+++ b/src/views/edgeServer/edgeServerConfigure/device.vue
@@ -53,22 +53,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -299,19 +283,6 @@ export default {
'@RequestInterval': [{ required: true, message: '请输入采集周期(ms)', trigger: 'blur' }],
'@Length': [{ required: true, message: '请输入长度', trigger: 'blur' }]
},
- dialogFormVisible: false,
- userForm: {
- username: '',
- password: ''
- },
- userRules: {
- username: [
- { required: true, message: '请输入账号', trigger: 'blur' }
- ],
- password: [
- { required: true, message: '请输入密码', trigger: 'blur' }
- ]
- },
serverData: {},
devicePointData: [],
nodeCodeData: [],
@@ -400,7 +371,7 @@ export default {
async getCodesByWorkingSubclass (workingSubclass) {
try {
const nodeCode = await this.$api.QUERY_CODES(workingSubclass)
- const nodeCodeData = []
+ let nodeCodeData = []
each(nodeCode, (o) => {
nodeCodeData.push({ value: o, label: o })
}
@@ -417,7 +388,7 @@ export default {
async getworkingSubclasses () {
try {
const workingSubclasses = await this.$api.QUERY_WORKING_SUBCLASSES()
- const workingSubclassesData = []
+ let workingSubclassesData = []
each(workingSubclasses, (o) => {
workingSubclassesData.push({ value: o, label: o })
}
@@ -478,10 +449,7 @@ export default {
})
},
async delDevice () {
- // 校验是否已经有账号和密码
- const userInfo = this.getUserInfo()
-
- const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password)
+ let deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
let deviceNode = deviceConfigure.Content.Settings.GroupNode[0].DeviceNode
if (deviceNode !== undefined && isArray(deviceNode)) {
deviceNode = filter(deviceNode, item => {
@@ -493,7 +461,7 @@ export default {
}
try {
- await this.$api.SET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password, { data: deviceConfigure.Content })
+ await this.$api.SET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD, { data: deviceConfigure.Content })
await this.$api.DEL_DEVICE({ action: 'remove_device', id: this.deviceData[this.deviceActiveStatus].id })
this.$message({
message: '删除设备成功',
@@ -540,17 +508,7 @@ export default {
this.setDeviceConfigure()
done()
},
- setUserInfo () {
- this.$refs.userForm.validate((valid) => {
- if (valid) {
- sessionStorage.setItem(this.serverData.id, JSON.stringify(this.userForm))
- this.dialogFormVisible = false
- }
- })
- },
async setDeviceConfigure () {
- // 校验是否已经有账号和密码
- const userInfo = this.getUserInfo()
try {
// 验证表单
this.$refs.deviceConfigure.$refs.form.validate((valid) => {
@@ -558,8 +516,8 @@ export default {
return false
}
})
- const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password)
- const deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
+ let deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
+ let deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
if (this.devicePointData.length > 0) {
let devicePointData = this.devicePointData
devicePointData = each(devicePointData, (item) => {
@@ -590,7 +548,7 @@ export default {
deviceNode.push(deviceConfigureModelValue)
}
deviceConfigure.Content.Settings.GroupNode[0].DeviceNode = deviceNode
- await this.$api.SET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password, { data: deviceConfigure.Content })
+ await this.$api.SET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD, { data: deviceConfigure.Content })
deviceConfigureModelValue.DeviceTypeName = this.$refs.deviceConfigure.defaultDeviceTypeNameValue
const data = {
action: 'update_device',
@@ -607,17 +565,10 @@ export default {
console.log(e)
}
},
- getUserInfo () {
- const userInfo = sessionStorage.getItem(this.serverData.id)
- if (!userInfo) {
- this.dialogFormVisible = true
- return false
- }
- return JSON.parse(userInfo)
- },
+
async getDeviceStatus () {
- const userInfo = this.getUserInfo()
- const res = await this.$api.GET_SERVER_DEVICE_STATUS('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password)
+ console.log(process.env.VUE_APP_VUE_APP_HSLSERVER_PASSWORD)
+ const res = await this.$api.GET_SERVER_DEVICE_STATUS('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
if (res) {
this.$emit('changeStatus', 'online')
const deviceStatus = {}
diff --git a/src/views/edgeServer/edgeServerConfigure/index.vue b/src/views/edgeServer/edgeServerConfigure/index.vue
index a07ff8d..1a0cb92 100644
--- a/src/views/edgeServer/edgeServerConfigure/index.vue
+++ b/src/views/edgeServer/edgeServerConfigure/index.vue
@@ -39,20 +39,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -99,20 +86,6 @@ export default {
}
],
isDrawerShow: false,
- dialogFormVisible: false,
- form: {
- username: '',
- password: ''
- },
- rules: {
- username: [
- { required: true, message: '请输入账号', trigger: 'blur' }
- ],
- password: [
- { required: true, message: '请输入密码', trigger: 'blur' }
- ]
- },
- dialogFormServerId: 0,
server: {},
serveStatus: {
online: {
@@ -360,43 +333,25 @@ export default {
})
done()
},
-
async setServerExec ({ row }) {
- let userInfo = sessionStorage.getItem(row.id)
- this.dialogFormServerId = row.id
- if (!userInfo) {
- this.dialogFormVisible = true
- return false
- }
- userInfo = JSON.parse(userInfo)
-
try {
await this.$api.SET_SERVER_EXEC({
action: 'exec',
server_id: row.id,
command: 'server_restart',
- username: userInfo.username,
- password: userInfo.password
+ username: 'admin',
+ password: process.env.VUE_APP_HSLSERVER_PASSWORD
})
this.$message({
message: '服务应用请求成功,请求动作已添加至请求队列中,请从服务监控页面查看结果',
type: 'success'
})
- this.dialogFormServerId = 0
this.getServers()
- this.dialogFormVisible = false
} catch (e) {
console.log(e)
}
},
- handleDialogFormVisible () {
- this.$refs.form.validate((valid) => {
- if (valid) {
- sessionStorage.setItem(this.dialogFormServerId, JSON.stringify(this.form))
- this.dialogFormVisible = false
- }
- })
- },
+
handleDialogCancel (done) {
this.$message({
message: '用户放弃改动',
diff --git a/src/views/edgeServer/edgeServerMonitor/index.vue b/src/views/edgeServer/edgeServerMonitor/index.vue
index 9a3a7c1..a6d20ab 100644
--- a/src/views/edgeServer/edgeServerMonitor/index.vue
+++ b/src/views/edgeServer/edgeServerMonitor/index.vue
@@ -8,7 +8,7 @@
- setServerExec(i, index, item)"
+ setDeviceExec(i, index, item)"
:style="{ 'borderRight': 'none' }">
暂停
@@ -72,22 +72,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-