DetailsWorkOrder.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div style="height: 100%">
  3. <el-table v-loading="listLoading" border :data="list" height="calc(100% - 42px)">
  4. <el-table-column
  5. v-for="(item, index) in columns"
  6. :key="index"
  7. align="center"
  8. :label="item.label"
  9. :min-width="item.width"
  10. :prop="item.prop"
  11. show-overflow-tooltip>
  12. <template #default="{ row }">
  13. <span v-if="item.prop === 'orderStatus'">
  14. {{ selectDictLabel(orderStatusOptions, row.orderStatus) }}
  15. </span>
  16. <span v-else-if="item.prop === 'createdTime'">
  17. {{ parseTime(row.createdTime, '{y}-{m}-{d}') }}
  18. </span>
  19. <el-button v-else-if="item.prop === 'name'" class="link-button" type="text" @click="handleDetail(row)">
  20. {{ row[item.prop] }}
  21. </el-button>
  22. <span v-else>{{ row[item.prop] }}</span>
  23. </template>
  24. </el-table-column>
  25. </el-table>
  26. </div>
  27. </template>
  28. <script>
  29. import workOrderApi from '@/api/work/index'
  30. import to from 'await-to-js'
  31. export default {
  32. name: 'DetailsContract',
  33. data() {
  34. return {
  35. busId: undefined,
  36. queryForm: {
  37. nboCode: undefined,
  38. pageNum: 1,
  39. pageSize: 9999,
  40. },
  41. listLoading: false,
  42. selectRows: [],
  43. showColumns: [],
  44. columns: [
  45. {
  46. label: '工单名称',
  47. width: '160px',
  48. prop: 'name',
  49. disableCheck: true,
  50. },
  51. {
  52. label: '工单类型',
  53. width: 'auto',
  54. prop: 'orderTypeName',
  55. },
  56. {
  57. label: '工单状态',
  58. width: '80px',
  59. prop: 'orderStatus',
  60. },
  61. {
  62. label: '支持人员',
  63. width: 'auto',
  64. prop: 'assignUserName',
  65. },
  66. // {
  67. // label: '反馈信息',
  68. // width: 'auto',
  69. // prop: 'feedBack',
  70. // },
  71. {
  72. label: '创建人',
  73. width: '80px',
  74. prop: 'createdName',
  75. },
  76. {
  77. label: '创建时间',
  78. width: '80px',
  79. prop: 'createdTime',
  80. },
  81. ],
  82. orderStatusOptions: [],
  83. list: [],
  84. }
  85. },
  86. mounted() {
  87. this.getOptions()
  88. },
  89. methods: {
  90. getOptions() {
  91. Promise.all([this.getDicts('work_order_status')])
  92. .then(([workorder]) => {
  93. this.orderStatusOptions = workorder.data.values || []
  94. })
  95. .catch((err) => console.log(err))
  96. },
  97. open(nboCode) {
  98. this.queryForm.nboCode = nboCode
  99. this.fetchData()
  100. },
  101. handleDetail(row) {
  102. this.$router.push({
  103. name: 'WorkOrderDetail',
  104. query: {
  105. id: row.id,
  106. },
  107. })
  108. },
  109. async fetchData() {
  110. this.listLoading = true
  111. const params = { ...this.queryForm }
  112. const [err, res] = await to(workOrderApi.getList(params))
  113. if (err) return (this.listLoading = false)
  114. this.list = res.data.list || []
  115. this.total = res.data.total
  116. this.listLoading = false
  117. },
  118. },
  119. }
  120. </script>