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