qualityWorkOrderTable.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <div>
  3. <seek-page :seekList="seekList" @search="search"></seek-page>
  4. <ele-pro-table
  5. ref="table"
  6. row-key="id"
  7. :columns="columns"
  8. :datasource="datasource"
  9. :cache-key="cacheKeyUrl"
  10. autoAmendPage
  11. height="calc(86vh - 230px)"
  12. >
  13. <template v-slot:action="{ row }">
  14. <el-link type="primary" :underline="false" @click="goToDetail(row)">
  15. 详情
  16. </el-link>
  17. </template>
  18. <template v-slot:code="{ row }">
  19. <el-link type="primary" @click="goToDetail(row)">{{
  20. row.code
  21. }}</el-link>
  22. </template>
  23. </ele-pro-table>
  24. </div>
  25. </template>
  26. <script>
  27. import dictMixins from '@/mixins/dictMixins';
  28. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  29. import { batchRecordPage } from '@/api/qualityWorkOrder/index.js';
  30. export default {
  31. mixins: [dictMixins, tableColumnsMixin],
  32. props: {
  33. tableQuery: {
  34. type: Object,
  35. default: () => {
  36. return {};
  37. }
  38. }
  39. },
  40. data() {
  41. return {
  42. columns: [
  43. {
  44. width: 50,
  45. type: 'index',
  46. columnKey: 'index',
  47. align: 'center',
  48. label: '序号'
  49. },
  50. {
  51. prop: 'code',
  52. label: '质检工单编码',
  53. align: 'center',
  54. minWidth: 110,
  55. showOverflowTooltip: true,
  56. slot: 'code'
  57. },
  58. {
  59. prop: 'name',
  60. label: '质检工单名称',
  61. align: 'center',
  62. showOverflowTooltip: true,
  63. minWidth: 150
  64. },
  65. {
  66. prop: 'sourceCode',
  67. label: '来源单号',
  68. align: 'center',
  69. showOverflowTooltip: true,
  70. minWidth: 150,
  71. formatter: (row) => {
  72. return row.qualityPlanCode
  73. ? row.qualityPlanCode
  74. : row.workOrderCode;
  75. }
  76. },
  77. {
  78. prop: 'qualityType',
  79. label: '类型',
  80. align: 'center',
  81. showOverflowTooltip: true,
  82. minWidth: 150,
  83. formatter: (row) => {
  84. return this.getDictValue('质检计划类型', row.qualityType);
  85. }
  86. },
  87. {
  88. prop: 'qualityMode',
  89. label: '质检方式',
  90. align: 'center',
  91. showOverflowTooltip: true,
  92. minWidth: 150,
  93. formatter: (row) => {
  94. return this.getDictValue('取样类型', `0${row.qualityMode}`);
  95. }
  96. },
  97. {
  98. prop: 'qualityName',
  99. label: '报工人',
  100. align: 'center',
  101. showOverflowTooltip: true,
  102. minWidth: 150
  103. },
  104. {
  105. prop: 'qualityTime',
  106. label: '质检时间',
  107. align: 'center',
  108. showOverflowTooltip: true,
  109. minWidth: 150
  110. },
  111. {
  112. prop: 'status',
  113. label: '状态',
  114. align: 'center',
  115. showOverflowTooltip: true,
  116. minWidth: 150,
  117. formatter: (row) => {
  118. switch (row.status) {
  119. case 0:
  120. return '未报工';
  121. case 1:
  122. return '已报工';
  123. default:
  124. return '已关闭';
  125. }
  126. }
  127. },
  128. {
  129. label: '操作',
  130. columnKey: 'action',
  131. slot: 'action',
  132. showOverflowTooltip: true,
  133. minWidth: 110,
  134. align: 'center',
  135. fixed: 'right'
  136. }
  137. ],
  138. cacheKeyUrl: 'mes-9221130-quality-work-order-table'
  139. };
  140. },
  141. computed: {
  142. seekList() {
  143. return [
  144. {
  145. label: '生产工单编码',
  146. value: 'workOrderCode',
  147. type: 'input',
  148. placeholder: '请输入',
  149. labelWidth: 110
  150. },
  151. {
  152. label: '质检工单编码',
  153. value: 'code',
  154. type: 'input',
  155. placeholder: '请输入',
  156. labelWidth: 110
  157. },
  158. {
  159. label: '质检工单名称',
  160. value: 'name',
  161. type: 'input',
  162. placeholder: '请输入',
  163. labelWidth: 110
  164. }
  165. ];
  166. }
  167. },
  168. created() {
  169. this.requestDict('质检计划类型');
  170. this.requestDict('不良品处理类型');
  171. this.requestDict('取样类型');
  172. },
  173. methods: {
  174. // 刷新表格
  175. reload(where = {}) {
  176. this.$refs.table.reload({
  177. where,
  178. ...this.tableQuery
  179. });
  180. },
  181. /* 表格数据源 */
  182. datasource({ page, limit, where, order }) {
  183. // 参数
  184. const body = {
  185. ...where,
  186. ...order,
  187. pageNum: page,
  188. size: limit,
  189. ...this.tableQuery
  190. };
  191. return batchRecordPage(body);
  192. },
  193. search(where) {
  194. this.reload(where);
  195. },
  196. goToDetail(row) {
  197. const path = `/page-qms/inspectionWork/details?id=${row.id}&path=&name=工单`;
  198. window.history.pushState(null, '', path);
  199. }
  200. }
  201. };
  202. </script>
  203. <style></style>