score.vue 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  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" :span-method="mergeMethod" :data="dsdtList" :height="clientHeight"
  36. @selection-change="handleSelectionChange"
  37. border>
  38. <el-table-column type="selection" width="55" align="center" fixed="left"/>
  39. <el-table-column label="详细计划" align="center" prop="detailPlan" :show-overflow-tooltip="true" width="180"
  40. fixed="left"/>
  41. <el-table-column label="计划培训时间" prop="planDate" width="180" align="center" fixed="left">
  42. <template slot-scope="scope">
  43. <span>{{ parseTime(scope.row.planDate, '{y}-{m}-{d}') }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="培训主题" align="center" prop="topic" :show-overflow-tooltip="true" fixed="left"
  47. width="180"/>
  48. <el-table-column label="培训计划" align="center" prop="courseDay" :show-overflow-tooltip="true" width="180"/>
  49. <el-table-column label="培训内容" align="center" prop="content" width="280"/>
  50. <el-table-column label="培训状态" align="center" prop="planStatus" :show-overflow-tooltip="true" width="180">
  51. <template slot-scope="scope">
  52. <el-tag v-if="scope.row.planStatus == 2" size="small" type="warning">待考试</el-tag>
  53. <el-tag v-if="scope.row.planStatus == 3" size="small" type="success">已完成</el-tag>
  54. <el-tag v-if="scope.row.planStatus == 1" size="small" type="danger">已中止</el-tag>
  55. <el-tag v-else-if="scope.row.planStatus == 0" size="small" type="info">未完成</el-tag>
  56. <el-tag v-else-if="scope.row.planStatus == 4" size="small" type="danger">已中止待审批</el-tag>
  57. <el-tag v-else-if="scope.row.planStatus == 5" size="small" type="success">已完成待审批</el-tag>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="第一次成绩" align="center" prop="score1" :show-overflow-tooltip="true" width="180">
  61. <template slot-scope="scope">
  62. <div v-if="scope.row.score1 == null&&scope.row.planStatus==2">
  63. <el-select v-model="scope.row.score1Tmp" style="width: 130px" placeholder="请选择成绩">
  64. <el-option value="好" label="好" key="好"/>
  65. <el-option value="满意" label="满意" key="满意"/>
  66. <el-option value="差" label="差" key="差"/>
  67. </el-select>
  68. <el-button type="text" @click="saveScore(scope.row)" class="ml5">保存</el-button>
  69. </div>
  70. <span v-else>{{ scope.row.score1 }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="附件" align="center" :show-overflow-tooltip="true" width="80">
  74. <template slot-scope="scope">
  75. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'tsNew-score1')"
  76. circle></el-button>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="第二次成绩" align="center" prop="score2" :show-overflow-tooltip="true" width="180">
  80. <template slot-scope="scope">
  81. <div
  82. v-if="scope.row.score2 == null&&scope.row.planStatus==2&&(scope.row.score1 == '满意'||scope.row.score1 == '差')">
  83. <el-select v-model="scope.row.score2Tmp" style="width: 130px" placeholder="请选择成绩">
  84. <el-option value="好" label="好" key="好"/>
  85. <el-option value="满意" label="满意" key="满意"/>
  86. <el-option value="差" label="差" key="差"/>
  87. </el-select>
  88. <el-button type="text" @click="saveScore(scope.row)" class="ml5">保存</el-button>
  89. </div>
  90. <span v-else>{{ scope.row.score2 }}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="附件" align="center" :show-overflow-tooltip="true" width="80">
  94. <template slot-scope="scope">
  95. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'tsNew-score2')"
  96. circle></el-button>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="第三次成绩" align="center" prop="score3" :show-overflow-tooltip="true" width="180">
  100. <template slot-scope="scope">
  101. <div
  102. v-if="scope.row.score3 == null&&scope.row.planStatus==2&&((scope.row.score1 == '满意'||scope.row.score1 == '差')&&(scope.row.score2 == '满意'||scope.row.score2 == '差'))">
  103. <el-select v-model="scope.row.score3Tmp" style="width: 130px" placeholder="请选择成绩">
  104. <el-option value="好" label="好" key="好"/>
  105. <el-option value="满意" label="满意" key="满意"/>
  106. <el-option value="差" label="差" key="差"/>
  107. </el-select>
  108. <el-button type="text" @click="saveScore(scope.row)" class="ml5">保存</el-button>
  109. </div>
  110. <span v-else>{{ scope.row.score3 }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="附件" align="center" :show-overflow-tooltip="true" width="80">
  114. <template slot-scope="scope">
  115. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'tsNew-score3')"
  116. circle></el-button>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true" width="180"/>
  120. <el-table-column label="操作" align="center" fixed="right" width="230" class-name="small-padding fixed-width">
  121. <template slot-scope="scope">
  122. <el-button
  123. size="mini"
  124. type="text"
  125. icon="el-icon-edit"
  126. @click="handleUpdate(scope.row)"
  127. >修改
  128. </el-button>
  129. <el-button
  130. size="mini"
  131. type="text"
  132. icon="el-icon-delete"
  133. @click="handleDelete(scope.row)"
  134. >删除
  135. </el-button>
  136. <el-button
  137. size="mini"
  138. type="text"
  139. icon="el-icon-folder"
  140. @click="openFileDialog(scope.row)"
  141. >学习资料
  142. </el-button>
  143. </template>
  144. </el-table-column>
  145. </el-table>
  146. <pagination
  147. v-show="total>0"
  148. :total="total"
  149. :page.sync="queryParams.pageNum"
  150. :limit.sync="queryParams.pageSize"
  151. @pagination="getList"
  152. />
  153. <!-- 添加或修改转岗培训对话框 -->
  154. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  155. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  156. <el-form-item label="详细计划" prop="detailPlan">
  157. <el-input v-model="form.detailPlan" placeholder="请输入详细计划"/>
  158. </el-form-item>
  159. <el-form-item label="培训主题" prop="topic">
  160. <el-input v-model="form.topic" placeholder="请输入培训主题"/>
  161. </el-form-item>
  162. <el-form-item label="培训排序" prop="sortTmpl">
  163. <el-input-number v-model="form.sortTmpl" placeholder="请输入培训排序" style="width:100%;"/>
  164. </el-form-item>
  165. <el-form-item label="应学习时长(h)" prop="timerNeed">
  166. <el-input-number v-model="form.timerNeed" placeholder="请输入应学习时长" style="width: 100%"/>
  167. </el-form-item>
  168. <el-form-item label="备注" prop="remarks">
  169. <el-input v-model="form.remarks" placeholder="请输入备注"/>
  170. </el-form-item>
  171. </el-form>
  172. <el-card v-for="(recordForm, index) in recordForm" :key="index" shadow="always" class="mb8 mt8">
  173. <el-form ref="recordForm" :model="recordForm" :rules="rules" label-width="100px">
  174. <el-row>
  175. <el-col :span="23">
  176. <el-form-item label="计划培训时间" prop="planDate">
  177. <el-date-picker
  178. v-model="recordForm.planDate"
  179. type="date"
  180. value-format="yyyy-MM-dd"
  181. placeholder="请选择计划培训时间">
  182. </el-date-picker>
  183. </el-form-item>
  184. </el-col>
  185. <el-col :span="1">
  186. <el-tooltip class="item" effect="dark" content="移除本行" placement="top">
  187. <el-button
  188. type="text"
  189. @click.prevent="removeDomain(recordForm)"
  190. style="float: right;"
  191. >❌
  192. </el-button>
  193. </el-tooltip>
  194. </el-col>
  195. </el-row>
  196. <el-row>
  197. <el-col :span="23">
  198. <el-form-item label="培训计划" prop="courseDay">
  199. <el-input v-model="recordForm.courseDay" placeholder="请输入培训计划"/>
  200. </el-form-item>
  201. </el-col>
  202. </el-row>
  203. <el-row>
  204. <el-col :span="23">
  205. <el-form-item label="培训内容" prop="content">
  206. <el-input type="textarea" v-model="recordForm.content" placeholder="请输入培训内容"/>
  207. </el-form-item>
  208. </el-col>
  209. </el-row>
  210. </el-form>
  211. </el-card>
  212. <div class="mb8 mt8">
  213. <el-tooltip class="item" effect="dark" content="该按钮会删除所有卡片内容!请谨慎操作!" placement="top">
  214. <el-button type="danger" plain @click="resetForm1()" :disabled="finalFlag"><i
  215. class="el-icon-refresh-left"></i></el-button>
  216. </el-tooltip>
  217. <el-button type="success" plain @click="add"><i class="el-icon-plus"></i></el-button>
  218. <el-button type="warning" plain @click="reduce" :disabled="flag||finalFlag"><i class="el-icon-minus"></i>
  219. </el-button>
  220. </div>
  221. <div slot="footer" class="dialog-footer">
  222. <el-button type="primary" @click="submitForm">确 定</el-button>
  223. <el-button @click="cancel">取 消</el-button>
  224. </div>
  225. </el-dialog>
  226. <el-dialog :visible.sync="file.open" width="30%" append-to-body>
  227. <el-descriptions class="margin-top" title="学习资料" :column="1" size="medium" border>
  228. <el-descriptions-item label-style="width:180px">
  229. <template slot="label">
  230. <i class="el-icon-user"></i>
  231. 资料名
  232. </template>
  233. {{ file.data.fileName }}
  234. </el-descriptions-item>
  235. <el-descriptions-item label-style="width:180px">
  236. <template slot="label">
  237. <i class="el-icon-mobile-phone"></i>
  238. 学习进度
  239. </template>
  240. <el-progress :text-inside="true" :stroke-width="20" :percentage="getCountTime()"
  241. status="success"></el-progress>
  242. </el-descriptions-item>
  243. <el-descriptions-item label-style="width:180px">
  244. <template slot="label">
  245. <i class="el-icon-mobile-phone"></i>
  246. 应学习时长(分)
  247. </template>
  248. {{ file.data.timerNeed }}
  249. </el-descriptions-item>
  250. <el-descriptions-item label-style="width:180px">
  251. <template slot="label">
  252. <i class="el-icon-mobile-phone"></i>
  253. 已学习时长(分)
  254. </template>
  255. {{ file.data.timer }}
  256. </el-descriptions-item>
  257. </el-descriptions>
  258. <el-button
  259. class="mt10"
  260. type="primary"
  261. icon="el-icon-video-play"
  262. @click="handleStudy(file.data)"
  263. >查看附件
  264. </el-button>
  265. </el-dialog>
  266. <el-dialog :close-on-click-modal="false" element-loading-background="rgba(0,0,0,0.2)"
  267. v-dialogDrag :title="pdf.title"
  268. :visible.sync="pdf.open" width="1300px" height="800px" :center="true" append-to-body
  269. @close="handleClose">
  270. <div style="margin-top: -30px">
  271. <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"
  272. v-if="ppt"></iframe>
  273. </div>
  274. </el-dialog>
  275. <!-- 报告附件对话框 -->
  276. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px"
  277. append-to-body>
  278. <el-upload
  279. ref="doc"
  280. :limit="50"
  281. :headers="doc.headers"
  282. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  283. :disabled="doc.isUploading"
  284. :on-progress="handleFileDocProgress"
  285. :on-success="handleFileDocSuccess"
  286. :auto-upload="true"
  287. drag
  288. >
  289. <i class="el-icon-upload"></i>
  290. <div class="el-upload__text">
  291. {{ $t('将文件拖到此处,或') }}
  292. <em>{{ $t('点击上传') }}</em>
  293. </div>
  294. </el-upload>
  295. <el-table :data="doc.commonfileList" border>
  296. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  297. <template slot-scope="scope">
  298. <a class="link-type" @click="handleDownload(scope.row)">
  299. <span>{{ scope.row.fileName }}</span>
  300. </a>
  301. </template>
  302. </el-table-column>
  303. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true"
  304. width="80"/>
  305. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  306. <el-table-column :label="$t('上传日期')" align="center" prop="createdate" :show-overflow-tooltip="true"
  307. width="120">
  308. <template slot-scope="scope">
  309. <span>{{ parseTime(scope.row.createdate, '{y}-{m}-{d}') }}</span>
  310. </template>
  311. </el-table-column>
  312. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  313. <template slot-scope="scope">
  314. <el-button
  315. v-if="scope.row.fileName!=null&&scope.row.fileName.endsWith('pdf')"
  316. size="mini"
  317. type="text"
  318. icon="el-icon-view"
  319. @click="handleSee(scope.row)"
  320. >{{ $t('预览') }}
  321. </el-button>
  322. <el-button v-hasPermi="['training:trainingrecords:file']" type="text" size="small" v-if="scope.row.isEdit"
  323. @click="save(scope.row)">保存
  324. </el-button>
  325. <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">
  326. 取消
  327. </el-button>
  328. <!-- <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>-->
  329. <el-button
  330. size="mini"
  331. type="text"
  332. icon="el-icon-download"
  333. @click="handleDownload(scope.row)"
  334. >{{ $t('下载') }}
  335. </el-button>
  336. <el-button
  337. size="mini"
  338. type="text"
  339. icon="el-icon-delete"
  340. @click="handleDeleteDoc(scope.row)"
  341. v-hasPermi="['training:trainingrecords:file']"
  342. >{{ $t('删除') }}
  343. </el-button>
  344. </template>
  345. </el-table-column>
  346. </el-table>
  347. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px"
  348. append-to-body>
  349. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  350. <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
  351. </div>
  352. <div style="margin-top: -30px">
  353. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  354. </div>
  355. </el-dialog>
  356. <div slot="footer" class="dialog-footer">
  357. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  358. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  359. </div>
  360. </el-dialog>
  361. </div>
  362. </template>
  363. <script>
  364. import {
  365. addLjplandsdt,
  366. delLjplandsdt,
  367. getLjplandsdt,
  368. listLjplandsdt,
  369. updateLjLearnTime,
  370. updateLjplandsdt
  371. } from "@/api/training/bccnew/ljplandsdt";
  372. import {
  373. addYsplandsdt,
  374. delYsplandsdt,
  375. getYsplandsdt,
  376. listYsplandsdt,
  377. updateYsLearnTime,
  378. updateYsplandsdt
  379. } from "@/api/training/bccnew/ysplandsdt";
  380. import {
  381. addFlplandsdt,
  382. delFlplandsdt,
  383. getFlplandsdt,
  384. listFlplandsdt,
  385. updateFlLearnTime,
  386. updateFlplandsdt
  387. } from "@/api/training/bccnew/flplandsdt";
  388. import {
  389. addFtplandsdt,
  390. delFtplandsdt,
  391. getFtplandsdt,
  392. listFtplandsdt,
  393. updateFtLearnTime,
  394. updateFtplandsdt
  395. } from "@/api/training/bccnew/ftplandsdt";
  396. import {treeselect} from "@/api/system/dept";
  397. import Treeselect from "@riophae/vue-treeselect";
  398. import {getToken} from "@/utils/auth";
  399. import {allFileList, delCommonfile} from "@/api/common/commonfile";
  400. import {delLjContent, listLjContent} from "@/api/training/bccnew/ljContent";
  401. import {delFtContent, listFtContent} from "@/api/training/bccnew/ftContent";
  402. import {delFlContent, listFlContent} from "@/api/training/bccnew/flContent";
  403. import {delYsContent, listYsContent} from "@/api/training/bccnew/ysContent";
  404. var timer = null;
  405. export default {
  406. name: "score",
  407. props: {
  408. newId: {},
  409. planType: {}
  410. },
  411. components: {Treeselect},
  412. data() {
  413. return {
  414. recordForm: [{}],
  415. flag: true,
  416. finalFlag: false,
  417. file: {
  418. open: false,
  419. data: {}
  420. },
  421. ppt: false,
  422. // 报告附件参数
  423. doc: {
  424. file: "",
  425. // 是否显示弹出层(报告附件)
  426. open: false,
  427. // 弹出层标题(报告附件)
  428. title: "附件",
  429. // 是否禁用上传
  430. isUploading: false,
  431. // 是否更新已经存在的用户数据
  432. updateSupport: 0,
  433. // 报告附件上传位置编号
  434. ids: 0,
  435. // 设置上传的请求头部
  436. headers: {Authorization: "Bearer " + getToken()},
  437. // 上传的地址
  438. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  439. commonfileList: null,
  440. queryParams: {
  441. pId: null,
  442. pType: 'traning'
  443. },
  444. pType: 'traning',
  445. pId: null,
  446. form: {}
  447. },
  448. pdf: {
  449. title: '',
  450. pdfUrl: '',
  451. numPages: null,
  452. open: false,
  453. pageNum: 1,
  454. pageTotalNum: 1,
  455. loadedRatio: 0,
  456. loadingFlash: false,
  457. },
  458. // 选中数组
  459. ids: [],
  460. // 总条数
  461. total: 0,
  462. // 非单个禁用
  463. single: true,
  464. // 非多个禁用
  465. multiple: true,
  466. // 显示搜索条件
  467. showSearch: false,
  468. loading: true,
  469. // 弹出层标题
  470. title: "",
  471. // 部门树选项
  472. deptOptions: undefined,
  473. // 培训状态字典
  474. planStatusOptions: [],
  475. clientHeight: 300,
  476. // 是否显示弹出层
  477. open: false,
  478. dsdtList: [],
  479. queryParams: {
  480. pageNum: 1,
  481. pageSize: 20,
  482. newId: this.newId
  483. },
  484. // 表单参数
  485. form: {},
  486. // 表单校验
  487. rules: {}
  488. }
  489. },
  490. watch: {
  491. // 根据名称筛选部门树
  492. deptName(val) {
  493. this.$refs.tree.filter(val);
  494. }
  495. },
  496. created() {
  497. //设置表格高度对应屏幕高度
  498. this.$nextTick(() => {
  499. this.clientHeight = document.body.clientHeight - 250
  500. })
  501. this.getList();
  502. this.getTreeselect();
  503. this.getDicts("training_bccnew_status").then(response => {
  504. this.planStatusOptions = response.data;
  505. });
  506. },
  507. methods: {
  508. resetForm1() {
  509. this.recordForm = [{}]
  510. this.flags();
  511. },
  512. // 表单添加一行
  513. add() {
  514. let arr = {};
  515. this.recordForm.push(arr)
  516. this.flags();
  517. },
  518. // 表单减少一行
  519. reduce() {
  520. this.recordForm.length = this.recordForm.length - 1
  521. this.flags()
  522. },
  523. //删除自身
  524. removeDomain(item) {
  525. console.log(item)
  526. if (!item.id) {
  527. //如果子类大于1 可点击删除按钮
  528. if (this.recordForm.length > 1) {
  529. var index = this.recordForm.indexOf(item)
  530. if (index !== -1) {
  531. this.recordForm.splice(index, 1)
  532. }
  533. }
  534. this.flags()
  535. } else {
  536. var index = this.recordForm.indexOf(item)
  537. if (this.planType === 1) {
  538. this.$confirm('是否确认删除该行?').then(function () {
  539. return delLjContent(item.id);
  540. }).then(() => {
  541. this.msgSuccess("删除成功");
  542. this.recordForm.splice(index, 1)
  543. })
  544. }else if (this.planType === 2) {
  545. this.$confirm('是否确认删除该行?').then(function () {
  546. return delYsContent(item.id);
  547. }).then(() => {
  548. this.msgSuccess("删除成功");
  549. this.recordForm.splice(index, 1)
  550. })
  551. }else if (this.planType === 3) {
  552. this.$confirm('是否确认删除该行?').then(function () {
  553. return delFlContent(item.id);
  554. }).then(() => {
  555. this.msgSuccess("删除成功");
  556. this.recordForm.splice(index, 1)
  557. })
  558. }else if (this.planType === 4) {
  559. this.$confirm('是否确认删除该行?').then(function () {
  560. return delFtContent(item.id);
  561. }).then(() => {
  562. this.msgSuccess("删除成功");
  563. this.recordForm.splice(index, 1)
  564. })
  565. }
  566. this.flags()
  567. }
  568. },
  569. // 判断数组长度
  570. flags() {
  571. //如果小于1则自动添加一行
  572. if (this.recordForm.length < 2) {
  573. this.flag = true
  574. } else if (this.recordForm.length < 1) {
  575. this.recordForm.push({});
  576. } else {
  577. //先赋值为true再赋为false, 不然会没反应
  578. this.flag = true
  579. this.flag = false
  580. }
  581. },
  582. saveScore(row) {
  583. if (this.planType === 1) {
  584. this.$confirm('成绩保存后不可修改!请确认成绩为' + ((row.score1Tmp ? row.score1Tmp : row.score2Tmp ? row.score2Tmp : row.score3Tmp) === undefined ? "" : (row.score1Tmp ? row.score1Tmp : row.score2Tmp ? row.score2Tmp : row.score3Tmp)), "警告", {
  585. confirmButtonText: "确定",
  586. cancelButtonText: "取消",
  587. type: "warning"
  588. }).then(function () {
  589. return updateLjplandsdt({
  590. id: row.id,
  591. score1: row.score1Tmp ? row.score1Tmp : row.score1,
  592. score2: row.score2Tmp ? row.score2Tmp : row.score2,
  593. score3: row.score3Tmp,
  594. newId: row.newId
  595. });
  596. }).then(() => {
  597. this.getList();
  598. this.msgSuccess("修改成功");
  599. })
  600. } else if (this.planType === 2) {
  601. this.$confirm('成绩保存后不可修改!请确认成绩为' + ((row.score1Tmp ? row.score1Tmp : row.score2Tmp ? row.score2Tmp : row.score3Tmp) === undefined ? "" : (row.score1Tmp ? row.score1Tmp : row.score2Tmp ? row.score2Tmp : row.score3Tmp)), "警告", {
  602. confirmButtonText: "确定",
  603. cancelButtonText: "取消",
  604. type: "warning"
  605. }).then(function () {
  606. return updateYsplandsdt({
  607. id: row.id,
  608. score1: row.score1Tmp ? row.score1Tmp : row.score1,
  609. score2: row.score2Tmp ? row.score2Tmp : row.score2,
  610. score3: row.score3Tmp,
  611. newId: row.newId
  612. });
  613. }).then(() => {
  614. this.getList();
  615. this.msgSuccess("修改成功");
  616. })
  617. } else if (this.planType === 3) {
  618. this.$confirm('成绩保存后不可修改!请确认成绩为' + ((row.score1Tmp ? row.score1Tmp : row.score2Tmp ? row.score2Tmp : row.score3Tmp) === undefined ? "" : (row.score1Tmp ? row.score1Tmp : row.score2Tmp ? row.score2Tmp : row.score3Tmp)), "警告", {
  619. confirmButtonText: "确定",
  620. cancelButtonText: "取消",
  621. type: "warning"
  622. }).then(function () {
  623. return updateFlplandsdt({
  624. id: row.id,
  625. score1: row.score1Tmp ? row.score1Tmp : row.score1,
  626. score2: row.score2Tmp ? row.score2Tmp : row.score2,
  627. score3: row.score3Tmp,
  628. newId: row.newId
  629. });
  630. }).then(() => {
  631. this.getList();
  632. this.msgSuccess("修改成功");
  633. })
  634. } else if (this.planType === 4) {
  635. this.$confirm('成绩保存后不可修改!请确认成绩为' + ((row.score1Tmp ? row.score1Tmp : row.score2Tmp ? row.score2Tmp : row.score3Tmp) === undefined ? "" : (row.score1Tmp ? row.score1Tmp : row.score2Tmp ? row.score2Tmp : row.score3Tmp)), "警告", {
  636. confirmButtonText: "确定",
  637. cancelButtonText: "取消",
  638. type: "warning"
  639. }).then(function () {
  640. return updateFtplandsdt({
  641. id: row.id,
  642. score1: row.score1Tmp ? row.score1Tmp : row.score1,
  643. score2: row.score2Tmp ? row.score2Tmp : row.score2,
  644. score3: row.score3Tmp,
  645. newId: row.newId
  646. });
  647. }).then(() => {
  648. this.getList();
  649. this.msgSuccess("修改成功");
  650. })
  651. }
  652. },
  653. // 文件上传中处理
  654. handleFileUploadProgress(event, file, fileList) {
  655. this.upload.isUploading = true;
  656. },
  657. // 文件上传成功处理
  658. handleFileSuccess(response, file, fileList) {
  659. this.upload.open = false;
  660. this.upload.isUploading = false;
  661. this.$refs.upload.clearFiles();
  662. this.$alert(response.msg, "导入结果", {dangerouslyUseHTMLString: true});
  663. this.getList();
  664. },
  665. // 提交上传文件
  666. submitFileForm() {
  667. this.$refs.upload.submit();
  668. },
  669. /** 报告附件按钮操作 */
  670. handleDoc(row, fileType) {
  671. if (this.planType === 1) {
  672. fileType += 'lj';
  673. } else if (this.planType === 2) {
  674. fileType += 'ys';
  675. } else if (this.planType === 3) {
  676. fileType += 'fl';
  677. } else if (this.planType === 4) {
  678. fileType += 'ft';
  679. }
  680. this.doc.pType = fileType
  681. this.doc.queryParams.pType = fileType
  682. this.doc.id = row.id;
  683. this.doc.title = this.$t('附件');
  684. this.doc.open = true;
  685. this.doc.queryParams.pId = row.id
  686. this.doc.pId = row.id
  687. this.getFileList()
  688. this.$nextTick(() => {
  689. this.$refs.doc.clearFiles()
  690. })
  691. },
  692. getFileList() {
  693. allFileList(this.doc.queryParams).then(response => {
  694. response.forEach(element => {
  695. element["isEdit"] = false
  696. });
  697. response.forEach(element => {
  698. element["isAdd"] = false
  699. });
  700. this.doc.commonfileList = response;
  701. });
  702. },
  703. //附件上传中处理
  704. handleFileDocProgress(event, file, fileList) {
  705. this.doc.file = file;
  706. this.doc.isUploading = true;
  707. },
  708. //附件上传成功处理
  709. handleFileDocSuccess(response, file, fileList) {
  710. this.doc.isUploading = false;
  711. this.$alert(response.msg, this.$t('导入结果'), {dangerouslyUseHTMLString: true});
  712. this.getFileList()
  713. },
  714. // 文件下载处理
  715. handleDownload(row) {
  716. var name = row.fileName;
  717. var url = row.fileUrl;
  718. var suffix = url.substring(url.lastIndexOf("."), url.length);
  719. const a = document.createElement('a')
  720. a.setAttribute('download', name)
  721. a.setAttribute('target', '_blank')
  722. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  723. a.click()
  724. },
  725. openPdf() {
  726. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  727. },
  728. handleSee(row) {
  729. // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
  730. this.pdf.open = true
  731. this.pdf.title = row.fileName
  732. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  733. },
  734. /** 删除按钮操作 */
  735. handleDeleteDoc(row) {
  736. const ids = row.id || this.ids;
  737. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  738. confirmButtonText: this.$t('确定'),
  739. cancelButtonText: this.$t('取消'),
  740. type: "warning"
  741. }).then(function () {
  742. return delCommonfile(ids);
  743. }).then(() => {
  744. this.getFileList()
  745. this.msgSuccess(this.$t('删除成功'));
  746. })
  747. },
  748. handleClose() {
  749. window.clearInterval(timer);
  750. this.getList();
  751. },
  752. handleStudy(row) {
  753. //office预览
  754. this.pdf.open = true
  755. this.pdf.title = row.fileName
  756. this.pdf.pdfUrl = ""
  757. this.ppt = true
  758. //如果是PDF等直接可以打开的就不调接口,否则调用接口
  759. if (row.fileName != null && row.fileName.endsWith('pdf')) {
  760. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  761. }
  762. let _this = this;
  763. if (this.planType === 1) {
  764. timer = window.setInterval(function () {
  765. updateLjLearnTime(row).then(res => {
  766. })
  767. }, 60000);
  768. } else if (this.planType === 2) {
  769. timer = window.setInterval(function () {
  770. updateYsLearnTime(row).then(res => {
  771. })
  772. }, 60000);
  773. } else if (this.planType === 3) {
  774. timer = window.setInterval(function () {
  775. updateFlLearnTime(row).then(res => {
  776. })
  777. }, 60000);
  778. } else if (this.planType === 4) {
  779. timer = window.setInterval(function () {
  780. updateFtLearnTime(row).then(res => {
  781. })
  782. }, 60000);
  783. }
  784. },
  785. getCountTime() {
  786. if (this.file.data.timerNeed === 0)
  787. return 0;
  788. return parseInt((this.file.data.timer / this.file.data.timerNeed * 100).toFixed(2))
  789. },
  790. openFileDialog(row) {
  791. this.file.open = true;
  792. this.file.data = row
  793. console.log(row)
  794. if (row.timer === '' || row.timer == null) {
  795. this.file.data.timer = 0
  796. }
  797. if (row.timerNeed === '' || row.timerNeed == null) {
  798. this.file.data.timerNeed = 0
  799. }
  800. console.log(this.file.data)
  801. },
  802. getList() {
  803. if (this.planType == 1) {
  804. listLjplandsdt(this.queryParams).then(res => {
  805. this.dsdtList = res.data;
  806. this.total = 0;
  807. this.loading = false;
  808. })
  809. } else if (this.planType == 2) {
  810. listYsplandsdt(this.queryParams).then(res => {
  811. this.dsdtList = res.data;
  812. this.total = 0;
  813. this.loading = false;
  814. })
  815. } else if (this.planType == 3) {
  816. listFlplandsdt(this.queryParams).then(res => {
  817. this.dsdtList = res.data;
  818. this.total = 0;
  819. this.loading = false;
  820. })
  821. } else if (this.planType == 4) {
  822. listFtplandsdt(this.queryParams).then(res => {
  823. this.dsdtList = res.data;
  824. this.total = 0;
  825. this.loading = false;
  826. })
  827. }
  828. },
  829. // 多选框选中数据
  830. handleSelectionChange(selection) {
  831. this.ids = selection.map(item => item.id)
  832. this.single = selection.length !== 1
  833. this.multiple = !selection.length
  834. },
  835. /** 查询部门下拉树结构 */
  836. getTreeselect() {
  837. treeselect().then(response => {
  838. this.deptOptions = response.data;
  839. });
  840. },
  841. // 取消按钮
  842. cancel() {
  843. this.open = false;
  844. this.reset();
  845. },
  846. // 表单重置
  847. reset() {
  848. this.form = {
  849. id: null,
  850. newId: this.newId,
  851. courseCode: null,
  852. topic: null,
  853. content: null,
  854. courseDay: null,
  855. courseHour: null,
  856. detailPlan: null,
  857. trainer: null,
  858. courseDate: null,
  859. assess: null,
  860. delFlag: null,
  861. createrCode: null,
  862. createdate: null,
  863. updaterCode: null,
  864. updatedate: null,
  865. deptId: null,
  866. remarks: null,
  867. planStatus: 0,
  868. score1: null,
  869. score2: null,
  870. score3: null
  871. };
  872. this.resetForm("form");
  873. this.recordForm = [{}]
  874. },
  875. /** 搜索按钮操作 */
  876. handleQuery() {
  877. this.queryParams.pageNum = 1;
  878. this.getList();
  879. },
  880. /** 重置按钮操作 */
  881. resetQuery() {
  882. this.resetForm("queryForm");
  883. this.handleQuery();
  884. },
  885. handleDelete(row) {
  886. const ids = row.id || this.ids;
  887. if (this.planType == 1) {
  888. this.$confirm('是否确认删除?', "警告", {
  889. confirmButtonText: "确定",
  890. cancelButtonText: "取消",
  891. type: "warning"
  892. }).then(function () {
  893. return delLjplandsdt(ids);
  894. }).then(() => {
  895. this.getList();
  896. this.msgSuccess("删除成功");
  897. })
  898. } else if (this.planType == 2) {
  899. this.$confirm('是否确认删除?', "警告", {
  900. confirmButtonText: "确定",
  901. cancelButtonText: "取消",
  902. type: "warning"
  903. }).then(function () {
  904. return delYsplandsdt(ids);
  905. }).then(() => {
  906. this.getList();
  907. this.msgSuccess("删除成功");
  908. })
  909. } else if (this.planType == 3) {
  910. this.$confirm('是否确认删除?', "警告", {
  911. confirmButtonText: "确定",
  912. cancelButtonText: "取消",
  913. type: "warning"
  914. }).then(function () {
  915. return delFlplandsdt(ids);
  916. }).then(() => {
  917. this.getList();
  918. this.msgSuccess("删除成功");
  919. })
  920. } else if (this.planType == 4) {
  921. this.$confirm('是否确认删除?', "警告", {
  922. confirmButtonText: "确定",
  923. cancelButtonText: "取消",
  924. type: "warning"
  925. }).then(function () {
  926. return delFtplandsdt(ids);
  927. }).then(() => {
  928. this.getList();
  929. this.msgSuccess("删除成功");
  930. })
  931. }
  932. },
  933. handleUpdate(row) {
  934. this.reset();
  935. const id = row.id || this.ids
  936. if (this.planType == 1) {
  937. getLjplandsdt(id).then(response => {
  938. this.form = response.data;
  939. this.open = true;
  940. this.title = "修改课程";
  941. listLjContent({pid: id}).then(res => {
  942. this.recordForm = res.data;
  943. })
  944. });
  945. } else if (this.planType == 2) {
  946. getYsplandsdt(id).then(response => {
  947. this.form = response.data;
  948. this.open = true;
  949. this.title = "修改课程";
  950. listYsContent({pid: id}).then(res => {
  951. this.recordForm = res.data;
  952. })
  953. });
  954. } else if (this.planType == 3) {
  955. getFlplandsdt(id).then(response => {
  956. this.form = response.data;
  957. this.open = true;
  958. this.title = "修改课程";
  959. listFlContent({pid: id}).then(res => {
  960. this.recordForm = res.data;
  961. })
  962. });
  963. } else if (this.planType == 4) {
  964. getFtplandsdt(id).then(response => {
  965. this.form = response.data;
  966. this.open = true;
  967. this.title = "修改课程";
  968. listFtContent({pid: id}).then(res => {
  969. this.recordForm = res.data;
  970. })
  971. });
  972. }
  973. },
  974. handleAdd() {
  975. this.reset();
  976. this.open = true;
  977. this.title = "添加课程";
  978. }, /** 提交按钮 */
  979. submitForm() {
  980. this.$refs["form"].validate(valid => {
  981. if (valid) {
  982. this.form.contents = this.recordForm;
  983. if (this.form.id != null) {
  984. if (this.planType == 1) {
  985. updateLjplandsdt(this.form).then(response => {
  986. this.msgSuccess("修改成功");
  987. this.open = false;
  988. this.getList();
  989. });
  990. } else if (this.planType == 2) {
  991. updateYsplandsdt(this.form).then(response => {
  992. this.msgSuccess("修改成功");
  993. this.open = false;
  994. this.getList();
  995. });
  996. } else if (this.planType == 3) {
  997. updateFlplandsdt(this.form).then(response => {
  998. this.msgSuccess("修改成功");
  999. this.open = false;
  1000. this.getList();
  1001. });
  1002. } else if (this.planType == 4) {
  1003. updateFtplandsdt(this.form).then(response => {
  1004. this.msgSuccess("修改成功");
  1005. this.open = false;
  1006. this.getList();
  1007. });
  1008. }
  1009. } else {
  1010. if (this.planType == 1) {
  1011. addLjplandsdt(this.form).then(response => {
  1012. this.msgSuccess("新增成功");
  1013. this.open = false;
  1014. this.getList();
  1015. });
  1016. } else if (this.planType == 2) {
  1017. addYsplandsdt(this.form).then(response => {
  1018. this.msgSuccess("新增成功");
  1019. this.open = false;
  1020. this.getList();
  1021. });
  1022. } else if (this.planType == 3) {
  1023. addFlplandsdt(this.form).then(response => {
  1024. this.msgSuccess("新增成功");
  1025. this.open = false;
  1026. this.getList();
  1027. });
  1028. } else if (this.planType == 4) {
  1029. addFtplandsdt(this.form).then(response => {
  1030. this.msgSuccess("新增成功");
  1031. this.open = false;
  1032. this.getList();
  1033. });
  1034. }
  1035. }
  1036. }
  1037. });
  1038. },
  1039. //合并单元格
  1040. mergeMethod({row, column, rowIndex, columnIndex}) {
  1041. // console.log(row)
  1042. if ([1, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14].includes(columnIndex)) {
  1043. const _row = this.setTable(this.dsdtList).merge[rowIndex];
  1044. const _col = _row > 0 ? 1 : 0;
  1045. return {
  1046. rowspan: _row,
  1047. colspan: _col
  1048. };
  1049. }
  1050. },
  1051. //单元格整理
  1052. setTable(tableData) {
  1053. // console.log(tableData)
  1054. let spanArr = [],
  1055. concat = 0;
  1056. tableData.forEach((item, index) => {
  1057. if (index === 0) {
  1058. spanArr.push(1);
  1059. } else {
  1060. if (item.topic === tableData[index - 1].topic) {
  1061. //第一列需合并相同内容的判断条件
  1062. spanArr[concat] += 1;
  1063. spanArr.push(0);
  1064. } else {
  1065. spanArr.push(1);
  1066. concat = index;
  1067. }
  1068. }
  1069. });
  1070. return {
  1071. merge: spanArr
  1072. };
  1073. },
  1074. }
  1075. };
  1076. </script>
  1077. <style scoped>
  1078. </style>