index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="search-container uni-row">
  4. <input type="text" v-model="keywords" placeholder="请输入关键字" />
  5. <view class="btn uni-row" @click="getList">搜索</view>
  6. <!-- <uni-icons type="scan" size="24" /> -->
  7. </view>
  8. <view class="scan-btn uni-row" style="min-height: 80rpx;" @click.stop="handleAddProcessInspection">新增序检</view>
  9. <view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
  10. @click="handleSelection(item)">
  11. <view class="lot-code uni-row">
  12. <text>批次号:{{ item.lotCode }}</text>
  13. <text :style="selectType(item)">{{ selectText(item) }}</text>
  14. <uni-icons type="right" size="16" />
  15. </view>
  16. <view class="info">
  17. <view class="info-row uni-row">
  18. <view class="label">序检箱号:</view>
  19. <view class="value">{{ item.carrierCode }}</view>
  20. <view class="label">检察员:</view>
  21. <view class="value">{{ item.nickName }}</view>
  22. </view>
  23. <view class="info-row uni-row">
  24. <view class="label">检查数量:</view>
  25. <view class="value">{{ item.examiningNum }}</view>
  26. <view class="label">不合格数:</view>
  27. <view class="value">{{ item.rejectNum }}</view>
  28. </view>
  29. <view class="info-row uni-row">
  30. <view class="label">产品描述:</view>
  31. <view class="value">{{ item.productDescription }}</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script setup>
  38. import {
  39. ref
  40. } from 'vue'
  41. import {
  42. getProcessInspecionList,
  43. getLotInfo
  44. } from '@/api/business/processInspection.js'
  45. import {
  46. onLoad,
  47. onReady,
  48. onUnload,
  49. onShow
  50. } from '@dcloudio/uni-app'
  51. import {
  52. store
  53. } from '@/store/index.js'
  54. const keywords = ref('')
  55. const inspecionList = ref([])
  56. const range = [{
  57. value: 0,
  58. text: "待确认",
  59. type: "color: #fcab53"
  60. }, {
  61. value: 1,
  62. text: "合格",
  63. type: "color: #55ff7f"
  64. }, {
  65. value: 2,
  66. text: "不合格",
  67. type: "color: #ff0c2c"
  68. }]
  69. const quer = ref({}) //用于查询
  70. /***************************** 页面生命周期函数 *****************************/
  71. onShow(() => {
  72. uni.showLoading({
  73. title: '加载中'
  74. });
  75. console.log("store", store.userInfo);
  76. quer.value.userId = store.userInfo.userId;
  77. getProcessInspecionList(quer.value).then(res => {
  78. console.log("res", res);
  79. if (res.code == 200) {
  80. inspecionList.value = res.rows;
  81. uni.hideLoading();
  82. }
  83. });
  84. })
  85. /***************************** 定义了一些方法 *****************************/
  86. function getList() {
  87. uni.showLoading({
  88. title: '加载中'
  89. });
  90. quer.value.keyword = keywords.value
  91. getProcessInspecionList(quer.value).then(res => {
  92. console.log("res", res);
  93. if (res.code == 200) {
  94. inspecionList.value = res.rows;
  95. uni.hideLoading();
  96. }
  97. });
  98. }
  99. //查看序捡详情
  100. function handleSelection(item) {
  101. store.processInspection = item;
  102. uni.navigateTo({
  103. url: '/pages/processInspection/form'
  104. })
  105. }
  106. //状态文本
  107. function selectText(item) {
  108. for (var i = 0; i < range.length; i++) {
  109. if (item.status == range[i].value) {
  110. return range[i].text
  111. }
  112. }
  113. }
  114. //状态样式
  115. function selectType(item) {
  116. for (var i = 0; i < range.length; i++) {
  117. if (item.status == range[i].value) {
  118. return range[i].type
  119. }
  120. }
  121. }
  122. const addProcessInspection = (data) => {
  123. const info = {
  124. title: data.title,
  125. standard: data.standard,
  126. result: '',
  127. number: 1
  128. }
  129. unfitInfos.value.push(info)
  130. }
  131. /***************************** 定义了一些事件 *****************************/
  132. // 新增序检
  133. const handleAddProcessInspection = () => {
  134. uni.navigateTo({
  135. url: '/pages/processInspection/scan'
  136. })
  137. }
  138. // 添加不合格信息
  139. const handleShowUnfit = () => {
  140. uni.navigateTo({
  141. url: '/pages/processInspection/form'
  142. })
  143. }
  144. </script>
  145. <style lang="scss">
  146. .page-container {
  147. height: 100%;
  148. background-color: #ececec;
  149. font-size: 28rpx;
  150. padding: 24rpx;
  151. box-sizing: border-box;
  152. }
  153. .search-container {
  154. border-radius: 12rpx;
  155. align-items: center;
  156. input {
  157. flex: 1;
  158. background-color: #ffffff;
  159. height: 64rpx;
  160. box-sizing: border-box;
  161. padding: 0 16rpx;
  162. }
  163. .btn {
  164. width: 120rpx;
  165. height: 64rpx;
  166. background-color: #1684FC;
  167. justify-content: center;
  168. font-size: 24rpx;
  169. color: #ffffff;
  170. justify-content: center;
  171. align-items: center;
  172. }
  173. }
  174. .scan-btn {
  175. height: 64rpx;
  176. margin: 32rpx 32rpx 0 32rpx;
  177. color: #ffffff;
  178. background-color: #f47c3c;
  179. align-items: center;
  180. justify-content: center;
  181. border-radius: 8rpx;
  182. }
  183. .daywork-item {
  184. padding: 24rpx;
  185. background-color: #ffffff;
  186. margin-top: 24rpx;
  187. border-radius: 8rpx;
  188. .lot-code {
  189. align-items: center;
  190. justify-content: space-between;
  191. font-weight: 700;
  192. }
  193. .info {
  194. font-size: 24rpx;
  195. color: #767676;
  196. .info-row {
  197. margin-top: 16rpx;
  198. .label {
  199. width: 120rpx;
  200. }
  201. .value {
  202. flex: 1;
  203. }
  204. }
  205. }
  206. }
  207. </style>