index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  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:safetyapproval: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:safetyapproval: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:safetyapproval: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:safetyapproval: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:safetyapproval: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="safetyapprovalList" @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="适用范围" 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="是否需要跟进" align="center" prop="follow" :formatter="followFormat"/>
  83. <el-table-column label="使用/储存/废物最大量" align="center" prop="allowance" :show-overflow-tooltip="true"/>
  84. <el-table-column label="排放/监控要求" align="center" prop="requirements" :show-overflow-tooltip="true"/>
  85. <el-table-column label="主要内容" 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:safetyapproval: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:safetyapproval: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:safetyapproval: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. >{{ $t('主要内容') }}</el-button>-->
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. <pagination
  133. v-show="total>0"
  134. :total="total"
  135. :page.sync="queryParams.pageNum"
  136. :limit.sync="queryParams.pageSize"
  137. @pagination="getList"
  138. />
  139. <!-- 添加或修改安全批文清单对话框 -->
  140. <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="900px" append-to-body>
  141. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  142. <el-form-item :label="$t('装置名称')" prop="plantCode">
  143. <el-select v-model="form.plantCode" :placeholder="$t('请选择') + $t('装置名称')">
  144. <el-option
  145. v-for="dict in plantCodeOptions"
  146. :key="dict.dictValue"
  147. :label="dict.dictLabel"
  148. :value="dict.dictValue"
  149. ></el-option>
  150. </el-select>
  151. </el-form-item>
  152. <el-form-item :label="$t('批文名称')" prop="approvalname">
  153. <el-input v-model="form.approvalname" :placeholder="$t('请输入') + $t('批文名称')" />
  154. </el-form-item>
  155. <el-form-item :label="$t('证书编号')" prop="certno">
  156. <el-input v-model="form.certno" :placeholder="$t('请输入') + $t('证书编号')" />
  157. </el-form-item>
  158. <el-form-item :label="$t('批准日期')" prop="effetivedate">
  159. <el-date-picker clearable size="small" style="width: 200px"
  160. v-model="form.effetivedate"
  161. type="date"
  162. value-format="yyyy-MM-dd"
  163. :placeholder="$t('请选择') + $t('批准日期')">
  164. </el-date-picker>
  165. </el-form-item>
  166. <el-form-item :label="$t('适用范围')" prop="scope">
  167. <el-input
  168. type="textarea"
  169. :rows="4"
  170. :placeholder="$t('请输入') + $t('适用范围')"
  171. v-model="form.scope">
  172. </el-input>
  173. </el-form-item>
  174. <el-form-item :label="$t('相关法规')" prop="relatedlaw">
  175. <el-input v-model="form.relatedlaw" :placeholder="$t('请输入') + $t('相关法规')" />
  176. </el-form-item>
  177. <el-form-item :label="$t('审批单位')" prop="responsauth">
  178. <el-input v-model="form.responsauth" :placeholder="$t('请输入') + $t('审批单位')" />
  179. </el-form-item>
  180. <el-form-item :label="$t('有效期是否永久')" prop="isPermanent">
  181. <el-select v-model="form.isPermanent" :placeholder="$t('请选择') + $t('有效期是否永久')" @change="permanentChange($event)">
  182. <el-option
  183. v-for="dict in isPermanentOptions"
  184. :key="dict.dictValue"
  185. :label="dict.dictLabel"
  186. :value="parseInt(dict.dictValue)"
  187. ></el-option>
  188. </el-select>
  189. </el-form-item>
  190. <el-form-item :label="$t('证书有效期')" label-width="50">
  191. <el-date-picker
  192. v-model="chooseDate"
  193. type="daterange"
  194. align="right"
  195. unlink-panels
  196. :range-separator="$t('至')"
  197. :start-placeholder="$t('开始日期')"
  198. :end-placeholder="$t('结束日期')"
  199. value-format="yyyy-MM-dd"
  200. :picker-options="pickerOptions"
  201. :disabled="canChange">
  202. </el-date-picker>
  203. </el-form-item>
  204. <el-form-item :label="$t('是否需要跟进')" prop="follow">
  205. <el-select v-model="form.follow" :placeholder="$t('请选择') + $t('是否需要跟进')">
  206. <el-option
  207. v-for="dict in followOptions"
  208. :key="dict.dictValue"
  209. :label="dict.dictLabel"
  210. :value="dict.dictValue"
  211. ></el-option>
  212. </el-select>
  213. </el-form-item>
  214. <el-form-item :label="$t('使用/储存/废物最大量')" prop="allowance">
  215. <el-input v-model="form.allowance" :placeholder="$t('请输入') + $t('使用/储存/废物最大量')" />
  216. </el-form-item>
  217. <el-form-item :label="$t('排放/监控要求')" prop="requirements">
  218. <el-input v-model="form.requirements" :placeholder="$t('请输入') + $t('排放/监控要求')" />
  219. </el-form-item>
  220. <el-form-item :label="$t('主要内容')" prop="content">
  221. <el-input v-model="form.content" type="textarea" :placeholder="$t('请输入') + $t('主要内容')" />
  222. </el-form-item>
  223. <el-form-item :label="$t('负责人')" prop="owner">
  224. <el-input v-model="form.owner" :placeholder="$t('请输入') + $t('负责人')" />
  225. </el-form-item>
  226. <el-form-item :label="$t('回顾人')" prop="reviewer">
  227. <el-select v-model="form.reviewer" filterable :placeholder="$t('请选择') + $t('回顾人')">
  228. <el-option
  229. v-for="dict in reviewerOptions"
  230. :key="dict.staffid"
  231. :label="dict.name"
  232. :value="dict.staffid">
  233. <span style="float: left">{{ dict.name }}</span>
  234. <span style="float: right; color: #8492a6; font-size: 13px">{{ dict.staffid }}</span>
  235. </el-option>
  236. </el-select>
  237. </el-form-item>
  238. <el-form-item :label="$t('本次回顾日期')" prop="reviewdate">
  239. <el-date-picker clearable size="small" style="width: 200px"
  240. v-model="form.reviewdate"
  241. type="date"
  242. value-format="yyyy-MM-dd"
  243. :placeholder="$t('请选择') + $t('本次回顾日期')">
  244. </el-date-picker>
  245. </el-form-item>
  246. <el-form-item :label="$t('回顾结果')" prop="reviewResult">
  247. <el-input v-model="form.reviewResult" :placeholder="$t('请输入') + $t('回顾结果')" />
  248. </el-form-item>
  249. <el-form-item :label="$t('下次回顾日期')" prop="nextreviewdate">
  250. <el-date-picker clearable size="small" style="width: 200px"
  251. v-model="form.nextreviewdate"
  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="remarks">
  258. <el-input v-model="form.remarks" :placeholder="$t('请输入') + $t('备注')" />
  259. </el-form-item>
  260. <el-form-item :label="$t('归属部门')" prop="deptId">
  261. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择') + $t('归属部门')" />
  262. </el-form-item>
  263. </el-form>
  264. <div slot="footer" class="dialog-footer">
  265. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  266. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  267. </div>
  268. </el-dialog>
  269. <!-- 用户导入对话框 -->
  270. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  271. <el-upload
  272. ref="upload"
  273. :limit="1"
  274. accept=".xlsx, .xls"
  275. :headers="upload.headers"
  276. :action="upload.url"
  277. :disabled="upload.isUploading"
  278. :on-progress="handleFileUploadProgress"
  279. :on-success="handleFileSuccess"
  280. :auto-upload="false"
  281. drag
  282. >
  283. <i class="el-icon-upload"></i>
  284. <div class="el-upload__text">
  285. {{ $t('将文件拖到此处,或') }}
  286. <em>{{ $t('点击上传') }}</em>
  287. </div>
  288. <div class="el-upload__tip" slot="tip">
  289. <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  290. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  291. </div>
  292. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  293. <input name="type" :value="upload.type" hidden />
  294. </form>
  295. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  296. </el-upload>
  297. <div slot="footer" class="dialog-footer">
  298. <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>
  299. <el-button @click="upload.open = false">{{ $t('取 消') }}</el-button>
  300. </div>
  301. </el-dialog>
  302. <!-- 报告附件对话框 -->
  303. <el-dialog v-dialogDrag :title="doc.title" :visible.sync="doc.open" width="700px" append-to-body>
  304. <el-upload
  305. ref="doc"
  306. :limit="50"
  307. :headers="doc.headers"
  308. :action="doc.url + '?pType=' + doc.pType + '&pId=' + doc.pId"
  309. :disabled="doc.isUploading"
  310. :on-progress="handleFileDocProgress"
  311. :on-success="handleFileDocSuccess"
  312. :auto-upload="true"
  313. drag
  314. >
  315. <i class="el-icon-upload"></i>
  316. <div class="el-upload__text">
  317. {{ $t('将文件拖到此处,或') }}
  318. <em>{{ $t('点击上传') }}</em>
  319. </div>
  320. </el-upload>
  321. <el-table :data="doc.commonfileList" border>
  322. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  323. <template slot-scope="scope">
  324. <a class="link-type" @click="handleDownload(scope.row)">
  325. <span>{{ scope.row.fileName }}</span>
  326. </a>
  327. </template>
  328. </el-table-column>
  329. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  330. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  331. <el-table-column :label="$t('操作')" align="center" width="150" class-name="small-padding fixed-width">
  332. <template slot-scope="scope">
  333. <el-button
  334. v-if="scope.row.fileName.endsWith('pdf')"
  335. size="mini"
  336. type="text"
  337. icon="el-icon-view"
  338. @click="handleSee(scope.row)"
  339. >{{ $t('预览') }}</el-button>
  340. <el-button
  341. size="mini"
  342. type="text"
  343. icon="el-icon-download"
  344. @click="handleDownload(scope.row)"
  345. >{{ $t('下载') }}</el-button>
  346. <el-button
  347. size="mini"
  348. type="text"
  349. icon="el-icon-delete"
  350. @click="handleDeleteDoc(scope.row)"
  351. >{{ $t('删除') }}</el-button>
  352. </template>
  353. </el-table-column>
  354. </el-table>
  355. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1700px" append-to-body>
  356. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  357. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  358. <div style="margin-top: -30px">
  359. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  360. </div>
  361. </el-dialog>
  362. <div slot="footer" class="dialog-footer">
  363. <!-- <el-button type="primary" @click="submitFileForm">{{ $t('确 定') }}</el-button>-->
  364. <el-button @click="doc.open = false">{{ $t('返 回') }}</el-button>
  365. </div>
  366. </el-dialog>
  367. </div>
  368. </template>
  369. <script>
  370. import { listSafetyapproval, getSafetyapproval, delSafetyapproval, addSafetyapproval, updateSafetyapproval, exportSafetyapproval } from "@/api/ehs/safetyapproval";
  371. import { listStaffmgr } from "@/api/plant/staffmgr";
  372. import {allFileList, delCommonfile} from "@/api/common/commonfile";
  373. import { treeselect } from "@/api/system/dept";
  374. import { getToken } from "@/utils/auth";
  375. import Treeselect from "@riophae/vue-treeselect";
  376. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  377. import pdf from "vue-pdf";
  378. export default {
  379. name: "Safetyapproval",
  380. components: { Treeselect },
  381. data() {
  382. return {
  383. // 遮罩层
  384. loading: true,
  385. // 选中数组
  386. ids: [],
  387. // 非单个禁用
  388. single: true,
  389. // 非多个禁用
  390. multiple: true,
  391. // 显示搜索条件
  392. showSearch: false,
  393. // 总条数
  394. total: 0,
  395. // 安全批文清单表格数据
  396. safetyapprovalList: [],
  397. // 弹出层标题
  398. title: "",
  399. // 部门树选项
  400. deptOptions: undefined,
  401. clientHeight:300,
  402. // 是否显示弹出层
  403. open: false,
  404. //日期快速选择
  405. pickerOptions: {
  406. shortcuts: [{
  407. text: this.$t('最近一周'),
  408. onClick(picker) {
  409. const end = new Date();
  410. const start = new Date();
  411. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  412. picker.$emit('pick', [start, end]);
  413. }
  414. }, {
  415. text: this.$t('最近一个月'),
  416. onClick(picker) {
  417. const end = new Date();
  418. const start = new Date();
  419. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  420. picker.$emit('pick', [start, end]);
  421. }
  422. }, {
  423. text: this.$t('最近三个月'),
  424. onClick(picker) {
  425. const end = new Date();
  426. const start = new Date();
  427. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  428. picker.$emit('pick', [start, end]);
  429. }
  430. }]
  431. },
  432. //日期选择器
  433. chooseDate: [],
  434. // 装置字典
  435. plantCodeOptions: [],
  436. // 是否需要跟进字典
  437. followOptions: [],
  438. // 证书有效期是否永久字典
  439. isPermanentOptions: [],
  440. //回顾人字典
  441. reviewerOptions: [],
  442. // 用户导入参数
  443. upload: {
  444. //下载模板请求地址
  445. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  446. //下载模板类型
  447. type: "safetyapproval",
  448. // 是否显示弹出层(用户导入)
  449. open: false,
  450. // 弹出层标题(用户导入)
  451. title: "",
  452. // 是否禁用上传
  453. isUploading: false,
  454. // 是否更新已经存在的用户数据
  455. updateSupport: 0,
  456. // 设置上传的请求头部
  457. headers: { Authorization: "Bearer " + getToken() },
  458. // 上传的地址
  459. url: process.env.VUE_APP_BASE_API + "/ehs/safetyapproval/importData"
  460. },
  461. // 报告附件参数
  462. doc: {
  463. file: "",
  464. // 是否显示弹出层(报告附件)
  465. open: false,
  466. // 弹出层标题(报告附件)
  467. title: "",
  468. // 是否禁用上传
  469. isUploading: false,
  470. // 是否更新已经存在的用户数据
  471. updateSupport: 0,
  472. // 报告附件上传位置编号
  473. ids: 0,
  474. // 设置上传的请求头部
  475. headers: { Authorization: "Bearer " + getToken() },
  476. // 上传的地址
  477. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  478. commonfileList: null,
  479. queryParams: {
  480. pId: null,
  481. pType: 'safetyapproval'
  482. },
  483. pType: 'safetyapproval',
  484. pId: null
  485. },
  486. pdf : {
  487. title: '',
  488. pdfUrl: '',
  489. numPages: null,
  490. open: false,
  491. pageNum: 1,
  492. pageTotalNum: 1,
  493. loadedRatio: 0,
  494. },
  495. // 查询参数
  496. queryParams: {
  497. pageNum: 1,
  498. pageSize: 20,
  499. plantCode: null,
  500. approvalname: null,
  501. certno: null,
  502. effetivedate: null,
  503. validity: null,
  504. relatedlaw: null,
  505. responsauth: null,
  506. owner: null,
  507. reviewdate: null,
  508. nextreviewdate: null,
  509. remarks: null,
  510. scope: null,
  511. follow: null,
  512. allowance: null,
  513. requirements: null,
  514. reviewer: null
  515. },
  516. //人员表查询参数
  517. staffmgrQueryParams: {},
  518. // 表单参数
  519. form: {},
  520. //证书是否永久
  521. canChange: false,
  522. // 表单校验
  523. rules: {
  524. plantCode: [
  525. { required: true, message: this.$t('装置') + this.$t('不能为空'), trigger: "change" }
  526. ],
  527. approvalname: [
  528. { required: true, message: this.$t('批文名称') + this.$t('不能为空'), trigger: "blur" }
  529. ],
  530. certno: [
  531. { required: true, message: this.$t('证书编号') + this.$t('不能为空'), trigger: "blur" }
  532. ],
  533. effetivedate: [
  534. { required: true, message: this.$t('批准日期') + this.$t('不能为空'), trigger: "blur" }
  535. ],
  536. relatedlaw: [
  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. reviewdate: [
  549. { required: true, message: this.$t('本次回顾日期') + this.$t('不能为空'), trigger: "blur" }
  550. ],
  551. nextreviewdate: [
  552. { required: true, message: this.$t('下次回顾日期') + this.$t('不能为空'), trigger: "blur" }
  553. ],
  554. scope: [
  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. allowance: [
  561. { required: true, message: this.$t('使用/储存/废物最大量') + this.$t('不能为空'), trigger: "blur" }
  562. ],
  563. requirements: [
  564. { required: true, message: this.$t('排放/监控要求') + this.$t('不能为空'), trigger: "blur" }
  565. ],
  566. reviewer: [
  567. { required: true, message: this.$t('回顾人') + this.$t('不能为空'), trigger: "blur" }
  568. ],
  569. reviewResult: [
  570. { required: true, message: this.$t('回顾结果') + this.$t('不能为空'), trigger: "blur" }
  571. ],
  572. content: [
  573. { required: true, message: this.$t('主要内容') + this.$t('不能为空'), trigger: "blur" }
  574. ],
  575. deptId: [
  576. { required: true, message: this.$t('归属部门') + this.$t('不能为空'), trigger: "blur" }
  577. ]
  578. }
  579. };
  580. },
  581. watch: {
  582. // 根据名称筛选部门树
  583. deptName(val) {
  584. this.$refs.tree.filter(val);
  585. }
  586. },
  587. created() {
  588. //设置表格高度对应屏幕高度
  589. this.$nextTick(() => {
  590. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  591. })
  592. this.getList();
  593. this.getReviewer();
  594. this.getTreeselect();
  595. this.getDicts("PLANT_DIVIDE").then(response => {
  596. this.plantCodeOptions = response.data;
  597. });
  598. this.getDicts("YES_NO").then(response => {
  599. this.isPermanentOptions = response.data;
  600. });
  601. this.getDicts("YES_NO").then(response => {
  602. this.followOptions = response.data;
  603. });
  604. },
  605. methods: {
  606. /** 查询安全批文清单列表 */
  607. getList() {
  608. this.loading = true;
  609. listSafetyapproval(this.queryParams).then(response => {
  610. this.safetyapprovalList = response.rows;
  611. this.total = response.total;
  612. this.loading = false;
  613. });
  614. },
  615. /** 查询部门下拉树结构 */
  616. getTreeselect() {
  617. treeselect().then(response => {
  618. this.deptOptions = response.data;
  619. });
  620. },
  621. getReviewer() {
  622. listStaffmgr(this.staffmgrQueryParams).then(response => {
  623. this.reviewerOptions = response.rows;
  624. });
  625. },
  626. // 装置字典翻译
  627. plantCodeFormat(row, column) {
  628. return this.selectDictLabel(this.plantCodeOptions, row.plantCode);
  629. },
  630. // 证书有效期是否永久翻译
  631. isPermanentFormat(row, column) {
  632. return this.selectDictLabel(this.isPermanentOptions, row.isPermanent);
  633. },
  634. // 是否需要跟进字典翻译
  635. followFormat(row, column) {
  636. return this.selectDictLabel(this.followOptions, row.follow);
  637. },
  638. // 取消按钮
  639. cancel() {
  640. this.open = false;
  641. this.reset();
  642. },
  643. // 表单重置
  644. reset() {
  645. this.form = {
  646. id: null,
  647. plantCode: null,
  648. approvalname: null,
  649. certno: null,
  650. effetivedate: null,
  651. validity: null,
  652. relatedlaw: null,
  653. responsauth: null,
  654. owner: null,
  655. reviewdate: null,
  656. nextreviewdate: null,
  657. conttype: null,
  658. delFlag: null,
  659. createrCode: null,
  660. createdate: null,
  661. updaterCode: null,
  662. updatedate: null,
  663. deptId: null,
  664. remarks: null
  665. };
  666. this.resetForm("form");
  667. },
  668. /** 搜索按钮操作 */
  669. handleQuery() {
  670. this.queryParams.pageNum = 1;
  671. this.getList();
  672. },
  673. /** 重置按钮操作 */
  674. resetQuery() {
  675. this.resetForm("queryForm");
  676. this.handleQuery();
  677. },
  678. // 多选框选中数据
  679. handleSelectionChange(selection) {
  680. this.ids = selection.map(item => item.id)
  681. this.single = selection.length!==1
  682. this.multiple = !selection.length
  683. },
  684. //证书有效期是否永久
  685. permanentChange(val) {
  686. if (val == 1) {
  687. this.canChange = true
  688. this.chooseDate = []
  689. }else if (val == 0){
  690. this.canChange = false
  691. }
  692. },
  693. /** 新增按钮操作 */
  694. handleAdd() {
  695. this.reset();
  696. this.open = true;
  697. this.chooseDate = [];
  698. this.title = this.$t('新增') + " " + this.$t('安全批文清单');
  699. },
  700. /** 修改按钮操作 */
  701. handleUpdate(row) {
  702. this.reset();
  703. this.chooseDate = [];
  704. if (row.isPermanent == 1) {
  705. this.canChange = true
  706. }else if (row.isPermanent == 0){
  707. this.canChange = false
  708. }
  709. const id = row.id || this.ids
  710. getSafetyapproval(id).then(response => {
  711. this.form = response.data;
  712. this.chooseDate = this.$set(this.form,'chooseDate',[""+response.data.validityBefore+"",""+response.data.validityAfter+""]);
  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("/safetyapproval/edit/" + tableId);
  721. },
  722. /** 提交按钮 */
  723. submitForm() {
  724. this.$refs["form"].validate(valid => {
  725. if (valid) {
  726. this.form.validityBefore = this.chooseDate[0];
  727. this.form.validityAfter = this.chooseDate[1];
  728. console.info("validityBefore:" + this.form.validityBefore)
  729. console.info("validityAfter:" + this.form.validityAfter)
  730. if (this.form.id != null) {
  731. updateSafetyapproval(this.form).then(response => {
  732. this.msgSuccess(this.$t('修改成功'));
  733. this.open = false;
  734. this.getList();
  735. });
  736. } else {
  737. addSafetyapproval(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 delSafetyapproval(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 exportSafetyapproval(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>