| | |
| | | </el-col>
|
| | | <!--用户数据-->
|
| | | <el-col :span="20" :xs="24">
|
| | | <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
|
| | | <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
| | | <el-form-item label="用户名称" prop="userName">
|
| | | <el-input
|
| | | v-model="queryParams.userName"
|
| | |
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="primary"
|
| | | plain
|
| | | icon="el-icon-plus"
|
| | | size="mini"
|
| | | @click="handleAdd"
|
| | |
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="success"
|
| | | plain
|
| | | icon="el-icon-edit"
|
| | | size="mini"
|
| | | :disabled="single"
|
| | |
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="danger"
|
| | | plain
|
| | | icon="el-icon-delete"
|
| | | size="mini"
|
| | | :disabled="multiple"
|
| | |
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="info"
|
| | | plain
|
| | | icon="el-icon-upload2"
|
| | | size="mini"
|
| | | @click="handleImport"
|
| | |
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="warning"
|
| | | plain
|
| | | icon="el-icon-download"
|
| | | size="mini"
|
| | | :loading="exportLoading"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['system:user:export']"
|
| | | >导出</el-button>
|
| | | </el-col>
|
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
| | | </el-row>
|
| | |
|
| | | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
| | | <el-table-column type="selection" width="40" align="center" />
|
| | | <el-table-column label="用户编号" align="center" prop="userId" />
|
| | | <el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="用户昵称" align="center" prop="nickName" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="部门" align="center" prop="dept.deptName" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
|
| | | <el-table-column label="状态" align="center">
|
| | | <el-table-column type="selection" width="50" align="center" />
|
| | | <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
| | | <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
| | | <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
| | | <template slot-scope="scope">
|
| | | <el-switch
|
| | | v-model="scope.row.status"
|
| | |
| | | ></el-switch>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
| | | <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
| | | <template slot-scope="scope">
|
| | | <span>{{ parseTime(scope.row.createTime) }}</span>
|
| | | </template>
|
| | |
| | | <el-table-column
|
| | | label="操作"
|
| | | align="center"
|
| | | width="180"
|
| | | width="160"
|
| | | class-name="small-padding fixed-width"
|
| | | >
|
| | | <template slot-scope="scope">
|
| | |
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="归属部门" prop="deptId">
|
| | | <treeselect v-model="form.deptId" :options="deptOptions" placeholder="请选择归属部门" />
|
| | | <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | | <el-row>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="手机号码" prop="phonenumber">
|
| | | <el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
|
| | |
| | | <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 v-if="form.userId == undefined" label="用户名称" prop="userName">
|
| | | <el-input v-model="form.userName" placeholder="请输入用户名称" />
|
| | |
| | | <el-input v-model="form.password" placeholder="请输入用户密码" type="password" />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | | <el-row>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="用户性别">
|
| | | <el-select v-model="form.sex" placeholder="请选择">
|
| | |
| | | </el-radio-group>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | |
|
| | | </el-row>
|
| | | <el-row>
|
| | | <el-col :span="12">
|
| | | <el-form-item label="岗位">
|
| | | <el-select v-model="form.postIds" multiple placeholder="请选择">
|
| | |
| | | </el-select>
|
| | | </el-form-item>
|
| | | </el-col>
|
| | | </el-row>
|
| | | <el-row>
|
| | | <el-col :span="24">
|
| | | <el-form-item label="备注">
|
| | | <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
| | |
| | | return {
|
| | | // 遮罩层
|
| | | loading: true,
|
| | | // 导出遮罩层
|
| | | exportLoading: false,
|
| | | // 选中数组
|
| | | ids: [],
|
| | | // 非单个禁用
|
| | | single: true,
|
| | | // 非多个禁用
|
| | | multiple: true,
|
| | | // 显示搜索条件
|
| | | showSearch: true,
|
| | | // 总条数
|
| | | total: 0,
|
| | | // 用户表格数据
|
| | |
| | | status: undefined,
|
| | | deptId: undefined
|
| | | },
|
| | | // 列信息
|
| | | columns: [
|
| | | { key: 0, label: `用户编号`, visible: true },
|
| | | { key: 1, label: `用户名称`, visible: true },
|
| | | { key: 2, label: `用户昵称`, visible: true },
|
| | | { key: 3, label: `部门`, visible: true },
|
| | | { key: 4, label: `手机号码`, visible: true },
|
| | | { key: 5, label: `状态`, visible: true },
|
| | | { key: 6, label: `创建时间`, visible: true }
|
| | | ],
|
| | | // 表单校验
|
| | | rules: {
|
| | | userName: [
|
| | |
| | | nickName: [
|
| | | { required: true, message: "用户昵称不能为空", trigger: "blur" }
|
| | | ],
|
| | | deptId: [
|
| | | { required: true, message: "归属部门不能为空", trigger: "blur" }
|
| | | ],
|
| | | password: [
|
| | | { required: true, message: "用户密码不能为空", trigger: "blur" }
|
| | | ],
|
| | | email: [
|
| | | { required: true, message: "邮箱地址不能为空", trigger: "blur" },
|
| | | {
|
| | | type: "email",
|
| | | message: "'请输入正确的邮箱地址",
|
| | |
| | | }
|
| | | ],
|
| | | phonenumber: [
|
| | | { required: true, message: "手机号码不能为空", trigger: "blur" },
|
| | | {
|
| | | pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
| | | message: "请输入正确的手机号码",
|
| | |
| | | cancelButtonText: "取消"
|
| | | }).then(({ value }) => {
|
| | | resetUserPwd(row.userId, value).then(response => {
|
| | | if (response.code === 200) {
|
| | | this.msgSuccess("修改成功,新密码是:" + value);
|
| | | } else {
|
| | | this.msgError(response.msg);
|
| | | }
|
| | | this.msgSuccess("修改成功,新密码是:" + value);
|
| | | });
|
| | | }).catch(() => {});
|
| | | },
|
| | |
| | | if (valid) {
|
| | | if (this.form.userId != undefined) {
|
| | | updateUser(this.form).then(response => {
|
| | | if (response.code === 200) {
|
| | | this.msgSuccess("修改成功");
|
| | | this.open = false;
|
| | | this.getList();
|
| | | } else {
|
| | | this.msgError(response.msg);
|
| | | }
|
| | | this.msgSuccess("修改成功");
|
| | | this.open = false;
|
| | | this.getList();
|
| | | });
|
| | | } else {
|
| | | addUser(this.form).then(response => {
|
| | | if (response.code === 200) {
|
| | | this.msgSuccess("新增成功");
|
| | | this.open = false;
|
| | | this.getList();
|
| | | } else {
|
| | | this.msgError(response.msg);
|
| | | }
|
| | | this.msgSuccess("新增成功");
|
| | | this.open = false;
|
| | | this.getList();
|
| | | });
|
| | | }
|
| | | }
|
| | |
| | | }).then(() => {
|
| | | this.getList();
|
| | | this.msgSuccess("删除成功");
|
| | | }).catch(function() {});
|
| | | }).catch(() => {});
|
| | | },
|
| | | /** 导出按钮操作 */
|
| | | handleExport() {
|
| | |
| | | confirmButtonText: "确定",
|
| | | cancelButtonText: "取消",
|
| | | type: "warning"
|
| | | }).then(function() {
|
| | | }).then(() => {
|
| | | this.exportLoading = true;
|
| | | return exportUser(queryParams);
|
| | | }).then(response => {
|
| | | this.download(response.msg);
|
| | | }).catch(function() {});
|
| | | this.exportLoading = false;
|
| | | }).catch(() => {});
|
| | | },
|
| | | /** 导入按钮操作 */
|
| | | handleImport() {
|