index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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="warning"
  51. plain
  52. icon="el-icon-download"
  53. size="mini"
  54. @click="handleExport"
  55. v-hasPermi="['fire:curtain:export']"
  56. >导出</el-button>
  57. </el-col>
  58. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  59. </el-row>
  60. <el-table v-loading="loading" :data="curtainList" :height="clientHeight" @selection-change="handleSelectionChange" border>
  61. <el-table-column type="selection" width="55" align="center" />
  62. <el-table-column label="位号" align="center" prop="devNo" />
  63. <el-table-column label="蒸汽喷嘴检查" align="center" prop="nozzleInspection">
  64. <template slot-scope="scope">
  65. <dict-tag :options="dict.type.inspection_status" :value="scope.row.nozzleInspection"/>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="阀门动作是否正常" align="center" prop="valveAction">
  69. <template slot-scope="scope">
  70. <dict-tag :options="dict.type.inspection_status" :value="scope.row.valveAction"/>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="供汽管线前排凝是否正常" align="center" prop="supplyLine">
  74. <template slot-scope="scope">
  75. <dict-tag :options="dict.type.inspection_status" :value="scope.row.supplyLine"/>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="管线上方无杂物覆盖" align="center" prop="overlayFree">
  79. <template slot-scope="scope">
  80. <dict-tag :options="dict.type.inspection_status" :value="scope.row.overlayFree"/>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="确认人" align="center" prop="confirmed" />
  84. <el-table-column label="备注" align="center" prop="remarks" />
  85. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  86. <template slot-scope="scope">
  87. <el-button
  88. icon="el-icon-picture-outline"
  89. size="mini"
  90. type="text"
  91. @click="openFileDialog(scope.row)"
  92. >附件
  93. </el-button>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. <pagination
  98. v-show="total>0"
  99. :total="total"
  100. :page.sync="queryParams.pageNum"
  101. :limit.sync="queryParams.pageSize"
  102. @pagination="getList"
  103. />
  104. <el-dialog :close-on-click-modal="false":visible.sync="file.open" append-to-body title="附件详情" width="50%">
  105. <el-tabs v-model="tabName" :stretch="true" type="border-card">
  106. <el-tab-pane label="常规附件" name="a">
  107. <el-empty v-if="file.files.length==0" description="如你所见,这里什么都没有"></el-empty>
  108. <el-image v-for="url in file.files" v-else :key="url" :src="url"></el-image>
  109. </el-tab-pane>
  110. <el-tab-pane label="异常附件" name="b">
  111. <el-empty v-if="file.issuesFiles.length==0" description="如你所见,这里什么都没有"></el-empty>
  112. <el-image v-for="url in file.issuesFiles" v-else :key="url" :src="url"></el-image>
  113. </el-tab-pane>
  114. <el-tab-pane label="异常整改后附件" name="c">
  115. <el-empty v-if="file.repairFile.length==0" description="如你所见,这里什么都没有"></el-empty>
  116. <el-image v-for="url in file.repairFile" v-else :key="url" :src="url"></el-image>
  117. </el-tab-pane>
  118. </el-tabs>
  119. </el-dialog>
  120. </div>
  121. </template>
  122. <script>
  123. import { listCurtain, getCurtain, delCurtain, addCurtain, updateCurtain } from "@/api/patrol/fire/curtain";
  124. import {listAllPlan} from "@/api/patrol/patrol/plan";
  125. export default {
  126. name: "Curtain",
  127. dicts: ['inspection_status'],
  128. data() {
  129. return {
  130. tabName: 'a',
  131. planList: [],
  132. file: {
  133. open: false,
  134. issuesFiles: [],
  135. repairFile: [],
  136. files: []
  137. },
  138. month: new Date(),
  139. year: new Date(),
  140. // 遮罩层
  141. loading: true,
  142. // 选中数组
  143. ids: [],
  144. // 非单个禁用
  145. single: true,
  146. // 非多个禁用
  147. multiple: true,
  148. // 显示搜索条件
  149. showSearch: false,
  150. // 页面高度
  151. clientHeight: 300,
  152. // 总条数
  153. total: 0,
  154. // 蒸汽幕检查记录表格数据
  155. curtainList: [],
  156. // 弹出层标题
  157. title: "",
  158. // 是否显示弹出层
  159. open: false,
  160. // 查询参数
  161. queryParams: {
  162. pageNum: 1,
  163. pageSize: 20,
  164. devNo: null,
  165. nozzleInspection: null,
  166. valveAction: null,
  167. supplyLine: null,
  168. overlayFree: null,
  169. confirmed: null,
  170. remarks: null,
  171. checkStatus: null,
  172. checkDate: null,
  173. month: null,
  174. year: null,
  175. createrCode: null,
  176. createdate: null,
  177. updaterCode: null,
  178. updatedate: null,
  179. deptId: null,
  180. planId: null,
  181. problemFileUrl: null,
  182. fileUrl: null,
  183. issuesStatus: null,
  184. issuesFlag: null,
  185. repairFile: null
  186. },
  187. // 表单参数
  188. form: {},
  189. // 表单校验
  190. rules: {
  191. delFlag: [
  192. { required: true, message: "删除标识0未删除不能为空", trigger: "blur" }
  193. ],
  194. }
  195. };
  196. },
  197. created() {
  198. if (this.$route.query.year && this.$route.query.month) {
  199. this.year.setFullYear(this.$route.query.year, this.$route.query.month, 1);
  200. this.month.setMonth(this.$route.query.month, 1);
  201. }
  202. if (this.$route.query.planId) {
  203. this.queryParams.planId = parseInt(this.$route.query.planId)
  204. }
  205. if (this.$route.query.id) {
  206. this.queryParams.id = parseInt(this.$route.query.id)
  207. this.queryParams.issuesFlag = '1';
  208. }
  209. //设置表格高度对应屏幕高度
  210. this.$nextTick(() => {
  211. this.clientHeight = document.body.clientHeight - 270
  212. });
  213. if (!this.queryParams.id) {
  214. let query = {planQuarter: this.month.getMonth() + 1, planYear: this.year.getFullYear(), patrolType: '16'}
  215. listAllPlan(query).then(res => {
  216. this.planList = res.data;
  217. if (res.data.length > 0) {
  218. this.queryParams.planId = res.data[0].id;
  219. }
  220. this.getList();
  221. })
  222. }else{
  223. this.getList();
  224. }
  225. },
  226. methods: {
  227. openFileDialog(row) {
  228. this.tabName = 'a'
  229. this.file.issuesFiles = []
  230. this.file.files = []
  231. this.file.repairFile = []
  232. this.file.open = true;
  233. if (row.problemFileUrl) {
  234. this.file.issuesFiles = row.problemFileUrl.split(',').map(item => process.env.VUE_APP_BASE_API + item);
  235. }
  236. if (row.fileUrl) {
  237. this.file.files = row.fileUrl.split(',').map(item => process.env.VUE_APP_BASE_API + item);
  238. }
  239. if (row.repairFile) {
  240. this.file.repairFile = row.repairFile.split(',').map(item => process.env.VUE_APP_BASE_API + item);
  241. }
  242. },
  243. getPlanList() {
  244. let query = {planQuarter: this.month.getMonth() + 1, planYear: this.year.getFullYear(), patrolType: '16'}
  245. listAllPlan(query).then(res => {
  246. this.planList = res.data;
  247. })
  248. },
  249. /** 查询蒸汽幕检查记录列表 */
  250. getList() {
  251. this.loading = true;
  252. if (!this.queryParams.id) {
  253. this.queryParams.month = this.month.getMonth() + 1;
  254. this.queryParams.year = this.year.getFullYear();
  255. }
  256. listCurtain(this.queryParams).then(response => {
  257. this.curtainList = response.rows;
  258. this.total = response.total;
  259. this.loading = false;
  260. });
  261. },
  262. // 取消按钮
  263. cancel() {
  264. this.open = false;
  265. this.reset();
  266. },
  267. // 表单重置
  268. reset() {
  269. this.form = {
  270. id: null,
  271. devNo: null,
  272. nozzleInspection: null,
  273. valveAction: null,
  274. supplyLine: null,
  275. overlayFree: null,
  276. confirmed: null,
  277. remarks: null,
  278. checkStatus: null,
  279. checkDate: null,
  280. month: null,
  281. year: null,
  282. delFlag: null,
  283. createrCode: null,
  284. createdate: null,
  285. updaterCode: null,
  286. updatedate: null,
  287. deptId: null,
  288. planId: null,
  289. problemFileUrl: null,
  290. fileUrl: null,
  291. issuesStatus: null,
  292. issuesFlag: null,
  293. repairFile: null
  294. };
  295. this.resetForm("form");
  296. },
  297. /** 搜索按钮操作 */
  298. handleQuery() {
  299. this.queryParams.pageNum = 1;
  300. this.getList();
  301. this.getPlanList();
  302. },
  303. /** 重置按钮操作 */
  304. resetQuery() {
  305. this.resetForm("queryForm");
  306. this.handleQuery();
  307. },
  308. // 多选框选中数据
  309. handleSelectionChange(selection) {
  310. this.ids = selection.map(item => item.id)
  311. this.single = selection.length!==1
  312. this.multiple = !selection.length
  313. },
  314. /** 新增按钮操作 */
  315. handleAdd() {
  316. this.reset();
  317. this.open = true;
  318. this.title = "添加蒸汽幕检查记录";
  319. },
  320. /** 修改按钮操作 */
  321. handleUpdate(row) {
  322. this.reset();
  323. const id = row.id || this.ids
  324. getCurtain(id).then(response => {
  325. this.form = response.data;
  326. this.open = true;
  327. this.title = "修改蒸汽幕检查记录";
  328. });
  329. },
  330. /** 提交按钮 */
  331. submitForm() {
  332. this.$refs["form"].validate(valid => {
  333. if (valid) {
  334. if (this.form.id != null) {
  335. updateCurtain(this.form).then(response => {
  336. this.msgSuccess("修改成功");
  337. this.open = false;
  338. this.getList();
  339. });
  340. } else {
  341. addCurtain(this.form).then(response => {
  342. this.msgSuccess("新增成功");
  343. this.open = false;
  344. this.getList();
  345. });
  346. }
  347. }
  348. });
  349. },
  350. /** 删除按钮操作 */
  351. handleDelete(row) {
  352. const ids = row.id || this.ids;
  353. this.$confirm('是否确认删除蒸汽幕检查记录编号为"' + ids + '"的数据项?').then(function() {
  354. return delCurtain(ids);
  355. }).then(() => {
  356. this.getList();
  357. this.msgSuccess("删除成功");
  358. }).catch(() => {});
  359. },
  360. /** 导出按钮操作 */
  361. handleExport() {
  362. this.download2('fire/curtain/export', {
  363. ...this.queryParams
  364. }, `curtain_${new Date().getTime()}.xlsx`)
  365. }
  366. }
  367. };
  368. </script>