From ac1b71d6f2b1fc58aea9ea9ade96ad85633107c6 Mon Sep 17 00:00:00 2001
From: lihua <531456470@qq.com>
Date: Tue, 13 Aug 2019 14:57:12 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E9=AA=8C?=
=?UTF-8?q?=E8=AF=81bug=E5=8F=8A=E5=88=A0=E9=99=A4bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/material.js | 4 ++--
src/views/asset/public/index.vue | 7 +++---
src/views/asset/staff/index.vue | 6 ++---
src/views/layout/components/Navbar.vue | 9 +++++++-
src/views/material/warehouse/index.vue | 9 +++-----
src/views/user/manage.vue | 32 ++++++++++++++++++--------
6 files changed, 43 insertions(+), 24 deletions(-)
diff --git a/src/api/material.js b/src/api/material.js
index 6683dfd..dcac7ba 100644
--- a/src/api/material.js
+++ b/src/api/material.js
@@ -26,9 +26,9 @@ export function edit(asset) {
})
}
-export function del(code) {
+export function del(id) {
return request({
- url: `/material/delete/${code}`,
+ url: `/material/delete/${id}`,
method: 'delete'
})
}
diff --git a/src/views/asset/public/index.vue b/src/views/asset/public/index.vue
index cee1923..d268eaf 100644
--- a/src/views/asset/public/index.vue
+++ b/src/views/asset/public/index.vue
@@ -74,7 +74,7 @@
min-width="10%">
编辑
- 删除
+ 删除
@@ -270,20 +270,21 @@ export default {
this.editVisible = false
}
this.visible = false
+ this.handleSearch()
} else {
console.log('error submit!!')
return false
}
})
},
- handleDelete(code, index) {
+ handleDelete(id, index) {
this.$confirm('此操作将永久删除该资产, 是否继续?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
- del(code).then(response => {
+ del(id).then(response => {
this.assetList.splice(index, 1)
this.listLoading = false
})
diff --git a/src/views/asset/staff/index.vue b/src/views/asset/staff/index.vue
index bfbf5d3..996d2ff 100644
--- a/src/views/asset/staff/index.vue
+++ b/src/views/asset/staff/index.vue
@@ -64,7 +64,7 @@
min-width="10%">
编辑
- 删除
+ 删除
@@ -239,14 +239,14 @@ export default {
}
})
},
- handleDelete(code, index) {
+ handleDelete(id, index) {
this.$confirm('此操作将永久删除该资产, 是否继续?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
- del(code).then(response => {
+ del(id).then(response => {
this.assetList.splice(index, 1)
this.listLoading = false
})
diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue
index 4a740d4..03695a2 100644
--- a/src/views/layout/components/Navbar.vue
+++ b/src/views/layout/components/Navbar.vue
@@ -32,7 +32,7 @@
-
+
@@ -108,6 +108,13 @@ export default {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
+ if (value.length < 5) {
+ this.$message({
+ type: 'error',
+ message: '密码不能小于5位'
+ })
+ return
+ }
modifyPassword(value).then(response => {
this.$message({
type: 'success',
diff --git a/src/views/material/warehouse/index.vue b/src/views/material/warehouse/index.vue
index 616da80..edc6b8c 100644
--- a/src/views/material/warehouse/index.vue
+++ b/src/views/material/warehouse/index.vue
@@ -107,7 +107,7 @@
出库
编辑
- 删除
+ 删除
@@ -256,9 +256,6 @@ export default {
],
position: [
{ required: true, message: '位号不能为空', trigger: 'blur' }
- ],
- company: [
- { required: true, message: '公司名称不能为空', trigger: 'blur' }
]
},
addVisible: false,
@@ -418,14 +415,14 @@ export default {
}
})
},
- handleDelete(code, index) {
+ handleDelete(id, index) {
this.$confirm('此操作将永久删除该资产, 是否继续?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = true
- del(code).then(response => {
+ del(id).then(response => {
this.materialList.splice(index, 1)
this.listLoading = false
})
diff --git a/src/views/user/manage.vue b/src/views/user/manage.vue
index e7898e9..72851e6 100644
--- a/src/views/user/manage.vue
+++ b/src/views/user/manage.vue
@@ -56,7 +56,7 @@
重置密码
编辑
- 删除
+ 删除
@@ -121,6 +121,21 @@ export default {
callback()
}
}
+ const validatePass = (rule, value, callback) => {
+ if (value.length < 5) {
+ callback(new Error('密码不能小于5位'))
+ } else {
+ callback()
+ }
+ }
+ const validateName = (rule, value, callback) => {
+ const reg = /^[a-z_A-Z]+$/
+ if (!reg.test(value)) {
+ callback(new Error('登录名称只能包含字母和下划线'))
+ } else {
+ callback()
+ }
+ }
return {
form: {
nickname: '',
@@ -134,10 +149,10 @@ export default {
{ required: true, message: '用户名称不能为空', trigger: 'blur' }
],
name: [
- { required: true, message: '登录名称不能为空', trigger: 'blur' }
+ { required: true, trigger: 'blur', validator: validateName }
],
password: [
- { required: true, message: '密码不能为空', trigger: 'blur' }
+ { required: true, trigger: 'blur', validator: validatePass }
],
phone: [
{ required: true, trigger: 'blur', validator: validPhone }
@@ -205,14 +220,13 @@ export default {
if (valid) {
if (this.addVisible) {
add(this.form).then(response => {
- this.form.createTime = new Date()
- this.userList.push(this.form)
+ this.handleSearch()
})
this.addVisible = false
}
if (this.editVisible) {
- edit(this.form).then(response => {
- console.log(response)
+ edit(this.form, this.form.id).then(response => {
+ this.handleSearch()
})
this.editVisible = false
}
@@ -225,7 +239,7 @@ export default {
},
handleResetPassword(id) {
resetPassword(id).then(response => {
- const newPassword = response.data
+ const newPassword = response.data.password
this.$alert(newPassword, '新密码', {
confirmButtonText: '确定'
})
@@ -239,7 +253,7 @@ export default {
}).then(() => {
this.listLoading = true
del(code).then(response => {
- this.assetList.splice(index, 1)
+ this.userList.splice(index, 1)
this.listLoading = false
})
this.$message({