清除服务账号密码输入框,env文件配置服务密码

This commit is contained in:
wu
2022-08-20 14:34:31 +08:00
parent ede4c9160d
commit 42ce278c36
4 changed files with 20 additions and 165 deletions

View File

@@ -8,7 +8,7 @@
<el-row :gutter="12">
<el-col :span="6" v-for="(i, k) in item.devices" :key="k">
<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' }">
<el-menu-item index="device_stop">
<span slot="title">暂停</span>
@@ -72,22 +72,6 @@
</el-row>
</el-card>
</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>
</template>
<script>
@@ -96,19 +80,6 @@ import { unset, map } from 'lodash'
export default {
data () {
return {
dialogFormVisible: false,
form: {
username: '',
password: ''
},
rules: {
username: [
{ required: true, message: '请输入账号', trigger: 'blur' }
],
password: [
{ required: true, message: '请输入密码', trigger: 'blur' }
]
},
serverData: [],
deviceData: [],
deviceCommand: {}
@@ -116,43 +87,20 @@ export default {
},
methods: {
setUserInfo () {
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)
async setDeviceExec (device, command, server) {
try {
await this.$api.SET_SERVER_EXEC({
action: 'exec',
server_id: server.id,
command: command,
device_name: device.device_name,
username: userInfo.username,
password: userInfo.password
username: 'admin',
password: process.env.VUE_APP_HSLSERVER_PASSWORD
})
this.$message({
message: '请求成功,请求动作已添加至请求队列中',
type: 'success'
})
this.dialogFormVisible = false
this.getServe()
} catch (e) {
console.log(e)
@@ -161,7 +109,7 @@ export default {
async getServe () {
this.serverData = await this.$api.QUERY_SERVERS()
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) {
const data = deviceStatus.Content
unset(data, '__status')