index.vue 33 KB

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