index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <search @search="reload" ref="searchRef"> </search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. cache-key="workOrderTable"
  11. :pageSize="20"
  12. :height="tableHeight"
  13. @fullscreen-change="fullscreenChange"
  14. >
  15. <template v-slot:feedStatus="{ row }">
  16. {{
  17. row.feedStatus === 1
  18. ? '报工中'
  19. : row.feedStatus === 0
  20. ? '投料中'
  21. : ''
  22. }}
  23. </template>
  24. <template v-slot:taskStayTimeDuration="{ row }">
  25. <span>{{ getTimeData(row.taskStayTimeDuration) }}</span>
  26. </template>
  27. </ele-pro-table>
  28. </el-card>
  29. </div>
  30. </template>
  31. <script>
  32. import { getList } from '@/api/InTheSystem/index.js';
  33. import search from './components/search.vue';
  34. export default {
  35. components: {
  36. search
  37. },
  38. data() {
  39. return {
  40. loading: false,
  41. tableHeight: 'calc(100vh - 330px)'
  42. };
  43. },
  44. computed: {
  45. // 表格列配置
  46. columns() {
  47. return [
  48. {
  49. columnKey: 'index',
  50. label: '序号',
  51. type: 'index',
  52. width: 55,
  53. align: 'center',
  54. fixed: 'left'
  55. },
  56. {
  57. prop: 'batchNo',
  58. label: '批次号',
  59. align: 'center',
  60. fixed: 'left',
  61. showOverflowTooltip: true
  62. },
  63. {
  64. prop: 'workOrderCode',
  65. label: '工单编码',
  66. align: 'center',
  67. minWidth: 110,
  68. fixed: 'left',
  69. showOverflowTooltip: true
  70. },
  71. {
  72. prop: 'qualityTaskName',
  73. label: '当前工序',
  74. align: 'center',
  75. showOverflowTooltip: true
  76. },
  77. {
  78. prop: 'taskName',
  79. label: '处置工序',
  80. align: 'center',
  81. showOverflowTooltip: true
  82. },
  83. {
  84. prop: 'categoryCode',
  85. label: '物品编码',
  86. align: 'center',
  87. minWidth: 160,
  88. showOverflowTooltip: true
  89. },
  90. {
  91. prop: 'name',
  92. label: '物品名称',
  93. align: 'center',
  94. minWidth: 160,
  95. showOverflowTooltip: true
  96. },
  97. {
  98. slot: 'feedStatus',
  99. label: '类型',
  100. align: 'center',
  101. showOverflowTooltip: true
  102. },
  103. {
  104. prop: 'number',
  105. label: '数量',
  106. align: 'center',
  107. showOverflowTooltip: true
  108. },
  109. {
  110. prop: 'deviceName',
  111. label: '设备名称',
  112. align: 'center',
  113. showOverflowTooltip: true
  114. },
  115. {
  116. prop: 'taskStayTimeDuration',
  117. slot: 'taskStayTimeDuration',
  118. label: '停留时间',
  119. align: 'center',
  120. width: 120,
  121. showOverflowTooltip: true
  122. },
  123. {
  124. prop: 'workstationName',
  125. label: '工位',
  126. align: 'center',
  127. showOverflowTooltip: true
  128. },
  129. {
  130. prop: 'factoriesName',
  131. label: '所属工厂',
  132. align: 'center',
  133. showOverflowTooltip: true
  134. },
  135. {
  136. prop: 'createName',
  137. label: '创建人',
  138. align: 'center',
  139. showOverflowTooltip: true
  140. },
  141. {
  142. prop: 'createTime',
  143. label: '创建时间',
  144. align: 'center',
  145. showOverflowTooltip: true,
  146. minWidth: 110,
  147. showOverflowTooltip: true
  148. }
  149. ];
  150. }
  151. },
  152. created() {},
  153. methods: {
  154. /* 表格数据源 */
  155. datasource({ page, limit, where }) {
  156. where = { rootCategoryLevelId: ['2'], ...where };
  157. return getList({
  158. pageNum: page,
  159. size: limit,
  160. ...where
  161. });
  162. },
  163. fullscreenChange(fullscreen) {
  164. if (fullscreen) {
  165. this.tableHeight = 'calc(100vh - 120px)';
  166. } else {
  167. this.tableHeight = 'calc(100vh - 330px)';
  168. }
  169. },
  170. /* 刷新表格 */
  171. reload(where) {
  172. this.$nextTick(() => {
  173. this.$refs.table.reload({ page: 1, where });
  174. });
  175. },
  176. getTimeData(time) {
  177. if (time) {
  178. const days = Math.floor(time / 1440);
  179. const remainingMinutes = time % 1440;
  180. const hours = Math.floor(remainingMinutes / 60);
  181. const minutes = remainingMinutes % 60;
  182. // 返回格式化的字符串
  183. if (days) {
  184. return `${days}天${hours}小时${minutes}分钟`;
  185. } else if (hours) {
  186. return `${hours}小时${minutes}分钟`;
  187. } else {
  188. return `${minutes}分钟`;
  189. }
  190. }
  191. }
  192. }
  193. };
  194. </script>
  195. <style lang="scss" scoped></style>