index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872
  1. <template>
  2. <div class="app-container">
  3. <!-- 表格 -->
  4. <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange" :height="clientHeight" border :cell-style="tableCellStyle">
  5. <el-table-column type="selection" width="55" align="center" />
  6. <el-table-column label="课程内容" align="center" prop="plantName" :show-overflow-tooltip="true"/>
  7. <el-table-column label="具体内容" align="center" prop="classContent" :show-overflow-tooltip="true"/>
  8. <el-table-column label="开始日期" align="center" prop="startDate" width="150">
  9. <template slot-scope="scope">
  10. <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
  11. </template>
  12. </el-table-column>
  13. <el-table-column label="结束日期" align="center" prop="endDate" width="150">
  14. <template slot-scope="scope">
  15. <span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
  16. </template>
  17. </el-table-column>
  18. <el-table-column label="实际完成日期" align="center" prop="dateOfCompletion" width="150">
  19. <template slot-scope="scope">
  20. <span>{{ parseTime(scope.row.dateOfCompletion, '{y}-{m}-{d}') }}</span>
  21. </template>
  22. </el-table-column>
  23. <el-table-column label="学习状态" align="center" prop="studyState" :formatter="studyStateFormat" width="120"/>
  24. <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
  25. <template slot-scope="scope">
  26. <el-button
  27. size="mini"
  28. type="text"
  29. icon="el-icon-chat-dot-round"
  30. v-hasPermi="['spec:plan:edit']"
  31. @click="handleFeedback(scope.row)"
  32. >反馈</el-button>
  33. <el-button
  34. size="mini"
  35. type="text"
  36. icon="el-icon-document"
  37. @click="handleDocSuccessor(scope.row)"
  38. v-hasPermi="['spec:plan:edit']"
  39. >学员附件</el-button>
  40. <el-button
  41. size="mini"
  42. type="text"
  43. icon="el-icon-document"
  44. @click="handleDocMentor(scope.row)"
  45. v-hasPermi="['spec:plan:edit']"
  46. >学习资料</el-button>
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <!-- 分页 -->
  51. <pagination
  52. v-show="total>0"
  53. :total="total"
  54. :page.sync="queryParams.pageNum"
  55. :limit.sync="queryParams.pageSize"
  56. @pagination="getList"
  57. />
  58. <!-- 学习资料对话框 -->
  59. <el-dialog v-dialogDrag :title="docMentor.title" :visible.sync="docMentor.open" width="700px" append-to-body>
  60. <el-table :data="docMentor.commonfileList" border>
  61. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  62. <template slot-scope="scope">
  63. <a class="link-type" @click="handleDownload(scope.row)">
  64. <span>{{ scope.row.fileName }}</span>
  65. </a>
  66. </template>
  67. </el-table-column>
  68. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  69. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  70. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  71. <template slot-scope="scope">
  72. <el-button
  73. v-if="scope.row.fileName.endsWith('pdf')"
  74. size="mini"
  75. type="text"
  76. icon="el-icon-view"
  77. @click="handleSee(scope.row)"
  78. >{{ $t('预览') }}</el-button>
  79. <el-button
  80. size="mini"
  81. type="text"
  82. icon="el-icon-download"
  83. @click="handleDownload(scope.row)"
  84. >{{ $t('下载') }}</el-button>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  89. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  90. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  91. <div style="margin-top: -30px">
  92. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  93. </div>
  94. </el-dialog>
  95. <div slot="footer" class="dialog-footer">
  96. <el-button @click="docMentor.open = false">{{ $t('返 回') }}</el-button>
  97. </div>
  98. </el-dialog>
  99. <!-- 学员附件对话框 -->
  100. <el-dialog v-dialogDrag :title="docSuccessor.title" :visible.sync="docSuccessor.open" width="700px" append-to-body>
  101. <el-upload
  102. ref="docSuccessor"
  103. :limit="50"
  104. :headers="docSuccessor.headers"
  105. :action="docSuccessor.url + '?pType=' + docSuccessor.pType + '&pId=' + docSuccessor.pId"
  106. :disabled="docSuccessor.isUploading"
  107. :on-progress="handleFileDocProgressSuccessor"
  108. :on-success="handleFileDocSuccessSuccessor"
  109. :auto-upload="true"
  110. drag
  111. >
  112. <i class="el-icon-upload"></i>
  113. <div class="el-upload__text">
  114. {{ $t('将文件拖到此处,或') }}
  115. <em>{{ $t('点击上传') }}</em>
  116. </div>
  117. </el-upload>
  118. <el-table :data="docSuccessor.commonfileList" border>
  119. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  120. <template slot-scope="scope">
  121. <a class="link-type" @click="handleDownload(scope.row)">
  122. <span>{{ scope.row.fileName }}</span>
  123. </a>
  124. </template>
  125. </el-table-column>
  126. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  127. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  128. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  129. <template slot-scope="scope">
  130. <el-button
  131. v-if="scope.row.fileName.endsWith('pdf')"
  132. size="mini"
  133. type="text"
  134. icon="el-icon-view"
  135. @click="handleSee(scope.row)"
  136. >{{ $t('预览') }}</el-button>
  137. <el-button
  138. size="mini"
  139. type="text"
  140. icon="el-icon-download"
  141. @click="handleDownload(scope.row)"
  142. >{{ $t('下载') }}</el-button>
  143. <el-button
  144. size="mini"
  145. type="text"
  146. icon="el-icon-delete"
  147. @click="handleDeleteDocSuccessor(scope.row)"
  148. >{{ $t('删除') }}</el-button>
  149. </template>
  150. </el-table-column>
  151. </el-table>
  152. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  153. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  154. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  155. <div style="margin-top: -30px">
  156. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  157. </div>
  158. </el-dialog>
  159. <div slot="footer" class="dialog-footer">
  160. <el-button @click="docSuccessor.open = false">{{ $t('返 回') }}</el-button>
  161. </div>
  162. </el-dialog>
  163. <!-- 反馈对话框 -->
  164. <el-dialog v-dialogDrag :title="feedbackDialog.title" :visible.sync="feedbackDialog.open" width="700px" append-to-body>
  165. <el-form v-if="mentorFeedback != null">
  166. <h3 style="margin-bottom:20px;">导师反馈</h3>
  167. <el-form-item>
  168. <p v-html="mentorFeedback" style="border:1px solid #DFE6EC; overflow:scroll; height:200px;" />
  169. </el-form-item>
  170. </el-form>
  171. <h3>我的心得</h3>
  172. <el-upload
  173. ref="docFeedback"
  174. :headers="docFeedback.headers"
  175. class="upload-demo"
  176. :action="docFeedback.url + '?pType=' + docFeedback.pType + '&pId=' + docFeedback.pId"
  177. :disabled="docFeedback.isUploading"
  178. :on-progress="handleFileDocProgressFeedback"
  179. :on-success="handleFileDocSuccessFeedback"
  180. :auto-upload="true"
  181. multiple
  182. :limit="3">
  183. <el-button
  184. size="small"
  185. type="primary"
  186. style="margin-bottom:10px;margin-top:10px;"
  187. v-if="feedbackDialog.studyState == 0 || feedbackDialog.studyState == 3"
  188. >
  189. 点击上传附件
  190. </el-button>
  191. </el-upload>
  192. <el-table :data="docFeedback.commonfileList" border>
  193. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  194. <template slot-scope="scope">
  195. <a class="link-type" @click="handleDownload(scope.row)">
  196. <span>{{ scope.row.fileName }}</span>
  197. </a>
  198. </template>
  199. </el-table-column>
  200. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="120" />
  201. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  202. <template slot-scope="scope">
  203. <el-button
  204. v-if="scope.row.fileName.endsWith('pdf')"
  205. size="mini"
  206. type="text"
  207. icon="el-icon-view"
  208. @click="handleSee(scope.row)"
  209. >{{ $t('预览') }}</el-button>
  210. <el-button
  211. size="mini"
  212. type="text"
  213. icon="el-icon-download"
  214. @click="handleDownload(scope.row)"
  215. >{{ $t('下载') }}</el-button>
  216. <el-button
  217. size="mini"
  218. type="text"
  219. icon="el-icon-delete"
  220. @click="handleDeleteDocFeedback(scope.row)"
  221. >{{ $t('删除') }}</el-button>
  222. </template>
  223. </el-table-column>
  224. </el-table>
  225. <el-form>
  226. <el-form-item label="我学到了什么?">
  227. <el-input v-model="feedbackParams.answer1" placeholder="请输入" type="textarea" rows="3"></el-input>
  228. </el-form-item>
  229. <el-form-item label="理论学习和平时操作的不同之处?">
  230. <el-input v-model="feedbackParams.answer2" placeholder="请输入" type="textarea" rows="3"></el-input>
  231. </el-form-item>
  232. <el-form-item label="完成此课程后有什么更好的合理化建议?">
  233. <el-input v-model="feedbackParams.answer3" placeholder="请输入" type="textarea" rows="3"></el-input>
  234. </el-form-item>
  235. </el-form>
  236. <div slot="footer" class="dialog-footer">
  237. <el-button @click="handleSaveFeedback()" v-if="feedbackDialog.studyState == 0 || feedbackDialog.studyState == 3">{{ $t('保 存') }}</el-button>
  238. <el-button @click="handleSubmitFeedback()" v-if="feedbackDialog.studyState == 0 || feedbackDialog.studyState == 3">{{ $t('提 交') }}</el-button>
  239. <el-button @click="feedbackDialog.open = false">{{ $t('返 回') }}</el-button>
  240. </div>
  241. </el-dialog>
  242. </div>
  243. </template>
  244. <script>
  245. import { getFeedbackByPlanId } from "@/api/training/spec/feedback";
  246. import { updateAnswer, addAnswer, getAnswer } from "@/api/training/spec/answer";
  247. import { getPlan, delPlan, addPlan, updatePlan, updatePlan2, exportPlan, importTemplate, listPlanByStaffId } from "@/api/training/spec/plan";
  248. import { allFileList, delCommonfile } from "@/api/common/commonfile";
  249. import { treeselect } from "@/api/system/dept";
  250. import { getToken } from "@/utils/auth";
  251. import Treeselect from "@riophae/vue-treeselect";
  252. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  253. export default {
  254. name: "MyPlan",
  255. components: { Treeselect },
  256. data() {
  257. return {
  258. // 报告附件参数
  259. docFeedback: { // 反馈附件
  260. file: "",
  261. // 是否显示弹出层(报告附件)
  262. open: false,
  263. // 弹出层标题(报告附件)
  264. title: "",
  265. // 是否禁用上传
  266. isUploading: false,
  267. // 是否更新已经存在的用户数据
  268. updateSupport: 0,
  269. // 报告附件上传位置编号
  270. ids: 0,
  271. // 设置上传的请求头部
  272. headers: { Authorization: "Bearer " + getToken() },
  273. // 上传的地址
  274. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  275. commonfileList: null,
  276. queryParams: {
  277. pId: null,
  278. pType: 'docFeedback'
  279. },
  280. pType: 'docFeedback',
  281. pId: null
  282. },
  283. docMentor: { // 学习资料
  284. file: "",
  285. // 是否显示弹出层(报告附件)
  286. open: false,
  287. // 弹出层标题(报告附件)
  288. title: "",
  289. // 是否禁用上传
  290. isUploading: false,
  291. // 是否更新已经存在的用户数据
  292. updateSupport: 0,
  293. // 报告附件上传位置编号
  294. ids: 0,
  295. // 设置上传的请求头部
  296. headers: { Authorization: "Bearer " + getToken() },
  297. // 上传的地址
  298. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  299. commonfileList: null,
  300. queryParams: {
  301. pId: null,
  302. pType: 'docMentor'
  303. },
  304. pType: 'docMentor',
  305. pId: null
  306. },
  307. docSuccessor: { // 学员附件
  308. file: "",
  309. // 是否显示弹出层(报告附件)
  310. open: false,
  311. // 弹出层标题(报告附件)
  312. title: "",
  313. // 是否禁用上传
  314. isUploading: false,
  315. // 是否更新已经存在的用户数据
  316. updateSupport: 0,
  317. // 报告附件上传位置编号
  318. ids: 0,
  319. // 设置上传的请求头部
  320. headers: { Authorization: "Bearer " + getToken() },
  321. // 上传的地址
  322. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  323. commonfileList: null,
  324. queryParams: {
  325. pId: null,
  326. pType: 'docSuccessor'
  327. },
  328. pType: 'docSuccessor',
  329. pId: null
  330. },
  331. // 遮罩层
  332. loading: true,
  333. // 选中数组
  334. ids: [],
  335. dataListSelections: [],
  336. // 非单个禁用
  337. single: true,
  338. // 非多个禁用
  339. multiple: true,
  340. // 显示搜索条件
  341. showSearch: false,
  342. // 总条数
  343. total: 0,
  344. // 培训计划表格数据
  345. planList: [],
  346. // 弹出层标题
  347. title: "",
  348. // 操作
  349. operation: "",
  350. // 部门树选项
  351. deptOptions: undefined,
  352. clientHeight:300,
  353. // 是否显示弹出层
  354. open: false,
  355. // 学习状态字典
  356. studyStateOptions: [],
  357. // 反馈对话框参数
  358. feedbackDialog: {
  359. // 是否显示弹出层(报告附件)
  360. open: false,
  361. // 弹出层标题(报告附件)
  362. title: "",
  363. // 学习状态
  364. studyState: null,
  365. // 计划id
  366. planId: null,
  367. },
  368. // 反馈参数
  369. feedbackParams: {
  370. answer1: "",
  371. answer2: "",
  372. answer3: ""
  373. },
  374. // 查询参数
  375. queryParams: {
  376. pageNum: 1,
  377. pageSize: 20,
  378. staffId: null,
  379. plantName: null,
  380. startDate: null,
  381. endDate: null,
  382. classHour: null,
  383. studyState: null,
  384. // approveStatus: 1
  385. },
  386. // 表单参数
  387. form: {},
  388. // 表单校验
  389. rules: {
  390. },
  391. // pdf文件参数
  392. pdf : {
  393. title: '',
  394. pdfUrl: '',
  395. numPages: null,
  396. open: false,
  397. pageNum: 1,
  398. pageTotalNum: 1,
  399. loadedRatio: 0,
  400. },
  401. // 导师反馈内容
  402. mentorFeedback: null,
  403. };
  404. },
  405. watch: {
  406. // 根据名称筛选部门树
  407. deptName(val) {
  408. this.$refs.tree.filter(val);
  409. }
  410. },
  411. created() {
  412. //设置表格高度对应屏幕高度
  413. this.$nextTick(() => {
  414. this.clientHeight = document.body.clientHeight -250
  415. })
  416. this.getList();
  417. this.getTreeselect();
  418. this.getDicts("st_study_state").then(response => {
  419. this.studyStateOptions = response.data;
  420. });
  421. },
  422. methods: {
  423. /** 单元格样式 */
  424. tableCellStyle(row, column, rowIndex, columnIndex) {
  425. if (row.column.label === "实际完成日期" && row.row.dateOfCompletion > row.row.endDate) {
  426. return "background: #FFEEEE"
  427. }
  428. },
  429. /** 反馈处理 */
  430. handleFeedback(row) {
  431. // 加载反馈附件
  432. this.docFeedback.id = row.id;
  433. this.docFeedback.queryParams.pId = row.id
  434. this.docFeedback.pId = row.id
  435. this.getFileListFeedback()
  436. this.$nextTick(() => {
  437. this.$refs.docFeedback.clearFiles()
  438. })
  439. // 清空导师反馈内容
  440. this.mentorFeedback = null;
  441. // 清空答案
  442. this.feedbackParams.answer1 = "";
  443. this.feedbackParams.answer2 = "";
  444. this.feedbackParams.answer3 = "";
  445. let feedback1 = {};
  446. feedback1.planId = row.id;
  447. feedback1.questionId = 1;
  448. let feedback2 = {};
  449. feedback2.planId = row.id;
  450. feedback2.questionId = 2;
  451. let feedback3 = {};
  452. feedback3.planId = row.id;
  453. feedback3.questionId = 3;
  454. // 获取答案
  455. getAnswer(feedback1).then(response => {
  456. let data = response.data;
  457. if (data != null) {
  458. this.feedbackParams.answer1 = data.answer;
  459. }
  460. return getAnswer(feedback2);
  461. }).then(response => {
  462. let data = response.data;
  463. if (data != null) {
  464. this.feedbackParams.answer2 = data.answer;
  465. }
  466. return getAnswer(feedback3);
  467. }).then(response => {
  468. let data = response.data;
  469. if (data != null) {
  470. this.feedbackParams.answer3 = data.answer;
  471. }
  472. // 获取导师反馈
  473. return getFeedbackByPlanId(row.id);
  474. }).then(response => {
  475. console.log(response.data);
  476. if (response.data != null) {
  477. this.mentorFeedback = response.data.mentorFeedback;
  478. }
  479. this.feedbackDialog.title = row.plantName + "学习情况反馈";
  480. this.feedbackDialog.planId = row.id;
  481. this.feedbackDialog.studyState = row.studyState;
  482. this.feedbackDialog.open = true;
  483. });
  484. },
  485. /** 反馈对话框保存处理 */
  486. handleSaveFeedback() {
  487. let feedback1 = {};
  488. feedback1.planId = this.feedbackDialog.planId;
  489. feedback1.questionId = 1;
  490. let feedback2 = {};
  491. feedback2.planId = this.feedbackDialog.planId;
  492. feedback2.questionId = 2;
  493. let feedback3 = {};
  494. feedback3.planId = this.feedbackDialog.planId;
  495. feedback3.questionId = 3;
  496. // 根据计划id和问题id获取答案,有则修改,无则新增
  497. getAnswer(feedback1).then(response => {
  498. let data = response.data;
  499. feedback1.answer = this.feedbackParams.answer1;
  500. if (data != null) {
  501. feedback1.id = data.id;
  502. updateAnswer(feedback1);
  503. } else {
  504. addAnswer(feedback1);
  505. }
  506. });
  507. getAnswer(feedback2).then(response => {
  508. let data = response.data;
  509. feedback2.answer = this.feedbackParams.answer2;
  510. if (data != null) {
  511. feedback2.id = data.id;
  512. updateAnswer(feedback2);
  513. } else {
  514. addAnswer(feedback2);
  515. }
  516. });
  517. getAnswer(feedback3).then(response => {
  518. let data = response.data;
  519. feedback3.answer = this.feedbackParams.answer3;
  520. if (data != null) {
  521. feedback3.id = data.id;
  522. updateAnswer(feedback3);
  523. } else {
  524. addAnswer(feedback3);
  525. }
  526. });
  527. // this.feedbackDialog.open = false;
  528. this.msgSuccess("保存成功");
  529. this.getList();
  530. },
  531. /** 反馈对话框提交处理 */
  532. handleSubmitFeedback() {
  533. let feedback1 = {};
  534. feedback1.planId = this.feedbackDialog.planId;
  535. feedback1.questionId = 1;
  536. let feedback2 = {};
  537. feedback2.planId = this.feedbackDialog.planId;
  538. feedback2.questionId = 2;
  539. let feedback3 = {};
  540. feedback3.planId = this.feedbackDialog.planId;
  541. feedback3.questionId = 3;
  542. // 根据计划id和问题id获取答案,有则修改,无则新增
  543. getAnswer(feedback1).then(response => {
  544. let data = response.data;
  545. feedback1.answer = this.feedbackParams.answer1;
  546. if (data != null) {
  547. feedback1.id = data.id;
  548. updateAnswer(feedback1);
  549. } else {
  550. addAnswer(feedback1);
  551. }
  552. });
  553. getAnswer(feedback2).then(response => {
  554. let data = response.data;
  555. feedback2.answer = this.feedbackParams.answer2;
  556. if (data != null) {
  557. feedback2.id = data.id;
  558. updateAnswer(feedback2);
  559. } else {
  560. addAnswer(feedback2);
  561. }
  562. });
  563. getAnswer(feedback3).then(response => {
  564. let data = response.data;
  565. feedback3.answer = this.feedbackParams.answer3;
  566. if (data != null) {
  567. feedback3.id = data.id;
  568. updateAnswer(feedback3);
  569. } else {
  570. addAnswer(feedback3);
  571. }
  572. });
  573. let plan = {};
  574. plan.id = this.feedbackDialog.planId;
  575. plan.studyState = 2;
  576. // 修改学习状态为2学员已提交
  577. updatePlan2(plan).then(response => {
  578. // 发送邮件提醒导师
  579. this.feedbackDialog.open = false;
  580. this.msgSuccess("提交成功");
  581. this.getList();
  582. });
  583. },
  584. /** 文件下载处理 */
  585. handleDownload(row) {
  586. var name = row.fileName;
  587. var url = row.fileUrl;
  588. var suffix = url.substring(url.lastIndexOf("."), url.length);
  589. const a = document.createElement('a');
  590. a.setAttribute('download', name);
  591. a.setAttribute('target', '_blank');
  592. a.setAttribute('href', process.env.VUE_APP_BASE_API + url);
  593. a.click();
  594. },
  595. openPdf() {
  596. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  597. },
  598. handleSee(row) {
  599. this.pdf.open = true;
  600. this.pdf.title = row.fileName;
  601. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl;
  602. },
  603. /** 报告附件按钮操作 */
  604. handleDocMentor(row) {
  605. this.docMentor.id = row.id;
  606. this.docMentor.title = row.plantName + this.$t('学习资料');
  607. this.docMentor.open = true;
  608. this.docMentor.queryParams.pId = row.id
  609. this.docMentor.pId = row.id
  610. this.getFileListMentor()
  611. this.$nextTick(() => {
  612. this.$refs.docMentor.clearFiles()
  613. })
  614. },
  615. handleDocSuccessor(row) {
  616. this.docSuccessor.id = row.id;
  617. this.docSuccessor.title = row.plantName + this.$t('学员附件');
  618. this.docSuccessor.open = true;
  619. this.docSuccessor.queryParams.pId = row.id
  620. this.docSuccessor.pId = row.id
  621. this.getFileListSuccessor()
  622. this.$nextTick(() => {
  623. this.$refs.docSuccessor.clearFiles()
  624. })
  625. },
  626. getFileListMentor() {
  627. allFileList(this.docMentor.queryParams).then(response => {
  628. this.docMentor.commonfileList = response;
  629. });
  630. },
  631. getFileListSuccessor() {
  632. allFileList(this.docSuccessor.queryParams).then(response => {
  633. this.docSuccessor.commonfileList = response;
  634. });
  635. },
  636. getFileListFeedback() {
  637. allFileList(this.docFeedback.queryParams).then(response => {
  638. this.docFeedback.commonfileList = response;
  639. });
  640. },
  641. /** 附件上传中处理 */
  642. handleFileDocProgressFeedback(event, file, fileList) {
  643. this.docFeedback.file = file;
  644. this.docFeedback.isUploading = true;
  645. },
  646. handleFileDocProgressMentor(event, file, fileList) {
  647. this.docMentor.file = file;
  648. this.docMentor.isUploading = true;
  649. },
  650. handleFileDocProgressSuccessor(event, file, fileList) {
  651. this.docSuccessor.file = file;
  652. this.docSuccessor.isUploading = true;
  653. },
  654. /** 附件上传成功处理 */
  655. handleFileDocSuccessFeedback(response, file, fileList) {
  656. // this.$refs.docFeedback.clearFiles(); //上传成功之后清除历史记录
  657. this.docFeedback.isUploading = false;
  658. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  659. // this.docFeedback.id = row.id;
  660. // this.docFeedback.queryParams.pId = row.id
  661. // this.docFeedback.pId = row.id
  662. this.getFileListFeedback();
  663. },
  664. handleFileDocSuccessMentor(response, file, fileList) {
  665. this.docMentor.isUploading = false;
  666. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  667. this.getFileListMentor()
  668. },
  669. handleFileDocSuccessSuccessor(response, file, fileList) {
  670. this.docSuccessor.isUploading = false;
  671. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  672. this.getFileListSuccessor()
  673. },
  674. /** 删除按钮操作 */
  675. handleDeleteDocFeedback(row) {
  676. const ids = row.id || this.ids;
  677. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  678. confirmButtonText: this.$t('确定'),
  679. cancelButtonText: this.$t('取消'),
  680. type: "warning"
  681. }).then(function() {
  682. return delCommonfile(ids);
  683. }).then(() => {
  684. this.getFileListFeedback()
  685. this.msgSuccess(this.$t('删除成功'));
  686. })
  687. },
  688. handleDeleteDocMentor(row) {
  689. const ids = row.id || this.ids;
  690. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  691. confirmButtonText: this.$t('确定'),
  692. cancelButtonText: this.$t('取消'),
  693. type: "warning"
  694. }).then(function() {
  695. return delCommonfile(ids);
  696. }).then(() => {
  697. this.getFileListMentor()
  698. this.msgSuccess(this.$t('删除成功'));
  699. })
  700. },
  701. handleDeleteDocSuccessor(row) {
  702. const ids = row.id || this.ids;
  703. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  704. confirmButtonText: this.$t('确定'),
  705. cancelButtonText: this.$t('取消'),
  706. type: "warning"
  707. }).then(function() {
  708. return delCommonfile(ids);
  709. }).then(() => {
  710. this.getFileListSuccessor()
  711. this.msgSuccess(this.$t('删除成功'));
  712. })
  713. },
  714. /** 查询培训计划列表 */
  715. getList() {
  716. this.loading = true;
  717. listPlanByStaffId(this.queryParams).then(response => {
  718. this.planList = response.rows;
  719. this.total = response.total;
  720. this.loading = false;
  721. });
  722. },
  723. /** 查询部门下拉树结构 */
  724. getTreeselect() {
  725. treeselect().then(response => {
  726. this.deptOptions = response.data;
  727. });
  728. },
  729. /** 学习状态字典翻译 */
  730. studyStateFormat(row, column) {
  731. return this.selectDictLabel(this.studyStateOptions, row.studyState);
  732. },
  733. /** 取消按钮 */
  734. cancel() {
  735. this.open = false;
  736. this.reset();
  737. },
  738. /** 表单重置 */
  739. reset() {
  740. this.form = {
  741. id: null,
  742. staffId: null,
  743. plantName: null,
  744. delFlag: null,
  745. createrCode: null,
  746. createdate: null,
  747. updaterCode: null,
  748. updatedate: null,
  749. deptId: null,
  750. startDate: null,
  751. endDate: null,
  752. classHour: null,
  753. classContent: null,
  754. studyState: null
  755. };
  756. this.resetForm("form");
  757. },
  758. /** 搜索按钮操作 */
  759. handleQuery() {
  760. this.queryParams.pageNum = 1;
  761. this.getList();
  762. },
  763. /** 重置按钮操作 */
  764. resetQuery() {
  765. this.resetForm("queryForm");
  766. this.handleQuery();
  767. },
  768. /** 多选框选中数据 */
  769. handleSelectionChange(selection) {
  770. this.ids = selection.map(item => item.id)
  771. this.single = selection.length!==1
  772. this.multiple = !selection.length
  773. this.dataListSelections = selection
  774. },
  775. /** 新增按钮操作 */
  776. handleAdd() {
  777. this.reset();
  778. this.open = true;
  779. this.title = "添加培养计划";
  780. this.operation = "add";
  781. },
  782. /** 修改按钮操作 */
  783. handleUpdate(row) {
  784. this.reset();
  785. const id = row.id || this.ids
  786. getPlan(id).then(response => {
  787. this.form = response.data;
  788. this.open = true;
  789. this.title = "修改培养计划";
  790. this.operation = "modify";
  791. });
  792. },
  793. /** 提交按钮 */
  794. submitForm() {
  795. this.$refs["form"].validate(valid => {
  796. if (valid) {
  797. if (this.form.id != null) {
  798. updatePlan(this.form).then(response => {
  799. this.msgSuccess("修改成功");
  800. this.open = false;
  801. this.getList();
  802. });
  803. } else {
  804. addPlan(this.form).then(response => {
  805. this.msgSuccess("新增成功");
  806. this.open = false;
  807. this.getList();
  808. });
  809. }
  810. }
  811. });
  812. },
  813. /** 删除按钮操作 */
  814. handleDelete(row) {
  815. const ids = row.id || this.ids;
  816. this.$confirm('是否确认删除?', "警告", {
  817. confirmButtonText: "确定",
  818. cancelButtonText: "取消",
  819. type: "warning"
  820. }).then(function() {
  821. return delPlan(ids);
  822. }).then(() => {
  823. this.getList();
  824. this.msgSuccess("删除成功");
  825. })
  826. },
  827. /** 导出按钮操作 */
  828. handleExport() {
  829. const queryParams = this.queryParams;
  830. this.$confirm('是否确认导出所有培养计划数据项?', "警告", {
  831. confirmButtonText: "确定",
  832. cancelButtonText: "取消",
  833. type: "warning"
  834. }).then(function() {
  835. return exportPlan(queryParams);
  836. }).then(response => {
  837. this.download(response.msg);
  838. })
  839. },
  840. /** 导入按钮操作 */
  841. handleImport() {
  842. this.upload.title = "用户导入";
  843. this.upload.open = true;
  844. },
  845. /** 下载模板操作 */
  846. importTemplate() {
  847. importTemplate().then(response => {
  848. this.download(response.msg);
  849. });
  850. },
  851. /** 文件上传中处理 */
  852. handleFileUploadProgress(event, file, fileList) {
  853. this.upload.isUploading = true;
  854. },
  855. /** 文件上传成功处理 */
  856. handleFileSuccess(response, file, fileList) {
  857. this.upload.open = false;
  858. this.upload.isUploading = false;
  859. this.$refs.upload.clearFiles();
  860. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  861. this.getList();
  862. },
  863. /** 提交上传文件 */
  864. submitFileForm() {
  865. this.$refs.upload.submit();
  866. },
  867. }
  868. };
  869. </script>