index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. const initReqParam = ref({})
  73. onLoad(() => {
  74. if (!store.tenantId) {
  75. initReqParam.value = {
  76. tenantId: store.userInfo.tenantId
  77. }
  78. }else {
  79. initReqParam.value = {
  80. tenantId: store.tenantId
  81. }
  82. }
  83. init(initReqParam.value);
  84. // dayworkItem数据更改后刷新数据
  85. uni.$once('dayworkItemUpdate', () => {
  86. init(initReqParam.value);
  87. })
  88. })
  89. /**
  90. * 监听下拉刷新
  91. */
  92. onPullDownRefresh(() => {
  93. init(initReqParam.value);
  94. setTimeout(function() {
  95. uni.stopPullDownRefresh();
  96. }, 3000);
  97. })
  98. function init(data = {}) {
  99. uni.showLoading({
  100. title: '加载中'
  101. });
  102. getListByUserEquipment(data).then((res) => {
  103. console.log(data)
  104. if (res.code === 200) {
  105. listData.value = res.rows;
  106. uni.hideLoading()
  107. } else if (res.code === 401) {
  108. uni.showToast({
  109. icon: 'none',
  110. title: '未登录或登录状态已超时',
  111. duration: 1500
  112. })
  113. } else if (res.code === 500) {
  114. uni.showToast({
  115. icon: 'none',
  116. title: '系统错误,请联系管理员',
  117. duration: 1500
  118. })
  119. } else {
  120. uni.showToast({
  121. icon: 'none',
  122. title: res.msg,
  123. duration: 1500
  124. })
  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. if (!store.tenantId) {
  139. reqParam = {
  140. tenantId: store.userInfo.tenantId
  141. }
  142. }else {
  143. reqParam = {
  144. tenantId: store.tenantId
  145. }
  146. }
  147. init(reqParam)
  148. }
  149. </script>
  150. <style lang="scss">
  151. $nav-height: 60rpx;
  152. .box-bg {
  153. width: 100%;
  154. background-color: #F5F5F5;
  155. padding: 5rpx 0;
  156. justify-content: space-around;
  157. align-items: center;
  158. .input-view {
  159. width: 100%;
  160. flex: 4;
  161. background-color: #f8f8f8;
  162. height: $nav-height;
  163. border: 1rpx solid #999;
  164. border-radius: 15rpx;
  165. padding: 0 15rpx;
  166. flex-wrap: nowrap;
  167. margin: 20rpx 10rpx;
  168. line-height: $nav-height;
  169. .input-uni-icon {
  170. line-height: $nav-height;
  171. }
  172. .nav-bar-input {
  173. width: 80%;
  174. height: $nav-height;
  175. line-height: $nav-height;
  176. padding: 0 5rpx;
  177. background-color: #f8f8f8;
  178. }
  179. }
  180. .search {
  181. width: 20%;
  182. text-align: center;
  183. color: #808080;
  184. }
  185. }
  186. .uni-column {
  187. background-color: rgba(245, 245, 245, 1);
  188. height: 100%;
  189. overflow: auto;
  190. }
  191. .list-item {
  192. background-color: #fff;
  193. position: relative;
  194. padding: 16rpx;
  195. padding-bottom: 24rpx;
  196. border-radius: 24rpx;
  197. margin-bottom: 24rpx;
  198. .title-container {
  199. justify-content: space-between;
  200. margin-top: 8rpx;
  201. margin-bottom: 16rpx;
  202. .title {
  203. height: 48rpx;
  204. align-items: center;
  205. .label {
  206. font-size: 32rpx;
  207. font-weight: bold;
  208. &.code {
  209. margin-left: 8rpx;
  210. }
  211. }
  212. }
  213. .tag {
  214. border: 1px solid #1ce5b0;
  215. background-color: #f6fffd;
  216. padding: 8rpx;
  217. border-radius: 8rpx;
  218. .label {
  219. color: #1ce5b0;
  220. font-size: 24rpx;
  221. }
  222. &.not-start {
  223. border: 1px solid #bbbbbb;
  224. background-color: #f5f5f5;
  225. .label {
  226. color: #bbbbbb;
  227. }
  228. }
  229. }
  230. }
  231. .item-info {
  232. margin-bottom: 8rpx;
  233. .label {
  234. font-size: 28rpx;
  235. width: 220rpx;
  236. color: #808080;
  237. &.right {
  238. flex: 1;
  239. color: #000000;
  240. }
  241. }
  242. }
  243. }
  244. </style>