清除服务账号密码输入框,env文件配置服务密码
This commit is contained in:
1
.env
1
.env
@@ -15,3 +15,4 @@ VUE_APP_I18N_FALLBACK_LOCALE=en
|
|||||||
|
|
||||||
# element 颜色
|
# element 颜色
|
||||||
VUE_APP_ELEMENT_COLOR=#409EFF
|
VUE_APP_ELEMENT_COLOR=#409EFF
|
||||||
|
VUE_APP_HSLSERVER_PASSWORD=123456
|
||||||
@@ -53,22 +53,6 @@
|
|||||||
</d2-crud>
|
</d2-crud>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-main>
|
</el-main>
|
||||||
|
|
||||||
<el-dialog title="服务账号登录" :visible.sync="dialogFormVisible" :modal="false">
|
|
||||||
<el-alert title="请先输入该服务的账号密码,再进行后续操作" type="warning" style="width:400px;display: inline-block;vertical-align: middle; margin-left: 5px;" :closable="false" />
|
|
||||||
<el-form :model="userForm" :rules="userRules" ref="userForm">
|
|
||||||
<el-form-item label="账号" prop="username">
|
|
||||||
<el-input v-model="userForm.username"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="密码" prop="password">
|
|
||||||
<el-input type="password" v-model="userForm.password"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
|
|
||||||
<el-button type="primary" @click="setUserInfo">确 定</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -299,19 +283,6 @@ export default {
|
|||||||
'@RequestInterval': [{ required: true, message: '请输入采集周期(ms)', trigger: 'blur' }],
|
'@RequestInterval': [{ required: true, message: '请输入采集周期(ms)', trigger: 'blur' }],
|
||||||
'@Length': [{ required: true, message: '请输入长度', 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: {},
|
serverData: {},
|
||||||
devicePointData: [],
|
devicePointData: [],
|
||||||
nodeCodeData: [],
|
nodeCodeData: [],
|
||||||
@@ -400,7 +371,7 @@ export default {
|
|||||||
async getCodesByWorkingSubclass (workingSubclass) {
|
async getCodesByWorkingSubclass (workingSubclass) {
|
||||||
try {
|
try {
|
||||||
const nodeCode = await this.$api.QUERY_CODES(workingSubclass)
|
const nodeCode = await this.$api.QUERY_CODES(workingSubclass)
|
||||||
const nodeCodeData = []
|
let nodeCodeData = []
|
||||||
each(nodeCode, (o) => {
|
each(nodeCode, (o) => {
|
||||||
nodeCodeData.push({ value: o, label: o })
|
nodeCodeData.push({ value: o, label: o })
|
||||||
}
|
}
|
||||||
@@ -417,7 +388,7 @@ export default {
|
|||||||
async getworkingSubclasses () {
|
async getworkingSubclasses () {
|
||||||
try {
|
try {
|
||||||
const workingSubclasses = await this.$api.QUERY_WORKING_SUBCLASSES()
|
const workingSubclasses = await this.$api.QUERY_WORKING_SUBCLASSES()
|
||||||
const workingSubclassesData = []
|
let workingSubclassesData = []
|
||||||
each(workingSubclasses, (o) => {
|
each(workingSubclasses, (o) => {
|
||||||
workingSubclassesData.push({ value: o, label: o })
|
workingSubclassesData.push({ value: o, label: o })
|
||||||
}
|
}
|
||||||
@@ -478,10 +449,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async delDevice () {
|
async delDevice () {
|
||||||
// 校验是否已经有账号和密码
|
let deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD)
|
||||||
const userInfo = this.getUserInfo()
|
|
||||||
|
|
||||||
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE('http://' + this.serverData.url + ':' + this.serverData.port, userInfo.username, userInfo.password)
|
|
||||||
let deviceNode = deviceConfigure.Content.Settings.GroupNode[0].DeviceNode
|
let deviceNode = deviceConfigure.Content.Settings.GroupNode[0].DeviceNode
|
||||||
if (deviceNode !== undefined && isArray(deviceNode)) {
|
if (deviceNode !== undefined && isArray(deviceNode)) {
|
||||||
deviceNode = filter(deviceNode, item => {
|
deviceNode = filter(deviceNode, item => {
|
||||||
@@ -493,7 +461,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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 })
|
await this.$api.DEL_DEVICE({ action: 'remove_device', id: this.deviceData[this.deviceActiveStatus].id })
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '删除设备成功',
|
message: '删除设备成功',
|
||||||
@@ -540,17 +508,7 @@ export default {
|
|||||||
this.setDeviceConfigure()
|
this.setDeviceConfigure()
|
||||||
done()
|
done()
|
||||||
},
|
},
|
||||||
setUserInfo () {
|
|
||||||
this.$refs.userForm.validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
sessionStorage.setItem(this.serverData.id, JSON.stringify(this.userForm))
|
|
||||||
this.dialogFormVisible = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async setDeviceConfigure () {
|
async setDeviceConfigure () {
|
||||||
// 校验是否已经有账号和密码
|
|
||||||
const userInfo = this.getUserInfo()
|
|
||||||
try {
|
try {
|
||||||
// 验证表单
|
// 验证表单
|
||||||
this.$refs.deviceConfigure.$refs.form.validate((valid) => {
|
this.$refs.deviceConfigure.$refs.form.validate((valid) => {
|
||||||
@@ -558,8 +516,8 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
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)
|
||||||
const deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
|
let deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
|
||||||
if (this.devicePointData.length > 0) {
|
if (this.devicePointData.length > 0) {
|
||||||
let devicePointData = this.devicePointData
|
let devicePointData = this.devicePointData
|
||||||
devicePointData = each(devicePointData, (item) => {
|
devicePointData = each(devicePointData, (item) => {
|
||||||
@@ -590,7 +548,7 @@ export default {
|
|||||||
deviceNode.push(deviceConfigureModelValue)
|
deviceNode.push(deviceConfigureModelValue)
|
||||||
}
|
}
|
||||||
deviceConfigure.Content.Settings.GroupNode[0].DeviceNode = deviceNode
|
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
|
deviceConfigureModelValue.DeviceTypeName = this.$refs.deviceConfigure.defaultDeviceTypeNameValue
|
||||||
const data = {
|
const data = {
|
||||||
action: 'update_device',
|
action: 'update_device',
|
||||||
@@ -607,17 +565,10 @@ export default {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getUserInfo () {
|
|
||||||
const userInfo = sessionStorage.getItem(this.serverData.id)
|
|
||||||
if (!userInfo) {
|
|
||||||
this.dialogFormVisible = true
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return JSON.parse(userInfo)
|
|
||||||
},
|
|
||||||
async getDeviceStatus () {
|
async getDeviceStatus () {
|
||||||
const userInfo = this.getUserInfo()
|
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, userInfo.username, userInfo.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) {
|
if (res) {
|
||||||
this.$emit('changeStatus', 'online')
|
this.$emit('changeStatus', 'online')
|
||||||
const deviceStatus = {}
|
const deviceStatus = {}
|
||||||
|
|||||||
@@ -39,20 +39,7 @@
|
|||||||
<device :server='server' @changeStatus='changeSelectedServerStatus' @changeServerConfig='changeSelectedServerConfig' />
|
<device :server='server' @changeStatus='changeSelectedServerStatus' @changeServerConfig='changeSelectedServerConfig' />
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
<el-dialog title="服务账号登录" :visible.sync="dialogFormVisible">
|
|
||||||
<el-alert title="请先输入该服务的账号密码,再进行后续操作" type="warning" style="width:400px;display: inline-block;vertical-align: middle; margin-left: 5px;" :closable="false" />
|
|
||||||
<el-form :model="form" :rules="rules" ref="form">
|
|
||||||
<el-form-item label="账号" prop="username">
|
|
||||||
<el-input v-model="form.username" ></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="密码" prop="password">
|
|
||||||
<el-input type="password" v-model="form.password" ></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="handleDialogFormVisible">确 定</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
</d2-container>
|
</d2-container>
|
||||||
</template>
|
</template>
|
||||||
@@ -99,20 +86,6 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
isDrawerShow: false,
|
isDrawerShow: false,
|
||||||
dialogFormVisible: false,
|
|
||||||
form: {
|
|
||||||
username: '',
|
|
||||||
password: ''
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
username: [
|
|
||||||
{ required: true, message: '请输入账号', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
password: [
|
|
||||||
{ required: true, message: '请输入密码', trigger: 'blur' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
dialogFormServerId: 0,
|
|
||||||
server: {},
|
server: {},
|
||||||
serveStatus: {
|
serveStatus: {
|
||||||
online: {
|
online: {
|
||||||
@@ -360,43 +333,25 @@ export default {
|
|||||||
})
|
})
|
||||||
done()
|
done()
|
||||||
},
|
},
|
||||||
|
|
||||||
async setServerExec ({ row }) {
|
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 {
|
try {
|
||||||
await this.$api.SET_SERVER_EXEC({
|
await this.$api.SET_SERVER_EXEC({
|
||||||
action: 'exec',
|
action: 'exec',
|
||||||
server_id: row.id,
|
server_id: row.id,
|
||||||
command: 'server_restart',
|
command: 'server_restart',
|
||||||
username: userInfo.username,
|
username: 'admin',
|
||||||
password: userInfo.password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
})
|
})
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '服务应用请求成功,请求动作已添加至请求队列中,请从服务监控页面查看结果',
|
message: '服务应用请求成功,请求动作已添加至请求队列中,请从服务监控页面查看结果',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
this.dialogFormServerId = 0
|
|
||||||
this.getServers()
|
this.getServers()
|
||||||
this.dialogFormVisible = false
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(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) {
|
handleDialogCancel (done) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '用户放弃改动',
|
message: '用户放弃改动',
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<el-row :gutter="12">
|
<el-row :gutter="12">
|
||||||
<el-col :span="6" v-for="(i, k) in item.devices" :key="k">
|
<el-col :span="6" v-for="(i, k) in item.devices" :key="k">
|
||||||
<el-popover placement="top" trigger="click">
|
<el-popover placement="top" trigger="click">
|
||||||
<el-menu @select="(index) => setServerExec(i, index, item)"
|
<el-menu @select="(index) => setDeviceExec(i, index, item)"
|
||||||
:style="{ 'borderRight': 'none' }">
|
:style="{ 'borderRight': 'none' }">
|
||||||
<el-menu-item index="device_stop">
|
<el-menu-item index="device_stop">
|
||||||
<span slot="title">暂停</span>
|
<span slot="title">暂停</span>
|
||||||
@@ -72,22 +72,6 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog title="服务账号登录" :visible.sync="dialogFormVisible">
|
|
||||||
<el-alert title="请先输入该服务的账号密码,再进行后续操作" type="warning" :closable="false" />
|
|
||||||
<el-form :model="form" :rules="rules" ref="form">
|
|
||||||
<el-form-item label="账号" prop="username">
|
|
||||||
<el-input v-model="form.username"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="密码" prop="password">
|
|
||||||
<el-input type="password" v-model="form.password"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
|
|
||||||
<el-button type="primary" @click="setUserInfo">确 定</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</d2-container>
|
</d2-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -96,19 +80,6 @@ import { unset, map } from 'lodash'
|
|||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
dialogFormVisible: false,
|
|
||||||
form: {
|
|
||||||
username: '',
|
|
||||||
password: ''
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
username: [
|
|
||||||
{ required: true, message: '请输入账号', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
password: [
|
|
||||||
{ required: true, message: '请输入密码', trigger: 'blur' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
serverData: [],
|
serverData: [],
|
||||||
deviceData: [],
|
deviceData: [],
|
||||||
deviceCommand: {}
|
deviceCommand: {}
|
||||||
@@ -116,43 +87,20 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
setUserInfo () {
|
async setDeviceExec (device, command, server) {
|
||||||
this.$refs.form.validate(async (valid) => {
|
|
||||||
if (valid) {
|
|
||||||
sessionStorage.setItem(this.deviceCommand.serverId, JSON.stringify(this.form))
|
|
||||||
this.form = {
|
|
||||||
username: '',
|
|
||||||
password: ''
|
|
||||||
}
|
|
||||||
this.dialogFormVisible = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async setServerExec (device, command, server) {
|
|
||||||
let userInfo = sessionStorage.getItem(server.id)
|
|
||||||
if (!userInfo) {
|
|
||||||
this.deviceCommand = {
|
|
||||||
serverId: server.id
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dialogFormVisible = true
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
userInfo = JSON.parse(userInfo)
|
|
||||||
try {
|
try {
|
||||||
await this.$api.SET_SERVER_EXEC({
|
await this.$api.SET_SERVER_EXEC({
|
||||||
action: 'exec',
|
action: 'exec',
|
||||||
server_id: server.id,
|
server_id: server.id,
|
||||||
command: command,
|
command: command,
|
||||||
device_name: device.device_name,
|
device_name: device.device_name,
|
||||||
username: userInfo.username,
|
username: 'admin',
|
||||||
password: userInfo.password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
})
|
})
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请求成功,请求动作已添加至请求队列中',
|
message: '请求成功,请求动作已添加至请求队列中',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
this.dialogFormVisible = false
|
|
||||||
this.getServe()
|
this.getServe()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
@@ -161,7 +109,7 @@ export default {
|
|||||||
async getServe () {
|
async getServe () {
|
||||||
this.serverData = await this.$api.QUERY_SERVERS()
|
this.serverData = await this.$api.QUERY_SERVERS()
|
||||||
this.serverData.forEach((element, index) => {
|
this.serverData.forEach((element, index) => {
|
||||||
this.$api.GET_SERVE_DEVICE_MONITORING('http://' + element.url + ':' + element.port, 'admin', '123456').then((deviceStatus) => {
|
this.$api.GET_SERVE_DEVICE_MONITORING('http://' + element.url + ':' + element.port, 'admin', process.env.VUE_APP_HSLSERVER_PASSWORD).then((deviceStatus) => {
|
||||||
if (deviceStatus.IsSuccess) {
|
if (deviceStatus.IsSuccess) {
|
||||||
const data = deviceStatus.Content
|
const data = deviceStatus.Content
|
||||||
unset(data, '__status')
|
unset(data, '__status')
|
||||||
|
|||||||
Reference in New Issue
Block a user