index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  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" @change="handleQuery" :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="guardian" label-width="50">
  15. <el-checkbox v-model="queryParams.guardian" @change="handleQuery" ></el-checkbox>
  16. </el-form-item>
  17. <!-- <el-form-item :label="$t('加氢工艺')" prop="hydrogenation" label-width="50">
  18. <el-checkbox v-model="queryParams.hydrogenation" @change="handleQuery" ></el-checkbox>
  19. </el-form-item>
  20. <el-form-item :label="$t('裂化工艺')" prop="cracking" label-width="50">
  21. <el-checkbox v-model="queryParams.cracking" @change="handleQuery" ></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:byxWorkcertificate: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:byxWorkcertificate: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:byxWorkcertificate: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:byxWorkcertificate: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:byxWorkcertificate: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" :cell-style="tableCellStyle" :header-cell-style="tableCellStyle" @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. <template slot-scope="scope">
  93. <span> {{scope.row.container}}</span>
  94. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'byxworkcertificate-container')" circle></el-button>
  95. </template>
  96. </el-table-column>
  97. <el-table-column :label="$t('证件号')" align="center" prop="containerIdnum" :show-overflow-tooltip="true"/>
  98. <el-table-column :label="$t('证件有效期')" align="center" prop="containerDate" width="100">
  99. <template slot-scope="scope">
  100. <span>{{ parseTime(scope.row.containerDate, '{y}-{m}-{d}') }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column :label="$t('消防设施操作')" align="center" prop="fireFacilities" :show-overflow-tooltip="true">
  104. <template slot-scope="scope">
  105. <span> {{scope.row.fireFacilities}}</span>
  106. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'byxworkcertificate-fireFacilities')" circle></el-button>
  107. </template>
  108. </el-table-column>
  109. <el-table-column :label="$t('证件号')" align="center" prop="fireFacilitiesIdnum" :show-overflow-tooltip="true"/>
  110. <el-table-column :label="$t('证件有效期')" align="center" prop="fireFacilitiesDate" width="100">
  111. <template slot-scope="scope">
  112. <span>{{ parseTime(scope.row.fireFacilitiesDate, '{y}-{m}-{d}') }}</span>
  113. </template>
  114. </el-table-column>
  115. <el-table-column :label="$t('监护人专项培训')" align="center" prop="guardian" :show-overflow-tooltip="true">
  116. <template slot-scope="scope">
  117. <span> {{scope.row.guardian}}</span>
  118. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'byxworkcertificate-guardian')" circle></el-button>
  119. </template>
  120. </el-table-column>
  121. <el-table-column :label="$t('证件号')" align="center" prop="guardianIdnum" :show-overflow-tooltip="true"/>
  122. <el-table-column :label="$t('证书有效期')" align="center" prop="boilvalidity" width="100">
  123. <template slot-scope="scope">
  124. <span>{{ parseTime(scope.row.boilvalidity, '{y}-{m}-{d}') }}</span>
  125. </template>
  126. </el-table-column>
  127. <el-table-column :label="$t('班组长首次培训日期')" align="center" prop="foremantrain" width="130">
  128. <template slot-scope="scope">
  129. <span>{{ parseTime(scope.row.foremantrain, '{y}-{m}-{d}') }}</span>
  130. <el-button icon="el-icon-folder" style="color:#6e96fa;" @click="handleDoc(scope.row , 'byxworkcertificate-foremantrain')" circle></el-button>
  131. </template>
  132. </el-table-column>
  133. <el-table-column :label="$t('班组长本次复审')" align="center" prop="foremanreview" width="100">
  134. <template slot-scope="scope">
  135. <span>{{ parseTime(scope.row.foremanreview, '{y}-{m}-{d}') }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column :label="$t('班组长下次复审')" align="center" prop="foremannextreview" width="100">
  139. <template slot-scope="scope">
  140. <span>{{ parseTime(scope.row.foremannextreview, '{y}-{m}-{d}') }}</span>
  141. </template>
  142. </el-table-column>
  143. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  144. <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
  145. <template slot-scope="scope">
  146. <el-button
  147. size="mini"
  148. type="text"
  149. icon="el-icon-edit"
  150. @click="handleUpdate(scope.row)"
  151. v-hasPermi="['training:byxWorkcertificate:edit']"
  152. >{{ $t('修改') }}</el-button>
  153. <el-button
  154. size="mini"
  155. type="text"
  156. icon="el-icon-delete"
  157. @click="handleDelete(scope.row)"
  158. v-hasPermi="['training:byxWorkcertificate:remove']"
  159. >{{ $t('删除') }}</el-button>
  160. </template>
  161. </el-table-column>
  162. </el-table>
  163. <pagination
  164. v-show="total>0"
  165. :total="total"
  166. :page.sync="queryParams.pageNum"
  167. :limit.sync="queryParams.pageSize"
  168. @pagination="getList"
  169. />
  170. <!-- 添加或修改作业证书一览对话框 -->
  171. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="title" :visible.sync="open" width="800px" append-to-body>
  172. <el-form ref="form" :model="form" :rules="rules" label-width="140px">
  173. <el-form-item :label="$t('装置名称')" prop="plantCode">
  174. <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置名称')">
  175. <el-option
  176. v-for="dict in plantCodeOptions"
  177. :key="dict.dictValue"
  178. :label="dict.dictLabel"
  179. :value="dict.dictValue"
  180. ></el-option>
  181. </el-select>
  182. </el-form-item>
  183. <el-form-item :label="$t('姓名')" prop="name">
  184. <el-input v-model="form.name" :placeholder="$t('请输入') + $t('姓名')" />
  185. </el-form-item>
  186. <el-form-item :label="$t('员工号')" prop="employeeid">
  187. <el-input v-model="form.employeeid" :placeholder="$t('请输入') + $t('员工号')" />
  188. </el-form-item>
  189. <el-form-item :label="$t('班组')" prop="classes">
  190. <el-select v-model="form.classes" :placeholder="$t('请选择') + $t('班组')">
  191. <el-option
  192. v-for="dict in classesOptions"
  193. :key="dict.dictValue"
  194. :label="dict.dictLabel"
  195. :value="dict.dictValue"
  196. ></el-option>
  197. </el-select>
  198. </el-form-item>
  199. <el-form-item :label="$t('移动式压力容器充装')" prop="container">
  200. <el-input v-model="form.container" :placeholder="$t('请输入') + $t('移动式压力容器充装')" />
  201. </el-form-item>
  202. <el-form-item :label="$t('证件号')" prop="containerIdnum">
  203. <el-input v-model="form.containerIdnum" :placeholder="$t('请输入') + $t('证件号')" />
  204. </el-form-item>
  205. <el-form-item :label="$t('证件有效期')" prop="containerDate">
  206. <el-date-picker clearable size="small" style="width: 200px"
  207. v-model="form.containerDate"
  208. type="date"
  209. value-format="yyyy-MM-dd"
  210. :placeholder="$t('请选择') + $t('证件有效期')">
  211. </el-date-picker>
  212. </el-form-item>
  213. <el-form-item :label="$t('消防设施操作')" prop="fireFacilities">
  214. <el-input v-model="form.fireFacilities" :placeholder="$t('请输入') + $t('消防设施操作')" />
  215. </el-form-item>
  216. <el-form-item :label="$t('证件号')" prop="fireFacilitiesIdnum">
  217. <el-input v-model="form.fireFacilitiesIdnum" :placeholder="$t('请输入') + $t('证件号')" />
  218. </el-form-item>
  219. <el-form-item :label="$t('证件有效期')" prop="fireFacilitiesDate">
  220. <el-date-picker clearable size="small" style="width: 200px"
  221. v-model="form.fireFacilitiesDate"
  222. type="date"
  223. value-format="yyyy-MM-dd"
  224. :placeholder="$t('请选择') + $t('证件有效期')">
  225. </el-date-picker>
  226. </el-form-item>
  227. <el-form-item :label="$t('监护人专项培训')" prop="guardian">
  228. <el-input v-model="form.guardian" :placeholder="$t('请输入') + $t('监护人专项培训')" />
  229. </el-form-item>
  230. <el-form-item :label="$t('证件号')" prop="guardianIdnum">
  231. <el-input v-model="form.guardianIdnum" :placeholder="$t('请输入') + $t('证件号')" />
  232. </el-form-item>
  233. <el-form-item :label="$t('证书有效期')" prop="boilvalidity">
  234. <el-date-picker clearable size="small" style="width: 200px"
  235. v-model="form.boilvalidity"
  236. type="date"
  237. value-format="yyyy-MM-dd"
  238. :placeholder="$t('请选择') + $t('证书有效期')">
  239. </el-date-picker>
  240. </el-form-item>
  241. <el-form-item :label="$t('班组长首次培训日期')" prop="foremantrain">
  242. <el-date-picker clearable size="small" style="width: 200px"
  243. v-model="form.foremantrain"
  244. type="date"
  245. value-format="yyyy-MM-dd"
  246. :placeholder="$t('请选择') + $t('班组长首次培训日期')">
  247. </el-date-picker>
  248. </el-form-item>
  249. <el-form-item :label="$t('班组长本次复审')" prop="foremanreview">
  250. <el-date-picker clearable size="small" style="width: 200px"
  251. v-model="form.foremanreview"
  252. type="date"
  253. value-format="yyyy-MM-dd"
  254. :placeholder="$t('请选择') + $t('班组长本次复审')">
  255. </el-date-picker>
  256. </el-form-item>
  257. <el-form-item :label="$t('班组长下次复审')" prop="foremannextreview">
  258. <el-date-picker clearable size="small" style="width: 200px"
  259. v-model="form.foremannextreview"
  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="remarks">
  266. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  267. </el-form-item>
  268. <el-form-item :label="$t('归属部门')" prop="deptId">
  269. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  270. </el-form-item>
  271. </el-form>
  272. <div slot="footer" class="dialog-footer">
  273. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  274. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  275. </div>
  276. </el-dialog>
  277. <!-- 用户导入对话框 -->
  278. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  279. <el-upload
  280. ref="upload"
  281. :limit="1"
  282. accept=".xlsx, .xls"
  283. :headers="upload.headers"
  284. :action="upload.url"
  285. :disabled="upload.isUploading"
  286. :on-progress="handleFileUploadProgress"
  287. :on-success="handleFileSuccess"
  288. :auto-upload="false"
  289. drag
  290. >
  291. <i class="el-icon-upload"></i>
  292. <div class="el-upload__text">
  293. {{ $t('将文件拖到此处,或') }}
  294. <em>{{ $t('点击上传') }}</em>
  295. </div>
  296. <div class="el-upload__tip" slot="tip">
  297. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  298. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  299. </div>
  300. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  301. <input name="type" :value="upload.type" hidden />
  302. </form>
  303. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!请将需要上传的数据放在模板excel文件中,并将模板文件的空白行与无关数据删除,谢谢!') }}</div>
  304. </el-upload>
  305. <div slot="footer" class="dialog-footer">
  306. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  307. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  308. </div>
  309. </el-dialog>
  310. <!-- 报告附件对话框 -->
  311. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="1000px" append-to-body >
  312. <el-upload v-hasPermi="['training:trainingrecords:file']"
  313. ref="doc"
  314. :limit="50"
  315. :headers="doc.headers"
  316. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  317. :disabled="doc.isUploading"
  318. :on-progress="handleFileDocProgress"
  319. :on-success="handleFileDocSuccess"
  320. :auto-upload="true"
  321. drag
  322. >
  323. <i class="el-icon-upload"></i>
  324. <div class="el-upload__text">
  325. {{ $t('将文件拖到此处,或') }}
  326. <em>{{ $t('点击上传') }}</em>
  327. </div>
  328. </el-upload>
  329. <el-table :data="doc.commonfileList" border>
  330. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  331. <template slot-scope="scope">
  332. <a class="link-type" @click="handleDownload(scope.row)">
  333. <span>{{ scope.row.fileName }}</span>
  334. </a>
  335. </template>
  336. </el-table-column>
  337. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  338. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  339. <!-- <el-table-column :label="$t('培训日期')" align="center" prop="pDate" width="150">-->
  340. <!-- <template slot-scope="scope">-->
  341. <!-- <el-date-picker-->
  342. <!-- v-if="scope.row.isEdit"-->
  343. <!-- v-model="scope.row.pDate"-->
  344. <!-- type="date"-->
  345. <!-- value-format="yyyy-MM-dd"-->
  346. <!-- placeholder="日期">-->
  347. <!-- </el-date-picker>-->
  348. <!-- <span v-else>{{ parseTime(scope.row.pDate, '{y}-{m}-{d}') }}</span>-->
  349. <!-- </template>-->
  350. <!-- </el-table-column>-->
  351. <el-table-column :label="$t('操作')" align="center" width="220" class-name="small-padding fixed-width">
  352. <template slot-scope="scope">
  353. <el-button
  354. v-if="scope.row.fileName.endsWith('pdf')"
  355. size="mini"
  356. type="text"
  357. icon="el-icon-view"
  358. @click="handleSee(scope.row)"
  359. >{{ $t('预览') }}</el-button>
  360. <el-button v-hasPermi="['training:trainingrecords:file']" type="text" size="small" v-if="scope.row.isEdit" @click="save(scope.row)">保存</el-button>
  361. <el-button type="text" size="small" v-if="scope.row.isEdit" @click="cancelFile(scope.row, scope.$index)">取消</el-button>
  362. <!-- <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>-->
  363. <el-button
  364. size="mini"
  365. type="text"
  366. icon="el-icon-download"
  367. @click="handleDownload(scope.row)"
  368. >{{ $t('下载') }}</el-button>
  369. <el-button
  370. size="mini"
  371. type="text"
  372. icon="el-icon-delete"
  373. @click="handleDeleteDoc(scope.row)"
  374. v-hasPermi="['training:trainingrecords:file']"
  375. >{{ $t('删除') }}</el-button>
  376. </template>
  377. </el-table-column>
  378. </el-table>
  379. <el-dialog :close-on-click-modal="false" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  380. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  381. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  382. <div style="margin-top: -30px">
  383. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  384. </div>
  385. </el-dialog>
  386. <div slot="footer" class="dialog-footer">
  387. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  388. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  389. </div>
  390. </el-dialog>
  391. <el-drawer
  392. :title="$t('数据分析')"
  393. size="600px"
  394. :visible.sync="drawer"
  395. :direction="direction">
  396. <el-row>
  397. <el-col>
  398. <el-card class="box-card" shadow="hover">
  399. <div slot="header" class="clearfix">
  400. <span>{{ $t('证书统计') }}</span>
  401. </div>
  402. <div class="text item">
  403. <cert-data></cert-data>
  404. </div>
  405. </el-card>
  406. </el-col>
  407. </el-row>
  408. </el-drawer>
  409. </div>
  410. </template>
  411. <script>
  412. import {
  413. listByxWorkcertificate,
  414. getByxWorkcertificate,
  415. delByxWorkcertificate,
  416. addByxWorkcertificate,
  417. updateByxWorkcertificate,
  418. exportByxWorkcertificate,
  419. } from "@/api/training/byxWorkcertificate";
  420. import { treeselect } from "@/api/system/dept";
  421. import { getToken } from "@/utils/auth";
  422. import Treeselect from "@riophae/vue-treeselect";
  423. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  424. import CertData from "./certData";
  425. import {allFileList, delCommonfile} from "@/api/common/commonfile";
  426. export default {
  427. name: "byxWorkcertificate",
  428. components: {CertData, Treeselect },
  429. data() {
  430. return {
  431. drawer: false,
  432. direction: 'rtl',
  433. // 遮罩层
  434. loading: true,
  435. // 选中数组
  436. ids: [],
  437. // 非单个禁用
  438. single: true,
  439. // 非多个禁用
  440. multiple: true,
  441. // 显示搜索条件
  442. showSearch: false,
  443. // 总条数
  444. total: 0,
  445. // 作业证书一览表格数据
  446. workcertificateList: [],
  447. // 弹出层标题
  448. title: "",
  449. // 部门树选项
  450. deptOptions: undefined,
  451. clientHeight:300,
  452. // 是否显示弹出层
  453. open: false,
  454. // 装置名称字典
  455. plantCodeOptions: [],
  456. // 班组字典
  457. classesOptions: [],
  458. // 用户导入参数
  459. upload: {
  460. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  461. //下载模板类型
  462. type: "byxworkcertificate",
  463. // 是否显示弹出层(用户导入)
  464. open: false,
  465. // 弹出层标题(用户导入)
  466. title: "",
  467. // 是否禁用上传
  468. isUploading: false,
  469. // 是否更新已经存在的用户数据
  470. updateSupport: 0,
  471. // 设置上传的请求头部
  472. headers: { Authorization: "Bearer " + getToken() },
  473. // 上传的地址
  474. url: process.env.VUE_APP_BASE_API + "/training/byxWorkcertificate/importData"
  475. },
  476. // 报告附件参数
  477. doc: {
  478. file: "",
  479. // 是否显示弹出层(报告附件)
  480. open: false,
  481. // 弹出层标题(报告附件)
  482. title: "附件",
  483. // 是否禁用上传
  484. isUploading: false,
  485. // 是否更新已经存在的用户数据
  486. updateSupport: 0,
  487. // 报告附件上传位置编号
  488. ids: 0,
  489. // 设置上传的请求头部
  490. headers: { Authorization: "Bearer " + getToken() },
  491. // 上传的地址
  492. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  493. commonfileList: null,
  494. queryParams: {
  495. pId: null,
  496. pType: 'traning'
  497. },
  498. pType: 'traning',
  499. pId: null,
  500. form: {}
  501. },
  502. pdf : {
  503. title: '',
  504. pdfUrl: '',
  505. numPages: null,
  506. open: false,
  507. pageNum: 1,
  508. pageTotalNum: 1,
  509. loadedRatio: 0,
  510. },
  511. // 查询参数
  512. queryParams: {
  513. pageNum: 1,
  514. pageSize: 20,
  515. classes: null,
  516. guardian: 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. },
  531. watch: {
  532. // 根据名称筛选部门树
  533. deptName(val) {
  534. this.$refs.tree.filter(val);
  535. }
  536. },
  537. created() {
  538. //设置表格高度对应屏幕高度
  539. this.$nextTick(() => {
  540. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  541. })
  542. this.getList();
  543. this.getTreeselect();
  544. this.getDicts("PLANT_DIVIDE").then(response => {
  545. this.plantCodeOptions = response.data;
  546. });
  547. this.getDicts("CLASSES").then(response => {
  548. this.classesOptions = response.data;
  549. });
  550. },
  551. methods: {
  552. tableCellStyle({row, column, rowIndex, columnIndex}) {
  553. if (columnIndex === 4||columnIndex === 5||columnIndex === 6) {
  554. return "background:#DDFFDD;";
  555. }
  556. if (columnIndex === 7||columnIndex === 8||columnIndex === 9) {
  557. return "background:#FFFFDD;";
  558. }
  559. if (columnIndex === 10||columnIndex === 11||columnIndex === 12) {
  560. return "background:#DDFFFF;";
  561. }
  562. if (columnIndex === 13||columnIndex === 14||columnIndex === 15) {
  563. return "background:rgb(229, 249, 175);";
  564. }
  565. },
  566. /** 查询作业证书一览列表 */
  567. getList() {
  568. this.loading = true;
  569. listByxWorkcertificate(this.queryParams).then(response => {
  570. this.workcertificateList = response.rows;
  571. this.total = response.total;
  572. this.loading = false;
  573. });
  574. },
  575. /** 查询部门下拉树结构 */
  576. getTreeselect() {
  577. treeselect().then(response => {
  578. this.deptOptions = response.data;
  579. });
  580. },
  581. // 装置名称字典翻译
  582. plantCodeFormat(row, column) {
  583. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  584. },
  585. // 班组字典翻译
  586. classesFormat(row, column) {
  587. return this.selectDictLabel(this.classesOptions, row.classes);
  588. },
  589. // 取消按钮
  590. cancel() {
  591. this.open = false;
  592. this.reset();
  593. },
  594. // 表单重置
  595. reset() {
  596. this.form = {
  597. id: null,
  598. plantCode: null,
  599. name: null,
  600. employeeid: null,
  601. classes: null,
  602. container: null,
  603. fireFacilities: null,
  604. idnum: null,
  605. reviewdate: null,
  606. pipevalidity: null,
  607. guardian: null,
  608. boilvalidity: null,
  609. hydrogenation: null,
  610. hydvalidity: null,
  611. hydnextreview: null,
  612. cracking: null,
  613. crackingvalidity: null,
  614. crackingreview: null,
  615. foremantrain: null,
  616. foremanreview: null,
  617. foremannextreview: null,
  618. waterdate: null,
  619. energydate: null,
  620. refrigerationdate: null,
  621. delFlag: null,
  622. createrCode: null,
  623. createdate: null,
  624. updaterCode: null,
  625. updatedate: null,
  626. remarks: null,
  627. deptId: null
  628. };
  629. this.resetForm("form");
  630. },
  631. /** 搜索按钮操作 */
  632. handleQuery() {
  633. this.queryParams.pageNum = 1;
  634. this.getList();
  635. },
  636. /** 重置按钮操作 */
  637. resetQuery() {
  638. this.resetForm("queryForm");
  639. this.handleQuery();
  640. },
  641. // 多选框选中数据
  642. handleSelectionChange(selection) {
  643. this.ids = selection.map(item => item.id)
  644. this.single = selection.length!==1
  645. this.multiple = !selection.length
  646. },
  647. /** 新增按钮操作 */
  648. handleAdd() {
  649. this.reset();
  650. this.open = true;
  651. this.title = this.$t('新增') + this.$t('空格') + this.$t('作业证书一览');
  652. },
  653. /** 修改按钮操作 */
  654. handleUpdate(row) {
  655. this.reset();
  656. const id = row.id || this.ids
  657. getByxWorkcertificate(id).then(response => {
  658. this.form = response.data;
  659. this.open = true;
  660. this.title = this.$t('修改') + this.$t('作业证书一览');
  661. });
  662. },
  663. /** 提交按钮 */
  664. submitForm() {
  665. this.$refs["form"].validate(valid => {
  666. if (valid) {
  667. if (this.form.id != null) {
  668. updateByxWorkcertificate(this.form).then(response => {
  669. this.msgSuccess(this.$t('修改成功'));
  670. this.open = false;
  671. this.getList();
  672. });
  673. } else {
  674. addByxWorkcertificate(this.form).then(response => {
  675. this.msgSuccess(this.$t('新增成功'));
  676. this.open = false;
  677. this.getList();
  678. });
  679. }
  680. }
  681. });
  682. },
  683. /** 删除按钮操作 */
  684. handleDelete(row) {
  685. const ids = row.id || this.ids;
  686. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  687. confirmButtonText: this.$t('确定'),
  688. cancelButtonText: this.$t('取消'),
  689. type: "warning"
  690. }).then(function() {
  691. return delByxWorkcertificate(ids);
  692. }).then(() => {
  693. this.getList();
  694. this.msgSuccess(this.$t('删除成功'));
  695. })
  696. },
  697. /** 导出按钮操作 */
  698. handleExport() {
  699. const queryParams = this.queryParams;
  700. this.$confirm(this.$t('是否确认导出所有作业证书一览数据项?'), this.$t('警告'), {
  701. confirmButtonText: this.$t('确定'),
  702. cancelButtonText: this.$t('取消'),
  703. type: "warning"
  704. }).then(function() {
  705. return exportByxWorkcertificate(queryParams);
  706. }).then(response => {
  707. this.download(response.msg);
  708. })
  709. },
  710. /** 导入按钮操作 */
  711. handleImport() {
  712. this.upload.title = this.$t('用户导入');
  713. this.upload.open = true;
  714. },
  715. /** 下载模板操作 */
  716. importTemplate() {
  717. this.$refs['downloadFileForm'].submit()
  718. },
  719. // 文件上传中处理
  720. handleFileUploadProgress(event, file, fileList) {
  721. this.upload.isUploading = true;
  722. },
  723. // 文件上传成功处理
  724. handleFileSuccess(response, file, fileList) {
  725. this.upload.open = false;
  726. this.upload.isUploading = false;
  727. this.$refs.upload.clearFiles();
  728. if (response.data[0] != null) {
  729. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据') + "," + this.$t('第') + response.data + this.$t('行数据出现错误导入失败')+"。", this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  730. }else {
  731. this.$alert(this.$t('成功导入') + response.msg + this.$t('条数据'), this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  732. }
  733. this.getList();
  734. },
  735. // 提交上传文件
  736. submitFileForm() {
  737. this.$refs.upload.submit();
  738. },
  739. //数据分析
  740. handleData(){
  741. this.drawer = true
  742. },
  743. /** 报告附件按钮操作 */
  744. handleDoc(row , fileType) {
  745. var workType = "";
  746. if (fileType === "byxworkcertificate-container"){
  747. workType = this.$t('移动式压力容器充装');
  748. }else if (fileType === "byxworkcertificate-fireFacilities"){
  749. workType = this.$t('消防设施操作');
  750. }else if (fileType === "byxworkcertificate-guardian") {
  751. workType = this.$t('监护人专项培训');
  752. }else if (fileType === "byxworkcertificate-foremantrain") {
  753. workType = this.$t('班组长');
  754. }
  755. this.doc.pType = fileType
  756. this.doc.queryParams.pType = fileType
  757. this.doc.id = row.id;
  758. this.doc.title = row.name + this.$t('的')+ this.$t('空格') + workType+ this.$t('空格') + this.$t('空格')+ this.$t('附件') ;
  759. this.doc.open = true;
  760. this.doc.queryParams.pId = row.id
  761. this.doc.pId = row.id
  762. this.getFileList()
  763. this.$nextTick(() => {
  764. this.$refs.doc.clearFiles()
  765. })
  766. },
  767. handleSee (row){
  768. // window.open(process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl);//path是文件的全路径地址
  769. this.pdf.open =true
  770. this.pdf.title = row.fileName
  771. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  772. },
  773. // 文件下载处理
  774. handleDownload(row) {
  775. var name = row.fileName;
  776. var url = row.fileUrl;
  777. var suffix = url.substring(url.lastIndexOf("."), url.length);
  778. const a = document.createElement('a')
  779. a.setAttribute('download', name)
  780. a.setAttribute('target', '_blank')
  781. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  782. a.click()
  783. },
  784. /** 删除按钮操作 */
  785. handleDeleteDoc(row) {
  786. const ids = row.id || this.ids;
  787. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  788. confirmButtonText: this.$t('确定'),
  789. cancelButtonText: this.$t('取消'),
  790. type: "warning"
  791. }).then(function() {
  792. return delCommonfile(ids);
  793. }).then(() => {
  794. this.getFileList()
  795. this.msgSuccess(this.$t('删除成功'));
  796. })
  797. },
  798. openPdf(){
  799. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  800. },
  801. //附件上传中处理
  802. handleFileDocProgress(event, file, fileList) {
  803. this.doc.file = file;
  804. this.doc.isUploading = true;
  805. },
  806. //附件上传成功处理
  807. handleFileDocSuccess(response, file, fileList) {
  808. this.doc.isUploading = false;
  809. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  810. this.getFileList()
  811. },
  812. getFileList (){
  813. allFileList(this.doc.queryParams).then(response => {
  814. this.doc.commonfileList = response;
  815. });
  816. },
  817. }
  818. };
  819. </script>