WXL
3 天以前 4c9fdc87987140e8b2c3f0dfc2f6608cdb6be774
src/views/system/user/index.vue
@@ -90,7 +90,6 @@
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['system:user:add']"
            >新增</el-button>
          </el-col>
          <el-col :span="1.5">
@@ -101,7 +100,6 @@
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['system:user:edit']"
            >修改</el-button>
          </el-col>
          <el-col :span="1.5">
@@ -112,7 +110,6 @@
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['system:user:remove']"
            >删除</el-button>
          </el-col>
          <el-col :span="1.5">
@@ -122,7 +119,6 @@
              icon="el-icon-upload2"
              size="mini"
              @click="handleImport"
              v-hasPermi="['system:user:import']"
            >导入</el-button>
          </el-col>
          <el-col :span="1.5">
@@ -133,7 +129,6 @@
              size="mini"
              :loading="exportLoading"
              @click="handleExport"
              v-hasPermi="['system:user:export']"
            >导出</el-button>
          </el-col>
@@ -175,31 +170,28 @@
                class="el-xg"
                icon="el-icon-help"
                @click="handleunlock(scope.row)"
                v-hasPermi="['system:user:edit']"
              >解锁</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['system:user:edit']"
              >修改</el-button>
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['system:user:remove']"
              >删除</el-button>
              <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
              <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)">
                <span class="el-dropdown-link">
                  <i class="el-icon-d-arrow-right el-icon--right"></i>更多
                </span>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item command="handleResetPwd" icon="el-icon-key"
                    v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
>重置密码</el-dropdown-item>
                  <el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check"
                    v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
>分配角色</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </template>
@@ -217,8 +209,8 @@
    </el-row>
    <!-- 添加或修改参数配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
    <el-dialog :title="title" :visible.sync="open" width="660px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="用户昵称" prop="nickName">
@@ -240,6 +232,37 @@
          <el-col :span="12">
            <el-form-item label="邮箱" prop="email">
              <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="机构" prop="orgId">
              <el-select v-model="form.orgId" filterable clearable placeholder="请选择机构" @change="handleOrgChange">
                <el-option
                  v-for="org in orgOptions"
                  :key="org.id"
                  :label="org.organizationname"
                  :value="org.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="协调员姓名" prop="coordinatorName">
              <el-input v-model="form.coordinatorName" placeholder="请输入协调员姓名" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="协调员编号" prop="coordinatorNo">
              <el-input v-model="form.coordinatorNo" placeholder="请输入协调员编号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="身份证" prop="idcardno">
              <el-input v-model="form.idcardno" placeholder="请输入身份证号" maxlength="18" />
            </el-form-item>
          </el-col>
        </el-row>
@@ -356,6 +379,7 @@
<script>
import { listUser, getUser, delUser, addUser, updateUser, exportUser,handleunlock, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
import { listOrganization } from "@/api/project/organization";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
@@ -399,6 +423,8 @@
      postOptions: [],
      // 角色选项
      roleOptions: [],
      // 机构选项
      orgOptions: [],
      // 表单参数
      form: {},
      defaultProps: {
@@ -465,6 +491,13 @@
            message: "请输入正确的手机号码",
            trigger: "blur"
          }
        ],
        idcardno: [
          {
            pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
            message: "请输入正确的身份证号码",
            trigger: "blur"
          }
        ]
      }
    };
@@ -478,6 +511,7 @@
  created() {
    this.getList();
    this.getTreeselect();
    this.getOrgList();
    this.getConfigKey("sys.user.initPassword").then(response => {
      this.initPassword = response.msg;
    });
@@ -498,6 +532,25 @@
      treeselect().then(response => {
        this.deptOptions = response.data;
      });
    },
    /** 查询机构下拉列表 */
    getOrgList() {
      listOrganization({ pageNum: 1, pageSize: 100000 }).then(response => {
        this.orgOptions = response.rows || [];
      });
    },
    /** 机构选择变更,同步机构名称及协调员信息 */
    handleOrgChange(orgId) {
      const org = this.orgOptions.find(o => o.id === orgId);
      if (org) {
        this.form.orgName = org.organizationname;
        this.form.coordinatorName = org.coordinatorName;
        this.form.coordinatorNo = org.coordinatorNo;
      } else {
        this.form.orgName = undefined;
        this.form.coordinatorName = undefined;
        this.form.coordinatorNo = undefined;
      }
    },
    // 筛选节点
    filterNode(value, data) {
@@ -538,6 +591,11 @@
        sex: undefined,
        status: "0",
        remark: undefined,
        orgId: undefined,
        orgName: undefined,
        coordinatorName: undefined,
        coordinatorNo: undefined,
        idcardno: undefined,
        postIds: [],
        roleIds: []
      };