From b30da7a58f6dc6a557f13df650792f0615a3b00b Mon Sep 17 00:00:00 2001 From: xuweijia Date: Thu, 20 Jun 2019 14:31:37 +0800 Subject: [PATCH 1/6] =?UTF-8?q?1.=20=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E6=B7=BB=E5=8A=A0tab=20=20=20=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=AE=BE=E5=A4=87=E6=89=80=E5=9C=A8=E5=9C=B0=E7=AE=A1?= =?UTF-8?q?=E7=90=86=EF=BC=8C=20=E6=94=AF=E6=8C=81=E5=A2=9E=E5=88=A0?= =?UTF-8?q?=E6=94=B9=E6=9F=A5=20=20=20=20=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=861=E5=BC=A0=E8=A1=A8=20loaction=202.?= =?UTF-8?q?=20=E9=A6=96=E9=A1=B5=E8=B0=83=E6=95=B4=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=88=97=EF=BC=8C=E6=94=AF=E6=8C=81=E4=BB=8E?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=89=80=E5=9C=A8=E5=9C=B0=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3. 升级了element版本,从2.4.11~~2.8.2 修复BUG 原先释放中 改为释放中 --- templates/admin.html | 227 +++++++++++++++++++++++++++++++++++++------ templates/base.html | 2 +- templates/index.html | 51 ++++++++-- web/database.py | 3 + web/urls.py | 4 +- web/views/device.py | 2 +- web/views/user.py | 47 +++++++++ 7 files changed, 295 insertions(+), 41 deletions(-) diff --git a/templates/admin.html b/templates/admin.html index 6887714..990f0ef 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -10,36 +10,113 @@ {% block content %}
-
- 接口 /api/v1/admins -
-
-
-
- - - -
-
-
- - - - - - - - - - - - - - - -
邮箱用户名上次登录时间
-
+ + +
+ 接口 /api/v1/admins +
+
+
+
+
+
+ + + +
+
+
+ + + + + + + + + + + + + + + +
邮箱用户名上次登录时间
+
+
+ + 新建 + + + + + + + + + + + + + +
+ + + +
+ + + + + + + + + + + + {% end %} {% block script %} @@ -49,9 +126,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 +153,86 @@ 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.id, + 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.id, + method: "delete", + }).then(ret => { + console.log(ret) + this.$message("删除成功") + }) + that.handleGetLocation({'name':'dept'}) + + + }, + } }) }) diff --git a/templates/base.html b/templates/base.html index 7bab22a..3abf069 100644 --- a/templates/base.html +++ b/templates/base.html @@ -14,7 +14,7 @@ - + diff --git a/templates/index.html b/templates/index.html index 8792a54..6d66948 100644 --- a/templates/index.html +++ b/templates/index.html @@ -64,7 +64,7 @@ 设备离线