请求HslServer接口的用户名密码统一写入在api文件
This commit is contained in:
@@ -5,22 +5,22 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
|||||||
* @description 方法名称
|
* @description 方法名称
|
||||||
* @param {Object} data 请求携带的信息
|
* @param {Object} data 请求携带的信息
|
||||||
*/
|
*/
|
||||||
VERIFY_SERVER (url, username, password) {
|
VERIFY_SERVER (url) {
|
||||||
return request({
|
return request({
|
||||||
auth: {
|
auth: {
|
||||||
username: username,
|
username: 'admin',
|
||||||
password: password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
},
|
},
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: url + '/Admin/ServerSettingsRequest'
|
url: url + '/Admin/ServerSettingsRequest'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
MODIFY_SERVER (url, username, password, data) {
|
MODIFY_SERVER (url, data) {
|
||||||
return request({
|
return request({
|
||||||
auth: {
|
auth: {
|
||||||
username: username,
|
username: 'admin',
|
||||||
password: password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
},
|
},
|
||||||
data: data,
|
data: data,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -47,21 +47,21 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
|||||||
},
|
},
|
||||||
ADD_DEVICE: (data) => handlePost(request, data),
|
ADD_DEVICE: (data) => handlePost(request, data),
|
||||||
DEL_DEVICE: (data) => handlePost(request, data),
|
DEL_DEVICE: (data) => handlePost(request, data),
|
||||||
GET_HSLSERVER_CONFIGURE (url, username, password) {
|
GET_HSLSERVER_CONFIGURE (url) {
|
||||||
return request({
|
return request({
|
||||||
auth: {
|
auth: {
|
||||||
username: username,
|
username: 'admin',
|
||||||
password: password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
},
|
},
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: url + '/Admin/JsonSettingsRequest'
|
url: url + '/Admin/JsonSettingsRequest'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
SET_HSLSERVER_CONFIGURE (url, username, password, data) {
|
SET_HSLSERVER_CONFIGURE (url, data) {
|
||||||
return request({
|
return request({
|
||||||
auth: {
|
auth: {
|
||||||
username: username,
|
username: 'admin',
|
||||||
password: password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
},
|
},
|
||||||
data: data,
|
data: data,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -72,11 +72,11 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
|||||||
GET_DEVICE_CONFIGURE (id) {
|
GET_DEVICE_CONFIGURE (id) {
|
||||||
return request({ url: '?query=device&id=' + id })
|
return request({ url: '?query=device&id=' + id })
|
||||||
},
|
},
|
||||||
GET_SERVE_DEVICE_MONITORING (url, username, password) {
|
GET_SERVE_DEVICE_MONITORING (url) {
|
||||||
return request({
|
return request({
|
||||||
auth: {
|
auth: {
|
||||||
username: username,
|
username: 'admin',
|
||||||
password: password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
},
|
},
|
||||||
url: url + '/Edge/DeviceData?data=/'
|
url: url + '/Edge/DeviceData?data=/'
|
||||||
})
|
})
|
||||||
@@ -85,20 +85,20 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
|||||||
return request({ url: '?query=all_devices' })
|
return request({ url: '?query=all_devices' })
|
||||||
},
|
},
|
||||||
SET_SERVER_EXEC: (data) => handlePost(request, data),
|
SET_SERVER_EXEC: (data) => handlePost(request, data),
|
||||||
GET_SERVER_DEVICE_STATUS (url, username, password) {
|
GET_SERVER_DEVICE_STATUS (url) {
|
||||||
return request({
|
return request({
|
||||||
auth: {
|
auth: {
|
||||||
username: username,
|
username: 'admin',
|
||||||
password: password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
},
|
},
|
||||||
url: url + '/Edge/DeviceData?data=__status'
|
url: url + '/Edge/DeviceData?data=__status'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
GET_DEVICE_POINT_VALUE(url, username, password, deviceName, data, type){
|
GET_DEVICE_POINT_VALUE(url, deviceName, data, type){
|
||||||
return request({
|
return request({
|
||||||
auth: {
|
auth: {
|
||||||
username: username,
|
username: 'admin',
|
||||||
password: password
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
'address':data
|
'address':data
|
||||||
|
|||||||
@@ -641,8 +641,6 @@ export default {
|
|||||||
async delDevice() {
|
async delDevice() {
|
||||||
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE(
|
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE(
|
||||||
"http://" + this.serverData.url + ":" + this.serverData.port,
|
"http://" + this.serverData.url + ":" + this.serverData.port,
|
||||||
"admin",
|
|
||||||
process.env.VUE_APP_HSLSERVER_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)) {
|
||||||
@@ -659,8 +657,6 @@ export default {
|
|||||||
try {
|
try {
|
||||||
await this.$api.SET_HSLSERVER_CONFIGURE(
|
await this.$api.SET_HSLSERVER_CONFIGURE(
|
||||||
"http://" + this.serverData.url + ":" + this.serverData.port,
|
"http://" + this.serverData.url + ":" + this.serverData.port,
|
||||||
"admin",
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD,
|
|
||||||
{ data: deviceConfigure.Content }
|
{ data: deviceConfigure.Content }
|
||||||
);
|
);
|
||||||
await this.$api.DEL_DEVICE({
|
await this.$api.DEL_DEVICE({
|
||||||
@@ -717,8 +713,6 @@ export default {
|
|||||||
this.$api
|
this.$api
|
||||||
.GET_DEVICE_POINT_VALUE(
|
.GET_DEVICE_POINT_VALUE(
|
||||||
"http://" + this.serverData.url + ":" + this.serverData.port,
|
"http://" + this.serverData.url + ":" + this.serverData.port,
|
||||||
"admin",
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD,
|
|
||||||
this.deviceData[this.deviceActiveStatus].name,
|
this.deviceData[this.deviceActiveStatus].name,
|
||||||
item.value,
|
item.value,
|
||||||
item.type
|
item.type
|
||||||
@@ -749,9 +743,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE(
|
const deviceConfigure = await this.$api.GET_HSLSERVER_CONFIGURE(
|
||||||
"http://" + this.serverData.url + ":" + this.serverData.port,
|
"http://" + this.serverData.url + ":" + this.serverData.port
|
||||||
"admin",
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD
|
|
||||||
);
|
);
|
||||||
const deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
|
const deviceConfigureModelValue = this.$refs.deviceConfigure.deviceConfigureModelValue
|
||||||
if (this.devicePointData.length > 0) {
|
if (this.devicePointData.length > 0) {
|
||||||
@@ -792,8 +784,6 @@ export default {
|
|||||||
deviceConfigure.Content.Settings.GroupNode[0].DeviceNode = deviceNode;
|
deviceConfigure.Content.Settings.GroupNode[0].DeviceNode = deviceNode;
|
||||||
await this.$api.SET_HSLSERVER_CONFIGURE(
|
await this.$api.SET_HSLSERVER_CONFIGURE(
|
||||||
"http://" + this.serverData.url + ":" + this.serverData.port,
|
"http://" + this.serverData.url + ":" + this.serverData.port,
|
||||||
"admin",
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD,
|
|
||||||
{ data: deviceConfigure.Content }
|
{ data: deviceConfigure.Content }
|
||||||
);
|
);
|
||||||
deviceConfigureModelValue.DeviceTypeName =
|
deviceConfigureModelValue.DeviceTypeName =
|
||||||
@@ -815,9 +805,7 @@ export default {
|
|||||||
},
|
},
|
||||||
async getDeviceStatus() {
|
async getDeviceStatus() {
|
||||||
const res = await this.$api.GET_SERVER_DEVICE_STATUS(
|
const res = await this.$api.GET_SERVER_DEVICE_STATUS(
|
||||||
"http://" + this.serverData.url + ":" + this.serverData.port,
|
"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");
|
||||||
|
|||||||
@@ -240,8 +240,6 @@ export default {
|
|||||||
if (this.formOptions.saveButtonText === '测试') {
|
if (this.formOptions.saveButtonText === '测试') {
|
||||||
this.serverSettings = await this.$api.VERIFY_SERVER(
|
this.serverSettings = await this.$api.VERIFY_SERVER(
|
||||||
'http://' + row.url + ':' + row.port,
|
'http://' + row.url + ':' + row.port,
|
||||||
'admin',
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD
|
|
||||||
)
|
)
|
||||||
if (this.serverSettings) {
|
if (this.serverSettings) {
|
||||||
this.$message({
|
this.$message({
|
||||||
@@ -264,8 +262,6 @@ export default {
|
|||||||
this.serverSettings.Content.ServerInfoConfig.CaptureURL = row.address
|
this.serverSettings.Content.ServerInfoConfig.CaptureURL = row.address
|
||||||
this.$api.MODIFY_SERVER(
|
this.$api.MODIFY_SERVER(
|
||||||
'http://' + row.url + ':' + row.port,
|
'http://' + row.url + ':' + row.port,
|
||||||
'admin',
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD,
|
|
||||||
{ data: this.serverSettings.Content }
|
{ data: this.serverSettings.Content }
|
||||||
)
|
)
|
||||||
await this.$api.ADD_SERVER({
|
await this.$api.ADD_SERVER({
|
||||||
@@ -294,15 +290,11 @@ export default {
|
|||||||
async handleRowEdit ({ index, row }, done) {
|
async handleRowEdit ({ index, row }, done) {
|
||||||
this.formOptions.saveLoading = true
|
this.formOptions.saveLoading = true
|
||||||
let serverSettings = await this.$api.VERIFY_SERVER(
|
let serverSettings = await this.$api.VERIFY_SERVER(
|
||||||
'http://' + row.url + ':' + row.port,
|
'http://' + row.url + ':' + row.port
|
||||||
'admin',
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD
|
|
||||||
)
|
)
|
||||||
serverSettings.Content.ServerInfoConfig.CaptureURL = row.address
|
serverSettings.Content.ServerInfoConfig.CaptureURL = row.address
|
||||||
this.$api.MODIFY_SERVER(
|
this.$api.MODIFY_SERVER(
|
||||||
'http://' + row.url + ':' + row.port,
|
'http://' + row.url + ':' + row.port,
|
||||||
'admin',
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD,
|
|
||||||
{ data: serverSettings.Content }
|
{ data: serverSettings.Content }
|
||||||
)
|
)
|
||||||
this.$api.UPDATE_SERVER({
|
this.$api.UPDATE_SERVER({
|
||||||
|
|||||||
@@ -177,9 +177,7 @@ export default {
|
|||||||
this.serverData.forEach((element, index) => {
|
this.serverData.forEach((element, index) => {
|
||||||
this.$api
|
this.$api
|
||||||
.GET_SERVE_DEVICE_MONITORING(
|
.GET_SERVE_DEVICE_MONITORING(
|
||||||
'http://' + element.url + ':' + element.port,
|
'http://' + element.url + ':' + element.port
|
||||||
'admin',
|
|
||||||
process.env.VUE_APP_HSLSERVER_PASSWORD
|
|
||||||
)
|
)
|
||||||
.then((deviceStatus) => {
|
.then((deviceStatus) => {
|
||||||
if (deviceStatus.IsSuccess) {
|
if (deviceStatus.IsSuccess) {
|
||||||
|
|||||||
Reference in New Issue
Block a user