index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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.$on('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. setTimeout(function(){
  103. uni.hideLoading();
  104. },2000)
  105. getListByUserEquipment(data).then((res) => {
  106. console.log(data)
  107. if (res.code === 200) {
  108. listData.value = res.rows;
  109. } else if (res.code === 401) {
  110. uni.showToast({
  111. icon: 'none',
  112. title: '未登录或登录状态已超时',
  113. duration: 1500
  114. })
  115. } else if (res.code === 500) {
  116. uni.showToast({
  117. icon: 'none',
  118. title: '系统错误,请联系管理员',
  119. duration: 1500
  120. })
  121. } else {
  122. uni.showToast({
  123. icon: 'none',
  124. title: res.msg,
  125. duration: 1500
  126. })
  127. }
  128. })
  129. }
  130. function handleToBatchReporting(item) {
  131. store.planSubDetails = item
  132. uni.navigateTo({
  133. url: '/pages/batchReporting/index'
  134. })
  135. }
  136. function handleSearch() {
  137. let reqParam = {
  138. keywords: keywords.value
  139. }
  140. if (!store.tenantId) {
  141. reqParam = {
  142. tenantId: store.userInfo.tenantId
  143. }
  144. }else {
  145. reqParam = {
  146. tenantId: store.tenantId
  147. }
  148. }
  149. init(reqParam)
  150. }
  151. </script>
  152. <style lang="scss">
  153. $nav-height: 60rpx;
  154. .box-bg {
  155. width: 100%;
  156. background-color: #F5F5F5;
  157. padding: 5rpx 0;
  158. justify-content: space-around;
  159. align-items: center;
  160. .input-view {
  161. width: 100%;
  162. flex: 4;
  163. background-color: #f8f8f8;
  164. height: $nav-height;
  165. border: 1rpx solid #999;
  166. border-radius: 15rpx;
  167. padding: 0 15rpx;
  168. flex-wrap: nowrap;
  169. margin: 20rpx 10rpx;
  170. line-height: $nav-height;
  171. .input-uni-icon {
  172. line-height: $nav-height;
  173. }
  174. .nav-bar-input {
  175. width: 80%;
  176. height: $nav-height;
  177. line-height: $nav-height;
  178. padding: 0 5rpx;
  179. background-color: #f8f8f8;
  180. }
  181. }
  182. .search {
  183. width: 20%;
  184. text-align: center;
  185. color: #808080;
  186. }
  187. }
  188. .uni-column {
  189. background-color: rgba(245, 245, 245, 1);
  190. height: 100%;
  191. overflow: auto;
  192. }
  193. .list-item {
  194. background-color: #fff;
  195. position: relative;
  196. padding: 16rpx;
  197. padding-bottom: 24rpx;
  198. border-radius: 24rpx;
  199. margin-bottom: 24rpx;
  200. .title-container {
  201. justify-content: space-between;
  202. margin-top: 8rpx;
  203. margin-bottom: 16rpx;
  204. .title {
  205. height: 48rpx;
  206. align-items: center;
  207. .label {
  208. font-size: 32rpx;
  209. font-weight: bold;
  210. &.code {
  211. margin-left: 8rpx;
  212. }
  213. }
  214. }
  215. .tag {
  216. border: 1px solid #1ce5b0;
  217. background-color: #f6fffd;
  218. padding: 8rpx;
  219. border-radius: 8rpx;
  220. .label {
  221. color: #1ce5b0;
  222. font-size: 24rpx;
  223. }
  224. &.not-start {
  225. border: 1px solid #bbbbbb;
  226. background-color: #f5f5f5;
  227. .label {
  228. color: #bbbbbb;
  229. }
  230. }
  231. }
  232. }
  233. .item-info {
  234. margin-bottom: 8rpx;
  235. .label {
  236. font-size: 28rpx;
  237. width: 220rpx;
  238. color: #808080;
  239. &.right {
  240. flex: 1;
  241. color: #000000;
  242. }
  243. }
  244. }
  245. }
  246. </style>