shikeying
2023-03-23 4ed7e70bb2dd379318da4d9454f86264c7fd6b88
src/views/system/user/index.vue
@@ -141,7 +141,7 @@
          <el-table-column label="用户编号" align="left" key="id" prop="id" v-if="columns[0].visible" />
          <el-table-column label="用户名称" align="left" key="user_name" prop="user_name" v-if="columns[1].visible" :show-overflow-tooltip="true" />
          <el-table-column label="用户昵称" align="left" key="nick_name" prop="nick_name" v-if="columns[2].visible" :show-overflow-tooltip="true" />
          <el-table-column label="部门" align="left" key="dept_id" prop="dept_id" v-if="columns[3].visible" :show-overflow-tooltip="true" />
          <el-table-column label="部门" align="left" key="dept_id" prop="parameter.dept_name" v-if="columns[3].visible" :show-overflow-tooltip="true" />
          <el-table-column label="手机号码" align="left" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
          <el-table-column label="状态" align="left" key="status" prop="status" v-if="columns[5].visible">
            <template slot-scope="scope">
@@ -418,14 +418,14 @@
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        // url: process.env.VUE_APP_BASE_API + "/system/user/import"
        // url: process.env.VUE_SERVER_URL + "/system/user/importData"
        url: "http://localhost:8082/admin" + "/system/user/import"
        // url: "http://localhost:8082/admin" + "/system/user/import"
        url: globalConf.baseUrl + "/system/user/import"
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        pageSize: 15,
        userName: undefined,
        phonenumber: undefined,
        status: undefined,
@@ -498,10 +498,18 @@
      );
    },
    /** 查询部门下拉树结构 */
    getTreeselect() {
      treeselect(this.queryParams.deptId).then(response => {
    getTreeselect(deptId) {
      // treeselect(this.queryParams.deptId).then(response => {
      //   this.deptOptions = response.data;
      // });
      if(deptId == undefined || deptId == ""){
        this.$modal.alert("请选择一个部门");
        return false;
      }
      treeselect(deptId).then(response => {
        this.deptOptions = response.data;
      });
      return true;
    },
    // 2022-12-08,加载顶级机构树列表
@@ -594,7 +602,9 @@
      //   this.$modal.msgSuccess("请先选择一个顶级机构");
      //   return;
      // }
      this.getTreeselect();
      if(!this.getTreeselect(this.queryParams.deptId)){
        return;
      }
      // getUser().then(response => {
      getNewUserRoles(this.queryParams.deptId).then(response => {
        // this.postOptions = response.posts;
@@ -603,11 +613,12 @@
        this.title = "添加用户";
        this.form.password = this.initPassword;
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.getTreeselect();
      // this.getTreeselect();
      // const userId = row.id || this.ids;
      const userId = row.id;
      getUser(userId).then(response => {
@@ -619,6 +630,7 @@
        this.open = true;
        this.title = "修改用户";
        this.form.password = "";
        this.getTreeselect(this.form.dept_id);
      });
    },
    /** 重置密码按钮操作 */
@@ -678,7 +690,7 @@
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/user/export', {
      this.$download('system/user/export', {
        ...this.queryParams
      }, `user_${new Date().getTime()}.xlsx`)
    },
@@ -690,7 +702,7 @@
    /** 下载模板操作 */
    importTemplate() {
      // this.download('system/user/select/downloadTemplate', {}, `user_template_${new Date().getTime()}.xlsx`);
      this.download('system/user/select/downloadTemplate', {}, `user_template.xlsx`);
      this.$download('system/user/select/downloadTemplate', {}, `user_template.xlsx`);
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {