index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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="位号" prop="devNo">
  5. <el-input
  6. v-model="queryParams.devNo"
  7. placeholder="请输入位号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="年月" prop="yearMonth">
  14. <el-date-picker
  15. v-model="queryParams.yearMonth"
  16. type="month"
  17. placeholder="选择年月"
  18. clearable
  19. size="small"
  20. value-format="yyyy-MM"
  21. style="width: 150px"
  22. @change="handleYearMonthChange"
  23. />
  24. </el-form-item>
  25. <el-form-item label="巡检计划" prop="planId">
  26. <el-select
  27. v-model="queryParams.planId"
  28. placeholder="请选择巡检计划"
  29. clearable
  30. size="small"
  31. filterable
  32. @change="handleQuery"
  33. style="width: 200px"
  34. >
  35. <el-option
  36. v-for="item in planOptions"
  37. :key="item.id"
  38. :label="item.planName"
  39. :value="item.id"
  40. />
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  45. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  46. </el-form-item>
  47. </el-form>
  48. <el-row :gutter="10" class="mb8">
  49. <el-col :span="1.5">
  50. <el-button
  51. type="warning"
  52. icon="el-icon-download"
  53. size="mini"
  54. @click="handleExport"
  55. v-hasPermi="['ps:patrol:list']"
  56. >导出
  57. </el-button>
  58. </el-col>
  59. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  60. </el-row>
  61. <el-table v-loading="loading" :data="eyewashList" @selection-change="handleSelectionChange" :height="clientHeight"
  62. border>
  63. <el-table-column type="selection" width="55" align="center"/>
  64. <el-table-column label="位号" align="center" prop="devNo" width="120" :show-overflow-tooltip="true"/>
  65. <el-table-column label="洗眼器标识醒目并处于良好状况" align="center" prop="signageOk" width="200"
  66. :show-overflow-tooltip="true">
  67. <template slot-scope="scope">
  68. <dict-tag :options="dict.type.inspection_status" :value="scope.row.signageOk"/>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="洗眼器周围2米内无障碍物,易接近" align="center" prop="accessClear" width="200"
  72. :show-overflow-tooltip="true">
  73. <template slot-scope="scope">
  74. <dict-tag :options="dict.type.inspection_status" :value="scope.row.accessClear"/>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="所处区域有良好的照明,且没有被遮挡" align="center" prop="lightUnobstructed" width="200"
  78. :show-overflow-tooltip="true">
  79. <template slot-scope="scope">
  80. <dict-tag :options="dict.type.inspection_status" :value="scope.row.lightUnobstructed"/>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="洗眼器配件没有损坏或丢失,也没有可见的腐蚀" align="center" prop="partsOk" width="220"
  84. :show-overflow-tooltip="true">
  85. <template slot-scope="scope">
  86. <dict-tag :options="dict.type.inspection_status" :value="scope.row.partsOk"/>
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="洗眼器上游手阀处于全开状态,并采取常开保护措施" align="center" prop="valveOpenLocked" width="240"
  90. :show-overflow-tooltip="true">
  91. <template slot-scope="scope">
  92. <dict-tag :options="dict.type.inspection_status" :value="scope.row.valveOpenLocked"/>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="洗眼器喷头已安装防尘盖,并在启动时防尘盖能够自动打开" align="center" prop="dustcapOk" width="240"
  96. :show-overflow-tooltip="true">
  97. <template slot-scope="scope">
  98. <dict-tag :options="dict.type.inspection_status" :value="scope.row.dustcapOk"/>
  99. </template>
  100. </el-table-column>
  101. <el-table-column label="洗眼器从出水点起高度在10-30厘米并均匀流动" align="center" prop="waterHeight" width="220"
  102. :show-overflow-tooltip="true">
  103. <template slot-scope="scope">
  104. <dict-tag :options="dict.type.inspection_status" :value="scope.row.waterHeight"/>
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="洗眼器出水干净不黑无污染,没有颗粒" align="center" prop="waterClean" width="200"
  108. :show-overflow-tooltip="true">
  109. <template slot-scope="scope">
  110. <dict-tag :options="dict.type.inspection_status" :value="scope.row.waterClean"/>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="洗眼器出水温度不高于25℃" align="center" prop="waterTemp" width="180" :show-overflow-tooltip="true">
  114. <template slot-scope="scope">
  115. <dict-tag :options="dict.type.inspection_status" :value="scope.row.waterTemp"/>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="洗眼器手推板、脚踏板及喷淋拉杆灵活,能保持全开" align="center" prop="leversOk" width="240"
  119. :show-overflow-tooltip="true">
  120. <template slot-scope="scope">
  121. <dict-tag :options="dict.type.inspection_status" :value="scope.row.leversOk"/>
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="洗眼器测试前已通知ERC" align="center" prop="ercNotified" width="180" :show-overflow-tooltip="true">
  125. <template slot-scope="scope">
  126. <dict-tag :options="dict.type.inspection_status" :value="scope.row.ercNotified"/>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="现场声光报警装置工作正常" align="center" prop="localAlarmOk" width="200"
  130. :show-overflow-tooltip="true">
  131. <template slot-scope="scope">
  132. <dict-tag :options="dict.type.inspection_status" :value="scope.row.localAlarmOk"/>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="ERC接收到洗眼器报警测试信号,报警信号已反馈至DCS和中控室迷你盘" align="center"
  136. prop="alarmSignalOk" width="280" :show-overflow-tooltip="true">
  137. <template slot-scope="scope">
  138. <dict-tag :options="dict.type.inspection_status" :value="scope.row.alarmSignalOk"/>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="确认人" align="center" prop="confirmer" width="120" :show-overflow-tooltip="true"/>
  142. <el-table-column label="备注" align="center" prop="remarks" width="150" :show-overflow-tooltip="true"/>
  143. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="80">
  144. <template slot-scope="scope">
  145. <el-button
  146. icon="el-icon-picture-outline"
  147. size="mini"
  148. type="text"
  149. @click="openFileDialog(scope.row)"
  150. >附件
  151. </el-button>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. <pagination
  156. v-show="total>0"
  157. :total="total"
  158. :page.sync="queryParams.pageNum"
  159. :limit.sync="queryParams.pageSize"
  160. @pagination="getList"
  161. />
  162. <el-dialog :close-on-click-modal="false" :visible.sync="file.open" append-to-body title="附件详情" width="50%">
  163. <el-tabs v-model="tabName" :stretch="true" type="border-card" @tab-click="getFileList">
  164. <el-tab-pane label="常规附件" name="a">
  165. <el-empty v-if="file.fileList.length==0" description="如你所见,这里什么都没有"></el-empty>
  166. <el-image v-for="item in file.fileList" v-else :key="item.fileUrl"
  167. :src="getFileUrl(item.fileUrl)"></el-image>
  168. </el-tab-pane>
  169. <el-tab-pane label="异常附件" name="b">
  170. <el-empty v-if="file.fileList.length==0" description="如你所见,这里什么都没有"></el-empty>
  171. <el-image v-for="item in file.fileList" v-else :key="item.fileUrl"
  172. :src="getFileUrl(item.fileUrl)"></el-image>
  173. </el-tab-pane>
  174. <el-tab-pane label="异常整改后附件" name="c">
  175. <el-empty v-if="file.fileList.length==0" description="如你所见,这里什么都没有"></el-empty>
  176. <el-image v-for="item in file.fileList" v-else :key="item.fileUrl"
  177. :src="getFileUrl(item.fileUrl)"></el-image>
  178. </el-tab-pane>
  179. </el-tabs>
  180. </el-dialog>
  181. </div>
  182. </template>
  183. <script>
  184. import {
  185. exportEyewash,
  186. listEyewash
  187. } from "@/api/ps/inspection/eyewash";
  188. import {treeselect} from "@/api/system/dept";
  189. import Treeselect from "@riophae/vue-treeselect";
  190. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  191. import {allFileList} from "@/api/common/commonfile";
  192. import {listPlan} from "@/api/ps/patrol/plan";
  193. export default {
  194. name: "Eyewash",
  195. dicts: ['inspection_status'],
  196. components: {Treeselect},
  197. data() {
  198. return {
  199. tabName: 'a',
  200. file: {
  201. open: false,
  202. fileList: [],
  203. queryParams: {
  204. pId: null,
  205. pType: 'ps-eyewash',
  206. pValue: ''
  207. },
  208. },
  209. // 遮罩层
  210. loading: true,
  211. // 选中数组
  212. ids: [],
  213. // 非单个禁用
  214. single: true,
  215. // 非多个禁用
  216. multiple: true,
  217. // 显示搜索条件
  218. showSearch: false,
  219. // 总条数
  220. total: 0,
  221. // 洗眼器巡检记录表格数据
  222. eyewashList: [],
  223. // 部门树选项
  224. deptOptions: undefined,
  225. // 巡检计划选项
  226. planOptions: [],
  227. clientHeight: 300,
  228. // 查询参数
  229. queryParams: {
  230. pageNum: 1,
  231. pageSize: 20,
  232. devNo: null,
  233. signageOk: null,
  234. accessClear: null,
  235. partsOk: null,
  236. valveOpenLocked: null,
  237. dustcapOk: null,
  238. waterHeight: null,
  239. waterClean: null,
  240. waterTemp: null,
  241. leversOk: null,
  242. ercNotified: null,
  243. localAlarmOk: null,
  244. alarmSignalOk: null,
  245. confirmer: null,
  246. checkStatus: null,
  247. checkDate: null,
  248. month: String(new Date().getMonth() + 1).padStart(2, '0'),
  249. year: String(new Date().getFullYear()),
  250. yearMonth: new Date().getFullYear() + '-' + String(new Date().getMonth() + 1).padStart(2, '0'),
  251. createrCode: null,
  252. createdate: null,
  253. updaterCode: null,
  254. updatedate: null,
  255. remarks: null,
  256. deptId: null,
  257. planId: null,
  258. issuesStatus: null,
  259. issuesFlag: null
  260. }
  261. };
  262. },
  263. watch: {
  264. // 根据名称筛选部门树
  265. deptName(val) {
  266. this.$refs.tree.filter(val);
  267. }
  268. },
  269. created() {
  270. if (this.$route.query.planId) {
  271. this.queryParams.planId = parseInt(this.$route.query.planId)
  272. }
  273. if (this.$route.query.id) {
  274. this.queryParams.id = parseInt(this.$route.query.id)
  275. this.queryParams.issuesFlag = '1';
  276. }
  277. //设置表格高度对应屏幕高度
  278. this.$nextTick(() => {
  279. this.clientHeight = document.body.clientHeight - 250
  280. })
  281. this.getPlanList();
  282. this.getTreeselect();
  283. },
  284. methods: {
  285. openFileDialog(row) {
  286. this.file.queryParams.pId = row.id;
  287. this.tabName = 'a'
  288. this.file.open = true;
  289. this.getFileList({})
  290. },
  291. getFileList(tab) {
  292. this.file.fileList = [];
  293. let value = 'regular';
  294. if (tab.name == 'a') {
  295. value = 'regular';
  296. } else if (tab.name == 'b') {
  297. value = 'issue';
  298. } else if (tab.name == 'c') {
  299. value = 'repair';
  300. }
  301. this.file.queryParams.pValue = value;
  302. allFileList(this.file.queryParams).then(response => {
  303. this.file.fileList = response;
  304. })
  305. },
  306. getFileUrl(url) {
  307. return process.env.VUE_APP_BASE_API + url;
  308. },
  309. /** 查询洗眼器巡检记录列表 */
  310. getList() {
  311. this.loading = true;
  312. listEyewash(this.queryParams).then(response => {
  313. this.eyewashList = response.rows;
  314. this.total = response.total;
  315. this.loading = false;
  316. });
  317. },
  318. /** 查询部门下拉树结构 */
  319. getTreeselect() {
  320. treeselect().then(response => {
  321. this.deptOptions = response.data;
  322. });
  323. },
  324. /** 查询巡检计划列表 */
  325. getPlanList() {
  326. const now = new Date();
  327. const currentYear = now.getFullYear();
  328. const currentMonth = now.getMonth() + 1;
  329. const query = {
  330. planYear: currentYear,
  331. planMonth: currentMonth,
  332. patrolType: '7'
  333. };
  334. listPlan(query).then(response => {
  335. this.planOptions = response.rows || [];
  336. // 如果没有从路由参数传入planId,则默认选择当月最后一个计划
  337. if (!this.$route.query.planId && this.planOptions.length > 0) {
  338. // 按创建时间降序排序,取第一个(最新的)
  339. const sortedPlans = [...this.planOptions].sort((a, b) => {
  340. const dateA = new Date(a.createdate);
  341. const dateB = new Date(b.createdate);
  342. return dateB - dateA;
  343. });
  344. // 选择当月最后一个计划(创建时间最新的)
  345. this.queryParams.planId = sortedPlans[0].id;
  346. }
  347. // 获取计划列表后再查询数据
  348. this.getList();
  349. }).catch(() => {
  350. // 如果获取计划列表失败,仍然查询数据
  351. this.getList();
  352. });
  353. },
  354. /** 搜索按钮操作 */
  355. handleQuery() {
  356. this.queryParams.pageNum = 1;
  357. this.getList();
  358. },
  359. /** 重置按钮操作 */
  360. resetQuery() {
  361. this.resetForm("queryForm");
  362. this.handleYearMonthChange(this.queryParams.yearMonth);
  363. this.handleQuery();
  364. },
  365. // 多选框选中数据
  366. handleSelectionChange(selection) {
  367. this.ids = selection.map(item => item.id)
  368. this.single = selection.length !== 1
  369. this.multiple = !selection.length
  370. },
  371. /** 导出按钮操作 */
  372. handleExport() {
  373. const queryParams = this.queryParams;
  374. this.$confirm('是否确认导出所有洗眼器巡检记录数据项?', "警告", {
  375. confirmButtonText: "确定",
  376. cancelButtonText: "取消",
  377. type: "warning"
  378. }).then(function () {
  379. return exportEyewash(queryParams);
  380. }).then(response => {
  381. this.download(response.msg);
  382. })
  383. },
  384. /** 年月选择器变化事件 */
  385. handleYearMonthChange(val) {
  386. if (val) {
  387. this.queryParams.year = val.substring(0, 4);
  388. this.queryParams.month = val.substring(5, 7);
  389. } else {
  390. this.queryParams.year = null;
  391. this.queryParams.month = null;
  392. }
  393. }
  394. }
  395. };
  396. </script>