index.vue 5.3 KB

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