index.vue 35 KB

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