index.vue 33 KB

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