1 |
- {"remainingRequest":"E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\src\\views\\system\\user\\index.vue?vue&type=style&index=0&id=1930a3c4&lang=scss&scoped=true&","dependencies":[{"path":"E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\src\\views\\system\\user\\index.vue","mtime":1687137999762},{"path":"E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\node_modules\\css-loader\\dist\\cjs.js","mtime":1688725399018},{"path":"E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\node_modules\\vue-loader\\lib\\loaders\\stylePostLoader.js","mtime":1688725423149},{"path":"E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\node_modules\\postcss-loader\\src\\index.js","mtime":1688725407590},{"path":"E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\node_modules\\sass-loader\\dist\\cjs.js","mtime":1688725390930},{"path":"E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1688725391035},{"path":"E:\\mec-cloud_IntelligentManufacturing_CRM\\mec-cloud_IntelligentManufacturing_CRM\\ruoyi-ui\\node_modules\\vue-loader\\lib\\index.js","mtime":1688725415411}],"contextDependencies":[],"result":[{"type":"Buffer","data":"base64:CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgovKiAuZWwtdGFibGUgLndhcmluZy1yb3cgewogICBiYWNrZ3JvdW5kOiAjZTAxMzEzICFpbXBvcnRhbnQ7CiB9CgogLmVsLXRhYmxlIC5zdWNjZXNzLXJvdyB7CiAgIGJhY2tncm91bmQ6IzhkYTgxNCAhaW1wb3J0YW50OwogfSAqLwo="},{"version":3,"sources":["index.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6rBA;AACA;AACA;;AAEA;AACA;AACA","file":"index.vue","sourceRoot":"src/views/system/user","sourcesContent":["<template>\r\n <div class=\"app-container\">\r\n <el-row :gutter=\"20\">\r\n <!--部门数据-->\r\n <el-col :span=\"4\" :xs=\"24\">\r\n <div class=\"head-container\">\r\n <el-input\r\n v-model=\"deptName\"\r\n placeholder=\"请输入部门名称\"\r\n clearable\r\n size=\"small\"\r\n prefix-icon=\"el-icon-search\"\r\n style=\"margin-bottom: 20px\"\r\n />\r\n </div>\r\n <div class=\"head-container\">\r\n <el-tree\r\n :data=\"deptOptions\"\r\n :props=\"defaultProps\"\r\n :expand-on-click-node=\"false\"\r\n :filter-node-method=\"filterNode\"\r\n ref=\"tree\"\r\n node-key=\"id\"\r\n default-expand-all\r\n highlight-current\r\n @node-click=\"handleNodeClick\"\r\n />\r\n </div>\r\n </el-col>\r\n\r\n <!--用户数据-->\r\n <el-col :span=\"20\" :xs=\"24\">\r\n <el-form :model=\"queryParams\" ref=\"queryForm\" size=\"small\" :inline=\"true\" v-show=\"showSearch\" label-width=\"68px\">\r\n <div style=\"float: left\">\r\n <el-form-item prop=\"userName\">\r\n \r\n <!-- <i class=\"el-icon-search\"></i> -->\r\n <el-input prefix-icon=\"el-icon-search\" v-model=\"queryParams.userName\" placeholder=\"搜索您的客户...\" clearable style=\"width: 240px\"\r\n @keyup.enter.native=\"handleQuery\" />\r\n </el-form-item>\r\n <el-form-item prop=\"phonenumber\">\r\n <el-input v-model=\"queryParams.phonenumber\" placeholder=\"筛选\" clearable style=\"width: 240px\"\r\n @keyup.enter.native=\"handleQuery\" />\r\n </el-form-item>\r\n <!-- <el-form-item label=\"状态\" prop=\"status\">\r\n <el-select\r\n v-model=\"queryParams.status\"\r\n placeholder=\"用户状态\"\r\n clearable\r\n style=\"width: 240px\"\r\n >\r\n <el-option\r\n v-for=\"dict in dict.type.sys_normal_disable\"\r\n :key=\"dict.value\"\r\n :label=\"dict.label\"\r\n :value=\"dict.value\"\r\n />\r\n </el-select>\r\n </el-form-item> -->\r\n <!-- <el-form-item >\r\n <el-date-picker\r\n v-model=\"dateRange\"\r\n style=\"width: 240px\"\r\n value-format=\"yyyy-MM-dd\"\r\n type=\"daterange\"\r\n range-separator=\"-\"\r\n start-placeholder=\"开始日期\"\r\n end-placeholder=\"结束日期\"\r\n ></el-date-picker>\r\n </el-form-item> -->\r\n <!-- <el-form-item> -->\r\n <!-- <el-button type=\"primary\" icon=\"el-icon-search\" size=\"mini\" @click=\"handleQuery\">搜索</el-button>\r\n <el-button icon=\"el-icon-refresh\" size=\"mini\" @click=\"resetQuery\">重置</el-button>\r\n </el-form-item> -->\r\n\r\n <el-date-picker v-model=\"value1\" type=\"date\" placeholder=\"选择日期\">\r\n </el-date-picker>\r\n </div>\r\n\r\n <div style=\"float: right\">\r\n <el-col :span=\"1.5\">\r\n <el-button plain size=\"mini\" @click=\"handleAdd\" v-hasPermi=\"['system:user:add']\"\r\n style=\"border-radius: 15px; margin-right: 0%\">新增</el-button>\r\n </el-col>\r\n <!-- <el-col :span=\"1.5\">\r\n <el-button type=\"success\" plain icon=\"el-icon-edit\" size=\"mini\" :disabled=\"single\" @click=\"handleUpdate\"\r\n v-hasPermi=\"['system:user:edit']\">修改</el-button>\r\n </el-col> -->\r\n <el-col :span=\"1.5\">\r\n <el-button type=\"danger\" plain icon=\"el-icon-delete\" size=\"mini\" :disabled=\"multiple\" @click=\"handleDelete\"\r\n v-hasPermi=\"['system:user:remove']\"></el-button>\r\n </el-col>\r\n </div>\r\n\r\n <!-- <el-col :span=\"1.5\">\r\n <el-button type=\"info\" plain icon=\"el-icon-upload2\" size=\"mini\" @click=\"handleImport\"\r\n v-hasPermi=\"['system:user:import']\">导入</el-button>\r\n </el-col>\r\n <el-col :span=\"1.5\">\r\n <el-button type=\"warning\" plain icon=\"el-icon-download\" size=\"mini\" @click=\"handleExport\"\r\n v-hasPermi=\"['system:user:export']\">导出</el-button>\r\n </el-col> -->\r\n <!-- <right-toolbar\r\n :showSearch.sync=\"showSearch\"\r\n @queryTable=\"getList\"\r\n :columns=\"columns\"\r\n ></right-toolbar>\r\n -->\r\n </el-form>\r\n\r\n <el-table v-loading=\"loading\" :data=\"userList\" @selection-change=\"handleSelectionChange\" stripe>\r\n <el-table-column type=\"selection\" width=\"50\" align=\"center\" />\r\n <el-table-column label=\"操作\" align=\"center\" key=\"userId\" prop=\"userId\" v-if=\"columns[0].visible\" />\r\n <el-table-column label=\"用户名\" align=\"center\" key=\"userName\" prop=\"userName\" v-if=\"columns[1].visible\" :show-overflow-tooltip=\"true\" />\r\n <el-table-column label=\"名字\" align=\"center\" key=\"nickName\" prop=\"nickName\" v-if=\"columns[2].visible\" :show-overflow-tooltip=\"true\" />\r\n <el-table-column label=\"姓氏\" align=\"center\" key=\"deptName\" prop=\"dept.deptName\" v-if=\"columns[3].visible\" :show-overflow-tooltip=\"true\" />\r\n <el-table-column label=\"角色\" align=\"center\" key=\"phonenumber\" prop=\"phonenumber\" v-if=\"columns[4].visible\" width=\"150\" />\r\n <el-table-column label=\"邮箱地址\" align=\"center\" key=\"nickName\" prop=\"nickName\" v-if=\"columns[2].visible\" :show-overflow-tooltip=\"true\" width=\"200\" />\r\n <el-table-column label=\"激活\" align=\"center\" key=\"deptName\" prop=\"dept.deptName\" v-if=\"columns[3].visible\" :show-overflow-tooltip=\"true\" />\r\n <el-table-column label=\"上次登录时间\" align=\"center\" key=\"phonenumber\" prop=\"phonenumber\" v-if=\"columns[4].visible\" width=\"150\" >\r\n <!-- <el-table-column label=\"创建时间\" align=\"center\" key=\"status\" v-if=\"columns[5].visible\"> -->\r\n <!-- <template slot-scope=\"scope\">\r\n <el-switch\r\n v-model=\"scope.row.status\"\r\n active-value=\"0\"\r\n inactive-value=\"1\"\r\n @change=\"handleStatusChange(scope.row)\"\r\n ></el-switch>\r\n </template> -->\r\n </el-table-column>\r\n <el-table-column label=\"创建时间\" align=\"center\" prop=\"createTime\" v-if=\"columns[6].visible\" width=\"260\">\r\n <template slot-scope=\"scope\">\r\n <span>{{ parseTime(scope.row.createTime) }}</span>\r\n </template>\r\n </el-table-column>\r\n <!-- <el-table-column\r\n label=\"操作\"\r\n align=\"center\"\r\n width=\"160\"\r\n class-name=\"small-padding fixed-width\"\r\n > -->\r\n <!-- <template slot-scope=\"scope\" v-if=\"scope.row.userId !== 1\">\r\n <el-button\r\n size=\"mini\"\r\n type=\"text\"\r\n icon=\"el-icon-edit\"\r\n @click=\"handleUpdate(scope.row)\"\r\n v-hasPermi=\"['system:user:edit']\"\r\n >修改</el-button>\r\n <el-button\r\n size=\"mini\"\r\n type=\"text\"\r\n icon=\"el-icon-delete\"\r\n @click=\"handleDelete(scope.row)\"\r\n v-hasPermi=\"['system:user:remove']\"\r\n >删除</el-button>\r\n <el-dropdown size=\"mini\" @command=\"(command) => handleCommand(command, scope.row)\" v-hasPermi=\"['system:user:resetPwd', 'system:user:edit']\">\r\n <el-button size=\"mini\" type=\"text\" icon=\"el-icon-d-arrow-right\">更多</el-button>\r\n <el-dropdown-menu slot=\"dropdown\">\r\n <el-dropdown-item command=\"handleResetPwd\" icon=\"el-icon-key\"\r\n v-hasPermi=\"['system:user:resetPwd']\">重置密码</el-dropdown-item>\r\n <el-dropdown-item command=\"handleAuthRole\" icon=\"el-icon-circle-check\"\r\n v-hasPermi=\"['system:user:edit']\">分配角色</el-dropdown-item>\r\n </el-dropdown-menu>\r\n </el-dropdown>\r\n </template> -->\r\n <!-- </el-table-column> -->\r\n </el-table>\r\n\r\n <pagination v-show=\"total > 0\" :total=\"total\" :page.sync=\"queryParams.pageNum\" :limit.sync=\"queryParams.pageSize\"\r\n @pagination=\"getList\" />\r\n </el-col>\r\n </el-row>\r\n\r\n <!-- 添加或修改用户配置对话框 -->\r\n <el-dialog :title=\"title\" :visible.sync=\"open\" width=\"600px\" append-to-body>\r\n <el-form ref=\"form\" :model=\"form\" :rules=\"rules\" label-width=\"80px\">\r\n <el-row>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"用户名\" prop=\"nickName\">\r\n <el-input v-model=\"form.nickName\" placeholder=\"请输入用户昵称\" maxlength=\"30\" />\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"归属部门\" prop=\"deptId\">\r\n <treeselect v-model=\"form.deptId\" :options=\"deptOptions\" :show-count=\"true\" placeholder=\"请选择归属部门\" />\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <el-row>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"手机号码\" prop=\"phonenumber\">\r\n <el-input v-model=\"form.phonenumber\" placeholder=\"请输入手机号码\" maxlength=\"11\" />\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"邮箱\" prop=\"email\">\r\n <el-input v-model=\"form.email\" placeholder=\"请输入邮箱\" maxlength=\"50\" />\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <el-row>\r\n <el-col :span=\"12\">\r\n <el-form-item v-if=\"form.userId == undefined\" label=\"用户名称\" prop=\"userName\">\r\n <el-input v-model=\"form.userName\" placeholder=\"请输入用户名称\" maxlength=\"30\" />\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"12\">\r\n <el-form-item v-if=\"form.userId == undefined\" label=\"用户密码\" prop=\"password\">\r\n <el-input v-model=\"form.password\" placeholder=\"请输入用户密码\" type=\"password\" maxlength=\"20\" show-password />\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <el-row>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"用户性别\">\r\n <el-select v-model=\"form.sex\" placeholder=\"请选择性别\">\r\n <el-option v-for=\"dict in dict.type.sys_user_sex\" :key=\"dict.value\" :label=\"dict.label\"\r\n :value=\"dict.value\"></el-option>\r\n </el-select>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"状态\">\r\n <el-radio-group v-model=\"form.status\">\r\n <el-radio v-for=\"dict in dict.type.sys_normal_disable\" :key=\"dict.value\" :label=\"dict.value\">{{ dict.label\r\n }}</el-radio>\r\n </el-radio-group>\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <el-row>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"岗位\">\r\n <el-select v-model=\"form.postIds\" multiple placeholder=\"请选择岗位\">\r\n <el-option v-for=\"item in postOptions\" :key=\"item.postId\" :label=\"item.postName\" :value=\"item.postId\"\r\n :disabled=\"item.status == 1\"></el-option>\r\n </el-select>\r\n </el-form-item>\r\n </el-col>\r\n <el-col :span=\"12\">\r\n <el-form-item label=\"角色\">\r\n <el-select v-model=\"form.roleIds\" multiple placeholder=\"请选择角色\">\r\n <el-option v-for=\"item in roleOptions\" :key=\"item.roleId\" :label=\"item.roleName\" :value=\"item.roleId\"\r\n :disabled=\"item.status == 1\"></el-option>\r\n </el-select>\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n <el-row>\r\n <el-col :span=\"24\">\r\n <el-form-item label=\"备注\">\r\n <el-input v-model=\"formNaNpxark\" type=\"textarea\" placeholder=\"请输入内容\"></el-input>\r\n </el-form-item>\r\n </el-col>\r\n </el-row>\r\n </el-form>\r\n <div slot=\"footer\" class=\"dialog-footer\">\r\n <el-button type=\"primary\" @click=\"submitForm\">确 定</el-button>\r\n <el-button @click=\"cancel\">取 消</el-button>\r\n </div>\r\n </el-dialog>\r\n\r\n <!-- 用户导入对话框 -->\r\n <el-dialog :title=\"upload.title\" :visible.sync=\"upload.open\" width=\"400px\" append-to-body>\r\n <el-upload ref=\"upload\" :limit=\"1\" accept=\".xlsx, .xls\" :headers=\"upload.headers\"\r\n :action=\"upload.url + '?updateSupport=' + upload.updateSupport\" :disabled=\"upload.isUploading\"\r\n :on-progress=\"handleFileUploadProgress\" :on-success=\"handleFileSuccess\" :auto-upload=\"false\" drag>\r\n <i class=\"el-icon-upload\"></i>\r\n <div class=\"el-upload__text\">将文件拖到此处,或<em>点击上传</em></div>\r\n <div class=\"el-upload__tip text-center\" slot=\"tip\">\r\n <div class=\"el-upload__tip\" slot=\"tip\">\r\n <el-checkbox v-model=\"upload.updateSupport\" />\r\n 是否更新已经存在的用户数据\r\n </div>\r\n <span>仅允许导入xls、xlsx格式文件。</span>\r\n <el-link type=\"primary\" :underline=\"false\" style=\"font-size: 12px; vertical-align: baseline\"\r\n @click=\"importTemplate\">下载模板</el-link>\r\n </div>\r\n </el-upload>\r\n <div slot=\"footer\" class=\"dialog-footer\">\r\n <el-button type=\"primary\" @click=\"submitFileForm\">确 定</el-button>\r\n <el-button @click=\"upload.open = false\">取 消</el-button>\r\n </div>\r\n </el-dialog>\r\n </div>\r\n</template>\r\n\r\n<script>\r\nimport {\r\n listUser,\r\n getUser,\r\n delUser,\r\n addUser,\r\n updateUser,\r\n resetUserPwd,\r\n changeUserStatus,\r\n deptTreeSelect,\r\n} from \"@/api/system/user\";\r\nimport { getToken } from \"@/utils/auth\";\r\nimport Treeselect from \"@riophae/vue-treeselect\";\r\nimport \"@riophae/vue-treeselect/dist/vue-treeselect.css\";\r\n\r\nexport default {\r\n name: \"User\",\r\n dicts: [\"sys_normal_disable\", \"sys_user_sex\"],\r\n components: { Treeselect },\r\n data() {\r\n return {\r\n pickerOptions: {\r\n disabledDate(time) {\r\n return time.getTime() > Date.now();\r\n },\r\n shortcuts: [\r\n {\r\n text: \"今天\",\r\n onClick(picker) {\r\n picker.$emit(\"pick\", new Date());\r\n },\r\n },\r\n {\r\n text: \"昨天\",\r\n onClick(picker) {\r\n const date = new Date();\r\n date.setTime(date.getTime() - 3600 * 1000 * 24);\r\n picker.$emit(\"pick\", date);\r\n },\r\n },\r\n {\r\n text: \"一周前\",\r\n onClick(picker) {\r\n const date = new Date();\r\n date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);\r\n picker.$emit(\"pick\", date);\r\n },\r\n },\r\n ],\r\n },\r\n value1: \"\",\r\n value2: \"\",\r\n // 遮罩层\r\n loading: true,\r\n // 选中数组\r\n ids: [],\r\n // 非单个禁用\r\n single: true,\r\n // 非多个禁用\r\n multiple: true,\r\n // 显示搜索条件\r\n showSearch: true,\r\n // 总条数\r\n total: 0,\r\n // 用户表格数据\r\n userList: null,\r\n // 弹出层标题\r\n title: \"\",\r\n // 部门树选项\r\n deptOptions: undefined,\r\n // 是否显示弹出层\r\n open: false,\r\n // 部门名称\r\n deptName: undefined,\r\n // 默认密码\r\n initPassword: undefined,\r\n // 日期范围\r\n dateRange: [],\r\n // 岗位选项\r\n postOptions: [],\r\n // 角色选项\r\n roleOptions: [],\r\n // 表单参数\r\n form: {},\r\n defaultProps: {\r\n children: \"children\",\r\n label: \"label\",\r\n },\r\n // 用户导入参数\r\n upload: {\r\n // 是否显示弹出层(用户导入)\r\n open: false,\r\n // 弹出层标题(用户导入)\r\n title: \"\",\r\n // 是否禁用上传\r\n isUploading: false,\r\n // 是否更新已经存在的用户数据\r\n updateSupport: 0,\r\n // 设置上传的请求头部\r\n headers: { Authorization: \"Bearer \" + getToken() },\r\n // 上传的地址\r\n url: process.env.VUE_APP_BASE_API + \"/system/user/importData\",\r\n },\r\n // 查询参数\r\n queryParams: {\r\n pageNum: 1,\r\n pageSize: 10,\r\n userName: undefined,\r\n phonenumber: undefined,\r\n status: undefined,\r\n deptId: undefined,\r\n },\r\n // 列信息\r\n columns: [\r\n { key: 0, label: `用户编号`, visible: true },\r\n { key: 1, label: `用户名称`, visible: true },\r\n { key: 2, label: `用户昵称`, visible: true },\r\n { key: 3, label: `部门`, visible: true },\r\n { key: 4, label: `手机号码`, visible: true },\r\n { key: 5, label: `状态`, visible: true },\r\n { key: 6, label: `创建时间`, visible: true },\r\n ],\r\n // 表单校验\r\n rules: {\r\n userName: [\r\n { required: true, message: \"用户名称不能为空\", trigger: \"blur\" },\r\n {\r\n min: 2,\r\n max: 20,\r\n message: \"用户名称长度必须介于 2 和 20 之间\",\r\n trigger: \"blur\",\r\n },\r\n ],\r\n nickName: [\r\n { required: true, message: \"用户昵称不能为空\", trigger: \"blur\" },\r\n ],\r\n password: [\r\n { required: true, message: \"用户密码不能为空\", trigger: \"blur\" },\r\n {\r\n min: 5,\r\n max: 20,\r\n message: \"用户密码长度必须介于 5 和 20 之间\",\r\n trigger: \"blur\",\r\n },\r\n ],\r\n email: [\r\n {\r\n type: \"email\",\r\n message: \"请输入正确的邮箱地址\",\r\n trigger: [\"blur\", \"change\"],\r\n },\r\n ],\r\n phonenumber: [\r\n {\r\n pattern: /^1[3|4|5|6|7|8|9][0-9]\\d{8}$/,\r\n message: \"请输入正确的手机号码\",\r\n trigger: \"blur\",\r\n },\r\n ],\r\n },\r\n };\r\n },\r\n watch: {\r\n // 根据名称筛选部门树\r\n deptName(val) {\r\n this.$refs.tree.filter(val);\r\n },\r\n },\r\n created() {\r\n this.getList();\r\n this.getDeptTree();\r\n this.getConfigKey(\"sys.user.initPassword\").then((response) => {\r\n this.initPassword = response.msg;\r\n });\r\n },\r\n methods: {\r\n\r\n // tableRowClassName(row, rowIndex) {\r\n // if (rowIndex === 1) {\r\n // return 'waring-row';\r\n // } else if (rowIndex === 2) {\r\n // return 'success-row';\r\n // }\r\n // return '';\r\n // },\r\n\r\n /** 查询用户列表 */\r\n getList() {\r\n this.loading = true;\r\n listUser(this.addDateRange(this.queryParams, this.dateRange)).then(\r\n (response) => {\r\n this.userList = response.rows;\r\n this.total = response.total;\r\n this.loading = false;\r\n }\r\n );\r\n },\r\n /** 查询部门下拉树结构 */\r\n getDeptTree() {\r\n deptTreeSelect().then((response) => {\r\n this.deptOptions = response.data;\r\n });\r\n },\r\n // 筛选节点\r\n filterNode(value, data) {\r\n if (!value) return true;\r\n return data.label.indexOf(value) !== -1;\r\n },\r\n // 节点单击事件\r\n handleNodeClick(data) {\r\n this.queryParams.deptId = data.id;\r\n this.handleQuery();\r\n },\r\n // 用户状态修改\r\n handleStatusChange(row) {\r\n let text = row.status === \"0\" ? \"启用\" : \"停用\";\r\n this.$modal\r\n .confirm('确认要\"' + text + '\"\"' + row.userName + '\"用户吗?')\r\n .then(function () {\r\n return changeUserStatus(row.userId, row.status);\r\n })\r\n .then(() => {\r\n this.$modal.msgSuccess(text + \"成功\");\r\n })\r\n .catch(function () {\r\n row.status = row.status === \"0\" ? \"1\" : \"0\";\r\n });\r\n },\r\n // 取消按钮\r\n cancel() {\r\n this.open = false;\r\n this.reset();\r\n },\r\n // 表单重置\r\n reset() {\r\n this.form = {\r\n userId: undefined,\r\n deptId: undefined,\r\n userName: undefined,\r\n nickName: undefined,\r\n password: undefined,\r\n phonenumber: undefined,\r\n email: undefined,\r\n sex: undefined,\r\n status: \"0\",\r\n remark: undefined,\r\n postIds: [],\r\n roleIds: [],\r\n };\r\n this.resetForm(\"form\");\r\n },\r\n /** 搜索按钮操作 */\r\n handleQuery() {\r\n this.queryParams.pageNum = 1;\r\n this.getList();\r\n },\r\n /** 重置按钮操作 */\r\n resetQuery() {\r\n this.dateRange = [];\r\n this.resetForm(\"queryForm\");\r\n this.queryParams.deptId = undefined;\r\n this.$refs.tree.setCurrentKey(null);\r\n this.handleQuery();\r\n },\r\n // 多选框选中数据\r\n handleSelectionChange(selection) {\r\n this.ids = selection.map((item) => item.userId);\r\n this.single = selection.length != 1;\r\n this.multiple = !selection.length;\r\n },\r\n // 更多操作触发\r\n handleCommand(command, row) {\r\n switch (command) {\r\n case \"handleResetPwd\":\r\n this.handleResetPwd(row);\r\n break;\r\n case \"handleAuthRole\":\r\n this.handleAuthRole(row);\r\n break;\r\n default:\r\n break;\r\n }\r\n },\r\n /** 新增按钮操作 */\r\n handleAdd() {\r\n this.reset();\r\n getUser().then((response) => {\r\n this.postOptions = response.posts;\r\n this.roleOptions = response.roles;\r\n this.open = true;\r\n this.title = \"添加用户\";\r\n this.form.password = this.initPassword;\r\n });\r\n },\r\n /** 修改按钮操作 */\r\n handleUpdate(row) {\r\n this.reset();\r\n const userId = row.userId || this.ids;\r\n getUser(userId).then((response) => {\r\n this.form = response.data;\r\n this.postOptions = response.posts;\r\n this.roleOptions = response.roles;\r\n this.$set(this.form, \"postIds\", response.postIds);\r\n this.$set(this.form, \"roleIds\", response.roleIds);\r\n this.open = true;\r\n this.title = \"修改用户\";\r\n this.form.password = \"\";\r\n });\r\n },\r\n /** 重置密码按钮操作 */\r\n handleResetPwd(row) {\r\n this.$prompt('请输入\"' + row.userName + '\"的新密码', \"提示\", {\r\n confirmButtonText: \"确定\",\r\n cancelButtonText: \"取消\",\r\n closeOnClickModal: false,\r\n inputPattern: /^.{5,20}$/,\r\n inputErrorMessage: \"用户密码长度必须介于 5 和 20 之间\",\r\n })\r\n .then(({ value }) => {\r\n resetUserPwd(row.userId, value).then((response) => {\r\n this.$modal.msgSuccess(\"修改成功,新密码是:\" + value);\r\n });\r\n })\r\n .catch(() => { });\r\n },\r\n /** 分配角色操作 */\r\n handleAuthRole: function (row) {\r\n const userId = row.userId;\r\n this.$router.push(\"/system/user-auth/role/\" + userId);\r\n },\r\n /** 提交按钮 */\r\n submitForm: function () {\r\n this.$refs[\"form\"].validate((valid) => {\r\n if (valid) {\r\n if (this.form.userId != undefined) {\r\n updateUser(this.form).then((response) => {\r\n this.$modal.msgSuccess(\"修改成功\");\r\n this.open = false;\r\n this.getList();\r\n });\r\n } else {\r\n addUser(this.form).then((response) => {\r\n this.$modal.msgSuccess(\"新增成功\");\r\n this.open = false;\r\n this.getList();\r\n });\r\n }\r\n }\r\n });\r\n },\r\n /** 删除按钮操作 */\r\n handleDelete(row) {\r\n const userIds = row.userId || this.ids;\r\n this.$modal\r\n .confirm('是否确认删除用户编号为\"' + userIds + '\"的数据项?')\r\n .then(function () {\r\n return delUser(userIds);\r\n })\r\n .then(() => {\r\n this.getList();\r\n this.$modal.msgSuccess(\"删除成功\");\r\n })\r\n .catch(() => { });\r\n },\r\n /** 导出按钮操作 */\r\n handleExport() {\r\n this.download(\r\n \"system/user/export\",\r\n {\r\n ...this.queryParams,\r\n },\r\n `user_${new Date().getTime()}.xlsx`\r\n );\r\n },\r\n /** 导入按钮操作 */\r\n handleImport() {\r\n this.upload.title = \"用户导入\";\r\n this.upload.open = true;\r\n },\r\n /** 下载模板操作 */\r\n importTemplate() {\r\n this.download(\r\n \"system/user/importTemplate\",\r\n {},\r\n `user_template_${new Date().getTime()}.xlsx`\r\n );\r\n },\r\n // 文件上传中处理\r\n handleFileUploadProgress(event, file, fileList) {\r\n this.upload.isUploading = true;\r\n },\r\n // 文件上传成功处理\r\n handleFileSuccess(response, file, fileList) {\r\n this.upload.open = false;\r\n this.upload.isUploading = false;\r\n this.$refs.upload.clearFiles();\r\n this.$alert(\r\n \"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>\" +\r\n response.msg +\r\n \"</div>\",\r\n \"导入结果\",\r\n { dangerouslyUseHTMLString: true }\r\n );\r\n this.getList();\r\n },\r\n // 提交上传文件\r\n submitFileForm() {\r\n this.$refs.upload.submit();\r\n },\r\n },\r\n};\r\n</script>\r\n<style lang=\"scss\" scoped>\r\n /* .el-table .waring-row {\r\n background: #e01313 !important;\r\n }\r\n\r\n .el-table .success-row {\r\n background:#8da814 !important;\r\n } */\r\n</style>\r\n"]}]}
|