index.vue 5.0 KB

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