web
4 天以前 8e38cc8536cfda9b6bda8548d63778cbf5f4d634
src/views/system/user/index.vue
@@ -30,7 +30,8 @@
                    plain
                    icon="Plus"
                    @click="handleAdd"
                >新增</el-button>
                >新增
                </el-button>
              </el-col>
          </el-row>
          <!--表格及分页-->
@@ -51,7 +52,10 @@
              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template #default="scope">
                    <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
                    <el-button v-if="scope.row.userType == 3" link type="primary" icon="Edit" @click="handleRole(scope.row)">绑定角色</el-button>
                    <el-button v-if="scope.row.userType == 3" link type="primary" icon="Edit"
                               @click="handleRole(scope.row)">绑定角色
                    </el-button>
                    <el-button link type="primary" icon="reset" @click="handeReset(scope.row)">重置密码</el-button>
                    <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
                </template>
              </el-table-column>
@@ -91,9 +95,7 @@
                        <el-form-item label="联系方式" prop="contact">
                          <el-input v-model="form.contact" placeholder="请输入联系方式" />
                      </el-form-item>
                      <el-form-item v-if="!form.id">
                          <br>
                      </el-form-item>
                <el-form-item />
                        <el-form-item label="上传头像" prop="">
                            <upload-icons @uploadData="uploadData" :imageList="form.headImg" :limit="1"></upload-icons>
                      </el-form-item>
@@ -117,7 +119,8 @@
                >
                <div class="bandCheck">
                    <el-checkbox-group v-model="roleCheckedList">
                        <el-checkbox v-for="(item,index) in roleSelectList" :key="index" :label="item.name" :value="item.id" size ="large" />
                    <el-checkbox v-for="(item,index) in roleSelectList" :key="index" :label="item.name" :value="item.id"
                                 size="large"/>
                    </el-checkbox-group>
                </div>
                <div class="handleBtn">
@@ -133,6 +136,7 @@
    import  role from "@/api/system/role";
    import  { sysDictData } from "@/api/system/dict";
    import setPostParams from "@/utils/searchParams.js";
    const { proxy } = getCurrentInstance();
    const imgBaseUrl = import.meta.env.VITE_APP_IMG_BASEURL //图片前缀
    
@@ -167,6 +171,7 @@
        email:'邮箱地址',
        createTimeView:'创建时间'
      })
    /** 获取列表 */
    async function getList(val) {
          loading.value = true;
@@ -196,6 +201,15 @@
      title.value = "修改用户";
    }
/** 重置密码 */
function handeReset(row) {
    proxy.$modal.confirm('是否确认重置"' + row.nickName + '"的密码?').then(function () {
        return user().resetPwd(row.id).then(res => {
            proxy.$modal.confirm(`重置密码成功,新密码为:${res.data}`);
        })
    })
}
    /** 删除按钮操作 */
    function handleDelete(row) {
      proxy.$modal.confirm('是否确认删除名称为"' + row.nickName + '"的数据项?').then(function() {
@@ -203,7 +217,8 @@
      }).then(() => {
        getList();
        proxy.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    }).catch(() => {
    });
    }
    /**
@@ -242,6 +257,7 @@
      userTypeList.value = res.data
        })
    }
    /** 提交按钮 */
    function submitForm() {
      proxy.$refs["userRef"].validate(valid => {
@@ -305,12 +321,14 @@
    }
    //绑定按钮
    const userId = ref()
    async function handleRole(row){
      open1.value = true
      userId.value = row.id
      await getUserRole()
      await getBandedRoleList(userId.value)
    }
    //获取已绑定角色列表
    async function getBandedRoleList(id){
      await user().getListRoleAdmin(id).then((res) =>{
@@ -324,6 +342,7 @@
        }
      })
    }
    //绑定请求
    async function bandListConfirm(){
      let postParam = {
@@ -338,6 +357,7 @@
        }
      })
    }
    getUserType()
    getList();
    </script>
@@ -346,8 +366,10 @@
        max-width: 100px;
        height: 50px;
    }
    .el-dialog{
        width:50vw;
        .user-form{
            display: flex;
            flex-wrap: wrap;
@@ -355,11 +377,13 @@
            align-items: center;
            margin: 20px auto;
            width: 90%;
            .el-form-item{
                width: 45%;
            }
        }
    }
    .bandCheck{
      width:100%;
      /* background-color: beige; */
@@ -368,12 +392,14 @@
      align-items: center;
      margin-bottom:100px;
    }
    .handleBtn{
      width:100%;
      /* background-color: beige; */
      display: flex;
      justify-content: center;
      align-items: center;
      .el-button{
        width:100px;
      }