index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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. </template>
  24. <template v-slot:code="{ row }"
  25. ><el-link type="primary" :underline="false" @click="goDetail(row)">
  26. {{ row.code }}
  27. </el-link></template
  28. >
  29. <!-- 操作列 -->
  30. <template v-slot:action="{ row }">
  31. <el-link
  32. type="primary"
  33. :underline="false"
  34. icon="el-icon-edit"
  35. @click="appoint(row)"
  36. >
  37. 委外
  38. </el-link>
  39. <el-link
  40. type="primary"
  41. :underline="false"
  42. icon="el-icon-edit"
  43. @click="openEdit(row)"
  44. >
  45. 修改
  46. </el-link>
  47. <el-popconfirm
  48. class="ele-action"
  49. title="确定要撤销此报修记录吗?"
  50. @confirm="remove(row)"
  51. >
  52. <template v-slot:reference>
  53. <el-link type="danger" :underline="false" icon="el-icon-delete">
  54. 撤销
  55. </el-link>
  56. </template>
  57. </el-popconfirm>
  58. </template>
  59. </ele-pro-table>
  60. </el-card>
  61. <!-- 新建或编辑弹窗 -->
  62. <AddDialog
  63. ref="addDialogRef"
  64. :dialogTitle="addDialogTitle"
  65. :deviceInfo="deviceInfo"
  66. :infoData="infoData"
  67. @refresh="reload"
  68. />
  69. <DetailsDialog
  70. ref="detailsDialogRef"
  71. :dialogTitle="detailsDialogTitle"
  72. />
  73. <!-- 委外弹窗 -->
  74. <EntrustDialog
  75. ref="entDialogRef"
  76. @refresh="reload"
  77. />
  78. </div>
  79. </template>
  80. <script>
  81. import { getPage , removeRequest } from '@/api/maintenance/repair_report';
  82. import NotesSearch from './components/notes-search.vue';
  83. import AddDialog from './components/addDialog.vue';
  84. import EntrustDialog from './components/entrustDialog.vue';
  85. import DetailsDialog from '../components/RepairDetailsDialog.vue';
  86. import dictMixins from '@/mixins/dictMixins';
  87. export default {
  88. mixins: [dictMixins],
  89. components: {
  90. NotesSearch,
  91. AddDialog,
  92. DetailsDialog,
  93. EntrustDialog
  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. columnKey: 'code',
  110. slot: 'code',
  111. prop: 'code',
  112. label: '报修记录编码',
  113. align: 'center',
  114. showOverflowTooltip: true,
  115. minWidth: 110
  116. },
  117. {
  118. prop: 'deviceCode',
  119. label: '设备编码',
  120. align: 'center',
  121. showOverflowTooltip: true,
  122. minWidth: 110
  123. },
  124. {
  125. prop: 'deviceName',
  126. label: '设备名称',
  127. align: 'center',
  128. showOverflowTooltip: true,
  129. minWidth: 110
  130. },
  131. {
  132. prop: 'type',
  133. label: '报修类型',
  134. align: 'center',
  135. showOverflowTooltip: true,
  136. minWidth: 110,
  137. formatter: (_row, _column, cellValue) => {
  138. return _row.sourceType==3?'自动报修':'人工报修'
  139. }
  140. },
  141. {
  142. prop: 'sourceType',
  143. label: '来源',
  144. align: 'center',
  145. showOverflowTooltip: true,
  146. minWidth: 110,
  147. formatter: (_row, _column, cellValue) => {
  148. return this.getDictValue('报修来源', _row.sourceType);
  149. }
  150. },
  151. {
  152. prop: 'sourceCode',
  153. label: '来源编码',
  154. align: 'center',
  155. showOverflowTooltip: true,
  156. minWidth: 110
  157. },
  158. {
  159. prop: 'status',
  160. label: '状态',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. minWidth: 110,
  164. formatter: (_row, _column, cellValue) => {
  165. return this.getDictValue('报修状态', _row.status);
  166. }
  167. },
  168. {
  169. prop: 'requestUserName',
  170. label: '报修人',
  171. align: 'center',
  172. showOverflowTooltip: true,
  173. minWidth: 110
  174. },
  175. {
  176. prop: 'createTime',
  177. label: '报修时间',
  178. align: 'center',
  179. showOverflowTooltip: true,
  180. minWidth: 110,
  181. formatter: (_row, _column, cellValue) => {
  182. return this.$util.toDateString(cellValue);
  183. }
  184. },
  185. {
  186. columnKey: 'action',
  187. slot: 'action',
  188. label: '操作',
  189. width: 200,
  190. align: 'center',
  191. resizable: false,
  192. showOverflowTooltip: true
  193. }
  194. ],
  195. // 加载状态
  196. loading: false,
  197. infoData: {},
  198. repairInfoLogs: [],
  199. addDialogTitle: '新增报修记录',
  200. detailsDialogTitle: '报修记录详情',
  201. deviceInfo: {} //设备信息
  202. };
  203. },
  204. computed: {},
  205. created () {
  206. this.requestDict('报修来源');
  207. this.requestDict('报修状态');
  208. },
  209. methods: {
  210. /* 表格数据源 */
  211. datasource ({ page, limit, where, order }) {
  212. return getPage({ pageNum: page, size: limit, ...where });
  213. },
  214. async changeEnable (row) {
  215. const res = await putRoles(row);
  216. if (res.code == 0) {
  217. this.$message({
  218. type: 'success',
  219. message: '修改成功',
  220. customClass: 'ele-message-border'
  221. });
  222. this.reload();
  223. }
  224. },
  225. /* 刷新表格 */
  226. reload (where) {
  227. this.$refs.table.reload({ page: 1, where });
  228. },
  229. openEdit (row) {
  230. if(row){
  231. this.addDialogTitle = '编辑报修记录';
  232. }else{
  233. this.addDialogTitle = '新增报修记录';
  234. }
  235. this.$refs.addDialogRef.init(row)
  236. },
  237. goDetail (row) {
  238. row.tabLabel = '维修信息';
  239. row.title = '报修记录详情';
  240. row.workOrderCode = row.id;
  241. this.$refs.detailsDialogRef.init(row);
  242. // this.$router.push({
  243. // path: '/maintenance/patrol/plan/details',
  244. // // query: {
  245. // // id
  246. // // }
  247. // })
  248. },
  249. // 委外
  250. appoint(row) {
  251. this.$refs.entDialogRef.init(row);
  252. },
  253. // 撤销
  254. remove(row){
  255. removeRequest(row.id).then((res) => {
  256. this.$message.success('撤销成功!');
  257. this.reload();
  258. });
  259. }
  260. }
  261. };
  262. </script>
  263. <style lang="scss" scoped></style>