index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div>
  3. <div class="top_fixed">
  4. <el-button type="primary" size="mini" @click="save(2, 'all')">一键报工</el-button>
  5. <el-button type="primary" size="mini" @click="removeCacheFn('all')">清空缓存</el-button>
  6. <el-button type="primary" size="mini" @click="save(1, 'all')">缓存</el-button>
  7. </div>
  8. <div class="job_box">
  9. <div v-for="(item, index) in List" :key="index" class="card_box" v-if="isLoad">
  10. <div class="title_box rx-bc">
  11. <div class="name">工单信息 </div>
  12. <div class="rx-bc">
  13. <el-button type="text" size="mini" @click="openPicking(item.id, item)">添加物料</el-button>
  14. <el-button type="text" size="mini" @click="removeCacheFn(item.id)">清空缓存</el-button>
  15. <el-button type="text" size="mini" @click="save(1, index)">缓存</el-button>
  16. </div>
  17. </div>
  18. <workOrderBom :item="item"></workOrderBom>
  19. <paramBom v-if="item.paramDetailList.length != 0" :list="item.paramDetailList"></paramBom>
  20. <jobBom :item="item" :notFormed="item.notFormedList" :warehouseList="warehouseList"></jobBom>
  21. <deviceBom v-if="item.equipmentList.length != 0" :list="item.equipmentList"></deviceBom>
  22. <modelBom v-if='item.modelList.length != 0' :list='item.modelList' pattern='job' ref='modelRef'></modelBom>
  23. </div>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { listByIdsReport } from '@/api/produce/job';
  29. import { getWarehouseList } from '@/api/produce/index';
  30. import workOrderBom from '../feeding/components/workOrderBom.vue';
  31. import paramBom from '../feeding/components/paramBom.vue';
  32. import jobBom from './components/jobBom.vue';
  33. import deviceBom from '../feeding/components/deviceBom.vue';
  34. import modelBom from '../feeding/components/modelBom.vue'
  35. export default {
  36. components: {
  37. workOrderBom,
  38. paramBom,
  39. jobBom,
  40. deviceBom
  41. },
  42. props: {
  43. workListIds: {
  44. type: Array,
  45. default() {
  46. return [];
  47. }
  48. }
  49. },
  50. data() {
  51. return {
  52. List: [],
  53. idsList: [],
  54. isLoad: false,
  55. warehouseList: []
  56. };
  57. },
  58. computed: {
  59. taskObj() {
  60. return this.$store.state.user.taskObj;
  61. },
  62. clientEnvironmentId() {
  63. return this.$store.state.user.info.clientEnvironmentId;
  64. }
  65. },
  66. watch: {
  67. workListIds: {
  68. handler(val) {
  69. this.getList(val);
  70. },
  71. deep: true,
  72. immediate: true
  73. }
  74. },
  75. created() {
  76. this.getWarehouseListFn();
  77. },
  78. methods: {
  79. getList(ids) {
  80. this.idsList = ids || [];
  81. let param = {
  82. ids: ids,
  83. taskId: this.taskObj.id,
  84. type: 0
  85. };
  86. this.isLoad = false;
  87. listByIdsReport(param)
  88. .then((res) => {
  89. this.List = res.map((obj) => {
  90. if (!Object.prototype.hasOwnProperty.call(obj, 'turnover')) {
  91. obj['turnover'] = [];
  92. }
  93. if (
  94. !Object.prototype.hasOwnProperty.call(obj, 'aridRegionList')
  95. ) {
  96. obj['aridRegionList'] = [];
  97. }
  98. if (!Object.prototype.hasOwnProperty.call(obj, 'instanceList')) {
  99. obj['instanceList'] = [];
  100. }
  101. if (!Object.prototype.hasOwnProperty.call(obj, 'palletList')) {
  102. obj['palletList'] = [];
  103. }
  104. if (
  105. !Object.prototype.hasOwnProperty.call(obj, 'revolvingDiskList')
  106. ) {
  107. obj['revolvingDiskList'] = [];
  108. }
  109. if (obj.palletList.length > 0) {
  110. obj.palletList = obj.palletList.map((m) => {
  111. return {
  112. hideKc: true, // 不显示库存
  113. quantity: m.feedQuantity,
  114. ...m
  115. };
  116. });
  117. }
  118. if (this.taskObj.type == 6 && this.clientEnvironmentId == 3) {
  119. obj.semiProductList = obj.pickOutInList;
  120. }
  121. obj.workReportInfo = {
  122. formingNum: null,
  123. formingWeight: null,
  124. formedNum: null,
  125. formedWeight: null,
  126. taskId: this.taskObj.id
  127. };
  128. obj.notFormedList = [
  129. {
  130. notFormedNum: null,
  131. notFormedWeight: null,
  132. weightUnit: obj.weightUnit,
  133. unit: obj.unit,
  134. warehouseId: null // 处置 仓库id
  135. }
  136. ];
  137. if (obj.semiProductList.length > 0) {
  138. // 预制体报工
  139. obj.workReportInfo.formedNum = obj.semiProductList.length;
  140. }
  141. obj.workReportInfo.formingNum = obj.formingNum;
  142. obj.workReportInfo.formingWeight = obj.formingWeight;
  143. obj.workReportInfo.unit = obj.unit;
  144. obj.workReportInfo.weightUnit = obj.weightUnit;
  145. obj.workReportInfo.workOrderId = obj.workOrderId;
  146. obj.paramDetailList.map((m) => {
  147. if (m.extInfo.textType == 5) {
  148. m.remainingTime = m.extInfo.remainingTime;
  149. }
  150. return {
  151. ...m.extInfo
  152. };
  153. });
  154. return {
  155. ...obj
  156. };
  157. });
  158. })
  159. .finally(() => {
  160. this.isLoad = true;
  161. if (this.taskObj.id == 1) {
  162. this.getCacheFn();
  163. }
  164. });
  165. },
  166. async save(type, index) { },
  167. getCacheFn() { },
  168. removeCacheFn(type) { },
  169. getWarehouseListFn() {
  170. getWarehouseList().then((res) => {
  171. this.warehouseList = res.data;
  172. });
  173. }
  174. }
  175. };
  176. </script>
  177. <style scoped lang="scss">
  178. .top_fixed {
  179. width: 100%;
  180. height: 40px;
  181. background: #fff;
  182. display: flex;
  183. align-items: center;
  184. justify-content: flex-end;
  185. }
  186. .title_box {
  187. .name {
  188. font-size: 14px;
  189. font-style: normal;
  190. font-weight: 400;
  191. color: #157a2c;
  192. padding-left: 5px;
  193. position: relative;
  194. &:before {
  195. position: absolute;
  196. content: '';
  197. left: 0px;
  198. top: 0px;
  199. bottom: 0px;
  200. width: 2px;
  201. height: 14px;
  202. background: #157a2c;
  203. margin: auto;
  204. }
  205. }
  206. }
  207. .job_box {
  208. margin-top: 6px;
  209. width: 100%;
  210. height: calc(100vh - 70px - 50px - 80px - 60px);
  211. overflow-y: scroll;
  212. overflow-x: hidden;
  213. }
  214. .card_box {
  215. background: #fff;
  216. padding: 8px;
  217. border-radius: 2px;
  218. }
  219. </style>