index.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item :label="$t('姓名')" 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 :label="$t('员工号')" prop="employeeid" label-width="50">
  14. <el-input
  15. v-model="queryParams.employeeid"
  16. :placeholder="$t('请输入') + $t('员工号')"
  17. clearable
  18. size="small"
  19. @input="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item :label="$t('班值')" prop="classes">
  23. <el-select v-model="queryParams.classes" @change="handleQuery" :placeholder="$t('请选择') + $t('班值')" clearable size="small">
  24. <el-option
  25. v-for="dict in classesOptions"
  26. :key="dict.dictValue"
  27. :label="dict.dictLabel"
  28. :value="dict.dictValue"
  29. />
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item :label="$t('入职')" prop="onboard">
  33. <el-select v-model="queryParams.onboard" @change="handleQuery" :placeholder="$t('请选择') + $t('入职')" clearable size="small">
  34. <el-option
  35. v-for="dict in onboardOptions"
  36. :key="dict.dictValue"
  37. :label="dict.dictLabel"
  38. :value="dict.dictValue"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="TDS" prop="tds">
  43. <el-select v-model="queryParams.tds" @change="handleQuery" :placeholder="$t('请选择')+'TDS'" clearable size="small">
  44. <el-option
  45. v-for="dict in tdsOptions"
  46. :key="dict.dictValue"
  47. :label="dict.dictLabel"
  48. :value="dict.dictValue"
  49. />
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item :label="$t('上岗证复证')" prop="postCard">
  53. <el-select v-model="queryParams.postCard" @change="handleQuery" :placeholder="$t('请选择') + $t('上岗证复证')" clearable size="small">
  54. <el-option
  55. v-for="dict in postCardOptions"
  56. :key="dict.dictValue"
  57. :label="dict.dictLabel"
  58. :value="dict.dictValue"
  59. />
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item :label="$t('工艺培训')" prop="craft">
  63. <el-select v-model="queryParams.craft" @change="handleQuery" :placeholder="$t('请选择') + $t('工艺培训')" clearable size="small">
  64. <el-option
  65. v-for="dict in craftOptions"
  66. :key="dict.dictValue"
  67. :label="dict.dictLabel"
  68. :value="dict.dictValue"
  69. />
  70. </el-select>
  71. </el-form-item>
  72. <el-form-item :label="$t('公司级培训')" prop="company">
  73. <el-select v-model="queryParams.company" @change="handleQuery" :placeholder="$t('请选择') + $t('公司级培训')" clearable size="small">
  74. <el-option
  75. v-for="dict in companyOptions"
  76. :key="dict.dictValue"
  77. :label="dict.dictLabel"
  78. :value="dict.dictValue"
  79. />
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item :label="$t('装置级培训')" prop="device">
  83. <el-select v-model="queryParams.device" @change="handleQuery" :placeholder="$t('请选择') + $t('装置级培训')" clearable size="small">
  84. <el-option
  85. v-for="dict in deviceOptions"
  86. :key="dict.dictValue"
  87. :label="dict.dictLabel"
  88. :value="dict.dictValue"
  89. />
  90. </el-select>
  91. </el-form-item>
  92. <el-form-item>
  93. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  94. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  95. </el-form-item>
  96. </el-form>
  97. <el-row :gutter="10" class="mb8">
  98. <el-col :span="1.5">
  99. <el-button
  100. type="primary"
  101. icon="el-icon-time"
  102. size="mini"
  103. @click="handleTime"
  104. >{{ $t('人员培训时长') }}</el-button>
  105. </el-col>
  106. <el-col :span="1.5">
  107. <el-button
  108. type="success"
  109. icon="el-icon-tickets"
  110. size="mini"
  111. @click="handleCompany"
  112. >{{ $t('公司级培训记录') }}</el-button>
  113. </el-col>
  114. <el-col :span="1.5">
  115. <el-button
  116. type="info"
  117. icon="el-icon-document"
  118. size="mini"
  119. @click="handleDevice"
  120. >{{ $t('装置级培训记录') }}</el-button>
  121. </el-col>
  122. <!--<el-col :span="1.5">
  123. <el-button
  124. type="danger"
  125. icon="el-icon-delete"
  126. size="mini"
  127. :disabled="multiple"
  128. @click="handleDelete"
  129. v-hasPermi="['training:trainingrecords:remove']"
  130. >{{ $t('删除') }}</el-button>
  131. </el-col>-->
  132. <!-- <el-col :span="1.5">
  133. <el-button
  134. type="info"
  135. icon="el-icon-upload2"
  136. size="mini"
  137. @click="handleImport"
  138. v-hasPermi="['training:trainingrecords:edit']"
  139. >{{ $t('导入') }}</el-button>
  140. </el-col>--><!-- <el-col :span="1.5">
  141. <el-button
  142. type="info"
  143. icon="el-icon-upload2"
  144. size="mini"
  145. @click="handleImport"
  146. v-hasPermi="['training:trainingrecords:edit']"
  147. >{{ $t('导入') }}</el-button>
  148. </el-col>-->
  149. <el-col :span="1.5">
  150. <el-button
  151. type="warning"
  152. icon="el-icon-download"
  153. size="mini"
  154. @click="handleExport"
  155. v-hasPermi="['training:trainingrecords:export']"
  156. >{{ $t('导出') }}</el-button>
  157. </el-col>
  158. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  159. </el-row>
  160. <el-table v-loading="loading" :data="trainingrecordsList" @selection-change="handleSelectionChange" :cell-style="tableCellStyle" @sort-change="sortChange" :height="clientHeight" border>
  161. <el-table-column type="selection" width="55" align="center" />
  162. <el-table-column :label="$t('姓名')" align="center" prop="name" :show-overflow-tooltip="true"/>
  163. <el-table-column :label="$t('员工号')" align="center" prop="employeeid" :show-overflow-tooltip="true"/>
  164. <el-table-column :label="$t('班值')" align="center" prop="classes" :formatter="classesFormat" />
  165. <el-table-column :label="$t('入职')" align="center" prop="onboard" :formatter="onboardFormat" >
  166. <template slot-scope="scope">
  167. <span> {{onboardFormat(scope.row)}}</span>
  168. <el-button icon="el-icon-folder" style="color:#6e96fa;" v-if="scope.row.onboard !== '3'" @click="handleDoc(scope.row , 'trainingrecords-onbord')" circle></el-button>
  169. </template>
  170. </el-table-column>
  171. <el-table-column label="TDS" align="center" prop="tds" :formatter="tdsFormat">
  172. <template slot-scope="scope">
  173. <span> {{tdsFormat(scope.row)}}</span>
  174. <el-button icon="el-icon-folder" style="color:#6e96fa;" v-if="scope.row.tds !== '3'" @click="handleDoc(scope.row , 'trainingrecords-tds')" circle></el-button>
  175. </template>
  176. </el-table-column>
  177. <el-table-column :label="$t('上岗证复证')" align="center" prop="postCard" :formatter="postCardFormat">
  178. <template slot-scope="scope">
  179. <span> {{postCardFormat(scope.row)}}</span>
  180. <el-button icon="el-icon-folder" style="color:#6e96fa;" v-if="scope.row.postCard !== '3'" @click="openWorklicense(scope.row)" circle></el-button>
  181. <!--<el-button icon="el-icon-folder" v-if="scope.row.postCard !== '3'" @click="handleDoc(scope.row , 'trainingrecords-postCard')" circle></el-button>-->
  182. </template>
  183. </el-table-column>
  184. <el-table-column :label="$t('工艺培训')" align="center" prop="craft" :formatter="craftFormat">
  185. <template slot-scope="scope">
  186. <span> {{craftFormat(scope.row)}}</span>
  187. <el-button icon="el-icon-folder" style="color:#6e96fa;" v-if="scope.row.craft !== '3'" @click="handleDoc(scope.row , 'trainingrecords-craft')" circle></el-button>
  188. </template>
  189. </el-table-column>
  190. <el-table-column :label="$t('公司级培训')" align="center" prop="company" :formatter="companyFormat">
  191. <template slot-scope="scope">
  192. <span> {{companyFormat(scope.row)}}</span>
  193. <el-button icon="el-icon-folder" style="color:#6e96fa;" v-if="scope.row.company !== '3'" @click="openCompany(scope.row)" circle></el-button>
  194. </template>
  195. </el-table-column>
  196. <el-table-column :label="$t('装置级培训')" align="center" prop="device" :formatter="deviceFormat">
  197. <template slot-scope="scope">
  198. <span> {{deviceFormat(scope.row)}}</span>
  199. <el-button icon="el-icon-folder" style="color:#6e96fa;" v-if="scope.row.device !== '3'" @click="openDevice(scope.row)" circle></el-button>
  200. </template>
  201. </el-table-column>
  202. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  203. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  204. <template slot-scope="scope">
  205. <el-button
  206. size="mini"
  207. type="text"
  208. icon="el-icon-edit"
  209. @click="handleUpdate(scope.row)"
  210. v-hasPermi="['training:trainingrecords:edit']"
  211. >{{ $t('修改') }}</el-button>
  212. <!--<el-button
  213. size="mini"
  214. type="text"
  215. icon="el-icon-delete"
  216. @click="handleDelete(scope.row)"
  217. v-hasPermi="['training:trainingrecords:remove']"
  218. >{{ $t('删除') }}</el-button>-->
  219. </template>
  220. </el-table-column>
  221. </el-table>
  222. <pagination
  223. v-show="total>0"
  224. :total="total"
  225. :page.sync="queryParams.pageNum"
  226. :limit.sync="queryParams.pageSize"
  227. @pagination="getList"
  228. />
  229. <!-- 添加或修改培训成绩对话框 -->
  230. <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
  231. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  232. <el-form-item :label="$t('装置名称')" prop="plantCode">
  233. <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置名称')">
  234. <el-option
  235. v-for="dict in plantCodeOptions"
  236. :key="dict.dictValue"
  237. :label="dict.dictLabel"
  238. :value="dict.dictValue"
  239. ></el-option>
  240. </el-select>
  241. </el-form-item>
  242. <el-form-item :label="$t('姓名')" prop="name">
  243. <el-input v-model="form.name" :placeholder="$t('请输入') + $t('姓名')" />
  244. </el-form-item>
  245. <el-form-item :label="$t('员工号')" prop="employeeid">
  246. <el-input v-model="form.employeeid" :placeholder="$t('请输入') + $t('员工号')" />
  247. </el-form-item>
  248. <el-form-item :label="$t('班值')" prop="classes">
  249. <el-select v-model="form.classes" :placeholder="$t('请选择') + $t('班值')">
  250. <el-option
  251. v-for="dict in classesOptions"
  252. :key="dict.dictValue"
  253. :label="dict.dictLabel"
  254. :value="dict.dictValue"
  255. ></el-option>
  256. </el-select>
  257. </el-form-item>
  258. <el-form-item :label="$t('入职')" prop="onboard">
  259. <el-select v-model="form.onboard" :placeholder="$t('请选择') + $t('入职')">
  260. <el-option
  261. v-for="dict in onboardOptions"
  262. :key="dict.dictValue"
  263. :label="dict.dictLabel"
  264. :value="dict.dictValue"
  265. ></el-option>
  266. </el-select>
  267. </el-form-item>
  268. <el-form-item label="TDS" prop="tds">
  269. <el-select v-model="form.tds" :placeholder="$t('请选择') + 'TDS'">
  270. <el-option
  271. v-for="dict in tdsOptions"
  272. :key="dict.dictValue"
  273. :label="dict.dictLabel"
  274. :value="dict.dictValue"
  275. ></el-option>
  276. </el-select>
  277. </el-form-item>
  278. <el-form-item :label="$t('上岗证复证')" prop="postCard">
  279. <el-select v-model="form.postCard" :placeholder="$t('请选择') + $t('上岗证复证')">
  280. <el-option
  281. v-for="dict in postCardOptions"
  282. :key="dict.dictValue"
  283. :label="dict.dictLabel"
  284. :value="dict.dictValue"
  285. ></el-option>
  286. </el-select>
  287. </el-form-item>
  288. <el-form-item :label="$t('工艺培训')" prop="craft">
  289. <el-select v-model="form.craft" :placeholder="$t('请选择') + $t('工艺培训')">
  290. <el-option
  291. v-for="dict in craftOptions"
  292. :key="dict.dictValue"
  293. :label="dict.dictLabel"
  294. :value="dict.dictValue"
  295. ></el-option>
  296. </el-select>
  297. </el-form-item>
  298. <el-form-item :label="$t('公司级培训')" prop="company">
  299. <el-select v-model="form.company" :placeholder="$t('请选择') + $t('公司级培训')">
  300. <el-option
  301. v-for="dict in companyOptions"
  302. :key="dict.dictValue"
  303. :label="dict.dictLabel"
  304. :value="dict.dictValue"
  305. ></el-option>
  306. </el-select>
  307. </el-form-item>
  308. <el-form-item :label="$t('装置级培训')" prop="device">
  309. <el-select v-model="form.device" :placeholder="$t('请选择') + $t('装置级培训')">
  310. <el-option
  311. v-for="dict in deviceOptions"
  312. :key="dict.dictValue"
  313. :label="dict.dictLabel"
  314. :value="dict.dictValue"
  315. ></el-option>
  316. </el-select>
  317. </el-form-item>
  318. <el-form-item :label="$t('备注')" prop="remarks">
  319. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  320. </el-form-item>
  321. <el-form-item :label="$t('归属部门')" prop="deptId">
  322. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  323. </el-form-item>
  324. </el-form>
  325. <div slot="footer" class="dialog-footer">
  326. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  327. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  328. </div>
  329. </el-dialog>
  330. <!-- 用户导入对话框 -->
  331. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  332. <el-upload
  333. ref="upload"
  334. :limit="1"
  335. accept=".xlsx, .xls"
  336. :headers="upload.headers"
  337. :action="upload.url"
  338. :disabled="upload.isUploading"
  339. :on-progress="handleFileUploadProgress"
  340. :on-success="handleFileSuccess"
  341. :auto-upload="false"
  342. drag
  343. >
  344. <i class="el-icon-upload"></i>
  345. <div class="el-upload__text">
  346. {{ $t('将文件拖到此处,或') }}
  347. <em>{{ $t('点击上传') }}</em>
  348. </div>
  349. <div class="el-upload__tip" slot="tip">
  350. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  351. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  352. </div>
  353. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  354. <input name="type" :value="upload.type" hidden />
  355. </form>
  356. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  357. </el-upload>
  358. <div slot="footer" class="dialog-footer">
  359. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  360. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  361. </div>
  362. </el-dialog>
  363. <!-- 公司级培训跟踪矩阵对话框 -->
  364. <el-dialog v-dialogDrag :title="companyTrainingTitle" :visible.sync="companyTrainingOpen" width="1400px" append-to-body @close="closeDialog()">
  365. <div>
  366. <svg-icon icon-class="rectangleGreen" class="rectangleGreen"></svg-icon>
  367. <span>{{ $t('需参加培训,已经完成培训人员') }}</span>
  368. <svg-icon icon-class="rectanglered" class="rectangleRed"></svg-icon>
  369. <span style="line-height: 40px">{{ $t('需参加培训,尚未进行培训人员') }}</span>
  370. </div>
  371. <el-table v-if="tableShow" border :data="companylevelList"
  372. v-loading="companyTrainingLoad"
  373. class="companyLevelTable" height="600px" border
  374. :span-method="colspanMethod"
  375. :cell-class-name="tableCellClassName"
  376. :row-style="{height:'40px'}"
  377. ref="companyTable"
  378. >
  379. <el-table-column :label="$t('课程代码')" align="center" width="120" fixed>
  380. <template slot-scope="scope">
  381. {{scope.row[0]}}
  382. </template>
  383. </el-table-column>
  384. <el-table-column :label="$t('公司级') + $t('空格') +$t('培训课程') + $t('空格') + $t('名称')" align="center" width="350" fixed>
  385. <template slot-scope="scope">
  386. {{scope.row[1]}}
  387. </template>
  388. </el-table-column>
  389. <el-table-column :label="$t('频率')" align="center" width="120" fixed>
  390. <template slot-scope="scope">
  391. {{scope.row[2]}}
  392. </template>
  393. </el-table-column>
  394. <el-table-column v-for="(item, index) in transTitle" width="150" :label="item.actualpost" :key="index" align="center">
  395. <el-table-column width="150" :label="item.name" :key="index" align="center">
  396. <template slot-scope="scope">
  397. {{scope.row[index + 3]}}
  398. </template>
  399. </el-table-column>
  400. </el-table-column>
  401. </el-table>
  402. </el-dialog>
  403. <!-- 装置级培训跟踪矩阵对话框 -->
  404. <el-dialog v-dialogDrag :title="deviceTrainingTitle" :visible.sync="deviceTrainingOpen" width="1400px" append-to-body @close="closeDialog()">
  405. <el-form :model="deviceParams" ref="deviceParamsForm" label-width="68px" :inline="true">
  406. <el-form-item :label="$t('年份')" prop="year">
  407. <el-date-picker clearable size="small" style="width: 200px"
  408. v-model="deviceParams.year"
  409. type="year"
  410. value-format="yyyy"
  411. :placeholder="$t('请选择')+$t('年份')">
  412. </el-date-picker>
  413. </el-form-item>
  414. <el-form-item :label="$t('培训类型')" prop="trainingType">
  415. <el-select v-model="deviceParams.trainingType" :placeholder="$t('请选择') + $t('培训类型')" clearable size="small">
  416. <el-option
  417. v-for="dict in trainingTypeOptions"
  418. :key="dict.dictValue"
  419. :label="dict.dictLabel"
  420. :value="dict.dictValue"
  421. />
  422. </el-select>
  423. </el-form-item>
  424. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleDeviceQuery" style="margin-left: 20px;">{{ $t('搜索') }}</el-button>
  425. <el-row style="text-align: right">
  426. <svg-icon icon-class="rectangleGreen" class="rectangleGreen"></svg-icon>
  427. <span>{{ $t('需参加培训,已经完成培训人员') }}</span>
  428. <svg-icon icon-class="rectanglered" class="rectangleRed"></svg-icon>
  429. <span style="line-height: 40px">{{ $t('需参加培训,尚未进行培训人员') }}</span>
  430. </el-row>
  431. </el-form>
  432. <el-table v-if="tableShow" border :data="devicelevelList"
  433. v-loading="deviceTrainingLoad"
  434. class="companyLevelTable" height="600px" border
  435. :span-method="colspanDeviceMethod"
  436. :cell-class-name="tableCellClassName"
  437. :row-style="{height:'40px'}"
  438. ref="deviceTable"
  439. >
  440. <el-table-column :label="$t('课程代码')" align="center" width="100" fixed>
  441. <template slot-scope="scope">
  442. {{scope.row[0]}}
  443. </template>
  444. </el-table-column>
  445. <el-table-column :label="$t('装置级') +$t('空格') + $t('培训课程')+$t('空格') + $t('名称')" align="center" width="250" fixed>
  446. <template slot-scope="scope">
  447. {{scope.row[1]}}
  448. </template>
  449. </el-table-column>
  450. <el-table-column v-for="(item, index) in transTitle" width="150" :label="item.actualpost" :key="index" align="center">
  451. <el-table-column width="150" :label="item.name" :key="index" align="center">
  452. <template slot-scope="scope">
  453. {{scope.row[index + 2]}}
  454. </template>
  455. </el-table-column>
  456. </el-table-column>
  457. </el-table>
  458. </el-dialog>
  459. <!-- 人员培训时长对话框 -->
  460. <el-dialog v-dialogDrag class="trainingTime" :title="trainingTimeTitle" :visible.sync="trainingTimeOpen" width="700px" append-to-body>
  461. <el-button type="primary" style="margin-bottom: 10px" @click="exportTrainingTime">{{ $t('导出') }}<i class="el-icon-download el-icon--right"></i></el-button>
  462. <el-table v-loading="loading" :data="transTitle" height="600px" border>
  463. <el-table-column :label="$t('员工姓名')" align="center" prop="name" width="300" :show-overflow-tooltip="true"/>
  464. <el-table-column :label="$t('培训时长')" align="center" prop="trainingTime" :show-overflow-tooltip="true"/>
  465. </el-table>
  466. </el-dialog>
  467. <!-- 上岗证培训列表对话框 -->
  468. <el-dialog v-dialogDrag :title="worklicenseTitle" :visible.sync="worklicenseOpen" width="800px" append-to-body>
  469. <el-table v-loading="loading" :data="worklicenseList" border>
  470. <el-table-column :label="$t('上岗证类型')" align="center" prop="worklicenseType" :show-overflow-tooltip="true"/>
  471. <el-table-column :label="$t('上岗证')+$t('空格')+$t('证件号')" align="center" prop="worklicenseIdnum" :show-overflow-tooltip="true"/>
  472. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  473. <template slot-scope="scope">
  474. <el-button
  475. size="mini"
  476. type="text"
  477. icon="el-icon-edit"
  478. @click="handleDoc(scope.row , 'trainingrecords-worklicense' + scope.row.worklicenseType)"
  479. >{{ $t('附件') }}</el-button>
  480. </template>
  481. </el-table-column>
  482. </el-table>
  483. </el-dialog>
  484. <!-- 公司级培训对话框 -->
  485. <el-dialog v-dialogDrag :title="companyTitle" :visible.sync="companyOpen" width="1400px" append-to-body>
  486. <el-table v-loading="loading" :data="participantsList" border>
  487. <el-table-column :label="$t('课程代码')" align="center" prop="courseCode" width="150" :show-overflow-tooltip="true"/>
  488. <el-table-column :label="$t('公司级') + $t('空格') + $t('培训课程') + $t('空格') + $t('名称')" align="center" prop="companyItem" width="400" :show-overflow-tooltip="true"/>
  489. <el-table-column :label="$t('开始日期')" align="center" prop="startDate" width="250">
  490. <template slot-scope="scope">
  491. <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
  492. </template>
  493. </el-table-column>
  494. <el-table-column :label="$t('结束日期')" align="center" prop="endDate" width="250">
  495. <template slot-scope="scope">
  496. <span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
  497. </template>
  498. </el-table-column>
  499. <el-table-column :label="$t('培训时长')" align="center" prop="trainingDuration" :show-overflow-tooltip="true"/>
  500. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  501. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  502. <template slot-scope="scope">
  503. <el-button
  504. size="mini"
  505. type="text"
  506. icon="el-icon-delete"
  507. @click="participantsHandleDelete(scope.row)"
  508. v-hasPermi="['training:trainingrecords:remove']"
  509. >{{ $t('删除') }}</el-button>
  510. </template>
  511. </el-table-column>
  512. </el-table>
  513. </el-dialog>
  514. <!-- 装置级培训对话框 -->
  515. <el-dialog v-dialogDrag :title="deviceTitle" :visible.sync="deviceOpen" width="1400px" append-to-body>
  516. <el-form :model="queryDeviceParams" ref="queryRegularForm" label-width="68px" :inline="true">
  517. <el-form-item :label="$t('年份')" prop="year">
  518. <el-date-picker clearable size="small" style="width: 200px"
  519. v-model="queryDeviceParams.year"
  520. type="year"
  521. value-format="yyyy"
  522. :placeholder="$t('请选择') + $t('年份')">
  523. </el-date-picker>
  524. </el-form-item>
  525. <el-form-item :label="$t('培训类型')" prop="trainingType">
  526. <el-select v-model="queryDeviceParams.trainingType" :placeholder="$t('请选择') + $t('培训类型')" clearable size="small">
  527. <el-option
  528. v-for="dict in trainingTypeOptions"
  529. :key="dict.dictValue"
  530. :label="dict.dictLabel"
  531. :value="dict.dictValue"
  532. />
  533. </el-select>
  534. </el-form-item>
  535. <el-button type="cyan" icon="el-icon-search" size="mini" @click="staffDeviceQuery" style="margin-left: 20px;">
  536. {{ $t('搜索') }}</el-button>
  537. </el-form>
  538. <el-table v-loading="loading" :data="devicceList" border>
  539. <el-table-column :label="$t('课程代码')" align="center" prop="courseCode" width="200" :show-overflow-tooltip="true"/>
  540. <el-table-column :label="$t('课程名称')" align="center" prop="item" width="350" :show-overflow-tooltip="true"/>
  541. <el-table-column :label="$t('授课人')" align="center" prop="lecturerName" width="150" :show-overflow-tooltip="true" />
  542. <el-table-column :label="$t('课时')" align="center" prop="hour" :show-overflow-tooltip="true"/>
  543. <el-table-column :label="$t('开始日期')" align="center" prop="startDate" width="100">
  544. <template slot-scope="scope">
  545. <span v-if="scope.row.supplementary === '0' && scope.row.trainingType === '10'">{{ parseTime(scope.row.startDate, '{y}-{m}') }}</span>
  546. <span v-else>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
  547. </template>
  548. </el-table-column>
  549. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  550. </el-table>
  551. </el-dialog>
  552. <!-- 报告附件对话框 -->
  553. <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px" append-to-body >
  554. <el-upload v-hasPermi="['training:trainingrecords:file']"
  555. ref="doc"
  556. :limit="50"
  557. :headers="doc.headers"
  558. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  559. :disabled="doc.isUploading"
  560. :on-progress="handleFileDocProgress"
  561. :on-success="handleFileDocSuccess"
  562. :auto-upload="true"
  563. drag
  564. >
  565. <i class="el-icon-upload"></i>
  566. <div class="el-upload__text">
  567. {{ $t('将文件拖到此处,或') }}
  568. <em>{{ $t('点击上传') }}</em>
  569. </div>
  570. </el-upload>
  571. <el-table :data="doc.commonfileList" border>
  572. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  573. <template slot-scope="scope">
  574. <a class="link-type" @click="handleDownload(scope.row)">
  575. <span>{{ scope.row.fileName }}</span>
  576. </a>
  577. </template>
  578. </el-table-column>
  579. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  580. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  581. <el-table-column :label="$t('培训日期')" align="center" prop="pDate" width="150">
  582. <template slot-scope="scope">
  583. <el-date-picker
  584. v-if="scope.row.isEdit"
  585. v-model="scope.row.pDate"
  586. type="date"
  587. value-format="yyyy-MM-dd"
  588. :placeholder="$t('日期')">
  589. </el-date-picker>
  590. <span v-else>{{ parseTime(scope.row.pDate, '{y}-{m}-{d}') }}</span>
  591. </template>
  592. </el-table-column>
  593. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  594. <template slot-scope="scope">
  595. <el-button
  596. v-if="scope.row.fileName.endsWith('pdf')"
  597. size="mini"
  598. type="text"
  599. icon="el-icon-view"
  600. @click="handleSee(scope.row)"
  601. >{{ $t('预览') }}</el-button>
  602. <el-button v-hasPermi="['training:trainingrecords:file']" type="text" size="small" v-if="scope.row.isEdit" @click="save(scope.row)">{{ $t('保存') }}</el-button>
  603. <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">{{ $t('取消') }}</el-button>
  604. <el-button v-hasPermi="['training:trainingrecords:file']" v-if="!scope.row.isEdit" @click="edit(scope.row)" icon="el-icon-edit" type="text" size="mini">{{ $t('编辑') }}</el-button>
  605. <el-button
  606. size="mini"
  607. type="text"
  608. icon="el-icon-download"
  609. @click="handleDownload(scope.row)"
  610. >{{ $t('下载') }}</el-button>
  611. <el-button
  612. size="mini"
  613. type="text"
  614. icon="el-icon-delete"
  615. @click="handleDeleteDoc(scope.row)"
  616. v-hasPermi="['training:trainingrecords:file']"
  617. >{{ $t('删除') }}</el-button>
  618. </template>
  619. </el-table-column>
  620. </el-table>
  621. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  622. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  623. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  624. <div style="margin-top: -30px">
  625. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  626. </div>
  627. </el-dialog>
  628. <div slot="footer" class="dialog-footer">
  629. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  630. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  631. </div>
  632. </el-dialog>
  633. </div>
  634. </template>
  635. <script>
  636. import { listTrainingrecords, getTrainingrecords, delTrainingrecords, addTrainingrecords, updateTrainingrecords, exportTrainingrecords, exportTrainingTime } from "@/api/training/trainingrecords";
  637. import { listCompanylevel } from "@/api/training/companylevel";
  638. import { listTraining } from "@/api/training/worklicense";
  639. import { listParticipants, companyListParticipants, delParticipants } from "@/api/training/participants";
  640. import { listDevice, deviceListParticipants} from "@/api/training/device";
  641. import { treeselect } from "@/api/system/dept";
  642. import { selectTimeStaffmgr } from "@/api/plant/staffmgr";
  643. import { getToken } from "@/utils/auth";
  644. import Treeselect from "@riophae/vue-treeselect";
  645. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  646. import {allFileList, delCommonfile ,updateCommonfile ,addCommonfile} from "@/api/common/commonfile";
  647. import {addTrainingNon, updateTrainingNon} from "@/api/training/trainingNon";
  648. export default {
  649. name: "Trainingrecords",
  650. components: { Treeselect},
  651. data() {
  652. return {
  653. transTitle: [], // transTitle 该标题为转化后的标题, 注意多一列, 因为原来的标题变成了竖着显示了, 所以多一列标题, 第一个为空即可
  654. companylevelList: [],
  655. companylevelListTemp: [],
  656. devicelevelList: [],
  657. devicelevelListTemp: [],
  658. // 遮罩层
  659. loading: true,
  660. // 选中数组
  661. ids: [],
  662. // 非单个禁用
  663. single: true,
  664. // 非多个禁用
  665. multiple: true,
  666. // 显示搜索条件
  667. showSearch: false,
  668. // 总条数
  669. total: 0,
  670. // 培训成绩表格数据
  671. trainingrecordsList: [],
  672. // 人员-公司级培训关系表格数据
  673. participantsList: [],
  674. // 人员-装置级培训关系表格数据
  675. devicceList: [],
  676. //上岗证培训列表
  677. worklicenseList: [],
  678. // 弹出层标题
  679. title: "",
  680. companyTitle: "",
  681. deviceTitle: "",
  682. companyTrainingTitle: "",
  683. trainingTimeTitle: "",
  684. deviceTrainingTitle: "",
  685. worklicenseTitle: "",
  686. // 部门树选项
  687. deptOptions: undefined,
  688. clientHeight:300,
  689. // 是否显示弹出层
  690. open: false,
  691. companyOpen: false,
  692. deviceOpen: false,
  693. companyTrainingOpen: false,
  694. deviceTrainingOpen: false,
  695. worklicenseOpen: false,
  696. companyTrainingLoad: false,
  697. deviceTrainingLoad: false,
  698. tableShow: true,
  699. trainingTimeOpen: false,
  700. // 装置名称字典
  701. plantCodeOptions: [],
  702. // 班值字典
  703. classesOptions: [],
  704. // SUB字典
  705. subOptions: [],
  706. // 裂解字典
  707. crackingOptions: [],
  708. // 热区字典
  709. hotareaOptions: [],
  710. // 冷区字典
  711. coldareaOptions: [],
  712. // AEU/PGU字典
  713. aeupguOptions: [],
  714. // 入职字典
  715. onboardOptions: [],
  716. // TDS字典
  717. tdsOptions: [],
  718. // 上岗证复证字典
  719. postCardOptions: [],
  720. // 工艺培训字典
  721. craftOptions: [],
  722. //公司级培训字典
  723. companyOptions: [],
  724. //装置级培训字典
  725. deviceOptions: [],
  726. // 培训岗位字典
  727. positionOptions: [],
  728. //培训类型字典
  729. trainingTypeOptions: [],
  730. //点击查看的员工号
  731. employeeid: '',
  732. // 用户导入参数
  733. upload: {
  734. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  735. //下载模板类型
  736. type: "trainingrecords",
  737. // 是否显示弹出层(用户导入)
  738. open: false,
  739. // 弹出层标题(用户导入)
  740. title: "",
  741. // 是否禁用上传
  742. isUploading: false,
  743. // 是否更新已经存在的用户数据
  744. updateSupport: 0,
  745. // 设置上传的请求头部
  746. headers: { Authorization: "Bearer " + getToken() },
  747. // 上传的地址
  748. url: process.env.VUE_APP_BASE_API + "/training/trainingrecords/importData"
  749. },
  750. // 报告附件参数
  751. doc: {
  752. file: "",
  753. // 是否显示弹出层(报告附件)
  754. open: false,
  755. // 弹出层标题(报告附件)
  756. title: this.$t('附件'),
  757. // 是否禁用上传
  758. isUploading: false,
  759. // 是否更新已经存在的用户数据
  760. updateSupport: 0,
  761. // 报告附件上传位置编号
  762. ids: 0,
  763. // 设置上传的请求头部
  764. headers: { Authorization: "Bearer " + getToken() },
  765. // 上传的地址
  766. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  767. commonfileList: null,
  768. queryParams: {
  769. pId: null,
  770. pType: 'traning'
  771. },
  772. pType: 'traning',
  773. pId: null,
  774. form: {}
  775. },
  776. // 查询参数
  777. queryParams: {
  778. pageNum: 1,
  779. pageSize: 20,
  780. name: null,
  781. employeeid: null,
  782. classes: null,
  783. sortDate: null,
  784. sortOrder: null,
  785. onboard: null,
  786. tds: null,
  787. postCard: null,
  788. craft: null,
  789. company: null
  790. },
  791. //人员表查询参数
  792. staffmgrQueryParams: {
  793. units: "10,18,20",
  794. leftYear: this.getNowTime(),
  795. },
  796. queryCompanyParams: {
  797. staffId: null,
  798. companyId: null,
  799. },
  800. queryDeviceParams: {
  801. staffId: null,
  802. regularId: null,
  803. year: this.getNowTime(),
  804. trainingType: null
  805. },
  806. deviceParams: {
  807. units: "10,18",
  808. staffId: null,
  809. regularId: null,
  810. year: null,
  811. trainingType: null
  812. },
  813. worklicenseParams: {
  814. employeeid: null,
  815. },
  816. companyQueryParams: {},
  817. // 表单参数
  818. form: {},
  819. pdf : {
  820. title: '',
  821. pdfUrl: '',
  822. numPages: null,
  823. open: false,
  824. pageNum: 1,
  825. pageTotalNum: 1,
  826. loadedRatio: 0,
  827. },
  828. // 表单校验
  829. rules: {
  830. plantCode: [
  831. { required: true, message: this.$t('装置名称') + this.$t('不能为空'), trigger: "change" }
  832. ],
  833. year: [
  834. { required: true, message: this.$t('年份') + this.$t('不能为空'), trigger: "blur" }
  835. ],
  836. deptId: [
  837. { required: true, message: this.$t('部门编号') + this.$t('不能为空'), trigger: "blur" }
  838. ]
  839. },
  840. };
  841. },
  842. watch: {
  843. // 根据名称筛选部门树
  844. deptName(val) {
  845. this.$refs.tree.filter(val);
  846. }
  847. },
  848. created() {
  849. //设置表格高度对应屏幕高度
  850. this.$nextTick(() => {
  851. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  852. })
  853. this.getList();
  854. this.getStaffmar();
  855. this.getTreeselect();
  856. this.getDicts("PLANT_DIVIDE").then(response => {
  857. this.plantCodeOptions = response.data;
  858. });
  859. this.getDicts("TEAM_DIVIDE").then(response => {
  860. this.classesOptions = response.data;
  861. });
  862. this.getDicts("TICK_CROSS").then(response => {
  863. this.subOptions = response.data;
  864. });
  865. this.getDicts("TICK_CROSS").then(response => {
  866. this.crackingOptions = response.data;
  867. });
  868. this.getDicts("TICK_CROSS").then(response => {
  869. this.hotareaOptions = response.data;
  870. });
  871. this.getDicts("TICK_CROSS").then(response => {
  872. this.coldareaOptions = response.data;
  873. });
  874. this.getDicts("TICK_CROSS").then(response => {
  875. this.aeupguOptions = response.data;
  876. });
  877. this.getDicts("TRAINING_QUALIFY").then(response => {
  878. this.onboardOptions = response.data;
  879. });
  880. this.getDicts("TRAINING_QUALIFY").then(response => {
  881. this.tdsOptions = response.data;
  882. });
  883. this.getDicts("TRAINING_QUALIFY").then(response => {
  884. this.postCardOptions = response.data;
  885. });
  886. this.getDicts("TRAINING_QUALIFY").then(response => {
  887. this.craftOptions = response.data;
  888. });
  889. this.getDicts("TRAINING_QUALIFY").then(response => {
  890. this.companyOptions = response.data;
  891. });
  892. this.getDicts("TRAINING_QUALIFY").then(response => {
  893. this.deviceOptions = response.data;
  894. });
  895. this.getDicts("ACTUALPOST").then(response => {
  896. this.positionOptions = response.data;
  897. });
  898. this.getDicts("TRAINING_TYPE").then(response => {
  899. this.trainingTypeOptions = response.data;
  900. });
  901. },
  902. methods: {
  903. colspanMethod({ row, column, rowIndex, columnIndex }) {
  904. if (columnIndex === 0) {
  905. const _row = this.setTable(this.companylevelList).merge[rowIndex];
  906. const _col = _row > 0 ? 1 : 0;
  907. return {
  908. rowspan: _row,
  909. colspan: _col
  910. };
  911. }
  912. if (columnIndex === 1 ) {
  913. const _row = this.setTable(this.companylevelList).merge[rowIndex];
  914. const _col = _row > 0 ? 1 : 0;
  915. return {
  916. rowspan: _row,
  917. colspan: _col
  918. };
  919. }
  920. if (columnIndex === 2 ) {
  921. const _row = this.setTable(this.companylevelList).merge[rowIndex];
  922. const _col = _row > 0 ? 1 : 0;
  923. return {
  924. rowspan: _row,
  925. colspan: _col
  926. };
  927. }
  928. },
  929. colspanDeviceMethod({ row, column, rowIndex, columnIndex }) {
  930. if (columnIndex === 0) {
  931. const _row = this.setTable(this.devicelevelList).merge[rowIndex];
  932. const _col = _row > 0 ? 1 : 0;
  933. return {
  934. rowspan: _row,
  935. colspan: _col
  936. };
  937. }
  938. if (columnIndex === 1 ) {
  939. const _row = this.setTable(this.devicelevelList).merge[rowIndex];
  940. const _col = _row > 0 ? 1 : 0;
  941. return {
  942. rowspan: _row,
  943. colspan: _col
  944. };
  945. }
  946. },
  947. setTable(tableData) {
  948. let spanArr = [],
  949. concat = 0;
  950. tableData.forEach((item, index) => {
  951. if (index === 0) {
  952. spanArr.push(1);
  953. } else {
  954. if (item[1] === tableData[index - 1][1] && item[0] === tableData[index - 1][0]) {
  955. //第一列需合并相同内容的判断条件
  956. spanArr[concat] += 1;
  957. spanArr.push(0);
  958. } else {
  959. spanArr.push(1);
  960. concat = index;
  961. }
  962. }
  963. });
  964. return {
  965. merge: spanArr
  966. };
  967. },
  968. //根据是否存在最后培训时间显示颜色提示
  969. tableCellClassName({ row, column, rowIndex, columnIndex }) {
  970. // for (let i = 2; i < this.transTitle.length + 2; i++) {
  971. // if (columnIndex == i){
  972. // return this.changeColor(row[i])
  973. // }
  974. // }
  975. return this.changeColor(row[columnIndex])
  976. },
  977. changeColor (value) {
  978. if (value == null) {
  979. return 'companyNot'
  980. }
  981. if (value.trim().startsWith('20')){
  982. return 'companyFinish'
  983. }
  984. if (value === "-"){
  985. return 'companyUrgent'
  986. }
  987. if (value === "尚未开始培训") {
  988. return 'companyNot'
  989. }
  990. },
  991. /** 查询培训成绩列表 */
  992. getList() {
  993. this.loading = true;
  994. listTrainingrecords(this.queryParams).then(response => {
  995. this.trainingrecordsList = response.rows;
  996. this.total = response.total;
  997. this.loading = false;
  998. });
  999. },
  1000. //获取人员表
  1001. getStaffmar() {
  1002. selectTimeStaffmgr(this.staffmgrQueryParams).then(response => {
  1003. const allData = response.rows
  1004. const data = [];
  1005. for (let i = 0; i < allData.length; i++) {
  1006. data.push({
  1007. name: allData[i].name,
  1008. actualpost: this.selectDictLabel(this.positionOptions, allData[i].actualpost),
  1009. trainingTime: allData[i].trainingTime
  1010. });
  1011. }
  1012. this.transTitle = data;
  1013. })
  1014. },
  1015. //获取公司级培训列表
  1016. getCompanyTraining() {
  1017. companyListParticipants(this.companyQueryParams).then(response => {
  1018. this.companylevelListTemp = response;
  1019. this.companylevelList = response
  1020. this.companyTrainingLoad = false
  1021. this.$nextTick(() => {
  1022. this.$refs.companyTable.doLayout(); // 解决表格错位
  1023. });
  1024. })
  1025. },
  1026. //获取装置级培训列表
  1027. getDeviceTraining() {
  1028. this.staffmgrQueryParams.leftYear = this.deviceParams.year
  1029. selectTimeStaffmgr(this.staffmgrQueryParams).then(response => {
  1030. const allData = response.rows
  1031. const data = [];
  1032. for (let i = 0; i < allData.length; i++) {
  1033. data.push({
  1034. name: allData[i].name,
  1035. actualpost: this.selectDictLabel(this.positionOptions, allData[i].actualpost),
  1036. trainingTime: allData[i].trainingTime
  1037. });
  1038. }
  1039. this.transTitle = data;
  1040. this.$nextTick(() => {
  1041. deviceListParticipants(this.deviceParams).then(response => {
  1042. this.devicelevelListTemp = response;
  1043. this.devicelevelList = response
  1044. this.deviceTrainingLoad = false
  1045. this.$nextTick(() => {
  1046. this.$refs.deviceTable.doLayout(); // 解决表格错位
  1047. });
  1048. })
  1049. });
  1050. })
  1051. },
  1052. /** 查询部门下拉树结构 */
  1053. getTreeselect() {
  1054. treeselect().then(response => {
  1055. this.deptOptions = response.data;
  1056. });
  1057. },
  1058. // 装置名称字典翻译
  1059. plantCodeFormat(row, column) {
  1060. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  1061. },
  1062. // 班值字典翻译
  1063. classesFormat(row, column) {
  1064. return this.selectDictLabel(this.classesOptions, row.classes);
  1065. },
  1066. // SUB字典翻译
  1067. subFormat(row, column) {
  1068. return this.selectDictLabel(this.subOptions, row.sub);
  1069. },
  1070. // 裂解字典翻译
  1071. crackingFormat(row, column) {
  1072. return this.selectDictLabel(this.crackingOptions, row.cracking);
  1073. },
  1074. // 热区字典翻译
  1075. hotareaFormat(row, column) {
  1076. return this.selectDictLabel(this.hotareaOptions, row.hotarea);
  1077. },
  1078. // 冷区字典翻译
  1079. coldareaFormat(row, column) {
  1080. return this.selectDictLabel(this.coldareaOptions, row.coldarea);
  1081. },
  1082. // AEU/PGU字典翻译
  1083. aeupguFormat(row, column) {
  1084. return this.selectDictLabel(this.aeupguOptions, row.aeupgu);
  1085. },
  1086. // 入职字典翻译
  1087. onboardFormat(row, column) {
  1088. return this.selectDictLabel(this.onboardOptions, row.onboard);
  1089. },
  1090. // TDS字典翻译
  1091. tdsFormat(row, column) {
  1092. return this.selectDictLabel(this.tdsOptions, row.tds);
  1093. },
  1094. // 上岗证复证字典翻译
  1095. postCardFormat(row, column) {
  1096. return this.selectDictLabel(this.postCardOptions, row.postCard);
  1097. },
  1098. // 工艺培训字典翻译
  1099. craftFormat(row, column) {
  1100. return this.selectDictLabel(this.craftOptions, row.craft);
  1101. },
  1102. //公司级培训字典翻译
  1103. companyFormat(row, column) {
  1104. return this.selectDictLabel(this.companyOptions, row.company);
  1105. },
  1106. //装置级培训字典翻译
  1107. deviceFormat(row, column) {
  1108. return this.selectDictLabel(this.deviceOptions, row.device);
  1109. },
  1110. // 培训类型翻译
  1111. trainingTypeFormat(row, column) {
  1112. return this.selectDictLabel(this.trainingTypeOptions, row.trainingType);
  1113. },
  1114. // 取消按钮
  1115. cancel() {
  1116. this.open = false;
  1117. this.reset();
  1118. },
  1119. // 表单重置
  1120. reset() {
  1121. this.form = {
  1122. id: null,
  1123. plantCode: null,
  1124. name: null,
  1125. employeeid: null,
  1126. classes: null,
  1127. companysafe: null,
  1128. plantsafe: null,
  1129. teamsafe: null,
  1130. sub: null,
  1131. cracking: null,
  1132. hotarea: null,
  1133. coldarea: null,
  1134. aeupgu: null,
  1135. upscore: null,
  1136. downscore: null,
  1137. delFlag: null,
  1138. createrCode: null,
  1139. createdate: null,
  1140. updaterCode: null,
  1141. updatedate: null,
  1142. remarks: null,
  1143. deptId: null,
  1144. onboard: null,
  1145. tds: null,
  1146. postCard: null,
  1147. craft: null,
  1148. company: null,
  1149. device: null
  1150. };
  1151. this.resetForm("form");
  1152. },
  1153. /** 搜索按钮操作 */
  1154. handleQuery() {
  1155. this.queryParams.pageNum = 1;
  1156. this.getList();
  1157. },
  1158. //搜索按钮
  1159. handleDeviceQuery() {
  1160. this.deviceTrainingLoad = true;
  1161. this.$nextTick(() => {
  1162. this.getDeviceTraining();
  1163. });
  1164. },
  1165. staffDeviceQuery() {
  1166. this.getDevice(this.employeeid)
  1167. },
  1168. /** 重置按钮操作 */
  1169. resetQuery() {
  1170. this.resetForm("queryForm");
  1171. this.handleQuery();
  1172. },
  1173. // 多选框选中数据
  1174. handleSelectionChange(selection) {
  1175. this.ids = selection.map(item => item.id)
  1176. this.single = selection.length!==1
  1177. this.multiple = !selection.length
  1178. },
  1179. //根据分数显示颜色提示
  1180. tableCellStyle({ row, column, rowIndex, columnIndex }) {
  1181. if (columnIndex === 4 && row.onboard === "2"){
  1182. return "color: rgba(255, 26, 26, 0.98) "
  1183. }else if (columnIndex === 5 && row.tds === "2"){
  1184. return "color: rgba(255, 26, 26, 0.98) "
  1185. }else if (columnIndex === 6 && row.postCard === "2"){
  1186. return "color: rgba(255, 26, 26, 0.98) "
  1187. }else if (columnIndex === 7 && row.craft === "2"){
  1188. return "color: rgba(255, 26, 26, 0.98) "
  1189. }else if (columnIndex === 8 && row.company === "2"){
  1190. return "color: rgba(255, 26, 26, 0.98) "
  1191. }
  1192. },
  1193. //排序
  1194. sortChange(val){
  1195. if (val.prop == 'companysafe'){
  1196. this.queryParams.sortDate = 'companysafe';
  1197. }else if (val.prop == 'plantsafe'){
  1198. this.queryParams.sortDate = 'plantsafe';
  1199. }else if (val.prop == 'teamsafe'){
  1200. this.queryParams.sortDate = 'teamsafe';
  1201. }
  1202. if (val.order === 'descending') {
  1203. this.queryParams.sortOrder = 'desc'
  1204. } else {
  1205. this.queryParams.sortOrder = 'asc'
  1206. }
  1207. this.getList()
  1208. },
  1209. /** 获取当前年份 */
  1210. getNowTime() {
  1211. var now = new Date();
  1212. var year = now.getFullYear(); //得到年份
  1213. var defaultDate = `${year}`;
  1214. defaultDate = `${year}`
  1215. return defaultDate;
  1216. },
  1217. /** 公司级培训矩阵按钮操作 */
  1218. handleCompany() {
  1219. this.companyTrainingLoad =true
  1220. this.companyTrainingTitle = this.$t('参加')+this.$t('空格')+this.$t('公司级')+this.$t('空格')+this.$t('培训人员')+this.$t('空格') +this.$t('名单')
  1221. this.companyTrainingOpen = true
  1222. // loading.close();
  1223. this.tableShow = true
  1224. setTimeout(() => {
  1225. this.getCompanyTraining();
  1226. }, 10);
  1227. },
  1228. /** 装置级培训矩阵按钮操作 */
  1229. handleDevice() {
  1230. this.deviceTrainingLoad =true
  1231. this.resetForm("queryRegularForm");
  1232. this.deviceTrainingTitle =this.$t('参加') +this.$t('空格') + this.$t('装置级') +this.$t('空格') + this.$t('培训人员') +this.$t('空格') + this.$t('名单')
  1233. this.deviceTrainingOpen = true
  1234. this.tableShow = true
  1235. this.deviceParams.year = this.getNowTime();
  1236. this.$nextTick(() => {
  1237. deviceListParticipants(this.deviceParams).then(response => {
  1238. this.devicelevelListTemp = response;
  1239. this.devicelevelList = response
  1240. this.deviceTrainingLoad = false
  1241. this.$nextTick(() => {
  1242. this.$refs.deviceTable.doLayout(); // 解决表格错位
  1243. });
  1244. })
  1245. });
  1246. // setTimeout(() => {
  1247. // this.getDeviceTraining();
  1248. // }, 10);
  1249. },
  1250. /** 人员培训时长按钮操作 */
  1251. handleTime() {
  1252. this.trainingTimeOpen = true;
  1253. this.trainingTimeTitle = this.$t('人员培训时长');
  1254. },
  1255. /** 新增按钮操作 */
  1256. handleAdd() {
  1257. this.reset();
  1258. this.open = true;
  1259. this.title = this.$t('新增') + this.$t('空格') + this.$t('培训成绩');
  1260. },
  1261. /** 修改按钮操作 */
  1262. handleUpdate(row) {
  1263. this.reset();
  1264. const id = row.id || this.ids
  1265. getTrainingrecords(id).then(response => {
  1266. this.form = response.data;
  1267. if (response.data.sub == 10) { this.form.sub = true }
  1268. if (response.data.cracking == 10) { this.form.cracking = true }
  1269. if (response.data.hotarea == 10) { this.form.hotarea = true }
  1270. if (response.data.coldarea == 10) { this.form.coldarea = true }
  1271. if (response.data.aeupgu == 10) { this.form.aeupgu = true }
  1272. this.open = true;
  1273. this.title = this.$t('修改') + this.$t('培训成绩');
  1274. });
  1275. },
  1276. /** 提交按钮 */
  1277. submitForm() {
  1278. this.$refs["form"].validate(valid => {
  1279. if (valid) {
  1280. if (this.form.id != null) {
  1281. updateTrainingrecords(this.form).then(response => {
  1282. this.msgSuccess(this.$t('修改成功'));
  1283. this.open = false;
  1284. this.getList();
  1285. });
  1286. } else {
  1287. addTrainingrecords(this.form).then(response => {
  1288. this.msgSuccess(this.$t('新增成功'));
  1289. this.open = false;
  1290. this.getList();
  1291. });
  1292. }
  1293. }
  1294. });
  1295. },
  1296. /** 删除按钮操作 */
  1297. handleDelete(row) {
  1298. const ids = row.id || this.ids;
  1299. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  1300. confirmButtonText: this.$t('确定'),
  1301. cancelButtonText: this.$t('取消'),
  1302. type: "warning"
  1303. }).then(function() {
  1304. return delTrainingrecords(ids);
  1305. }).then(() => {
  1306. this.getList();
  1307. this.msgSuccess(this.$t('删除成功'));
  1308. })
  1309. },
  1310. /** 公司级培训删除按钮操作 */
  1311. participantsHandleDelete(row) {
  1312. const ids = row.id
  1313. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  1314. confirmButtonText: this.$t('确定'),
  1315. cancelButtonText: this.$t('取消'),
  1316. type: "warning"
  1317. }).then(function() {
  1318. return delParticipants(ids);
  1319. }).then(() => {
  1320. this.getParticipants(row.staffId)
  1321. this.msgSuccess(this.$t('删除成功'));
  1322. })
  1323. },
  1324. /** 导出按钮操作 */
  1325. handleExport() {
  1326. const queryParams = this.queryParams;
  1327. this.$confirm(this.$t('是否确认导出所有培训成绩数据项?'), this.$t('警告'), {
  1328. confirmButtonText: this.$t('确定'),
  1329. cancelButtonText: this.$t('取消'),
  1330. type: "warning"
  1331. }).then(function() {
  1332. return exportTrainingrecords(queryParams);
  1333. }).then(response => {
  1334. this.download(response.msg);
  1335. })
  1336. },
  1337. /** 导出人员培训时长按钮操作 */
  1338. exportTrainingTime() {
  1339. const queryParams = this.transTitle;
  1340. this.$confirm(this.$t('是否确认导出人员培训时长?'), this.$t('警告'), {
  1341. confirmButtonText: this.$t('确定'),
  1342. cancelButtonText: this.$t('取消'),
  1343. type: "warning"
  1344. }).then(function() {
  1345. return exportTrainingTime();
  1346. }).then(response => {
  1347. this.download(response.msg);
  1348. })
  1349. },
  1350. /** 导入按钮操作 */
  1351. handleImport() {
  1352. this.upload.title = this.$t('用户导入');
  1353. this.upload.open = true;
  1354. },
  1355. /** 下载模板操作 */
  1356. importTemplate() {
  1357. this.$refs['downloadFileForm'].submit()
  1358. },
  1359. // 文件上传中处理
  1360. handleFileUploadProgress(event, file, fileList) {
  1361. this.upload.isUploading = true;
  1362. },
  1363. // 文件上传成功处理
  1364. handleFileSuccess(response, file, fileList) {
  1365. this.upload.open = false;
  1366. this.upload.isUploading = false;
  1367. this.$refs.upload.clearFiles();
  1368. if (response.data[0] != null) {
  1369. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1370. }else {
  1371. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1372. }
  1373. this.getList();
  1374. },
  1375. // 提交上传文件
  1376. submitFileForm() {
  1377. this.$refs.upload.submit();
  1378. },
  1379. /** 报告附件按钮操作 */
  1380. handleDoc(row , fileType) {
  1381. this.doc.pType = fileType
  1382. this.doc.queryParams.pType = fileType
  1383. this.doc.id = row.id;
  1384. var titleType = '';
  1385. if (fileType === 'trainingrecords-onbord') {
  1386. titleType = row.name + this.$t('空格') + this.$t('的')+this.$t('入职')+ this.$t('空格') + this.$t('培训')
  1387. }else if (fileType === 'trainingrecords-tds') {
  1388. titleType = row.name + this.$t('空格') + this.$t('的')+this.$t('TDS培训')
  1389. }else if (fileType === 'trainingrecords-craft') {
  1390. titleType = row.name + this.$t('空格') + this.$t('的')+this.$t('工艺培训')
  1391. }else {
  1392. titleType =this.$t('上岗证') + this.$t('空格') + this.$t('培训')
  1393. }
  1394. this.doc.title = titleType;
  1395. this.doc.open = true;
  1396. this.doc.queryParams.pId = row.id
  1397. this.doc.pId = row.id
  1398. this.getFileList()
  1399. this.$nextTick(() => {
  1400. this.$refs.doc.clearFiles()
  1401. })
  1402. },
  1403. getFileList (){
  1404. allFileList(this.doc.queryParams).then(response => {
  1405. response.forEach(element => {
  1406. element["isEdit"] = false
  1407. });
  1408. response.forEach(element => {
  1409. element["isAdd"] = false
  1410. });
  1411. this.doc.commonfileList = response;
  1412. });
  1413. },
  1414. //附件上传中处理
  1415. handleFileDocProgress(event, file, fileList) {
  1416. this.doc.file = file;
  1417. this.doc.isUploading = true;
  1418. },
  1419. //附件上传成功处理
  1420. handleFileDocSuccess(response, file, fileList) {
  1421. this.doc.isUploading = false;
  1422. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1423. this.getFileList()
  1424. },
  1425. // 文件下载处理
  1426. handleDownload(row) {
  1427. var name = row.fileName;
  1428. var url = row.fileUrl;
  1429. var suffix = url.substring(url.lastIndexOf("."), url.length);
  1430. const a = document.createElement('a')
  1431. a.setAttribute('download', name)
  1432. a.setAttribute('target', '_blank')
  1433. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  1434. a.click()
  1435. },
  1436. //pdf预览
  1437. openPdf(){
  1438. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  1439. },
  1440. handleSee (row){
  1441. this.pdf.open =true
  1442. this.pdf.title = row.fileName
  1443. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  1444. },
  1445. /** 打开上岗证复证列表 */
  1446. openWorklicense(row) {
  1447. this.worklicenseOpen = true;
  1448. this.worklicenseTitle = row.name + this.$t('的')+this.$t('上岗证复证')+this.$t('列表');
  1449. this.worklicenseParams.employeeid = row.employeeid
  1450. listTraining(this.worklicenseParams).then(response => {
  1451. this.worklicenseList = response;
  1452. });
  1453. },
  1454. /** 打开公司级培训列表 */
  1455. openCompany(row) {
  1456. this.companyOpen = true;
  1457. this.companyTitle = row.name+ this.$t('空格') + this.$t('的')+this.$t('公司级') + this.$t('空格') +this.$t('培训信息');
  1458. this.$nextTick(() => {
  1459. this.getParticipants(row.employeeid)
  1460. })
  1461. },
  1462. /** 打开装置级培训列表 */
  1463. openDevice(row) {
  1464. this.deviceOpen = true;
  1465. this.resetForm("queryRegularForm");
  1466. this.deviceTitle = row.name + this.$t('空格') + this.$t('的')+this.$t('装置级') + this.$t('空格') +this.$t('培训信息');
  1467. this.employeeid = row.employeeid;
  1468. this.queryDeviceParams.year = this.getNowTime();
  1469. this.$nextTick(() => {
  1470. this.getDevice(row.employeeid)
  1471. })
  1472. },
  1473. getParticipants(employeeid) {
  1474. this.queryCompanyParams.staffId = employeeid
  1475. listParticipants(this.queryCompanyParams).then(response => {
  1476. this.participantsList = response.rows;
  1477. });
  1478. },
  1479. getDevice(employeeid) {
  1480. this.queryDeviceParams.staffId = employeeid
  1481. listDevice(this.queryDeviceParams).then(response => {
  1482. this.devicceList = response.rows;
  1483. });
  1484. },
  1485. // 取消
  1486. cancelFile(row, index) {
  1487. // 如果是新增的数据
  1488. if (row.isAdd) {
  1489. this.doc.commonfileList.splice(index, 1)
  1490. } else {
  1491. // 不是新增的数据 还原数据
  1492. for (const i in row.oldRow) {
  1493. row[i] = row.oldRow[i]
  1494. }
  1495. row.isEdit = false
  1496. }
  1497. },
  1498. edit(row) {
  1499. // 备份原始数据
  1500. row['oldRow'] = JSON.parse(JSON.stringify(row));
  1501. this.$nextTick(() => {
  1502. row.isEdit = true;
  1503. })
  1504. },
  1505. save(row) {
  1506. row.isEdit = false;
  1507. var that = this;
  1508. that.loading = true;
  1509. this.form = row;
  1510. if (row.isAdd == true) {
  1511. addCommonfile(this.form).then(response => {
  1512. this.msgSuccess(this.$t('新增成功'));
  1513. this.open = false;
  1514. this.getList();
  1515. });
  1516. }else {
  1517. updateCommonfile(this.form).then(response => {
  1518. this.msgSuccess(this.$t('修改成功'));
  1519. this.open = false;
  1520. this.getList();
  1521. });
  1522. }
  1523. },
  1524. /** 删除按钮操作 */
  1525. handleDeleteDoc(row) {
  1526. const ids = row.id || this.ids;
  1527. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  1528. confirmButtonText: this.$t('确定'),
  1529. cancelButtonText: this.$t('取消'),
  1530. type: "warning"
  1531. }).then(function() {
  1532. return delCommonfile(ids);
  1533. }).then(() => {
  1534. this.getFileList()
  1535. this.msgSuccess(this.$t('删除成功'));
  1536. })
  1537. },
  1538. /** 公司级培训修改按钮操作 */
  1539. handleCompanyUpdate(row) {
  1540. this.reset();
  1541. const id = row.id || this.ids
  1542. },
  1543. closeDialog(){
  1544. this.companylevelList = []
  1545. this.devicelevelList = []
  1546. this.tableShow =false
  1547. },
  1548. }
  1549. };
  1550. </script>
  1551. <style>
  1552. .companyLevelTable {
  1553. color: black;
  1554. }
  1555. .el-dialog__body {
  1556. padding-top: 0px
  1557. }
  1558. .el-table--scrollable-x .el-table__body-wrapper {
  1559. z-index: 1;
  1560. }
  1561. .rectangleRed {
  1562. width: 60px !important;
  1563. height: 30px !important;
  1564. margin-bottom: -8px;
  1565. }
  1566. .rectangleGreen {
  1567. width: 60px !important;
  1568. height: 30px !important;
  1569. margin-bottom: -8px;
  1570. }
  1571. </style>