index.vue 6.9 KB

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