修复服务无法编辑问题
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
:edit-template="editTemplate"
|
:edit-template="editTemplate"
|
||||||
:form-options="formOptions"
|
:form-options="formOptions"
|
||||||
:add-rules="addRules"
|
:add-rules="addRules"
|
||||||
|
@dialog-open="handleDialogOpen"
|
||||||
@row-add="handleRowAdd"
|
@row-add="handleRowAdd"
|
||||||
@row-edit="handleRowEdit"
|
@row-edit="handleRowEdit"
|
||||||
@row-remove="handleRowRemove"
|
@row-remove="handleRowRemove"
|
||||||
@@ -209,7 +210,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' }],
|
||||||
@@ -235,6 +236,12 @@ export default {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleDialogOpen ({ mode }) {
|
||||||
|
if(mode === 'edit'){
|
||||||
|
this.formOptions.saveButtonText = '确定'
|
||||||
|
this.formOptions.saveButtonType = 'text'
|
||||||
|
}
|
||||||
|
},
|
||||||
// 普通的新增
|
// 普通的新增
|
||||||
addRow () {
|
addRow () {
|
||||||
this.$refs.d2Crud.showDialog({
|
this.$refs.d2Crud.showDialog({
|
||||||
@@ -249,7 +256,7 @@ export default {
|
|||||||
this.serverSettings = await this.$api.VERIFY_SERVER(
|
this.serverSettings = await this.$api.VERIFY_SERVER(
|
||||||
'http://' + row.url + ':' + row.port,
|
'http://' + row.url + ':' + row.port,
|
||||||
row.userName,
|
row.userName,
|
||||||
row.password
|
process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
)
|
)
|
||||||
if (this.serverSettings) {
|
if (this.serverSettings) {
|
||||||
this.$message({
|
this.$message({
|
||||||
@@ -257,7 +264,6 @@ export default {
|
|||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.formOptions.saveLoading = false
|
|
||||||
each(Object.keys(row), (p) => {
|
each(Object.keys(row), (p) => {
|
||||||
this.addTemplate[p].value = row[p]
|
this.addTemplate[p].value = row[p]
|
||||||
})
|
})
|
||||||
@@ -274,7 +280,7 @@ export default {
|
|||||||
this.$api.MODIFY_SERVER(
|
this.$api.MODIFY_SERVER(
|
||||||
'http://' + row.url + ':' + row.port,
|
'http://' + row.url + ':' + row.port,
|
||||||
row.userName,
|
row.userName,
|
||||||
row.password,
|
process.env.VUE_APP_HSLSERVER_PASSWORD,
|
||||||
{ data: this.serverSettings.Content }
|
{ data: this.serverSettings.Content }
|
||||||
)
|
)
|
||||||
this.$api.ADD_SERVER({
|
this.$api.ADD_SERVER({
|
||||||
@@ -298,15 +304,21 @@ export default {
|
|||||||
})
|
})
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
this.formOptions.saveLoading = false
|
||||||
},
|
},
|
||||||
async handleRowEdit ({ index, row }, done) {
|
async handleRowEdit ({ index, row }, done) {
|
||||||
this.formOptions.saveLoading = true
|
this.formOptions.saveLoading = true
|
||||||
this.serverSettings.Content.ServerInfoConfig.CaptureURL = row.address
|
let serverSettings = await this.$api.VERIFY_SERVER(
|
||||||
|
'http://' + row.url + ':' + row.port,
|
||||||
|
'admin',
|
||||||
|
process.env.VUE_APP_HSLSERVER_PASSWORD
|
||||||
|
)
|
||||||
|
serverSettings.Content.ServerInfoConfig.CaptureURL = row.address
|
||||||
this.$api.MODIFY_SERVER(
|
this.$api.MODIFY_SERVER(
|
||||||
'http://' + row.url + ':' + row.port,
|
'http://' + row.url + ':' + row.port,
|
||||||
row.userName,
|
'admin',
|
||||||
row.password,
|
process.env.VUE_APP_HSLSERVER_PASSWORD,
|
||||||
{ data: this.serverSettings.Content }
|
{ data: serverSettings.Content }
|
||||||
)
|
)
|
||||||
this.$api.UPDATE_SERVER({
|
this.$api.UPDATE_SERVER({
|
||||||
action: 'update_server',
|
action: 'update_server',
|
||||||
@@ -349,7 +361,6 @@ export default {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDialogCancel (done) {
|
handleDialogCancel (done) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '用户放弃改动',
|
message: '用户放弃改动',
|
||||||
|
|||||||
Reference in New Issue
Block a user