index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--部门数据-->
  5. <el-col :span="4" :xs="24">
  6. <div class="head-container">
  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. />
  15. </div>
  16. <div class="head-container">
  17. <el-tree
  18. :data="deptOptions"
  19. :props="defaultProps"
  20. :expand-on-click-node="false"
  21. :filter-node-method="filterNode"
  22. ref="tree"
  23. node-key="id"
  24. default-expand-all
  25. highlight-current
  26. @node-click="handleNodeClick"
  27. />
  28. </div>
  29. </el-col>
  30. <!--用户数据-->
  31. <el-col :span="20" :xs="24">
  32. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  33. <el-form-item label="用户名称" prop="userName">
  34. <el-input
  35. v-model="queryParams.userName"
  36. placeholder="请输入用户名称"
  37. clearable
  38. style="width: 240px"
  39. @keyup.enter.native="handleQuery"
  40. />
  41. </el-form-item>
  42. <el-form-item label="手机号码" prop="phonenumber">
  43. <el-input
  44. v-model="queryParams.phonenumber"
  45. placeholder="请输入手机号码"
  46. clearable
  47. style="width: 240px"
  48. @keyup.enter.native="handleQuery"
  49. />
  50. </el-form-item>
  51. <el-form-item label="状态" prop="status">
  52. <el-select
  53. v-model="queryParams.status"
  54. placeholder="用户状态"
  55. clearable
  56. style="width: 240px"
  57. >
  58. <el-option
  59. v-for="dict in dict.type.sys_normal_disable"
  60. :key="dict.value"
  61. :label="dict.label"
  62. :value="dict.value"
  63. />
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item label="创建时间">
  67. <el-date-picker
  68. v-model="dateRange"
  69. style="width: 240px"
  70. value-format="yyyy-MM-dd"
  71. type="daterange"
  72. range-separator="-"
  73. start-placeholder="开始日期"
  74. end-placeholder="结束日期"
  75. ></el-date-picker>
  76. </el-form-item>
  77. <el-form-item>
  78. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  79. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  80. </el-form-item>
  81. </el-form>
  82. <el-row :gutter="10" class="mb8">
  83. <el-col :span="1.5">
  84. <el-button
  85. type="primary"
  86. plain
  87. icon="el-icon-plus"
  88. size="mini"
  89. @click="handleAdd"
  90. v-hasPermi="['system:user:add']"
  91. >新增</el-button>
  92. </el-col>
  93. <el-col :span="1.5">
  94. <el-button
  95. type="success"
  96. plain
  97. icon="el-icon-edit"
  98. size="mini"
  99. :disabled="single"
  100. @click="handleUpdate"
  101. v-hasPermi="['system:user:edit']"
  102. >修改</el-button>
  103. </el-col>
  104. <el-col :span="1.5">
  105. <el-button
  106. type="danger"
  107. plain
  108. icon="el-icon-delete"
  109. size="mini"
  110. :disabled="multiple"
  111. @click="handleDelete"
  112. v-hasPermi="['system:user:remove']"
  113. >删除</el-button>
  114. </el-col>
  115. <el-col :span="1.5">
  116. <el-button
  117. type="info"
  118. plain
  119. icon="el-icon-upload2"
  120. size="mini"
  121. @click="handleImport"
  122. v-hasPermi="['system:user:import']"
  123. >导入</el-button>
  124. </el-col>
  125. <el-col :span="1.5">
  126. <el-button
  127. type="warning"
  128. plain
  129. icon="el-icon-download"
  130. size="mini"
  131. @click="handleExport"
  132. v-hasPermi="['system:user:export']"
  133. >导出</el-button>
  134. </el-col>
  135. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  136. </el-row>
  137. <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
  138. <el-table-column type="selection" width="50" align="center" />
  139. <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
  140. <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
  141. <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
  142. <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
  143. <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
  144. <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
  145. <template slot-scope="scope">
  146. <el-switch
  147. v-model="scope.row.status"
  148. active-value="0"
  149. inactive-value="1"
  150. @change="handleStatusChange(scope.row)"
  151. ></el-switch>
  152. </template>
  153. </el-table-column>
  154. <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
  155. <template slot-scope="scope">
  156. <span>{{ parseTime(scope.row.createTime) }}</span>
  157. </template>
  158. </el-table-column>
  159. <el-table-column
  160. label="操作"
  161. align="center"
  162. width="160"
  163. class-name="small-padding fixed-width"
  164. >
  165. <template slot-scope="scope" v-if="scope.row.userId !== 1">
  166. <el-button
  167. size="mini"
  168. type="text"
  169. icon="el-icon-edit"
  170. @click="handleUpdate(scope.row)"
  171. v-hasPermi="['system:user:edit']"
  172. >修改</el-button>
  173. <el-button
  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-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
  181. <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
  182. <el-dropdown-menu slot="dropdown">
  183. <el-dropdown-item command="handleResetPwd" icon="el-icon-key"
  184. v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
  185. <el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check"
  186. v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
  187. </el-dropdown-menu>
  188. </el-dropdown>
  189. </template>
  190. </el-table-column>
  191. </el-table>
  192. <pagination
  193. v-show="total>0"
  194. :total="total"
  195. :page.sync="queryParams.pageNum"
  196. :limit.sync="queryParams.pageSize"
  197. @pagination="getList"
  198. />
  199. </el-col>
  200. </el-row>
  201. <!-- 添加或修改用户配置对话框 -->
  202. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  203. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  204. <el-row>
  205. <el-col :span="12">
  206. <el-form-item label="用户昵称" prop="nickName">
  207. <el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
  208. </el-form-item>
  209. </el-col>
  210. <el-col :span="12">
  211. <el-form-item label="归属部门" prop="deptId">
  212. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
  213. </el-form-item>
  214. </el-col>
  215. </el-row>
  216. <el-row>
  217. <el-col :span="12">
  218. <el-form-item label="手机号码" prop="phonenumber">
  219. <el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
  220. </el-form-item>
  221. </el-col>
  222. <el-col :span="12">
  223. <el-form-item label="邮箱" prop="email">
  224. <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
  225. </el-form-item>
  226. </el-col>
  227. </el-row>
  228. <el-row>
  229. <el-col :span="12">
  230. <el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
  231. <el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
  232. </el-form-item>
  233. </el-col>
  234. <el-col :span="12">
  235. <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
  236. <el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
  237. </el-form-item>
  238. </el-col>
  239. </el-row>
  240. <el-row>
  241. <el-col :span="12">
  242. <el-form-item label="用户性别">
  243. <el-select v-model="form.sex" placeholder="请选择性别">
  244. <el-option
  245. v-for="dict in dict.type.sys_user_sex"
  246. :key="dict.value"
  247. :label="dict.label"
  248. :value="dict.value"
  249. ></el-option>
  250. </el-select>
  251. </el-form-item>
  252. </el-col>
  253. <el-col :span="12">
  254. <el-form-item label="状态">
  255. <el-radio-group v-model="form.status">
  256. <el-radio
  257. v-for="dict in dict.type.sys_normal_disable"
  258. :key="dict.value"
  259. :label="dict.value"
  260. >{{dict.label}}</el-radio>
  261. </el-radio-group>
  262. </el-form-item>
  263. </el-col>
  264. </el-row>
  265. <el-row>
  266. <el-col :span="12">
  267. <el-form-item label="岗位">
  268. <el-select v-model="form.postIds" multiple placeholder="请选择岗位">
  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>
  276. </el-select>
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="12">
  280. <el-form-item label="角色">
  281. <el-select v-model="form.roleIds" multiple placeholder="请选择角色">
  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>
  289. </el-select>
  290. </el-form-item>
  291. </el-col>
  292. </el-row>
  293. <el-row>
  294. <el-col :span="24">
  295. <el-form-item label="备注">
  296. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
  297. </el-form-item>
  298. </el-col>
  299. </el-row>
  300. </el-form>
  301. <div slot="footer" class="dialog-footer">
  302. <el-button type="primary" @click="submitForm">确 定</el-button>
  303. <el-button @click="cancel">取 消</el-button>
  304. </div>
  305. </el-dialog>
  306. <!-- 用户导入对话框 -->
  307. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  308. <el-upload
  309. ref="upload"
  310. :limit="1"
  311. accept=".xlsx, .xls"
  312. :headers="upload.headers"
  313. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  314. :disabled="upload.isUploading"
  315. :on-progress="handleFileUploadProgress"
  316. :on-success="handleFileSuccess"
  317. :auto-upload="false"
  318. drag
  319. >
  320. <i class="el-icon-upload"></i>
  321. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  322. <div class="el-upload__tip text-center" slot="tip">
  323. <div class="el-upload__tip" slot="tip">
  324. <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
  325. </div>
  326. <span>仅允许导入xls、xlsx格式文件。</span>
  327. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
  328. </div>
  329. </el-upload>
  330. <div slot="footer" class="dialog-footer">
  331. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  332. <el-button @click="upload.open = false">取 消</el-button>
  333. </div>
  334. </el-dialog>
  335. </div>
  336. </template>
  337. <script>
  338. import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
  339. import { getToken } from "@/utils/auth";
  340. import Treeselect from "@riophae/vue-treeselect";
  341. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  342. export default {
  343. name: "User",
  344. dicts: ['sys_normal_disable', 'sys_user_sex'],
  345. components: { Treeselect },
  346. data() {
  347. return {
  348. // 遮罩层
  349. loading: true,
  350. // 选中数组
  351. ids: [],
  352. // 非单个禁用
  353. single: true,
  354. // 非多个禁用
  355. multiple: true,
  356. // 显示搜索条件
  357. showSearch: true,
  358. // 总条数
  359. total: 0,
  360. // 用户表格数据
  361. userList: null,
  362. // 弹出层标题
  363. title: "",
  364. // 部门树选项
  365. deptOptions: undefined,
  366. // 是否显示弹出层
  367. open: false,
  368. // 部门名称
  369. deptName: undefined,
  370. // 默认密码
  371. initPassword: undefined,
  372. // 日期范围
  373. dateRange: [],
  374. // 岗位选项
  375. postOptions: [],
  376. // 角色选项
  377. roleOptions: [],
  378. // 表单参数
  379. form: {},
  380. defaultProps: {
  381. children: "children",
  382. label: "label"
  383. },
  384. // 用户导入参数
  385. upload: {
  386. // 是否显示弹出层(用户导入)
  387. open: false,
  388. // 弹出层标题(用户导入)
  389. title: "",
  390. // 是否禁用上传
  391. isUploading: false,
  392. // 是否更新已经存在的用户数据
  393. updateSupport: 0,
  394. // 设置上传的请求头部
  395. headers: { Authorization: "Bearer " + getToken() },
  396. // 上传的地址
  397. url: process.env.VUE_APP_BASE_API + "/system/user/importData"
  398. },
  399. // 查询参数
  400. queryParams: {
  401. pageNum: 1,
  402. pageSize: 10,
  403. userName: undefined,
  404. phonenumber: undefined,
  405. status: undefined,
  406. deptId: undefined
  407. },
  408. // 列信息
  409. columns: [
  410. { key: 0, label: `用户编号`, visible: true },
  411. { key: 1, label: `用户名称`, visible: true },
  412. { key: 2, label: `用户昵称`, visible: true },
  413. { key: 3, label: `部门`, visible: true },
  414. { key: 4, label: `手机号码`, visible: true },
  415. { key: 5, label: `状态`, visible: true },
  416. { key: 6, label: `创建时间`, visible: true }
  417. ],
  418. // 表单校验
  419. rules: {
  420. userName: [
  421. { required: true, message: "用户名称不能为空", trigger: "blur" },
  422. { min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
  423. ],
  424. nickName: [
  425. { required: true, message: "用户昵称不能为空", trigger: "blur" }
  426. ],
  427. password: [
  428. { required: true, message: "用户密码不能为空", trigger: "blur" },
  429. { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
  430. { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
  431. ],
  432. email: [
  433. {
  434. type: "email",
  435. message: "请输入正确的邮箱地址",
  436. trigger: ["blur", "change"]
  437. }
  438. ],
  439. phonenumber: [
  440. {
  441. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  442. message: "请输入正确的手机号码",
  443. trigger: "blur"
  444. }
  445. ]
  446. }
  447. };
  448. },
  449. watch: {
  450. // 根据名称筛选部门树
  451. deptName(val) {
  452. this.$refs.tree.filter(val);
  453. }
  454. },
  455. created() {
  456. this.getList();
  457. this.getDeptTree();
  458. this.getConfigKey("sys.user.initPassword").then(response => {
  459. this.initPassword = response.msg;
  460. });
  461. },
  462. methods: {
  463. /** 查询用户列表 */
  464. getList() {
  465. this.loading = true;
  466. listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  467. this.userList = response.rows;
  468. this.total = response.total;
  469. this.loading = false;
  470. }
  471. );
  472. },
  473. /** 查询部门下拉树结构 */
  474. getDeptTree() {
  475. deptTreeSelect().then(response => {
  476. this.deptOptions = response.data;
  477. });
  478. },
  479. // 筛选节点
  480. filterNode(value, data) {
  481. if (!value) return true;
  482. return data.label.indexOf(value) !== -1;
  483. },
  484. // 节点单击事件
  485. handleNodeClick(data) {
  486. this.queryParams.deptId = data.id;
  487. this.handleQuery();
  488. },
  489. // 用户状态修改
  490. handleStatusChange(row) {
  491. let text = row.status === "0" ? "启用" : "停用";
  492. this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
  493. return changeUserStatus(row.userId, row.status);
  494. }).then(() => {
  495. this.$modal.msgSuccess(text + "成功");
  496. }).catch(function() {
  497. row.status = row.status === "0" ? "1" : "0";
  498. });
  499. },
  500. // 取消按钮
  501. cancel() {
  502. this.open = false;
  503. this.reset();
  504. },
  505. // 表单重置
  506. reset() {
  507. this.form = {
  508. userId: undefined,
  509. deptId: undefined,
  510. userName: undefined,
  511. nickName: undefined,
  512. password: undefined,
  513. phonenumber: undefined,
  514. email: undefined,
  515. sex: undefined,
  516. status: "0",
  517. remark: undefined,
  518. postIds: [],
  519. roleIds: []
  520. };
  521. this.resetForm("form");
  522. },
  523. /** 搜索按钮操作 */
  524. handleQuery() {
  525. this.queryParams.pageNum = 1;
  526. this.getList();
  527. },
  528. /** 重置按钮操作 */
  529. resetQuery() {
  530. this.dateRange = [];
  531. this.resetForm("queryForm");
  532. this.queryParams.deptId = undefined;
  533. this.$refs.tree.setCurrentKey(null);
  534. this.handleQuery();
  535. },
  536. // 多选框选中数据
  537. handleSelectionChange(selection) {
  538. this.ids = selection.map(item => item.userId);
  539. this.single = selection.length != 1;
  540. this.multiple = !selection.length;
  541. },
  542. // 更多操作触发
  543. handleCommand(command, row) {
  544. switch (command) {
  545. case "handleResetPwd":
  546. this.handleResetPwd(row);
  547. break;
  548. case "handleAuthRole":
  549. this.handleAuthRole(row);
  550. break;
  551. default:
  552. break;
  553. }
  554. },
  555. /** 新增按钮操作 */
  556. handleAdd() {
  557. this.reset();
  558. getUser().then(response => {
  559. this.postOptions = response.posts;
  560. this.roleOptions = response.roles;
  561. this.open = true;
  562. this.title = "添加用户";
  563. this.form.password = this.initPassword;
  564. });
  565. },
  566. /** 修改按钮操作 */
  567. handleUpdate(row) {
  568. this.reset();
  569. const userId = row.userId || this.ids;
  570. getUser(userId).then(response => {
  571. this.form = response.data;
  572. this.postOptions = response.posts;
  573. this.roleOptions = response.roles;
  574. this.$set(this.form, "postIds", response.postIds);
  575. this.$set(this.form, "roleIds", response.roleIds);
  576. this.open = true;
  577. this.title = "修改用户";
  578. this.form.password = "";
  579. });
  580. },
  581. /** 重置密码按钮操作 */
  582. handleResetPwd(row) {
  583. this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
  584. confirmButtonText: "确定",
  585. cancelButtonText: "取消",
  586. closeOnClickModal: false,
  587. inputPattern: /^.{5,20}$/,
  588. inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
  589. inputValidator: (value) => {
  590. if (/<|>|"|'|\||\\/.test(value)) {
  591. return "不能包含非法字符:< > \" ' \\\ |"
  592. }
  593. },
  594. }).then(({ value }) => {
  595. resetUserPwd(row.userId, value).then(response => {
  596. this.$modal.msgSuccess("修改成功,新密码是:" + value);
  597. });
  598. }).catch(() => {});
  599. },
  600. /** 分配角色操作 */
  601. handleAuthRole: function(row) {
  602. const userId = row.userId;
  603. this.$router.push("/system/user-auth/role/" + userId);
  604. },
  605. /** 提交按钮 */
  606. submitForm: function() {
  607. this.$refs["form"].validate(valid => {
  608. if (valid) {
  609. if (this.form.userId != undefined) {
  610. updateUser(this.form).then(response => {
  611. this.$modal.msgSuccess("修改成功");
  612. this.open = false;
  613. this.getList();
  614. });
  615. } else {
  616. addUser(this.form).then(response => {
  617. this.$modal.msgSuccess("新增成功");
  618. this.open = false;
  619. this.getList();
  620. });
  621. }
  622. }
  623. });
  624. },
  625. /** 删除按钮操作 */
  626. handleDelete(row) {
  627. const userIds = row.userId || this.ids;
  628. this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
  629. return delUser(userIds);
  630. }).then(() => {
  631. this.getList();
  632. this.$modal.msgSuccess("删除成功");
  633. }).catch(() => {});
  634. },
  635. /** 导出按钮操作 */
  636. handleExport() {
  637. this.download('system/user/export', {
  638. ...this.queryParams
  639. }, `user_${new Date().getTime()}.xlsx`)
  640. },
  641. /** 导入按钮操作 */
  642. handleImport() {
  643. this.upload.title = "用户导入";
  644. this.upload.open = true;
  645. },
  646. /** 下载模板操作 */
  647. importTemplate() {
  648. this.download('system/user/importTemplate', {
  649. }, `user_template_${new Date().getTime()}.xlsx`)
  650. },
  651. // 文件上传中处理
  652. handleFileUploadProgress(event, file, fileList) {
  653. this.upload.isUploading = true;
  654. },
  655. // 文件上传成功处理
  656. handleFileSuccess(response, file, fileList) {
  657. this.upload.open = false;
  658. this.upload.isUploading = false;
  659. this.$refs.upload.clearFiles();
  660. this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
  661. this.getList();
  662. },
  663. // 提交上传文件
  664. submitFileForm() {
  665. this.$refs.upload.submit();
  666. }
  667. }
  668. };
  669. </script>