details.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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:type="{ row }">
  15. <!-- <el-button type="text" size="mini" @click="handDetailed(row)"
  16. >详情</el-button
  17. > -->
  18. <el-tag v-if="row.type == 1">自建领料</el-tag>
  19. <el-tag v-if="row.type == 2">工单领料</el-tag>
  20. <el-tag v-if="row.type == 3">委外领料</el-tag>
  21. </template>
  22. <template v-slot:action="{ row }">
  23. <el-button type="text" size="mini" @click="handDetailed(row)"
  24. >详情</el-button
  25. >
  26. </template>
  27. <template v-slot:status="{ row }">
  28. <el-tag
  29. :type="['danger', 'success', 'warning', 'danger'][row.status]"
  30. effect="dark"
  31. style="margin: 3px 0"
  32. >{{ statusList[row.status] }}</el-tag
  33. >
  34. </template>
  35. </ele-pro-table>
  36. <detailed
  37. @detailedClose="detailedClose"
  38. v-if="detailedShow"
  39. :detailedObj="detailedObj"
  40. ></detailed>
  41. <!-- <outsourcingPickingList
  42. v-if="outsourcingPickingShow"
  43. ref="outsourcingPickingListRef"
  44. :workTaskId="workListIds[0]"
  45. :taskId="taskId"
  46. :workList="workList"
  47. @closeOutsourcingPicking="closeOutsourcingPicking"
  48. ></outsourcingPickingList> -->
  49. <!-- <picking
  50. v-if="pickingShow"
  51. @close="pickingClose"
  52. :workListIds="workListIds"
  53. ></picking> -->
  54. </div>
  55. </template>
  56. <script>
  57. import { pickDetails } from '@/api/produce/picking';
  58. import { workorderList } from '@/api/produce/workOrder';
  59. import detailed from '@/views/produce/components/picking/detailed.vue';
  60. // import outsourcingPickingList from './outsourcingPickingList.vue';
  61. import { getTaskInstanceById } from '@/api/produce/index';
  62. import { checkOutsource, listOutsource } from '@/api/produce/picking';
  63. // import picking from './outsourceIndex.vue';
  64. import { boolean } from 'mathjs';
  65. export default {
  66. name: 'picking-details',
  67. components: { detailed },
  68. props: {
  69. isDetails: {
  70. type: Boolean,
  71. default: false
  72. },
  73. workTaskId: {},
  74. taskId: {},
  75. workOrderInfo: {
  76. type: Object,
  77. default: {}
  78. }
  79. },
  80. data() {
  81. return {
  82. dataList: [],
  83. detailedShow: false,
  84. detailedObj: null,
  85. statusList: ['未领料', '领料中', '已出库', '已驳回'],
  86. outsourcingPickingShow: false,
  87. workList: [],
  88. pickingShow: false
  89. };
  90. },
  91. computed: {
  92. // 表格列配置
  93. columns() {
  94. return [
  95. {
  96. columnKey: 'index',
  97. label: '序号',
  98. type: 'index',
  99. width: 55,
  100. align: 'center',
  101. showOverflowTooltip: true
  102. },
  103. // {
  104. // label: '工序',
  105. // prop: 'taskName',
  106. // width: 120,
  107. // align: 'center',
  108. // showOverflowTooltip: true
  109. // },
  110. {
  111. prop: 'createTime',
  112. label: '领料时间',
  113. align: 'center',
  114. showOverflowTooltip: true
  115. },
  116. {
  117. prop: 'code',
  118. label: '领料单编号',
  119. align: 'center',
  120. showOverflowTooltip: true
  121. },
  122. {
  123. prop: 'name',
  124. label: '领料单名称',
  125. align: 'center',
  126. showOverflowTooltip: true
  127. },
  128. {
  129. prop: 'type',
  130. label: '领料类型',
  131. align: 'center',
  132. slot: 'type',
  133. showOverflowTooltip: true
  134. },
  135. {
  136. prop: 'executorName',
  137. label: '领料人',
  138. align: 'center'
  139. },
  140. {
  141. prop: 'status',
  142. slot: 'status',
  143. label: '状态',
  144. align: 'center'
  145. },
  146. {
  147. prop: '',
  148. label: '操作',
  149. width: 80,
  150. align: 'center',
  151. resizable: false,
  152. fixed: 'right',
  153. slot: 'action'
  154. }
  155. ];
  156. },
  157. taskObj() {
  158. return this.$store.state.user.taskObj;
  159. },
  160. clientEnvironmentId() {
  161. return this.$store.state.user.info.clientEnvironmentId;
  162. }
  163. },
  164. mounted() {
  165. const ids = [];
  166. ids.push(this.workOrderInfo.id);
  167. this.getList(ids);
  168. },
  169. methods: {
  170. getList(workListIds) {
  171. this.workListIds = workListIds || [];
  172. pickDetails(workListIds).then((res) => {
  173. this.dataList = res || [];
  174. this.$forceUpdate();
  175. });
  176. },
  177. rowClick(row) {},
  178. handleAdd() {
  179. this.$emit('pickAdd', 'pick');
  180. },
  181. refresh() {
  182. this.getList(this.workListIds);
  183. },
  184. handDetailed(row) {
  185. this.detailedObj = JSON.stringify(row);
  186. this.detailedShow = true;
  187. },
  188. detailedClose() {
  189. this.detailedShow = false;
  190. },
  191. openOutsourcingPicking() {
  192. if (this.workListIds) {
  193. this.getTaskInstanceByIdFn();
  194. // this.outsourcingPickingShow=true
  195. } else {
  196. this.$message.warning('请选择工单');
  197. }
  198. },
  199. closeOutsourcingPicking() {
  200. this.outsourcingPickingShow = false;
  201. },
  202. pickingClose() {
  203. this.pickingShow = false;
  204. this.getList(this.workListIds);
  205. },
  206. //获取工单列表
  207. getTaskInstanceByIdFn() {
  208. if (this.workListIds.length == 1) {
  209. this.pickingShow = true;
  210. } else {
  211. this.$message.warning('只能选择一个工单进行委外领料');
  212. }
  213. // let param = {
  214. // ids: [this.workListIds[0]],
  215. // taskId: this.taskId
  216. // };
  217. // workorderList(param)
  218. // .then((res) => {
  219. // let _arr = res.map((e) => {
  220. // e.pickList = [...e.bomDetailDTOS];
  221. // e.bomDetailDTOS = [];
  222. // return e;
  223. // });
  224. // this.workList = JSON.parse(JSON.stringify(_arr));
  225. // console.log(this.workList, 'this.workList');
  226. // this.outsourcingPickingShow = true;
  227. // this.getOutsourcingDataList(
  228. // this.workList[0].currentTaskDiagram.taskId
  229. // );
  230. // this.$forceUpdate();
  231. // })
  232. // .finally(() => {});
  233. // checkOutsource({
  234. // ids: [this.workListIds[0]],
  235. // taskId: this.workTaskId
  236. // }).then((res) => {
  237. // console.log(res);
  238. // });
  239. // getTaskInstanceById(this.workListIds[0]).then((res) => {
  240. // // console.log(res,this.workTaskId, 'res2345678');
  241. // let { data } = res;
  242. // if (data.length) {
  243. // let arr = data.filter((item) => item.taskId == this.workTaskId);
  244. // console.log(arr, 'arr');
  245. // console.log(arr, this.workTaskId, 'res2345678');
  246. // if (arr[0].existOutsource) {
  247. // } else {
  248. // this.$message.warning('当前工序不能委外领料');
  249. // }
  250. // }
  251. // });
  252. }
  253. },
  254. created() {}
  255. };
  256. </script>
  257. <style lang="scss" scoped></style>