index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <el-dialog
  3. title="首件两检报工"
  4. :visible.sync="dialogVisible"
  5. width="85%"
  6. :before-close="handleClose"
  7. >
  8. <div>
  9. <div class="step-list" v-loading="loading">
  10. <ele-pro-table
  11. ref="table"
  12. row-key="id"
  13. :columns="columns"
  14. :datasource="list"
  15. cache-key="mes-ruleRecordsList-2511172018"
  16. autoAmendPage
  17. :need-page="false"
  18. @refresh="getData"
  19. >
  20. <template v-slot:selfCheck="{ row }">
  21. <el-button
  22. type="primary"
  23. @click="selfRequest(row)"
  24. v-if="row.status == 0"
  25. >自检请托</el-button
  26. >
  27. <el-button
  28. type="primary"
  29. :disabled="row.status != 0"
  30. @click="reportClick(row, 1)"
  31. >{{ row.status == 0 ? '报工' : '已报工' }}</el-button
  32. >
  33. <el-button
  34. type="primary"
  35. v-if="row.status == 2 || row.status == 3"
  36. @click="reportClick(row, 1, 'detail')"
  37. >详情</el-button
  38. >
  39. </template>
  40. <template v-slot:specialInspection="{ row }">
  41. <el-button
  42. type="primary"
  43. :disabled="row.status != 2"
  44. @click="reportClick(row, 2)"
  45. >{{ row.status == 3 ? '已报工' : '报工' }}</el-button
  46. >
  47. <el-button
  48. type="primary"
  49. v-if="row.status == 3"
  50. @click="reportClick(row, 2, 'detail')"
  51. >详情</el-button
  52. >
  53. </template>
  54. <template v-slot:status="{ row }">
  55. <el-tag v-if="row.status == 0">待自检</el-tag>
  56. <el-tag v-if="row.status == 2">待专检</el-tag>
  57. <el-tag v-if="row.status == 3">已完成</el-tag>
  58. </template>
  59. </ele-pro-table>
  60. </div>
  61. </div>
  62. <self-inspection-reporting
  63. ref="selfReportingRef"
  64. @refreshData="getData"
  65. ></self-inspection-reporting>
  66. <self-inspection-request
  67. ref="selfRequestRef"
  68. @refreshData="getData"
  69. ></self-inspection-request>
  70. </el-dialog>
  71. </template>
  72. <script>
  73. import { getQualityInspectionList } from '@/api/produce/qualityInspection.js';
  74. import dictMixins from '@/mixins/dictMixins';
  75. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  76. import selfInspectionReporting from './components/selfInspectionReporting.vue';
  77. import selfInspectionRequest from './components/selfInspectionRequest.vue';
  78. export default {
  79. mixins: [dictMixins, tableColumnsMixin],
  80. components: {
  81. selfInspectionReporting,
  82. selfInspectionRequest
  83. },
  84. data() {
  85. return {
  86. dialogVisible: false,
  87. loading: false,
  88. produceTaskInfo: null,
  89. workOrder: null,
  90. butLoad: false,
  91. list: [],
  92. type: ''
  93. };
  94. },
  95. computed: {
  96. columns() {
  97. return [
  98. {
  99. width: 50,
  100. type: 'index',
  101. columnKey: 'index',
  102. label: '序号',
  103. align: 'center'
  104. },
  105. {
  106. prop: 'name',
  107. label: '名称',
  108. align: 'center',
  109. showOverflowTooltip: true,
  110. minWidth: 150
  111. },
  112. {
  113. prop: 'workstationName',
  114. label: '工位名称',
  115. align: 'center',
  116. showOverflowTooltip: true,
  117. minWidth: 150
  118. },
  119. {
  120. prop: 'deviceName',
  121. label: '设备名称',
  122. align: 'center',
  123. showOverflowTooltip: true,
  124. minWidth: 150
  125. },
  126. {
  127. prop: 'selfCheckUserName',
  128. label: '自检报工人',
  129. align: 'center',
  130. showOverflowTooltip: true,
  131. minWidth: 120
  132. },
  133. {
  134. prop: 'selfCheckTime',
  135. label: '自检时间',
  136. align: 'center',
  137. showOverflowTooltip: true,
  138. minWidth: 120
  139. },
  140. {
  141. prop: 'specialCheckUserName',
  142. label: '专检报工人',
  143. align: 'center',
  144. showOverflowTooltip: true,
  145. minWidth: 120
  146. },
  147. {
  148. prop: 'specialCheckTime',
  149. label: '专检时间',
  150. align: 'center',
  151. showOverflowTooltip: true,
  152. minWidth: 120
  153. },
  154. {
  155. prop: 'status',
  156. slot: 'status',
  157. label: '状态',
  158. align: 'center',
  159. showOverflowTooltip: true,
  160. minWidth: 100
  161. },
  162. {
  163. label: '自检报工',
  164. align: 'center',
  165. width: 150,
  166. fixed: 'right',
  167. slot: 'selfCheck'
  168. },
  169. {
  170. label: '专检报工',
  171. align: 'center',
  172. width: 150,
  173. fixed: 'right',
  174. slot: 'specialInspection'
  175. }
  176. ];
  177. }
  178. },
  179. methods: {
  180. open(workOrder, produceTaskInfo, type) {
  181. this.workOrder = workOrder;
  182. this.produceTaskInfo = produceTaskInfo;
  183. this.type = type;
  184. this.dialogVisible = true;
  185. this.getData();
  186. },
  187. // 获取数据
  188. async getData() {
  189. this.loading = true;
  190. try {
  191. const isSourceTask = this.type == 1;
  192. const params = {
  193. workOrderId: this.workOrder?.id,
  194. produceTaskId: isSourceTask
  195. ? this.produceTaskInfo?.sourceTaskId
  196. : this.produceTaskInfo?.id,
  197. produceTaskInstanceId: isSourceTask
  198. ? this.produceTaskInfo?.id
  199. : this.workOrder?.taskId
  200. };
  201. const { list = [] } = await getQualityInspectionList(params);
  202. this.list = list;
  203. } catch (error) {
  204. this.list = [];
  205. } finally {
  206. this.loading = false;
  207. }
  208. },
  209. handleClose() {
  210. this.dialogVisible = false;
  211. this.$emit('close');
  212. },
  213. async handleUpdate() {
  214. try {
  215. this.butLoad = true;
  216. await this.getData();
  217. this.$message.success('已更新');
  218. this.butLoad = false;
  219. } catch (error) {
  220. this.butLoad = false;
  221. }
  222. },
  223. selfRequest(row) {
  224. this.$refs.selfRequestRef.open(row);
  225. },
  226. reportClick(row, type, mode) {
  227. this.$refs.selfReportingRef.open(row, type, mode);
  228. }
  229. }
  230. };
  231. </script>
  232. <style lang="scss" scoped></style>