index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. import { getUserProcess } from '@/api/process/process.js'
  64. const listData = ref([])
  65. const keywords = ref('')
  66. const initReqParam = ref({})
  67. onLoad(() => {
  68. if (!store.tenantId) {
  69. initReqParam.value = {
  70. tenantId: store.userInfo.tenantId
  71. }
  72. } else {
  73. initReqParam.value = {
  74. tenantId: store.tenantId
  75. }
  76. }
  77. init(initReqParam.value);
  78. // dayworkItem数据更改后刷新数据
  79. uni.$on('dayworkItemUpdate', reflush);
  80. })
  81. onUnload(() => {
  82. // uni.$off('dayworkItemUpdate', reflush)
  83. })
  84. /**
  85. * 监听下拉刷新
  86. */
  87. onPullDownRefresh(() => {
  88. init(initReqParam.value);
  89. setTimeout(function() {
  90. uni.stopPullDownRefresh();
  91. }, 3000);
  92. })
  93. function reflush() {
  94. init(initReqParam.value);
  95. }
  96. function init(data) {
  97. uni.showLoading({
  98. title: '加载中'
  99. });
  100. // 获取员工工序信息
  101. getUserProcess().then(res => {
  102. if(res.code == 200){
  103. store.userProcessInfo = res.data;
  104. console.log(res)
  105. console.log(store.userProcessInfo)
  106. }else{
  107. uni.showToast({
  108. icon: "error",
  109. title: res.msg,
  110. duration: 1000
  111. })
  112. }
  113. })
  114. getListByUserEquipment(data).then((res) => {
  115. console.log(data)
  116. if (res.code === 200) {
  117. listData.value = res.data;
  118. uni.hideLoading();
  119. } else if (res.code === 401) {
  120. uni.showToast({
  121. icon: "error",
  122. title: res.msg,
  123. duration: 1500
  124. })
  125. uni.hideLoading();
  126. } else if (res.code === 500) {
  127. uni.showToast({
  128. icon: 'error',
  129. title: res.msg,
  130. duration: 1500
  131. })
  132. uni.hideLoading();
  133. } else {
  134. uni.showToast({
  135. icon: 'none',
  136. title: res.msg,
  137. duration: 1500
  138. })
  139. uni.hideLoading();
  140. }
  141. uni.hideLoading();
  142. })
  143. }
  144. function handleToBatchReporting(item) {
  145. store.planSubDetails = item
  146. uni.navigateTo({
  147. url: '/pages/batchReporting/index'
  148. })
  149. }
  150. function handleSearch() {
  151. let reqParam = {
  152. keywords: keywords.value
  153. }
  154. reqParam.tenantId = !store.tenantId ? store.userInfo.tenantId : store.tenantId;
  155. init(reqParam)
  156. }
  157. </script>
  158. <style lang="scss">
  159. $nav-height: 60rpx;
  160. .box-bg {
  161. width: 100%;
  162. background-color: #F5F5F5;
  163. padding: 5rpx 0;
  164. justify-content: space-around;
  165. align-items: center;
  166. .input-view {
  167. width: 100%;
  168. flex: 4;
  169. background-color: #f8f8f8;
  170. height: $nav-height;
  171. border: 1rpx solid #999;
  172. border-radius: 15rpx;
  173. padding: 0 15rpx;
  174. flex-wrap: nowrap;
  175. margin: 20rpx 10rpx;
  176. line-height: $nav-height;
  177. .input-uni-icon {
  178. line-height: $nav-height;
  179. }
  180. .nav-bar-input {
  181. width: 80%;
  182. height: $nav-height;
  183. line-height: $nav-height;
  184. padding: 0 5rpx;
  185. background-color: #f8f8f8;
  186. }
  187. }
  188. .search {
  189. width: 20%;
  190. text-align: center;
  191. color: #808080;
  192. }
  193. }
  194. .uni-column {
  195. background-color: rgba(245, 245, 245, 1);
  196. height: 100%;
  197. overflow: auto;
  198. }
  199. .list-item {
  200. background-color: #fff;
  201. position: relative;
  202. padding: 16rpx;
  203. padding-bottom: 24rpx;
  204. border-radius: 24rpx;
  205. margin-bottom: 24rpx;
  206. .title-container {
  207. justify-content: space-between;
  208. margin-top: 8rpx;
  209. margin-bottom: 16rpx;
  210. .title {
  211. height: 48rpx;
  212. align-items: center;
  213. .label {
  214. font-size: 32rpx;
  215. font-weight: bold;
  216. &.code {
  217. margin-left: 8rpx;
  218. }
  219. }
  220. }
  221. .tag {
  222. border: 1px solid #1ce5b0;
  223. background-color: #f6fffd;
  224. padding: 8rpx;
  225. border-radius: 8rpx;
  226. .label {
  227. color: #1ce5b0;
  228. font-size: 24rpx;
  229. }
  230. &.not-start {
  231. border: 1px solid #bbbbbb;
  232. background-color: #f5f5f5;
  233. .label {
  234. color: #bbbbbb;
  235. }
  236. }
  237. }
  238. }
  239. .item-info {
  240. margin-bottom: 8rpx;
  241. .label {
  242. font-size: 28rpx;
  243. width: 220rpx;
  244. color: #808080;
  245. &.right {
  246. flex: 1;
  247. color: #000000;
  248. }
  249. }
  250. }
  251. }
  252. </style>