index.vue 30 KB

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