作者 RuoYi

格式化代码

@@ -4,28 +4,77 @@ @@ -4,28 +4,77 @@
4 <!--部门数据--> 4 <!--部门数据-->
5 <el-col :span="4" :xs="24"> 5 <el-col :span="4" :xs="24">
6 <div class="head-container"> 6 <div class="head-container">
7 - <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" /> 7 + <el-input
  8 + v-model="deptName"
  9 + placeholder="请输入部门名称"
  10 + clearable
  11 + size="small"
  12 + prefix-icon="el-icon-search"
  13 + style="margin-bottom: 20px"
  14 + />
8 </div> 15 </div>
9 <div class="head-container"> 16 <div class="head-container">
10 - <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" default-expand-all @node-click="handleNodeClick" /> 17 + <el-tree
  18 + :data="deptOptions"
  19 + :props="defaultProps"
  20 + :expand-on-click-node="false"
  21 + :filter-node-method="filterNode"
  22 + ref="tree"
  23 + default-expand-all
  24 + @node-click="handleNodeClick"
  25 + />
11 </div> 26 </div>
12 </el-col> 27 </el-col>
13 <!--用户数据--> 28 <!--用户数据-->
14 <el-col :span="20" :xs="24"> 29 <el-col :span="20" :xs="24">
15 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> 30 <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
16 <el-form-item label="用户名称" prop="userName"> 31 <el-form-item label="用户名称" prop="userName">
17 - <el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" /> 32 + <el-input
  33 + v-model="queryParams.userName"
  34 + placeholder="请输入用户名称"
  35 + clearable
  36 + size="small"
  37 + style="width: 240px"
  38 + @keyup.enter.native="handleQuery"
  39 + />
18 </el-form-item> 40 </el-form-item>
19 <el-form-item label="手机号码" prop="phonenumber"> 41 <el-form-item label="手机号码" prop="phonenumber">
20 - <el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable size="small" style="width: 240px" @keyup.enter.native="handleQuery" /> 42 + <el-input
  43 + v-model="queryParams.phonenumber"
  44 + placeholder="请输入手机号码"
  45 + clearable
  46 + size="small"
  47 + style="width: 240px"
  48 + @keyup.enter.native="handleQuery"
  49 + />
21 </el-form-item> 50 </el-form-item>
22 <el-form-item label="状态" prop="status"> 51 <el-form-item label="状态" prop="status">
23 - <el-select v-model="queryParams.status" placeholder="用户状态" clearable size="small" style="width: 240px">  
24 - <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" /> 52 + <el-select
  53 + v-model="queryParams.status"
  54 + placeholder="用户状态"
  55 + clearable
  56 + size="small"
  57 + style="width: 240px"
  58 + >
  59 + <el-option
  60 + v-for="dict in statusOptions"
  61 + :key="dict.dictValue"
  62 + :label="dict.dictLabel"
  63 + :value="dict.dictValue"
  64 + />
25 </el-select> 65 </el-select>
26 </el-form-item> 66 </el-form-item>
27 <el-form-item label="创建时间"> 67 <el-form-item label="创建时间">
28 - <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> 68 + <el-date-picker
  69 + v-model="dateRange"
  70 + size="small"
  71 + style="width: 240px"
  72 + value-format="yyyy-MM-dd"
  73 + type="daterange"
  74 + range-separator="-"
  75 + start-placeholder="开始日期"
  76 + end-placeholder="结束日期"
  77 + ></el-date-picker>
29 </el-form-item> 78 </el-form-item>
30 <el-form-item> 79 <el-form-item>
31 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> 80 <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -35,19 +84,51 @@ @@ -35,19 +84,51 @@
35 84
36 <el-row :gutter="10" class="mb8"> 85 <el-row :gutter="10" class="mb8">
37 <el-col :span="1.5"> 86 <el-col :span="1.5">
38 - <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button> 87 + <el-button
  88 + type="primary"
  89 + icon="el-icon-plus"
  90 + size="mini"
  91 + @click="handleAdd"
  92 + v-hasPermi="['system:user:add']"
  93 + >新增</el-button>
39 </el-col> 94 </el-col>
40 <el-col :span="1.5"> 95 <el-col :span="1.5">
41 - <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:user:edit']">修改</el-button> 96 + <el-button
  97 + type="success"
  98 + icon="el-icon-edit"
  99 + size="mini"
  100 + :disabled="single"
  101 + @click="handleUpdate"
  102 + v-hasPermi="['system:user:edit']"
  103 + >修改</el-button>
42 </el-col> 104 </el-col>
43 <el-col :span="1.5"> 105 <el-col :span="1.5">
44 - <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']">删除</el-button> 106 + <el-button
  107 + type="danger"
  108 + icon="el-icon-delete"
  109 + size="mini"
  110 + :disabled="multiple"
  111 + @click="handleDelete"
  112 + v-hasPermi="['system:user:remove']"
  113 + >删除</el-button>
45 </el-col> 114 </el-col>
46 <el-col :span="1.5"> 115 <el-col :span="1.5">
47 - <el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['system:user:import']">导入</el-button> 116 + <el-button
  117 + type="info"
  118 + icon="el-icon-upload2"
  119 + size="mini"
  120 + @click="handleImport"
  121 + v-hasPermi="['system:user:import']"
  122 + >导入</el-button>
48 </el-col> 123 </el-col>
49 <el-col :span="1.5"> 124 <el-col :span="1.5">
50 - <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:user:export']">导出</el-button> 125 + <el-button
  126 + type="warning"
  127 + icon="el-icon-download"
  128 + size="mini"
  129 + @click="handleExport"
  130 + v-hasPermi="['system:user:export']"
  131 + >导出</el-button>
51 </el-col> 132 </el-col>
52 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> 133 <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
53 </el-row> 134 </el-row>
@@ -61,7 +142,12 @@ @@ -61,7 +142,12 @@
61 <el-table-column label="手机号码" align="center" prop="phonenumber" width="120" /> 142 <el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
62 <el-table-column label="状态" align="center"> 143 <el-table-column label="状态" align="center">
63 <template slot-scope="scope"> 144 <template slot-scope="scope">
64 - <el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch> 145 + <el-switch
  146 + v-model="scope.row.status"
  147 + active-value="0"
  148 + inactive-value="1"
  149 + @change="handleStatusChange(scope.row)"
  150 + ></el-switch>
65 </template> 151 </template>
66 </el-table-column> 152 </el-table-column>
67 <el-table-column label="创建时间" align="center" prop="createTime" width="160"> 153 <el-table-column label="创建时间" align="center" prop="createTime" width="160">
@@ -69,16 +155,46 @@ @@ -69,16 +155,46 @@
69 <span>{{ parseTime(scope.row.createTime) }}</span> 155 <span>{{ parseTime(scope.row.createTime) }}</span>
70 </template> 156 </template>
71 </el-table-column> 157 </el-table-column>
72 - <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> 158 + <el-table-column
  159 + label="操作"
  160 + align="center"
  161 + width="160"
  162 + class-name="small-padding fixed-width"
  163 + >
73 <template slot-scope="scope"> 164 <template slot-scope="scope">
74 - <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">修改</el-button>  
75 - <el-button v-if="scope.row.userId !== 1" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">删除</el-button>  
76 - <el-button size="mini" type="text" icon="el-icon-key" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']">重置</el-button> 165 + <el-button
  166 + size="mini"
  167 + type="text"
  168 + icon="el-icon-edit"
  169 + @click="handleUpdate(scope.row)"
  170 + v-hasPermi="['system:user:edit']"
  171 + >修改</el-button>
  172 + <el-button
  173 + v-if="scope.row.userId !== 1"
  174 + size="mini"
  175 + type="text"
  176 + icon="el-icon-delete"
  177 + @click="handleDelete(scope.row)"
  178 + v-hasPermi="['system:user:remove']"
  179 + >删除</el-button>
  180 + <el-button
  181 + size="mini"
  182 + type="text"
  183 + icon="el-icon-key"
  184 + @click="handleResetPwd(scope.row)"
  185 + v-hasPermi="['system:user:resetPwd']"
  186 + >重置</el-button>
77 </template> 187 </template>
78 </el-table-column> 188 </el-table-column>
79 </el-table> 189 </el-table>
80 190
81 - <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> 191 + <pagination
  192 + v-show="total>0"
  193 + :total="total"
  194 + :page.sync="queryParams.pageNum"
  195 + :limit.sync="queryParams.pageSize"
  196 + @pagination="getList"
  197 + />
82 </el-col> 198 </el-col>
83 </el-row> 199 </el-row>
84 200
@@ -125,14 +241,23 @@ @@ -125,14 +241,23 @@
125 <el-col :span="12"> 241 <el-col :span="12">
126 <el-form-item label="用户性别"> 242 <el-form-item label="用户性别">
127 <el-select v-model="form.sex" placeholder="请选择"> 243 <el-select v-model="form.sex" placeholder="请选择">
128 - <el-option v-for="dict in sexOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue"></el-option> 244 + <el-option
  245 + v-for="dict in sexOptions"
  246 + :key="dict.dictValue"
  247 + :label="dict.dictLabel"
  248 + :value="dict.dictValue"
  249 + ></el-option>
129 </el-select> 250 </el-select>
130 </el-form-item> 251 </el-form-item>
131 </el-col> 252 </el-col>
132 <el-col :span="12"> 253 <el-col :span="12">
133 <el-form-item label="状态"> 254 <el-form-item label="状态">
134 <el-radio-group v-model="form.status"> 255 <el-radio-group v-model="form.status">
135 - <el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio> 256 + <el-radio
  257 + v-for="dict in statusOptions"
  258 + :key="dict.dictValue"
  259 + :label="dict.dictValue"
  260 + >{{dict.dictLabel}}</el-radio>
136 </el-radio-group> 261 </el-radio-group>
137 </el-form-item> 262 </el-form-item>
138 </el-col> 263 </el-col>
@@ -141,14 +266,26 @@ @@ -141,14 +266,26 @@
141 <el-col :span="12"> 266 <el-col :span="12">
142 <el-form-item label="岗位"> 267 <el-form-item label="岗位">
143 <el-select v-model="form.postIds" multiple placeholder="请选择"> 268 <el-select v-model="form.postIds" multiple placeholder="请选择">
144 - <el-option v-for="item in postOptions" :key="item.postId" :label="item.postName" :value="item.postId" :disabled="item.status == 1"></el-option> 269 + <el-option
  270 + v-for="item in postOptions"
  271 + :key="item.postId"
  272 + :label="item.postName"
  273 + :value="item.postId"
  274 + :disabled="item.status == 1"
  275 + ></el-option>
145 </el-select> 276 </el-select>
146 </el-form-item> 277 </el-form-item>
147 </el-col> 278 </el-col>
148 <el-col :span="12"> 279 <el-col :span="12">
149 <el-form-item label="角色"> 280 <el-form-item label="角色">
150 <el-select v-model="form.roleIds" multiple placeholder="请选择"> 281 <el-select v-model="form.roleIds" multiple placeholder="请选择">
151 - <el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId" :disabled="item.status == 1"></el-option> 282 + <el-option
  283 + v-for="item in roleOptions"
  284 + :key="item.roleId"
  285 + :label="item.roleName"
  286 + :value="item.roleId"
  287 + :disabled="item.status == 1"
  288 + ></el-option>
152 </el-select> 289 </el-select>
153 </el-form-item> 290 </el-form-item>
154 </el-col> 291 </el-col>
@@ -169,7 +306,18 @@ @@ -169,7 +306,18 @@
169 306
170 <!-- 用户导入对话框 --> 307 <!-- 用户导入对话框 -->
171 <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body> 308 <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
172 - <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> 309 + <el-upload
  310 + ref="upload"
  311 + :limit="1"
  312 + accept=".xlsx, .xls"
  313 + :headers="upload.headers"
  314 + :action="upload.url + '?updateSupport=' + upload.updateSupport"
  315 + :disabled="upload.isUploading"
  316 + :on-progress="handleFileUploadProgress"
  317 + :on-success="handleFileSuccess"
  318 + :auto-upload="false"
  319 + drag
  320 + >
173 <i class="el-icon-upload"></i> 321 <i class="el-icon-upload"></i>
174 <div class="el-upload__text"> 322 <div class="el-upload__text">
175 将文件拖到此处,或 323 将文件拖到此处,或
@@ -190,17 +338,7 @@ @@ -190,17 +338,7 @@
190 </template> 338 </template>
191 339
192 <script> 340 <script>
193 -import {  
194 - listUser,  
195 - getUser,  
196 - delUser,  
197 - addUser,  
198 - updateUser,  
199 - exportUser,  
200 - resetUserPwd,  
201 - changeUserStatus,  
202 - importTemplate,  
203 -} from "@/api/system/user"; 341 +import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
204 import { getToken } from "@/utils/auth"; 342 import { getToken } from "@/utils/auth";
205 import { treeselect } from "@/api/system/dept"; 343 import { treeselect } from "@/api/system/dept";
206 import Treeselect from "@riophae/vue-treeselect"; 344 import Treeselect from "@riophae/vue-treeselect";
@@ -249,7 +387,7 @@ export default { @@ -249,7 +387,7 @@ export default {
249 form: {}, 387 form: {},
250 defaultProps: { 388 defaultProps: {
251 children: "children", 389 children: "children",
252 - label: "label", 390 + label: "label"
253 }, 391 },
254 // 用户导入参数 392 // 用户导入参数
255 upload: { 393 upload: {
@@ -264,7 +402,7 @@ export default { @@ -264,7 +402,7 @@ export default {
264 // 设置上传的请求头部 402 // 设置上传的请求头部
265 headers: { Authorization: "Bearer " + getToken() }, 403 headers: { Authorization: "Bearer " + getToken() },
266 // 上传的地址 404 // 上传的地址
267 - url: process.env.VUE_APP_BASE_API + "/system/user/importData", 405 + url: process.env.VUE_APP_BASE_API + "/system/user/importData"
268 }, 406 },
269 // 查询参数 407 // 查询参数
270 queryParams: { 408 queryParams: {
@@ -273,57 +411,57 @@ export default { @@ -273,57 +411,57 @@ export default {
273 userName: undefined, 411 userName: undefined,
274 phonenumber: undefined, 412 phonenumber: undefined,
275 status: undefined, 413 status: undefined,
276 - deptId: undefined, 414 + deptId: undefined
277 }, 415 },
278 // 表单校验 416 // 表单校验
279 rules: { 417 rules: {
280 userName: [ 418 userName: [
281 - { required: true, message: "用户名称不能为空", trigger: "blur" }, 419 + { required: true, message: "用户名称不能为空", trigger: "blur" }
282 ], 420 ],
283 nickName: [ 421 nickName: [
284 - { required: true, message: "用户昵称不能为空", trigger: "blur" }, 422 + { required: true, message: "用户昵称不能为空", trigger: "blur" }
285 ], 423 ],
286 deptId: [ 424 deptId: [
287 - { required: true, message: "归属部门不能为空", trigger: "blur" }, 425 + { required: true, message: "归属部门不能为空", trigger: "blur" }
288 ], 426 ],
289 password: [ 427 password: [
290 - { required: true, message: "用户密码不能为空", trigger: "blur" }, 428 + { required: true, message: "用户密码不能为空", trigger: "blur" }
291 ], 429 ],
292 email: [ 430 email: [
293 { required: true, message: "邮箱地址不能为空", trigger: "blur" }, 431 { required: true, message: "邮箱地址不能为空", trigger: "blur" },
294 { 432 {
295 type: "email", 433 type: "email",
296 message: "'请输入正确的邮箱地址", 434 message: "'请输入正确的邮箱地址",
297 - trigger: ["blur", "change"],  
298 - }, 435 + trigger: ["blur", "change"]
  436 + }
299 ], 437 ],
300 phonenumber: [ 438 phonenumber: [
301 { required: true, message: "手机号码不能为空", trigger: "blur" }, 439 { required: true, message: "手机号码不能为空", trigger: "blur" },
302 { 440 {
303 pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, 441 pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
304 message: "请输入正确的手机号码", 442 message: "请输入正确的手机号码",
305 - trigger: "blur",  
306 - },  
307 - ],  
308 - }, 443 + trigger: "blur"
  444 + }
  445 + ]
  446 + }
309 }; 447 };
310 }, 448 },
311 watch: { 449 watch: {
312 // 根据名称筛选部门树 450 // 根据名称筛选部门树
313 deptName(val) { 451 deptName(val) {
314 this.$refs.tree.filter(val); 452 this.$refs.tree.filter(val);
315 - }, 453 + }
316 }, 454 },
317 created() { 455 created() {
318 this.getList(); 456 this.getList();
319 this.getTreeselect(); 457 this.getTreeselect();
320 - this.getDicts("sys_normal_disable").then((response) => { 458 + this.getDicts("sys_normal_disable").then(response => {
321 this.statusOptions = response.data; 459 this.statusOptions = response.data;
322 }); 460 });
323 - this.getDicts("sys_user_sex").then((response) => { 461 + this.getDicts("sys_user_sex").then(response => {
324 this.sexOptions = response.data; 462 this.sexOptions = response.data;
325 }); 463 });
326 - this.getConfigKey("sys.user.initPassword").then((response) => { 464 + this.getConfigKey("sys.user.initPassword").then(response => {
327 this.initPassword = response.msg; 465 this.initPassword = response.msg;
328 }); 466 });
329 }, 467 },
@@ -331,8 +469,7 @@ export default { @@ -331,8 +469,7 @@ export default {
331 /** 查询用户列表 */ 469 /** 查询用户列表 */
332 getList() { 470 getList() {
333 this.loading = true; 471 this.loading = true;
334 - listUser(this.addDateRange(this.queryParams, this.dateRange)).then(  
335 - (response) => { 472 + listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
336 this.userList = response.rows; 473 this.userList = response.rows;
337 this.total = response.total; 474 this.total = response.total;
338 this.loading = false; 475 this.loading = false;
@@ -341,7 +478,7 @@ export default { @@ -341,7 +478,7 @@ export default {
341 }, 478 },
342 /** 查询部门下拉树结构 */ 479 /** 查询部门下拉树结构 */
343 getTreeselect() { 480 getTreeselect() {
344 - treeselect().then((response) => { 481 + treeselect().then(response => {
345 this.deptOptions = response.data; 482 this.deptOptions = response.data;
346 }); 483 });
347 }, 484 },
@@ -358,22 +495,15 @@ export default { @@ -358,22 +495,15 @@ export default {
358 // 用户状态修改 495 // 用户状态修改
359 handleStatusChange(row) { 496 handleStatusChange(row) {
360 let text = row.status === "0" ? "启用" : "停用"; 497 let text = row.status === "0" ? "启用" : "停用";
361 - this.$confirm(  
362 - '确认要"' + text + '""' + row.userName + '"用户吗?',  
363 - "警告",  
364 - { 498 + this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", {
365 confirmButtonText: "确定", 499 confirmButtonText: "确定",
366 cancelButtonText: "取消", 500 cancelButtonText: "取消",
367 - type: "warning",  
368 - }  
369 - )  
370 - .then(function () { 501 + type: "warning"
  502 + }).then(function() {
371 return changeUserStatus(row.userId, row.status); 503 return changeUserStatus(row.userId, row.status);
372 - })  
373 - .then(() => { 504 + }).then(() => {
374 this.msgSuccess(text + "成功"); 505 this.msgSuccess(text + "成功");
375 - })  
376 - .catch(function () { 506 + }).catch(function() {
377 row.status = row.status === "0" ? "1" : "0"; 507 row.status = row.status === "0" ? "1" : "0";
378 }); 508 });
379 }, 509 },
@@ -396,7 +526,7 @@ export default { @@ -396,7 +526,7 @@ export default {
396 status: "0", 526 status: "0",
397 remark: undefined, 527 remark: undefined,
398 postIds: [], 528 postIds: [],
399 - roleIds: [], 529 + roleIds: []
400 }; 530 };
401 this.resetForm("form"); 531 this.resetForm("form");
402 }, 532 },
@@ -413,7 +543,7 @@ export default { @@ -413,7 +543,7 @@ export default {
413 }, 543 },
414 // 多选框选中数据 544 // 多选框选中数据
415 handleSelectionChange(selection) { 545 handleSelectionChange(selection) {
416 - this.ids = selection.map((item) => item.userId); 546 + this.ids = selection.map(item => item.userId);
417 this.single = selection.length != 1; 547 this.single = selection.length != 1;
418 this.multiple = !selection.length; 548 this.multiple = !selection.length;
419 }, 549 },
@@ -421,7 +551,7 @@ export default { @@ -421,7 +551,7 @@ export default {
421 handleAdd() { 551 handleAdd() {
422 this.reset(); 552 this.reset();
423 this.getTreeselect(); 553 this.getTreeselect();
424 - getUser().then((response) => { 554 + getUser().then(response => {
425 this.postOptions = response.posts; 555 this.postOptions = response.posts;
426 this.roleOptions = response.roles; 556 this.roleOptions = response.roles;
427 this.open = true; 557 this.open = true;
@@ -434,7 +564,7 @@ export default { @@ -434,7 +564,7 @@ export default {
434 this.reset(); 564 this.reset();
435 this.getTreeselect(); 565 this.getTreeselect();
436 const userId = row.userId || this.ids; 566 const userId = row.userId || this.ids;
437 - getUser(userId).then((response) => { 567 + getUser(userId).then(response => {
438 this.form = response.data; 568 this.form = response.data;
439 this.postOptions = response.posts; 569 this.postOptions = response.posts;
440 this.roleOptions = response.roles; 570 this.roleOptions = response.roles;
@@ -449,23 +579,21 @@ export default { @@ -449,23 +579,21 @@ export default {
449 handleResetPwd(row) { 579 handleResetPwd(row) {
450 this.$prompt('请输入"' + row.userName + '"的新密码', "提示", { 580 this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
451 confirmButtonText: "确定", 581 confirmButtonText: "确定",
452 - cancelButtonText: "取消",  
453 - })  
454 - .then(({ value }) => {  
455 - resetUserPwd(row.userId, value).then((response) => { 582 + cancelButtonText: "取消"
  583 + }).then(({ value }) => {
  584 + resetUserPwd(row.userId, value).then(response => {
456 if (response.code === 200) { 585 if (response.code === 200) {
457 this.msgSuccess("修改成功,新密码是:" + value); 586 this.msgSuccess("修改成功,新密码是:" + value);
458 } 587 }
459 }); 588 });
460 - })  
461 - .catch(() => {}); 589 + }).catch(() => {});
462 }, 590 },
463 /** 提交按钮 */ 591 /** 提交按钮 */
464 - submitForm: function () {  
465 - this.$refs["form"].validate((valid) => { 592 + submitForm: function() {
  593 + this.$refs["form"].validate(valid => {
466 if (valid) { 594 if (valid) {
467 if (this.form.userId != undefined) { 595 if (this.form.userId != undefined) {
468 - updateUser(this.form).then((response) => { 596 + updateUser(this.form).then(response => {
469 if (response.code === 200) { 597 if (response.code === 200) {
470 this.msgSuccess("修改成功"); 598 this.msgSuccess("修改成功");
471 this.open = false; 599 this.open = false;
@@ -473,7 +601,7 @@ export default { @@ -473,7 +601,7 @@ export default {
473 } 601 }
474 }); 602 });
475 } else { 603 } else {
476 - addUser(this.form).then((response) => { 604 + addUser(this.form).then(response => {
477 if (response.code === 200) { 605 if (response.code === 200) {
478 this.msgSuccess("新增成功"); 606 this.msgSuccess("新增成功");
479 this.open = false; 607 this.open = false;
@@ -487,39 +615,29 @@ export default { @@ -487,39 +615,29 @@ export default {
487 /** 删除按钮操作 */ 615 /** 删除按钮操作 */
488 handleDelete(row) { 616 handleDelete(row) {
489 const userIds = row.userId || this.ids; 617 const userIds = row.userId || this.ids;
490 - this.$confirm(  
491 - '是否确认删除用户编号为"' + userIds + '"的数据项?',  
492 - "警告",  
493 - { 618 + this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
494 confirmButtonText: "确定", 619 confirmButtonText: "确定",
495 cancelButtonText: "取消", 620 cancelButtonText: "取消",
496 - type: "warning",  
497 - }  
498 - )  
499 - .then(function () { 621 + type: "warning"
  622 + }).then(function() {
500 return delUser(userIds); 623 return delUser(userIds);
501 - })  
502 - .then(() => { 624 + }).then(() => {
503 this.getList(); 625 this.getList();
504 this.msgSuccess("删除成功"); 626 this.msgSuccess("删除成功");
505 - })  
506 - .catch(function () {}); 627 + }).catch(function() {});
507 }, 628 },
508 /** 导出按钮操作 */ 629 /** 导出按钮操作 */
509 handleExport() { 630 handleExport() {
510 const queryParams = this.queryParams; 631 const queryParams = this.queryParams;
511 - this.$confirm("是否确认导出所有用户数据项?", "警告", { 632 + this.$confirm('是否确认导出所有用户数据项?', "警告", {
512 confirmButtonText: "确定", 633 confirmButtonText: "确定",
513 cancelButtonText: "取消", 634 cancelButtonText: "取消",
514 - type: "warning",  
515 - })  
516 - .then(function () { 635 + type: "warning"
  636 + }).then(function() {
517 return exportUser(queryParams); 637 return exportUser(queryParams);
518 - })  
519 - .then((response) => { 638 + }).then(response => {
520 this.download(response.msg); 639 this.download(response.msg);
521 - })  
522 - .catch(function () {}); 640 + }).catch(function() {});
523 }, 641 },
524 /** 导入按钮操作 */ 642 /** 导入按钮操作 */
525 handleImport() { 643 handleImport() {
@@ -528,7 +646,7 @@ export default { @@ -528,7 +646,7 @@ export default {
528 }, 646 },
529 /** 下载模板操作 */ 647 /** 下载模板操作 */
530 importTemplate() { 648 importTemplate() {
531 - importTemplate().then((response) => { 649 + importTemplate().then(response => {
532 this.download(response.msg); 650 this.download(response.msg);
533 }); 651 });
534 }, 652 },
@@ -547,7 +665,7 @@ export default { @@ -547,7 +665,7 @@ export default {
547 // 提交上传文件 665 // 提交上传文件
548 submitFileForm() { 666 submitFileForm() {
549 this.$refs.upload.submit(); 667 this.$refs.upload.submit();
550 - },  
551 - }, 668 + }
  669 + }
552 }; 670 };
553 </script> 671 </script>