index.vue 12 KB

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