index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="uni-column" style="padding: 24rpx">
  3. <view class="box-bg uni-row">
  4. <view class="input-view uni-row">
  5. <uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
  6. <input class="nav-bar-input" type="text" v-model="keywords" placeholder="输入搜索关键词" />
  7. </view>
  8. <view class="search" @click="handleSearch">
  9. 搜索
  10. </view>
  11. </view>
  12. <view v-for="(item, index) in listData" :key="index" @click="handleToBatchReporting(item)" class="list-item">
  13. <view class="title-container uni-row">
  14. <view class="title uni-row">
  15. <text class="label">生产计划单号</text>
  16. <text class="label code">{{ item['productionPlanNo'] }}</text>
  17. </view>
  18. <view v-if="item['dayWorkList'].length > 0" class="tag"><text class="label">进行中</text></view>
  19. <view v-else type="default" class="tag not-start"><text class="label">未开始</text></view>
  20. </view>
  21. <view class="item-info uni-row">
  22. <text class="label">产品描述</text>
  23. <text class="label right">{{ item['productDescription'] }}</text>
  24. </view>
  25. <view class="item-info uni-row">
  26. <text class="label">总批数</text>
  27. <text class="label right">{{ item['lotNumber'] }}</text>
  28. </view>
  29. <view class="item-info uni-row">
  30. <text class="label">完成批数</text>
  31. <text class="label right">{{ item['equiment'] }}</text>
  32. </view>
  33. <view class="item-info uni-row">
  34. <text class="label">投产数</text>
  35. <text class="label right">{{ item['productionQuantity'] }}</text>
  36. </view>
  37. <view class="item-info uni-row">
  38. <text class="label">设备</text>
  39. <text class="label right">{{ item['equipmentName'] }}</text>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script setup>
  45. import {
  46. getListByUserEquipment
  47. } from '@/api/business/subPlanDetails'
  48. import {
  49. ref
  50. } from 'vue'
  51. import {
  52. onReady,
  53. onLoad,
  54. onUnload,
  55. onPullDownRefresh
  56. } from '@dcloudio/uni-app'
  57. import {
  58. getToken
  59. } from '@/utils/auth'
  60. import {
  61. store
  62. } from '@/store/index.js'
  63. const listData = ref([])
  64. const keywords = ref('')
  65. const initReqParam = ref({})
  66. onLoad(() => {
  67. if (!store.tenantId) {
  68. initReqParam.value = {
  69. tenantId: store.userInfo.tenantId
  70. }
  71. } else {
  72. initReqParam.value = {
  73. tenantId: store.tenantId
  74. }
  75. }
  76. init(initReqParam.value);
  77. // dayworkItem数据更改后刷新数据
  78. uni.$on('dayworkItemUpdate', reflush);
  79. })
  80. onUnload(() => {
  81. uni.$off('dayworkItemUpdate', reflush)
  82. })
  83. /**
  84. * 监听下拉刷新
  85. */
  86. onPullDownRefresh(() => {
  87. init(initReqParam.value);
  88. setTimeout(function() {
  89. uni.stopPullDownRefresh();
  90. }, 3000);
  91. })
  92. function reflush() {
  93. init(initReqParam.value);
  94. }
  95. function init(data = {}) {
  96. uni.showLoading({
  97. title: '加载中'
  98. });
  99. getListByUserEquipment(data).then((res) => {
  100. console.log(data)
  101. if (res.code === 200) {
  102. listData.value = res.rows;
  103. uni.hideLoading();
  104. } else if (res.code === 401) {
  105. uni.showToast({
  106. icon: 'none',
  107. title: '未登录或登录状态已超时',
  108. duration: 1500
  109. })
  110. uni.hideLoading();
  111. } else if (res.code === 500) {
  112. uni.showToast({
  113. icon: 'none',
  114. title: '系统错误,请联系管理员',
  115. duration: 1500
  116. })
  117. uni.hideLoading();
  118. } else {
  119. uni.showToast({
  120. icon: 'none',
  121. title: res.msg,
  122. duration: 1500
  123. })
  124. uni.hideLoading();
  125. }
  126. })
  127. }
  128. function handleToBatchReporting(item) {
  129. store.planSubDetails = item
  130. uni.navigateTo({
  131. url: '/pages/batchReporting/index'
  132. })
  133. }
  134. function handleSearch() {
  135. let reqParam = {
  136. keywords: keywords.value
  137. }
  138. reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
  139. init(reqParam)
  140. }
  141. </script>
  142. <style lang="scss">
  143. $nav-height: 60rpx;
  144. .box-bg {
  145. width: 100%;
  146. background-color: #F5F5F5;
  147. padding: 5rpx 0;
  148. justify-content: space-around;
  149. align-items: center;
  150. .input-view {
  151. width: 100%;
  152. flex: 4;
  153. background-color: #f8f8f8;
  154. height: $nav-height;
  155. border: 1rpx solid #999;
  156. border-radius: 15rpx;
  157. padding: 0 15rpx;
  158. flex-wrap: nowrap;
  159. margin: 20rpx 10rpx;
  160. line-height: $nav-height;
  161. .input-uni-icon {
  162. line-height: $nav-height;
  163. }
  164. .nav-bar-input {
  165. width: 80%;
  166. height: $nav-height;
  167. line-height: $nav-height;
  168. padding: 0 5rpx;
  169. background-color: #f8f8f8;
  170. }
  171. }
  172. .search {
  173. width: 20%;
  174. text-align: center;
  175. color: #808080;
  176. }
  177. }
  178. .uni-column {
  179. background-color: rgba(245, 245, 245, 1);
  180. height: 100%;
  181. overflow: auto;
  182. }
  183. .list-item {
  184. background-color: #fff;
  185. position: relative;
  186. padding: 16rpx;
  187. padding-bottom: 24rpx;
  188. border-radius: 24rpx;
  189. margin-bottom: 24rpx;
  190. .title-container {
  191. justify-content: space-between;
  192. margin-top: 8rpx;
  193. margin-bottom: 16rpx;
  194. .title {
  195. height: 48rpx;
  196. align-items: center;
  197. .label {
  198. font-size: 32rpx;
  199. font-weight: bold;
  200. &.code {
  201. margin-left: 8rpx;
  202. }
  203. }
  204. }
  205. .tag {
  206. border: 1px solid #1ce5b0;
  207. background-color: #f6fffd;
  208. padding: 8rpx;
  209. border-radius: 8rpx;
  210. .label {
  211. color: #1ce5b0;
  212. font-size: 24rpx;
  213. }
  214. &.not-start {
  215. border: 1px solid #bbbbbb;
  216. background-color: #f5f5f5;
  217. .label {
  218. color: #bbbbbb;
  219. }
  220. }
  221. }
  222. }
  223. .item-info {
  224. margin-bottom: 8rpx;
  225. .label {
  226. font-size: 28rpx;
  227. width: 220rpx;
  228. color: #808080;
  229. &.right {
  230. flex: 1;
  231. color: #000000;
  232. }
  233. }
  234. }
  235. }
  236. </style>