index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="search-container uni-row">
  4. <input type="text" v-model="quer.keyword" placeholder="请输入关键字" />
  5. <view class="btn uni-row" @click="getList">搜索</view>
  6. <!-- <uni-icons type="scan" size="24" /> -->
  7. </view>
  8. <view class="time-controls" style="margin-top: 10rpx;">
  9. <uni-section title="检查日期:" type="square" class="uni-row sta">
  10. <input v-model="startTime" type="date" @input="timeSizer" />
  11. </uni-section>
  12. </view>
  13. <view class="daywork-item uni-column" v-for="(item, index) in inspecionList" :key="index"
  14. @click="handleSelection(item)">
  15. <view class="lot-code uni-row">
  16. <text>批次号:{{ item.lotCode }}</text>
  17. <text style="margin-left: 16rpx;color: #55ff7f;">{{ item.inspectionType }}</text>
  18. <text :style="selectType(item)">{{ selectText(item) }}</text>
  19. <text class="fa fa-trash" style="font-size: 16; color: white;"></text>
  20. </view>
  21. <view class="info">
  22. <view class="info-row uni-row">
  23. <view class="label">检查箱号:</view>
  24. <view class="value">{{ item.carrierCode }}</view>
  25. <view class="label">检察员:</view>
  26. <view class="value">{{ item.technicianName }}</view>
  27. </view>
  28. <view class="info-row uni-row">
  29. <view class="label">检查数量:</view>
  30. <view class="value">{{ item.examiningNum }}</view>
  31. <view class="label">不良品量:</view>
  32. <view class="value">{{ item.disqualificationNum }}</view>
  33. </view>
  34. <view class="info-row uni-row">
  35. <view class="label">产品描述:</view>
  36. <view class="value">{{ item.productDescription }}</view>
  37. </view>
  38. <view class="info-row uni-row">
  39. <view class="label">检测载具:</view>
  40. <view class="value">{{ item.inspectionCarrierCode }}</view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </template>
  46. <script setup>
  47. import {
  48. ref
  49. } from 'vue'
  50. import {
  51. getProcessInspecionList,
  52. updateAdoptStatus
  53. } from '@/api/business/processInspection.js'
  54. import {
  55. timestampToTime,
  56. toHHmmss
  57. } from '@/utils/common.js'
  58. import {
  59. onLoad,
  60. onReady,
  61. onUnload,
  62. onShow
  63. } from '@dcloudio/uni-app'
  64. import {
  65. store
  66. } from '@/store/index.js'
  67. const keyword = ref('')
  68. const inspecionList = ref([]); //时间后筛选数组
  69. const original = ref([]); //原始数组
  70. const startTime = ref(new Date().toISOString().split("T")[0])
  71. const range = [{
  72. value: 0,
  73. text: "待确认",
  74. type: "color: #fcab53"
  75. }, {
  76. value: 1,
  77. text: "合格",
  78. type: "color: #55ff7f"
  79. }, {
  80. value: 2,
  81. text: "不合格",
  82. type: "color: #ff0c2c"
  83. }]
  84. const quer = ref({}) //用于查询
  85. /***************************** 页面生命周期函数 *****************************/
  86. onShow(() => {
  87. getList()
  88. // uni.showLoading({
  89. // title: '加载中'
  90. // });
  91. // quer.value.userId = store.userInfo.userId;
  92. // quer.value.startTime = startTime.value;
  93. // getProcessInspecionList(quer.value).then(res => {
  94. // console.log("res", res);
  95. // if (res.code == 200) {
  96. // original.value = res.rows;
  97. // // timeSizer();
  98. // uni.hideLoading();
  99. // // uni.hideLoading();
  100. // }
  101. // });
  102. })
  103. /***************************** 定义了一些方法 *****************************/
  104. function getList() {
  105. uni.showLoading({
  106. title: '加载中'
  107. });
  108. quer.value.startTime = startTime.value;
  109. quer.value.deptId = store.curDeptDetails.deptId
  110. quer.value.userId = store.userInfo.userId
  111. getProcessInspecionList(quer.value).then(res => {
  112. console.log("res", res);
  113. if (res.code == 200) {
  114. res.rows.forEach(v => {
  115. if (v.type === "deliveryInspection") {
  116. v.inspectionType = "交检"
  117. } else if (v.type === "firstArticleInspection") {
  118. v.inspectionType = "首件检"
  119. } else if (v.type === "patrolInspection") {
  120. v.inspectionType = "巡检"
  121. } else if (v.type === "outsourcedInspector") {
  122. v.inspectionType = "外协检"
  123. } else if (v.type === "factoryInspection") {
  124. v.inspectionType = "出厂检"
  125. } else {
  126. v.inspectionType = "仪器室"
  127. }
  128. });
  129. inspecionList.value = res.rows;
  130. uni.hideLoading();
  131. }
  132. });
  133. }
  134. //时间筛选,暂时注释,使用搜索向
  135. function timeSizer() {}
  136. // 筛选函数
  137. const filterSameDayItems = (inspectionList, startTime) => {
  138. // 使用filter方法筛选出与startTime同一天的元素
  139. const filteredList = inspectionList.filter(item => {
  140. // 将数组中每个元素的date属性转换为不包含时分秒的字符串
  141. const itemDateString = item.createTime.split(' ')[0];
  142. // 比较两个日期字符串是否相同
  143. return itemDateString === startTime;
  144. });
  145. return filteredList;
  146. };
  147. function isSameDate(date1, date2) {
  148. // 使用Date对象的toISOString()方法来格式化日期,并去除时分秒部分
  149. const formatDate = (date) => date.toISOString().split('T')[0];
  150. // 比较两个日期的年月日部分是否相同
  151. return formatDate(date1) === formatDate(date2);
  152. }
  153. //查看序捡详情
  154. function handleSelection(item) {
  155. store.processInspection = item;
  156. uni.navigateTo({
  157. url: '/pages/inspectionDetails/form'
  158. })
  159. }
  160. //状态文本
  161. function selectText(item) {
  162. for (var i = 0; i < range.length; i++) {
  163. if (item.status == range[i].value) {
  164. return range[i].text
  165. }
  166. }
  167. }
  168. //状态样式
  169. function selectType(item) {
  170. for (var i = 0; i < range.length; i++) {
  171. if (item.status == range[i].value) {
  172. return range[i].type
  173. }
  174. }
  175. }
  176. /***************************** 定义了一些事件 *****************************/
  177. </script>
  178. <style lang="scss">
  179. .time-controls {
  180. .title {
  181. margin: 20% auto 40% auto;
  182. .first {
  183. font-size: 48rpx;
  184. margin: 0 auto;
  185. }
  186. .second {
  187. color: red;
  188. font-size: 24rpx;
  189. margin: 10rpx auto 0 auto;
  190. }
  191. }
  192. .sta {
  193. justify-content: center;
  194. align-items: center;
  195. input {
  196. border: 1rpx solid gray;
  197. border-radius: 8rpx;
  198. width: 400rpx;
  199. height: 64rpx;
  200. }
  201. }
  202. button {
  203. width: 78%;
  204. background-color: #1684fc;
  205. color: white;
  206. margin: 0 auto;
  207. }
  208. }
  209. .page-container {
  210. height: 100%;
  211. background-color: #ececec;
  212. font-size: 28rpx;
  213. padding: 24rpx;
  214. box-sizing: border-box;
  215. }
  216. .search-container {
  217. border-radius: 12rpx;
  218. align-items: center;
  219. input {
  220. flex: 1;
  221. background-color: #ffffff;
  222. height: 64rpx;
  223. box-sizing: border-box;
  224. padding: 0 16rpx;
  225. }
  226. .btn {
  227. width: 120rpx;
  228. height: 64rpx;
  229. background-color: #1684FC;
  230. justify-content: center;
  231. font-size: 24rpx;
  232. color: #ffffff;
  233. justify-content: center;
  234. align-items: center;
  235. }
  236. }
  237. .scan-btn {
  238. height: 64rpx;
  239. margin: 32rpx 32rpx 0 32rpx;
  240. color: #ffffff;
  241. background-color: #f47c3c;
  242. align-items: center;
  243. justify-content: center;
  244. border-radius: 8rpx;
  245. }
  246. .daywork-item {
  247. padding: 24rpx;
  248. background-color: #ffffff;
  249. margin-top: 24rpx;
  250. border-radius: 8rpx;
  251. .lot-code {
  252. align-items: center;
  253. justify-content: space-between;
  254. font-weight: 700;
  255. }
  256. .info {
  257. font-size: 24rpx;
  258. color: #767676;
  259. .info-row {
  260. margin-top: 16rpx;
  261. .label {
  262. width: 120rpx;
  263. }
  264. .value {
  265. flex: 1;
  266. }
  267. .start-batch-btn {
  268. flex: 1;
  269. height: 80rpx;
  270. line-height: 80rpx;
  271. border-radius: 8rpx;
  272. color: #FFFFFF;
  273. font-size: 28rpx;
  274. }
  275. }
  276. }
  277. }
  278. </style>