mixMaterialDetail.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
  3. <template #gHeader>
  4. <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  5. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  6. <text
  7. style="font-size:44rpx;"
  8. class="gui-header-leader-btns gui-color-white font-icons"
  9. @tap="goBack"
  10. >&#xe6c5;</text>
  11. <!-- 导航文本此处也可以是其他自定义内容 -->
  12. <text
  13. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text"
  14. >多单备料资源档</text>
  15. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  16. <!-- 实际宽度请根据自己情况设置 -->
  17. <view style="width:40px;" />
  18. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  19. </view>
  20. </template>
  21. <template #gBody>
  22. <view class="list-content">
  23. <view class="table-title">
  24. <span>资源清单</span>
  25. </view>
  26. <view v-if="cardList?.length > 0">
  27. <view
  28. v-for="item in cardList"
  29. :key="item.id"
  30. class="card-list-flexbox"
  31. @click="handleShowResetMaterialNumDialog(item)"
  32. >
  33. <view class="card-list-item">
  34. <text class="text-1 gui-color-gray">{{ item.workOrderNo }}</text>
  35. <text class="text-2 gui-color-gray font-icons">更改应备量&#xe66b;</text>
  36. </view>
  37. <view class="card-list-item">
  38. <text class="text-1 gui-color-gray">用料清单号</text>
  39. <text class="text-2 gui-color-gray">{{ item.workOrderBomNo }}</text>
  40. </view>
  41. <view class="card-list-item">
  42. <text class="text-1 gui-color-gray">应备数量</text>
  43. <text class="text-2" style="color: orange;font-weight: bold;">{{ item.nowSendQty }}</text>
  44. </view>
  45. <view class="card-list-item">
  46. <text class="text-1 gui-color-gray">BOM规格</text>
  47. <text class="text-2" style="color: orange;font-weight: bold;">{{ item.bomModel }}</text>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-else>
  52. <view class="bg-image">
  53. <image src="@/static/empty.png" mode="heightFix" />
  54. <text>这里什么都没有...</text>
  55. </view>
  56. </view>
  57. <uni-popup ref="inputDialog" type="dialog">
  58. <uni-popup-dialog
  59. ref="inputClose"
  60. mode="input"
  61. title="更改物料应备数"
  62. :value="materialObject.num"
  63. placeholder="请输入内容"
  64. @confirm="handleResetMaterialNum"
  65. />
  66. </uni-popup>
  67. </view>
  68. </template>
  69. </gui-page>
  70. </template>
  71. <script>
  72. import {
  73. onReachBottom
  74. } from '@dcloudio/uni-app'
  75. import {
  76. ref,
  77. defineComponent,
  78. onMounted,
  79. onBeforeMount
  80. } from 'vue'
  81. export default defineComponent({
  82. setup() {
  83. const parentRow = uni.getStorageSync('mixMaterialDetail') ?? {}
  84. const detailId = ref()
  85. const materialObject = ref({
  86. id: '',
  87. num: 0 // 更改应备数
  88. })
  89. const inputDialog = ref()
  90. const queryParams = ref({
  91. pageSize: 10,
  92. pageNo: 1,
  93. wmsSyntheticalSendDetailId: ''
  94. })
  95. const cardList = ref([])
  96. onMounted(() => {
  97. search()
  98. })
  99. onBeforeMount(() => {
  100. detailId.value = JSON.parse(parentRow)?.id
  101. })
  102. const search = function() {
  103. uni.$reqGet('getSyntheticalSendResourcePage', {
  104. ...queryParams.value,
  105. wmsSyntheticalSendDetailId: detailId.value
  106. })
  107. .then(({
  108. data
  109. }) => {
  110. cardList.value = data?.list
  111. })
  112. }
  113. const goBack = function() {
  114. uni.removeStorageSync('mixMaterialDetail')
  115. uni.$goBack('/pages/workbranch/warehouse/production/scanMixMaterials')
  116. }
  117. const handleShowResetMaterialNumDialog = function(ret) {
  118. materialObject.value.id = ret?.id
  119. materialObject.value.num = ret?.nowSendQty
  120. inputDialog.value.open()
  121. }
  122. const handleResetMaterialNum = function(ret) {
  123. if (![NaN, undefined, null, ''].includes(Number(ret))) {
  124. uni.$reqPut('updateSyntheticalSendResource', {
  125. id: materialObject.value.id,
  126. nowSendQty: ret
  127. })
  128. .then(({
  129. code,
  130. data,
  131. msg
  132. }) => {
  133. if (code === 0) {
  134. uni.showToast({
  135. title: '更新成功',
  136. duration: 2000,
  137. icon: 'none'
  138. })
  139. queryParams.value.pageNo = 1
  140. search()
  141. } else {
  142. uni.showToast({
  143. title: msg,
  144. duration: 2000,
  145. icon: 'none'
  146. })
  147. }
  148. })
  149. }
  150. }
  151. // uniapp移动端触底事件
  152. onReachBottom(() => {
  153. queryParams.value.pageNo += 1
  154. uni.$reqGet('getSyntheticalSendResourcePage', {
  155. ...queryParams.value,
  156. wmsSyntheticalSendDetailId: detailId.value
  157. })
  158. .then(({
  159. data
  160. }) => {
  161. Array.prototype.push.call(cardList.value, ...data?.list ?? [])
  162. })
  163. })
  164. return {
  165. goBack,
  166. cardList,
  167. search,
  168. queryParams,
  169. parentRow,
  170. inputDialog,
  171. materialObject,
  172. handleResetMaterialNum,
  173. handleShowResetMaterialNumDialog
  174. }
  175. }
  176. })
  177. </script>
  178. <style lang="scss" scoped>
  179. .gui-header-leader-btns {
  180. color: black;
  181. font-size: 24px !important;
  182. margin-left: 24rpx;
  183. }
  184. .list-content {
  185. margin-top: 80px;
  186. background-color: #edeeee;
  187. }
  188. .card-list-flexbox {
  189. display: flex;
  190. flex-direction: row;
  191. align-items: center;
  192. flex-wrap: wrap;
  193. margin: 3px 2px;
  194. .card-list-item {
  195. width: 750rpx;
  196. min-height: 40px;
  197. margin: 2rpx 0;
  198. display: flex;
  199. flex-direction: row;
  200. align-items: center;
  201. justify-content: space-between;
  202. background-color: #fff;
  203. uni-text {
  204. font-size: 14px;
  205. min-height: 40px;
  206. text-align: left;
  207. padding: 0 12px;
  208. display: flex;
  209. flex-direction: row;
  210. align-items: center;
  211. }
  212. .text-1 {
  213. flex: 1;
  214. min-height: 40px;
  215. justify-content: flex-start;
  216. }
  217. .text-2 {
  218. flex: 3;
  219. min-height: 40px;
  220. justify-content: flex-end;
  221. margin-right: 4px;
  222. padding: 2px 6px;
  223. }
  224. }
  225. .card-list-item:nth-of-type(1) {
  226. .text-1 {
  227. flex: 9;
  228. font-weight: bold;
  229. color: black !important;
  230. }
  231. .text-2 {
  232. flex: 4;
  233. display: flex;
  234. flex-direction: row;
  235. justify-content: flex-end;
  236. align-items: center;
  237. color: limegreen !important;
  238. }
  239. }
  240. }
  241. .font-icons {
  242. width: 40px;
  243. font-size: 20px;
  244. }
  245. .table-title {
  246. height: 40px;
  247. line-height: 40px;
  248. margin: 0 0 4px 0;
  249. padding: 0 12px;
  250. font-size: 16px;
  251. font-weight: bold;
  252. background-color: white;
  253. }
  254. </style>