index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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="classes">
  5. <el-select v-model="queryParams.classes" :placeholder="$t('请选择') + $t('班组')" clearable size="small">
  6. <el-option
  7. v-for="dict in classesOptions"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item :label="$t('锅炉证')" prop="boiler" label-width="50">
  15. <el-checkbox v-model="queryParams.boiler"></el-checkbox>
  16. </el-form-item>
  17. <el-form-item :label="$t('加氢工艺')" prop="hydrogenation" label-width="50">
  18. <el-checkbox v-model="queryParams.hydrogenation"></el-checkbox>
  19. </el-form-item>
  20. <el-form-item :label="$t('裂化工艺')" prop="cracking" label-width="50">
  21. <el-checkbox v-model="queryParams.cracking"></el-checkbox>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  25. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  26. </el-form-item>
  27. </el-form>
  28. <el-row :gutter="10" class="mb8">
  29. <el-col :span="1.5">
  30. <el-button
  31. type="primary"
  32. icon="el-icon-plus"
  33. size="mini"
  34. @click="handleAdd"
  35. v-hasPermi="['training:workcertificate:add']"
  36. >{{ $t('新增') }}</el-button>
  37. </el-col>
  38. <el-col :span="1.5">
  39. <el-button
  40. type="success"
  41. icon="el-icon-edit"
  42. size="mini"
  43. :disabled="single"
  44. @click="handleUpdate"
  45. v-hasPermi="['training:workcertificate:edit']"
  46. >{{ $t('修改') }}</el-button>
  47. </el-col>
  48. <el-col :span="1.5">
  49. <el-button
  50. type="danger"
  51. icon="el-icon-delete"
  52. size="mini"
  53. :disabled="multiple"
  54. @click="handleDelete"
  55. v-hasPermi="['training:workcertificate:remove']"
  56. >{{ $t('删除') }}</el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="info"
  61. icon="el-icon-upload2"
  62. size="mini"
  63. @click="handleImport"
  64. v-hasPermi="['training:workcertificate:edit']"
  65. >{{ $t('导入') }}</el-button>
  66. </el-col>
  67. <el-col :span="1.5">
  68. <el-button
  69. type="warning"
  70. icon="el-icon-download"
  71. size="mini"
  72. @click="handleExport"
  73. v-hasPermi="['training:workcertificate:export']"
  74. >{{ $t('导出') }}</el-button>
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="primary"
  79. icon="el-icon-s-data"
  80. size="mini"
  81. @click="handleData"
  82. >{{ $t('数据分析') }}</el-button>
  83. </el-col>
  84. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  85. </el-row>
  86. <el-table v-loading="loading" :data="workcertificateList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  87. <el-table-column type="selection" width="55" align="center" />
  88. <el-table-column :label="$t('姓名')" align="center" prop="name" :show-overflow-tooltip="true"/>
  89. <el-table-column :label="$t('员工号')" align="center" prop="employeeid" :show-overflow-tooltip="true"/>
  90. <el-table-column :label="$t('班组')" align="center" prop="classes" :formatter="classesFormat" />
  91. <el-table-column :label="$t('压力容器')" align="center" prop="container" :show-overflow-tooltip="true"/>
  92. <el-table-column :label="$t('压力管道')" align="center" prop="pipe" :show-overflow-tooltip="true"/>
  93. <el-table-column :label="$t('身份证件号')" align="center" prop="idnum" :show-overflow-tooltip="true"/>
  94. <el-table-column :label="$t('复证日期')" align="center" prop="reviewdate" width="100">
  95. <template slot-scope="scope">
  96. <span>{{ parseTime(scope.row.reviewdate, '{y}-{m}-{d}') }}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column :label="$t('证书有效期')" align="center" prop="pipevalidity" width="100">
  100. <template slot-scope="scope">
  101. <span>{{ parseTime(scope.row.pipevalidity, '{y}-{m}-{d}') }}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column :label="$t('锅炉证')" align="center" prop="boiler" :show-overflow-tooltip="true"/>
  105. <el-table-column :label="$t('证书有效期')" align="center" prop="boilvalidity" width="100">
  106. <template slot-scope="scope">
  107. <span>{{ parseTime(scope.row.boilvalidity, '{y}-{m}-{d}') }}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column :label="$t('加氢工艺')" align="center" prop="hydrogenation" :show-overflow-tooltip="true"/>
  111. <el-table-column :label="$t('证书有效期')" align="center" prop="hydvalidity" width="100">
  112. <template slot-scope="scope">
  113. <span>{{ parseTime(scope.row.hydvalidity, '{y}-{m}-{d}') }}</span>
  114. </template>
  115. </el-table-column>
  116. <el-table-column :label="$t('下次复审')" align="center" prop="hydnextreview" width="100">
  117. <template slot-scope="scope">
  118. <span>{{ parseTime(scope.row.hydnextreview, '{y}-{m}-{d}') }}</span>
  119. </template>
  120. </el-table-column>
  121. <el-table-column :label="$t('裂化工艺')" align="center" prop="cracking" :show-overflow-tooltip="true"/>
  122. <el-table-column :label="$t('证书有效期')" align="center" prop="crackingvalidity" width="100">
  123. <template slot-scope="scope">
  124. <span>{{ parseTime(scope.row.crackingvalidity, '{y}-{m}-{d}') }}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column :label="$t('下次复审')" align="center" prop="crackingreview" width="100">
  128. <template slot-scope="scope">
  129. <span>{{ parseTime(scope.row.crackingreview, '{y}-{m}-{d}') }}</span>
  130. </template>
  131. </el-table-column>
  132. <el-table-column :label="$t('班组长最近培训日期')" align="center" prop="foremantrain" width="100">
  133. <template slot-scope="scope">
  134. <span>{{ parseTime(scope.row.foremantrain, '{y}-{m}-{d}') }}</span>
  135. </template>
  136. </el-table-column>
  137. <el-table-column :label="$t('班组长本次复审')" align="center" prop="foremanreview" width="100">
  138. <template slot-scope="scope">
  139. <span>{{ parseTime(scope.row.foremanreview, '{y}-{m}-{d}') }}</span>
  140. </template>
  141. </el-table-column>
  142. <el-table-column :label="$t('班组长下次复审')" align="center" prop="foremannextreview" width="100">
  143. <template slot-scope="scope">
  144. <span>{{ parseTime(scope.row.foremannextreview, '{y}-{m}-{d}') }}</span>
  145. </template>
  146. </el-table-column>
  147. <el-table-column :label="$t('锅炉水质培训日期')" align="center" prop="waterdate" width="100">
  148. <template slot-scope="scope">
  149. <span>{{ parseTime(scope.row.waterdate, '{y}-{m}-{d}') }}</span>
  150. </template>
  151. </el-table-column>
  152. <el-table-column :label="$t('锅炉能效培训日期')" align="center" prop="energydate" width="100">
  153. <template slot-scope="scope">
  154. <span>{{ parseTime(scope.row.energydate, '{y}-{m}-{d}') }}</span>
  155. </template>
  156. </el-table-column>
  157. <el-table-column :label="$t('制冷作业培训日期')" align="center" prop="refrigerationdate" width="100">
  158. <template slot-scope="scope">
  159. <span>{{ parseTime(scope.row.refrigerationdate, '{y}-{m}-{d}') }}</span>
  160. </template>
  161. </el-table-column>
  162. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  163. <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
  164. <template slot-scope="scope">
  165. <el-button
  166. size="mini"
  167. type="text"
  168. icon="el-icon-edit"
  169. @click="handleUpdate(scope.row)"
  170. v-hasPermi="['training:workcertificate:edit']"
  171. >{{ $t('修改') }}</el-button>
  172. <el-button
  173. size="mini"
  174. type="text"
  175. icon="el-icon-delete"
  176. @click="handleDelete(scope.row)"
  177. v-hasPermi="['training:workcertificate:remove']"
  178. >{{ $t('删除') }}</el-button>
  179. </template>
  180. </el-table-column>
  181. </el-table>
  182. <pagination
  183. v-show="total>0"
  184. :total="total"
  185. :page.sync="queryParams.pageNum"
  186. :limit.sync="queryParams.pageSize"
  187. @pagination="getList"
  188. />
  189. <!-- 添加或修改作业证书一览对话框 -->
  190. <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="500px" append-to-body>
  191. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  192. <el-form-item :label="$t('装置名称')" prop="plantCode">
  193. <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置名称')">
  194. <el-option
  195. v-for="dict in plantCodeOptions"
  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="name">
  203. <el-input v-model="form.name" :placeholder="$t('请输入') + $t('姓名')" />
  204. </el-form-item>
  205. <el-form-item :label="$t('员工号')" prop="employeeid">
  206. <el-input v-model="form.employeeid" :placeholder="$t('请输入') + $t('员工号')" />
  207. </el-form-item>
  208. <el-form-item :label="$t('班组')" prop="classes">
  209. <el-select v-model="form.classes" :placeholder="$t('请选择') + $t('班组')">
  210. <el-option
  211. v-for="dict in classesOptions"
  212. :key="dict.dictValue"
  213. :label="dict.dictLabel"
  214. :value="dict.dictValue"
  215. ></el-option>
  216. </el-select>
  217. </el-form-item>
  218. <el-form-item :label="$t('压力容器')" prop="container">
  219. <el-input v-model="form.container" :placeholder="$t('请输入') + $t('压力容器')" />
  220. </el-form-item>
  221. <el-form-item :label="$t('压力管道')" prop="pipe">
  222. <el-input v-model="form.pipe" :placeholder="$t('请输入') + $t('压力管道')" />
  223. </el-form-item>
  224. <el-form-item :label="$t('身份证件号')" prop="idnum">
  225. <el-input v-model="form.idnum" :placeholder="$t('请输入') + $t('员工姓名')" />
  226. </el-form-item>
  227. <el-form-item :label="$t('复证日期')" prop="reviewdate">
  228. <el-date-picker clearable size="small" style="width: 200px"
  229. v-model="form.reviewdate"
  230. type="date"
  231. value-format="yyyy-MM-dd"
  232. :placeholder="$t('请选择') + $t('复证日期')">
  233. </el-date-picker>
  234. </el-form-item>
  235. <el-form-item :label="$t('证书有效期')" prop="pipevalidity">
  236. <el-date-picker clearable size="small" style="width: 200px"
  237. v-model="form.pipevalidity"
  238. type="date"
  239. value-format="yyyy-MM-dd"
  240. :placeholder="$t('请选择') + $t('证书有效期')">
  241. </el-date-picker>
  242. </el-form-item>
  243. <el-form-item :label="$t('锅炉证')" prop="boiler">
  244. <el-input v-model="form.boiler" :placeholder="$t('请输入') + $t('锅炉证')" />
  245. </el-form-item>
  246. <el-form-item :label="$t('证书有效期')" prop="boilvalidity">
  247. <el-date-picker clearable size="small" style="width: 200px"
  248. v-model="form.boilvalidity"
  249. type="date"
  250. value-format="yyyy-MM-dd"
  251. :placeholder="$t('请选择') + $t('证书有效期')">
  252. </el-date-picker>
  253. </el-form-item>
  254. <el-form-item :label="$t('加氢工艺')" prop="hydrogenation">
  255. <el-input v-model="form.hydrogenation" :placeholder="$t('请输入') + $t('加氢工艺')" />
  256. </el-form-item>
  257. <el-form-item :label="$t('证书有效期')" prop="hydvalidity">
  258. <el-date-picker clearable size="small" style="width: 200px"
  259. v-model="form.hydvalidity"
  260. type="date"
  261. value-format="yyyy-MM-dd"
  262. :placeholder="$t('请选择') + $t('证书有效期')">
  263. </el-date-picker>
  264. </el-form-item>
  265. <el-form-item :label="$t('下次复审')" prop="hydnextreview">
  266. <el-date-picker clearable size="small" style="width: 200px"
  267. v-model="form.hydnextreview"
  268. type="date"
  269. value-format="yyyy-MM-dd"
  270. :placeholder="$t('请选择') + $t('下次复审')">
  271. </el-date-picker>
  272. </el-form-item>
  273. <el-form-item :label="$t('裂化工艺')" prop="cracking">
  274. <el-input v-model="form.cracking" :placeholder="$t('请输入') + $t('裂化工艺')" />
  275. </el-form-item>
  276. <el-form-item :label="$t('证书有效期')" prop="crackingvalidity">
  277. <el-date-picker clearable size="small" style="width: 200px"
  278. v-model="form.crackingvalidity"
  279. type="date"
  280. value-format="yyyy-MM-dd"
  281. :placeholder="$t('请选择') + $t('证书有效期')">
  282. </el-date-picker>
  283. </el-form-item>
  284. <el-form-item :label="$t('下次复审')" prop="crackingreview">
  285. <el-date-picker clearable size="small" style="width: 200px"
  286. v-model="form.crackingreview"
  287. type="date"
  288. value-format="yyyy-MM-dd"
  289. :placeholder="$t('请选择') + $t('下次复审')">
  290. </el-date-picker>
  291. </el-form-item>
  292. <el-form-item :label="$t('班组长最近培训日期')" prop="foremantrain">
  293. <el-date-picker clearable size="small" style="width: 200px"
  294. v-model="form.foremantrain"
  295. type="date"
  296. value-format="yyyy-MM-dd"
  297. :placeholder="$t('请选择') + $t('班组长最近培训日期')">
  298. </el-date-picker>
  299. </el-form-item>
  300. <el-form-item :label="$t('班组长本次复审')" prop="foremanreview">
  301. <el-date-picker clearable size="small" style="width: 200px"
  302. v-model="form.foremanreview"
  303. type="date"
  304. value-format="yyyy-MM-dd"
  305. :placeholder="$t('请选择') + $t('班组长本次复审')">
  306. </el-date-picker>
  307. </el-form-item>
  308. <el-form-item :label="$t('班组长下次复审')" prop="foremannextreview">
  309. <el-date-picker clearable size="small" style="width: 200px"
  310. v-model="form.foremannextreview"
  311. type="date"
  312. value-format="yyyy-MM-dd"
  313. :placeholder="$t('请选择') + $t('班组长下次复审')">
  314. </el-date-picker>
  315. </el-form-item>
  316. <el-form-item :label="$t('锅炉水质培训日期')" prop="waterdate">
  317. <el-date-picker clearable size="small" style="width: 200px"
  318. v-model="form.waterdate"
  319. type="date"
  320. value-format="yyyy-MM-dd"
  321. :placeholder="$t('请选择') + $t('锅炉水质培训日期')">
  322. </el-date-picker>
  323. </el-form-item>
  324. <el-form-item :label="$t('锅炉能效培训日期')" prop="energydate">
  325. <el-date-picker clearable size="small" style="width: 200px"
  326. v-model="form.energydate"
  327. type="date"
  328. value-format="yyyy-MM-dd"
  329. :placeholder="$t('请选择') + $t('锅炉能效培训日期')">
  330. </el-date-picker>
  331. </el-form-item>
  332. <el-form-item :label="$t('制冷作业培训日期')" prop="refrigerationdate">
  333. <el-date-picker clearable size="small" style="width: 200px"
  334. v-model="form.refrigerationdate"
  335. type="date"
  336. value-format="yyyy-MM-dd"
  337. :placeholder="$t('请选择') + $t('制冷作业培训日期')">
  338. </el-date-picker>
  339. </el-form-item>
  340. <el-form-item :label="$t('备注')" prop="remarks">
  341. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  342. </el-form-item>
  343. <el-form-item :label="$t('归属部门')" prop="deptId">
  344. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  345. </el-form-item>
  346. </el-form>
  347. <div slot="footer" class="dialog-footer">
  348. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  349. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  350. </div>
  351. </el-dialog>
  352. <!-- 用户导入对话框 -->
  353. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  354. <el-upload
  355. ref="upload"
  356. :limit="1"
  357. accept=".xlsx, .xls"
  358. :headers="upload.headers"
  359. :action="upload.url"
  360. :disabled="upload.isUploading"
  361. :on-progress="handleFileUploadProgress"
  362. :on-success="handleFileSuccess"
  363. :auto-upload="false"
  364. drag
  365. >
  366. <i class="el-icon-upload"></i>
  367. <div class="el-upload__text">
  368. {{ $t('将文件拖到此处,或') }}
  369. <em>{{ $t('点击上传') }}</em>
  370. </div>
  371. <div class="el-upload__tip" slot="tip">
  372. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  373. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  374. </div>
  375. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  376. <input name="type" :value="upload.type" hidden />
  377. </form>
  378. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  379. </el-upload>
  380. <div slot="footer" class="dialog-footer">
  381. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  382. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  383. </div>
  384. </el-dialog>
  385. <el-drawer
  386. :title="$t('数据分析')"
  387. size="600px"
  388. :visible.sync="drawer"
  389. :direction="direction">
  390. <el-row>
  391. <el-col>
  392. <el-card class="box-card" shadow="hover">
  393. <div slot="header" class="clearfix">
  394. <span>{{ $t('证书统计') }}</span>
  395. </div>
  396. <div class="text item">
  397. <cert-data></cert-data>
  398. </div>
  399. </el-card>
  400. </el-col>
  401. </el-row>
  402. </el-drawer>
  403. </div>
  404. </template>
  405. <script>
  406. import { listWorkcertificate, getWorkcertificate, delWorkcertificate, addWorkcertificate, updateWorkcertificate, exportWorkcertificate } from "@/api/training/workcertificate";
  407. import { treeselect } from "@/api/system/dept";
  408. import { getToken } from "@/utils/auth";
  409. import Treeselect from "@riophae/vue-treeselect";
  410. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  411. import CertData from "./certData";
  412. export default {
  413. name: "Workcertificate",
  414. components: {CertData, Treeselect },
  415. data() {
  416. return {
  417. drawer: false,
  418. direction: 'rtl',
  419. // 遮罩层
  420. loading: true,
  421. // 选中数组
  422. ids: [],
  423. // 非单个禁用
  424. single: true,
  425. // 非多个禁用
  426. multiple: true,
  427. // 显示搜索条件
  428. showSearch: false,
  429. // 总条数
  430. total: 0,
  431. // 作业证书一览表格数据
  432. workcertificateList: [],
  433. // 弹出层标题
  434. title: "",
  435. // 部门树选项
  436. deptOptions: undefined,
  437. clientHeight:300,
  438. // 是否显示弹出层
  439. open: false,
  440. // 装置名称字典
  441. plantCodeOptions: [],
  442. // 班组字典
  443. classesOptions: [],
  444. // 用户导入参数
  445. upload: {
  446. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  447. //下载模板类型
  448. type: "workcertificate",
  449. // 是否显示弹出层(用户导入)
  450. open: false,
  451. // 弹出层标题(用户导入)
  452. title: "",
  453. // 是否禁用上传
  454. isUploading: false,
  455. // 是否更新已经存在的用户数据
  456. updateSupport: 0,
  457. // 设置上传的请求头部
  458. headers: { Authorization: "Bearer " + getToken() },
  459. // 上传的地址
  460. url: process.env.VUE_APP_BASE_API + "/training/workcertificate/importData"
  461. },
  462. // 查询参数
  463. queryParams: {
  464. pageNum: 1,
  465. pageSize: 20,
  466. classes: null,
  467. boiler: null,
  468. hydrogenation: null,
  469. cracking: null,
  470. },
  471. // 表单参数
  472. form: {},
  473. // 表单校验
  474. rules: {
  475. plantCode: [
  476. { required: true, message: this.$t('装置名称')+this.$t('不能为空'), trigger: "change" }
  477. ],
  478. deptId: [
  479. { required: true, message: this.$t('部门编号')+this.$t('不能为空'), trigger: "blur" }
  480. ]
  481. }
  482. };
  483. },
  484. watch: {
  485. // 根据名称筛选部门树
  486. deptName(val) {
  487. this.$refs.tree.filter(val);
  488. }
  489. },
  490. created() {
  491. //设置表格高度对应屏幕高度
  492. this.$nextTick(() => {
  493. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  494. })
  495. this.getList();
  496. this.getTreeselect();
  497. this.getDicts("PLANT_DIVIDE").then(response => {
  498. this.plantCodeOptions = response.data;
  499. });
  500. this.getDicts("CLASSES").then(response => {
  501. this.classesOptions = response.data;
  502. });
  503. },
  504. methods: {
  505. /** 查询作业证书一览列表 */
  506. getList() {
  507. this.loading = true;
  508. listWorkcertificate(this.queryParams).then(response => {
  509. this.workcertificateList = response.rows;
  510. this.total = response.total;
  511. this.loading = false;
  512. });
  513. },
  514. /** 查询部门下拉树结构 */
  515. getTreeselect() {
  516. treeselect().then(response => {
  517. this.deptOptions = response.data;
  518. });
  519. },
  520. // 装置名称字典翻译
  521. plantCodeFormat(row, column) {
  522. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  523. },
  524. // 班组字典翻译
  525. classesFormat(row, column) {
  526. return this.selectDictLabel(this.classesOptions, row.classes);
  527. },
  528. // 取消按钮
  529. cancel() {
  530. this.open = false;
  531. this.reset();
  532. },
  533. // 表单重置
  534. reset() {
  535. this.form = {
  536. id: null,
  537. plantCode: null,
  538. name: null,
  539. employeeid: null,
  540. classes: null,
  541. container: null,
  542. pipe: null,
  543. idnum: null,
  544. reviewdate: null,
  545. pipevalidity: null,
  546. boiler: null,
  547. boilvalidity: null,
  548. hydrogenation: null,
  549. hydvalidity: null,
  550. hydnextreview: null,
  551. cracking: null,
  552. crackingvalidity: null,
  553. crackingreview: null,
  554. foremantrain: null,
  555. foremanreview: null,
  556. foremannextreview: null,
  557. waterdate: null,
  558. energydate: null,
  559. refrigerationdate: null,
  560. delFlag: null,
  561. createrCode: null,
  562. createdate: null,
  563. updaterCode: null,
  564. updatedate: null,
  565. remarks: null,
  566. deptId: null
  567. };
  568. this.resetForm("form");
  569. },
  570. /** 搜索按钮操作 */
  571. handleQuery() {
  572. this.queryParams.pageNum = 1;
  573. this.getList();
  574. },
  575. /** 重置按钮操作 */
  576. resetQuery() {
  577. this.resetForm("queryForm");
  578. this.handleQuery();
  579. },
  580. // 多选框选中数据
  581. handleSelectionChange(selection) {
  582. this.ids = selection.map(item => item.id)
  583. this.single = selection.length!==1
  584. this.multiple = !selection.length
  585. },
  586. /** 新增按钮操作 */
  587. handleAdd() {
  588. this.reset();
  589. this.open = true;
  590. this.title = this.$t('新增') + this.$t('空格') + this.$t('作业证书一览');
  591. },
  592. /** 修改按钮操作 */
  593. handleUpdate(row) {
  594. this.reset();
  595. const id = row.id || this.ids
  596. getWorkcertificate(id).then(response => {
  597. this.form = response.data;
  598. this.open = true;
  599. this.title = this.$t('修改') + this.$t('作业证书一览');
  600. });
  601. },
  602. /** 提交按钮 */
  603. submitForm() {
  604. this.$refs["form"].validate(valid => {
  605. if (valid) {
  606. if (this.form.id != null) {
  607. updateWorkcertificate(this.form).then(response => {
  608. this.msgSuccess(this.$t('修改成功'));
  609. this.open = false;
  610. this.getList();
  611. });
  612. } else {
  613. addWorkcertificate(this.form).then(response => {
  614. this.msgSuccess(this.$t('新增成功'));
  615. this.open = false;
  616. this.getList();
  617. });
  618. }
  619. }
  620. });
  621. },
  622. /** 删除按钮操作 */
  623. handleDelete(row) {
  624. const ids = row.id || this.ids;
  625. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  626. confirmButtonText: this.$t('确定'),
  627. cancelButtonText: this.$t('取消'),
  628. type: "warning"
  629. }).then(function() {
  630. return delWorkcertificate(ids);
  631. }).then(() => {
  632. this.getList();
  633. this.msgSuccess(this.$t('删除成功'));
  634. })
  635. },
  636. /** 导出按钮操作 */
  637. handleExport() {
  638. const queryParams = this.queryParams;
  639. this.$confirm(this.$t('是否确认导出所有作业证书一览数据项?'), this.$t('警告'), {
  640. confirmButtonText: this.$t('确定'),
  641. cancelButtonText: this.$t('取消'),
  642. type: "warning"
  643. }).then(function() {
  644. return exportWorkcertificate(queryParams);
  645. }).then(response => {
  646. this.download(response.msg);
  647. })
  648. },
  649. /** 导入按钮操作 */
  650. handleImport() {
  651. this.upload.title = this.$t('用户导入');
  652. this.upload.open = true;
  653. },
  654. /** 下载模板操作 */
  655. importTemplate() {
  656. this.$refs['downloadFileForm'].submit()
  657. },
  658. // 文件上传中处理
  659. handleFileUploadProgress(event, file, fileList) {
  660. this.upload.isUploading = true;
  661. },
  662. // 文件上传成功处理
  663. handleFileSuccess(response, file, fileList) {
  664. this.upload.open = false;
  665. this.upload.isUploading = false;
  666. this.$refs.upload.clearFiles();
  667. if (response.data[0] != null) {
  668. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  669. }else {
  670. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  671. }
  672. this.getList();
  673. },
  674. // 提交上传文件
  675. submitFileForm() {
  676. this.$refs.upload.submit();
  677. },
  678. //数据分析
  679. handleData(){
  680. this.drawer = true
  681. }
  682. }
  683. };
  684. </script>