index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <maintenance-search @search="reload"> </maintenance-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="openAdd('新增计划性维修')"
  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:planCode="{ row }">
  33. <el-link
  34. type="primary"
  35. :underline="false"
  36. @click="openAdd('详情', row)"
  37. >
  38. {{ row.planCode }}
  39. </el-link>
  40. </template>
  41. <!-- 操作列 -->
  42. <template v-slot:action="{ row }">
  43. <!-- <el-link
  44. type="primary"
  45. :underline="false"
  46. icon="el-icon-edit"
  47. @click="openAdd('编辑计划性维修', row)"
  48. >
  49. 编辑
  50. </el-link> -->
  51. <el-link
  52. v-if="
  53. row.planStatus == 4 || row.planStatus == 0 || row.planStatus == 5
  54. "
  55. type="primary"
  56. :underline="false"
  57. @click="openAdd('派单', row)"
  58. >
  59. 派单
  60. </el-link>
  61. <el-popconfirm
  62. class="ele-action"
  63. title="确认撤销这条报修记录吗?"
  64. @confirm="cancel(row)"
  65. >
  66. <template v-slot:reference>
  67. <el-link type="danger" :underline="false" icon="el-icon-delete">
  68. 撤回
  69. </el-link>
  70. </template>
  71. </el-popconfirm>
  72. </template>
  73. </ele-pro-table>
  74. </el-card>
  75. <!-- 详情 -->
  76. <DetailDialog ref="detailDialogRef" />
  77. <!-- 新建或编辑弹窗 -->
  78. <planRepaireDialog ref="planRepaireDialog" @done="reload" />
  79. </div>
  80. </template>
  81. <script>
  82. import planRepaireDialog from '../../components/planRepaireDialog.vue';
  83. import MaintenanceSearch from './components/maintenance-search.vue';
  84. import DetailDialog from './components/detailDialog.vue';
  85. import { removePlan } from '@/api/maintenance/repair_report';
  86. import { getPage } from '@/api/maintenance/patrol_maintenance';
  87. import dictMixins from '@/mixins/dictMixins';
  88. export default {
  89. mixins: [dictMixins],
  90. components: {
  91. MaintenanceSearch,
  92. DetailDialog,
  93. planRepaireDialog
  94. },
  95. data() {
  96. return {
  97. // 表格列配置
  98. columns: [
  99. {
  100. columnKey: 'index',
  101. label: '序号',
  102. type: 'index',
  103. width: 55,
  104. align: 'center',
  105. showOverflowTooltip: true,
  106. fixed: 'left'
  107. },
  108. {
  109. prop: 'planCode',
  110. label: '计划维修单号',
  111. align: 'center',
  112. slot: 'planCode',
  113. showOverflowTooltip: true,
  114. minWidth: 110
  115. },
  116. {
  117. prop: 'planName',
  118. label: '计划维修名称',
  119. align: 'center',
  120. showOverflowTooltip: true,
  121. minWidth: 110
  122. },
  123. // {
  124. // prop: 'number',
  125. // label: '报修设备数量',
  126. // align: 'center',
  127. // showOverflowTooltip: true,
  128. // minWidth: 110
  129. // },
  130. {
  131. prop: 'planStatus',
  132. label: '状态',
  133. align: 'center',
  134. showOverflowTooltip: true,
  135. minWidth: 110,
  136. formatter: (item) => {
  137. return {
  138. 0: '待派单',
  139. 1: '已派单',
  140. 2: '执行中',
  141. 3: '已完成',
  142. 4: '已撤回',
  143. 5: '已驳回'
  144. }[item.planStatus];
  145. }
  146. },
  147. // {
  148. // prop: 'number',
  149. // label: '维修人员',
  150. // align: 'center',
  151. // showOverflowTooltip: true,
  152. // minWidth: 110
  153. // },
  154. {
  155. prop: 'createUserName',
  156. label: '创建人',
  157. align: 'center',
  158. showOverflowTooltip: true,
  159. minWidth: 110
  160. },
  161. {
  162. prop: 'createTime',
  163. label: '创建时间',
  164. align: 'center',
  165. showOverflowTooltip: true,
  166. minWidth: 110,
  167. formatter: (_row, _column, cellValue) => {
  168. return this.$util.toDateString(cellValue);
  169. }
  170. },
  171. {
  172. columnKey: 'action',
  173. label: '操作',
  174. width: 150,
  175. align: 'center',
  176. resizable: false,
  177. slot: 'action',
  178. showOverflowTooltip: true
  179. }
  180. ],
  181. // 加载状态
  182. loading: false,
  183. infoData: {},
  184. repairInfoLogs: [],
  185. deviceInfo: {}, //设备信息
  186. isBindPlan: false
  187. };
  188. },
  189. computed: {},
  190. created() {
  191. this.requestDict('维修计划状态');
  192. },
  193. methods: {
  194. openAdd(dialogTitle, row) {
  195. this.$nextTick(() => {
  196. this.$refs.planRepaireDialog.init(row, dialogTitle);
  197. });
  198. },
  199. /* 表格数据源 */
  200. datasource({ page, limit, where, order }) {
  201. return getPage({ pageNum: page, size: limit, ...where, planType: 4 });
  202. },
  203. async changeEnable(row) {
  204. const res = await putRoles(row);
  205. if (res.code == 0) {
  206. this.$message({
  207. type: 'success',
  208. message: '修改成功',
  209. customClass: 'ele-message-border'
  210. });
  211. this.reload();
  212. }
  213. },
  214. /* 刷新表格 */
  215. reload(where) {
  216. this.$refs.table.reload({ page: 1, where });
  217. },
  218. jumpAdd() {
  219. this.$router.push({
  220. path: '/maintenance/repair/planRepair/add'
  221. });
  222. },
  223. toEdit({ id }) {
  224. this.$router.push({
  225. path: '/maintenance/repair/planRepair/add',
  226. query: { id }
  227. });
  228. },
  229. goDetail(row) {
  230. this.$refs.detailDialogRef.openDeatailDialog(row);
  231. },
  232. // 撤销
  233. cancel(row) {
  234. removePlan([row.id]).then((res) => {
  235. this.$message.success('撤销成功!');
  236. this.reload();
  237. });
  238. }
  239. }
  240. };
  241. </script>
  242. <style lang="scss" scoped></style>