index.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959
  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="$t('姓名')" prop="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. :placeholder="$t('请输入') + $t('姓名')"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item :label="$t('班组')" prop="classes">
  14. <el-select v-model="queryParams.classes" :placeholder="$t('请选择') + $t('班组')" clearable size="small">
  15. <el-option
  16. v-for="dict in classesOptions"
  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="$t('裂解')" prop="boiler" label-width="50">
  24. <el-checkbox v-model="queryParams.boiler"></el-checkbox>
  25. </el-form-item>
  26. <el-form-item :label="$t('压缩')" prop="cracking" label-width="50">
  27. <el-checkbox v-model="queryParams.cracking"></el-checkbox>
  28. </el-form-item>
  29. <el-form-item :label="$t('分离')" prop="hotarea" label-width="50">
  30. <el-checkbox v-model="queryParams.hotarea"></el-checkbox>
  31. </el-form-item>
  32. <el-form-item label="PGU/AEU" prop="coldarea" label-width="50">
  33. <el-checkbox v-model="queryParams.coldarea"></el-checkbox>
  34. </el-form-item>
  35. <el-form-item :label="$t('无')+$t('空格')+$t('上岗证')" prop="notHave" label-width="50">
  36. <el-checkbox v-model="queryParams.notHave"></el-checkbox>
  37. </el-form-item>
  38. <el-form-item :label="$t('证书有效期即将到期')" prop="expiring" label-width="50">
  39. <el-checkbox v-model="queryParams.expiring"></el-checkbox>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  43. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  44. </el-form-item>
  45. </el-form>
  46. <el-row :gutter="10" class="mb8">
  47. <el-col :span="1.5">
  48. <el-button
  49. type="primary"
  50. icon="el-icon-plus"
  51. size="mini"
  52. @click="handleAdd"
  53. v-hasPermi="['training:worklicense:add']"
  54. >{{ $t('新增') }}</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="success"
  59. icon="el-icon-edit"
  60. size="mini"
  61. :disabled="single"
  62. @click="handleUpdate"
  63. v-hasPermi="['training:worklicense:edit']"
  64. >{{ $t('修改') }}</el-button>
  65. </el-col>
  66. <el-col :span="1.5">
  67. <el-button
  68. type="danger"
  69. icon="el-icon-delete"
  70. size="mini"
  71. :disabled="multiple"
  72. @click="handleDelete"
  73. v-hasPermi="['training:worklicense:remove']"
  74. >{{ $t('删除') }}</el-button>
  75. </el-col>
  76. <!-- <el-col :span="1.5">-->
  77. <!-- <el-button-->
  78. <!-- type="info"-->
  79. <!-- icon="el-icon-upload2"-->
  80. <!-- size="mini"-->
  81. <!-- @click="handleImport"-->
  82. <!-- v-hasPermi="['training:worklicense:edit']"-->
  83. <!-- >{{ $t('导入') }}</el-button>-->
  84. <!-- </el-col>-->
  85. <el-col :span="1.5">
  86. <el-button
  87. type="warning"
  88. icon="el-icon-download"
  89. size="mini"
  90. @click="handleExport"
  91. v-hasPermi="['training:worklicense:export']"
  92. >{{ $t('导出') }}</el-button>
  93. </el-col>
  94. <el-col :span="1.5">
  95. <el-button
  96. type="primary"
  97. icon="el-icon-s-data"
  98. size="mini"
  99. @click="handleData"
  100. >{{ $t('数据分析') }}</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="worklicenseList" @selection-change="handleSelectionChange" :cell-class-name="tableCellClassName" :height="clientHeight" border>
  105. <el-table-column type="selection" width="55" align="center" />
  106. <el-table-column :label="$t('姓名')" align="center" prop="name" :show-overflow-tooltip="true"/>
  107. <el-table-column :label="$t('员工号')" align="center" prop="employeeid" :show-overflow-tooltip="true"/>
  108. <el-table-column :label="$t('班组')" align="center" prop="classes" :formatter="classesFormat" />
  109. <el-table-column :label="$t('职务')" align="center" prop="post" width="150" :formatter="actualpostFormat"/>
  110. <el-table-column :label="$t('证件类型')" align="center" prop="idtype" :show-overflow-tooltip="true"/>
  111. <el-table-column :label="$t('证件号')" align="center" prop="crackingIdnum" width="150" :show-overflow-tooltip="true"/>
  112. <el-table-column :label="$t('裂解')" align="center" prop="boiler" :formatter="boilerFormat">
  113. <template slot-scope="scope">
  114. <span> {{boilerFormat(scope.row)}}</span>
  115. <el-button v-if="boilerFormat(scope.row) == 'YES'" icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'worklicense-boiler')" circle></el-button>
  116. </template>
  117. </el-table-column>
  118. <el-table-column :label="$t('压缩')" align="center" prop="cracking" :formatter="crackingFormat">
  119. <template slot-scope="scope">
  120. <span> {{crackingFormat(scope.row)}}</span>
  121. <el-button v-if="crackingFormat(scope.row) == 'YES'" icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'worklicense-compression')" circle></el-button>
  122. </template>
  123. </el-table-column>
  124. <el-table-column :label="$t('分离')" align="center" prop="hotarea" :formatter="hotareaFormat">
  125. <template slot-scope="scope">
  126. <span> {{hotareaFormat(scope.row)}}</span>
  127. <el-button v-if="hotareaFormat(scope.row) == 'YES'" icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'worklicense-separation')" circle></el-button>
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="PGU/AEU" align="center" prop="coldarea" width="100" :formatter="coldareaFormat">
  131. <template slot-scope="scope">
  132. <span> {{coldareaFormat(scope.row)}}</span>
  133. <el-button v-if="coldareaFormat(scope.row) == 'YES'" icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'worklicense-pguaeu')" circle></el-button>
  134. </template>
  135. </el-table-column>
  136. <el-table-column :label="$t('取复证日期')" align="center" prop="recertificatedate" width="100">
  137. <template slot-scope="scope">
  138. <span>{{ parseTime(scope.row.recertificatedate, '{y}-{m}-{d}') }}</span>
  139. </template>
  140. </el-table-column>
  141. <el-table-column :label="$t('证书有效期')" align="center" prop="validity" width="100">
  142. <template slot-scope="scope">
  143. <span>{{ parseTime(scope.row.validity, '{y}-{m}-{d}') }}</span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  147. <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" 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="handleUpdate(scope.row)"
  154. v-hasPermi="['training:worklicense:edit']"
  155. >{{ $t('修改') }}</el-button>
  156. <el-button
  157. size="mini"
  158. type="text"
  159. icon="el-icon-delete"
  160. @click="handleDelete(scope.row)"
  161. v-hasPermi="['training:worklicense:remove']"
  162. >{{ $t('删除') }}</el-button>
  163. </template>
  164. </el-table-column>
  165. </el-table>
  166. <pagination
  167. v-show="total>0"
  168. :total="total"
  169. :page.sync="queryParams.pageNum"
  170. :limit.sync="queryParams.pageSize"
  171. @pagination="getList"
  172. />
  173. <!-- 添加或修改上岗证一览对话框 -->
  174. <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="800px" append-to-body>
  175. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  176. <el-form-item :label="$t('装置名称')" prop="plantCode">
  177. <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置名称')">
  178. <el-option
  179. v-for="dict in plantCodeOptions"
  180. :key="dict.dictValue"
  181. :label="dict.dictLabel"
  182. :value="dict.dictValue"
  183. ></el-option>
  184. </el-select>
  185. </el-form-item>
  186. <el-form-item :label="$t('姓名')" prop="name">
  187. <el-input v-model="form.name" :placeholder="$t('请输入') + $t('姓名')" />
  188. </el-form-item>
  189. <el-form-item :label="$t('员工号')" prop="employeeid">
  190. <el-input v-model="form.employeeid" :placeholder="$t('请输入') + $t('员工号')" />
  191. </el-form-item>
  192. <el-form-item :label="$t('班组')" prop="classes">
  193. <el-select v-model="form.classes" :placeholder="$t('请选择') + $t('班组')">
  194. <el-option
  195. v-for="dict in classesOptions"
  196. :key="dict.dictValue"
  197. :label="dict.dictLabel"
  198. :value="dict.dictValue"
  199. ></el-option>
  200. </el-select>
  201. </el-form-item>
  202. <el-form-item :label="$t('职务')" prop="post">
  203. <el-select v-model="form.post" :placeholder="$t('请选择') + $t('职务')">
  204. <el-option
  205. v-for="dict in actualpostOptions"
  206. :key="dict.dictValue"
  207. :label="dict.dictLabel"
  208. :value="dict.dictValue"
  209. ></el-option>
  210. </el-select>
  211. </el-form-item>
  212. <el-form-item :label="$t('证件类型')" prop="idtype">
  213. <el-input v-model="form.idtype" :placeholder="$t('请输入') + $t('证件类型')" />
  214. </el-form-item>
  215. <el-form-item :label="$t('证件号')" prop="crackingIdnum">
  216. <el-input v-model="form.crackingIdnum" :placeholder="$t('请输入') +$t('证件号') " />
  217. </el-form-item>
  218. <el-row>
  219. <el-col :span="6">
  220. <el-form-item :label="$t('裂解')" prop="boiler">
  221. <el-checkbox v-model="form.boiler" @change="changeBoiler()"></el-checkbox>
  222. </el-form-item>
  223. </el-col>
  224. <el-col :span="6">
  225. <el-form-item :label="$t('压缩')" prop="cracking">
  226. <el-checkbox v-model="form.cracking" @change="changeCracking()"></el-checkbox>
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="6">
  230. <el-form-item :label="$t('分离')" prop="hotarea">
  231. <el-checkbox v-model="form.hotarea" @change="changeHotarea()"></el-checkbox>
  232. </el-form-item>
  233. </el-col>
  234. <el-col :span="6">
  235. <el-form-item label="PGU/AEU" prop="coldarea">
  236. <el-checkbox v-model="form.coldarea" @change="changeColdarea()"></el-checkbox>
  237. </el-form-item>
  238. </el-col>
  239. </el-row>
  240. <el-form-item :label="$t('取复证日期')" prop="recertificatedate">
  241. <el-date-picker clearable size="small" style="width: 200px"
  242. v-model="form.recertificatedate"
  243. type="date"
  244. value-format="yyyy-MM-dd"
  245. :placeholder="$t('请选择') + $t('取复证日期')">
  246. </el-date-picker>
  247. </el-form-item>
  248. <el-form-item :label="$t('证书有效期')" prop="validity">
  249. <el-date-picker clearable size="small" style="width: 200px"
  250. v-model="form.validity"
  251. type="date"
  252. value-format="yyyy-MM-dd"
  253. :placeholder="$t('请选择') + $t('证书有效期')">
  254. </el-date-picker>
  255. </el-form-item>
  256. <el-form-item :label="$t('备注')" prop="remarks">
  257. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  258. </el-form-item>
  259. <el-form-item :label="$t('归属部门')" prop="deptId">
  260. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  261. </el-form-item>
  262. </el-form>
  263. <div slot="footer" class="dialog-footer">
  264. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  265. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  266. </div>
  267. </el-dialog>
  268. <!-- 用户导入对话框 -->
  269. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  270. <el-upload
  271. ref="upload"
  272. :limit="1"
  273. accept=".xlsx, .xls"
  274. :headers="upload.headers"
  275. :action="upload.url"
  276. :disabled="upload.isUploading"
  277. :on-progress="handleFileUploadProgress"
  278. :on-success="handleFileSuccess"
  279. :auto-upload="false"
  280. drag
  281. >
  282. <i class="el-icon-upload"></i>
  283. <div class="el-upload__text">
  284. {{ $t('将文件拖到此处,或') }}
  285. <em>{{ $t('点击上传') }}</em>
  286. </div>
  287. <div class="el-upload__tip" slot="tip">
  288. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  289. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  290. </div>
  291. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  292. <input name="type" :value="upload.type" hidden />
  293. </form>
  294. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  295. </el-upload>
  296. <div slot="footer" class="dialog-footer">
  297. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  298. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  299. </div>
  300. </el-dialog>
  301. <!-- 报告附件对话框 -->
  302. <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px" append-to-body >
  303. <el-upload v-hasPermi="['training:trainingrecords:file']"
  304. ref="doc"
  305. :limit="50"
  306. :headers="doc.headers"
  307. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  308. :disabled="doc.isUploading"
  309. :on-progress="handleFileDocProgress"
  310. :on-success="handleFileDocSuccess"
  311. :auto-upload="true"
  312. drag
  313. >
  314. <i class="el-icon-upload"></i>
  315. <div class="el-upload__text">
  316. {{ $t('将文件拖到此处,或') }}
  317. <em>{{ $t('点击上传') }}</em>
  318. </div>
  319. </el-upload>
  320. <el-table :data="doc.commonfileList" border>
  321. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  322. <template slot-scope="scope">
  323. <a class="link-type" @click="handleDownload(scope.row)">
  324. <span>{{ scope.row.fileName }}</span>
  325. </a>
  326. </template>
  327. </el-table-column>
  328. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  329. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  330. <!-- <el-table-column :label="$t('培训日期')" align="center" prop="pDate" width="150">-->
  331. <!-- <template slot-scope="scope">-->
  332. <!-- <el-date-picker-->
  333. <!-- v-if="scope.row.isEdit"-->
  334. <!-- v-model="scope.row.pDate"-->
  335. <!-- type="date"-->
  336. <!-- value-format="yyyy-MM-dd"-->
  337. <!-- placeholder="日期">-->
  338. <!-- </el-date-picker>-->
  339. <!-- <span v-else>{{ parseTime(scope.row.pDate, '{y}-{m}-{d}') }}</span>-->
  340. <!-- </template>-->
  341. <!-- </el-table-column>-->
  342. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  343. <template slot-scope="scope">
  344. <el-button
  345. v-if="scope.row.fileName.endsWith('pdf')"
  346. size="mini"
  347. type="text"
  348. icon="el-icon-view"
  349. @click="handleSee(scope.row)"
  350. >{{ $t('预览') }}</el-button>
  351. <el-button v-hasPermi="['training:trainingrecords:file']" type="text" size="small" v-if="scope.row.isEdit" @click="save(scope.row)">保存</el-button>
  352. <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">取消</el-button>
  353. <!-- <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>-->
  354. <el-button
  355. size="mini"
  356. type="text"
  357. icon="el-icon-download"
  358. @click="handleDownload(scope.row)"
  359. >{{ $t('下载') }}</el-button>
  360. <el-button
  361. size="mini"
  362. type="text"
  363. icon="el-icon-delete"
  364. @click="handleDeleteDoc(scope.row)"
  365. v-hasPermi="['training:trainingrecords:file']"
  366. >{{ $t('删除') }}</el-button>
  367. </template>
  368. </el-table-column>
  369. </el-table>
  370. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  371. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  372. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  373. <div style="margin-top: -30px">
  374. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  375. </div>
  376. </el-dialog>
  377. <div slot="footer" class="dialog-footer">
  378. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  379. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  380. </div>
  381. </el-dialog>
  382. <el-drawer
  383. :title="$t('数据分析')"
  384. size="600px"
  385. :visible.sync="drawer"
  386. :direction="direction">
  387. <el-row>
  388. <el-col>
  389. <el-card class="box-card" shadow="hover">
  390. <div slot="header" class="clearfix">
  391. <span>{{$t('上岗证')+$t('空格')+ $t('统计') }}</span>
  392. </div>
  393. <div class="text item">
  394. <license-data></license-data>
  395. </div>
  396. </el-card>
  397. </el-col>
  398. </el-row>
  399. </el-drawer>
  400. </div>
  401. </template>
  402. <script>
  403. import { listWorklicense, getWorklicense, delWorklicense, addWorklicense, updateWorklicense, exportWorklicense } from "@/api/training/worklicense";
  404. import { treeselect } from "@/api/system/dept";
  405. import { getToken } from "@/utils/auth";
  406. import Treeselect from "@riophae/vue-treeselect";
  407. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  408. import LicenseData from "./licenseData";
  409. import {addCommonfile, allFileList, delCommonfile, updateCommonfile} from "@/api/common/commonfile";
  410. export default {
  411. name: "Worklicense",
  412. components: {LicenseData, Treeselect},
  413. data() {
  414. return {
  415. drawer: false,
  416. direction: 'rtl',
  417. // 遮罩层
  418. loading: true,
  419. // 选中数组
  420. ids: [],
  421. // 非单个禁用
  422. single: true,
  423. // 非多个禁用
  424. multiple: true,
  425. // 显示搜索条件
  426. showSearch: false,
  427. // 总条数
  428. total: 0,
  429. // 上岗证一览表格数据
  430. worklicenseList: [],
  431. // 弹出层标题
  432. title: "",
  433. // 部门树选项
  434. deptOptions: undefined,
  435. clientHeight:300,
  436. // 是否显示弹出层
  437. open: false,
  438. // 装置名称字典
  439. plantCodeOptions: [],
  440. // 班组字典
  441. classesOptions: [],
  442. // 职务字典
  443. actualpostOptions: [],
  444. // 裂解字典
  445. boilerOptions: [],
  446. // 压缩字典
  447. crackingOptions: [],
  448. // 分离字典
  449. hotareaOptions: [],
  450. // PGU/AEU字典
  451. coldareaOptions: [],
  452. // 用户导入参数
  453. upload: {
  454. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  455. //下载模板类型
  456. type: "worklicense",
  457. // 是否显示弹出层(用户导入)
  458. open: false,
  459. // 弹出层标题(用户导入)
  460. title: "",
  461. // 是否禁用上传
  462. isUploading: false,
  463. // 是否更新已经存在的用户数据
  464. updateSupport: 0,
  465. // 设置上传的请求头部
  466. headers: { Authorization: "Bearer " + getToken() },
  467. // 上传的地址
  468. url: process.env.VUE_APP_BASE_API + "/training/worklicense/importData"
  469. },
  470. // 报告附件参数
  471. doc: {
  472. file: "",
  473. // 是否显示弹出层(报告附件)
  474. open: false,
  475. // 弹出层标题(报告附件)
  476. title: "附件",
  477. // 是否禁用上传
  478. isUploading: false,
  479. // 是否更新已经存在的用户数据
  480. updateSupport: 0,
  481. // 报告附件上传位置编号
  482. ids: 0,
  483. // 设置上传的请求头部
  484. headers: { Authorization: "Bearer " + getToken() },
  485. // 上传的地址
  486. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  487. commonfileList: null,
  488. queryParams: {
  489. pId: null,
  490. pType: 'traning'
  491. },
  492. pType: 'traning',
  493. pId: null,
  494. form: {}
  495. },
  496. pdf : {
  497. title: '',
  498. pdfUrl: '',
  499. numPages: null,
  500. open: false,
  501. pageNum: 1,
  502. pageTotalNum: 1,
  503. loadedRatio: 0,
  504. },
  505. // 查询参数
  506. queryParams: {
  507. pageNum: 1,
  508. pageSize: 20,
  509. name: null,
  510. classes: null,
  511. boiler: null,
  512. cracking: null,
  513. hotarea: null,
  514. coldarea: null,
  515. notHave: null,
  516. expiring: null
  517. },
  518. // 表单参数
  519. form: {},
  520. // 表单校验
  521. rules: {
  522. plantCode: [
  523. { required: true, message: this.$t('装置名称')+this.$t('不能为空'), trigger: "change" }
  524. ],
  525. deptId: [
  526. { required: true, message: this.$t('部门编号')+this.$t('不能为空'), trigger: "blur" }
  527. ]
  528. },
  529. //是否填写证件号
  530. boilerDisplay: false,
  531. compressionDisplay: false,
  532. separationDisplay: false,
  533. pguaeuDisplay: false,
  534. };
  535. },
  536. watch: {
  537. // 根据名称筛选部门树
  538. deptName(val) {
  539. this.$refs.tree.filter(val);
  540. }
  541. },
  542. created() {
  543. //设置表格高度对应屏幕高度
  544. this.$nextTick(() => {
  545. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  546. })
  547. this.getList();
  548. this.getTreeselect();
  549. this.getDicts("PLANT_DIVIDE").then(response => {
  550. this.plantCodeOptions = response.data;
  551. });
  552. this.getDicts("TEAM_DIVIDE").then(response => {
  553. this.classesOptions = response.data;
  554. });
  555. this.getDicts("ACTUALPOST").then(response => {
  556. this.actualpostOptions = response.data;
  557. });
  558. this.getDicts("YES_NO_EN").then(response => {
  559. this.boilerOptions = response.data;
  560. });
  561. this.getDicts("YES_NO_EN").then(response => {
  562. this.crackingOptions = response.data;
  563. });
  564. this.getDicts("YES_NO_EN").then(response => {
  565. this.hotareaOptions = response.data;
  566. });
  567. this.getDicts("YES_NO_EN").then(response => {
  568. this.coldareaOptions = response.data;
  569. });
  570. },
  571. methods: {
  572. /** 查询上岗证一览列表 */
  573. getList() {
  574. this.loading = true;
  575. listWorklicense(this.queryParams).then(response => {
  576. this.worklicenseList = response.rows;
  577. this.total = response.total;
  578. this.loading = false;
  579. });
  580. },
  581. //根据分数显示颜色提示
  582. tableCellClassName({ row, column, rowIndex, columnIndex }) {
  583. if (columnIndex == 12) {
  584. return this.changeColor(row.validity)
  585. }
  586. },
  587. changeColor (value) {
  588. var timeInterval = Date.parse(value) - Date.parse(new Date());
  589. if (timeInterval <= 182 * 24 * 3600 * 1000) {
  590. return 'cellCare'
  591. }
  592. },
  593. /** 查询部门下拉树结构 */
  594. getTreeselect() {
  595. treeselect().then(response => {
  596. this.deptOptions = response.data;
  597. });
  598. },
  599. // 装置名称字典翻译
  600. plantCodeFormat(row, column) {
  601. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  602. },
  603. // 班组字典翻译
  604. classesFormat(row, column) {
  605. return this.selectDictLabel(this.classesOptions, row.classes);
  606. },
  607. // 职务字典翻译
  608. actualpostFormat(row, column) {
  609. return this.selectDictLabel(this.actualpostOptions, row.post);
  610. },
  611. // 裂解字典翻译
  612. boilerFormat(row, column) {
  613. return this.selectDictLabel(this.boilerOptions, row.boiler);
  614. },
  615. // 压缩字典翻译
  616. crackingFormat(row, column) {
  617. return this.selectDictLabel(this.crackingOptions, row.cracking);
  618. },
  619. // 分离字典翻译
  620. hotareaFormat(row, column) {
  621. return this.selectDictLabel(this.hotareaOptions, row.hotarea);
  622. },
  623. // PGU/AEU字典翻译
  624. coldareaFormat(row, column) {
  625. return this.selectDictLabel(this.coldareaOptions, row.coldarea);
  626. },
  627. // 取消按钮
  628. cancel() {
  629. this.open = false;
  630. this.reset();
  631. },
  632. // 表单重置
  633. reset() {
  634. this.form = {
  635. id: null,
  636. plantCode: null,
  637. name: null,
  638. employeeid: null,
  639. classes: null,
  640. post: null,
  641. idtype: null,
  642. crackingIdnum: null,
  643. boiler: null,
  644. cracking: null,
  645. hotarea: null,
  646. coldarea: null,
  647. aromatic: null,
  648. recertificatedate: null,
  649. validity: null,
  650. delFlag: null,
  651. createrCode: null,
  652. createdate: null,
  653. updaterCode: null,
  654. updatedate: null,
  655. remarks: null,
  656. deptId: null,
  657. separationIdnum: null,
  658. compressionIdnum: null,
  659. pguaeuIdnum: null,
  660. separationDate: null,
  661. compressionDate: null,
  662. pguaeuDate: null,
  663. crackingDate: null
  664. };
  665. this.resetForm("form");
  666. },
  667. /** 搜索按钮操作 */
  668. handleQuery() {
  669. this.queryParams.pageNum = 1;
  670. this.getList();
  671. },
  672. /** 重置按钮操作 */
  673. resetQuery() {
  674. this.resetForm("queryForm");
  675. this.handleQuery();
  676. },
  677. // 多选框选中数据
  678. handleSelectionChange(selection) {
  679. this.ids = selection.map(item => item.id)
  680. this.single = selection.length!==1
  681. this.multiple = !selection.length
  682. },
  683. /** 新增按钮操作 */
  684. handleAdd() {
  685. this.reset();
  686. this.open = true;
  687. this.title = this.$t('新增') + this.$t('空格') + this.$t('上岗证一览表');
  688. },
  689. /** 修改按钮操作 */
  690. handleUpdate(row) {
  691. this.reset();
  692. const id = row.id || this.ids
  693. getWorklicense(id).then(response => {
  694. this.form = response.data;
  695. if (response.data.boiler == 1) { this.form.boiler = true; this.boilerDisplay = true }
  696. if (response.data.boiler == 0) { this.form.boiler = false; this.boilerDisplay = false }
  697. if (response.data.cracking == 1) { this.form.cracking = true; this.compressionDisplay = true }
  698. if (response.data.cracking == 0) { this.form.cracking = false; this.compressionDisplay = false }
  699. if (response.data.hotarea == 1) { this.form.hotarea = true; this.separationDisplay = true }
  700. if (response.data.hotarea == 0) { this.form.hotarea = false; this.separationDisplay = false }
  701. if (response.data.coldarea == 1) { this.form.coldarea = true; this.pguaeuDisplay = true }
  702. if (response.data.coldarea == 0) { this.form.coldarea = false; this.pguaeuDisplay = false }
  703. this.open = true;
  704. this.title = this.$t('修改') + this.$t('上岗证一览表');
  705. });
  706. },
  707. /** 提交按钮 */
  708. submitForm() {
  709. this.$refs["form"].validate(valid => {
  710. if (valid) {
  711. if (this.form.id != null) {
  712. updateWorklicense(this.form).then(response => {
  713. this.msgSuccess(this.$t('修改成功'));
  714. this.open = false;
  715. this.getList();
  716. });
  717. } else {
  718. addWorklicense(this.form).then(response => {
  719. this.msgSuccess(this.$t('新增成功'));
  720. this.open = false;
  721. this.getList();
  722. });
  723. }
  724. }
  725. });
  726. },
  727. /** 删除按钮操作 */
  728. handleDelete(row) {
  729. const ids = row.id || this.ids;
  730. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  731. confirmButtonText: this.$t('确定'),
  732. cancelButtonText: this.$t('取消'),
  733. type: "warning"
  734. }).then(function() {
  735. return delWorklicense(ids);
  736. }).then(() => {
  737. this.getList();
  738. this.msgSuccess(this.$t('删除成功'));
  739. })
  740. },
  741. /** 导出按钮操作 */
  742. handleExport() {
  743. const queryParams = this.queryParams;
  744. this.$confirm(this.$t('是否确认导出所有上岗证一览数据项?'), this.$t('警告'), {
  745. confirmButtonText: this.$t('确定'),
  746. cancelButtonText: this.$t('取消'),
  747. type: "warning"
  748. }).then(function() {
  749. return exportWorklicense(queryParams);
  750. }).then(response => {
  751. this.download(response.msg);
  752. })
  753. },
  754. /** 导入按钮操作 */
  755. handleImport() {
  756. this.upload.title = this.$t('用户导入');
  757. this.upload.open = true;
  758. },
  759. /** 下载模板操作 */
  760. importTemplate() {
  761. this.$refs['downloadFileForm'].submit()
  762. },
  763. // 文件上传中处理
  764. handleFileUploadProgress(event, file, fileList) {
  765. this.upload.isUploading = true;
  766. },
  767. // 文件上传成功处理
  768. handleFileSuccess(response, file, fileList) {
  769. this.upload.open = false;
  770. this.upload.isUploading = false;
  771. this.$refs.upload.clearFiles();
  772. if (response.data[0] != null) {
  773. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  774. }else {
  775. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  776. }
  777. this.getList();
  778. },
  779. // 提交上传文件
  780. submitFileForm() {
  781. this.$refs.upload.submit();
  782. },
  783. //数据分析
  784. handleData(){
  785. this.drawer = true
  786. },
  787. //裂解修改
  788. changeBoiler() {
  789. if (this.form.boiler === true) {
  790. this.boilerDisplay = true
  791. }else {
  792. this.boilerDisplay = false
  793. }
  794. },
  795. //压缩修改
  796. changeCracking() {
  797. if (this.form.cracking === true) {
  798. this.compressionDisplay = true
  799. }else {
  800. this.compressionDisplay = false
  801. }
  802. },
  803. //分离修改
  804. changeHotarea() {
  805. if (this.form.hotarea === true) {
  806. this.separationDisplay = true
  807. }else {
  808. this.separationDisplay = false
  809. }
  810. },
  811. //PGU/AEU修改
  812. changeColdarea() {
  813. if (this.form.coldarea === true) {
  814. this.pguaeuDisplay = true
  815. }else {
  816. this.pguaeuDisplay = false
  817. }
  818. },
  819. /** 报告附件按钮操作 */
  820. handleDoc(row , fileType) {
  821. var workType = "";
  822. if (fileType === "worklicense-boiler"){
  823. workType = this.$t('裂解');
  824. }else if (fileType === "worklicense-compression"){
  825. workType = this.$t('压缩');
  826. }else if (fileType === "worklicense-separation"){
  827. workType = this.$t('分离');
  828. }else if (fileType === "worklicense-pguaeu"){
  829. workType = "PGU/AEU";
  830. }
  831. this.doc.pType = fileType
  832. this.doc.queryParams.pType = fileType
  833. this.doc.id = row.id;
  834. this.doc.title = row.name + this.$t('的')+ this.$t('空格') + workType+ this.$t('空格') + this.$t('上岗证')+ this.$t('空格')+ this.$t('附件') ;
  835. this.doc.open = true;
  836. this.doc.queryParams.pId = row.id
  837. this.doc.pId = row.id
  838. this.getFileList()
  839. /*this.$nextTick(() => {
  840. this.$refs.doc.clearFiles()
  841. })*/
  842. },
  843. getFileList (){
  844. allFileList(this.doc.queryParams).then(response => {
  845. response.forEach(element => {
  846. element["isEdit"] = false
  847. });
  848. response.forEach(element => {
  849. element["isAdd"] = false
  850. });
  851. this.doc.commonfileList = response;
  852. });
  853. },
  854. //附件上传中处理
  855. handleFileDocProgress(event, file, fileList) {
  856. this.doc.file = file;
  857. this.doc.isUploading = true;
  858. },
  859. //附件上传成功处理
  860. handleFileDocSuccess(response, file, fileList) {
  861. this.doc.isUploading = false;
  862. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  863. this.getFileList()
  864. },
  865. // 文件下载处理
  866. handleDownload(row) {
  867. var name = row.fileName;
  868. var url = row.fileUrl;
  869. var suffix = url.substring(url.lastIndexOf("."), url.length);
  870. const a = document.createElement('a')
  871. a.setAttribute('download', name)
  872. a.setAttribute('target', '_blank')
  873. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  874. a.click()
  875. },
  876. openPdf(){
  877. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  878. },
  879. handleSee (row){
  880. // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
  881. this.pdf.open =true
  882. this.pdf.title = row.fileName
  883. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  884. },
  885. // 上一页
  886. prePage() {
  887. let page = this.pdf.pageNum
  888. page = page > 1 ? page - 1 : this.pdf.pageTotalNum
  889. this.pdf.pageNum = page
  890. },
  891. // 下一页
  892. nextPage() {
  893. let page = this.pdf.pageNum
  894. page = page < this.pdf.pageTotalNum ? page + 1 : 1
  895. this.pdf.pageNum = page
  896. },
  897. // 取消
  898. cancelFile(row, index) {
  899. // 如果是新增的数据
  900. if (row.isAdd) {
  901. this.doc.commonfileList.splice(index, 1)
  902. } else {
  903. // 不是新增的数据 还原数据
  904. for (const i in row.oldRow) {
  905. row[i] = row.oldRow[i]
  906. }
  907. row.isEdit = false
  908. }
  909. },
  910. edit(row) {
  911. // 备份原始数据
  912. row['oldRow'] = JSON.parse(JSON.stringify(row));
  913. this.$nextTick(() => {
  914. row.isEdit = true;
  915. })
  916. },
  917. save(row) {
  918. row.isEdit = false;
  919. var that = this;
  920. that.loading = true;
  921. this.form = row;
  922. if (row.isAdd == true) {
  923. addCommonfile(this.form).then(response => {
  924. this.msgSuccess(this.$t('新增成功'));
  925. this.open = false;
  926. this.getList();
  927. });
  928. }else {
  929. updateCommonfile(this.form).then(response => {
  930. this.msgSuccess(this.$t('修改成功'));
  931. this.open = false;
  932. this.getList();
  933. });
  934. }
  935. },
  936. /** 删除按钮操作 */
  937. handleDeleteDoc(row) {
  938. const ids = row.id || this.ids;
  939. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  940. confirmButtonText: this.$t('确定'),
  941. cancelButtonText: this.$t('取消'),
  942. type: "warning"
  943. }).then(function() {
  944. return delCommonfile(ids);
  945. }).then(() => {
  946. this.getFileList()
  947. this.msgSuccess(this.$t('删除成功'));
  948. })
  949. },
  950. }
  951. };
  952. </script>