lj 5 سال پیش
والد
کامیت
e27604d1a8
4فایلهای تغییر یافته به همراه39 افزوده شده و 172 حذف شده
  1. BIN
      dist_ksh_1.zip
  2. 4 5
      src/components/Index.vue
  3. 35 165
      src/components/UserManger.vue
  4. 0 2
      src/pages/Monitor.vue

BIN
dist_ksh_1.zip


+ 4 - 5
src/components/Index.vue

@@ -14,11 +14,10 @@
       </div>
       <!-- 标题 -->
       <div class="sysName">
-        <h2 v-if="userinfo.user_header">{{ userinfo.user_header }}</h2>
-        <h2 v-else>可视农业应用系统 实时监测基地生产环境</h2>
+        <h2 v-if="userinfo.user_header">{{ userinfo.user_header}}</h2>
+        <h2 v-else>可视农业应用系统</h2>
         <p>
-          The visual agricultural application system monitors the production
-          environment of the base in real time
+          Agricultural Visualization Monitoring System
         </p>
       </div>
       <div class="site" v-if="userinfo.site">
@@ -138,7 +137,7 @@ export default {
     color: #fff;
     text-align: center;
     h2 {
-      font-size: 20px;
+      font-size: 26px;
     }
     p {
       font-size: 14px;

+ 35 - 165
src/components/UserManger.vue

@@ -71,21 +71,34 @@
             </p>
           </div>
           <div class="btn">
-            <el-button type="success" @click="edit(item)" plain
+            <el-button size="small" type="success" @click="edit(item)" plain
               >用户编辑</el-button
             >
+            <template v-if="have_type == 0 || staff == 1">
+              <el-button
+                size="small"
+                v-if="item.user_have_type == '1'"
+                type="success"
+                @click="allotEquip(item.id, item.username)"
+                plain
+                >分配设备</el-button
+              >
+              <el-button
+                size="small"
+                v-if="item.user_have_type == '1'"
+                type="success"
+                @click="delUser(item.id, item.username)"
+                plain
+                >删除用户</el-button
+              >
+            </template>
             <el-button
               type="success"
+              size="small"
               @click="resetPassword(item.id, item.username)"
               plain
               >重置密码</el-button
             >
-            <!-- <a @click="edit(item)">
-							<i class="iconfont icon-iconfontedit"></i>编辑
-						</a>
-						<a @click="resetPassword(item.uid, item.username)">
-							<i class="iconfont icon-mima"></i>密码
-						</a> -->
           </div>
         </el-card>
       </el-col>
@@ -127,9 +140,6 @@
             v-model="resetPassForm.username"
           ></el-input>
         </el-form-item>
-        <el-form-item v-if="userType != 1" label="原始密码 : " prop="oldPass">
-          <el-input type="password" v-model="resetPassForm.oldPass"></el-input>
-        </el-form-item>
         <el-form-item label="新密码 : " prop="pass">
           <el-input type="password" v-model="resetPassForm.pass"></el-input>
         </el-form-item>
@@ -255,7 +265,6 @@ export default {
       resetPassForm: {
         username: "",
         uid: "",
-        oldPass: "",
         pass: "",
         checkPass: "",
       },
@@ -292,7 +301,6 @@ export default {
       },
       //重置密码格规则
       resetPassFormRules: {
-        oldPass: [{ required: true, message: "请填原始密码", trigger: "blur" }],
         pass: [
           { validator: validatePass, trigger: "blur" },
           { required: true, message: "请填写新密码", trigger: "blur" },
@@ -312,7 +320,6 @@ export default {
       return window.sessionStorage.getItem("myuser_type");
     },
   },
-  created() {},
   mounted() {
     this.getList();
     this.have_type = localStorage.getItem("have_type"); // 0管理员  1用户
@@ -327,60 +334,13 @@ export default {
           typelist: 5,
           page: this.page,
           uname: this.username,
+          page_size: 8,
         }),
       }).then((res) => {
         this.userList = res.data.userlist;
         this.totalNum = res.data.nums;
       });
     },
-    getUserGroup() {
-      this.$axios({
-        method: "POST",
-        url: "api_gateway?method=pest.warning_record.rolemanage_view",
-        data: this.qs.stringify({
-          add_role: "all",
-        }),
-      }).then((res) => {
-        if (res.data.message == "") {
-          this.userGroupList = res.data.data.data;
-        }
-      });
-    },
-    recharge(id) {
-      this.$confirm("是否向该用户充值一年费用?", "信息", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(() => {
-          this.$axios({
-            method: "POST",
-            url: "api_gateway?method=user.login.user_add_package_time",
-            data: this.qs.stringify({
-              uid: id,
-            }),
-          }).then((res) => {
-            if (res.data.message == "") {
-              this.$message({
-                type: "success",
-                message: "充值成功!",
-              });
-              this.getList();
-            } else {
-              this.$message({
-                type: "error",
-                message: "充值失败!",
-              });
-            }
-          });
-        })
-        .catch(() => {
-          this.$message({
-            type: "info",
-            message: "充值取消!",
-          });
-        });
-    },
     // 编辑用户信息
     edit(role) {
       this.editUserForm = JSON.parse(JSON.stringify(role));
@@ -429,50 +389,13 @@ export default {
         this.editUserForm.user_area = value[1];
       }
     },
-    login(uid, username) {
-      //一键登录
-      this.$confirm("一键登录将登录此用户,是否继续?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(() => {
-          this.$axios({
-            method: "POST",
-            url: "api_gateway?method=user.login.auto_login",
-            data: this.qs.stringify({
-              uid,
-            }),
-          }).then((res) => {
-            if (res.data.message == "") {
-              this.$message({
-                type: "success",
-                message: "操作成功!",
-              });
-              localStorage.setItem("username", username); //修改当前登录的用户名
-              this.reload(); //整体刷新
-              this.$EventBus.$on("firstPage", (data) => {
-                //默认显示菜单第一项
-                this.$router.push(`${data}`);
-              });
-            } else {
-              this.$message({
-                type: "warning",
-                message: res.data.message,
-              });
-            }
-          });
-        })
-        .catch(() => {
-          this.$message({
-            type: "info",
-            message: "取消一键登录!",
-          });
-        });
+    // 分配设备
+    allotEquip(id, name) {
+      window.location.href = "allot?uname=" + name;
     },
-    //用户禁用
-    forbidUse(id, state, txt) {
-      this.$confirm(txt, "提示", {
+    // 删除普通用户
+    delUser(id, name) {
+      this.$confirm("删除用户, 是否继续?", "警告", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
@@ -480,25 +403,25 @@ export default {
         .then(() => {
           this.$axios({
             method: "POST",
-            url: "api_gateway?method=user.login.users_statu_updata",
+            url: "del_user",
             data: this.qs.stringify({
-              uid: id,
-              state: state,
+              userid: id,
             }),
           }).then((res) => {
-            if (res.data.message == "") {
+            if (res.data == 1) {
+              this.getList();
+            } else {
               this.$message({
-                type: "success",
-                message: "操作成功!",
+                type: "error",
+                message: res.data,
               });
-              this.getList();
             }
           });
         })
         .catch(() => {
           this.$message({
             type: "info",
-            message: "禁用取消!",
+            message: "已取消删除",
           });
         });
     },
@@ -544,41 +467,6 @@ export default {
     addUser() {
       this.addUserDialogVisible = true;
     },
-    //监听用户类型改变
-    userTypeChange(val) {
-      if (val == 3) {
-        this.editIsShow = true;
-      } else {
-        this.editIsShow = false;
-      }
-    },
-    //监听省/市/区
-    pcdChange(val) {
-      let addr_type = "";
-      switch (val) {
-        case "1":
-          addr_type = "province";
-          break;
-        case "2":
-          addr_type = "city";
-          break;
-        case "3":
-          addr_type = "district";
-          break;
-      }
-      this.$axios({
-        method: "POST",
-        url: "api_gateway?method=device.device_manage.device_addr",
-        data: this.qs.stringify({
-          addr_type,
-        }),
-      }).then((res) => {
-        if (res.data.message == "") {
-          this.areaList = res.data.data;
-          this.editUserForm.user_area = "";
-        }
-      });
-    },
     //添加用户提交
     addUserSubm() {
       this.$refs.addUserFormRef.validate((valid) => {
@@ -643,24 +531,6 @@ export default {
       this.getList();
     },
   },
-  filters: {
-    formatUserType(value) {
-      switch (value) {
-        case 1:
-          return "超级管理员";
-          break;
-        case 2:
-          return "经销商";
-          break;
-        case 3:
-          return "农林政府单位";
-          break;
-        case 4:
-          return "普通用户";
-          break;
-      }
-    },
-  },
 };
 </script>
 

+ 0 - 2
src/pages/Monitor.vue

@@ -334,8 +334,6 @@ export default {
       //设备名字
       if (value.device_name) {
         return `${value.device_name}-${value.jktype}`;
-      } else {
-        return `${value.device_id}-${value.jktype}`;
       }
     },
   },