score.vue 30 KB

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