index.vue 19 KB

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