index.vue 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item :label="$t('年份')" prop="years">
  5. <el-date-picker clearable size="small" style="width: 200px"
  6. v-model="queryParams.years"
  7. type="year"
  8. value-format="yyyy"
  9. :placeholder="$t('请选择') + $t('年份')"
  10. @change="handleQuery" >
  11. </el-date-picker>
  12. </el-form-item>
  13. <el-form-item :label="$t('培训课程')" prop="course">
  14. <el-input
  15. v-model="queryParams.course"
  16. :placeholder="$t('请输入') + $t('培训课程')"
  17. clearable
  18. size="small"
  19. @input="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item :label="$t('培训类型')" prop="trainingType" label-width="50">
  23. <el-select v-model="queryParams.trainingType" @change="handleQuery" :placeholder="$t('请选择') + $t('培训类型')" clearable size="small">
  24. <el-option
  25. v-for="dict in trainingTypeOptions"
  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="isfinish" label-width="50">
  33. <el-select v-model="queryParams.isfinish" @change="handleQuery" :placeholder="$t('请选择') + $t('是否完成')" clearable size="small">
  34. <el-option
  35. v-for="dict in isfinishOptions"
  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="$t('未参培情况')" prop="isNon" label-width="50">
  43. <el-select v-model="queryParams.isNon" @change="handleQuery" :placeholder="$t('请选择') + $t('是否未参培')" clearable size="small">
  44. <el-option
  45. key="0"
  46. label="全部"
  47. value="0"
  48. />
  49. <el-option
  50. key="1"
  51. label="未参培"
  52. value="1"
  53. />
  54. <el-option
  55. key="2"
  56. label="已完成"
  57. value="2"
  58. />
  59. <el-option
  60. key="3"
  61. label="未完成"
  62. value="3"
  63. />
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item :label="$t('培训开始日期')" label-width="60">
  67. <el-date-picker
  68. v-model="chooseDate"
  69. @change="handleQuery"
  70. type="daterange"
  71. align="right"
  72. unlink-panels
  73. :range-separator="$t('至')"
  74. :start-placeholder="$t('开始日期')"
  75. :end-placeholder="$t('结束日期')"
  76. value-format="yyyy-MM-dd"
  77. :picker-options="pickerOptions">
  78. </el-date-picker>
  79. </el-form-item>
  80. <el-form-item>
  81. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  82. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  83. </el-form-item>
  84. </el-form>
  85. <el-row :gutter="10" class="mb8">
  86. <el-col :span="1.5">
  87. <el-button
  88. type="primary"
  89. icon="el-icon-plus"
  90. size="mini"
  91. @click="handleAdd"
  92. v-hasPermi="['training:training:add']"
  93. >{{ $t('新增') }}</el-button>
  94. </el-col>
  95. <el-col :span="1.5">
  96. <el-button
  97. type="success"
  98. icon="el-icon-edit"
  99. size="mini"
  100. :disabled="single"
  101. @click="handleUpdate"
  102. v-hasPermi="['training:training:edit']"
  103. >{{ $t('修改') }}</el-button>
  104. </el-col>
  105. <el-col :span="1.5">
  106. <el-button
  107. type="danger"
  108. icon="el-icon-delete"
  109. size="mini"
  110. :disabled="multiple"
  111. @click="handleDelete"
  112. v-hasPermi="['training:training:remove']"
  113. >{{ $t('删除') }}</el-button>
  114. </el-col>
  115. <el-col :span="1.5">
  116. <el-button
  117. type="warning"
  118. icon="el-icon-download"
  119. size="mini"
  120. @click="handleExport"
  121. v-hasPermi="['training:training:export']"
  122. >{{ $t('导出') }}</el-button>
  123. </el-col>
  124. <el-col :span="1.5">
  125. <el-button
  126. type="info"
  127. icon="el-icon-document"
  128. size="mini"
  129. @click="handleDevice"
  130. >装置级培训记录
  131. </el-button>
  132. </el-col>
  133. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  134. </el-row>
  135. <el-row>
  136. <el-col :span="24">
  137. <el-button type="primary" plain @click="selectCourse('10')">定期类</el-button>
  138. <el-button type="primary" plain @click="selectCourse('12')">
  139. EHS类培训、学习及信息通告
  140. </el-button>
  141. <el-button type="primary" plain @click="selectCourse('14')">
  142. 程序和操作手册培训更新培训
  143. </el-button>
  144. <el-button type="primary" plain @click="selectCourse('16')">事件报告和调查</el-button>
  145. <el-button type="primary" plain @click="selectCourse('20')">MOC培训</el-button>
  146. <el-button type="primary" plain @click="selectCourse('24')">GIS/GSA</el-button>
  147. <!-- <el-button type="primary" plain @click="selectCourse('26')">{{ $t('事故信息') }}</el-button>-->
  148. <el-button type="primary" plain @click="selectCourse('26')">BYC EHS月报</el-button>
  149. <el-button type="primary" plain @click="selectCourse('28')">BYC事故信息</el-button>
  150. <el-button type="primary" plain @click="selectCourse('30')">CBP EHS季度会</el-button>
  151. <el-button type="primary" plain @click="selectCourse('32')">BASF事件分享</el-button>
  152. <el-button type="primary" plain @click="selectCourse('34')">Lesson Learnt</el-button>
  153. <el-button type="primary" plain @click="selectCourse('36')">职检报告</el-button>
  154. <el-button type="primary" plain @click="selectCourse('50')">{{ $t('其他') }}</el-button>
  155. </el-col>
  156. </el-row>
  157. <el-table v-loading="loading" :data="trainingList" @selection-change="handleSelectionChange" :cell-style="tableCellStyle" :height="clientHeight" border>
  158. <el-table-column type="selection" width="55" align="center" />
  159. <el-table-column :label="$t('年份')" align="center" prop="years" :show-overflow-tooltip="true"/>
  160. <el-table-column :label="$t('培训课程')" align="center" prop="course" width="250" :show-overflow-tooltip="true"/>
  161. <el-table-column :label="$t('培训类型')" align="center" prop="trainingType" width="120" :formatter="trainingTypeFormat"/>
  162. <el-table-column :label="$t('培训内容')" align="center" prop="content" width="250" :show-overflow-tooltip="true" />
  163. <el-table-column :label="$t('课程代码')" align="center" prop="courseid" width="150" :show-overflow-tooltip="true"/>
  164. <el-table-column :label="$t('是否完成')" align="center" prop="isfinish" width="120">
  165. <template slot-scope="scope">
  166. <!-- <el-progress :percentage="scope.row.trainingPercent"></el-progress>-->
  167. <span > ({{ scope.row.haveTraining }}/{{ scope.row.mustTraining }})</span>
  168. </template>
  169. </el-table-column>
  170. <el-table-column :label="$t('培训频率')" align="center" prop="period" :show-overflow-tooltip="true"/>
  171. <el-table-column label="学习时长(min)" align="center" prop="timerNeed" :show-overflow-tooltip="true"/>
  172. <el-table-column :label="$t('课时')" align="center" prop="duration" :show-overflow-tooltip="true"/>
  173. <el-table-column :label="$t('培训人')" align="center" prop="trainer" :show-overflow-tooltip="true"/>
  174. <el-table-column label="课件" align="center" width="120">
  175. <template slot-scope="scope">
  176. <div v-if="scope.row.fileName && scope.row.fileName.trim() !== ''">
  177. <el-tag type="success" size="mini">
  178. <i class="el-icon-document"></i>
  179. </el-tag>
  180. <el-button
  181. size="mini"
  182. type="text"
  183. icon="el-icon-edit"
  184. @click="handleDoc(scope.row)"
  185. style="margin-left: 5px;"
  186. >管理
  187. </el-button>
  188. </div>
  189. <div v-else>
  190. <el-button
  191. size="mini"
  192. type="text"
  193. icon="el-icon-upload"
  194. @click="handleDoc(scope.row)"
  195. style="margin-left: 5px;"
  196. >上传
  197. </el-button>
  198. </div>
  199. </template>
  200. </el-table-column>
  201. <el-table-column :label="$t('培训岗位')" align="center" prop="position" width="250" :show-overflow-tooltip="true" />
  202. <el-table-column :label="$t('培训开始日期')" align="center" prop="courseStartdate" width="100">
  203. <template slot-scope="scope">
  204. <span>{{ parseTime(scope.row.courseStartdate, '{y}-{m}-{d}') }}</span>
  205. </template>
  206. </el-table-column>
  207. <el-table-column :label="$t('培训结束日期')" align="center" prop="courseEnddate" width="100">
  208. <template slot-scope="scope">
  209. <span>{{ parseTime(scope.row.courseEnddate, '{y}-{m}-{d}') }}</span>
  210. </template>
  211. </el-table-column>
  212. <!-- <el-table-column :label="$t('未参培人员名单')" align="center" prop="nonParticipants" width="200" :show-overflow-tooltip="true" />-->
  213. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  214. <el-table-column :label="$t('操作')" align="center" fixed="right" width="270" class-name="small-padding fixed-width">
  215. <template slot-scope="scope">
  216. <el-button
  217. size="mini"
  218. type="text"
  219. icon="el-icon-edit"
  220. @click="handleUpdate(scope.row)"
  221. v-hasPermi="['training:training:edit']"
  222. >{{ $t('修改') }}</el-button>
  223. <el-button
  224. size="mini"
  225. type="text"
  226. icon="el-icon-edit"
  227. @click="handleStaffmgr(scope.row)"
  228. v-hasPermi="['training:training:edit']"
  229. >人员名单</el-button>
  230. <el-button
  231. size="mini"
  232. type="text"
  233. icon="el-icon-edit"
  234. @click="handleDetail(scope.row)"
  235. v-hasPermi="['training:training:edit']"
  236. >培训详情</el-button>
  237. <el-button
  238. size="mini"
  239. type="text"
  240. icon="el-icon-download"
  241. @click="handleExportSign(scope.row)"
  242. >导出签名表</el-button>
  243. </template>
  244. </el-table-column>
  245. </el-table>
  246. <pagination
  247. v-show="total>0"
  248. :total="total"
  249. :page.sync="queryParams.pageNum"
  250. :limit.sync="queryParams.pageSize"
  251. @pagination="getList"
  252. />
  253. <!-- 添加或修改培训计划对话框 -->
  254. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="title" :visible.sync="open" width="80%" append-to-body>
  255. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  256. <el-row>
  257. <el-col :span="12">
  258. <el-form-item :label="$t('培训课程')" prop="course">
  259. <el-input v-model="form.course" :placeholder="$t('请输入') + $t('培训课程')" />
  260. </el-form-item>
  261. </el-col>
  262. <el-col :span="12">
  263. <el-form-item :label="$t('培训类型')" prop="trainingType">
  264. <el-select v-model="form.trainingType" :placeholder="$t('请选择') + $t('培训类型')">
  265. <el-option
  266. v-for="dict in trainingTypeOptions"
  267. :key="dict.dictValue"
  268. :label="dict.dictLabel"
  269. :value="dict.dictValue"
  270. ></el-option>
  271. </el-select>
  272. </el-form-item>
  273. </el-col>
  274. </el-row>
  275. <el-row>
  276. <el-col :span="12">
  277. <el-form-item :label="$t('培训内容')" prop="content">
  278. <el-input
  279. v-model="form.content"
  280. type="textarea"
  281. :rows="3"
  282. :placeholder="$t('请输入') + $t('培训内容')"
  283. />
  284. </el-form-item>
  285. </el-col>
  286. <el-col :span="12">
  287. <el-form-item :label="$t('课程代码')" prop="courseid">
  288. <el-input v-model="form.courseid" :placeholder="$t('请输入') + $t('课程代码')" />
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. <el-row>
  293. <el-col :span="12">
  294. <el-form-item :label="$t('培训周期')" prop="period">
  295. <el-input v-model="form.period" :placeholder="$t('请输入') + $t('培训周期')" />
  296. </el-form-item>
  297. </el-col>
  298. <el-col :span="12">
  299. <el-form-item :label="$t('课时')" prop="duration">
  300. <el-input v-model="form.duration" :placeholder="$t('请输入') + $t('课时')" />
  301. </el-form-item>
  302. </el-col>
  303. </el-row>
  304. <el-row>
  305. <el-col :span="12">
  306. <el-form-item :label="$t('培训人')" prop="trainer">
  307. <el-select v-model="form.trainer" filterable multiple :placeholder="$t('请选择') + $t('培训人')">
  308. <el-option
  309. v-for="dict in stffmgrOptions"
  310. :key="dict.staffid"
  311. :label="dict.name"
  312. :value="dict.staffid">
  313. <span style="float: left">{{ dict.name }}</span>
  314. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.staffid }}</span>
  315. </el-option>
  316. </el-select>
  317. </el-form-item>
  318. </el-col>
  319. <el-col :span="12">
  320. <el-form-item :label="$t('培训岗位')" prop="position">
  321. <el-select v-model="form.position" multiple :placeholder="$t('请选择') + $t('培训岗位')" @change="changePosition" style="width: 400px">
  322. <el-option
  323. v-for="dict in positionOptions"
  324. :key="dict.dictValue"
  325. :label="dict.dictLabel"
  326. :value="dict.dictValue"
  327. ></el-option>
  328. </el-select>
  329. </el-form-item>
  330. </el-col>
  331. </el-row>
  332. <el-row>
  333. <el-col :span="12">
  334. </el-col>
  335. </el-row>
  336. <el-row>
  337. <el-col :span="12">
  338. <el-form-item :label="$t('年份')" prop="years">
  339. <el-date-picker clearable size="small" style="width: 200px"
  340. v-model="form.years"
  341. type="year"
  342. value-format="yyyy"
  343. @change="handleStaff"
  344. :placeholder="$t('请选择') + $t('年份')">
  345. </el-date-picker>
  346. </el-form-item>
  347. </el-col>
  348. <el-col :span="12">
  349. <el-form-item label="应学习时长(分)" prop="timerNeed" >
  350. <el-input-number v-model="form.timerNeed" placeholder="请输入应学习时长" style="width: 200px"/>
  351. </el-form-item>
  352. </el-col>
  353. </el-row>
  354. <el-row>
  355. <el-col :span="12">
  356. <el-form-item :label="$t('培训开始日期')" prop="courseStartdate">
  357. <el-date-picker clearable size="small" style="width: 200px"
  358. v-model="form.courseStartdate"
  359. type="date"
  360. value-format="yyyy-MM-dd"
  361. :placeholder="$t('请选择') + $t('培训开始日期')">
  362. </el-date-picker>
  363. </el-form-item>
  364. </el-col>
  365. <el-col :span="12">
  366. </el-col>
  367. </el-row>
  368. <el-row>
  369. <el-col :span="12">
  370. <el-form-item :label="$t('培训结束日期')" prop="courseEnddate">
  371. <el-date-picker clearable size="small" style="width: 200px"
  372. v-model="form.courseEnddate"
  373. type="date"
  374. value-format="yyyy-MM-dd"
  375. :placeholder="$t('请选择') + $t('培训结束日期')">
  376. </el-date-picker>
  377. </el-form-item >
  378. </el-col>
  379. <el-col :span="12">
  380. <el-form-item :label="$t('是否完成')" prop="isfinish">
  381. <el-select v-model="form.isfinish" :placeholder="$t('请选择') + $t('是否完成')">
  382. <el-option
  383. v-for="dict in isfinishOptions"
  384. :key="dict.dictValue"
  385. :label="dict.dictLabel"
  386. :value="parseInt(dict.dictValue)"
  387. ></el-option>
  388. </el-select>
  389. </el-form-item>
  390. </el-col>
  391. </el-row>
  392. <el-row>
  393. <el-col :span="12">
  394. <el-form-item label="培训考试" prop="examId">
  395. <el-select v-model="form.examId" filterable :placeholder="$t('请选择') + $t('培训考试')">
  396. <el-option
  397. v-for="dict in examOptions"
  398. :key="dict.examId"
  399. :label="dict.title"
  400. :value="dict.examId">
  401. </el-option>
  402. </el-select>
  403. </el-form-item>
  404. </el-col>
  405. <el-col :span="12">
  406. <el-form-item :label="$t('备注')" prop="remarks">
  407. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  408. </el-form-item>
  409. </el-col>
  410. </el-row>
  411. </el-form>
  412. <div slot="footer" class="dialog-footer">
  413. <el-button type="primary" @click="submitForm" :disabled="submitDisabled">{{ $t('确 定') }}</el-button>
  414. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  415. </div>
  416. </el-dialog>
  417. <!-- 添加参与公司级培训人员名单对话框 -->
  418. <el-dialog :close-on-click-modal="false" v-dialogDrag title="培训人员名单" :visible.sync="personOpen" width="1500px" append-to-body>
  419. <el-form ref="personForm" :model="personForm" label-width="80px">
  420. <el-form-item :label="$t('课程名称')" prop="item">
  421. <el-input v-model="personForm.course" disabled />
  422. </el-form-item>
  423. <el-form-item :label="$t('实际岗位')">
  424. <el-checkbox-group v-model="checkboxPost" size="medium" @change="postChange">
  425. <el-checkbox-button v-for="post in positionOptions" :label="post.dictValue" :key="post.dictValue">{{post.dictLabel}}</el-checkbox-button>
  426. </el-checkbox-group>
  427. </el-form-item>
  428. </el-form>
  429. <div class="staff_checked">
  430. <el-transfer v-model="checked" :data="selectPersonOptions" @change="staffChange" :left-default-checked="leftList" filterable
  431. :titles="['无需参培人员', '需要参培人员']"
  432. >
  433. <span slot-scope="{ option }">{{ option.label }}
  434. <span style="float: right; color: #8492a6; font-size: 12px; padding-left: 10px;padding-right: 15px;">{{ option.staffid }}</span>
  435. <span style="float: right; color: #8492a6; font-size: 12px; padding-left: 10px;">{{ option.actualpost }}</span>
  436. </span>
  437. </el-transfer>
  438. </div>
  439. <div slot="footer" class="dialog-footer">
  440. <el-button type="primary" @click="submitParticipants">{{ $t('确 定') }}</el-button>
  441. <el-button @click="cancelParticipants">{{ $t('取 消') }}</el-button>
  442. </div>
  443. </el-dialog>
  444. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px"
  445. append-to-body>
  446. <el-upload
  447. ref="doc"
  448. :limit="50"
  449. :headers="doc.headers"
  450. :action="doc.url+'/'+doc.id"
  451. :disabled="doc.isUploading"
  452. :on-progress="handleFileDocProgress"
  453. :on-success="handleFileDocSuccess"
  454. :file-list="doc.file"
  455. :auto-upload="true"
  456. drag
  457. >
  458. <i class="el-icon-upload"></i>
  459. <div class="el-upload__text">
  460. {{ $t('将文件拖到此处,或') }}
  461. <em>{{ $t('点击上传') }}</em>
  462. </div>
  463. </el-upload>
  464. <el-table :data="doc.commonfileList" border>
  465. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  466. <template slot-scope="scope">
  467. <a class="link-type" @click="handleDownload(scope.row)">
  468. <span>{{ scope.row.fileName }}</span>
  469. </a>
  470. </template>
  471. </el-table-column>
  472. <!-- <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true"-->
  473. <!-- width="80"/>-->
  474. <!-- <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>-->
  475. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  476. <template slot-scope="scope">
  477. <el-button
  478. v-if="scope.row.fileName!=null&&scope.row.fileName.endsWith('pdf')"
  479. size="mini"
  480. type="text"
  481. icon="el-icon-view"
  482. @click="handleSee(scope.row)"
  483. >{{ $t('预览') }}
  484. </el-button>
  485. <el-button v-hasPermi="['training:trainingrecords:file']" type="text" size="small" v-if="scope.row.isEdit"
  486. @click="save(scope.row)">保存
  487. </el-button>
  488. <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">
  489. 取消
  490. </el-button>
  491. <el-button
  492. size="mini"
  493. type="text"
  494. icon="el-icon-download"
  495. @click="handleDownload(scope.row)"
  496. >{{ $t('下载') }}
  497. </el-button>
  498. <el-button
  499. size="mini"
  500. type="text"
  501. icon="el-icon-delete"
  502. @click="handleDeleteDoc(scope.row)"
  503. v-hasPermi="['training:trainingrecords:file']"
  504. >{{ $t('删除') }}
  505. </el-button>
  506. </template>
  507. </el-table-column>
  508. </el-table>
  509. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px"
  510. append-to-body>
  511. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  512. <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
  513. </div>
  514. <div style="margin-top: -30px">
  515. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  516. </div>
  517. </el-dialog>
  518. <div slot="footer" class="dialog-footer">
  519. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  520. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  521. </div>
  522. </el-dialog>
  523. </div>
  524. </template>
  525. <script>
  526. import {
  527. addTrainingbcc,
  528. delTrainingbcc,
  529. exportTrainingbcc,
  530. exportTrainingbccSign,
  531. getTrainingbcc,
  532. getTrainingbccStaffIds,
  533. listTrainingbcc,
  534. updateTrainingbcc,
  535. updateTrainingbccStaffIds
  536. } from "@/api/training/trainingbcc";
  537. import nonAdd from './trainingNon'
  538. import newAdd from './trainingNew'
  539. import {listAllStaffmgr, listStaffmgr, listStaffmgrAll, selectTimeStaffmgr} from "@/api/plant/staffmgr";
  540. import {treeselect} from "@/api/system/dept";
  541. import {getToken} from "@/utils/auth";
  542. import Treeselect from "@riophae/vue-treeselect";
  543. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  544. import {listExam} from "@/api/training/elearn/exam";
  545. import _ from 'lodash';
  546. export default {
  547. name: "Training",
  548. components: { Treeselect, nonAdd, newAdd},
  549. data() {
  550. return {
  551. // 遮罩层
  552. loading: true,
  553. positionVisible: false,
  554. showFlag: false,
  555. //确认按钮是否可点
  556. submitDisabled: false,
  557. //左侧选框默认选择
  558. leftList: [],
  559. // 选中数组
  560. ids: [],
  561. //人员筛选按钮选择数据
  562. checkboxPost: [],
  563. // 非单个禁用
  564. single: true,
  565. // 非多个禁用
  566. multiple: true,
  567. // 显示搜索条件
  568. showSearch: false,
  569. // 总条数
  570. total: 0,
  571. // 培训计划表格数据
  572. trainingList: [],
  573. positionIds: [],
  574. trainers: [],
  575. units: [],
  576. nonParticipants: [],
  577. // 弹出层标题
  578. title: "",
  579. // 部门树选项
  580. deptOptions: undefined,
  581. clientHeight:300,
  582. // 是否显示弹出层
  583. open: false,
  584. personOpen: false,
  585. // 装置名称字典
  586. plantCodeOptions: [],
  587. // 部门字典
  588. unitOptions: [],
  589. examOptions: [],
  590. // 培训岗位字典
  591. positionOptions: [],
  592. //选择人员数据
  593. checked: [],
  594. trainingTypeOptions: [],
  595. // 是否完成字典
  596. isfinishOptions: [],
  597. // 指定岗位字典
  598. designatedPositionOptions: [],
  599. //指定人员岗位多选
  600. designatedPositions: [],
  601. //指定人员id多选
  602. designatedStaffs: [],
  603. selectPersonOptions: [],
  604. //是否存在岗位多选
  605. haveDesignated: '',
  606. //人员表联查
  607. stffmgrOptions: undefined,
  608. //人员表联查-包含离职
  609. stffmgrAllOptions: undefined,
  610. //指定人员选项
  611. designatedStaffsOptions: [],
  612. // 用户导入参数
  613. upload: {
  614. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  615. //下载模板类型
  616. type: "training",
  617. // 是否显示弹出层(用户导入)
  618. open: false,
  619. // 弹出层标题(用户导入)
  620. title: "",
  621. // 是否禁用上传
  622. isUploading: false,
  623. // 是否更新已经存在的用户数据
  624. updateSupport: 0,
  625. // 设置上传的请求头部
  626. headers: { Authorization: "Bearer " + getToken() },
  627. // 上传的地址
  628. url: process.env.VUE_APP_BASE_API + "/training/training/importData"
  629. },
  630. //未参会人员弹窗是否打开
  631. nonVisible: false,
  632. //新员工弹窗是否打开
  633. newVisible: false,
  634. // 报告附件参数
  635. doc: {
  636. file: "",
  637. // 是否显示弹出层(报告附件)
  638. open: false,
  639. // 弹出层标题(报告附件)
  640. title: "",
  641. // 是否禁用上传
  642. isUploading: false,
  643. // 是否更新已经存在的用户数据
  644. updateSupport: 0,
  645. // 报告附件上传位置编号
  646. ids: 0,
  647. // 设置上传的请求头部
  648. headers: { Authorization: "Bearer " + getToken() },
  649. // 上传的地址
  650. url: process.env.VUE_APP_BASE_API + "/training/trainingbcc/uploadFile",
  651. commonfileList: null,
  652. queryParams: {
  653. pId: null,
  654. pType: 'trainingbcc'
  655. },
  656. pType: 'trainingbcc',
  657. pId: null
  658. },
  659. pdf : {
  660. title: '',
  661. pdfUrl: '',
  662. numPages: null,
  663. open: false,
  664. pageNum: 1,
  665. pageTotalNum: 1,
  666. loadedRatio: 0,
  667. },
  668. pic: {
  669. imageUrl: '',
  670. fileList: [],
  671. // 设置上传的请求头部
  672. headers: { Authorization: "Bearer " + getToken() },
  673. // 上传的地址
  674. url: process.env.VUE_APP_BASE_API + "/training/training/uploadFile",
  675. },
  676. photoList: [],
  677. dialogImageUrl: '',
  678. dialogVisible: false,
  679. // 查询参数
  680. queryParams: {
  681. pageNum: 1,
  682. pageSize: 20,
  683. course: null,
  684. position: [],
  685. years: this.getNowTime(),
  686. isfinish: null,
  687. startDate: null,
  688. endDate: null,
  689. trainingType: null,
  690. isNon: null,
  691. },
  692. trainingId: null,
  693. //地址
  694. downloadAction: process.env.VUE_APP_BASE_API + '/training/training/trainingReport',
  695. //人员表查询参数
  696. staffmgrQueryParams: {},
  697. searchStaffmgr: "",
  698. //日期快速选择
  699. pickerOptions: {
  700. shortcuts: [{
  701. text: this.$t('最近一周'),
  702. onClick(picker) {
  703. const end = new Date();
  704. const start = new Date();
  705. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  706. picker.$emit('pick', [start, end]);
  707. }
  708. }, {
  709. text: this.$t('最近一个月'),
  710. onClick(picker) {
  711. const end = new Date();
  712. const start = new Date();
  713. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  714. picker.$emit('pick', [start, end]);
  715. }
  716. }, {
  717. text: this.$t('最近三个月'),
  718. onClick(picker) {
  719. const end = new Date();
  720. const start = new Date();
  721. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  722. picker.$emit('pick', [start, end]);
  723. }
  724. }]
  725. },
  726. //日期选择器
  727. chooseDate: [],
  728. // 表单参数
  729. form: {},
  730. personForm: {},
  731. // 表单校验
  732. rules: {
  733. course: [
  734. { required: true, message: this.$t('培训课程') + this.$t('不能为空'), trigger: "blur" }
  735. ],
  736. trainingType: [
  737. { required: true, message: this.$t('培训类型') + this.$t('不能为空'), trigger: "blur" }
  738. ],
  739. trainer: [
  740. { required: true, message: this.$t('培训人') + this.$t('不能为空'), trigger: "blur" }
  741. ],
  742. position: [
  743. { required: true, message: this.$t('培训岗位') + this.$t('不能为空'), trigger: "blur" }
  744. ],
  745. years: [
  746. { required: true, message: this.$t('年份') + this.$t('不能为空'), trigger: "blur" }
  747. ],
  748. courseStartdate: [
  749. { required: true, message: this.$t('培训开始日期') + this.$t('不能为空'), trigger: "blur" }
  750. ],
  751. courseEnddate: [
  752. { required: true, message: this.$t('培训结束日期') + this.$t('不能为空'), trigger: "blur" }
  753. ],
  754. isfinish: [
  755. { required: true, message: this.$t('是否完成') + this.$t('不能为空'), trigger: "blur" }
  756. ],
  757. deptId: [
  758. { required: true, message: this.$t('部门编号') + this.$t('不能为空'), trigger: "blur" }
  759. ]
  760. }
  761. };
  762. },
  763. watch: {
  764. // 根据名称筛选部门树
  765. deptName(val) {
  766. this.$refs.tree.filter(val);
  767. },
  768. },
  769. created() {
  770. const queryName = this.$route.query && this.$route.query.status;
  771. if (queryName == '未参培'){
  772. this.queryParams.isNon = "1"
  773. }
  774. if (queryName == '已完成'){
  775. this.queryParams.isNon = "2"
  776. }
  777. if (queryName == '未完成'){
  778. this.queryParams.isNon = "3"
  779. }
  780. this.getStaffmar();
  781. this.getStaffmarAll();
  782. listExam({ pageNum: 1, pageSize: 1000, examType: 2 }).then(response => {
  783. this.examOptions = response.rows;
  784. });
  785. //设置表格高度对应屏幕高度
  786. this.$nextTick(() => {
  787. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  788. })
  789. this.getTreeselect();
  790. this.getDicts("PLANT_DIVIDE").then(response => {
  791. this.plantCodeOptions = response.data;
  792. });
  793. this.getDicts("ACTUALPOST").then(response => {
  794. this.positionOptions = response.data;
  795. this.designatedPositionOptions = response.data;
  796. const allData = response.data
  797. const data = [];
  798. for (let i = 0; i < allData.length; i++) {
  799. data.push({
  800. key: allData[i].dictValue,
  801. label: allData[i].dictLabel,
  802. });
  803. }
  804. this.positionOpt = response.data;
  805. });
  806. this.getDicts("YES_NO_EN").then(response => {
  807. this.isfinishOptions = response.data;
  808. });
  809. this.getDicts("STAFF_UNIT").then(response => {
  810. this.unitOptions = response.data;
  811. });
  812. this.getDicts("TRAINING_TYPE_BCC").then(response => {
  813. this.trainingTypeOptions = response.data;
  814. });
  815. },
  816. methods: {
  817. /** 查询培训计划列表 */
  818. getList() {
  819. let _this = this
  820. this.loading = true;
  821. listTrainingbcc(this.queryParams).then(response => {
  822. this.trainingList = response.rows;
  823. this.trainingList.forEach(function (value,key,arr) {
  824. var positionid = null;
  825. var positionName = null;
  826. let unitid = null;
  827. let unitName = null;
  828. if (value.position != null) {
  829. positionid = value.position.split(',');
  830. positionid.forEach(function (value, key, arr) {
  831. if (key != 0) {
  832. positionName = positionName + "," + _this.selectDictLabel(_this.positionOptions, value);
  833. }else if (key == 0) {
  834. positionName = _this.selectDictLabel(_this.positionOptions, value);
  835. }
  836. })
  837. }
  838. if (value.unit != null) {
  839. unitid = value.unit.split(',');
  840. unitid.forEach(function (value, key, arr) {
  841. if (key != 0) {
  842. unitName = unitName + "," + _this.selectDictLabel(_this.unitOptions, value);
  843. }else if (key == 0) {
  844. unitName = _this.selectDictLabel(_this.unitOptions, value);
  845. }
  846. })
  847. }
  848. _this.trainingList[key].positionid = value.position;
  849. _this.trainingList[key].position = positionName;
  850. _this.trainingList[key].unitid = value.unit;
  851. _this.trainingList[key].unit = unitName;
  852. var parentName = null;
  853. if (value.trainer != null) {
  854. let staffId = value.trainer.split(",");
  855. staffId.forEach(function (id, index) {
  856. _this.stffmgrAllOptions.forEach(function (item) {
  857. if (item.staffid === id) {
  858. if (index === 0) {
  859. parentName = item.name
  860. }else {
  861. parentName = parentName + "," + item.name
  862. }
  863. }
  864. });
  865. });
  866. }
  867. _this.trainingList[key].trainer = parentName;
  868. })
  869. this.total = response.total;
  870. this.loading = false;
  871. });
  872. },
  873. /** 获取当前年份 */
  874. getNowTime() {
  875. var now = new Date();
  876. var year = now.getFullYear(); //得到年份
  877. var defaultDate = `${year}`;
  878. defaultDate = `${year}`
  879. return defaultDate;
  880. },
  881. closeChildDialog () {
  882. this.showFlag = false
  883. this.getList();
  884. },
  885. /** 查询部门下拉树结构 */
  886. getTreeselect() {
  887. treeselect().then(response => {
  888. this.deptOptions = response.data;
  889. });
  890. },
  891. // 装置名称字典翻译
  892. plantCodeFormat(row, column) {
  893. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  894. },
  895. // 部门字典翻译
  896. unitFormat(row, column) {
  897. return this.selectDictLabel(this.unitOptions, row.unit);
  898. },
  899. // 培训类型翻译
  900. trainingTypeFormat(row, column) {
  901. return this.selectDictLabel(this.trainingTypeOptions, row.trainingType);
  902. },
  903. // 培训岗位字典翻译
  904. positionFormat(row, column) {
  905. return this.selectDictLabel(this.positionOptions, row.position);
  906. },
  907. // 是否完成字典翻译
  908. isfinishFormat(row, column) {
  909. return this.selectDictLabel(this.isfinishOptions, row.isfinish);
  910. },
  911. //获取人员表
  912. getStaffmar(year) {
  913. this.staffmgrQueryParams.leftYear = year
  914. listAllStaffmgr(this.staffmgrQueryParams).then(response => {
  915. this.stffmgrOptions = response.rows;
  916. //
  917. const allData = response.rows
  918. const data = [];
  919. for (let i = 0; i < allData.length; i++) {
  920. data.push({
  921. key: allData[i].staffid,
  922. label: allData[i].name,
  923. staffid: allData[i].staffid,
  924. actualpost: this.selectDictLabel(this.positionOptions, allData[i].actualpost)
  925. });
  926. }
  927. this.selectPersonOptions = data;
  928. });
  929. },
  930. //年份选择change事件
  931. handleStaff(val){
  932. this.getStaffmar(val)
  933. },
  934. //获取人员表--包含离职
  935. getStaffmarAll() {
  936. listStaffmgrAll(this.staffmgrQueryParams).then(response => {
  937. this.stffmgrAllOptions = response.rows;
  938. this.getList();
  939. });
  940. },
  941. //遍历人员表
  942. forEachStaffmar(id) {
  943. let stffmgrName = "";
  944. this.stffmgrOptions.forEach(function (item) {
  945. if (item.staffid === id) {
  946. stffmgrName = item.name
  947. }
  948. });
  949. return stffmgrName
  950. },
  951. // 取消按钮
  952. cancel() {
  953. this.open = false;
  954. this.reset();
  955. },
  956. // 表单重置
  957. reset() {
  958. this.form = {
  959. id: null,
  960. plantCode: null,
  961. course: null,
  962. courseid: null,
  963. period: null,
  964. duration: null,
  965. trainer: null,
  966. positionId: [],
  967. position: null,
  968. content: null,
  969. unit : null,
  970. years: null,
  971. courseStartdate: null,
  972. courseEnddate: null,
  973. isfinish: null,
  974. delFlag: null,
  975. createrCode: null,
  976. createdate: null,
  977. updaterCode: null,
  978. updatedate: null,
  979. remarks: null,
  980. deptId: null,
  981. startDate: null,
  982. endDate: null,
  983. nonParticipants: null,
  984. trainingType: null,
  985. picUrl: null,
  986. mustTraining: null,
  987. haveTraining: null
  988. };
  989. this.resetForm("form");
  990. },
  991. /** 搜索按钮操作 */
  992. handleQuery() {
  993. this.queryParams.pageNum = 1;
  994. this.queryParams.startDate = this.chooseDate[0];
  995. this.queryParams.endDate = this.chooseDate[1];
  996. this.getList();
  997. },
  998. /** 重置按钮操作 */
  999. resetQuery() {
  1000. this.resetForm("queryForm");
  1001. this.chooseDate = "";
  1002. this.handleQuery();
  1003. },
  1004. // 多选框选中数据
  1005. handleSelectionChange(selection) {
  1006. this.ids = selection.map(item => item.id)
  1007. this.single = selection.length!==1
  1008. this.multiple = !selection.length
  1009. },
  1010. //根据分数显示颜色提示
  1011. tableCellStyle({ row, column, rowIndex, columnIndex }) {
  1012. if (columnIndex == 6 && row.isfinish == 0){
  1013. return "color: rgba(255, 26, 26, 0.98) "
  1014. }
  1015. },
  1016. //培训岗位变动
  1017. changePosition() {
  1018. let _this = this
  1019. this.getDicts("ACTUALPOST").then(response => {
  1020. this.designatedPositionOptions = response.data;
  1021. this.form.position.forEach(function (value, key, arr) {
  1022. _this.designatedPositionOptions.forEach(function (positionValue, positionkey, arr) {
  1023. if (positionValue.dictValue === value) {
  1024. _this.designatedPositionOptions.splice(positionkey ,1)
  1025. }
  1026. })
  1027. })
  1028. });
  1029. },
  1030. //指定人员训岗位变动
  1031. changeDesignated() {
  1032. if (this.designatedPositions.length > 0) {
  1033. var designatedId = null;
  1034. this.designatedPositions.forEach(function (value,key,arr) {
  1035. if (key != 0) {
  1036. designatedId = designatedId + "," + value;
  1037. }else if (key == 0) {
  1038. designatedId = value;
  1039. }
  1040. })
  1041. this.staffmgrQueryParams.actualposts = designatedId;
  1042. listStaffmgr(this.staffmgrQueryParams).then(response => {
  1043. this.designatedStaffsOptions = response.rows;
  1044. });
  1045. let _this = this
  1046. this.getDicts("ACTUALPOST").then(response => {
  1047. this.positionOptions = response.data;
  1048. this.designatedPositions.forEach(function (value, key, arr) {
  1049. _this.positionOptions.forEach(function (positionValue, positionkey, arr) {
  1050. if (positionValue.dictValue === value) {
  1051. _this.positionOptions.splice(positionkey ,1)
  1052. }
  1053. })
  1054. })
  1055. });
  1056. }else {
  1057. this.designatedStaffs = [];
  1058. }
  1059. },
  1060. //指定人员按钮变动
  1061. changeHave() {
  1062. if (this.haveDesignated === false) {
  1063. this.designatedPositions = []
  1064. this.designatedStaffs = []
  1065. }
  1066. },
  1067. /** 新增按钮操作 */
  1068. handleAdd() {
  1069. this.reset();
  1070. this.open = true;
  1071. this.submitDisabled = false;
  1072. this.haveDesignated = false;
  1073. this.designatedPositions = [];
  1074. this.getDicts("ACTUALPOST").then(response => {
  1075. this.positionOptions = response.data;
  1076. });
  1077. this.getDicts("ACTUALPOST").then(response => {
  1078. this.designatedPositionOptions = response.data;
  1079. });
  1080. this.form.trainingType = this.queryParams.trainingType
  1081. this.title = this.$t('新增') + this.$t('空格') + this.$t('培训计划');
  1082. this.getStaffmar()
  1083. },
  1084. /** 修改按钮操作 */
  1085. handleUpdate(row) {
  1086. this.reset();
  1087. let _this = this
  1088. this.submitDisabled = false;
  1089. const id = row.id || this.ids
  1090. getTrainingbcc(id).then(response => {
  1091. this.form = response.data;
  1092. this.getStaffmar(response.data.years)
  1093. if (this.form.position != null) {
  1094. this.form.position = this.form.position.split(',');
  1095. this.getDicts("ACTUALPOST").then(response => {
  1096. this.designatedPositionOptions = response.data;
  1097. this.form.position.forEach(function (value, key, arr) {
  1098. _this.designatedPositionOptions.forEach(function (positionValue, positionkey, arr) {
  1099. if (positionValue.dictValue === value) {
  1100. _this.designatedPositionOptions.splice(positionkey ,1)
  1101. }
  1102. })
  1103. })
  1104. })
  1105. }else {
  1106. this.getDicts("ACTUALPOST").then(response => {
  1107. this.designatedPositionOptions = response.data;
  1108. })
  1109. this.form.position = [];
  1110. }
  1111. if (this.form.designatedPosition != null) {
  1112. this.designatedPositions = this.form.designatedPosition.split(',');
  1113. this.getDicts("ACTUALPOST").then(response => {
  1114. this.positionOptions = response.data;
  1115. this.designatedPositions.forEach(function (value, key, arr) {
  1116. _this.positionOptions.forEach(function (positionValue, positionkey, arr) {
  1117. if (positionValue.dictValue === value) {
  1118. _this.positionOptions.splice(positionkey ,1)
  1119. }
  1120. })
  1121. })
  1122. });
  1123. this.haveDesignated = true;
  1124. var designatedId = null;
  1125. this.designatedPositions.forEach(function (value,key,arr) {
  1126. if (key != 0) {
  1127. designatedId = designatedId + "," + value;
  1128. }else if (key == 0) {
  1129. designatedId = value;
  1130. }
  1131. })
  1132. this.staffmgrQueryParams.actualposts = designatedId;
  1133. this.$nextTick(() => {
  1134. listAllStaffmgr(this.staffmgrQueryParams).then(response => {
  1135. this.designatedStaffsOptions = response.rows;
  1136. });
  1137. })
  1138. }else {
  1139. this.haveDesignated = false;
  1140. this.designatedPositions = [];
  1141. this.getDicts("ACTUALPOST").then(response => {
  1142. this.positionOptions = response.data;
  1143. })
  1144. }
  1145. if (this.form.designatedStaff != null) {
  1146. this.designatedStaffs = this.form.designatedStaff.split(',');
  1147. }else {
  1148. this.designatedStaffs = [];
  1149. }
  1150. if (this.form.unit != null) {
  1151. this.form.unit = this.form.unit.split(',');
  1152. /*this.changeUnit(this.form.unit)*/
  1153. }else {
  1154. this.form.unit = [];
  1155. }
  1156. if (this.form.nonParticipants != null) {
  1157. this.nonParticipants = this.form.nonParticipants.split(",");
  1158. }
  1159. if (this.form.picUrl!= null){
  1160. this.photoList =[]
  1161. let fileList = this.form.picUrl.split(",")
  1162. for (let i = 0; i < fileList.length; i++) {
  1163. let item = {url: process.env.VUE_APP_BASE_API +fileList[i],response: {msg: fileList[i]} }
  1164. this.photoList.push(item)
  1165. }
  1166. }
  1167. if (this.form.trainer != null) {
  1168. this.form.trainer = this.form.trainer.split(',');
  1169. }else {
  1170. this.form.trainer = [];
  1171. }
  1172. this.open = true;
  1173. this.title = this.$t('修改') + this.$t('培训计划');
  1174. });
  1175. },
  1176. /** 提交按钮 */
  1177. submitForm() {
  1178. this.submitDisabled = true;
  1179. this.$refs["form"].validate(valid => {
  1180. if (valid) {
  1181. var trainerId = null;
  1182. this.form.trainer.forEach(function (value,key,arr) {
  1183. if (key != 0) {
  1184. trainerId = trainerId + "," + value;
  1185. }else if (key == 0) {
  1186. trainerId = value;
  1187. }
  1188. })
  1189. var id = null;
  1190. this.form.position.forEach(function (value,key,arr) {
  1191. if (key != 0) {
  1192. id = id + "," + value;
  1193. }else if (key == 0) {
  1194. id = value;
  1195. }
  1196. })
  1197. var designatedId = null;
  1198. this.designatedPositions.forEach(function (value,key,arr) {
  1199. if (key != 0) {
  1200. designatedId = designatedId + "," + value;
  1201. }else if (key == 0) {
  1202. designatedId = value;
  1203. }
  1204. })
  1205. this.form.designatedPosition = designatedId;
  1206. var staffId = null;
  1207. this.designatedStaffs.forEach(function (value,key,arr) {
  1208. if (key != 0) {
  1209. staffId = staffId + "," + value;
  1210. }else if (key == 0) {
  1211. staffId = value;
  1212. }
  1213. })
  1214. this.form.designatedStaff = staffId;
  1215. var u = null;
  1216. if (this.form.unit){
  1217. this.form.unit.forEach(function (value,key,arr) {
  1218. if (key != 0) {
  1219. u = u + "," + value;
  1220. }else if (key == 0) {
  1221. u = value;
  1222. }
  1223. })
  1224. }
  1225. var parentId = null;
  1226. this.nonParticipants.forEach(function (value,key,arr) {
  1227. if (key != 0) {
  1228. parentId = parentId + "," + value;
  1229. }else if (key == 0) {
  1230. parentId = value;
  1231. }
  1232. })
  1233. this.form.trainer = trainerId;
  1234. this.form.position = id;
  1235. this.form.unit = u;
  1236. // this.form.nonParticipants = parentId;
  1237. if (this.form.id != null) {
  1238. updateTrainingbcc(this.form).then(response => {
  1239. this.msgSuccess(this.$t('修改成功'));
  1240. this.open = false;
  1241. this.submitDisabled = false;
  1242. this.getList();
  1243. });
  1244. } else {
  1245. addTrainingbcc(this.form).then(response => {
  1246. this.msgSuccess(this.$t('新增成功'));
  1247. this.open = false;
  1248. this.submitDisabled = false;
  1249. this.getList();
  1250. });
  1251. }
  1252. } else {
  1253. this.submitDisabled = false;
  1254. }
  1255. });
  1256. },
  1257. /** 删除按钮操作 */
  1258. handleDelete(row) {
  1259. const ids = row.id || this.ids;
  1260. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  1261. confirmButtonText: this.$t('确定'),
  1262. cancelButtonText: this.$t('取消'),
  1263. type: "warning"
  1264. }).then(function() {
  1265. return delTrainingbcc(ids);
  1266. }).then(() => {
  1267. this.getList();
  1268. this.msgSuccess(this.$t('删除成功'));
  1269. })
  1270. },
  1271. /** 导出按钮操作 */
  1272. handleExport() {
  1273. const queryParams = this.queryParams;
  1274. this.$confirm(this.$t('是否确认导出所有培训计划数据项?'), this.$t('警告'), {
  1275. confirmButtonText: this.$t('确定'),
  1276. cancelButtonText: this.$t('取消'),
  1277. type: "warning"
  1278. }).then(function() {
  1279. return exportTrainingbcc(queryParams);
  1280. }).then(response => {
  1281. this.download(response.msg);
  1282. })
  1283. },
  1284. /** 参会人员名单按钮操作 */
  1285. handleStaffmgr(row) {
  1286. this.leftList = [];
  1287. const id = row.id || this.ids
  1288. getTrainingbccStaffIds(id).then(response => {
  1289. this.personForm = response.data;
  1290. if (response.data.staffIds != null) {
  1291. this.checked = response.data.staffIds.split(",");
  1292. }else {
  1293. this.checked = [];
  1294. }
  1295. this.personOpen = true;
  1296. });
  1297. },
  1298. handleDetail(row){
  1299. this.$router.push({ name: 'deviceList', params: { id: row.id }})
  1300. },
  1301. handleExportSign(row) {
  1302. this.$confirm('是否确认导出签名表?', "警告", {
  1303. confirmButtonText: "确定",
  1304. cancelButtonText: "取消",
  1305. type: "warning"
  1306. }).then(function () {
  1307. return exportTrainingbccSign({id:row.id});
  1308. }).then(response => {
  1309. window.open(process.env.VUE_APP_BASE_API + response.msg);
  1310. })
  1311. },
  1312. //岗位筛选变动
  1313. postChange() {
  1314. this.submitDebounced();
  1315. },
  1316. submitDebounced: _.debounce(function() {
  1317. this.leftList = [];
  1318. if (this.checkboxPost.length > 0) {
  1319. this.staffmgrQueryParams.actualposts = this.checkboxPost.toString();
  1320. this.$nextTick(() => {
  1321. selectTimeStaffmgr(this.staffmgrQueryParams).then(response => {
  1322. const allData = response.rows
  1323. const data = [];
  1324. for (let i = 0; i < allData.length; i++) {
  1325. data[i] = allData[i].staffid
  1326. }
  1327. this.leftList = data;
  1328. })
  1329. })
  1330. }
  1331. }, 500), // 300 毫秒内没有更多的点击时,提交最终数据
  1332. //选择参会人员变动
  1333. staffChange() {
  1334. this.personForm.staffIds = this.checked.toString()
  1335. },
  1336. selectCourse(val) {
  1337. this.queryParams.trainingType = val
  1338. this.handleQuery()
  1339. },
  1340. /** 参会人员提交按钮 */
  1341. submitParticipants() {
  1342. this.$refs["personForm"].validate(valid => {
  1343. if (valid) {
  1344. updateTrainingbccStaffIds(this.personForm).then(response => {
  1345. this.msgSuccess(this.$t('修改成功'));
  1346. this.personOpen = false;
  1347. this.checkboxPost = [];
  1348. this.getList();
  1349. });
  1350. }
  1351. });
  1352. },
  1353. // 选择参会人员取消按钮
  1354. cancelParticipants() {
  1355. this.personOpen = false;
  1356. this.reset();
  1357. },
  1358. handleDoc(row) {
  1359. this.doc.file = null;
  1360. this.doc.commonfileList = [];
  1361. this.doc.open = true;
  1362. this.doc.id = row.id;
  1363. getTrainingbcc(row.id).then(res => {
  1364. if (res.data.fileUrl != null)
  1365. this.doc.commonfileList.push({fileUrl: res.data.fileUrl, fileName: res.data.fileName, id: res.data.id})
  1366. })
  1367. this.$nextTick(() => {
  1368. this.$refs.doc.clearFiles()
  1369. })
  1370. },
  1371. // 上传中处理
  1372. handleFileDocProgress(event, file, fileList) {
  1373. this.doc.file = file;
  1374. this.doc.isUploading = true;
  1375. },
  1376. //附件上传成功处理
  1377. handleFileDocSuccess(response, file, fileList) {
  1378. this.doc.isUploading = false;
  1379. this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  1380. this.getList();
  1381. this.doc.commonfileList = [];
  1382. getTrainingbcc(response.data).then(res => {
  1383. if (res.data.fileUrl != null) {
  1384. this.doc.commonfileList.push({fileUrl: res.data.fileUrl, fileName: res.data.fileName, id: res.data.id})
  1385. }
  1386. })
  1387. },
  1388. openPdf() {
  1389. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  1390. },
  1391. handleSee(row) {
  1392. // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
  1393. this.pdf.open = true
  1394. this.pdf.title = row.fileName
  1395. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  1396. },
  1397. // 文件下载处理
  1398. handleDownload(row) {
  1399. var name = row.fileName;
  1400. var url = row.fileUrl;
  1401. var suffix = url.substring(url.lastIndexOf("."), url.length);
  1402. const a = document.createElement('a')
  1403. a.setAttribute('download', name)
  1404. a.setAttribute('target', '_blank')
  1405. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  1406. a.click()
  1407. },
  1408. /** 装置级培训矩阵按钮操作 */
  1409. handleDevice() {
  1410. this.$router.push({ path: '/trainingbcc/records'});
  1411. },
  1412. }
  1413. };
  1414. </script>
  1415. <style scoped>
  1416. .staff_checked >>> .el-transfer-panel {
  1417. width : 600px;
  1418. }
  1419. .el-transfer-panel__item.el-checkbox {
  1420. width: 553px !important;
  1421. }
  1422. .avatar-uploader .el-upload {
  1423. border: 1px dashed #d9d9d9;
  1424. border-radius: 6px;
  1425. cursor: pointer;
  1426. position: relative;
  1427. overflow: hidden;
  1428. }
  1429. .avatar-uploader .el-upload:hover {
  1430. border-color: #409EFF;
  1431. }
  1432. .avatar-uploader-icon {
  1433. font-size: 28px;
  1434. color: #8c939d;
  1435. width: 178px;
  1436. height: 178px;
  1437. line-height: 178px;
  1438. text-align: center;
  1439. }
  1440. .avatar {
  1441. width: 178px;
  1442. height: 178px;
  1443. display: block;
  1444. }
  1445. </style>