index.vue 32 KB

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