index.vue 30 KB

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