index.vue 36 KB

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