index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <notes-search @search="reload"> </notes-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. cache-key="systemRoleTable"
  11. >
  12. <!-- 表头工具栏 -->
  13. <template v-slot:toolbar>
  14. <el-button
  15. size="small"
  16. type="primary"
  17. icon="el-icon-plus"
  18. class="ele-btn-icon"
  19. @click="openEdit()"
  20. >
  21. 新建
  22. </el-button>
  23. <el-button
  24. size="small"
  25. type="primary"
  26. class="ele-btn-icon"
  27. @click="goDetail({ id: 12 })"
  28. >
  29. 详情
  30. </el-button>
  31. </template>
  32. <!-- <template v-slot:enable="{ row }">
  33. <el-switch
  34. v-model="row.enable"
  35. active-color="#13ce66"
  36. inactive-color="#ff4949"
  37. :active-value="1"
  38. :inactive-value="0"
  39. @change="changeEnable(row)"
  40. >
  41. </el-switch>
  42. </template> -->
  43. <!-- 操作列 -->
  44. <template v-slot:action="{ row }">
  45. <el-link
  46. type="primary"
  47. :underline="false"
  48. icon="el-icon-edit"
  49. @click="openEdit(row)"
  50. >
  51. 撤回
  52. </el-link>
  53. </template>
  54. </ele-pro-table>
  55. </el-card>
  56. <!-- 新建或编辑弹窗 -->
  57. <AddDialog
  58. ref="addDialogRef"
  59. :dialogTitle="addDialogTitle"
  60. :deviceInfo="deviceInfo"
  61. :infoData="infoData"
  62. @refresh="reload"
  63. />
  64. <DetailsDialog
  65. ref="detailsDialogRef"
  66. :dialogTitle="detailsDialogTitle"
  67. :infoData="infoData"
  68. :repairInfoLogs="repairInfoLogs"
  69. />
  70. </div>
  71. </template>
  72. <script>
  73. import { getPage } from '@/api/maintenance/repair';
  74. // import AddPatrolPlanDialog from '@/components/addPatrolPlanDialog'
  75. import NotesSearch from './components/notes-search.vue';
  76. import AddDialog from './components/addDialog.vue';
  77. import DetailsDialog from '../components/RepairDetailsDialog.vue';
  78. export default {
  79. components: {
  80. NotesSearch,
  81. AddDialog,
  82. DetailsDialog
  83. // AddPatrolPlanDialog
  84. },
  85. data () {
  86. return {
  87. // 表格列配置
  88. columns: [
  89. {
  90. columnKey: 'index',
  91. label: '序号',
  92. type: 'index',
  93. width: 55,
  94. align: 'center',
  95. showOverflowTooltip: true,
  96. fixed: 'left'
  97. },
  98. {
  99. prop: 'code',
  100. label: '报修记录编码',
  101. align: 'center',
  102. showOverflowTooltip: true,
  103. minWidth: 110
  104. },
  105. {
  106. prop: 'deviceId',
  107. label: '设备编码',
  108. align: 'center',
  109. showOverflowTooltip: true,
  110. minWidth: 110
  111. },
  112. {
  113. prop: 'enable',
  114. label: '设备名称',
  115. align: 'center',
  116. showOverflowTooltip: true,
  117. minWidth: 110
  118. },
  119. {
  120. prop: 'sourceType',
  121. label: '报修类型',
  122. align: 'center',
  123. showOverflowTooltip: true,
  124. minWidth: 110
  125. },
  126. {
  127. prop: 'from',
  128. label: '来源',
  129. align: 'center',
  130. showOverflowTooltip: true,
  131. minWidth: 110
  132. },
  133. {
  134. prop: 'sourceCode',
  135. label: '来源编码',
  136. align: 'center',
  137. showOverflowTooltip: true,
  138. minWidth: 110
  139. },
  140. {
  141. prop: 'status',
  142. label: '状态',
  143. align: 'center',
  144. showOverflowTooltip: true,
  145. minWidth: 110
  146. },
  147. {
  148. prop: 'requestUserId',
  149. label: '报修人',
  150. align: 'center',
  151. showOverflowTooltip: true,
  152. minWidth: 110
  153. },
  154. {
  155. prop: 'createTime',
  156. label: '报修时间',
  157. align: 'center',
  158. showOverflowTooltip: true,
  159. minWidth: 110,
  160. formatter: (_row, _column, cellValue) => {
  161. return this.$util.toDateString(cellValue);
  162. }
  163. },
  164. {
  165. columnKey: 'action',
  166. label: '操作',
  167. width: 230,
  168. align: 'center',
  169. resizable: false,
  170. slot: 'action',
  171. showOverflowTooltip: true
  172. }
  173. ],
  174. // 加载状态
  175. loading: false,
  176. infoData: {},
  177. repairInfoLogs: [],
  178. addDialogTitle: '新增报修记录',
  179. detailsDialogTitle: '报修记录详情',
  180. deviceInfo: {} //设备信息
  181. };
  182. },
  183. computed: {},
  184. methods: {
  185. /* 表格数据源 */
  186. datasource ({ page, limit, where, order }) {
  187. return getPage({ pageNum: page, size: limit, ...where });
  188. },
  189. async changeEnable (row) {
  190. const res = await putRoles(row);
  191. if (res.code == 0) {
  192. this.$message({
  193. type: 'success',
  194. message: '修改成功',
  195. customClass: 'ele-message-border'
  196. });
  197. this.reload();
  198. }
  199. },
  200. /* 刷新表格 */
  201. reload (where) {
  202. this.$refs.table.reload({ page: 1, where });
  203. },
  204. openEdit (row) {
  205. this.addDialogTitle = '新增报修记录';
  206. this.$refs.addDialogRef.addRepairNotesDialog = true;
  207. },
  208. goDetail (row) {
  209. row.tabLabel = '维修信息';
  210. row.title = '报修记录详情';
  211. row.workOrderCode = row.id;
  212. this.$refs.detailsDialogRef.init(row);
  213. // this.$router.push({
  214. // path: '/maintenance/patrol/plan/details',
  215. // // query: {
  216. // // id
  217. // // }
  218. // })
  219. }
  220. }
  221. };
  222. </script>
  223. <style lang="scss" scoped></style>