¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-row :gutter="20"> |
| | | <!--é¨é¨æ°æ®--> |
| | | <el-col :span="4" :xs="24"> |
| | | <div class="head-container"> |
| | | <el-input |
| | | v-model="deptName" |
| | | placeholder="请è¾å
¥é¨é¨åç§°" |
| | | clearable |
| | | size="small" |
| | | prefix-icon="el-icon-search" |
| | | style="margin-bottom: 20px" |
| | | /> |
| | | </div> |
| | | <div class="head-container"> |
| | | <el-tree |
| | | :data="deptOptions" |
| | | :props="defaultProps" |
| | | :expand-on-click-node="false" |
| | | :filter-node-method="filterNode" |
| | | ref="tree" |
| | | node-key="id" |
| | | default-expand-all |
| | | highlight-current |
| | | @node-click="handleNodeClick" |
| | | /> |
| | | </div> |
| | | </el-col> |
| | | <!--ç¨æ·æ°æ®--> |
| | | <el-col :span="20" :xs="24"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="ç¨æ·åç§°" prop="userName"> |
| | | <el-input |
| | | v-model="queryParams.userName" |
| | | placeholder="请è¾å
¥ç¨æ·åç§°" |
| | | clearable |
| | | style="width: 240px" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ææºå·ç " prop="phonenumber"> |
| | | <el-input |
| | | v-model="queryParams.phonenumber" |
| | | placeholder="请è¾å
¥ææºå·ç " |
| | | clearable |
| | | style="width: 240px" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" prop="status"> |
| | | <el-select |
| | | v-model="queryParams.status" |
| | | placeholder="ç¨æ·ç¶æ" |
| | | clearable |
| | | style="width: 240px" |
| | | > |
| | | <el-option |
| | | v-for="dict in dict.type.sys_normal_disable" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å建æ¶é´"> |
| | | <el-date-picker |
| | | v-model="dateRange" |
| | | style="width: 240px" |
| | | value-format="yyyy-MM-dd" |
| | | type="daterange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['system:user:add']" |
| | | >æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['system:user:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['system:user:remove']" |
| | | >å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="info" |
| | | plain |
| | | icon="el-icon-upload2" |
| | | size="mini" |
| | | @click="handleImport" |
| | | v-hasPermi="['system:user:import']" |
| | | >导å
¥</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @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="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" |
| | | active-value="0" |
| | | inactive-value="1" |
| | | @change="handleStatusChange(scope.row)" |
| | | ></el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <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> |
| | | <el-table-column |
| | | label="æä½" |
| | | align="center" |
| | | width="160" |
| | | class-name="small-padding fixed-width" |
| | | > |
| | | <template slot-scope="scope" v-if="scope.row.userId !== 1"> |
| | | <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-button size="mini" type="text" icon="el-icon-d-arrow-right">æ´å¤</el-button> |
| | | <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 command="handleAuthRole" icon="el-icon-circle-check" |
| | | v-hasPermi="['system:user:edit']">åé
è§è²</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </el-col> |
| | | </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-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¨æ·æµç§°" prop="nickName"> |
| | | <el-input v-model="form.nickName" placeholder="请è¾å
¥ç¨æ·æµç§°" maxlength="30" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½å±é¨é¨" prop="deptId"> |
| | | <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-form-item> |
| | | </el-col> |
| | | <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 v-if="form.userId == undefined" label="ç¨æ·åç§°" prop="userName"> |
| | | <el-input v-model="form.userName" placeholder="请è¾å
¥ç¨æ·åç§°" maxlength="30" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item v-if="form.userId == undefined" label="ç¨æ·å¯ç " prop="password"> |
| | | <el-input v-model="form.password" placeholder="请è¾å
¥ç¨æ·å¯ç " type="password" maxlength="20" show-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-option |
| | | v-for="dict in dict.type.sys_user_sex" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¶æ"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio |
| | | v-for="dict in dict.type.sys_normal_disable" |
| | | :key="dict.value" |
| | | :label="dict.value" |
| | | >{{dict.label}}</el-radio> |
| | | </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-option |
| | | v-for="item in postOptions" |
| | | :key="item.postId" |
| | | :label="item.postName" |
| | | :value="item.postId" |
| | | :disabled="item.status == 1" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è§è²"> |
| | | <el-select v-model="form.roleIds" multiple placeholder="è¯·éæ©è§è²"> |
| | | <el-option |
| | | v-for="item in roleOptions" |
| | | :key="item.roleId" |
| | | :label="item.roleName" |
| | | :value="item.roleId" |
| | | :disabled="item.status == 1" |
| | | ></el-option> |
| | | </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> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- ç¨æ·å¯¼å
¥å¯¹è¯æ¡ --> |
| | | <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> |
| | | <el-upload |
| | | ref="upload" |
| | | :limit="1" |
| | | accept=".xlsx, .xls" |
| | | :headers="upload.headers" |
| | | :action="upload.url + '?updateSupport=' + upload.updateSupport" |
| | | :disabled="upload.isUploading" |
| | | :on-progress="handleFileUploadProgress" |
| | | :on-success="handleFileSuccess" |
| | | :auto-upload="false" |
| | | drag |
| | | > |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text">å°æä»¶æå°æ¤å¤ï¼æ<em>ç¹å»ä¸ä¼ </em></div> |
| | | <div class="el-upload__tip text-center" slot="tip"> |
| | | <div class="el-upload__tip" slot="tip"> |
| | | <el-checkbox v-model="upload.updateSupport" /> æ¯å¦æ´æ°å·²ç»åå¨çç¨æ·æ°æ® |
| | | </div> |
| | | <span>ä»
å
许导å
¥xlsãxlsxæ ¼å¼æä»¶ã</span> |
| | | <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">ä¸è½½æ¨¡æ¿</el-link> |
| | | </div> |
| | | </el-upload> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitFileForm">ç¡® å®</el-button> |
| | | <el-button @click="upload.open = false">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user"; |
| | | import { getToken } from "@/utils/auth"; |
| | | import Treeselect from "@riophae/vue-treeselect"; |
| | | import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
| | | |
| | | export default { |
| | | name: "User", |
| | | dicts: ['sys_normal_disable', 'sys_user_sex'], |
| | | components: { Treeselect }, |
| | | data() { |
| | | return { |
| | | // é®ç½©å± |
| | | loading: true, |
| | | // é䏿°ç» |
| | | ids: [], |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // ç¨æ·è¡¨æ ¼æ°æ® |
| | | userList: null, |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | // é¨é¨æ é项 |
| | | deptOptions: undefined, |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // é¨é¨åç§° |
| | | deptName: undefined, |
| | | // é»è®¤å¯ç |
| | | initPassword: undefined, |
| | | // æ¥æèå´ |
| | | dateRange: [], |
| | | // å²ä½é项 |
| | | postOptions: [], |
| | | // è§è²é项 |
| | | roleOptions: [], |
| | | // 表ååæ° |
| | | form: {}, |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "label" |
| | | }, |
| | | // ç¨æ·å¯¼å
¥åæ° |
| | | upload: { |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå±ï¼ç¨æ·å¯¼å
¥ï¼ |
| | | open: false, |
| | | // å¼¹åºå±æ é¢ï¼ç¨æ·å¯¼å
¥ï¼ |
| | | title: "", |
| | | // æ¯å¦ç¦ç¨ä¸ä¼ |
| | | isUploading: false, |
| | | // æ¯å¦æ´æ°å·²ç»åå¨çç¨æ·æ°æ® |
| | | updateSupport: 0, |
| | | // 设置ä¸ä¼ ç请æ±å¤´é¨ |
| | | headers: { Authorization: "Bearer " + getToken() }, |
| | | // ä¸ä¼ çå°å |
| | | url: process.env.VUE_APP_BASE_API + "/system/user/importData" |
| | | }, |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | userName: undefined, |
| | | phonenumber: undefined, |
| | | status: undefined, |
| | | deptId: undefined |
| | | }, |
| | | // åä¿¡æ¯ |
| | | columns: [ |
| | | { key: 0, label: `ç¨æ·ç¼å·`, visible: false }, |
| | | { 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: [ |
| | | { required: true, message: "ç¨æ·åç§°ä¸è½ä¸ºç©º", trigger: "blur" }, |
| | | { min: 2, max: 20, message: 'ç¨æ·åç§°é¿åº¦å¿
é¡»ä»äº 2 å 20 ä¹é´', trigger: 'blur' } |
| | | ], |
| | | nickName: [ |
| | | { required: true, message: "ç¨æ·æµç§°ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | password: [ |
| | | { required: true, message: "ç¨æ·å¯ç ä¸è½ä¸ºç©º", trigger: "blur" }, |
| | | { min: 5, max: 20, message: 'ç¨æ·å¯ç é¿åº¦å¿
é¡»ä»äº 5 å 20 ä¹é´', trigger: 'blur' } |
| | | ], |
| | | email: [ |
| | | { |
| | | type: "email", |
| | | message: "请è¾å
¥æ£ç¡®çé®ç®±å°å", |
| | | trigger: ["blur", "change"] |
| | | } |
| | | ], |
| | | phonenumber: [ |
| | | { |
| | | pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, |
| | | message: "请è¾å
¥æ£ç¡®çææºå·ç ", |
| | | trigger: "blur" |
| | | } |
| | | ] |
| | | } |
| | | }; |
| | | }, |
| | | watch: { |
| | | // æ ¹æ®åç§°çéé¨é¨æ |
| | | deptName(val) { |
| | | this.$refs.tree.filter(val); |
| | | } |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | this.getDeptTree(); |
| | | this.getConfigKey("sys.user.initPassword").then(response => { |
| | | this.initPassword = response.msg; |
| | | }); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢ç¨æ·å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { |
| | | this.userList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | }, |
| | | /** æ¥è¯¢é¨é¨ä¸ææ ç»æ */ |
| | | getDeptTree() { |
| | | deptTreeSelect().then(response => { |
| | | this.deptOptions = response.data; |
| | | }); |
| | | }, |
| | | // çéèç¹ |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | return data.label.indexOf(value) !== -1; |
| | | }, |
| | | // èç¹åå»äºä»¶ |
| | | handleNodeClick(data) { |
| | | this.queryParams.deptId = data.id; |
| | | this.handleQuery(); |
| | | }, |
| | | // ç¨æ·ç¶æä¿®æ¹ |
| | | handleStatusChange(row) { |
| | | let text = row.status === "0" ? "å¯ç¨" : "åç¨"; |
| | | this.$modal.confirm('确认è¦"' + text + '""' + row.userName + '"ç¨æ·åï¼').then(function() { |
| | | return changeUserStatus(row.userId, row.status); |
| | | }).then(() => { |
| | | this.$modal.msgSuccess(text + "æå"); |
| | | }).catch(function() { |
| | | row.status = row.status === "0" ? "1" : "0"; |
| | | }); |
| | | }, |
| | | // åæ¶æé® |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表åéç½® |
| | | reset() { |
| | | this.form = { |
| | | userId: undefined, |
| | | deptId: undefined, |
| | | userName: undefined, |
| | | nickName: undefined, |
| | | password: undefined, |
| | | phonenumber: undefined, |
| | | email: undefined, |
| | | sex: undefined, |
| | | status: "0", |
| | | remark: undefined, |
| | | postIds: [], |
| | | roleIds: [] |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.dateRange = []; |
| | | this.resetForm("queryForm"); |
| | | this.queryParams.deptId = undefined; |
| | | this.$refs.tree.setCurrentKey(null); |
| | | this.handleQuery(); |
| | | }, |
| | | // å¤éæ¡é䏿°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.userId); |
| | | this.single = selection.length != 1; |
| | | this.multiple = !selection.length; |
| | | }, |
| | | // æ´å¤æä½è§¦å |
| | | handleCommand(command, row) { |
| | | switch (command) { |
| | | case "handleResetPwd": |
| | | this.handleResetPwd(row); |
| | | break; |
| | | case "handleAuthRole": |
| | | this.handleAuthRole(row); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | }, |
| | | /** æ°å¢æé®æä½ */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | getUser().then(response => { |
| | | this.postOptions = response.data.posts; |
| | | this.roleOptions = response.data.roles; |
| | | this.open = true; |
| | | this.title = "æ·»å ç¨æ·"; |
| | | this.form.password = this.initPassword; |
| | | }); |
| | | }, |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const userId = row.userId || this.ids; |
| | | getUser(userId).then(response => { |
| | | this.form = response.data.user; |
| | | this.postOptions = response.data.posts; |
| | | this.roleOptions = response.data.roles; |
| | | this.$set(this.form, "postIds", response.data.postIds); |
| | | this.$set(this.form, "roleIds", response.data.roleIds); |
| | | this.open = true; |
| | | this.title = "ä¿®æ¹ç¨æ·"; |
| | | this.form.password = ""; |
| | | }); |
| | | }, |
| | | /** éç½®å¯ç æé®æä½ */ |
| | | handleResetPwd(row) { |
| | | this.$prompt('请è¾å
¥"' + row.userName + '"çæ°å¯ç ', "æç¤º", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | closeOnClickModal: false, |
| | | inputPattern: /^.{5,20}$/, |
| | | inputErrorMessage: "ç¨æ·å¯ç é¿åº¦å¿
é¡»ä»äº 5 å 20 ä¹é´" |
| | | }).then(({ value }) => { |
| | | resetUserPwd(row.userId, value).then(response => { |
| | | this.$modal.msgSuccess("ä¿®æ¹æåï¼æ°å¯ç æ¯ï¼" + value); |
| | | }); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** åé
è§è²æä½ */ |
| | | handleAuthRole: function(row) { |
| | | const userId = row.userId; |
| | | this.$router.push("/system/user-auth/role/" + userId); |
| | | }, |
| | | /** æäº¤æé® */ |
| | | submitForm: function() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.userId != undefined) { |
| | | updateUser(this.form).then(response => { |
| | | this.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addUser(this.form).then(response => { |
| | | this.$modal.msgSuccess("æ°å¢æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const userIds = row.userId || this.ids; |
| | | this.$modal.confirm('æ¯å¦ç¡®è®¤å é¤ç¨æ·ç¼å·ä¸º"' + userIds + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return delUser(userIds); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("å 餿å"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** å¯¼åºæé®æä½ */ |
| | | handleExport() { |
| | | this.download('system/user/export', { |
| | | ...this.queryParams |
| | | }, `user_${new Date().getTime()}.xlsx`) |
| | | }, |
| | | /** 导å
¥æé®æä½ */ |
| | | handleImport() { |
| | | this.upload.title = "ç¨æ·å¯¼å
¥"; |
| | | this.upload.open = true; |
| | | }, |
| | | /** ä¸è½½æ¨¡æ¿æä½ */ |
| | | importTemplate() { |
| | | this.download('system/user/importTemplate', { |
| | | }, `user_template_${new Date().getTime()}.xlsx`) |
| | | }, |
| | | // æä»¶ä¸ä¼ ä¸å¤ç |
| | | handleFileUploadProgress(event, file, fileList) { |
| | | this.upload.isUploading = true; |
| | | }, |
| | | // æä»¶ä¸ä¼ æåå¤ç |
| | | handleFileSuccess(response, file, fileList) { |
| | | this.upload.open = false; |
| | | this.upload.isUploading = false; |
| | | this.$refs.upload.clearFiles(); |
| | | this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导å
¥ç»æ", { dangerouslyUseHTMLString: true }); |
| | | this.getList(); |
| | | }, |
| | | // æäº¤ä¸ä¼ æä»¶ |
| | | submitFileForm() { |
| | | this.$refs.upload.submit(); |
| | | } |
| | | } |
| | | }; |
| | | </script> |