index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="课程编号" prop="courseCode">
  5. <el-input
  6. v-model="queryParams.courseCode"
  7. placeholder="请输入课程编号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="培训主题" prop="topic">
  14. <el-input
  15. v-model="queryParams.topic"
  16. placeholder="请输入培训主题"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="讲师" prop="trainer">
  23. <el-input
  24. v-model="queryParams.trainer"
  25. placeholder="请输入讲师"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  33. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  34. </el-form-item>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button
  39. type="primary"
  40. icon="el-icon-plus"
  41. size="mini"
  42. @click="handleAdd"
  43. v-hasPermi="['bccnew:firstPlanTmpl:add']"
  44. >新增
  45. </el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button
  49. type="success"
  50. icon="el-icon-edit"
  51. size="mini"
  52. :disabled="single"
  53. @click="handleUpdate"
  54. v-hasPermi="['bccnew:firstPlanTmpl:edit']"
  55. >修改
  56. </el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="danger"
  61. icon="el-icon-delete"
  62. size="mini"
  63. :disabled="multiple"
  64. @click="handleDelete"
  65. v-hasPermi="['bccnew:firstPlanTmpl:remove']"
  66. >删除
  67. </el-button>
  68. </el-col>
  69. <el-col :span="1.5">
  70. <el-button
  71. type="info"
  72. icon="el-icon-upload2"
  73. size="mini"
  74. @click="handleImport"
  75. v-hasPermi="['bccnew:firstPlanTmpl:edit']"
  76. >导入
  77. </el-button>
  78. </el-col>
  79. <el-col :span="1.5">
  80. <el-button
  81. type="warning"
  82. icon="el-icon-download"
  83. size="mini"
  84. @click="handleExport"
  85. v-hasPermi="['bccnew:firstPlanTmpl:export']"
  86. >导出
  87. </el-button>
  88. </el-col>
  89. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  90. </el-row>
  91. <el-table v-loading="loading" :data="firstPlanTmplList" @selection-change="handleSelectionChange"
  92. :height="clientHeight" border>
  93. <el-table-column type="selection" width="55" align="center"/>
  94. <el-table-column label="课程编号" align="center" prop="courseCode" :show-overflow-tooltip="true" width="180"/>
  95. <el-table-column label="培训主题" align="center" prop="topic" :show-overflow-tooltip="true" width="180"/>
  96. <el-table-column label="材料版本" align="center" prop="materialVer" :show-overflow-tooltip="true" width="180"/>
  97. <el-table-column label="培训时长h" align="center" prop="courseHour" :show-overflow-tooltip="true" width="180"/>
  98. <el-table-column label="讲师" align="center" prop="trainer" :show-overflow-tooltip="true" width="180"/>
  99. <el-table-column label="考试评估方式" align="center" prop="examType" :show-overflow-tooltip="true" width="180"/>
  100. <el-table-column label="应学习时长" align="center" prop="timerNeed" :show-overflow-tooltip="true"/>
  101. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true" width="180"/>
  102. <el-table-column label="操作" align="center" fixed="right" width="230" class-name="small-padding fixed-width">
  103. <template slot-scope="scope">
  104. <el-button
  105. size="mini"
  106. type="text"
  107. icon="el-icon-edit"
  108. @click="handleUpdate(scope.row)"
  109. v-hasPermi="['bccnew:firstPlanTmpl:edit']"
  110. >修改
  111. </el-button>
  112. <el-button
  113. size="mini"
  114. type="text"
  115. icon="el-icon-delete"
  116. @click="handleDelete(scope.row)"
  117. v-hasPermi="['bccnew:firstPlanTmpl:remove']"
  118. >删除
  119. </el-button>
  120. <el-button
  121. size="mini"
  122. type="text"
  123. icon="el-icon-folder"
  124. @click="uploadFile(scope.row)"
  125. v-hasPermi="['bccnew:firstPlanTmpl:edit']"
  126. >学习资料
  127. </el-button>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. <pagination
  132. v-show="total>0"
  133. :total="total"
  134. :page.sync="queryParams.pageNum"
  135. :limit.sync="queryParams.pageSize"
  136. @pagination="getList"
  137. />
  138. <!-- 添加或修改进组培训模版对话框 -->
  139. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  140. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  141. <el-form-item label="课程编号" prop="courseCode">
  142. <el-input v-model="form.courseCode" placeholder="请输入课程编号"/>
  143. </el-form-item>
  144. <el-form-item label="培训主题" prop="topic">
  145. <el-input v-model="form.topic" placeholder="请输入培训主题"/>
  146. </el-form-item>
  147. <el-form-item label="材料版本">
  148. <el-input v-model="form.materialVer" placeholder="请输入材料版本"/>
  149. </el-form-item>
  150. <el-form-item label="培训时长h" prop="courseHour">
  151. <el-input-number v-model="form.courseHour" placeholder="请输入培训时长h"/>
  152. </el-form-item>
  153. <el-form-item label="讲师" prop="trainer">
  154. <el-input v-model="form.trainer" placeholder="请输入讲师"/>
  155. </el-form-item>
  156. <el-form-item label="考试评估方式" prop="examType">
  157. <el-input v-model="form.examType" placeholder="请输入考试评估方式"/>
  158. </el-form-item>
  159. <el-form-item label="应学习时长" prop="timerNeed">
  160. <el-input-number v-model="form.timerNeed" placeholder="请输入应学习时长" />
  161. </el-form-item>
  162. <el-form-item label="培训排序" prop="sortTmpl">
  163. <el-input-number v-model="form.sortTmpl" placeholder="请输入培训排序" />
  164. </el-form-item><el-form-item label="培训考试" prop="examId">
  165. <el-select v-model="form.examId" filterable :placeholder="$t('请选择') + $t('培训考试')">
  166. <el-option
  167. v-for="dict in examOptions"
  168. :key="dict.examId"
  169. :label="dict.title"
  170. :value="dict.examId">
  171. </el-option>
  172. </el-select>
  173. </el-form-item>
  174. <el-form-item label="备注" prop="remarks">
  175. <el-input v-model="form.remarks" placeholder="请输入备注"/>
  176. </el-form-item>
  177. </el-form>
  178. <div slot="footer" class="dialog-footer">
  179. <el-button type="primary" @click="submitForm">确 定</el-button>
  180. <el-button @click="cancel">取 消</el-button>
  181. </div>
  182. </el-dialog>
  183. <!-- 用户导入对话框 -->
  184. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  185. <el-upload
  186. ref="upload"
  187. :limit="1"
  188. accept=".xlsx, .xls"
  189. :headers="upload.headers"
  190. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  191. :disabled="upload.isUploading"
  192. :on-progress="handleFileUploadProgress"
  193. :on-success="handleFileSuccess"
  194. :auto-upload="false"
  195. drag
  196. >
  197. <i class="el-icon-upload"></i>
  198. <div class="el-upload__text">
  199. 将文件拖到此处,或
  200. <em>点击上传</em>
  201. </div>
  202. <div class="el-upload__tip" slot="tip">
  203. <el-checkbox v-model="upload.updateSupport"/>
  204. 是否更新已经存在的用户数据
  205. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  206. </div>
  207. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  208. </el-upload>
  209. <div slot="footer" class="dialog-footer">
  210. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  211. <el-button @click="upload.open = false">取 消</el-button>
  212. </div>
  213. </el-dialog>
  214. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px"
  215. append-to-body>
  216. <el-upload
  217. ref="doc"
  218. :limit="50"
  219. :headers="doc.headers"
  220. :action="doc.url+'/'+doc.id"
  221. :disabled="doc.isUploading"
  222. :on-progress="handleFileDocProgress"
  223. :on-success="handleFileDocSuccess"
  224. :auto-upload="true"
  225. drag
  226. >
  227. <i class="el-icon-upload"></i>
  228. <div class="el-upload__text">
  229. {{ $t('将文件拖到此处,或') }}
  230. <em>{{ $t('点击上传') }}</em>
  231. </div>
  232. </el-upload>
  233. <el-table :data="doc.commonfileList" border>
  234. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  235. <template slot-scope="scope">
  236. <a class="link-type" @click="handleDownload(scope.row)">
  237. <span>{{ scope.row.fileName }}</span>
  238. </a>
  239. </template>
  240. </el-table-column>
  241. <!-- <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true"-->
  242. <!-- width="80"/>-->
  243. <!-- <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>-->
  244. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  245. <template slot-scope="scope">
  246. <el-button
  247. v-if="scope.row.fileName!=null&&scope.row.fileName.endsWith('pdf')"
  248. size="mini"
  249. type="text"
  250. icon="el-icon-view"
  251. @click="handleSee(scope.row)"
  252. >{{ $t('预览') }}
  253. </el-button>
  254. <el-button type="text" size="small" v-if="scope.row.isEdit"
  255. @click="save(scope.row)">保存
  256. </el-button>
  257. <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">
  258. 取消
  259. </el-button>
  260. <el-button
  261. size="mini"
  262. type="text"
  263. icon="el-icon-download"
  264. @click="handleDownload(scope.row)"
  265. >{{ $t('下载') }}
  266. </el-button>
  267. <el-button
  268. size="mini"
  269. type="text"
  270. icon="el-icon-delete"
  271. @click="handleDeleteDoc(scope.row)"
  272. >{{ $t('删除') }}
  273. </el-button>
  274. </template>
  275. </el-table-column>
  276. </el-table>
  277. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px"
  278. append-to-body>
  279. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  280. <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
  281. </div>
  282. <div style="margin-top: -30px">
  283. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  284. </div>
  285. </el-dialog>
  286. <div slot="footer" class="dialog-footer">
  287. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  288. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  289. </div>
  290. </el-dialog>
  291. </div>
  292. </template>
  293. <script>
  294. import {
  295. addFirstPlanTmpl,
  296. delFirstPlanTmpl,
  297. exportFirstPlanTmpl,
  298. getFirstPlanTmpl,
  299. importTemplate,
  300. listFirstPlanTmpl,
  301. updateFirstPlanTmpl
  302. } from "@/api/training/bccnew/firstPlanTmpl";
  303. import {treeselect} from "@/api/system/dept";
  304. import {getToken} from "@/utils/auth";
  305. import Treeselect from "@riophae/vue-treeselect";
  306. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  307. import {listExam} from "@/api/training/elearn/exam";
  308. export default {
  309. name: "FirstPlanTmpl",
  310. components: {Treeselect},
  311. // components: { Editor },
  312. data() {
  313. return {
  314. examOptions: [],
  315. // 报告附件参数
  316. doc: {
  317. file: null,
  318. // 是否显示弹出层(报告附件)
  319. open: false,
  320. // 弹出层标题(报告附件)
  321. title: "附件",
  322. // 是否禁用上传
  323. isUploading: false,
  324. // 是否更新已经存在的用户数据
  325. updateSupport: 0,
  326. // 报告附件上传位置编号
  327. ids: 0,
  328. id: null,
  329. // 设置上传的请求头部
  330. headers: {Authorization: "Bearer " + getToken()},
  331. // 上传的地址
  332. url: process.env.VUE_APP_BASE_API + "/bccnew/firstPlanTmpl/uploadFile",
  333. commonfileList: null,
  334. queryParams: {
  335. pId: null,
  336. pType: 'bccnew'
  337. },
  338. pType: 'bccnew',
  339. pId: null,
  340. form: {}
  341. },
  342. pdf: {
  343. title: '',
  344. pdfUrl: '',
  345. numPages: null,
  346. open: false,
  347. pageNum: 1,
  348. pageTotalNum: 1,
  349. loadedRatio: 0,
  350. },
  351. // 遮罩层
  352. loading: true,
  353. // 选中数组
  354. ids: [],
  355. // 非单个禁用
  356. single: true,
  357. // 非多个禁用
  358. multiple: true,
  359. // 显示搜索条件
  360. showSearch: false,
  361. // 总条数
  362. total: 0,
  363. // 进组培训模版表格数据
  364. firstPlanTmplList: [],
  365. // 弹出层标题
  366. title: "",
  367. // 部门树选项
  368. deptOptions: undefined,
  369. clientHeight: 300,
  370. // 是否显示弹出层
  371. open: false,
  372. // 用户导入参数
  373. upload: {
  374. // 是否显示弹出层(用户导入)
  375. open: false,
  376. // 弹出层标题(用户导入)
  377. title: "",
  378. // 是否禁用上传
  379. isUploading: false,
  380. // 是否更新已经存在的用户数据
  381. updateSupport: 0,
  382. // 设置上传的请求头部
  383. headers: {Authorization: "Bearer " + getToken()},
  384. // 上传的地址
  385. url: process.env.VUE_APP_BASE_API + "/bccnew/firstPlanTmpl/importData"
  386. },
  387. // 查询参数
  388. queryParams: {
  389. pageNum: 1,
  390. pageSize: 20,
  391. newId: null,
  392. courseCode: null,
  393. topic: null,
  394. content: null,
  395. courseDay: null,
  396. courseHour: null,
  397. courseType: null,
  398. trainer: null,
  399. courseDate: null,
  400. assess: null,
  401. createrCode: null,
  402. createdate: null,
  403. updaterCode: null,
  404. updatedate: null,
  405. deptId: null,
  406. remarks: null
  407. },
  408. // 表单参数
  409. form: {},
  410. // 表单校验
  411. rules: {}
  412. };
  413. },
  414. watch: {
  415. // 根据名称筛选部门树
  416. deptName(val) {
  417. this.$refs.tree.filter(val);
  418. }
  419. },
  420. created() {
  421. //设置表格高度对应屏幕高度
  422. this.$nextTick(() => {
  423. this.clientHeight = document.body.clientHeight - 250
  424. })
  425. this.getList();
  426. this.getTreeselect();
  427. listExam({ pageNum: 1, pageSize: 1000, examType: 2 }).then(response => {
  428. this.examOptions = response.rows;
  429. });
  430. },
  431. methods: {
  432. uploadFile(row) {
  433. this.doc.file = null;
  434. this.doc.commonfileList = [];
  435. this.doc.open = true;
  436. this.doc.id = row.id;
  437. getFirstPlanTmpl(row.id).then(res => {
  438. if (res.data.fileUrl != null)
  439. this.doc.commonfileList.push({fileUrl: res.data.fileUrl, fileName: res.data.fileName, id: res.data.id})
  440. })
  441. this.$nextTick(()=>{
  442. this.$refs.doc.clearFiles();
  443. })
  444. },
  445. // 文件下载处理
  446. handleDownload(row) {
  447. var name = row.fileName;
  448. var url = row.fileUrl;
  449. var suffix = url.substring(url.lastIndexOf("."), url.length);
  450. const a = document.createElement('a')
  451. a.setAttribute('download', name)
  452. a.setAttribute('target', '_blank')
  453. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  454. a.click()
  455. },
  456. openPdf() {
  457. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  458. },
  459. handleSee(row) {
  460. // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
  461. this.pdf.open = true
  462. this.pdf.title = row.fileName
  463. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  464. },
  465. /** 删除按钮操作 */
  466. handleDeleteDoc(row) {
  467. const ids = row.id || this.ids;
  468. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  469. confirmButtonText: this.$t('确定'),
  470. cancelButtonText: this.$t('取消'),
  471. type: "warning"
  472. }).then(function () {
  473. return updateFirstPlanTmpl({id: row.id, fileUrl: '', fileName: ''});
  474. }).then(() => {
  475. this.msgSuccess(this.$t('删除成功'));
  476. this.doc.commonfileList = [];
  477. })
  478. },
  479. // 上传中处理
  480. handleFileDocProgress(event, file, fileList) {
  481. this.doc.file = file;
  482. this.doc.isUploading = true;
  483. },
  484. //附件上传成功处理
  485. handleFileDocSuccess(response, file, fileList) {
  486. this.doc.isUploading = false;
  487. this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  488. this.getList();
  489. this.doc.commonfileList = [];
  490. getFirstPlanTmpl(response.data).then(res => {
  491. if (res.data.fileUrl != null) {
  492. this.doc.commonfileList.push({fileUrl: res.data.fileUrl, fileName: res.data.fileName, id: res.data.id})
  493. }
  494. })
  495. },
  496. /** 查询进组培训模版列表 */
  497. getList() {
  498. this.loading = true;
  499. listFirstPlanTmpl(this.queryParams).then(response => {
  500. this.firstPlanTmplList = response.rows;
  501. this.total = response.total;
  502. this.loading = false;
  503. });
  504. },
  505. /** 查询部门下拉树结构 */
  506. getTreeselect() {
  507. treeselect().then(response => {
  508. this.deptOptions = response.data;
  509. });
  510. },
  511. // 取消按钮
  512. cancel() {
  513. this.open = false;
  514. this.reset();
  515. },
  516. // 表单重置
  517. reset() {
  518. this.form = {
  519. id: null,
  520. newId: null,
  521. courseCode: null,
  522. topic: null,
  523. content: null,
  524. courseDay: null,
  525. courseHour: null,
  526. courseType: null,
  527. trainer: null,
  528. courseDate: null,
  529. assess: null,
  530. delFlag: null,
  531. createrCode: null,
  532. createdate: null,
  533. updaterCode: null,
  534. updatedate: null,
  535. deptId: null,
  536. remarks: null
  537. };
  538. this.resetForm("form");
  539. },
  540. /** 搜索按钮操作 */
  541. handleQuery() {
  542. this.queryParams.pageNum = 1;
  543. this.getList();
  544. },
  545. /** 重置按钮操作 */
  546. resetQuery() {
  547. this.resetForm("queryForm");
  548. this.handleQuery();
  549. },
  550. // 多选框选中数据
  551. handleSelectionChange(selection) {
  552. this.ids = selection.map(item => item.id)
  553. this.single = selection.length !== 1
  554. this.multiple = !selection.length
  555. },
  556. /** 新增按钮操作 */
  557. handleAdd() {
  558. this.reset();
  559. this.open = true;
  560. this.title = "添加进组培训模版";
  561. },
  562. /** 修改按钮操作 */
  563. handleUpdate(row) {
  564. this.reset();
  565. const id = row.id || this.ids
  566. getFirstPlanTmpl(id).then(response => {
  567. this.form = response.data;
  568. this.open = true;
  569. this.title = "修改进组培训模版";
  570. });
  571. },
  572. /** 提交按钮 */
  573. submitForm() {
  574. this.$refs["form"].validate(valid => {
  575. if (valid) {
  576. if (this.form.id != null) {
  577. updateFirstPlanTmpl(this.form).then(response => {
  578. this.msgSuccess("修改成功");
  579. this.open = false;
  580. this.getList();
  581. });
  582. } else {
  583. addFirstPlanTmpl(this.form).then(response => {
  584. this.msgSuccess("新增成功");
  585. this.open = false;
  586. this.getList();
  587. });
  588. }
  589. }
  590. });
  591. },
  592. /** 删除按钮操作 */
  593. handleDelete(row) {
  594. const ids = row.id || this.ids;
  595. this.$confirm('是否确认删除?', "警告", {
  596. confirmButtonText: "确定",
  597. cancelButtonText: "取消",
  598. type: "warning"
  599. }).then(function () {
  600. return delFirstPlanTmpl(ids);
  601. }).then(() => {
  602. this.getList();
  603. this.msgSuccess("删除成功");
  604. })
  605. },
  606. /** 导出按钮操作 */
  607. handleExport() {
  608. const queryParams = this.queryParams;
  609. this.$confirm('是否确认导出所有进组培训模版数据项?', "警告", {
  610. confirmButtonText: "确定",
  611. cancelButtonText: "取消",
  612. type: "warning"
  613. }).then(function () {
  614. return exportFirstPlanTmpl(queryParams);
  615. }).then(response => {
  616. this.download(response.msg);
  617. })
  618. },
  619. /** 导入按钮操作 */
  620. handleImport() {
  621. this.upload.title = "用户导入";
  622. this.upload.open = true;
  623. },
  624. /** 下载模板操作 */
  625. importTemplate() {
  626. importTemplate().then(response => {
  627. this.download(response.msg);
  628. });
  629. },
  630. // 文件上传中处理
  631. handleFileUploadProgress(event, file, fileList) {
  632. this.upload.isUploading = true;
  633. },
  634. // 文件上传成功处理
  635. handleFileSuccess(response, file, fileList) {
  636. this.upload.open = false;
  637. this.upload.isUploading = false;
  638. this.$refs.upload.clearFiles();
  639. this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
  640. this.getList();
  641. },
  642. // 提交上传文件
  643. submitFileForm() {
  644. this.$refs.upload.submit();
  645. }
  646. }
  647. };
  648. </script>