| | |
| | | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
| | | <el-table-column type="selection" width="50" align="center" />
|
| | | <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns.userId.visible" />
|
| | | <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns.userName.visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="用户名称" align="center" key="userName" v-if="columns.userName.visible" :show-overflow-tooltip="true">
|
| | | <template slot-scope="scope">
|
| | | <a class="link-type" style="cursor:pointer" @click="handleViewData(scope.row)">{{ scope.row.userName }}</a>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns.nickName.visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns.deptName.visible" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns.phonenumber.visible" width="120" />
|
| | |
| | | </el-form-item>
|
| | | </el-col>
|
| | | <el-col :span="12">
|
| | | <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
| | | <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password" :rules="pwdValidator">
|
| | | <el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
|
| | | </el-form-item>
|
| | | </el-col>
|
| | |
| | | </div>
|
| | | </el-dialog>
|
| | |
|
| | | <!-- 用户详情抽屉 -->
|
| | | <user-view-drawer ref="userViewRef" />
|
| | | <!-- 用户导入对话框 -->
|
| | | <excel-import-dialog ref="importUserRef" title="用户导入" action="/system/user/importData" template-action="/system/user/importTemplate" template-file-name="user_template" update-support-label="是否更新已经存在的用户数据" @success="getList" />
|
| | | </div>
|
| | |
| | | import "@riophae/vue-treeselect/dist/vue-treeselect.css"
|
| | | import TreePanel from "@/components/TreePanel"
|
| | | import ExcelImportDialog from "@/components/ExcelImportDialog"
|
| | | import UserViewDrawer from "./view"
|
| | | import passwordRule from "@/utils/passwordRule"
|
| | |
|
| | | export default {
|
| | | name: "User",
|
| | | mixins: [passwordRule],
|
| | | dicts: ['sys_normal_disable', 'sys_user_sex'],
|
| | | components: { Treeselect, TreePanel, ExcelImportDialog },
|
| | | components: { Treeselect, TreePanel, ExcelImportDialog, UserViewDrawer },
|
| | | data() {
|
| | | return {
|
| | | // 遮罩层
|
| | |
| | | ],
|
| | | nickName: [
|
| | | { required: true, message: "用户昵称不能为空", trigger: "blur" }
|
| | | ],
|
| | | password: [
|
| | | { required: true, message: "用户密码不能为空", trigger: "blur" },
|
| | | { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
|
| | | { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
| | | ],
|
| | | email: [
|
| | | {
|
| | |
| | | },
|
| | | /** 重置密码按钮操作 */
|
| | | handleResetPwd(row) {
|
| | | this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
| | | this.$prompt(`请输入「${row.userName}」的新密码`, "重置密码", {
|
| | | confirmButtonText: "确定",
|
| | | cancelButtonText: "取消",
|
| | | closeOnClickModal: false,
|
| | | inputPattern: /^.{5,20}$/,
|
| | | inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
| | | inputValidator: (value) => {
|
| | | if (/<|>|"|'|\||\\/.test(value)) {
|
| | | return "不能包含非法字符:< > \" ' \\\ |"
|
| | | }
|
| | | },
|
| | | inputValidator: this.pwdPromptValidator
|
| | | }).then(({ value }) => {
|
| | | resetUserPwd(row.userId, value).then(() => {
|
| | | this.$modal.msgSuccess("修改成功,新密码是:" + value)
|
| | |
| | | ...this.queryParams
|
| | | }, `user_${new Date().getTime()}.xlsx`)
|
| | | },
|
| | | /** 详情按钮操作 */
|
| | | handleViewData(row) {
|
| | | this.$refs.userViewRef.open(row.userId)
|
| | | },
|
| | | /** 导入按钮操作 */
|
| | | handleImport() {
|
| | | this.$refs.importUserRef.open()
|