details.vue 7.6 KB

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