productionIssue.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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="goHome"
  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. style="font-size: 14px;"
  15. >生产发料</text>
  16. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  17. <!-- 实际宽度请根据自己情况设置 -->
  18. <view style="width:40px;" />
  19. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  20. </view>
  21. </template>
  22. <template #gBody>
  23. <view class="list-content">
  24. <view v-if="cardList.length > 0" class="list-panel">
  25. <view v-for="(item, key) in cardList" :key="key" class="panel">
  26. <div class="panel-row">
  27. <span>{{ item.productCode }}</span>
  28. </div>
  29. <div class="panel-row">
  30. <span>产品名称</span>
  31. <span>{{ item.productName }}</span>
  32. </div>
  33. <div class="panel-row">
  34. <span>领料单号</span>
  35. <span>{{ item.workOrderBomNo }}</span>
  36. </div>
  37. <div class="panel-row">
  38. <span>计划数量</span>
  39. <span>{{ item.productAmount * 1 }}</span>
  40. </div>
  41. <div class="panel-row">
  42. <span>生产订单</span>
  43. <span>{{ item.workOrderNo }}</span>
  44. </div>
  45. <div class="panel-row">
  46. <span>发料状态</span>
  47. <span>{{ stateComputed(item.sendStatus) }}</span>
  48. </div>
  49. <view class="panel-row-operation">
  50. <text class="tag-limegreen" @click="handleNavigateTo('发料记录', item.id)">发料记录</text>
  51. <text class="tag-skyblue" @click="handleNavigateTo('需求明细', item.id)">需求明细</text>
  52. </view>
  53. </view>
  54. </view>
  55. <view v-else>
  56. <view class="bg-image">
  57. <image src="@/static/empty.png" mode="heightFix" />
  58. <text>这里什么都没有...</text>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. </gui-page>
  64. </template>
  65. <script>
  66. import {
  67. onReachBottom
  68. } from '@dcloudio/uni-app'
  69. import {
  70. ref,
  71. defineComponent,
  72. computed
  73. } from 'vue'
  74. export default defineComponent({
  75. setup() {
  76. const queryParams = ref({
  77. pageSize: 10,
  78. pageNo: 1
  79. })
  80. const stateToText = ref('')
  81. const stateComputed = computed(() => {
  82. return (state) => {
  83. switch (state) {
  84. case 0:
  85. stateToText.value = '待发料'
  86. break
  87. case 1:
  88. stateToText.value = '已发料-部分'
  89. break
  90. case 2:
  91. stateToText.value = '已发料-全部'
  92. break
  93. case 3:
  94. stateToText.value = '发料成功-部分'
  95. break
  96. case 4:
  97. stateToText.value = '发料成功-全部'
  98. break
  99. }
  100. return stateToText.value
  101. }
  102. })
  103. const cardList = ref([])
  104. // 生产发料主列表
  105. uni.$reqGet('productionIssueList')
  106. .then(({
  107. data
  108. }) => {
  109. cardList.value = data.list ?? []
  110. })
  111. // uniapp移动端触底事件
  112. onReachBottom(() => {
  113. queryParams.value.pageNo += 1
  114. // 生产发料主列表
  115. uni.$reqGet('productionIssueList', queryParams.value)
  116. .then(({
  117. data
  118. }) => {
  119. Array.prototype.push.call(cardList.value, ...data?.list ?? [])
  120. })
  121. })
  122. const goHome = function() {
  123. uni.$goHome()
  124. }
  125. const handleNavigateTo = function(name, id) {
  126. switch (name) {
  127. case '发料记录':
  128. uni.navigateTo({
  129. url: `/pages/workbranch/warehouse/productionIssue/issueRecord?issueId=${id}`
  130. })
  131. break
  132. case '需求明细':
  133. uni.navigateTo({
  134. url: `/pages/workbranch/warehouse/productionIssue/demandDetails?issueId=${id}`
  135. })
  136. break
  137. }
  138. }
  139. return {
  140. goHome,
  141. cardList,
  142. stateComputed,
  143. handleNavigateTo
  144. }
  145. }
  146. })
  147. </script>
  148. <style lang="scss" scoped>
  149. .gui-header-leader-btns {
  150. color: black;
  151. font-size: 24px !important;
  152. margin-left: 24rpx;
  153. }
  154. span, text {
  155. font-size: 12px;
  156. }
  157. .list-content {
  158. margin-top: 80px;
  159. background-color: #edeeee;
  160. }
  161. .tag-limegreen,
  162. .tag-skyblue {
  163. padding: 0 8px;
  164. margin: 4px;
  165. border-radius: 5px;
  166. font-size: 12px;
  167. color: white;
  168. }
  169. .tag-limegreen {
  170. background-color: #2fb657;
  171. }
  172. .tag-skyblue {
  173. background-color: #00a0e9;
  174. }
  175. </style>