diff --git a/templates/admin.html b/templates/admin.html index 6887714..ec28f56 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -10,36 +10,114 @@ {% block content %}
-
- 接口 /api/v1/admins -
-
-
-
- - - -
-
-
- - - - - - - - - - - - - - - -
邮箱用户名上次登录时间
-
+ + +
+ 接口 /api/v1/admins +
+
+
+
+
+
+ + + +
+
+
+ + + + + + + + + + + + + + + +
邮箱用户名上次登录时间
+
+
+ + 新建 + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + + {% end %} {% block script %} @@ -49,9 +127,20 @@ new Vue({ el: "#app", data: Object.assign({ + locationOperTitle: '', + locationOperAction : '', + dialogTableVisible: false, + tabActiveName: "admin", formEmail: "", users: [], token: "", + form:{ + "location": "", + "providerIP":"", + "id":"" + }, + eqtLocationDatas:[ + ] }, ret), methods: { addAdmin() { @@ -65,7 +154,87 @@ console.log(ret) this.$message("添加成功") }) - } + }, + tableHeaderColor ({row, column, rowIndex, columnIndex}) { + if (rowIndex === 0) { + return 'background-color: #D2E9FF;' + } + }, + openNewLocationDialog(){ + let that = this + that.locationOperAction = 'new' + that.locationOperTitle = '新建' + that.dialogTableVisible = true + }, + openEditLocationDialog(index, row){ + let that = this + that.locationOperAction = 'edit' + that.locationOperTitle = '编辑' + that.form.location = row.location + that.form.providerIP = row.providerIP + that.form.id = row.id + that.dialogTableVisible = true + }, + handleNewLocation(){ + let that = this + $.ajax({ + url: "/api/v1/location", + method: "post", + data: JSON.stringify({ + location: that.form.location, + providerIP: that.form.providerIP + }) + }).then(ret => { + console.log(ret) + this.$message("添加成功") + that.dialogTableVisible = false + that.handleGetLocation({'name':'dept'}) + }) + + }, + handleGetLocation(value){ + let that = this + if(value.name === 'dept'){ + $.ajax({ + url: "/api/v1/location", + method: "get" + }).then(ret => { + that.eqtLocationDatas = ret.location + console.log(ret) + }) + } + }, + handleEditLocation(){ + let that = this + $.ajax({ + url: "/api/v1/location/" + that.form.providerIP, + method: "put", + data: JSON.stringify({ + location: that.form.location, + providerIP: that.form.providerIP + }) + }).then(ret => { + console.log(ret) + this.$message("编辑成功") + that.dialogTableVisible = false + that.handleGetLocation({'name':'dept'}) + }) + + + }, + handleDeleteLocation(index, row){ + let that = this + $.ajax({ + url: "/api/v1/location/" + row.providerIP, + method: "delete", + }).then(ret => { + console.log(ret) + this.$message("删除成功") + that.handleGetLocation({'name':'dept'}) + }) + + }, + } }) }) diff --git a/templates/index.html b/templates/index.html index 8792a54..cb614ee 100644 --- a/templates/index.html +++ b/templates/index.html @@ -64,7 +64,7 @@ 设备离线