index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="器材名称" prop="devName">
  5. <el-input
  6. v-model="queryParams.devName"
  7. placeholder="请输入器材名称"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="年" prop="planYear">
  13. <el-date-picker
  14. v-model="year"
  15. :clearable="false"
  16. format="yyyy"
  17. placeholder="请选择年份"
  18. type="year"
  19. @change="handleQuery">
  20. </el-date-picker>
  21. </el-form-item>
  22. <el-form-item label="月" prop="planQuarter">
  23. <el-date-picker
  24. v-model="month"
  25. :clearable="false"
  26. format="MM"
  27. placeholder="选择月"
  28. popper-class="picker-date"
  29. type="month"
  30. @change="handleQuery">
  31. </el-date-picker>
  32. </el-form-item>
  33. <el-form-item label="计划名称" prop="planId">
  34. <el-select v-model="queryParams.planId" clearable
  35. @change="handleQuery">
  36. <el-option v-for="item in planList"
  37. :key="item.id"
  38. :label="item.planName"
  39. :value="item.id"/>
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item>
  43. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  44. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  45. </el-form-item>
  46. </el-form>
  47. <el-row :gutter="10" class="mb8">
  48. <el-col :span="1.5">
  49. <el-button
  50. type="warning"
  51. plain
  52. icon="el-icon-download"
  53. size="mini"
  54. @click="handleExport"
  55. v-hasPermi="['emergency:cabinet:export']"
  56. >导出</el-button>
  57. </el-col>
  58. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  59. </el-row>
  60. <el-tabs v-model="devType" @tab-click="handleQuery">
  61. <el-tab-pane label="事故柜1" name="1">
  62. <el-table v-loading="loading" :data="cabinetList" :height="clientHeight" @selection-change="handleSelectionChange" border>
  63. <el-table-column type="selection" width="55" align="center" />
  64. <el-table-column label="器材名称" align="center" prop="devName" />
  65. <el-table-column label="器材标配数量" align="center" prop="devNum" />
  66. <el-table-column label="器材数量" align="center" prop="quantityEquipment">
  67. <template slot-scope="scope">
  68. <dict-tag :options="dict.type.inspection_status" :value="scope.row.quantityEquipment"/>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="器材完好度" align="center" prop="equipmentIntegrity">
  72. <template slot-scope="scope">
  73. <dict-tag :options="dict.type.inspection_status" :value="scope.row.equipmentIntegrity"/>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="器材整洁度" align="center" prop="equipmentCleanliness">
  77. <template slot-scope="scope">
  78. <dict-tag :options="dict.type.inspection_status" :value="scope.row.equipmentCleanliness"/>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="器材标签有效期" align="center" prop="labelValidity">
  82. <template slot-scope="scope">
  83. <dict-tag :options="dict.type.inspection_status" :value="scope.row.labelValidity"/>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="确认人" align="center" prop="confirmed" />
  87. <el-table-column label="备注" align="center" prop="remarks" />
  88. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  89. <template slot-scope="scope">
  90. <el-button
  91. icon="el-icon-picture-outline"
  92. size="mini"
  93. type="text"
  94. @click="openFileDialog(scope.row)"
  95. >附件
  96. </el-button>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. </el-tab-pane>
  101. <el-tab-pane label="事故柜2" name="2">
  102. <el-table v-loading="loading" :data="cabinetList" :height="clientHeight" @selection-change="handleSelectionChange" border>
  103. <el-table-column type="selection" width="55" align="center" />
  104. <el-table-column label="器材名称" align="center" prop="devName" />
  105. <el-table-column label="器材标配数量" align="center" prop="devNum" />
  106. <el-table-column label="器材数量" align="center" prop="quantityEquipment">
  107. <template slot-scope="scope">
  108. <dict-tag :options="dict.type.inspection_status" :value="scope.row.quantityEquipment"/>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="器材完好度" align="center" prop="equipmentIntegrity">
  112. <template slot-scope="scope">
  113. <dict-tag :options="dict.type.inspection_status" :value="scope.row.equipmentIntegrity"/>
  114. </template>
  115. </el-table-column>
  116. <el-table-column label="自给空气呼吸器气压值(>27MPa)" align="center" prop="barometricValue">
  117. <template slot-scope="scope">
  118. <dict-tag :options="dict.type.inspection_status" :value="scope.row.barometricValue"/>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="自给空气呼吸器有效日期 (钢瓶有效期15年,三年检查一次并贴标)" align="center" prop="respiratorExpiration">
  122. <template slot-scope="scope">
  123. <dict-tag :options="dict.type.inspection_status" :value="scope.row.respiratorExpiration"/>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="确认人" align="center" prop="confirmed" />
  127. <el-table-column label="备注" align="center" prop="remarks" />
  128. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  129. <template slot-scope="scope">
  130. <el-button
  131. icon="el-icon-picture-outline"
  132. size="mini"
  133. type="text"
  134. @click="openFileDialog(scope.row)"
  135. >附件
  136. </el-button>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. </el-tab-pane>
  141. <el-tab-pane label="事故柜3" name="3">
  142. <el-table v-loading="loading" :data="cabinetList" :height="clientHeight" @selection-change="handleSelectionChange" border>
  143. <el-table-column type="selection" width="55" align="center" />
  144. <el-table-column label="器材名称" align="center" prop="devName" />
  145. <el-table-column label="器材标配数量" align="center" prop="devNum" />
  146. <el-table-column label="器材数量" align="center" prop="quantityEquipment">
  147. <template slot-scope="scope">
  148. <dict-tag :options="dict.type.inspection_status" :value="scope.row.quantityEquipment"/>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="器材完好度" align="center" prop="equipmentIntegrity">
  152. <template slot-scope="scope">
  153. <dict-tag :options="dict.type.inspection_status" :value="scope.row.equipmentIntegrity"/>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="自给空气呼吸器气压值(>27MPa)" align="center" prop="barometricValue">
  157. <template slot-scope="scope">
  158. <dict-tag :options="dict.type.inspection_status" :value="scope.row.barometricValue"/>
  159. </template>
  160. </el-table-column>
  161. <el-table-column label="自给空气呼吸器有效日期 (钢瓶有效期15年,三年检查一次并贴标)" align="center" prop="respiratorExpiration">
  162. <template slot-scope="scope">
  163. <dict-tag :options="dict.type.inspection_status" :value="scope.row.respiratorExpiration"/>
  164. </template>
  165. </el-table-column>
  166. <el-table-column label="确认人" align="center" prop="confirmed" />
  167. <el-table-column label="备注" align="center" prop="remarks" />
  168. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  169. <template slot-scope="scope">
  170. <el-button
  171. icon="el-icon-picture-outline"
  172. size="mini"
  173. type="text"
  174. @click="openFileDialog(scope.row)"
  175. >附件
  176. </el-button>
  177. </template>
  178. </el-table-column>
  179. </el-table>
  180. </el-tab-pane>
  181. </el-tabs>
  182. <pagination
  183. v-show="total>0"
  184. :total="total"
  185. :page.sync="queryParams.pageNum"
  186. :limit.sync="queryParams.pageSize"
  187. @pagination="getList"
  188. />
  189. <el-dialog :close-on-click-modal="false":visible.sync="file.open" append-to-body title="附件详情" width="50%">
  190. <el-tabs v-model="tabName" :stretch="true" type="border-card">
  191. <el-tab-pane label="常规附件" name="a">
  192. <el-empty v-if="file.files.length==0" description="如你所见,这里什么都没有"></el-empty>
  193. <el-image v-for="url in file.files" v-else :key="url" :src="url"></el-image>
  194. </el-tab-pane>
  195. <el-tab-pane label="异常附件" name="b">
  196. <el-empty v-if="file.issuesFiles.length==0" description="如你所见,这里什么都没有"></el-empty>
  197. <el-image v-for="url in file.issuesFiles" v-else :key="url" :src="url"></el-image>
  198. </el-tab-pane>
  199. <el-tab-pane label="异常整改后附件" name="c">
  200. <el-empty v-if="file.repairFile.length==0" description="如你所见,这里什么都没有"></el-empty>
  201. <el-image v-for="url in file.repairFile" v-else :key="url" :src="url"></el-image>
  202. </el-tab-pane>
  203. </el-tabs>
  204. </el-dialog>
  205. </div>
  206. </template>
  207. <script>
  208. import { listCabinet, getCabinet, delCabinet, addCabinet, updateCabinet } from "@/api/patrol/emergency/cabinet";
  209. import {listAllPlan} from "@/api/patrol/patrol/plan";
  210. export default {
  211. name: "Cabinet",
  212. dicts: ['inspection_status'],
  213. data() {
  214. return {
  215. tabName: 'a',
  216. planList: [],
  217. file: {
  218. open: false,
  219. issuesFiles: [],
  220. repairFile: [],
  221. files: []
  222. },
  223. month: new Date(),
  224. year: new Date(),
  225. devType:'1',
  226. // 遮罩层
  227. loading: true,
  228. // 选中数组
  229. ids: [],
  230. // 非单个禁用
  231. single: true,
  232. // 非多个禁用
  233. multiple: true,
  234. // 显示搜索条件
  235. showSearch: false,
  236. // 页面高度
  237. clientHeight: 300,
  238. // 总条数
  239. total: 0,
  240. // 应急事故柜表格数据
  241. cabinetList: [],
  242. // 弹出层标题
  243. title: "",
  244. // 是否显示弹出层
  245. open: false,
  246. // 查询参数
  247. queryParams: {
  248. pageNum: 1,
  249. pageSize: 20,
  250. id: null,
  251. devName: null,
  252. devNum: null,
  253. quantityEquipment: null,
  254. equipmentIntegrity: null,
  255. equipmentCleanliness: null,
  256. labelValidity: null,
  257. barometricValue: null,
  258. respiratorExpiration: null,
  259. confirmed: null,
  260. remarks: null,
  261. checkDate: null,
  262. devType: null,
  263. checkStatus: null,
  264. month: null,
  265. year: null,
  266. createrCode: null,
  267. createdate: null,
  268. updaterCode: null,
  269. updatedate: null,
  270. deptId: null,
  271. planId: null,
  272. problemFileUrl: null,
  273. fileUrl: null,
  274. issuesStatus: null,
  275. issuesFlag: null,
  276. repairFile: null
  277. },
  278. // 表单参数
  279. form: {},
  280. // 表单校验
  281. rules: {
  282. devType: [
  283. { required: true, message: "事故柜类型不能为空", trigger: "blur" }
  284. ],
  285. delFlag: [
  286. { required: true, message: "删除标识0未删除不能为空", trigger: "blur" }
  287. ],
  288. }
  289. };
  290. },
  291. created() {
  292. if (this.$route.query.year && this.$route.query.month) {
  293. this.year.setFullYear(this.$route.query.year, this.$route.query.month, 1);
  294. this.month.setMonth(this.$route.query.month, 1);
  295. }
  296. if (this.$route.query.planId) {
  297. this.queryParams.planId = parseInt(this.$route.query.planId)
  298. }
  299. if (this.$route.query.id) {
  300. this.queryParams.id = parseInt(this.$route.query.id)
  301. this.queryParams.issuesFlag = '1';
  302. }
  303. //设置表格高度对应屏幕高度
  304. this.$nextTick(() => {
  305. this.clientHeight = document.body.clientHeight - 270
  306. });
  307. if (!this.queryParams.id) {
  308. let query = {planQuarter: this.month.getMonth() + 1, planYear: this.year.getFullYear(), patrolType: '7'}
  309. listAllPlan(query).then(res => {
  310. this.planList = res.data;
  311. if (res.data.length > 0) {
  312. this.queryParams.planId = res.data[0].id;
  313. }
  314. this.getList();
  315. })
  316. }else{
  317. this.getList();
  318. }
  319. },
  320. methods: {
  321. openFileDialog(row) {
  322. this.tabName = 'a'
  323. this.file.issuesFiles = []
  324. this.file.files = []
  325. this.file.repairFile = []
  326. this.file.open = true;
  327. if (row.problemFileUrl)
  328. this.file.issuesFiles = row.problemFileUrl.split(',');
  329. if (row.fileUrl)
  330. this.file.files = row.fileUrl.split(',');
  331. if (row.repairFile)
  332. this.file.repairFile = row.repairFile.split(',');
  333. },
  334. getPlanList() {
  335. let query = {planQuarter: this.month.getMonth() + 1, planYear: this.year.getFullYear(), patrolType: '7'}
  336. listAllPlan(query).then(res => {
  337. this.planList = res.data;
  338. })
  339. },
  340. /** 查询应急事故柜列表 */
  341. getList() {
  342. this.loading = true;
  343. this.queryParams.devType=this.devType;
  344. if (!this.queryParams.id) {
  345. this.queryParams.month = this.month.getMonth() + 1;
  346. this.queryParams.year = this.year.getFullYear();
  347. }
  348. listCabinet(this.queryParams).then(response => {
  349. this.cabinetList = response.rows;
  350. this.total = response.total;
  351. this.loading = false;
  352. });
  353. },
  354. // 取消按钮
  355. cancel() {
  356. this.open = false;
  357. this.reset();
  358. },
  359. // 表单重置
  360. reset() {
  361. this.form = {
  362. id: null,
  363. devName: null,
  364. devNum: null,
  365. quantityEquipment: null,
  366. equipmentIntegrity: null,
  367. equipmentCleanliness: null,
  368. labelValidity: null,
  369. barometricValue: null,
  370. respiratorExpiration: null,
  371. confirmed: null,
  372. remarks: null,
  373. checkDate: null,
  374. devType: null,
  375. checkStatus: null,
  376. month: null,
  377. year: null,
  378. delFlag: null,
  379. createrCode: null,
  380. createdate: null,
  381. updaterCode: null,
  382. updatedate: null,
  383. deptId: null,
  384. planId: null,
  385. problemFileUrl: null,
  386. fileUrl: null,
  387. issuesStatus: null,
  388. issuesFlag: null,
  389. repairFile: null
  390. };
  391. this.resetForm("form");
  392. },
  393. /** 搜索按钮操作 */
  394. handleQuery() {
  395. this.queryParams.pageNum = 1;
  396. this.getList();
  397. this.getPlanList();
  398. },
  399. /** 重置按钮操作 */
  400. resetQuery() {
  401. this.resetForm("queryForm");
  402. this.handleQuery();
  403. },
  404. // 多选框选中数据
  405. handleSelectionChange(selection) {
  406. this.ids = selection.map(item => item.id)
  407. this.single = selection.length!==1
  408. this.multiple = !selection.length
  409. },
  410. /** 新增按钮操作 */
  411. handleAdd() {
  412. this.reset();
  413. this.open = true;
  414. this.title = "添加应急事故柜";
  415. },
  416. /** 修改按钮操作 */
  417. handleUpdate(row) {
  418. this.reset();
  419. const id = row.id || this.ids
  420. getCabinet(id).then(response => {
  421. this.form = response.data;
  422. this.open = true;
  423. this.title = "修改应急事故柜";
  424. });
  425. },
  426. /** 提交按钮 */
  427. submitForm() {
  428. this.$refs["form"].validate(valid => {
  429. if (valid) {
  430. if (this.form.id != null) {
  431. updateCabinet(this.form).then(response => {
  432. this.msgSuccess("修改成功");
  433. this.open = false;
  434. this.getList();
  435. });
  436. } else {
  437. addCabinet(this.form).then(response => {
  438. this.msgSuccess("新增成功");
  439. this.open = false;
  440. this.getList();
  441. });
  442. }
  443. }
  444. });
  445. },
  446. /** 删除按钮操作 */
  447. handleDelete(row) {
  448. const ids = row.id || this.ids;
  449. this.$confirm('是否确认删除应急事故柜编号为"' + ids + '"的数据项?').then(function() {
  450. return delCabinet(ids);
  451. }).then(() => {
  452. this.getList();
  453. this.msgSuccess("删除成功");
  454. }).catch(() => {});
  455. },
  456. /** 导出按钮操作 */
  457. handleExport() {
  458. this.download2('emergency/cabinet/export', {
  459. ...this.queryParams
  460. }, `cabinet_${new Date().getTime()}.xlsx`)
  461. }
  462. }
  463. };
  464. </script>