index.vue 7.6 KB

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