index.vue 34 KB

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