liujie 5 years ago
parent
commit
5525d1a907

+ 2 - 4
config/index.js

@@ -6,21 +6,19 @@ const path = require('path')
 
 module.exports = {
   dev: {
-
     // Paths
     assetsSubDirectory: 'static',
     assetsPublicPath: '/',
     proxyTable: {
       '/api': {
-        target: 'http://192.168.1.8:8000/',
-        // target: 'http://192.168.1.4:8000/',
+        // target: 'http://192.168.1.8:8000/',
+        target: 'http://192.168.1.4:8000/',
         changeOrigin: true,
         pathRewrite: {
           '^/api': '' //重写接口
         }
       },
     },
-
     // Various Dev Server settings
     host: '192.168.1.7', // can be overwritten by process.env.HOST
     port: 8000, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined

BIN
dist_ksh.zip


+ 1 - 0
package.json

@@ -16,6 +16,7 @@
     "element-ui": "^2.14.1",
     "es6-promise": "^4.2.8",
     "vue": "^2.5.2",
+    "vue-cropper": "^0.5.2",
     "vue-router": "^3.0.1"
   },
   "devDependencies": {

+ 81 - 0
src/assets/css/global.css

@@ -0,0 +1,81 @@
+html,body,#app{
+    height:100%;
+    margin:0;
+   padding:0;
+   /* overflow: hidden; */
+}
+a{text-decoration: none;}
+ul,li{
+    list-style-type: none;
+    margin: 0;
+    padding: 0;
+}
+p{margin:0}
+.el-breadcrumb{
+    margin-bottom:15px;
+    font-size:12px;
+    background:#fff;
+    border-top:1px solid #ddd;
+    padding:15px 10px;
+    margin-left:-20px;
+    margin-right:-20px;
+    position: fixed;
+    z-index: 99;
+    left: 220px;
+    right: 0;
+    top: 177px;
+}
+.el-dialog__header{
+    background:#F2F2F2;
+    border-bottom:1px solid #CACACA;
+}
+.el-main{padding:20px 20px 0!important;background-color: #f6f6f6;}
+
+/* 修改分页的默认样式 */
+.el-pagination{
+    text-align: center;
+    margin-top:20px;
+    margin-bottom:20px;
+}
+.el-pagination .el-pager li.active{
+    background-color: #17BB89!important;
+}
+.el-col{margin-bottom:10px;}
+/* 解决elementUI的table的闪动问题 */
+.el-table__body{width:100%!important}
+/* 去掉e-card组件的padding */
+.pad0 .el-card__body{padding:0px!important}
+
+
+/* 时间段宽度设置 */
+.el-date-editor--daterange.el-input__inner {
+    width:220px!important;
+}
+
+.avatar-uploader .el-upload {
+    border:1px dashed #d9d9d9;
+    border-radius: 6px;
+    cursor: pointer;
+    position: relative;
+    overflow: hidden;
+    }
+.avatar-uploader .el-upload:hover {
+    border-color: #409EFF;
+    }
+.avatar-uploader-icon {
+    font-size: 28px;
+    color: #8c939d;
+    width: 100px;
+    height: 100px;
+    line-height: 100px!important;
+    text-align: center;
+    }
+.avatar {
+    width: 100px;
+    height: 100px;
+    display: block;
+    }
+       
+.search-box{margin-bottom:10px;}
+
+

BIN
src/assets/images/systemManger/user.png


BIN
src/assets/images/systemManger/user_dis.png


+ 82 - 22
src/components/Index.vue

@@ -1,24 +1,41 @@
 <template>
   <el-container style="height: 100%">
     <el-header class="header" v-show="flag">
-      <div class="logInfo">
-        <img :src="'api' + logo" alt="" />
-        <h3>{{ header }}</h3>
+      <div v-if="userinfo.logo">
+        <img
+          :src="userinfo.logo"
+          alt=""
+          style="position: absolute; left: 20px; top: 20px; max-width: 136px"
+        />
       </div>
+      <!-- 用户 -->
+      <div class="userinfo">
+        <img :src="userphoto" class="userheadImg" alt="" />{{ username }}
+      </div>
+      <!-- 标题 -->
       <div class="sysName">
-        <h2>可视农业应用系统 实时监测基地生产环境</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
         </p>
       </div>
+      <div class="site" v-if="userinfo.site">
+        <i class="iconfont icon-jidi"></i>
+        <span>{{ userinfo.site }}</span>
+      </div>
       <span class="header_btn" @click="hCheckFun">[隐藏]</span>
     </el-header>
     <el-header class="header2" v-show="!flag">
-      <h3>可视农业应用系统</h3>
+      <h3 v-if="userinfo.user_header">{{ userinfo.user_header }}</h3>
+      <h3 v-else>可视农业应用系统</h3>
+      <div class="site" v-if="userinfo.site">
+        <i class="iconfont icon-jidi"></i>
+        <span>{{ userinfo.site }}</span>
+      </div>
       <span class="header_btn" @click="hCheckFun">[展开]</span>
     </el-header>
-
     <el-container style="overflow: auto">
       <el-aside width="200px">
         <el-menu
@@ -28,13 +45,17 @@
           :router="isRouter"
           active-text-color="rgb(57, 249, 190)"
         >
+          <el-menu-item index="/index/monitor1">
+            <i :class="iconObj[20]"></i>
+            <span slot="title">可视农业应用系统</span>
+          </el-menu-item>
           <el-menu-item index="/index/list1">
             <i :class="iconObj[22]"></i>
             <span slot="title">设备列表</span>
           </el-menu-item>
-          <el-menu-item index="/index/monitor1">
-            <i :class="iconObj[20]"></i>
-            <span slot="title">可视农业应用系统</span>
+          <el-menu-item index="/index/userManger1">
+            <i :class="iconObj[23]"></i>
+            <span slot="title">用户管理</span>
           </el-menu-item>
         </el-menu>
       </el-aside>
@@ -52,30 +73,41 @@ export default {
       iconObj: {
         20: "iconfont icon-jiankong",
         22: "iconfont icon-shebei",
+        23: "iconfont icon-xitong",
       },
       flag: true,
-      header: "",
-      logo: "",
       active: 1,
+      userinfo: {},
+      username: "",
+      userphoto: "",
     };
   },
   created: function () {
-    this.getUserInfo();
+    this.getuserinfo();
   },
   computed: {},
   mounted() {},
   methods: {
-    getUserInfo() {
+    hCheckFun() {
+      this.flag = !this.flag;
+    },
+    getuserinfo() {
       this.$axios({
-        method: "POST",
-        url: "logoheader",
+        method: "post",
+        url: "userinfo_",
       }).then((res) => {
-        this.header = res.data.header;
-        this.logo = res.data.logo;
+        this.username = res.data.username;
+        this.userphoto = res.data.userphoto;
+        localStorage.setItem("username", res.data.username); // 0管理员  1用户
+      });
+      this.$axios({
+        method: "get",
+        url: "user_detail",
+      }).then((res) => {
+        this.userinfo = res.data;
+        localStorage.setItem("have_type", this.userinfo.have_type); // 0管理员  1用户
+        localStorage.setItem("staff", this.userinfo.staff); // 1是admin
       });
-    },
-    hCheckFun() {
-      this.flag = !this.flag;
     },
   },
 };
@@ -89,6 +121,19 @@ export default {
   border-bottom: 2px solid #272b3a;
   background: #272b3a no-repeat center / 100% 100%
     url(../assets/images/monitor/h_bg.jpg);
+  .userinfo {
+    color: #fff;
+    position: absolute;
+    top: 10px;
+    right: 10px;
+    .userheadImg {
+      width: 35px;
+      height: 35px;
+      border-radius: 50%;
+      vertical-align: middle;
+      margin-right: 6px;
+    }
+  }
   .sysName {
     color: #fff;
     text-align: center;
@@ -124,6 +169,19 @@ export default {
   background-color: #323749;
   color: #fff;
 }
+.site {
+  position: absolute;
+  right: 90px;
+  bottom: 10px;
+  z-index: 888;
+  font-size: 14px;
+  color: #ffffff;
+  span {
+    color: #fff;
+    letter-spacing: 1px;
+    font-size: 13px;
+  }
+}
 .header_btn {
   position: absolute;
   color: #727272;
@@ -143,14 +201,16 @@ export default {
     .el-menu-item {
       color: #909399;
     }
-    .is-active{
+    .is-active {
       background-color: rgba(45, 111, 102, 0.4);
     }
     .el-menu-item:focus,
     .el-menu-item:hover {
       color: #39f9be;
       background-color: rgba(45, 111, 102, 0.4);
-      i{color: #39f9be;}
+      i {
+        color: #39f9be;
+      }
     }
   }
 }

+ 1 - 1
src/components/Login.vue

@@ -71,7 +71,7 @@ export default {
 			}
 			this.$axios({
 				method: 'POST',
-				url: 'login',
+				url: '/api/login',
 				data: this.qs.stringify({
 					username: this.username,
 					password: this.pass

+ 779 - 0
src/components/UserManger.vue

@@ -0,0 +1,779 @@
+<template>
+  <div>
+    <div class="search-box">
+      <div class="filter-box">
+        <el-input
+          size="small"
+          placeholder="请输入用户名"
+          @change="checkList()"
+          clearable
+          v-model="username"
+        >
+          <i slot="suffix" class="el-input__icon el-icon-search"></i>
+        </el-input>
+      </div>
+      <el-button v-if="have_type == 0 || staff == 1" type="success" size="mini"
+        ><a style="color: #fff" href="systemmanage_user_add"
+          >添加新用户</a
+        ></el-button
+      >
+    </div>
+    <el-row :gutter="10">
+      <el-col
+        :xs="24"
+        :sm="24"
+        :md="12"
+        :lg="6"
+        :xl="6"
+        v-for="item in userList"
+        :key="item.uid"
+      >
+        <el-card class="box-card pad0">
+          <div class="img-box">
+            <img src="@/assets/images/systemManger/user.png" />
+            <p>{{ item.username }}</p>
+          </div>
+          <div class="detail">
+            <p>
+              模块类型
+              <span v-if="item.user_type == '1'">农业植保监测系统</span>
+              <span v-if="item.user_type == '2'">农业气象监测系统</span>
+              <span v-if="item.user_type == '3'">环境灾害预警系统</span>
+              <span v-if="item.user_type == '4'">农产品溯源系统</span>
+              <span v-if="item.user_type == '5'">可视农业应用系统</span>
+              <span v-if="item.user_type == '6'">苗情监测应用系统</span>
+            </p>
+            <p>
+              用户类型
+              <span v-if="item.user_have_type == '1'">普通用户</span>
+              <span v-if="item.user_have_type == '0'">管理员</span>
+            </p>
+            <p>
+              站点名称
+              <span>{{ item.site || "无" }}</span>
+            </p>
+            <p>
+              站点地址
+              <span
+                >{{ item.user_pro }} {{ item.user_city }}
+                {{ item.user_area }}</span
+              >
+            </p>
+            <p>
+              标题
+              <span>{{ item.user_header || "--" }}</span>
+            </p>
+            <p>
+              logo
+              <span
+                ><img style="width: 46px; height: 32px" :src="item.logo" alt=""
+              /></span>
+            </p>
+          </div>
+          <div class="btn">
+            <el-button type="success" @click="edit(item)" plain
+              >用户编辑</el-button
+            >
+            <el-button
+              type="success"
+              @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>
+    </el-row>
+    <!-- 暂无数据 -->
+    <div class="expertDiagnosis_referral_units_not" v-if="userList.length <= 0">
+      <img
+        src="@/assets/images/monitor/zanwu.png"
+        alt
+        class="expertDiagnosis_referral_units_notImg"
+      />
+    </div>
+    <el-pagination
+      v-if="userList.length > 0"
+      background
+      :page-size="8"
+      layout="prev, pager, next"
+      :current-page="page"
+      :total="totalNum"
+      @current-change="changePage"
+    ></el-pagination>
+    <!-- 重置密码 -->
+    <el-dialog
+      title="重置密码"
+      :visible.sync="resetPassDialogVisible"
+      width="30%"
+      @close="resetPassDialogClosed"
+    >
+      <el-form
+        ref="resetPassFormRef"
+        :model="resetPassForm"
+        label-width="110px"
+        :rules="resetPassFormRules"
+      >
+        <el-form-item label="用户名 : " prop="username">
+          <el-input
+            type="text"
+            disabled
+            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>
+        <el-form-item label="确认新密码 : " prop="checkPass">
+          <el-input
+            type="password"
+            v-model="resetPassForm.checkPass"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="resetPassDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="resetPassSubm">确认</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 用户编辑 -->
+    <el-dialog
+      title="用户信息编辑"
+      :visible.sync="editUserDialogVisible"
+      width="500px"
+      @close="editUserDialogClosed"
+    >
+      <el-form ref="editUserFormRef" :model="editUserForm" label-width="80px">
+        <el-form-item label="用户名 : ">
+          <el-input v-model="editUserForm.username" disabled></el-input>
+        </el-form-item>
+        <el-form-item label="标题 : ">
+          <el-input
+            maxlength="11"
+            v-model="editUserForm.user_header"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="logo : ">
+          <el-upload
+            class="avatar-uploader"
+            action
+            :auto-upload="false"
+            :show-file-list="false"
+            :on-change="changeUpload"
+            :before-upload="beforeAvatarUpload"
+          >
+            <img
+              v-if="editUserForm.logo"
+              :src="editUserForm.logo"
+              class="avatar"
+            />
+            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+          </el-upload>
+        </el-form-item>
+        <el-form-item label="站点名称 : ">
+          <el-input maxlength="16" v-model="editUserForm.site"></el-input>
+        </el-form-item>
+        <el-form-item label="站点位置 : ">
+          <div class="block">
+            <el-cascader
+              placeholder="搜索:河南"
+              v-model="cityValue"
+              :options="cityData"
+              :props="props"
+              @change="handleChange"
+              filterable
+            >
+            </el-cascader>
+          </div>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="editUserDialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="editUserSubm">确认</el-button>
+      </span>
+    </el-dialog>
+    <!-- vueCropper 剪裁图片实现-->
+    <!-- <el-dialog title="图片剪裁" :visible.sync="cropperVisible" append-to-body>
+      <div class="cropper-content">
+        <div style="width: 100%; height: 500px">
+          <vueCropper
+            ref="cropper"
+            :img="photo.img"
+            autoCrop
+            centerBox
+            fixed
+            :fixedNumber="photo.fixedNumber"
+            :outputSize="photo.size"
+            :outputType="photo.outputType"
+          ></vueCropper>
+        </div>
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cropperVisible = false">取 消</el-button>
+        <el-button type="primary" @click="finish">确认</el-button>
+      </div>
+    </el-dialog> -->
+  </div>
+</template>
+
+<script>
+import cityData from "./citydata.js";
+export default {
+  data() {
+    var checkMobile = (rule, value, callback) => {
+      const regMobile = /^1\d{10}$/;
+      if (regMobile.test(value)) {
+        callback();
+      } else {
+        // 返回一个错误提示
+        callback(new Error("请输入合法的手机号码"));
+      }
+    };
+    var validatePass = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("请输入新密码"));
+      } else {
+        if (this.resetPassForm.checkPass !== "") {
+          this.$refs.resetPassFormRef.validateField("checkPass");
+        }
+        callback();
+      }
+    };
+    var validatePass2 = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("请再次输入密码"));
+      } else if (value !== this.resetPassForm.pass) {
+        callback(new Error("两次输入密码不一致!"));
+      } else {
+        callback();
+      }
+    };
+    return {
+      zanwu: "/images/expertDiagnosis/zanwu.png",
+      role: "", //筛选项 角色类型
+      userTypeCheck: "", //筛选项 用户类型
+      username: "", //筛选项
+      roleList: [],
+      page: 1,
+      userList: [],
+      userGroupList: [],
+      totalNum: 0,
+      //省市县
+      areaList: [],
+      resetPassDialogVisible: false,
+      addUserDialogVisible: false,
+      editUserDialogVisible: false,
+      resetPassForm: {
+        username: "",
+        uid: "",
+        oldPass: "",
+        pass: "",
+        checkPass: "",
+      },
+      addUserForm: {
+        username: "",
+        mobile: "",
+        pass: "",
+        role_id: "",
+        user_type: "",
+        pcd: "",
+        user_area: "",
+        cs_user: false, //1为普通用户
+        user_group_id: "", //用户组id
+      },
+      cropperVisible: false,
+      // 裁剪组件的基础配置option
+      photo: {
+        img: "", // 裁剪图片的地址
+        info: true, // 裁剪框的大小信息
+        outputSize: 0.8, // 裁剪生成图片的质量
+        outputType: "jpeg", // 裁剪生成图片的格式
+        // canScale: false, // 图片是否允许滚轮缩放
+        // autoCrop: true, // 是否默认生成截图框
+        // autoCropWidth: 300, // 默认生成截图框宽度
+        // autoCropHeight: 200, // 默认生成截图框高度
+        // fixedBox: true, // 固定截图框大小 不允许改变
+        fixed: true, // 是否开启截图框宽高固定比例
+        // fixedNumber: [136, 32], // 截图框的宽高比例
+        full: true, // 是否输出原图比例的截图
+        canMoveBox: false, // 截图框能否拖动
+        original: false, // 上传图片按照原始比例渲染
+        centerBox: false, // 截图框是否被限制在图片里面
+        infoTrue: true, // true 为展示真实输出图片宽高 false 展示看到的截图框宽高
+      },
+      cityData,
+      cityValue: [],
+      props: {
+        expandTrigger: "hover",
+        value: "value",
+      },
+      editUserForm: {},
+      //控制省/市/区显示
+      editIsShow: false,
+      //添加用户规则
+      addUserFormRules: {
+        username: [
+          { required: true, message: "请填写用户名", trigger: "blur" },
+        ],
+        mobile: [
+          { required: true, trigger: "blur", message: "手机号不能为空" },
+          { validator: checkMobile, trigger: "blur" },
+        ],
+        pass: [{ required: true, message: "请填写用户密码", trigger: "blur" }],
+      },
+      //重置密码格规则
+      resetPassFormRules: {
+        oldPass: [{ required: true, message: "请填原始密码", trigger: "blur" }],
+        pass: [
+          { validator: validatePass, trigger: "blur" },
+          { required: true, message: "请填写新密码", trigger: "blur" },
+        ],
+        checkPass: [
+          { validator: validatePass2, trigger: "blur" },
+          { required: true, message: "请确认新密码", trigger: "blur" },
+        ],
+      },
+      have_type: "",
+      staff: "",
+    };
+  },
+  computed: {
+    //获取用户类型
+    userType: function () {
+      return window.sessionStorage.getItem("myuser_type");
+    },
+  },
+  created() {},
+  mounted() {
+    this.getList();
+    this.have_type = localStorage.getItem("have_type"); // 0管理员  1用户
+    this.staff = localStorage.getItem("staff"); // 1是admin
+  },
+  methods: {
+    getList() {
+      this.$axios({
+        method: "POST",
+        url: "user_list",
+        data: this.qs.stringify({
+          typelist: 5,
+          page: this.page,
+          uname: this.username,
+        }),
+      }).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));
+      this.editUserDialogVisible = true;
+      this.cityValue = [
+        this.editUserForm.user_pro,
+        this.editUserForm.user_city,
+        this.editUserForm.user_area,
+      ];
+    },
+    beforeAvatarUpload(file) {
+      console.log(file);
+      const isJPG = file.type === "image/jpeg" || file.type === "image/png";
+      const isLt2M = file.size / 1024 / 1024 < 2;
+      if (!isJPG) {
+        this.$message.error("上传头像图片只能是 JPG 和 PNG格式!");
+      }
+      if (!isLt2M) {
+        this.$message.error("上传头像图片大小不能超过 2MB!");
+      }
+      return isJPG && isLt2M;
+    },
+    changeUpload(file, fileList) {
+      var form = new FormData();
+      form.append("img_file", file.raw);
+      this.$axios({
+        method: "POST",
+        url: "base_photo",
+        data: form,
+      }).then((res) => {
+        this.editUserForm.logo = res.data.src;
+      });
+    },
+    handleChange(value) {
+      console.log(value);
+      console.log(this.cityValue);
+      this.editUserForm.user_pro = value[0];
+      this.editUserForm.user_city = value[1];
+      if (value[2]) {
+        this.editUserForm.user_area = value[2];
+      } else {
+        this.editUserForm.user_city = value[0].substring(
+          0,
+          value[0].length - 1
+        );
+        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: "取消一键登录!",
+          });
+        });
+    },
+    //用户禁用
+    forbidUse(id, state, txt) {
+      this.$confirm(txt, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.$axios({
+            method: "POST",
+            url: "api_gateway?method=user.login.users_statu_updata",
+            data: this.qs.stringify({
+              uid: id,
+              state: state,
+            }),
+          }).then((res) => {
+            if (res.data.message == "") {
+              this.$message({
+                type: "success",
+                message: "操作成功!",
+              });
+              this.getList();
+            }
+          });
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "禁用取消!",
+          });
+        });
+    },
+    //密码重置
+    resetPassword(id, name) {
+      this.resetPassForm.id = id;
+      this.resetPassForm.username = name;
+      this.resetPassDialogVisible = true;
+    },
+    resetPassSubm() {
+      //暂时不用
+      this.$refs.resetPassFormRef.validate((valid) => {
+        if (!valid) return;
+        this.$axios({
+          method: "POST",
+          url: "systemmanage_user_list",
+          data: this.qs.stringify({
+            id: this.resetPassForm.id,
+            req: "resetpwd",
+            userName: this.editUserForm.username,
+            userpassWord: this.resetPassForm.pass,
+            userRePassWord: this.resetPassForm.pass,
+          }),
+        }).then((res) => {
+          if (res.data == 0) {
+            this.$message.success("修改密码成功");
+            this.resetPassDialogVisible = false;
+          } else {
+            this.$message.error(res.data.message);
+          }
+        });
+      });
+    },
+    //监听重置密码对话框的关闭事件
+    resetPassDialogClosed() {
+      this.$refs.resetPassFormRef.resetFields();
+    },
+    changePage(value) {
+      this.page = value;
+      this.getList();
+    },
+    //添加用户
+    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) => {
+        if (!valid) return;
+        let cs_user = this.addUserForm.cs_user ? "1" : "";
+        this.$axios({
+          method: "POST",
+          url: "api_gateway?method=user.login.regiest",
+          data: this.qs.stringify({
+            username: this.addUserForm.username,
+            mobile: this.addUserForm.mobile,
+            password: this.addUserForm.pass,
+            role_id: this.addUserForm.role_id,
+            user_type: this.addUserForm.user_type,
+            pcd: this.addUserForm.pcd,
+            user_area: this.addUserForm.user_area,
+            user_group_id: this.addUserForm.user_group_id,
+            cs_user,
+          }),
+        }).then((res) => {
+          if (res.data.message == "") {
+            this.$message.success("添加用户成功!");
+            this.addUserDialogVisible = false;
+            this.getList();
+          } else {
+            this.$message.error(res.data.message);
+          }
+        });
+      });
+    },
+    addUserDialogClosed() {
+      this.$refs.addUserFormRef.resetFields();
+    },
+    //修改用户信息提交
+    editUserSubm() {
+      this.$refs.editUserFormRef.validate((valid) => {
+        if (!valid) return;
+        this.$axios({
+          method: "POST",
+          url: "user_detail",
+          data: this.qs.stringify(this.editUserForm),
+        }).then((res) => {
+          if (res.data == 1) {
+            this.editUserDialogVisible = false;
+            var curr = localStorage.getItem("username");
+            if (curr == this.editUserForm.username) {
+              window.location.reload();
+            } else {
+              this.getList();
+            }
+          }
+        });
+      });
+    },
+    editUserDialogClosed() {
+      this.$refs.editUserFormRef.resetFields();
+      this.areaList = []; //清空省/市/区
+      this.editIsShow = false;
+    },
+    checkList() {
+      this.page = 1;
+      this.getList();
+    },
+  },
+  filters: {
+    formatUserType(value) {
+      switch (value) {
+        case 1:
+          return "超级管理员";
+          break;
+        case 2:
+          return "经销商";
+          break;
+        case 3:
+          return "农林政府单位";
+          break;
+        case 4:
+          return "普通用户";
+          break;
+      }
+    },
+  },
+};
+</script>
+
+<style lang='less' scoped>
+.search-box {
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 10px;
+  .filter-box > div {
+    margin-right: 15px;
+  }
+  .el-input {
+    width: 200px;
+  }
+  .el-date-editor--daterange {
+    width: 222px;
+  }
+}
+.el-card {
+  .img-box {
+    text-align: center;
+    border-bottom: 1px solid #e1e1e1;
+    padding: 15px 0;
+    p {
+      font-size: 14px;
+      font-weight: 800;
+      margin-top: 10px;
+    }
+  }
+  .detail {
+    border-bottom: 1px solid #e1e1e1;
+    padding: 10px 0;
+    padding: 0 20px;
+    p {
+      display: flex;
+      justify-content: space-between;
+      font-size: 13px;
+      line-height: 34px;
+      color: #666;
+      padding: 0 0px;
+    }
+  }
+  .btn {
+    text-align: center;
+    padding: 20px 10px;
+    display: flex;
+    justify-content: space-around;
+    button {
+      // flex: 1;
+      margin: 0 8px;
+      border: 1px solid #17bb89;
+      color: #17bb89;
+      // border-radius: 4px;
+      // font-size: 12px;
+      // padding: 5px 5px;
+      background: #fff;
+      cursor: pointer;
+      i {
+        font-size: 12px;
+        margin-right: 2px;
+      }
+    }
+    button:hover {
+      background: #fff;
+      border: 1px solid #47d9ad;
+      color: #47d9ad;
+    }
+  }
+}
+// 暂无数据
+.expertDiagnosis_referral_units_not {
+  width: 272px;
+  margin: 0 auto;
+}
+</style>

File diff suppressed because it is too large
+ 13586 - 0
src/components/citydata.js


+ 5 - 0
src/main.js

@@ -9,10 +9,15 @@ import router from './router'
 import axios from 'axios'
 Vue.prototype.$axios = axios //全局注册,使用方法为:this.$axios
 
+// 图片裁剪
+import VueCropper from 'vue-cropper'
+Vue.use(VueCropper)
+
 import qs from 'qs'
 Vue.prototype.qs = qs //全局注册,使用方法为:this.qs
 
 Vue.use(ElementUI);
+import './assets/css/global.css'
 
 axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
 axios.defaults.timeout = 30000;

+ 12 - 6
src/pages/EquipList.vue

@@ -33,8 +33,14 @@
               <span>{{ item.device_id }}</span>
             </p>
             <p>
-              适配用户
-              <span>{{ item.device_user || "无" }}</span>
+              在线状态
+              <span :class="item.status == 0 ? 'red' : 'green'">{{
+                item.status == 1 ? "在线" : "离线"
+              }}</span>
+            </p>
+            <p>
+              通道
+              <span>{{ item.jktype }}</span>
             </p>
             <p>
               设备名称
@@ -91,6 +97,7 @@ export default {
         data: this.qs.stringify({
           f_id: this.queryInfo.f_id,
           page: this.queryInfo.page,
+          equip_type:2
         }),
       }).then((res) => {
         if (res.data.data) {
@@ -100,7 +107,6 @@ export default {
       });
     },
     searchChange() {
-      console.log(111);
       this.queryInfo.page = 1;
       this.getList();
     },
@@ -124,7 +130,7 @@ export default {
               }),
             }).then((res) => {
               if (res.data == 0) {
-                this.getList();
+                this.getList() ;
                 this.$message({
                   type: "success",
                   message: "修改成功",
@@ -154,8 +160,9 @@ export default {
 </script>
 
 <style lang='less' scoped>
+.red{color:red}
+.green{color:#5aae22}
 .search-box {
-  padding: 15px 20px;
   .el-input {
     width: 200px;
   }
@@ -207,7 +214,6 @@ export default {
 }
 
 .el-row {
-  padding: 0 20px;
   /deep/.el-card__body {
     padding: 0 20px;
   }

+ 25 - 23
src/pages/Monitor.vue

@@ -12,7 +12,6 @@
           :class="{ 'video-container': true, fScreen: fScreen }"
           ref="videoContainerRef"
         >
-          <!-- 非插件播放 ,默认非插件播放-->
           <div
             :class="{
               videoItem: true,
@@ -24,7 +23,7 @@
             }"
             v-for="count in divNum"
             :key="String(count) + divNum"
-            @click="selectVideo($event, count, 'my-video' + divNum + count)"
+            @click="selectVideo($event, count, 'my-video' + count)"
           >
             <span style="display: none" class="current">{{
               Idlist[count - 1]
@@ -76,7 +75,7 @@
             ></i>
             <div
               style="width: 100%; height: 100%"
-              :id="'my-video' + divNum + count"
+              :id="'my-video' + count"
             ></div>
           </div>
         </div>
@@ -260,7 +259,7 @@
         <el-form-item label="通道" prop="jk_type">
           <el-select v-model="addEquipForm.jk_type" placeholder="请选择">
             <el-option
-              v-for="item in 12"
+              v-for="item in 32"
               :key="item"
               :label="'通道' + item"
               :value="item"
@@ -294,8 +293,8 @@ export default {
       takePhotoDialogVisible: false, //拍照弹框
       Idlist: [], //右侧设备列表
       divMainHeight: "", //视频盒子高度
-      selected: "", //默认不选中视频窗口
-      divName: "", //选中的监控的id
+      selected: null, //默认选中第一台设备
+      divName: "", //默认选中第一台设备
       html: "", //插件播放内容
       picUrl: "", //视频拍照地址
       playBackDialogVisible: false,
@@ -326,6 +325,7 @@ export default {
       addEquipForm: {
         device_id: "",
         jk_type: "",
+        equip_type:2,//1 苗情 2 可视化
       },
     };
   },
@@ -348,7 +348,7 @@ export default {
       this.$axios({
         method: "POST",
         url: "list_camera",
-        data: this.qs.stringify({ page: this.currPage }),
+        data: this.qs.stringify({ page: this.currPage,equip_type:2 }),
       }).then((res) => {
         this.Idlist = res.data.data;
         this.totalPage = Math.ceil(res.data.counts / 12);
@@ -366,7 +366,6 @@ export default {
     },
     //视频分页
     splitPage(str) {
-      this.selected = "";
       this.activeIndex = null;
       if (str == "jian") {
         if (this.currPage > 1) {
@@ -437,33 +436,35 @@ export default {
     },
     //分屏默认显示视频
     initMonitor() {
-      this.selected = ""; //取消监控选中
-      this.activeIndex = null; //取消菜单选中
-      for (let item = 0; item < this.divNum; item++) {
-        if (this.Idlist[item]) {
+      this.id = this.Idlist[0].device_id; //第一台设备id
+      this.videotape = this.Idlist[0].videotape; //第一台是否有回放
+      this.divName = "my-video1"; //第一台选中
+      this.selected = 1; //第一台选中
+      for (let item = 1; item < this.divNum + 1; item++) {
+        if (this.Idlist[item-1]) {
+          console.log(item);
           //避免右侧监控数量少于divNum
           this.$axios({
             url: "addr_camera",
             method: "POST",
             data: this.qs.stringify({
-              device_id: this.Idlist[item].device_id,
-              jk_type: this.Idlist[item].jktype,
+              device_id: this.Idlist[item-1].device_id,
+              jk_type: this.Idlist[item-1].jktype,
             }),
           }).then((res) => {
             var data = eval("(" + res.data + ")");
             var hlsHdSrc = data.hlsHd;
             var rtmpHdSrc = data.rtmp;
             this.$nextTick(() => {
-              let playHtml = `<video id="videoitem${this.divNum}${item}"
+              let playHtml = `<video id="videoitem${item}"
 								 style='width: 100%;height: 100%;' src="${hlsHdSrc}" autoplay  poster='' muted controls playsInline  webkit-playsinline>
-								 </video>`;
-              document.getElementById(
-                "my-video" + this.divNum + (item + 1)
-              ).innerHTML = playHtml;
+                 </video>`;
+                 console.log("my-video" + item);
+              document.getElementById("my-video" + item).innerHTML = playHtml;
               this.$nextTick(() => {
-                this.videoObj[
-                  "videoitem" + this.divNum + item
-                ] = new EZUIKit.EZUIPlayer("videoitem" + this.divNum + item);
+                this.videoObj["videoitem" + item] = new EZUIKit.EZUIPlayer(
+                  "videoitem" + item
+                );
               });
             });
           });
@@ -505,6 +506,7 @@ export default {
     //点击分屏
     splitView(num) {
       this.divNum = num;
+      console.log(this.videoObj);
       for (let item in this.videoObj) {
         console.log(item);
         this.videoObj[item].stop();
@@ -626,7 +628,7 @@ export default {
           data: this.qs.stringify(this.addEquipForm),
         }).then((res) => {
           if (res.data == 1) {
-            this.addEquipDialogVisible=false
+            this.addEquipDialogVisible = false;
             this.getJkList();
           } else {
             this.$message.error(res.data);

+ 6 - 1
src/router/index.js

@@ -4,12 +4,13 @@ import Router from 'vue-router'
 const Index = () => import('@/components/Index')
 const Monitor = () => import('@/pages/Monitor')
 const EquipList = () => import('@/pages/EquipList')
+const UserManger = () => import('@/components/UserManger')
 Vue.use(Router)
 
 export default new Router({
   routes: [{
       path: '',
-      redirect: '/index/list1'
+      redirect: '/index/monitor1'
     },
     // {
     //   path: '/login',
@@ -27,6 +28,10 @@ export default new Router({
           path: 'list1',
           component: EquipList,
         },
+        {
+          path: 'userManger1',
+          component: UserManger
+        },
       ]
     },