details.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div>
  3. <ele-pro-table
  4. ref="table"
  5. :columns="columns"
  6. max-height="68vh"
  7. :datasource="dataList"
  8. cache-key="pickingDetails"
  9. highlight-current-row
  10. @row-click="rowClick"
  11. :need-page="false"
  12. @refresh="refresh"
  13. >
  14. <template v-slot:toolbar>
  15. <div class="rx-sc" v-if="!isDetails">
  16. <div class="c_title">领料记录 </div>
  17. <el-button type="primary" size="mini" style="margin: 0 5px" @click="handleAdd">新增</el-button>
  18. <!-- <el-button type="primary" size="mini" @click="openOutsourcingPicking()">委外领料</el-button> -->
  19. </div>
  20. </template>
  21. <template v-slot:action="{ row }">
  22. <el-button type="text" size="mini" @click="handDetailed(row)"
  23. >详情</el-button
  24. >
  25. </template>
  26. <template v-slot:status="{ row }">
  27. <el-tag
  28. :type="['danger', 'success', 'warning', 'danger'][row.status] "
  29. effect="dark"
  30. style="margin: 3px 0;"
  31. >{{
  32. statusList[row.status]
  33. }}</el-tag
  34. >
  35. </template>
  36. </ele-pro-table>
  37. <detailed
  38. @detailedClose="detailedClose"
  39. v-if="detailedShow"
  40. :detailedObj="detailedObj"
  41. ></detailed>
  42. <outsourcingPickingList v-if="outsourcingPickingShow" ref="outsourcingPickingListRef" @closeOutsourcingPicking="closeOutsourcingPicking"></outsourcingPickingList>
  43. </div>
  44. </template>
  45. <script>
  46. import { pickDetails } from '@/api/produce/picking';
  47. import detailed from './detailed.vue';
  48. import outsourcingPickingList from './outsourcingPickingList.vue';
  49. import { getTaskInstanceById } from '@/api/produce/index';
  50. import { boolean } from 'mathjs';
  51. export default {
  52. name: 'picking-details',
  53. components: { detailed,outsourcingPickingList },
  54. props:{
  55. isDetails:{
  56. type: Boolean,
  57. default: false
  58. },
  59. workTaskId:{
  60. }
  61. },
  62. data() {
  63. return {
  64. dataList: [],
  65. detailedShow: false,
  66. detailedObj: null,
  67. statusList: ['未领料', '领料中', '已出库', '已驳回'],
  68. outsourcingPickingShow:false
  69. };
  70. },
  71. computed: {
  72. // 表格列配置
  73. columns() {
  74. return [
  75. {
  76. columnKey: 'index',
  77. label: '序号',
  78. type: 'index',
  79. width: 55,
  80. align: 'center',
  81. showOverflowTooltip: true
  82. },
  83. // {
  84. // label: '工序',
  85. // prop: 'taskName',
  86. // width: 120,
  87. // align: 'center',
  88. // showOverflowTooltip: true
  89. // },
  90. {
  91. prop: 'createTime',
  92. label: '领料时间',
  93. align: 'center'
  94. },
  95. {
  96. prop: 'code',
  97. label: '领料单编号',
  98. align: 'center'
  99. },
  100. {
  101. prop: 'name',
  102. label: '领料单名称',
  103. align: 'center'
  104. },
  105. {
  106. prop: 'executorName',
  107. label: '领料人',
  108. align: 'center'
  109. },
  110. {
  111. prop: 'status',
  112. slot: 'status',
  113. label: '状态',
  114. align: 'center'
  115. },
  116. {
  117. prop: '',
  118. label: '操作',
  119. width: 80,
  120. align: 'center',
  121. resizable: false,
  122. fixed: 'right',
  123. slot: 'action'
  124. }
  125. ];
  126. },
  127. taskObj() {
  128. return this.$store.state.user.taskObj;
  129. },
  130. clientEnvironmentId() {
  131. return this.$store.state.user.info.clientEnvironmentId;
  132. }
  133. },
  134. methods: {
  135. getList(workListIds) {
  136. this.workListIds = workListIds || [];
  137. pickDetails(workListIds).then((res) => {
  138. this.dataList = res || [];
  139. this.$forceUpdate();
  140. });
  141. },
  142. rowClick(row) {},
  143. handleAdd() {
  144. this.$emit('pickAdd', 'pick');
  145. },
  146. refresh() {
  147. this.getList(this.workListIds);
  148. },
  149. handDetailed(row) {
  150. this.detailedObj = JSON.stringify(row);
  151. this.detailedShow = true;
  152. },
  153. detailedClose() {
  154. this.detailedShow = false;
  155. },
  156. openOutsourcingPicking(){
  157. console.log('this.workListIds',this.workListIds)
  158. if(this.workListIds.length == 1){
  159. this.getTaskInstanceByIdFn()
  160. // this.outsourcingPickingShow=true
  161. }else{
  162. this.$message.warning('只能选择一条工单进行委外领料');
  163. }
  164. },
  165. closeOutsourcingPicking(){
  166. this.outsourcingPickingShow=false
  167. },
  168. //获取工单列表
  169. getTaskInstanceByIdFn() {
  170. getTaskInstanceById(this.workListIds[0]).then((res) => {
  171. // console.log(res,this.workTaskId, 'res2345678');
  172. let { data } = res;
  173. if (data.length) {
  174. let arr = data.filter(item => item.taskId == this.workTaskId)
  175. console.log(arr,this.workTaskId, 'res2345678');
  176. if(arr[0].existOutsource){
  177. this.outsourcingPickingShow=true
  178. }else{
  179. this.$message.warning('当前工序不能委外领料');
  180. }
  181. }
  182. })
  183. },
  184. },
  185. created() {}
  186. };
  187. </script>
  188. <style lang="scss" scoped></style>