index.vue 18 KB

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