优化代码&删除多余的请求
This commit is contained in:
@@ -96,12 +96,15 @@ export default ({ service, request, serviceForMock, requestForMock, mock, faker,
|
|||||||
},
|
},
|
||||||
GET_DEVICE_POINT_VALUE (url, deviceName, data, type) {
|
GET_DEVICE_POINT_VALUE (url, deviceName, data, type) {
|
||||||
return request({
|
return request({
|
||||||
|
validateStatus: (status) => {
|
||||||
|
return status === 404 ? 200 : status
|
||||||
|
},
|
||||||
auth: {
|
auth: {
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
password: process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
'address':data
|
address: data
|
||||||
},
|
},
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: url + '/' + deviceName + '/Read' + type + '32'
|
url: url + '/' + deviceName + '/Read' + type + '32'
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
|||||||
<el-form :inline="true" size="mini" :model="deviceConfigureModelValue" ref="form" :rules="rules"
|
<el-form :inline="true" size="mini" :model="deviceConfigureModelValue" ref="form" :rules="rules"
|
||||||
label-position="right" class="demo-form-inline">
|
label-position="right" class="demo-form-inline">
|
||||||
<el-form-item label="设备">
|
<el-form-item label="设备">
|
||||||
<el-select @change="deviceChange" v-model="defaultDeviceTypeNameValue" placeholder="请选择">
|
<el-select @change="deviceChange" filterable v-model="defaultDeviceTypeNameValue" placeholder="请选择">
|
||||||
<el-option v-for="item in deviceTypeData" :key="item" :label="item" :value="item">
|
<el-option v-for="item in deviceTypeData" :key="item" :label="item" :value="item">
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
@@ -124,7 +124,7 @@ export default {
|
|||||||
// if (this.choosable === 'true') {
|
// if (this.choosable === 'true') {
|
||||||
// deviceConfigureModelValue["@ParentDeviceCode"] = val["@ParentDeviceCode"]
|
// deviceConfigureModelValue["@ParentDeviceCode"] = val["@ParentDeviceCode"]
|
||||||
// }
|
// }
|
||||||
deviceConfigureModelValue["@ParentDeviceCode"] = val["@ParentDeviceCode"] || ''
|
deviceConfigureModelValue['@ParentDeviceCode'] = val['@ParentDeviceCode'] || ''
|
||||||
each(deviceConfigureFormItemData[this.defaultDeviceTypeNameValue], (item) => {
|
each(deviceConfigureFormItemData[this.defaultDeviceTypeNameValue], (item) => {
|
||||||
if (item.type === 'time') {
|
if (item.type === 'time') {
|
||||||
deviceConfigureModelValue[item.key] = val[item.key] ? val[item.key] : new Date()
|
deviceConfigureModelValue[item.key] = val[item.key] ? val[item.key] : new Date()
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ export default {
|
|||||||
labelPosition: 'left',
|
labelPosition: 'left',
|
||||||
saveLoading: false,
|
saveLoading: false,
|
||||||
saveButtonText: '测试',
|
saveButtonText: '测试',
|
||||||
saveButtonType: 'text',
|
saveButtonType: 'text'
|
||||||
},
|
},
|
||||||
addRules: {
|
addRules: {
|
||||||
deviceName: [{ required: true, type: 'string', message: '服务名称不可为空', trigger: 'blur' }],
|
deviceName: [{ required: true, type: 'string', message: '服务名称不可为空', trigger: 'blur' }],
|
||||||
@@ -239,7 +239,7 @@ 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
|
||||||
)
|
)
|
||||||
if (this.serverSettings) {
|
if (this.serverSettings) {
|
||||||
this.$message({
|
this.$message({
|
||||||
@@ -289,7 +289,7 @@ 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(
|
const serverSettings = await this.$api.VERIFY_SERVER(
|
||||||
'http://' + row.url + ':' + row.port
|
'http://' + row.url + ':' + row.port
|
||||||
)
|
)
|
||||||
serverSettings.Content.ServerInfoConfig.CaptureURL = row.address
|
serverSettings.Content.ServerInfoConfig.CaptureURL = row.address
|
||||||
@@ -321,7 +321,6 @@ export default {
|
|||||||
done()
|
done()
|
||||||
},
|
},
|
||||||
setServerExec ({ row }) {
|
setServerExec ({ row }) {
|
||||||
|
|
||||||
this.$confirm('是否要重启动该服务', '提示', {
|
this.$confirm('是否要重启动该服务', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
@@ -345,9 +344,8 @@ export default {
|
|||||||
this.$message({
|
this.$message({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
message: '已重启动该服务'
|
message: '已重启动该服务'
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
handleDialogCancel (done) {
|
handleDialogCancel (done) {
|
||||||
this.$message({
|
this.$message({
|
||||||
|
|||||||
Reference in New Issue
Block a user