清除服务账号密码输入框,env文件配置服务密码
This commit is contained in:
@@ -53,22 +53,6 @@
|
||||
</d2-crud>
|
||||
</el-card>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
@@ -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 = {}
|
||||
|
||||
Reference in New Issue
Block a user