index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  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. @input="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item :label="$t('班组')" prop="classes">
  14. <el-select v-model="queryParams.classes" @change="handleQuery" :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" @change="handleQuery" ></el-checkbox>
  25. </el-form-item>
  26. <el-form-item :label="$t('压力容器')" prop="container" label-width="50">
  27. <el-checkbox v-model="queryParams.container" @change="handleQuery" ></el-checkbox>
  28. </el-form-item>
  29. <el-form-item :label="$t('压力管道')" prop="pipe" label-width="50">
  30. <el-checkbox v-model="queryParams.pipe" @change="handleQuery" ></el-checkbox>
  31. </el-form-item>
  32. <el-form-item label="烷基化" prop="alkylation" label-width="50">
  33. <el-checkbox v-model="queryParams.alkylation" @change="handleQuery" ></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" @change="handleQuery" ></el-checkbox>
  37. </el-form-item>
  38. <el-form-item :label="$t('证书有效期即将到期')" prop="expiring" label-width="50">
  39. <el-checkbox v-model="queryParams.expiring" @change="handleQuery" ></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:byxWorklicense: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:byxWorklicense: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:byxWorklicense: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:byxWorklicense: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:byxWorklicense: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="containerIdnum" 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="container" :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="pipe" :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="烷基化" align="center" prop="alkylation" 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:byxWorklicense: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:byxWorklicense: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="containerIdnum">
  216. <el-input v-model="form.containerIdnum" :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="container">
  226. <el-checkbox v-model="form.container" @change="changeCracking()"></el-checkbox>
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="6">
  230. <el-form-item :label="$t('压力管道')" prop="pipe">
  231. <el-checkbox v-model="form.pipe" @change="changeHotarea()"></el-checkbox>
  232. </el-form-item>
  233. </el-col>
  234. <el-col :span="6">
  235. <el-form-item label="烷基化" prop="alkylation">
  236. <el-checkbox v-model="form.alkylation" @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 {
  404. listByxWorklicense,
  405. getByxWorklicense,
  406. delByxWorklicense,
  407. addByxWorklicense,
  408. updateByxWorklicense,
  409. exportByxWorklicense,
  410. } from "@/api/training/byxWorklicense";
  411. import { treeselect } from "@/api/system/dept";
  412. import { getToken } from "@/utils/auth";
  413. import Treeselect from "@riophae/vue-treeselect";
  414. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  415. import LicenseData from "./licenseData";
  416. import {addCommonfile, allFileList, delCommonfile, updateCommonfile} from "@/api/common/commonfile";
  417. export default {
  418. name: "ByxWorklicense",
  419. components: {LicenseData, Treeselect},
  420. data() {
  421. return {
  422. drawer: false,
  423. direction: 'rtl',
  424. // 遮罩层
  425. loading: true,
  426. // 选中数组
  427. ids: [],
  428. // 非单个禁用
  429. single: true,
  430. // 非多个禁用
  431. multiple: true,
  432. // 显示搜索条件
  433. showSearch: false,
  434. // 总条数
  435. total: 0,
  436. // 上岗证一览表格数据
  437. worklicenseList: [],
  438. // 弹出层标题
  439. title: "",
  440. // 部门树选项
  441. deptOptions: undefined,
  442. clientHeight:300,
  443. // 是否显示弹出层
  444. open: false,
  445. // 装置名称字典
  446. plantCodeOptions: [],
  447. // 班组字典
  448. classesOptions: [],
  449. // 职务字典
  450. actualpostOptions: [],
  451. // 裂解字典
  452. boilerOptions: [],
  453. // 压缩字典
  454. crackingOptions: [],
  455. // 分离字典
  456. hotareaOptions: [],
  457. // PGU/AEU字典
  458. coldareaOptions: [],
  459. // 用户导入参数
  460. upload: {
  461. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  462. //下载模板类型
  463. type: "byxWorklicense",
  464. // 是否显示弹出层(用户导入)
  465. open: false,
  466. // 弹出层标题(用户导入)
  467. title: "",
  468. // 是否禁用上传
  469. isUploading: false,
  470. // 是否更新已经存在的用户数据
  471. updateSupport: 0,
  472. // 设置上传的请求头部
  473. headers: { Authorization: "Bearer " + getToken() },
  474. // 上传的地址
  475. url: process.env.VUE_APP_BASE_API + "/training/ByxWorklicense/importData"
  476. },
  477. // 报告附件参数
  478. doc: {
  479. file: "",
  480. // 是否显示弹出层(报告附件)
  481. open: false,
  482. // 弹出层标题(报告附件)
  483. title: "附件",
  484. // 是否禁用上传
  485. isUploading: false,
  486. // 是否更新已经存在的用户数据
  487. updateSupport: 0,
  488. // 报告附件上传位置编号
  489. ids: 0,
  490. // 设置上传的请求头部
  491. headers: { Authorization: "Bearer " + getToken() },
  492. // 上传的地址
  493. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  494. commonfileList: null,
  495. queryParams: {
  496. pId: null,
  497. pType: 'traning'
  498. },
  499. pType: 'traning',
  500. pId: null,
  501. form: {}
  502. },
  503. pdf : {
  504. title: '',
  505. pdfUrl: '',
  506. numPages: null,
  507. open: false,
  508. pageNum: 1,
  509. pageTotalNum: 1,
  510. loadedRatio: 0,
  511. },
  512. // 查询参数
  513. queryParams: {
  514. pageNum: 1,
  515. pageSize: 20,
  516. name: null,
  517. classes: null,
  518. boiler: null,
  519. container: null,
  520. pipe: null,
  521. alkylation: null,
  522. notHave: null,
  523. expiring: null
  524. },
  525. // 表单参数
  526. form: {},
  527. // 表单校验
  528. rules: {
  529. plantCode: [
  530. { required: true, message: this.$t('装置名称')+this.$t('不能为空'), trigger: "change" }
  531. ],
  532. deptId: [
  533. { required: true, message: this.$t('部门编号')+this.$t('不能为空'), trigger: "blur" }
  534. ]
  535. },
  536. //是否填写证件号
  537. boilerDisplay: false,
  538. compressionDisplay: false,
  539. separationDisplay: false,
  540. pguaeuDisplay: false,
  541. };
  542. },
  543. watch: {
  544. // 根据名称筛选部门树
  545. deptName(val) {
  546. this.$refs.tree.filter(val);
  547. }
  548. },
  549. created() {
  550. //设置表格高度对应屏幕高度
  551. this.$nextTick(() => {
  552. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  553. })
  554. this.getList();
  555. this.getTreeselect();
  556. this.getDicts("PLANT_DIVIDE").then(response => {
  557. this.plantCodeOptions = response.data;
  558. });
  559. this.getDicts("TEAM_DIVIDE").then(response => {
  560. this.classesOptions = response.data;
  561. });
  562. this.getDicts("ACTUALPOST").then(response => {
  563. this.actualpostOptions = response.data;
  564. });
  565. this.getDicts("YES_NO_EN").then(response => {
  566. this.boilerOptions = response.data;
  567. });
  568. this.getDicts("YES_NO_EN").then(response => {
  569. this.crackingOptions = response.data;
  570. });
  571. this.getDicts("YES_NO_EN").then(response => {
  572. this.hotareaOptions = response.data;
  573. });
  574. this.getDicts("YES_NO_EN").then(response => {
  575. this.coldareaOptions = response.data;
  576. });
  577. },
  578. methods: {
  579. /** 查询上岗证一览列表 */
  580. getList() {
  581. this.loading = true;
  582. listByxWorklicense(this.queryParams).then(response => {
  583. this.worklicenseList = response.rows;
  584. this.total = response.total;
  585. this.loading = false;
  586. });
  587. },
  588. //根据分数显示颜色提示
  589. tableCellClassName({ row, column, rowIndex, columnIndex }) {
  590. if (columnIndex == 12) {
  591. return this.changeColor(row.validity)
  592. }
  593. },
  594. changeColor (value) {
  595. var timeInterval = Date.parse(value) - Date.parse(new Date());
  596. if (timeInterval <= 182 * 24 * 3600 * 1000) {
  597. return 'cellCare'
  598. }
  599. },
  600. /** 查询部门下拉树结构 */
  601. getTreeselect() {
  602. treeselect().then(response => {
  603. this.deptOptions = response.data;
  604. });
  605. },
  606. // 装置名称字典翻译
  607. plantCodeFormat(row, column) {
  608. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  609. },
  610. // 班组字典翻译
  611. classesFormat(row, column) {
  612. return this.selectDictLabel(this.classesOptions, row.classes);
  613. },
  614. // 职务字典翻译
  615. actualpostFormat(row, column) {
  616. return this.selectDictLabel(this.actualpostOptions, row.post);
  617. },
  618. // 裂解字典翻译
  619. boilerFormat(row, column) {
  620. return this.selectDictLabel(this.boilerOptions, row.boiler);
  621. },
  622. // 压缩字典翻译
  623. crackingFormat(row, column) {
  624. return this.selectDictLabel(this.crackingOptions, row.container);
  625. },
  626. // 分离字典翻译
  627. hotareaFormat(row, column) {
  628. return this.selectDictLabel(this.hotareaOptions, row.pipe);
  629. },
  630. // PGU/AEU字典翻译
  631. coldareaFormat(row, column) {
  632. return this.selectDictLabel(this.coldareaOptions, row.alkylation);
  633. },
  634. // 取消按钮
  635. cancel() {
  636. this.open = false;
  637. this.reset();
  638. },
  639. // 表单重置
  640. reset() {
  641. this.form = {
  642. id: null,
  643. plantCode: null,
  644. name: null,
  645. employeeid: null,
  646. classes: null,
  647. post: null,
  648. idtype: null,
  649. containerIdnum: null,
  650. boiler: null,
  651. container: null,
  652. pipe: null,
  653. alkylation: null,
  654. aromatic: null,
  655. recertificatedate: null,
  656. validity: null,
  657. delFlag: null,
  658. createrCode: null,
  659. createdate: null,
  660. updaterCode: null,
  661. updatedate: null,
  662. remarks: null,
  663. deptId: null,
  664. separationIdnum: null,
  665. compressionIdnum: null,
  666. pguaeuIdnum: null,
  667. separationDate: null,
  668. compressionDate: null,
  669. pguaeuDate: null,
  670. crackingDate: null
  671. };
  672. this.resetForm("form");
  673. },
  674. /** 搜索按钮操作 */
  675. handleQuery() {
  676. this.queryParams.pageNum = 1;
  677. this.getList();
  678. },
  679. /** 重置按钮操作 */
  680. resetQuery() {
  681. this.resetForm("queryForm");
  682. this.handleQuery();
  683. },
  684. // 多选框选中数据
  685. handleSelectionChange(selection) {
  686. this.ids = selection.map(item => item.id)
  687. this.single = selection.length!==1
  688. this.multiple = !selection.length
  689. },
  690. /** 新增按钮操作 */
  691. handleAdd() {
  692. this.reset();
  693. this.open = true;
  694. this.title = this.$t('新增') + this.$t('空格') + this.$t('上岗证一览表');
  695. },
  696. /** 修改按钮操作 */
  697. handleUpdate(row) {
  698. this.reset();
  699. const id = row.id || this.ids
  700. getByxWorklicense(id).then(response => {
  701. this.form = response.data;
  702. if (response.data.boiler == 1) { this.form.boiler = true; this.boilerDisplay = true }
  703. if (response.data.boiler == 0) { this.form.boiler = false; this.boilerDisplay = false }
  704. if (response.data.container == 1) { this.form.container = true; this.compressionDisplay = true }
  705. if (response.data.container == 0) { this.form.container = false; this.compressionDisplay = false }
  706. if (response.data.pipe == 1) { this.form.pipe = true; this.separationDisplay = true }
  707. if (response.data.pipe == 0) { this.form.pipe = false; this.separationDisplay = false }
  708. if (response.data.alkylation == 1) { this.form.alkylation = true; this.pguaeuDisplay = true }
  709. if (response.data.alkylation == 0) { this.form.alkylation = false; this.pguaeuDisplay = false }
  710. this.open = true;
  711. this.title = this.$t('修改') + this.$t('上岗证一览表');
  712. });
  713. },
  714. /** 提交按钮 */
  715. submitForm() {
  716. this.$refs["form"].validate(valid => {
  717. if (valid) {
  718. if (this.form.id != null) {
  719. updateByxWorklicense(this.form).then(response => {
  720. this.msgSuccess(this.$t('修改成功'));
  721. this.open = false;
  722. this.getList();
  723. });
  724. } else {
  725. addByxWorklicense(this.form).then(response => {
  726. this.msgSuccess(this.$t('新增成功'));
  727. this.open = false;
  728. this.getList();
  729. });
  730. }
  731. }
  732. });
  733. },
  734. /** 删除按钮操作 */
  735. handleDelete(row) {
  736. const ids = row.id || this.ids;
  737. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  738. confirmButtonText: this.$t('确定'),
  739. cancelButtonText: this.$t('取消'),
  740. type: "warning"
  741. }).then(function() {
  742. return delByxWorklicense(ids);
  743. }).then(() => {
  744. this.getList();
  745. this.msgSuccess(this.$t('删除成功'));
  746. })
  747. },
  748. /** 导出按钮操作 */
  749. handleExport() {
  750. const queryParams = this.queryParams;
  751. this.$confirm(this.$t('是否确认导出所有上岗证一览数据项?'), this.$t('警告'), {
  752. confirmButtonText: this.$t('确定'),
  753. cancelButtonText: this.$t('取消'),
  754. type: "warning"
  755. }).then(function() {
  756. return exportByxWorklicense(queryParams);
  757. }).then(response => {
  758. this.download(response.msg);
  759. })
  760. },
  761. /** 导入按钮操作 */
  762. handleImport() {
  763. this.upload.title = this.$t('用户导入');
  764. this.upload.open = true;
  765. },
  766. /** 下载模板操作 */
  767. importTemplate() {
  768. this.$refs['downloadFileForm'].submit()
  769. },
  770. // 文件上传中处理
  771. handleFileUploadProgress(event, file, fileList) {
  772. this.upload.isUploading = true;
  773. },
  774. // 文件上传成功处理
  775. handleFileSuccess(response, file, fileList) {
  776. this.upload.open = false;
  777. this.upload.isUploading = false;
  778. this.$refs.upload.clearFiles();
  779. if (response.data[0] != null) {
  780. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  781. }else {
  782. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  783. }
  784. this.getList();
  785. },
  786. // 提交上传文件
  787. submitFileForm() {
  788. this.$refs.upload.submit();
  789. },
  790. //数据分析
  791. handleData(){
  792. this.drawer = true
  793. },
  794. //裂解修改
  795. changeBoiler() {
  796. if (this.form.boiler === true) {
  797. this.boilerDisplay = true
  798. }else {
  799. this.boilerDisplay = false
  800. }
  801. },
  802. //压缩修改
  803. changeCracking() {
  804. if (this.form.container === true) {
  805. this.compressionDisplay = true
  806. }else {
  807. this.compressionDisplay = false
  808. }
  809. },
  810. //分离修改
  811. changeHotarea() {
  812. if (this.form.pipe === true) {
  813. this.separationDisplay = true
  814. }else {
  815. this.separationDisplay = false
  816. }
  817. },
  818. //PGU/AEU修改
  819. changeColdarea() {
  820. if (this.form.alkylation === true) {
  821. this.pguaeuDisplay = true
  822. }else {
  823. this.pguaeuDisplay = false
  824. }
  825. },
  826. /** 报告附件按钮操作 */
  827. handleDoc(row , fileType) {
  828. var workType = "";
  829. if (fileType === "worklicense-boiler"){
  830. workType = this.$t('裂解(裂化)');
  831. }else if (fileType === "worklicense-compression"){
  832. workType = this.$t('压力容器');
  833. }else if (fileType === "worklicense-separation"){
  834. workType = this.$t('压力管道');
  835. }else if (fileType === "worklicense-pguaeu"){
  836. workType = this.$t('烷基化');
  837. }
  838. this.doc.pType = fileType
  839. this.doc.queryParams.pType = fileType
  840. this.doc.id = row.id;
  841. this.doc.title = row.name + this.$t('的')+ this.$t('空格') + workType+ this.$t('空格') + this.$t('上岗证')+ this.$t('空格')+ this.$t('附件') ;
  842. this.doc.open = true;
  843. this.doc.queryParams.pId = row.id
  844. this.doc.pId = row.id
  845. this.getFileList()
  846. /*this.$nextTick(() => {
  847. this.$refs.doc.clearFiles()
  848. })*/
  849. },
  850. getFileList (){
  851. allFileList(this.doc.queryParams).then(response => {
  852. response.forEach(element => {
  853. element["isEdit"] = false
  854. });
  855. response.forEach(element => {
  856. element["isAdd"] = false
  857. });
  858. this.doc.commonfileList = response;
  859. });
  860. },
  861. //附件上传中处理
  862. handleFileDocProgress(event, file, fileList) {
  863. this.doc.file = file;
  864. this.doc.isUploading = true;
  865. },
  866. //附件上传成功处理
  867. handleFileDocSuccess(response, file, fileList) {
  868. this.doc.isUploading = false;
  869. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  870. this.getFileList()
  871. },
  872. // 文件下载处理
  873. handleDownload(row) {
  874. var name = row.fileName;
  875. var url = row.fileUrl;
  876. var suffix = url.substring(url.lastIndexOf("."), url.length);
  877. const a = document.createElement('a')
  878. a.setAttribute('download', name)
  879. a.setAttribute('target', '_blank')
  880. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  881. a.click()
  882. },
  883. openPdf(){
  884. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  885. },
  886. handleSee (row){
  887. // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
  888. this.pdf.open =true
  889. this.pdf.title = row.fileName
  890. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  891. },
  892. // 上一页
  893. prePage() {
  894. let page = this.pdf.pageNum
  895. page = page > 1 ? page - 1 : this.pdf.pageTotalNum
  896. this.pdf.pageNum = page
  897. },
  898. // 下一页
  899. nextPage() {
  900. let page = this.pdf.pageNum
  901. page = page < this.pdf.pageTotalNum ? page + 1 : 1
  902. this.pdf.pageNum = page
  903. },
  904. // 取消
  905. cancelFile(row, index) {
  906. // 如果是新增的数据
  907. if (row.isAdd) {
  908. this.doc.commonfileList.splice(index, 1)
  909. } else {
  910. // 不是新增的数据 还原数据
  911. for (const i in row.oldRow) {
  912. row[i] = row.oldRow[i]
  913. }
  914. row.isEdit = false
  915. }
  916. },
  917. edit(row) {
  918. // 备份原始数据
  919. row['oldRow'] = JSON.parse(JSON.stringify(row));
  920. this.$nextTick(() => {
  921. row.isEdit = true;
  922. })
  923. },
  924. save(row) {
  925. row.isEdit = false;
  926. var that = this;
  927. that.loading = true;
  928. this.form = row;
  929. if (row.isAdd == true) {
  930. addCommonfile(this.form).then(response => {
  931. this.msgSuccess(this.$t('新增成功'));
  932. this.open = false;
  933. this.getList();
  934. });
  935. }else {
  936. updateCommonfile(this.form).then(response => {
  937. this.msgSuccess(this.$t('修改成功'));
  938. this.open = false;
  939. this.getList();
  940. });
  941. }
  942. },
  943. /** 删除按钮操作 */
  944. handleDeleteDoc(row) {
  945. const ids = row.id || this.ids;
  946. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  947. confirmButtonText: this.$t('确定'),
  948. cancelButtonText: this.$t('取消'),
  949. type: "warning"
  950. }).then(function() {
  951. return delCommonfile(ids);
  952. }).then(() => {
  953. this.getFileList()
  954. this.msgSuccess(this.$t('删除成功'));
  955. })
  956. },
  957. }
  958. };
  959. </script>