index_s.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  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="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入年度培训标题"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="培训状态" prop="planStatus">
  14. <el-select v-model="queryParams.planStatus" placeholder="请选择培训状态" clearable size="small">
  15. <el-option
  16. v-for="dict in planStatusOptions"
  17. :key="dict.dictValue"
  18. :label="dict.dictLabel"
  19. :value="dict.dictValue"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="开始时间" prop="startdate">
  24. <el-date-picker clearable size="small" style="width: 200px"
  25. v-model="queryParams.startdate"
  26. type="date"
  27. value-format="yyyy-MM-dd"
  28. placeholder="选择开始时间">
  29. </el-date-picker>
  30. </el-form-item>
  31. <el-form-item label="结束时间" prop="enddate">
  32. <el-date-picker clearable size="small" style="width: 200px"
  33. v-model="queryParams.enddate"
  34. type="date"
  35. value-format="yyyy-MM-dd"
  36. placeholder="选择结束时间">
  37. </el-date-picker>
  38. </el-form-item>
  39. <el-form-item label="培训类型 " prop="planType">
  40. <el-select v-model="queryParams.planType" placeholder="请选择培训类型" clearable size="small">
  41. <el-option
  42. v-for="dict in planTypeOptions"
  43. :key="dict.dictValue"
  44. :label="dict.dictLabel"
  45. :value="dict.dictValue"
  46. />
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  51. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  52. </el-form-item>
  53. </el-form>
  54. <el-table v-loading="loading" :data="tnNewList" @selection-change="handleSelectionChange" :height="clientHeight"
  55. border>
  56. <el-table-column type="selection" width="55" align="center"/>
  57. <!-- <el-table-column label="培训员工编号" align="center" prop="staffId" :show-overflow-tooltip="true"/>-->
  58. <el-table-column label="新员工" align="center" prop="staffName" width="100"/>
  59. <el-table-column label="培训状态" align="center" prop="planStatus" width="100" :formatter="planStatusFormat">
  60. <template slot-scope="scope">
  61. <el-tag v-if="scope.row.planStatus == 1" size="small" type="success">已完成</el-tag>
  62. <el-tag v-else-if="scope.row.planStatus == 0" size="small" type="info">未完成</el-tag>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="进度" align="center" width="160">
  66. <template slot-scope="scope">
  67. <el-progress :percentage="scope.row.planFinish"></el-progress>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="开始时间" align="center" prop="startdate" width="100">
  71. <template slot-scope="scope">
  72. <span>{{ parseTime(scope.row.startdate, '{y}-{m}-{d}') }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="结束时间" align="center" prop="enddate" width="100">
  76. <template slot-scope="scope">
  77. <span>{{ parseTime(scope.row.enddate, '{y}-{m}-{d}') }}</span>
  78. </template>
  79. </el-table-column>
  80. <!-- <el-table-column label="导师员工编号" align="center" prop="mentorStaffId" :show-overflow-tooltip="true"/>-->
  81. <el-table-column label="导师" align="center" prop="mentorStaffName" width="100"/>
  82. <el-table-column label="岗位" align="center" prop="planType" width="100">
  83. <template slot-scope="scope">
  84. <span v-if="scope.row.planType == 1" size="small" type="success">裂解</span>
  85. <span v-else-if="scope.row.planType == 2" size="small" type="success">压缩</span>
  86. <span v-else-if="scope.row.planType == 3" size="small" type="success">分离</span>
  87. <span v-else-if="scope.row.planType == 4" size="small" type="success">芳烃</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="三级教育记录卡" align="center" prop="three" width="80">
  91. <template slot-scope="scope">
  92. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'tsNew-three')"
  93. circle></el-button>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="上岗能力评测表" align="center" prop="firstplan-score" width="80">
  97. <template slot-scope="scope">
  98. <el-button icon="el-icon-folder" style="color:#6e96fa;"
  99. @click="handleDoc(scope.row , 'tsNew-firstplan-score')" circle></el-button>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="导师提名表" align="center" prop="agreement" width="80">
  103. <template slot-scope="scope">
  104. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'tsNew-teacher-order')"
  105. circle></el-button>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="带徒协议" align="center" prop="agreement" width="80">
  109. <template slot-scope="scope">
  110. <el-button icon="el-icon-folder" style="color:#6e96fa;"
  111. @click="handleDownloadWord(scope.row, 'mentorAgreement')" circle></el-button>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="带徒目标" align="center" prop="target" width="80">
  115. <template slot-scope="scope">
  116. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDownloadWord(scope.row, 'targetPlan')"
  117. circle></el-button>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="培训考评" align="center" prop="tnNew-score" width="80">
  121. <template slot-scope="scope">
  122. <el-button icon="el-icon-folder" style="color:#6e96fa;"
  123. @click="handleDownloadWord(scope.row, 'appraisalForm')" circle></el-button>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true" width="100"/>
  127. <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
  128. <template slot-scope="scope">
  129. <el-button
  130. size="mini"
  131. type="text"
  132. icon="el-icon-view"
  133. @click="planList(scope.row)"
  134. >培训计划
  135. </el-button>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. <pagination
  140. v-show="total>0"
  141. :total="total"
  142. :page.sync="queryParams.pageNum"
  143. :limit.sync="queryParams.pageSize"
  144. @pagination="getList"
  145. />
  146. <!-- 添加或修改新员工培训对话框 -->
  147. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  148. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  149. <el-form-item label="培训员工" prop="mentorStaffId">
  150. <el-select v-model="form.staffId" filterable :placeholder="$t('请选择')+$t('培训员工')">
  151. <el-option
  152. v-for="item in userOption"
  153. :key="item.staffid"
  154. :label="item.name +' '+ item.deptName"
  155. :value="item.staffid"
  156. :disabled="item.disabled">
  157. </el-option>
  158. </el-select>
  159. </el-form-item>
  160. <el-form-item label="培训状态">
  161. <el-select v-model="form.planStatus" placeholder="请选择培训状态">
  162. <el-option
  163. v-for="dict in planStatusOptions"
  164. :key="dict.dictValue"
  165. :label="dict.dictLabel"
  166. :value="parseInt(dict.dictValue)"
  167. ></el-option>
  168. </el-select>
  169. </el-form-item>
  170. <el-form-item label="开始时间" prop="startdate">
  171. <el-date-picker clearable size="small" style="width: 200px"
  172. v-model="form.startdate"
  173. type="date"
  174. value-format="yyyy-MM-dd"
  175. placeholder="选择开始时间">
  176. </el-date-picker>
  177. </el-form-item>
  178. <el-form-item label="结束时间" prop="enddate">
  179. <el-date-picker clearable size="small" style="width: 200px"
  180. v-model="form.enddate"
  181. type="date"
  182. value-format="yyyy-MM-dd"
  183. placeholder="选择结束时间">
  184. </el-date-picker>
  185. </el-form-item>
  186. <el-form-item label="导师员工" prop="mentorStaffId">
  187. <el-select v-model="form.mentorStaffId" filterable :placeholder="$t('请选择')+$t('导师员工')">
  188. <el-option
  189. v-for="item in userOption"
  190. :key="item.staffid"
  191. :label="item.name +' '+ item.deptName"
  192. :value="item.staffid"
  193. :disabled="item.disabled">
  194. </el-option>
  195. </el-select>
  196. </el-form-item>
  197. <el-form-item label="岗位" prop="planType">
  198. <el-radio-group v-model="form.planType">
  199. <el-radio
  200. key="1"
  201. :label="1"
  202. >裂解
  203. </el-radio>
  204. <el-radio
  205. key="2"
  206. :label="2"
  207. >压缩
  208. </el-radio>
  209. <el-radio
  210. key="3"
  211. :label="3"
  212. >分离
  213. </el-radio>
  214. <el-radio
  215. key="4"
  216. :label="4"
  217. >芳烃
  218. </el-radio>
  219. </el-radio-group>
  220. </el-form-item>
  221. <el-form-item label="备注" prop="remarks">
  222. <el-input v-model="form.remarks" placeholder="请输入备注"/>
  223. </el-form-item>
  224. </el-form>
  225. <div slot="footer" class="dialog-footer">
  226. <el-button type="primary" @click="submitForm">确 定</el-button>
  227. <el-button @click="cancel">取 消</el-button>
  228. </div>
  229. </el-dialog>
  230. <!-- 用户导入对话框 -->
  231. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  232. <el-upload
  233. ref="upload"
  234. :limit="1"
  235. accept=".xlsx, .xls"
  236. :headers="upload.headers"
  237. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  238. :disabled="upload.isUploading"
  239. :on-progress="handleFileUploadProgress"
  240. :on-success="handleFileSuccess"
  241. :auto-upload="false"
  242. drag
  243. >
  244. <i class="el-icon-upload"></i>
  245. <div class="el-upload__text">
  246. 将文件拖到此处,或
  247. <em>点击上传</em>
  248. </div>
  249. <div class="el-upload__tip" slot="tip">
  250. <el-checkbox v-model="upload.updateSupport"/>
  251. 是否更新已经存在的用户数据
  252. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  253. </div>
  254. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  255. </el-upload>
  256. <div slot="footer" class="dialog-footer">
  257. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  258. <el-button @click="upload.open = false">取 消</el-button>
  259. </div>
  260. </el-dialog>
  261. <!-- 报告附件对话框 -->
  262. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px"
  263. append-to-body>
  264. <el-upload v-hasPermi="['training:trainingrecords:file']"
  265. ref="doc"
  266. :limit="50"
  267. :headers="doc.headers"
  268. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  269. :disabled="doc.isUploading"
  270. :on-progress="handleFileDocProgress"
  271. :on-success="handleFileDocSuccess"
  272. :auto-upload="true"
  273. drag
  274. >
  275. <i class="el-icon-upload"></i>
  276. <div class="el-upload__text">
  277. {{ $t('将文件拖到此处,或') }}
  278. <em>{{ $t('点击上传') }}</em>
  279. </div>
  280. </el-upload>
  281. <el-table :data="doc.commonfileList" border>
  282. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  283. <template slot-scope="scope">
  284. <a class="link-type" @click="handleDownload(scope.row)">
  285. <span>{{ scope.row.fileName }}</span>
  286. </a>
  287. </template>
  288. </el-table-column>
  289. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true"
  290. width="80"/>
  291. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  292. <!-- <el-table-column :label="$t('培训日期')" align="center" prop="pDate" width="150">-->
  293. <!-- <template slot-scope="scope">-->
  294. <!-- <el-date-picker-->
  295. <!-- v-if="scope.row.isEdit"-->
  296. <!-- v-model="scope.row.pDate"-->
  297. <!-- type="date"-->
  298. <!-- value-format="yyyy-MM-dd"-->
  299. <!-- placeholder="日期">-->
  300. <!-- </el-date-picker>-->
  301. <!-- <span v-else>{{ parseTime(scope.row.pDate, '{y}-{m}-{d}') }}</span>-->
  302. <!-- </template>-->
  303. <!-- </el-table-column>-->
  304. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  305. <template slot-scope="scope">
  306. <el-button
  307. v-if="scope.row.fileName.endsWith('pdf')"
  308. size="mini"
  309. type="text"
  310. icon="el-icon-view"
  311. @click="handleSee(scope.row)"
  312. >{{ $t('预览') }}
  313. </el-button>
  314. <el-button v-hasPermi="['training:trainingrecords:file']" type="text" size="small" v-if="scope.row.isEdit"
  315. @click="save(scope.row)">保存
  316. </el-button>
  317. <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">
  318. 取消
  319. </el-button>
  320. <!-- <el-button v-hasPermi="['training:trainingrecords:file']" v-if="!scope.row.isEdit" @click="edit(scope.row)" icon="el-icon-edit" type="text" size="mini">编辑</el-button>-->
  321. <el-button
  322. size="mini"
  323. type="text"
  324. icon="el-icon-download"
  325. @click="handleDownload(scope.row)"
  326. >{{ $t('下载') }}
  327. </el-button>
  328. <el-button
  329. size="mini"
  330. type="text"
  331. icon="el-icon-delete"
  332. @click="handleDeleteDoc(scope.row)"
  333. v-hasPermi="['training:trainingrecords:file']"
  334. >{{ $t('删除') }}
  335. </el-button>
  336. </template>
  337. </el-table-column>
  338. </el-table>
  339. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px"
  340. append-to-body>
  341. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  342. <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
  343. </div>
  344. <div style="margin-top: -30px">
  345. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  346. </div>
  347. </el-dialog>
  348. <div slot="footer" class="dialog-footer">
  349. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  350. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  351. </div>
  352. </el-dialog>
  353. </div>
  354. </template>
  355. <script>
  356. import {
  357. addTsnew,
  358. delTsnew,
  359. exportTsnew,
  360. getTsnew,
  361. importTemplate,
  362. listTsnew,
  363. updateTsnew
  364. } from "@/api/training/bccnew/tsnew";
  365. import {treeselect} from "@/api/system/dept";
  366. import {getToken} from "@/utils/auth";
  367. import Treeselect from "@riophae/vue-treeselect";
  368. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  369. import {listStaff} from "@/api/training/newstaff/tnNew";
  370. import {allFileList, delCommonfile} from "@/api/common/commonfile";
  371. export default {
  372. name: "Tsnew",
  373. components: {Treeselect},
  374. data() {
  375. return {
  376. // 遮罩层
  377. loading: true,
  378. // 选中数组
  379. ids: [],
  380. // 非单个禁用
  381. single: true,
  382. // 非多个禁用
  383. multiple: true,
  384. // 显示搜索条件
  385. showSearch: false,
  386. // 总条数
  387. total: 0,
  388. // 新员工培训表格数据
  389. tnNewList: [],
  390. // 弹出层标题
  391. title: "",
  392. // 部门树选项
  393. deptOptions: undefined,
  394. clientHeight: 300,
  395. // 培训状态字典
  396. planStatusOptions: [],
  397. // 培训类型 1-新员工 2-转岗字典
  398. planTypeOptions: [],
  399. userOption: [],
  400. // 是否显示弹出层
  401. open: false,
  402. // 用户导入参数
  403. upload: {
  404. // 是否显示弹出层(用户导入)
  405. open: false,
  406. // 弹出层标题(用户导入)
  407. title: "",
  408. // 是否禁用上传
  409. isUploading: false,
  410. // 是否更新已经存在的用户数据
  411. updateSupport: 0,
  412. // 设置上传的请求头部
  413. headers: {Authorization: "Bearer " + getToken()},
  414. // 上传的地址
  415. url: process.env.VUE_APP_BASE_API + "/newstaff/tsNew/importData"
  416. },
  417. // 报告附件参数
  418. doc: {
  419. file: "",
  420. // 是否显示弹出层(报告附件)
  421. open: false,
  422. // 弹出层标题(报告附件)
  423. title: "附件",
  424. // 是否禁用上传
  425. isUploading: false,
  426. // 是否更新已经存在的用户数据
  427. updateSupport: 0,
  428. // 报告附件上传位置编号
  429. ids: 0,
  430. // 设置上传的请求头部
  431. headers: {Authorization: "Bearer " + getToken()},
  432. // 上传的地址
  433. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  434. commonfileList: null,
  435. queryParams: {
  436. pId: null,
  437. pType: 'traning'
  438. },
  439. pType: 'traning',
  440. pId: null,
  441. form: {}
  442. },
  443. pdf: {
  444. title: '',
  445. pdfUrl: '',
  446. numPages: null,
  447. open: false,
  448. pageNum: 1,
  449. pageTotalNum: 1,
  450. loadedRatio: 0,
  451. },
  452. // 查询参数
  453. queryParams: {
  454. pageNum: 1,
  455. pageSize: 20,
  456. name: null,
  457. isStudent: '1',
  458. planStatus: null,
  459. startdate: null,
  460. enddate: null,
  461. planType: null,
  462. },
  463. // 表单参数
  464. form: {},
  465. // 表单校验
  466. rules: {}
  467. };
  468. },
  469. watch: {
  470. // 根据名称筛选部门树
  471. deptName(val) {
  472. this.$refs.tree.filter(val);
  473. }
  474. },
  475. created() {
  476. //设置表格高度对应屏幕高度
  477. this.$nextTick(() => {
  478. this.clientHeight = document.body.clientHeight - 250
  479. })
  480. this.getList();
  481. this.getTreeselect();
  482. this.getDicts("training_bccnew_status").then(response => {
  483. this.planStatusOptions = response.data;
  484. });
  485. this.getDicts("training_newstaff_type").then(response => {
  486. this.planTypeOptions = response.data;
  487. });
  488. listStaff(this.queryParams).then(response => {
  489. this.userOption = response.data;
  490. });
  491. },
  492. methods: {
  493. // 文件下载处理
  494. handleDownloadWord(row, type) {
  495. console.log(row)
  496. if (type == 'mentorAgreement') {
  497. var name = row.mentorAgreementWordPath;
  498. var url = row.mentorAgreementWordPath;
  499. } else if (type == 'targetPlan') {
  500. var name = row.targetPlanWordPath;
  501. var url = row.targetPlanWordPath;
  502. } else if (type == 'appraisalForm') {
  503. var name = row.appraisalFormWordPath;
  504. var url = row.appraisalFormWordPath;
  505. }
  506. var suffix = url.substring(url.lastIndexOf("."), url.length);
  507. console.log(url)
  508. const a = document.createElement('a')
  509. a.setAttribute('download', name)
  510. a.setAttribute('target', '_blank')
  511. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  512. a.click()
  513. },
  514. /** 查询新员工培训列表 */
  515. getList() {
  516. this.loading = true;
  517. listTsnew(this.queryParams).then(response => {
  518. this.tnNewList = response.rows;
  519. this.total = response.total;
  520. this.loading = false;
  521. });
  522. },
  523. /** 查询部门下拉树结构 */
  524. getTreeselect() {
  525. treeselect().then(response => {
  526. this.deptOptions = response.data;
  527. });
  528. },
  529. // 培训状态字典翻译
  530. planStatusFormat(row, column) {
  531. return this.selectDictLabel(this.planStatusOptions, row.planStatus);
  532. },
  533. // 培训类型 1-新员工 2-转岗字典翻译
  534. planTypeFormat(row, column) {
  535. return this.selectDictLabel(this.planTypeOptions, row.planType);
  536. },
  537. // 取消按钮
  538. cancel() {
  539. this.open = false;
  540. this.reset();
  541. },
  542. // 表单重置
  543. reset() {
  544. this.form = {
  545. newId: null,
  546. staffId: null,
  547. name: null,
  548. delFlag: null,
  549. createrCode: null,
  550. createdate: null,
  551. updaterCode: null,
  552. updatedate: null,
  553. deptId: null,
  554. planStatus: 0,
  555. planYear: null,
  556. startdate: null,
  557. enddate: null,
  558. mentorStaffId: null,
  559. planType: null,
  560. remarks: null
  561. };
  562. this.resetForm("form");
  563. },
  564. /** 搜索按钮操作 */
  565. handleQuery() {
  566. this.queryParams.pageNum = 1;
  567. this.getList();
  568. },
  569. /** 重置按钮操作 */
  570. resetQuery() {
  571. this.resetForm("queryForm");
  572. this.handleQuery();
  573. },
  574. // 多选框选中数据
  575. handleSelectionChange(selection) {
  576. this.ids = selection.map(item => item.newId)
  577. this.single = selection.length !== 1
  578. this.multiple = !selection.length
  579. },
  580. planList(row) {
  581. const newId = row.newId
  582. this.$router.push("/training/bccnew/trainingPlan_s/" + newId);
  583. },
  584. /** 新增按钮操作 */
  585. handleAdd() {
  586. this.reset();
  587. this.open = true;
  588. this.title = "添加新员工培训";
  589. },
  590. /** 修改按钮操作 */
  591. handleUpdate(row) {
  592. this.reset();
  593. const newId = row.newId || this.ids
  594. getTsnew(newId).then(response => {
  595. this.form = response.data;
  596. this.open = true;
  597. this.title = "修改新员工培训";
  598. });
  599. },
  600. /** 提交按钮 */
  601. submitForm() {
  602. this.$refs["form"].validate(valid => {
  603. if (valid) {
  604. if (this.form.newId != null) {
  605. updateTsnew(this.form).then(response => {
  606. this.msgSuccess("修改成功");
  607. this.open = false;
  608. this.getList();
  609. });
  610. } else {
  611. addTsnew(this.form).then(response => {
  612. this.msgSuccess("新增成功");
  613. this.open = false;
  614. this.getList();
  615. });
  616. }
  617. }
  618. });
  619. },
  620. /** 删除按钮操作 */
  621. handleDelete(row) {
  622. const newIds = row.newId || this.ids;
  623. this.$confirm('是否确认删除?', "警告", {
  624. confirmButtonText: "确定",
  625. cancelButtonText: "取消",
  626. type: "warning"
  627. }).then(function () {
  628. return delTsnew(newIds);
  629. }).then(() => {
  630. this.getList();
  631. this.msgSuccess("删除成功");
  632. })
  633. },
  634. /** 导出按钮操作 */
  635. handleExport() {
  636. const queryParams = this.queryParams;
  637. this.$confirm('是否确认导出所有新员工培训数据项?', "警告", {
  638. confirmButtonText: "确定",
  639. cancelButtonText: "取消",
  640. type: "warning"
  641. }).then(function () {
  642. return exportTsnew(queryParams);
  643. }).then(response => {
  644. this.download(response.msg);
  645. })
  646. },
  647. /** 导入按钮操作 */
  648. handleImport() {
  649. this.upload.title = "用户导入";
  650. this.upload.open = true;
  651. },
  652. /** 下载模板操作 */
  653. importTemplate() {
  654. importTemplate().then(response => {
  655. this.download(response.msg);
  656. });
  657. },
  658. // 文件上传中处理
  659. handleFileUploadProgress(event, file, fileList) {
  660. this.upload.isUploading = true;
  661. },
  662. // 文件上传成功处理
  663. handleFileSuccess(response, file, fileList) {
  664. this.upload.open = false;
  665. this.upload.isUploading = false;
  666. this.$refs.upload.clearFiles();
  667. this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
  668. this.getList();
  669. },
  670. // 提交上传文件
  671. submitFileForm() {
  672. this.$refs.upload.submit();
  673. },
  674. /** 报告附件按钮操作 */
  675. handleDoc(row, fileType) {
  676. this.doc.pType = fileType
  677. this.doc.queryParams.pType = fileType
  678. this.doc.id = row.id;
  679. this.doc.title = this.$t('附件');
  680. this.doc.open = true;
  681. this.doc.queryParams.pId = row.newId
  682. this.doc.pId = row.newId
  683. this.getFileList()
  684. this.$nextTick(() => {
  685. this.$refs.doc.clearFiles()
  686. })
  687. },
  688. getFileList() {
  689. allFileList(this.doc.queryParams).then(response => {
  690. response.forEach(element => {
  691. element["isEdit"] = false
  692. });
  693. response.forEach(element => {
  694. element["isAdd"] = false
  695. });
  696. this.doc.commonfileList = response;
  697. });
  698. },
  699. //附件上传中处理
  700. handleFileDocProgress(event, file, fileList) {
  701. this.doc.file = file;
  702. this.doc.isUploading = true;
  703. },
  704. //附件上传成功处理
  705. handleFileDocSuccess(response, file, fileList) {
  706. this.doc.isUploading = false;
  707. this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  708. this.getFileList()
  709. },
  710. // 文件下载处理
  711. handleDownload(row) {
  712. var name = row.fileName;
  713. var url = row.fileUrl;
  714. var suffix = url.substring(url.lastIndexOf("."), url.length);
  715. const a = document.createElement('a')
  716. a.setAttribute('download', name)
  717. a.setAttribute('target', '_blank')
  718. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  719. a.click()
  720. },
  721. openPdf() {
  722. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  723. },
  724. handleSee(row) {
  725. // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
  726. this.pdf.open = true
  727. this.pdf.title = row.fileName
  728. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  729. },
  730. /** 删除按钮操作 */
  731. handleDeleteDoc(row) {
  732. const ids = row.id || this.ids;
  733. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  734. confirmButtonText: this.$t('确定'),
  735. cancelButtonText: this.$t('取消'),
  736. type: "warning"
  737. }).then(function () {
  738. return delCommonfile(ids);
  739. }).then(() => {
  740. this.getFileList()
  741. this.msgSuccess(this.$t('删除成功'));
  742. })
  743. },
  744. }
  745. };
  746. </script>