index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="app-container">
  3. <TextSearch/>
  4. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
  5. <el-form-item label="日期" prop="checkDateM">
  6. <el-date-picker
  7. v-model="queryParams.checkDateM"
  8. type="date"
  9. value-format="yyyy-MM-dd"
  10. placeholder="请选择日期"
  11. @change="handleQuery">
  12. </el-date-picker>
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  16. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  17. </el-form-item>
  18. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :search="false"></right-toolbar>
  19. </el-form>
  20. <table class="patrolTable" style="width: 100%; margin-bottom: 30px">
  21. <tr>
  22. <td rowspan="3" colspan="2">漏点巡检记录表</td>
  23. <td>日期</td>
  24. <td colspan="2">{{ parseTime(pointPatrol.checkDateM, '{y}年{m}月{d}日') }}</td>
  25. <td colspan="2">{{ parseTime(pointPatrol.checkDateN, '{y}年{m}月{d}日') }}</td>
  26. </tr>
  27. <tr>
  28. <td>班组</td>
  29. <td colspan="2">
  30. <span v-if="!isEdit">{{ pointPatrol.teamM }}班</span>
  31. <span v-else><el-input v-model="pointPatrol.teamM" placeholder="请输入当前班组"
  32. style="width: 150px"/> 班</span>
  33. </td>
  34. <td colspan="2">
  35. <span v-if="!isEdit">{{ pointPatrol.teamN }}班</span>
  36. <span v-else><el-input v-model="pointPatrol.teamN" placeholder="请输入当前班组"
  37. style="width: 150px"/> 班</span>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td>时间</td>
  42. <td colspan="2">早班一次</td>
  43. <td colspan="2">夜班一次</td>
  44. </tr>
  45. <tr>
  46. <td>漏点编号</td>
  47. <td>漏点位置</td>
  48. <td>介质</td>
  49. <td>挂牌(是/否)</td>
  50. <td>泄露状态<br/>(未检出/轻微/严重)</td>
  51. <td>挂牌(是/否)</td>
  52. <td>泄露状态<br/>(未检出/轻微/严重)</td>
  53. </tr>
  54. </table>
  55. <div slot="footer" class="footer">
  56. <el-button type="primary" @click="submitForm">保 存</el-button>
  57. <el-button @click="cancel">取 消</el-button>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import {
  63. addPointPatrol,
  64. delPointPatrol,
  65. getPointPatrol,
  66. listPointPatrol,
  67. updatePointPatrol
  68. } from "@/api/asset/pointPatrol";
  69. import PointRecord from "@/views/asset/pointRecord/index.vue";
  70. export default {
  71. name: "PointPatrol",
  72. components: {PointRecord},
  73. data() {
  74. return {
  75. isEdit: false,
  76. // 页面高度
  77. clientHeight: 300,
  78. // 遮罩层
  79. loading: true,
  80. // 选中数组
  81. ids: [],
  82. // 非单个禁用
  83. single: true,
  84. // 非多个禁用
  85. multiple: true,
  86. // 显示搜索条件
  87. showSearch: false,
  88. // 总条数
  89. total: 0,
  90. // 漏点巡检表格数据
  91. pointPatrolList: [],
  92. pointPatrol: {},
  93. // 弹出层标题
  94. title: "",
  95. // 是否显示弹出层
  96. open: false,
  97. // 查询参数
  98. queryParams: {
  99. pageNum: 1,
  100. pageSize: 20,
  101. teamM: null,
  102. checkDateM: new Date(),
  103. signM: null,
  104. teamN: null,
  105. checkDateN: null,
  106. signN: null,
  107. remarks: null,
  108. createrCode: null,
  109. createdate: null,
  110. updaterCode: null,
  111. updatedate: null,
  112. deptId: null
  113. },
  114. // 表单参数
  115. form: {},
  116. // 表单校验
  117. rules: {}
  118. };
  119. },
  120. created() {
  121. this.getList();
  122. //设置表格高度对应屏幕高度
  123. this.$nextTick(() => {
  124. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  125. });
  126. },
  127. methods: {
  128. /** 查询漏点巡检列表 */
  129. getList() {
  130. this.loading = true;
  131. if (this.queryParams.checkDateM==null) {
  132. this.queryParams.checkDateM = new Date();
  133. }
  134. listPointPatrol(this.queryParams).then(response => {
  135. this.pointPatrolList = response.rows;
  136. if (this.pointPatrolList.length > 0) {
  137. this.pointPatrol = this.pointPatrolList[0]
  138. this.isEdit = false
  139. } else {
  140. this.isEdit = true
  141. }
  142. this.total = response.total;
  143. this.loading = false;
  144. });
  145. },
  146. // 取消按钮
  147. cancel() {
  148. this.open = false;
  149. this.reset();
  150. },
  151. // 表单重置
  152. reset() {
  153. this.form = {
  154. id: null,
  155. teamM: null,
  156. checkDateM: null,
  157. signM: null,
  158. teamN: null,
  159. checkDateN: null,
  160. signN: null,
  161. remarks: null,
  162. delFlag: null,
  163. createrCode: null,
  164. createdate: null,
  165. updaterCode: null,
  166. updatedate: null,
  167. deptId: null
  168. };
  169. this.resetForm("form");
  170. },
  171. /** 搜索按钮操作 */
  172. handleQuery() {
  173. this.queryParams.pageNum = 1;
  174. this.getList();
  175. },
  176. /** 重置按钮操作 */
  177. resetQuery() {
  178. this.resetForm("queryForm");
  179. this.handleQuery();
  180. },
  181. // 多选框选中数据
  182. handleSelectionChange(selection) {
  183. this.ids = selection.map(item => item.id)
  184. this.single = selection.length !== 1
  185. this.multiple = !selection.length
  186. },
  187. /** 新增按钮操作 */
  188. handleAdd() {
  189. this.reset();
  190. this.open = true;
  191. this.title = "添加漏点巡检";
  192. },
  193. /** 修改按钮操作 */
  194. handleUpdate(row) {
  195. this.reset();
  196. const id = row.id || this.ids
  197. getPointPatrol(id).then(response => {
  198. this.form = response.data;
  199. this.open = true;
  200. this.title = "修改漏点巡检";
  201. });
  202. },
  203. /** 提交按钮 */
  204. submitForm() {
  205. this.isEdit = false
  206. this.pointPatrol.checkDateM=this.queryParams.checkDateM;
  207. if (this.form.id != null) {
  208. updatePointPatrol(this.pointPatrol).then(response => {
  209. this.$modal.msgSuccess("修改成功");
  210. this.getList();
  211. });
  212. } else {
  213. addPointPatrol(this.pointPatrol).then(response => {
  214. this.$modal.msgSuccess("新增成功");
  215. this.getList();
  216. });
  217. }
  218. },
  219. /** 删除按钮操作 */
  220. handleDelete(row) {
  221. const ids = row.id || this.ids;
  222. this.$modal.confirm('是否确认删除漏点巡检编号为"' + ids + '"的数据项?').then(function () {
  223. return delPointPatrol(ids);
  224. }).then(() => {
  225. this.getList();
  226. this.$modal.msgSuccess("删除成功");
  227. }).catch(() => {
  228. });
  229. },
  230. /** 导出按钮操作 */
  231. handleExport() {
  232. this.download('asset/pointPatrol/export', {
  233. ...this.queryParams
  234. }, `pointPatrol_${new Date().getTime()}.xlsx`)
  235. }
  236. }
  237. };
  238. </script>
  239. <style scoped lang="scss">
  240. /* 表格边框 */
  241. table {
  242. border-collapse: collapse;
  243. }
  244. table td {
  245. border: 1px #b4b4b4 solid;
  246. padding: 10px;
  247. text-align: center;
  248. }
  249. </style>