Browse Source

提交--用户管理 和院管理员代码

plg 7 months ago
parent
commit
0dda5b188f

BIN
src/assets/img/table/delete.png


BIN
src/assets/img/table/edit.png


BIN
src/assets/img/table/reset.png


BIN
src/assets/img/table/search.png


+ 8 - 5
src/components/Register.vue

@@ -179,7 +179,7 @@ export default {
       this.$http.get(`/org/findAllOrgByPOrgNo`, {}, (res) => {
         //  this.$toast.success({message:'成功'});
         if (res && res.code == 200) {
-          debugger;
+
           //将值赋值给list
           if (res.data.length > 0) {
             let resAdd = this.addPro(res.data);
@@ -275,7 +275,7 @@ export default {
       });
     },
     edit(val) {
-      debugger;
+   debugger;
       this.getChannel();
       this.dialogVisible = true;
       this.isView = false;
@@ -290,7 +290,7 @@ export default {
         {
         },
         (res) => {
-          debugger;
+    
           console.log(res)
           if (res && res.code == 200) {
            //获取返回值
@@ -383,14 +383,16 @@ export default {
           userName: this.ruleForm.name,
           gender: this.ruleForm.sex,
           password: md5(this.ruleForm.password),
+          //roleType     1普通用户    roleType   管理员
+          roleType:'1'
         },
         (res) => {
-          debugger;
+
           this.disableFlagStatus();
           // this.disableFlag = false;
           if (res && res.code == 200) {
             this.dialogVisible = false;
-            debugger
+      
             // this.$toast.success({ message: "成功" });
             //调用父组件的查询方法
             that.$emit("search");
@@ -411,6 +413,7 @@ export default {
       this.userDetailData.orgName=this.groupName; 
       this.userDetailData.userName= this.ruleForm.name;
       this.userDetailData.gender= this.ruleForm.sex;
+      this.userDetailData.userNo= this.ruleForm.studentNumber;
       this.$http.post(
      `/user/addOrUpdateUser`,
         {

+ 520 - 0
src/components/manageRegister.vue

@@ -0,0 +1,520 @@
+<template>
+  <div>
+    <!---lxh-修改密码-->
+    <div class="dig_update">
+      <el-dialog
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        width="40%"
+        style="border-radius: 40px"
+      >
+        <div slot="title">
+          <el-form
+            :model="ruleForm"
+            :rules="rules"
+            :inline="true"
+            ref="ruleForm"
+            label-width="150px"
+            class="demo-ruleForm"
+          >
+            <p v-if="isView" class="dig_title">单独注册</p>
+            <p v-if="!isView" class="dig_title">编辑</p>
+            <div slot=""></div>
+            <div slot="footer"></div>
+            <!-- :show-all-levels="false" -->
+            <el-form-item label="所属组织架构" prop="group">
+              <el-cascader
+                placeholder="请选择组织架构"
+                v-model="ruleForm.group"
+                :options="groupData"
+                 :props="{ checkStrictly: true }"
+               
+                clearable
+              ></el-cascader>
+            </el-form-item>
+            <el-form-item label="学号" prop="studentNumber">
+              <el-input v-model="ruleForm.studentNumber"></el-input>
+            </el-form-item>
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="姓名" prop="name">
+                  <el-input v-model="ruleForm.name" autocomplete="off"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="性别" prop="name">
+                  <el-radio-group v-model="ruleForm.sex" style="margin-left: 20px">
+                    <el-radio label="1">男</el-radio>
+                    <el-radio label="0">女</el-radio>
+                  </el-radio-group>
+                </el-form-item>
+              </el-col>
+            </el-row>
+        
+            <el-form-item  v-if="isView"  label="密码" prop="password">
+              <el-input
+                type="password"
+                v-model="ruleForm.password"
+                autocomplete="off"
+              ></el-input>
+            </el-form-item>
+            <el-form-item  v-if="isView"  label="确认密码" prop="comPassword">
+              <el-input
+                type="password"
+                v-model="ruleForm.comPassword"
+                autocomplete="off"
+              ></el-input>
+            </el-form-item>
+            <div class="dig_button">
+              <el-button type="info" round @click="resetForm('ruleForm')">重置</el-button>
+              <!-- <el-button type="success" round @click="submitForm('ruleForm')"
+                >提交</el-button
+              > -->
+              <el-button type="success" round @click="submitCom()"
+                >提交</el-button
+              >
+            </div>
+          </el-form>
+        </div>
+      </el-dialog>
+    </div>
+  </div>
+</template>
+<script>
+// import { oSessionStorage } from "../../utils/utils";
+import { oSessionStorage } from "../utils/utils";
+import md5 from "md5";
+export default {
+  data() {
+    var validatePass = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("请输入密码"));
+      } else if (value.length < 6) {
+        callback(new Error("密码至少6位"));
+      } else {
+        callback();
+      }
+    };
+    var validateComPass = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("请输入密码"));
+      } else if (value.length < 6) {
+        callback(new Error("密码至少6位"));
+      } else if (value !== this.ruleForm.password) {
+        callback(new Error("两次密码不一致"));
+        // callback();
+      } else {
+        callback();
+      }
+    };
+    var validatePhone = (rule, value, callback) => {
+      let myreg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
+      if (value === "") {
+        callback(new Error("请输入手机号"));
+      } else if (!myreg.test(value)) {
+        callback(new Error("请输入正确格式"));
+      } else {
+        callback();
+      }
+    };
+    return {
+      //编辑返回的值
+      userDetailData:{},
+      //组织架构名字
+      groupName: "",
+      ppData: [],
+      groupData: [],
+      options: [
+        {
+          value: "1",
+          label: "选项1",
+          children: [
+            {
+              value: "11",
+              label: "选项11",
+              children: [{ value: "111", label: "选项111" }],
+            },
+          ],
+        },
+      ],
+      disableFlag: false,
+      phoneFlag: false,
+      flag: 3,
+      dialogVisible: false,
+      //渠道列表
+      channelList: [{ name: "渠道天成", id: "1" }],
+      ruleForm: {
+        //所属组织架构
+        group: "",
+        //学号
+        studentNumber: "",
+        //姓名
+        name: "",
+        //性别
+        sex: "",
+        //密码
+        password: "",
+        comPassword: "",
+      },
+      isView: true,
+      rules: {
+        group: [{ required: true, message: "请选择组织架构", trigger: "blur" }],
+        studentNumber: [{ required: true, message: "请输入学号", trigger: "blur" }],
+        name: [{ required: true, message: "请输入学号", trigger: "blur" }],
+        // password: [{ required: true, message: "请输密码", trigger: "blur" }],
+        password: [{ required: true, validator: validatePass, trigger: "blur" }],
+        comPassword: [{ required: true, validator: validateComPass, trigger: "blur" }],
+      },
+    };
+  },
+  mounted() {
+    let userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
+    this.ruleForm.parentCode = userInfo.invitationCode;
+
+    //获取渠道信息
+
+    // this.ruleForm.type = "3";
+  },
+  methods: {
+    //获取组织架构方法--------------------开始-----------------------
+    getChannel() {
+      this.$http.get(`/org/findAllOrgByPOrgNo`, {}, (res) => {
+        //  this.$toast.success({message:'成功'});
+        if (res && res.code == 200) {
+      
+          //将值赋值给list
+          if (res.data.length > 0) {
+            let resAdd = this.addPro(res.data);
+            this.ppData = JSON.parse(JSON.stringify(resAdd));
+            let forRes = this.arrToTree(resAdd);
+            // console.log('格式化的结构')
+            // console.log(forRes)
+            let resultRes = this.deleteChildren(forRes);
+            console.log("格式化的结构且去掉children");
+            console.log(resultRes);
+            this.groupData = resultRes;
+          } else {
+            this.groupData = [];
+          }
+          // this.channelList = res.data;
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    //z增加
+    addPro(val) {
+      let data = JSON.parse(JSON.stringify(val));
+      for (let i = 0; i < val.length; i++) {
+        data[i].value = val[i].orgNo;
+        data[i].label = val[i].orgName;
+      }
+      return data;
+    },
+    //非递归方式:将平铺数据转换为树形结构数据
+    arrToTree(arr) {
+      let data = arr.filter((item) => {
+        item.children = arr.filter((e) => {
+          return item.orgNo === e.parentOrgNo;
+        });
+        return !item.parentOrgNo;
+      });
+      return data;
+    },
+    //去除转换树形结构数据后存在的空children
+    deleteChildren(arr) {
+      let childs = arr;
+      for (let i = childs.length; i--; i > 0) {
+        if (childs[i].children) {
+          if (childs[i].children.length) {
+            this.deleteChildren(childs[i].children);
+          } else {
+            delete childs[i].children;
+          }
+        }
+      }
+      return arr;
+    },
+    queryOrgName() {
+      for (let i = 0; i < this.ppData.length; i++) {
+        if (this.ruleForm.group[this.ruleForm.group.length-1] == this.ppData[i].orgNo) {
+          this.groupName = this.ppData[i].orgName;
+        }
+      }
+    },
+    //获取组织架构方法--------------------结束-----------------------
+    timeChange(val) {
+      if (val !== null) {
+        //根据时间得到格式化的数据
+        this.ruleForm.birthDate = this.formatterTime(val);
+      }
+    },
+    formatterTime(val) {
+      let date = new Date(val);
+      let year = date.getFullYear();
+      let month = date.getMonth() + 1;
+      month = this.formatterMon(month);
+      let day = date.getDate();
+      day = this.formatterMon(day);
+      return year + "-" + month + "-" + day;
+    },
+    formatterMon(val) {
+      if (val < 10) {
+        return "0" + val;
+      } else {
+        return val;
+      }
+    },
+    open(val) {
+       this.cancle();
+      this.getChannel();
+     
+      this.dialogVisible = true;
+      this.isView = val;
+
+      this.$nextTick(() => {
+        this.$refs.ruleForm.clearValidate();
+      });
+    },
+    edit(val) {
+      this.getChannel();
+      this.dialogVisible = true;
+      this.isView = false;
+      this.queryUserDetail(val.id)
+      //调用查询详情的接口
+    },
+    //调用查询详情的接口
+    queryUserDetail(val){
+      let url = `/user/findUserById?id=${val}`
+      
+      this.$http.get(url,
+        {
+        },
+        (res) => {
+   
+          console.log(res)
+          if (res && res.code == 200) {
+           //获取返回值
+           //根据将数据存储
+           this.userDetailData=res.data;
+           let a =[]
+           for(let i=res.data.orgList.length;i>0;i--){
+                //
+                a.push(res.data.orgList[i-1].orgNo)                      
+           }
+           //回显学号
+           this.ruleForm.studentNumber=res.data.userNo;
+           //回显姓名
+           this.ruleForm.name=res.data.userName
+           //回显性别
+            this.ruleForm.sex=res.data.gender
+           this.ruleForm.group=a;
+          } else {
+            // this.$toast.fail(res.msg);
+            this.$message.error(res.msg);
+          }
+        }
+      );
+    },
+    cancle() {
+      this.$refs["ruleForm"].clearValidate();
+      //清空表单
+      this.ruleForm.group = "";
+      this.ruleForm.name = "";
+      this.ruleForm.studentNumber = "";
+      this.ruleForm.password = "";
+      this.ruleForm.comPassword = "";
+      this.ruleForm.sex = "";
+      this.dialogVisible = false;
+    },
+    disableFlagStatus() {
+      setTimeout(() => {
+        this.disableFlag = false;
+      }, 1500);
+    },
+    submitCom() {
+      if (this.disableFlag) {
+        return;
+      }
+      this.disableFlag = true;
+      let validSp = [];
+      if (this.isView) {
+        validSp = ["group", "studentNumber", "name", "sex", "password", "comPassword"];
+      } else {
+        validSp = ["group", "studentNumber", "name", "sex"];
+      }
+      let aa = [];
+      this.$refs["ruleForm"].validateField(validSp, (valid) => {
+        if (!valid) {
+          aa.push(valid);
+          //判断是编辑还是新增
+          if (this.isView) {
+            if (aa.length == 6) {
+              this.register();
+            } else {
+              this.disableFlagStatus();
+            }
+          } else {
+            if (aa.length == 4) {
+              this.editUserFun();
+            } else {
+              this.disableFlagStatus();
+            }
+          }
+
+          //都校验通过后可以触发注册接口了
+          //调用方法进行入参
+        } else {
+          this.disableFlagStatus();
+        }
+      });
+    },
+    register() {
+      this.queryOrgName();
+      if(this.ruleForm.group.length!=2){
+        this.$message({
+          message:'院管理员请选择二级组织架构',
+          type:'error'
+        })
+        return 
+      }
+      console.log( this.ruleForm.group)
+      let that = this;
+      // this.ruleForm.password = md5(this.ruleForm.password);
+      this.$http.post(
+        `/user/addOrUpdateUser`,
+        {
+          orgNo:this.ruleForm.group[this.ruleForm.group.length-1] ,
+          orgName: this.groupName,
+          userNo: this.ruleForm.studentNumber,
+          userName: this.ruleForm.name,
+          gender: this.ruleForm.sex,
+          password: md5(this.ruleForm.password),
+           //roleType     1普通用户    roleType   管理员
+          roleType:'2'
+        },
+        (res) => {
+       
+          this.disableFlagStatus();
+          // this.disableFlag = false;
+          if (res && res.code == 200) {
+            this.dialogVisible = false;
+       
+            // this.$toast.success({ message: "成功" });
+            //调用父组件的查询方法
+            that.$emit("search");
+          } else {
+            // this.$toast.fail({ message: res.msg });
+            this.$message.error(res.msg);
+          }
+          //清空缓存
+          this.cancle();
+        }
+      );
+    },
+    editUserFun() {
+      let that = this;
+      this.queryOrgName();
+      if(this.ruleForm.group.length!=2){
+        this.$message({
+          message:'院管理员请选择二级组织架构',
+          type:'error'
+        })
+        return 
+      }
+      this.userDetailData.orgNo=this.ruleForm.group[this.ruleForm.group.length-1];
+      this.userDetailData.orgName=this.groupName; 
+      this.userDetailData.userName= this.ruleForm.name;
+      this.userDetailData.gender= this.ruleForm.sex;
+      this.userDetailData.userNo= this.ruleForm.studentNumber;
+      this.$http.post(
+     `/user/addOrUpdateUser`,
+        {
+        ...this.userDetailData
+        },
+        (res) => {
+          this.disableFlagStatus();
+          if (res && res.code == 200) {
+            this.dialogVisible = false;
+            // this.$toast.success({ message: "成功" });
+            //调用父组件的查询方法
+            that.$emit("search");
+            this.$message.success("修改成功");
+          } else {
+            // this.$toast.fail({ message: res.msg });
+            this.$message.error(res.msg);
+          }
+
+          //清空缓存
+
+          //清空缓存
+        }
+      );
+    },
+  },
+};
+</script>
+<style lang="less" scoped>
+.dig_update /deep/.el-cascader {
+  position: relative;
+  font-size: 14px;
+  line-height: 40px;
+  width: 100%;
+}
+.dig_update /deep/.el-dialog {
+  box-shadow: none !important;
+  background: transparent !important;
+}
+.demo-ruleForm /deep/ .el-form-item {
+  margin-right: 10px;
+  vertical-align: top;
+  display: flex !important;
+  flex-direction: column;
+}
+.demo-ruleForm /deep/.el-form-item__label {
+  text-align: left;
+  vertical-align: middle;
+  float: left;
+  font-size: 14px;
+  color: #606266;
+  line-height: 40px;
+  padding: 0 12px 0 0;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+}
+
+.demo-ruleForm /deep/.el-input {
+  width: 100% !important;
+}
+
+.demo-ruleForm /deep/.el-input__inner {
+  width: 100% !important;
+  background-color: #f7f7f7;
+  border: 0px;
+}
+
+.dig_button {
+  display: flex;
+  width: 100%;
+  justify-content: space-around;
+}
+
+.demo-ruleForm {
+  background-color: #ffffff;
+  // border-radius: 20px;
+  margin-right: -10px;
+  margin-top: -10px;
+  padding-right: 100px;
+  padding-left: 100px;
+  border-radius: 20px;
+  padding-top: 20px;
+  padding-bottom: 40px;
+  .dig_title {
+    margin-bottom: 30px;
+    text-align: center;
+    font-weight: 700;
+  }
+}
+
+
+</style>

+ 19 - 0
src/styles/public.css

@@ -216,6 +216,20 @@
   
 }
 
+
+/*表格列表按钮颜色*/
+
+.el-button--text{
+  cursor: pointer;
+  color:#00BF78 ;  
+  font-weight: 700;
+}
+
+.el-button--text:focus, .el-button--text:hover{
+  cursor: pointer;
+  color:#00BF78 ;
+}
+
 /* 清空按钮颜色  */
 
 .el-button--info{
@@ -415,4 +429,9 @@
 
 .pag_class{
   text-align: end;
+}
+
+.el-table tr {
+  background-color: #FFF;
+  height: 50px !important;
 }

+ 479 - 323
src/views/manage/channelInfo/channelInfo.vue

@@ -1,124 +1,123 @@
 <template>
   <div class="record-warp">
     <div class="record-main">
-      <!-- <el-row>
+      <el-row>
         <el-col :span="24">
           <div class="search-head">
-            <span>渠道:</span>
-            <el-select v-model="channel" placeholder="请选择渠道">
+            <el-input v-model="name" clearable placeholder="请输入姓名"></el-input
+            >&nbsp;&nbsp;&nbsp;&nbsp;
+
+            <el-input
+              v-model="studentNumber"
+              clearable
+              placeholder="请输入账号"
+            ></el-input
+            >&nbsp;&nbsp;&nbsp;&nbsp;
+            <el-cascader
+              placeholder="请选择组织架构"
+              v-model="group"
+              :options="groupData"
+              :props="{ checkStrictly: true }"
+              clearable
+            ></el-cascader>
+            <!-- <el-select v-model="channel" placeholder="请选择所属组织架构">
               <el-option
                 :label="item.name"
                 :value="item.id"
                 v-for="item in channelList"
                 :key="item.id"
-              ></el-option> </el-select
-            >&nbsp;&nbsp;&nbsp;&nbsp;
-            <el-button type="primary" icon="el-icon-search" @click="searchTarget"
+              ></el-option> 
+            </el-select> -->
+            &nbsp;&nbsp;&nbsp;&nbsp;
+            <!-- <span style="font-size: 16px;">性别:</span>&nbsp;&nbsp; -->
+            <div style="display: flex; flex-direction: row; align-items: center">
+              <span
+                style="
+                  font-size: 16px;
+                  margin-right: 10px;
+                  line-height: 20px;
+                  min-width: 40px;
+                "
+                >性别:</span
+              >
+              <el-radio v-model="sex" label="1">男</el-radio>
+              <el-radio v-model="sex" label="0">女</el-radio>
+            </div>
+            &nbsp;&nbsp;&nbsp;&nbsp;
+            <el-button type="primary" round icon="el-icon-search" @click="searchTarget"
               >搜索</el-button
             >
-            <el-button type="primary" icon="el-icon-delete-solid" @click="clearSearch"
-              >清空</el-button
-            >
+            <el-button type="info" round @click="clearSearch">清空</el-button>
+            <!-- <el-button type="success" round class="add_class" @click="fileVisible = true"
+              >批量导入</el-button
+            > -->
+            <el-button type="success" class="add_class" icon="el-icon-plus" round @click="addUser">添加管理员</el-button>
           </div>
         </el-col>
-      </el-row> -->
-      <!-- <el-row class="add_user_class">
+      </el-row>
+      <el-row class="add_user_class">
         <el-col :span="24">
-          <div class="search-head">
-            <el-button type="primary" icon="el-icon-plus" @click="addUser"
-              >新增</el-button
-            >
-          </div>
+          <div class="search-head"></div>
         </el-col>
-      </el-row> -->
+      </el-row>
 
       <div class="table-content">
         <el-table
           :data="tableData"
           :row-style="{ height: '0px' }"
           :cell-style="{ padding: '5px' }"
+          :header-cell-style="{ background: '#F8F8F8', color: '#606266' }"
         >
-          <!-- <el-table-column prop="channelName" label="渠道" align="center" width="">
+          <!-- <el-table-column prop="name" label="姓名" align="center" width=""  show-overflow-tooltip>
           </el-table-column> -->
-          <el-table-column prop="used" label="已使用次数" align="center" width="">
-          </el-table-column>
-          <el-table-column prop="singlePrice" label="单次价格" align="center" width="">
-          </el-table-column>
-          <el-table-column
-            prop="rechargeUsed"
-            label="充值使用次数"
-            align="center"
-            width=""
-          >
-          </el-table-column>
-          <el-table-column prop="unuse" label="剩余次数" align="center" width="">
-          </el-table-column>
-          <el-table-column
-            prop="rechargeCount"
-            label="累计充值次数"
-            align="center"
-            width=""
-          >
-          </el-table-column>
-          <el-table-column prop="signAmount" label="签约单次金额" align="center" width="">
-          </el-table-column>
           <el-table-column
-            prop="effectiveDate"
-            label="有效时间起"
+            show-overflow-tooltip
+            prop="userName"
+            label="姓名"
             align="center"
             width=""
           >
           </el-table-column>
-          <el-table-column
-            prop="expirationDate"
-            label="有效时间止"
-            align="center"
-            width=""
-          >
+          <el-table-column prop="userNo" label="账号" align="center" width="">
           </el-table-column>
-
           <el-table-column
-            prop="status"
-            label="状态"
+            prop="gender"
+            label="性别"
             align="center"
-            :formatter="formatterStatus"
             width=""
+            :formatter="genderFun"
           >
           </el-table-column>
-          <el-table-column prop="remarks" label="备注" align="center" width="">
+          <el-table-column prop="orgName" label="所属组织架构" align="center" width="">
           </el-table-column>
-          <!-- <el-table-column
-            prop="selfPage"
-            label="自定义首尾页"
-            align="center"
-            :formatter="formatterSelfPage"
-            width=""
-          >
-          </el-table-column> -->
-          <!-- <el-table-column prop="isDelete" label="删除状态" align="center" :formatter="formatterDelete" width="">
-                      </el-table-column> -->
-          <el-table-column label="操作" width="200px" align="center" fixed="right">
+          <el-table-column label="操作" width="510px" align="center">
             <template slot-scope="scope">
-              <el-button
-                @click="viewUser(scope.row)"
-                v-if="scope.row.state != 0"
-                type="text"
-                size="small"
-                >查看</el-button
-              >
-              <el-button
-                type="text"
-                size="small"
-                v-if="scope.row.state != 0"
-                @click="editUser(scope.row)"
-                >编辑</el-button
-              >
+              <div class="detail_button_out">
+                <div class="detail_button" @click="viewUser(scope.row)">
+                  <img src="../../../assets/img/table/search.png" />
+                  <span> 查看个人详情 </span>
+                </div>
+                <div class="detail_button" @click="editUser(scope.row)">
+                  <img src="../../../assets/img/table/edit.png" />
+                  <span> 编辑编辑个人详情 </span>
+                </div>
+                <!-- 弹出提示框 提示是否确认重置-->
+                <div class="detail_button" @click="resetUser(false, scope.row)">
+                  <img src="../../../assets/img/table/reset.png" />
+                  <span> 重置密码 </span>
+                </div>
+                <!-- 弹出提示框 提示是否确认删除-->
 
+                <div class="detail_button" @click="resetUser(true, scope.row)">
+                  <img src="../../../assets/img/table/delete.png" />
+                  <span> 删除 </span>
+                </div>
+              </div>
               <!-- <el-popconfirm
                 v-if="scope.row.state != 0"
                 title="确定删除吗?"
                 placement="top"
-                @confirm="deleteChannel(scope.$index, scope.row)"
+                @confirm="deleteUser(scope.$index, scope.row)"
               >
                 <el-button
                   size="small"
@@ -127,140 +126,143 @@
                   slot="reference"
                   >删除</el-button
                 >
-              </el-popconfirm> -->
-              <el-button
-                type="text"
-                size="small"
+              </el-popconfirm>
+              <el-popconfirm
                 v-if="scope.row.state != 0"
-                @click="viewPoster(scope.row)"
-                >查看海报</el-button
+                title="密码将重置为123456"
+                placement="top"
+                @confirm="resetUser(scope.$index, scope.row)"
               >
-              <!-- <el-button
-                type="text"
-                size="small"
-                v-if="scope.row.state != 0"
-                @click="topUpCount(scope.row)"
-                >充值次数</el-button
-              > -->
+                <el-button
+                  size="small"
+                  style="margin-left: 10px"
+                  type="text"
+                  slot="reference"
+                  >重置密码</el-button
+                >
+              </el-popconfirm> -->
             </template>
           </el-table-column>
         </el-table>
       </div>
-
+      <!-- small -->
       <el-pagination
-        small
+        class="pag_class"
         background
+        @size-change="handleSizeChange"
         @current-change="handleCurrentChange"
         :current-page.sync="pageNum"
-        layout="total, prev, pager, next"
+        layout="total, sizes, prev, pager, next"
         :page-size="pageSize"
+        :page-sizes="[10, 20, 50, 100]"
         :total="total"
       >
       </el-pagination>
       <!-- <el-pagination small background layout="total prev, pager, next" :total="36">
-          </el-pagination> -->
+      </el-pagination> -->
     </div>
-    <ContractChannelRegister ref="register" @search="searchTarget" />
-    <ContractPoster ref="poster" @search="searchTarget" />
-    <ContractTopUp ref="topUp" @search="searchTarget" />
-
-    <el-dialog title="查看" :visible.sync="centerDialogVisible" width="60%" center>
-      <div>
-        <el-row>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">已使用次数</div>
-              <div class="user_out_subNext">
-                {{ detailObj.used }}
-              </div>
-            </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">单次价格</div>
-              <div class="user_out_subNext">
-                {{ detailObj.singlePrice }}
-              </div>
-            </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">充值使用次数</div>
-              <div class="user_out_subNext">
-                {{ detailObj.rechargeUsed }}
-              </div>
+    <ManageRegister ref="register" @search="searchTarget" />
+    <el-dialog
+      class="dig_update"
+      :visible.sync="centerDialogVisible"
+      width="40%"
+      center
+      style="border-radius: 40px"
+    >
+      <div slot="title">
+        <div class="demo-ruleForm">
+          <p class="dig_title">详情</p>
+          <div class="user_out">
+            <div class="user_out_sub">姓名</div>
+            <div class="user_out_subNext">
+              {{ view.name }}
             </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">剩余次数</div>
-              <div class="user_out_subNext">
-                {{ detailObj.unuse }}
-              </div>
-            </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">累计充值次数</div>
-              <div class="user_out_subNext">
-                {{ detailObj.rechargeCount }}
-              </div>
-            </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">签约单次金额</div>
-              <div class="user_out_subNext">
-                {{ detailObj.signAmount }}
-              </div>
-            </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">有效时间起</div>
-              <div class="user_out_subNext">
-                {{ detailObj.effectiveDate }}
-              </div>
-            </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">有效时间止</div>
-              <div class="user_out_subNext">
-                {{ detailObj.expirationDate }}
-              </div>
-            </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">状态</div>
-              <div class="user_out_subNext">
-                {{ detailObj.status == "1" ? "签约" : "解约" }}
-              </div>
+          </div>
+          <div class="user_out">
+            <div class="user_out_sub">学号</div>
+            <div class="user_out_subNext">
+              {{ view.studentNumber }}
             </div>
-          </el-col>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub">备注</div>
-              <div class="user_out_subNext">
-                {{ detailObj.remarks }}
-              </div>
+          </div>
+          <div class="user_out">
+            <div class="user_out_sub">性别</div>
+            <div class="user_out_subNext">
+              {{ view.sex }}
             </div>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-            <div class="user_out">
-              <div class="user_out_sub" style="height: 200px">海报背景图</div>
-              <div class="user_out_subNext">
-                <el-image
-                  :src="detailObj.background"
-                  style="width: 150px; height: 150px"
-                />
-              </div>
+          </div>
+          <div class="user_out">
+            <div class="user_out_sub">组织架构</div>
+            <div class="user_out_subNext">
+              {{ view.orgName }}
             </div>
-          </el-col>
-        </el-row>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+
+    <el-dialog
+      class="dig_update"
+      :visible.sync="resetVisible"
+      width="30%"
+      center
+      style="border-radius: 40px"
+    >
+      <div slot="title">
+        <div class="demo-ruleForm">
+          <p v-show="!isDelete" class="dig_title">重置密码</p>
+          <p v-show="isDelete" class="dig_title">删除用户</p>
+          <p v-show="!isDelete">重置密码后密码为123456</p>
+          <p v-show="isDelete">确认将删除{{ userName }}用户?</p>
+          <div class="dig_button">
+            <el-button type="info" round @click="cancle()">取消</el-button>
+            <!-- <el-button type="success" round @click="submitForm('ruleForm')"
+                >提交</el-button
+              > -->
+            <el-button type="success" round @click="submitCom()">确定</el-button>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+    <el-dialog
+      class="dig_update"
+      :visible.sync="fileVisible"
+      width="40%"
+      center
+      style="border-radius: 40px"
+    >
+      <div slot="title">
+        <div class="demo-ruleForm">
+          <p v-show="!isDelete" class="dig_title">批量导入</p>
+
+          <el-upload
+            class="upload-demo"
+            drag
+            :action="basePath + '/user/userImport'"
+            :on-success="fileSuccess"
+            :on-error="fileError"
+          >
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+            <div class="el-upload__tip" slot="tip">建议文件不超过500kb</div>
+          </el-upload>
+          <a
+            style="
+              display: flex;
+              margin-top: 20px;
+              margin-bottom: 20px;
+              color: #409eff;
+              cursor: pointer;
+            "
+            :href="basePath + '/user/templateDownload'"
+          >
+            下载模版
+          </a>
+          <!-- <div class="dig_button">
+            <el-button type="info" round @click="cancle()">取消</el-button>
+     
+            <el-button type="success" round @click="submitCom()">确定</el-button>
+          </div> -->
+        </div>
       </div>
     </el-dialog>
   </div>
@@ -268,18 +270,51 @@
 
 <script>
 import { oSessionStorage } from "../../../utils/utils";
-import contractChannelRegister from "../../../components/ContractChannelRegister.vue";
-
-import contractPoster from "../../../components/ContractPoster.vue";
-import contractTopUp from "../../../components/ContractTopUp.vue";
+import manageRegister from "../../../components/manageRegister.vue";
+import { basePath } from "../../../utils/http";
 export default {
-  name: "channelManagement",
+  name: "userManage",
   components: {
-    ContractChannelRegister: contractChannelRegister,
-    ContractPoster: contractPoster,
+    ManageRegister: manageRegister,
   },
   data() {
     return {
+      basePath: basePath,
+      //上传文件的弹出款的标志
+      fileVisible: false,
+      //判断点击的是重置密码还是点击删除
+      isDelete: false,
+      //重置密码需要调用个userId
+      userId: "",
+      //充值密码使用userName
+      userName: "",
+      //重置密码弹出框
+      resetVisible: false,
+      //根据名称搜索
+      name: "",
+      //搜索的用户编号
+      studentNumber: "",
+      //搜索的组织架构
+      // 搜索需要的性别
+      sex: "",
+
+      group: "",
+      ppData: [],
+      groupData: [],
+      options: [
+        {
+          value: "1",
+          label: "选项1",
+          children: [
+            {
+              value: "11",
+              label: "选项11",
+              children: [{ value: "111", label: "选项111" }],
+            },
+          ],
+        },
+      ],
+
       centerDialogVisible: false,
       editUserFlag: false,
       startTime: "",
@@ -291,21 +326,16 @@ export default {
       keyword: "",
       tableData: [],
       userInfo: {}, //用户信息
-      userId: "", //用户id
-      name: "", //根据名称搜索
-      userName: "", //根据昵称搜索
-      hospitalOrDepartment: "", //医院科室
 
       invitationCode: "",
       roleType: "0",
       type: 0,
       view: {
         name: "",
-        userName: "",
-        channelId: "",
-        role: "",
+        studentNumber: "",
+        sex: "",
+        orgName: "",
       },
-      detailObj: {},
       channel: "",
       channelList: [{ name: "渠道天成", id: "1" }],
     };
@@ -313,29 +343,8 @@ export default {
   created() {},
   mounted() {
     this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
-    console.log(this.userInfo);
 
-    if (this.userInfo.type == "1") {
-      this.channel = "";
-    } else if (this.userInfo.type == "0") {
-      this.channel = this.userInfo.channelId;
-    }
-    this.invitationCode = this.userInfo.invitationCode;
     this.getChannel();
-    //判断是超级管理员吗
-    if (this.userInfo.roleType == "1") {
-      this.type = 0;
-    } else if (this.userInfo.roleType == "3") {
-      //如果登录的是代理用户
-      this.type = 4;
-    } else if (this.userInfo.roleType == "2") {
-      this.type = 5;
-    }
-
-    if (this.$route.query.invitationCode) {
-      this.invitationCode = this.$route.query.invitationCode;
-      this.type = this.$route.query.type;
-    }
     if (!this.userInfo) {
       //如果用户信息不存在跳转登陆页
       this.$router.push({ path: "/" });
@@ -343,109 +352,185 @@ export default {
     this.searchTarget();
   },
   methods: {
-    //充值次数
-    topUpCount(row) {
-      // console.log(this.$refs.topUp)
-      this.$refs.topUp.open(row.id);
+    //文件上传成功
+    fileSuccess(res) {
+  
+
+      if (res.code == 200) {
+        this.searchTarget();
+        this.$message({
+          message:res.msg,
+          type: "success",
+        });
+      }else{
+        this.$message({
+          message:res.msg,
+          type: 'error',
+        });
+      }
+      //查询列表
     },
-    //查看海报
-    viewPoster(row) {
-      this.$refs.poster.open(row);
+    //文件上传失败
+    fileError() {
+      this.$message({
+        message: "上传失败",
+        type: "error",
+      });
+    },
+    cancle() {
+      this.resetVisible = false;
     },
-    //格式化自定义首尾页
-    formatterSelfPage(row) {
-      if (row.selfPage == "0") {
-        return "否";
+    //提交文本
+    submitCom() {
+      //判断当前是否是
+      if (this.isDelete) {
+        this.deleteUser();
+        //调用删除方法
       } else {
-        return "是";
+        this.resetFun();
+        // 调用重置密码方法
       }
     },
-    //获取渠道信息
+    //性别---
+    genderFun(val) {
+      let sex = val.gender;
+      if (sex == "1") {
+        return "男";
+      } else if (sex == "0") {
+        return "女";
+      } else {
+        return sex;
+      }
+    },
+    //每页多少条
+    handleSizeChange(val) {
+      console.log(`每页 ${val} 条`);
+      //将首页重置为1时---且总条数变化
+      //设置为当前总条数
+    },
+    //获取组织架构方法--------------------开始-----------------------
     getChannel() {
-      this.$http.get(`/channel/findAll`, {}, (res) => {
+      this.$http.get(`/org/findAllOrgByPOrgNo`, {}, (res) => {
         //  this.$toast.success({message:'成功'});
         if (res && res.code == 200) {
           //将值赋值给list
-          this.channelList = res.data;
+          if (res.data.length > 0) {
+            let resAdd = this.addPro(res.data);
+            this.ppData = JSON.parse(JSON.stringify(resAdd));
+            let forRes = this.arrToTree(resAdd);
+            // console.log('格式化的结构')
+            // console.log(forRes)
+            let resultRes = this.deleteChildren(forRes);
+            console.log("格式化的结构且去掉children");
+            console.log(resultRes);
+            this.groupData = resultRes;
+          } else {
+            this.groupData = [];
+          }
+          // this.channelList = res.data;
         } else {
           this.$message.error(res.msg);
         }
       });
     },
-    //员工管理
-    userManage(row) {
-      this.$router.push({ path: "/manage/staff", query: { channelId: row.id } });
+    //z增加
+    addPro(val) {
+      let data = JSON.parse(JSON.stringify(val));
+      for (let i = 0; i < val.length; i++) {
+        data[i].value = val[i].orgNo;
+        data[i].label = val[i].orgName;
+      }
+      return data;
+    },
+    //非递归方式:将平铺数据转换为树形结构数据
+    arrToTree(arr) {
+      let data = arr.filter((item) => {
+        item.children = arr.filter((e) => {
+          return item.orgNo === e.parentOrgNo;
+        });
+        return !item.parentOrgNo;
+      });
+      return data;
     },
-    //格式化状态
-    formatterStatus(row) {
-      if (row.status == "1") {
-        return "签约";
-      } else if (row.status == "0") {
-        return "解约";
-      } else {
-        return "";
+    //去除转换树形结构数据后存在的空children
+    deleteChildren(arr) {
+      let childs = arr;
+      for (let i = childs.length; i--; i > 0) {
+        if (childs[i].children) {
+          if (childs[i].children.length) {
+            this.deleteChildren(childs[i].children);
+          } else {
+            delete childs[i].children;
+          }
+        }
       }
+      return arr;
     },
+    //获取组织架构方法--------------------结束-----------------------
     formatterDelete(row) {
-      if (row.isDelete == 0) {
-        return "正常";
-      } else {
+      if (row.state == 0) {
         return "已删除";
+      } else {
+        return "正常";
       }
     },
-    resetUser(index, val) {
-      console.log(val);
-      this.$http.get(`/user/reset/${val.id}`, {}, (res) => {
-        //  this.$toast.success({message:'成功'});
-        if (res && res.code == 200) {
-          this.$message.success("重置成功");
-          this.searchTarget();
-        } else {
-          this.$message.error(res.msg);
-        }
-      });
+    resetUser(flag, val) {
+      this.resetVisible = true;
+      this.isDelete = flag;
+      this.userId = val.id;
+      this.userName = val.userName;
+      //当前用户id
+
       //重置密码
     },
     editUser(row) {
       this.editRegisterUser(row);
     },
     viewUser(row) {
-      this.detailObj = row;
+      this.view.name = row.userName;
+      this.view.studentNumber = row.userNo;
+      this.view.sex = row.gender == "0" ? "女" : "男";
+      this.view.orgName = row.orgName;
       this.centerDialogVisible = true;
     },
     addUser() {
       this.addRegisterUser(true);
     },
     clearSearch() {
-      this.channel = "";
+      this.name = "";
+      //搜索的用户编号
+      this.studentNumber = "";
+      //搜索的组织架构
+      // 搜索需要的性别
+      this.sex = "";
+      this.group = "";
       this.searchTarget();
     },
-    formatterRole(val) {
-      if (val.type == "1") {
-        return "超级管理员";
-      } else {
-        return "渠道用户";
-      }
-    },
 
-    forma(val) {
-      if (val.gender == "0") {
-        return "男";
-      } else {
-        return "女";
-      }
-    },
     addRegisterUser(val) {
       this.$refs.register.open(val);
     },
     editRegisterUser(val) {
       this.$refs.register.edit(val);
     },
-    deleteChannel(index, row) {
-      this.$http.delete(`/sign/delete/${row.id}`, {}, (res) => {
+    resetFun() {
+      this.$http.get(`/user/resetPassword?userId=${this.userId}`, {}, (res) => {
+        //  this.$toast.success({message:'成功'});
+        if (res && res.code == 200) {
+          this.resetVisible = false;
+          this.$message.success("重置成功");
+          this.searchTarget();
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    deleteUser() {
+      this.$http.get(`/user/delete?userId=${this.userId}`, {}, (res) => {
         //  this.$toast.success({message:'成功'});
         if (res && res.code == 200) {
           this.$message.success("删除成功");
+          this.resetVisible = false;
           this.searchTarget();
         } else {
           this.$message.error("删除失败");
@@ -459,22 +544,15 @@ export default {
     },
     //根据现有情况进行搜索
     searchList() {
-      //  let url =``
-      let data = {};
-      if (this.channel == "" || this.channel == null) {
-        data = {
-          pageNum: this.pageNum,
-          pageSize: this.pageSize,
-        };
-      } else {
-        data = {
-          pageNum: this.pageNum,
-          pageSize: this.pageSize,
-          channelId: this.channel,
-        };
-      }
-      this.$http.post(`/sign/find`, data, (res) => {
-        // console.log(res,'用户测试记录')
+      let url = `/user/findAdminUserListByPage?pageSize=${this.pageSize}&pageNum=${
+        this.pageNum
+      }${this.sex == "" ? "" : `&gender=${this.sex}`}${
+        this.group.length == 0 ? "" : `&orgNo=${this.group[this.group.length - 1]}`
+      }${this.name == "" ? "" : `&userName=${this.name}`}${
+        this.studentNumber == "" ? "" : `&userNo=${this.studentNumber}`
+      }`;
+      this.$http.get(url, {}, (res) => {
+        console.log(res);
         if (res && res.code == 200) {
           this.tableData = res.data.content;
           this.total = res.data.totalElements;
@@ -502,36 +580,28 @@ export default {
       oSessionStorage.removeItem("token");
       this.$router.push({ path: "/" });
     },
-    //点击日历获取日期
-    getDate(param) {
-      // console.log(param,"日期。。。")
-      this.userRecord(param.dateStr);
-    },
+
     //点击获取月出勤次数
     getTimes(param) {
       this.monthTimes = param;
     },
-    // 用户测试记录显示
-    userRecord(date) {
-      this.$http.get(
-        `gameRecord/findListByUserIdAndDate/${this.userId}/${date}`,
-        {},
-        (res) => {
-          // console.log(res,'用户测试记录')
-          if (res && res.code == 200) {
-            this.listData = res.data;
-          } else {
-            this.$toast.fail(res.msg);
-          }
-        }
-      );
-    },
   },
 };
 </script>
 
 <style lang="less" scoped>
 @import "../../../styles/theme.less";
+.pag_class {
+  text-align: end;
+}
+
+.pag_class /deep/.el-input__inner {
+  width: 100% !important;
+}
+.pag_class /deep/.el-pagination--small span:not([class*="suffix"]) {
+  height: 22px;
+  line-height: 28px !important;
+}
 
 .record-warp {
   width: 100%;
@@ -589,4 +659,90 @@ export default {
   padding-left: 10px;
   flex: 3;
 }
+.detail_button_out {
+  display: flex;
+  justify-content: space-around;
+  .detail_button {
+    display: flex;
+    align-items: center;
+    cursor: pointer;
+    letter-spacing: 2px;
+    img {
+      width: 15px;
+      margin-right: 5px;
+    }
+    span {
+      color: #00bf78;
+      // font-weight: 600;
+    }
+  }
+}
+
+//弹出框样式
+
+.dig_update /deep/.el-cascader {
+  position: relative;
+  font-size: 14px;
+  line-height: 40px;
+  width: 100%;
+}
+.dig_update /deep/.el-dialog {
+  box-shadow: none !important;
+  background: transparent !important;
+}
+.demo-ruleForm /deep/ .el-form-item {
+  margin-right: 10px;
+  vertical-align: top;
+  display: flex !important;
+  flex-direction: column;
+}
+.demo-ruleForm /deep/.el-dialog__header {
+  background-color: #ffffff;
+  padding-left: 140px !important;
+}
+.demo-ruleForm /deep/.el-form-item__label {
+  text-align: left;
+  vertical-align: middle;
+  float: left;
+  font-size: 14px;
+  color: #606266;
+  line-height: 40px;
+  padding: 0 12px 0 0;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+}
+
+.demo-ruleForm /deep/.el-input {
+  width: 100% !important;
+}
+
+.demo-ruleForm /deep/.el-input__inner {
+  width: 100% !important;
+  background-color: #f7f7f7;
+  border: 0px;
+}
+
+.dig_button {
+  margin-top: 40px;
+  display: flex;
+  width: 100%;
+  justify-content: space-around;
+}
+
+.demo-ruleForm {
+  background-color: #ffffff;
+  // border-radius: 20px;
+  margin-right: -10px;
+  margin-top: -10px;
+  padding-right: 100px;
+  padding-left: 100px;
+  border-radius: 20px;
+  padding-top: 20px;
+  padding-bottom: 20px;
+  .dig_title {
+    margin-bottom: 30px;
+    text-align: center;
+    font-weight: 700;
+  }
+}
 </style>

+ 319 - 115
src/views/manage/userManage.vue

@@ -48,7 +48,9 @@
               >搜索</el-button
             >
             <el-button type="info" round @click="clearSearch">清空</el-button>
-            <el-button type="success" round class="add_class">批量导入</el-button>
+            <el-button type="success" round class="add_class" @click="fileVisible = true"
+              >批量导入</el-button
+            >
             <el-button type="info" round @click="addUser">单独注册</el-button>
           </div>
         </el-col>
@@ -78,28 +80,40 @@
           </el-table-column>
           <el-table-column prop="userNo" label="学号" align="center" width="">
           </el-table-column>
-          <el-table-column prop="gender" label="性别" align="center" width="" :formatter="genderFun">
+          <el-table-column
+            prop="gender"
+            label="性别"
+            align="center"
+            width=""
+            :formatter="genderFun"
+          >
           </el-table-column>
           <el-table-column prop="orgName" label="所属组织架构" align="center" width="">
           </el-table-column>
           <el-table-column label="操作" width="510px" align="center">
             <template slot-scope="scope">
-              <el-button
-                @click="viewUser(scope.row)"
-                v-if="scope.row.state != 0"
-                type="text"
-                size="small"
-                >查看</el-button
-              >
-              <el-button
-                type="text"
-                size="small"
-                v-if="scope.row.state != 0"
-                @click="editUser(scope.row)"
-                >编辑</el-button
-              >
+              <div class="detail_button_out">
+                <div class="detail_button" @click="viewUser(scope.row)">
+                  <img src="../../assets/img/table/search.png" />
+                  <span> 查看个人详情 </span>
+                </div>
+                <div class="detail_button" @click="editUser(scope.row)">
+                  <img src="../../assets/img/table/edit.png" />
+                  <span> 编辑编辑个人详情 </span>
+                </div>
+                <!-- 弹出提示框 提示是否确认重置-->
+                <div class="detail_button" @click="resetUser(false, scope.row)">
+                  <img src="../../assets/img/table/reset.png" />
+                  <span> 重置密码 </span>
+                </div>
+                <!-- 弹出提示框 提示是否确认删除-->
 
-              <el-popconfirm
+                <div class="detail_button" @click="resetUser(true, scope.row)">
+                  <img src="../../assets/img/table/delete.png" />
+                  <span> 删除 </span>
+                </div>
+              </div>
+              <!-- <el-popconfirm
                 v-if="scope.row.state != 0"
                 title="确定删除吗?"
                 placement="top"
@@ -126,7 +140,7 @@
                   slot="reference"
                   >重置密码</el-button
                 >
-              </el-popconfirm>
+              </el-popconfirm> -->
             </template>
           </el-table-column>
         </el-table>
@@ -148,36 +162,116 @@
       </el-pagination> -->
     </div>
     <Register ref="register" @search="searchTarget" />
-    <el-dialog title="查看" :visible.sync="centerDialogVisible" width="60%" center>
-      <div>
-        <div class="user_out">
-          <div class="user_out_sub">姓名</div>
-          <div class="user_out_subNext">
-            {{ view.name }}
+    <el-dialog
+      class="dig_update"
+      :visible.sync="centerDialogVisible"
+      width="40%"
+      center
+      style="border-radius: 40px"
+    >
+      <div slot="title">
+        <div class="demo-ruleForm">
+          <p class="dig_title">详情</p>
+          <div class="user_out">
+            <div class="user_out_sub">姓名</div>
+            <div class="user_out_subNext">
+              {{ view.name }}
+            </div>
           </div>
-          <div class="user_out_sub">学号</div>
-          <div class="user_out_subNext">
-            {{ view.userName }}
+          <div class="user_out">
+            <div class="user_out_sub">学号</div>
+            <div class="user_out_subNext">
+              {{ view.studentNumber }}
+            </div>
           </div>
-        </div>
-        <div class="user_out">
-          <div class="user_out_sub">性别</div>
-          <div class="user_out_subNext">
-            {{ view.channelName }}
+          <div class="user_out">
+            <div class="user_out_sub">性别</div>
+            <div class="user_out_subNext">
+              {{ view.sex }}
+            </div>
+          </div>
+          <div class="user_out">
+            <div class="user_out_sub">组织架构</div>
+            <div class="user_out_subNext">
+              {{ view.orgName }}
+            </div>
           </div>
-          <div class="user_out_sub">组织架构</div>
-          <div class="user_out_subNext">
-            {{ view.role }}
+        </div>
+      </div>
+    </el-dialog>
+
+    <el-dialog
+      class="dig_update"
+      :visible.sync="resetVisible"
+      width="30%"
+      center
+      style="border-radius: 40px"
+    >
+      <div slot="title">
+        <div class="demo-ruleForm">
+          <p v-show="!isDelete" class="dig_title">重置密码</p>
+          <p v-show="isDelete" class="dig_title">删除用户</p>
+          <p v-show="!isDelete">重置密码后密码为123456</p>
+          <p v-show="isDelete">确认将删除{{ userName }}用户?</p>
+          <div class="dig_button">
+            <el-button type="info" round @click="cancle()">取消</el-button>
+            <!-- <el-button type="success" round @click="submitForm('ruleForm')"
+                >提交</el-button
+              > -->
+            <el-button type="success" round @click="submitCom()">确定</el-button>
           </div>
         </div>
       </div>
     </el-dialog>
+    <el-dialog
+      class="dig_update"
+      :visible.sync="fileVisible"
+      width="40%"
+      center
+      style="border-radius: 40px"
+    >
+      <div slot="title">
+        <div class="demo-ruleForm">
+          <p v-show="!isDelete" class="dig_title">批量导入</p>
+
+          <el-upload
+            class="upload-demo"
+            drag
+            :action="basePath + '/user/userImport'"
+            :on-success="fileSuccess"
+            :on-error="fileError"
+          >
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+            <div class="el-upload__tip" slot="tip">建议文件不超过500kb</div>
+          </el-upload>
+          <a
+            style="
+              display: flex;
+              margin-top: 20px;
+              margin-bottom: 20px;
+              color: #409eff;
+              cursor: pointer;
+            "
+            :href="basePath + '/user/templateDownload'"
+          >
+            下载模版
+          </a>
+          <!-- <div class="dig_button">
+            <el-button type="info" round @click="cancle()">取消</el-button>
+     
+            <el-button type="success" round @click="submitCom()">确定</el-button>
+          </div> -->
+        </div>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { oSessionStorage } from "../../utils/utils";
 import register from "../../components/Register.vue";
+import { basePath } from "../../utils/http";
 export default {
   name: "userManage",
   components: {
@@ -185,6 +279,17 @@ export default {
   },
   data() {
     return {
+      basePath: basePath,
+      //上传文件的弹出款的标志
+      fileVisible: false,
+      //判断点击的是重置密码还是点击删除
+      isDelete: false,
+      //重置密码需要调用个userId
+      userId: "",
+      //充值密码使用userName
+      userName: "",
+      //重置密码弹出框
+      resetVisible: false,
       //根据名称搜索
       name: "",
       //搜索的用户编号
@@ -221,17 +326,15 @@ export default {
       keyword: "",
       tableData: [],
       userInfo: {}, //用户信息
-      userId: "", //用户id
 
       invitationCode: "",
       roleType: "0",
       type: 0,
       view: {
         name: "",
-        userName: "",
-        channelId: "",
-        channelName: "",
-        role: "",
+        studentNumber: "",
+        sex: "",
+        orgName: "",
       },
       channel: "",
       channelList: [{ name: "渠道天成", id: "1" }],
@@ -249,15 +352,54 @@ export default {
     this.searchTarget();
   },
   methods: {
-    //性别---
-    genderFun(val){
-      let sex =val.gender
-      if(sex=='1'){
-        return '男'
-      }else if (sex=='0'){
-        return '女'
+    //文件上传成功
+    fileSuccess(res) {
+  
+
+      if (res.code == 200) {
+        this.searchTarget();
+        this.$message({
+          message:res.msg,
+          type: "success",
+        });
       }else{
-        return sex
+        this.$message({
+          message:res.msg,
+          type: 'error',
+        });
+      }
+      //查询列表
+    },
+    //文件上传失败
+    fileError() {
+      this.$message({
+        message: "上传失败",
+        type: "error",
+      });
+    },
+    cancle() {
+      this.resetVisible = false;
+    },
+    //提交文本
+    submitCom() {
+      //判断当前是否是
+      if (this.isDelete) {
+        this.deleteUser();
+        //调用删除方法
+      } else {
+        this.resetFun();
+        // 调用重置密码方法
+      }
+    },
+    //性别---
+    genderFun(val) {
+      let sex = val.gender;
+      if (sex == "1") {
+        return "男";
+      } else if (sex == "0") {
+        return "女";
+      } else {
+        return sex;
       }
     },
     //每页多少条
@@ -332,28 +474,23 @@ export default {
         return "正常";
       }
     },
-    resetUser(index, val) {
-      console.log(val);
-      this.$http.get(`/user/reset/${val.id}`, {}, (res) => {
-        //  this.$toast.success({message:'成功'});
-        if (res && res.code == 200) {
-          this.$message.success("重置成功");
-          this.searchTarget();
-        } else {
-          this.$message.error(res.msg);
-        }
-      });
+    resetUser(flag, val) {
+      this.resetVisible = true;
+      this.isDelete = flag;
+      this.userId = val.id;
+      this.userName = val.userName;
+      //当前用户id
+
       //重置密码
     },
     editUser(row) {
       this.editRegisterUser(row);
     },
     viewUser(row) {
-      this.view.name = row.name;
-      this.view.userName = row.userName;
-      this.view.channelId = row.channelId;
-      this.view.channelName = row.channelName;
-      this.view.role = row.type == "0" ? "渠道用户" : "";
+      this.view.name = row.userName;
+      this.view.studentNumber = row.userNo;
+      this.view.sex = row.gender == "0" ? "女" : "男";
+      this.view.orgName = row.orgName;
       this.centerDialogVisible = true;
     },
     addUser() {
@@ -369,32 +506,31 @@ export default {
       this.group = "";
       this.searchTarget();
     },
-    formatterRole(val) {
-      if (val.type == "1") {
-        return "超级管理员";
-      } else {
-        return "渠道用户";
-      }
-    },
 
-    forma(val) {
-      if (val.gender == "0") {
-        return "男";
-      } else {
-        return "女";
-      }
-    },
     addRegisterUser(val) {
       this.$refs.register.open(val);
     },
     editRegisterUser(val) {
       this.$refs.register.edit(val);
     },
-    deleteUser(index, row) {
-      this.$http.delete(`/user/delete/${row.id}`, {}, (res) => {
+    resetFun() {
+      this.$http.get(`/user/resetPassword?userId=${this.userId}`, {}, (res) => {
+        //  this.$toast.success({message:'成功'});
+        if (res && res.code == 200) {
+          this.resetVisible = false;
+          this.$message.success("重置成功");
+          this.searchTarget();
+        } else {
+          this.$message.error(res.msg);
+        }
+      });
+    },
+    deleteUser() {
+      this.$http.get(`/user/delete?userId=${this.userId}`, {}, (res) => {
         //  this.$toast.success({message:'成功'});
         if (res && res.code == 200) {
           this.$message.success("删除成功");
+          this.resetVisible = false;
           this.searchTarget();
         } else {
           this.$message.error("删除失败");
@@ -408,22 +544,23 @@ export default {
     },
     //根据现有情况进行搜索
     searchList() {
-      let url = `/user/findUserListByPage?pageSize=${this.pageSize}&pageNum=${this.pageNum}${this.sex==''?'': `&gender=${this.sex}`}${this.group.length==0?'': `&orgNo=${this.group[this.group.length-1]}`}${this.name==''?'': `&userName=${this.name}`}${this.studentNumber==''?'': `&userNo=${this.studentNumber}`}`
-      this.$http.get(url
-       ,
-        {
-        },
-        (res) => {
-          console.log(res)
-          if (res && res.code == 200) {
-            this.tableData = res.data.content;
-            this.total = res.data.totalElements;
-          } else {
-            // this.$toast.fail(res.msg);
-            this.$message.error(res.msg);
-          }
+      let url = `/user/findUserListByPage?pageSize=${this.pageSize}&pageNum=${
+        this.pageNum
+      }${this.sex == "" ? "" : `&gender=${this.sex}`}${
+        this.group.length == 0 ? "" : `&orgNo=${this.group[this.group.length - 1]}`
+      }${this.name == "" ? "" : `&userName=${this.name}`}${
+        this.studentNumber == "" ? "" : `&userNo=${this.studentNumber}`
+      }`;
+      this.$http.get(url, {}, (res) => {
+        console.log(res);
+        if (res && res.code == 200) {
+          this.tableData = res.data.content;
+          this.total = res.data.totalElements;
+        } else {
+          // this.$toast.fail(res.msg);
+          this.$message.error(res.msg);
         }
-      );
+      });
     },
     searchTarget() {
       this.pageNum = 1;
@@ -443,30 +580,11 @@ export default {
       oSessionStorage.removeItem("token");
       this.$router.push({ path: "/" });
     },
-    //点击日历获取日期
-    getDate(param) {
-      // console.log(param,"日期。。。")
-      this.userRecord(param.dateStr);
-    },
+
     //点击获取月出勤次数
     getTimes(param) {
       this.monthTimes = param;
     },
-    // 用户测试记录显示
-    userRecord(date) {
-      this.$http.get(
-        `gameRecord/findListByUserIdAndDate/${this.userId}/${date}`,
-        {},
-        (res) => {
-          // console.log(res,'用户测试记录')
-          if (res && res.code == 200) {
-            this.listData = res.data;
-          } else {
-            this.$toast.fail(res.msg);
-          }
-        }
-      );
-    },
   },
 };
 </script>
@@ -541,4 +659,90 @@ export default {
   padding-left: 10px;
   flex: 3;
 }
+.detail_button_out {
+  display: flex;
+  justify-content: space-around;
+  .detail_button {
+    display: flex;
+    align-items: center;
+    cursor: pointer;
+    letter-spacing: 2px;
+    img {
+      width: 15px;
+      margin-right: 5px;
+    }
+    span {
+      color: #00bf78;
+      // font-weight: 600;
+    }
+  }
+}
+
+//弹出框样式
+
+.dig_update /deep/.el-cascader {
+  position: relative;
+  font-size: 14px;
+  line-height: 40px;
+  width: 100%;
+}
+.dig_update /deep/.el-dialog {
+  box-shadow: none !important;
+  background: transparent !important;
+}
+.demo-ruleForm /deep/ .el-form-item {
+  margin-right: 10px;
+  vertical-align: top;
+  display: flex !important;
+  flex-direction: column;
+}
+.demo-ruleForm /deep/.el-dialog__header {
+  background-color: #ffffff;
+  padding-left: 140px !important;
+}
+.demo-ruleForm /deep/.el-form-item__label {
+  text-align: left;
+  vertical-align: middle;
+  float: left;
+  font-size: 14px;
+  color: #606266;
+  line-height: 40px;
+  padding: 0 12px 0 0;
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+}
+
+.demo-ruleForm /deep/.el-input {
+  width: 100% !important;
+}
+
+.demo-ruleForm /deep/.el-input__inner {
+  width: 100% !important;
+  background-color: #f7f7f7;
+  border: 0px;
+}
+
+.dig_button {
+  margin-top: 40px;
+  display: flex;
+  width: 100%;
+  justify-content: space-around;
+}
+
+.demo-ruleForm {
+  background-color: #ffffff;
+  // border-radius: 20px;
+  margin-right: -10px;
+  margin-top: -10px;
+  padding-right: 100px;
+  padding-left: 100px;
+  border-radius: 20px;
+  padding-top: 20px;
+  padding-bottom: 20px;
+  .dig_title {
+    margin-bottom: 30px;
+    text-align: center;
+    font-weight: 700;
+  }
+}
 </style>