detailDialog.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div>
  3. <!-- <div class="switch">
  4. <div class="switch_left">
  5. <ul>
  6. <li
  7. v-for="item in tabOptions"
  8. :key="item.key"
  9. :class="{ active: activeComp == item.key }"
  10. @click="changeActive(item)"
  11. >
  12. {{ item.name }}
  13. </li>
  14. </ul>
  15. </div>
  16. </div> -->
  17. <div v-show="activeComp == 'main'">
  18. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  19. <headerTitle title="入库单详情"></headerTitle>
  20. <el-row>
  21. <el-col :span="6">
  22. <el-form-item label="物品名称:" prop="categoryName">
  23. {{ form.categoryName }}
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="6">
  27. <el-form-item label="物品编码:" prop="categoryCode">
  28. {{ form.categoryCode }}
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="6">
  32. <el-form-item label="物品分类:" prop="categoryLevelName">
  33. {{ form.categoryLevelName }}
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="6">
  37. <el-form-item label="包装数量:" prop="totalPackage">
  38. {{ totalPackage }}
  39. </el-form-item>
  40. </el-col>
  41. <!-- <el-form-item label="单位:" prop="packingUnit">
  42. {{ form.packingUnit }}
  43. </el-form-item> -->
  44. <el-col :span="6">
  45. <el-form-item label="计量数量:" prop="totalCount">
  46. {{ totalCount }}
  47. </el-form-item>
  48. </el-col>
  49. <!-- <el-col :span="12">
  50. <el-form-item label="车牌号:" prop="carNo">
  51. {{ form.carNo }}
  52. </el-form-item>
  53. <el-form-item label="收货单编码:" prop="receiveNo">
  54. {{ form.receiveNo }}
  55. </el-form-item>
  56. <el-form-item label="制单人:" prop="makerName">
  57. {{ form.makerName }}
  58. </el-form-item>
  59. <el-form-item prop="orderNo" label="订单编码:">
  60. {{ form.orderNo }}
  61. </el-form-item>
  62. </el-col> -->
  63. </el-row>
  64. </el-form>
  65. </div>
  66. <keep-alive>
  67. <add
  68. ref="add"
  69. :form="form"
  70. :bizType="taskDefinitionKey == 'wmsBizType4' ? 4 : 1"
  71. v-if="form.code"
  72. :sourceBizNo="form.code"
  73. :detailList="form.detailList"
  74. ></add>
  75. </keep-alive>
  76. </div>
  77. </template>
  78. <script>
  79. import { getStorageDetail } from '@/api/mes/index';
  80. import dictMixins from '@/mixins/dictMixins';
  81. import { reviewStatusEnum } from '@/enum/dict';
  82. import add from '@/views/bpm/stockManagement/storage.vue';
  83. export default {
  84. props: {
  85. businessId: {
  86. default: ''
  87. },
  88. taskId: {
  89. default: ''
  90. },
  91. taskDefinitionKey: {
  92. default: ''
  93. }
  94. },
  95. components: {
  96. add
  97. },
  98. mixins: [dictMixins],
  99. data() {
  100. return {
  101. activeComp: 'main',
  102. tabOptions: [
  103. { key: 'main', name: '生产入库单详情' },
  104. { key: 'storage', name: '生产入库' }
  105. ],
  106. reviewStatusEnum,
  107. rules: {},
  108. form: {},
  109. detailData: {},
  110. totalPackage: '',
  111. totalCount: ''
  112. };
  113. },
  114. async created() {
  115. await this.getDetailData(this.businessId);
  116. },
  117. methods: {
  118. changeActive(item) {
  119. console.log('item', item);
  120. this.activeComp = item.key;
  121. this.$emit('activeCompChange', item.key);
  122. // if (this.taskDefinitionKey == 'storeman' && item.key == 'storage') {
  123. // this.$nextTick(() => {
  124. // this.$refs.add.pickerSuccess(this.form);
  125. // });
  126. // }
  127. },
  128. success() {
  129. this.$emit('handleClose');
  130. },
  131. async getTableValue() {
  132. return {
  133. form: this.form,
  134. returnStorageData:
  135. this.$refs.add && (await this.$refs.add.getReturnStorage())
  136. };
  137. },
  138. async getDetailData(id) {
  139. this.loading = true;
  140. const data = await getStorageDetail(id);
  141. console.log('data-----------', data);
  142. this.loading = false;
  143. if (data) {
  144. this.form = data;
  145. let categoryLevelTopIds = data.detailList.map(
  146. (item) => item.rootCategoryLevelId
  147. );
  148. let filterCategoryLevelTopIds = Array.from(
  149. new Set(categoryLevelTopIds)
  150. );
  151. data.categoryLevelTopId = filterCategoryLevelTopIds.join(',');
  152. if (this.taskDefinitionKey == 'wmsBizType4') {
  153. this.form.totalCount = data.detailList.reduce(
  154. (sum, item) => sum + (item.quantity || 0),
  155. 0
  156. );
  157. this.$set(
  158. this.form,
  159. 'totalCount',
  160. data.detailList.reduce(
  161. (sum, item) => sum + (item.quantity || 0),
  162. 0
  163. )
  164. );
  165. }
  166. this.totalPackage =
  167. this.form.detailList.length + this.form?.detailList[0]?.packingUnit;
  168. this.totalCount =
  169. this.form.totalCount + this.form?.detailList[0]?.measuringUnit;
  170. this.detailData = data;
  171. }
  172. }
  173. }
  174. };
  175. </script>
  176. <style scoped lang="scss">
  177. .ele-dialog-form {
  178. .el-form-item {
  179. margin-bottom: 10px;
  180. }
  181. }
  182. .headbox {
  183. display: flex;
  184. justify-content: flex-start;
  185. align-items: center;
  186. .amount {
  187. font-size: 14px;
  188. font-weight: bold;
  189. margin-right: 20px;
  190. }
  191. }
  192. </style>