yf_zd 5 лет назад
Родитель
Сommit
f5d615ad7a
1 измененных файлов с 46 добавлено и 5 удалено
  1. 46 5
      bigdata2/src/components/UserManger.vue

+ 46 - 5
bigdata2/src/components/UserManger.vue

@@ -74,10 +74,11 @@
             </p>
           </div>
           <div class="btn">
-            <el-button type="success" @click="edit(item)" plain
+            <el-button type="success" @click="edit(item)" plain size='small'
               >用户编辑</el-button
             >
             <el-button
+              size='small'
               v-if="item.user_have_type == '1'" 
               type="success"
               @click="allotEquip(item.id, item.username)"
@@ -85,6 +86,15 @@
               >分配设备</el-button
             >
             <el-button
+              size='small'
+              v-if="item.user_have_type == '1'" 
+              type="success"
+              @click="delUser(item.id, item.username)"
+              plain
+              >删除用户</el-button
+            >
+            <el-button
+              size='small'
               type="success"
               @click="resetPassword(item.id, item.username)"
               plain
@@ -388,6 +398,37 @@ export default {
     allotEquip(id,name){
       window.location.href = 'allot?uname='+name;
     },
+    // 删除普通用户
+    delUser(id,name){
+        this.$confirm('删除用户, 是否继续?', '警告', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          this.$axios({
+            method: "POST",
+            url: "/del_user",
+            data: this.qs.stringify({
+              userid: id,
+            }),
+          }).then((res) => {
+            if (res.data == 1) {
+              this.getList();
+            } else {
+              this.$message({
+                type: 'error',
+                message: res.data
+              }); 
+            }
+          });
+        }).catch(() => {
+          this.$message({
+            type: 'info',
+            message: '已取消删除'
+          });          
+        });
+        
+    },
     //密码重置
     resetPassword(id, name) {
       this.resetPassForm.id = id;
@@ -519,12 +560,12 @@ export default {
     justify-content: space-around;
     button {
       // flex: 1;
-      margin: 0 8px;
+      // margin: 0 8px;
       border: 1px solid #17bb89;
       color: #17bb89;
-      // border-radius: 4px;
-      // font-size: 12px;
-      // padding: 5px 5px;
+      // // border-radius: 4px;
+      // // font-size: 12px;
+      // // padding: 5px 5px;
       background: #fff;
       cursor: pointer;
       i {