index.vue 35 KB

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