index.vue 24 KB

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