| <template> | 
|     <div class="content"> | 
|         <div :class="{ 'content_top': status }" class="content_search"> | 
|             <v-Search placeholder="搜索工单编号/物料编码" @searchInput="searchInput" @submit="submit" @reset="reset" :isShow="true"> | 
|                 <template v-slot:content> | 
|                     <div class="Search_item"> | 
|                         <div class="Search_item_label">检验日期</div> | 
|                         <div class="Search_item_content" @click="openDate"> | 
|                             <div class="Search_item_content_a" :style="pageData.checkStartDate ? 'color: #000;' : ''">{{ pageData.checkStartDate ? pageData.checkStartDate : '开始日期'}}</div> | 
|                             <span>-</span> | 
|                             <div class="Search_item_content_a" :style="pageData.checkEndDate ? 'color: #000;' : ''">{{ pageData.checkEndDate ? pageData.checkEndDate : '结束日期'}}</div> | 
|                         </div> | 
|                     </div> | 
|                     <div class="Search_item"> | 
|                         <div class="Search_item_label">检验类型</div> | 
|                         <div class="Search_item_content"> | 
|                             <div class="tag"> | 
|                                 <div class="tag_item" :class="{'tag_active': item.isActive}" v-for="(item, i) in data" :key="item.id" @click="changeTag(i)">{{item.name}}</div> | 
|                             </div> | 
|                         </div> | 
|                     </div> | 
|                     <div class="Search_item"> | 
|                         <div class="Search_item_label">检验工序</div> | 
|                         <div class="Search_item_content"> | 
|                             <div class="tag"> | 
|                                 <div class="tag_item" :class="{'tag_active': item.isActive}" v-for="(item, i) in workingProcedure" :key="item.id" @click="changeTag1(i)">{{item.name}}</div> | 
|                             </div> | 
|                         </div> | 
|                     </div> | 
|                     <div class="Search_item"> | 
|                         <div class="Search_item_label">批次号</div> | 
|                         <div class="Search_item_content"> | 
|                             <input type="text" placeholder="请输入批次号" v-model="pageData.batch" /> | 
|                         </div> | 
|                     </div> | 
|                 </template> | 
|             </v-Search> | 
|         </div> | 
|         <div class="content_total">共{{pageData.total}}条数据</div> | 
|         <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> | 
|             <van-list | 
|                 v-model:loading="loading" | 
|                 :finished="finished" | 
|                 finished-text="没有更多了~" | 
|                 @load="onLoad"> | 
|                 <div class="content_list"> | 
|                     <van-swipe-cell v-for="(item, i) in listData" :key="i"> | 
|                         <div class="content_list_item" @click="jumpDesc(item)"> | 
|                             <div class="content_list_item_title"> | 
|                                 <span>{{item.code}}</span> | 
|                                 <span class="warning" v-if="item.checkType === 0">巡线</span> | 
|                                 <span v-if="item.checkType === 1">巡检</span> | 
|                                 <span class="green" v-if="item.checkType === 2">完工检</span> | 
|                             </div> | 
|                             <div class="content_list_item_nr"> | 
|                                 <div class="content_list_item_nr_box"> | 
|                                     <div class="label">物料信息:</div> | 
|                                     <div class="cr" v-if="item.mmodel">{{item.mmodel.name}}丨{{item.mmodel.code}}</div> | 
|                                 </div> | 
|                                 <div class="content_list_item_nr_boxs"> | 
|                                     <div class="label">生产数量:</div> | 
|                                     <div class="cr" v-if="item.umodel">{{item.num}}{{item.umodel.name}}</div> | 
|                                 </div> | 
|                                 <div class="content_list_item_nr_box"> | 
|                                     <div class="label">生产批次:</div> | 
|                                     <div class="cr">{{item.batch}}</div> | 
|                                 </div> | 
|                                 <div class="content_list_item_nr_boxs"> | 
|                                     <div class="label">生产工序:</div> | 
|                                     <div class="cr" v-if="item.pmodel">{{item.pmodel.name}}</div> | 
|                                 </div> | 
|                                 <div class="content_list_item_nr_box"> | 
|                                     <div class="label">工单编号:</div> | 
|                                     <div class="cr">{{item.workorderCode}}</div> | 
|                                 </div> | 
|                                 <div class="content_list_item_nr_boxs"> | 
|                                     <div class="label">检验人员:</div> | 
|                                     <div class="cr">{{item.smodelRealName}}/{{item.checkUserDepartName}}</div> | 
|                                 </div> | 
|                                 <!-- <div class="content_list_item_nr_box"> | 
|                                     <div class="label">检验日期:</div> | 
|                                     <div class="cr">{{item.checkDate}}</div> | 
|                                 </div> --> | 
|                                 <!-- <div class="content_list_item_nr_boxs"> | 
|                                     <div class="label">工装码:</div> | 
|                                     <div class="cr" v-if="item.amodel">{{item.amodel.code}}</div> | 
|                                 </div> --> | 
|                                 <div class="content_list_item_nr_box"> | 
|                                     <div class="label">合格数量:</div> | 
|                                     <div class="cr" v-if="item.umodel">{{item.qualifiedNum}}{{item.umodel.name}}</div> | 
|                                 </div> | 
|                                 <div class="content_list_item_nr_boxs"> | 
|                                     <div class="label">不良数量:</div> | 
|                                     <div class="cr warning" v-if="item.umodel">{{item.unqualifiedNum}}{{item.umodel.name}}</div> | 
|                                 </div> | 
|                             </div> | 
|                         </div> | 
|                     </van-swipe-cell> | 
|                 </div> | 
|             </van-list> | 
|         </van-pull-refresh> | 
|         <!-- <div class="content_code" @click="openScanCode"> | 
|             <img src="@/assets/icon/btn_saoma@2x.png" alt="" /> | 
|         </div> --> | 
|         <van-calendar v-model:show="isOpenDate" :min-date="minDate" :max-date="maxDate" type="range" color="#4275FC" @confirm="onConfirm" /> | 
|         <v-ScanCode | 
|             :openCode="openCode" | 
|             :infos="['第一次扫码']" | 
|             @closePopup="closePopup" | 
|             @onDecode="onDecode"> | 
|         </v-ScanCode> | 
|     </div> | 
| </template> | 
|   | 
| <script setup lang="ts"> | 
|     import { reactive, ref, onMounted } from "vue" | 
|     import { useRouter, useRoute } from "vue-router" | 
|     import { useStore } from "vuex" | 
|     import { gsdate, judgmentPlatform } from '@/utils/utils' | 
|     import { page } from '@/apis/QualityAPI' | 
|     import { getWorkingProcedure, deletejy } from "@/apis/PlanningAPI" | 
|     import { model } from '@/interface' | 
|     import vSearch from '@/components/common/Search.vue' | 
|     import vLableSelection from '@/components/common/LabelSelection.vue' | 
|   | 
|     interface page extends model { | 
|         total: number, | 
|         checkStartDate: string, | 
|         checkEndDate: string, | 
|         minParam: any, | 
|         batch: string | number, | 
|         checkType: string, | 
|         procedureId: string, | 
|         workorderId: string | 
|     } | 
|   | 
|     const store = useStore() | 
|   | 
|     const route = useRoute() | 
|   | 
|     const router = useRouter() | 
|   | 
|     // 分页查询数据 | 
|     const pageData = reactive<page>({ | 
|         capacity: 10, | 
|         page: 0, | 
|         total: 0, | 
|         checkStartDate: '', | 
|         checkEndDate: '', | 
|         minParam: '', | 
|         batch: '', | 
|         checkType: '', | 
|         procedureId: '', | 
|         workorderId: route.query.id ? route.query.id as string : '' | 
|     }) | 
|   | 
|     const minDate: Date = new Date(2021, 0, 1) | 
|   | 
|     const maxDate: Date = new Date(new Date().getFullYear() + 1, 12, 30) | 
|   | 
|     let status = ref<boolean>(false)    // 根据平台是否需要设置top | 
|   | 
|     // 列表数据 | 
|     let listData: any = ref([]) | 
|   | 
|     const openCode = ref<boolean>(false) | 
|   | 
|     // 检验类型 | 
|     let data: any = reactive([ | 
|         { id: '0', name: '巡线', isActive: false }, | 
|         { id: '1', name: '巡检', isActive: false }, | 
|         { id: '2', name: '完工检', isActive: false } | 
|     ]) | 
|   | 
|     // 检验工序 | 
|     let workingProcedure: any = reactive([]) | 
|   | 
|     const isOpenDate = ref(false) | 
|   | 
|     const list: any = ref([]) | 
|     const loading = ref(false) | 
|     const finished = ref(false) | 
|     const refreshing = ref(false) | 
|   | 
|     // 删除检验记录 | 
|     const dele = (id: string | number): void => { | 
|         deletejy(id) | 
|             .then(res => { | 
|                 if (res.code === 200) { | 
|                     listData.value = [] | 
|                     pageData.page = 0 | 
|                     finished.value = false | 
|                     onLoad() | 
|                 } | 
|             }) | 
|     } | 
|   | 
|     // 重置 | 
|     const reset = () => { | 
|         pageData.checkStartDate = '' | 
|         pageData.checkEndDate = '' | 
|         pageData.minParam = '' | 
|         pageData.checkType = '' | 
|         pageData.procedureId = '' | 
|         pageData.batch = '' | 
|         pageData.page = 0 | 
|         listData.value = [] | 
|         finished.value = false | 
|         data.forEach((item: any) => { item.isActive = false }) | 
|         workingProcedure.forEach((item: any) => { item.isActive = false }) | 
|         onLoad() | 
|     } | 
|   | 
|     // 查询搜索 | 
|     const searchInput = (val: any) => { | 
|         pageData.minParam = val | 
|         pageData.page = 0 | 
|         listData.value = [] | 
|         finished.value = false | 
|         onLoad() | 
|     } | 
|   | 
|     // 搜索提交 | 
|     const submit = () => { | 
|         data.forEach((item: any) => { | 
|             if (item.isActive) { | 
|                 pageData.checkType = item.id | 
|             } | 
|         }) | 
|         workingProcedure.forEach((item: any) => { | 
|             if (item.isActive) { | 
|                 pageData.procedureId = item.id | 
|             } | 
|         }) | 
|         pageData.page = 0 | 
|         listData.value = [] | 
|         finished.value = false | 
|         onLoad() | 
|     } | 
|   | 
|     // 跳转详情 | 
|     const jumpDesc = (item: any) => { | 
|         router.push({ name: 'details', query: { id: item.id } }) | 
|     } | 
|   | 
|     // 打开日期选择组件 | 
|     const openDate = () => { | 
|         isOpenDate.value = true | 
|     } | 
|   | 
|     // 打开扫码组件 | 
|     const openScanCode = () => { | 
|         openCode.value = true | 
|     } | 
|   | 
|     // 关闭扫码组件 | 
|     const closePopup = (): void => { | 
|         openCode.value = false | 
|     } | 
|   | 
|     // 日期确认 | 
|     const onConfirm = (values: any) => { | 
|         const [start, end] = values | 
|         pageData.checkStartDate = gsdate(start) | 
|         pageData.checkEndDate = gsdate(end) | 
|         isOpenDate.value = false | 
|     } | 
|   | 
|     // 切换检类型 | 
|     const changeTag = (i: any): void => { | 
|         data.forEach((item: { isActive: boolean; }, index: any) => { | 
|             item.isActive = index === i; | 
|         }) | 
|     } | 
|   | 
|     // 切换检工序 | 
|     const changeTag1 = (i: any): void => { | 
|         workingProcedure.forEach((item: { isActive: boolean; }, index: any) => { | 
|             item.isActive = index === i; | 
|         }) | 
|     } | 
|   | 
|     // 获取扫码值 | 
|     const onDecode = (data: string[]): void => { | 
|         console.log(data) | 
|     } | 
|   | 
|     // 获取当前用户所分配的工序 | 
|     const getWorkingProcedures = async () => { | 
|         let res = await getWorkingProcedure({ | 
|             capacity: 100, | 
|             page: 1, | 
|             model: { | 
|                 userId: store.state.userInfo.id | 
|             } | 
|         }) | 
|         if (res.code === 200 && res.data.records.length !== 0) { | 
|             res.data.records.forEach((item: any, index: number) => { | 
|                 // if (index === 0) { | 
|                 //     workingProcedure.push({ id: item.id, name: item.name, isActive: true }) | 
|                 // } else { | 
|                     workingProcedure.push({ id: item.id, name: item.name, isActive: false }) | 
|                 // } | 
|             }) | 
|         } | 
|     } | 
|   | 
|     // 列表 | 
|     const onLoad = () => { | 
|         if (!finished.value) { | 
|             pageData.page = pageData.page + 1 | 
|             loading.value = true | 
|             page({ | 
|                 capacity: pageData.capacity, | 
|                 page: pageData.page, | 
|                 model: { | 
|                     minParam: pageData.minParam, | 
|                     checkStartDate: pageData.checkStartDate, | 
|                     checkEndDate: pageData.checkEndDate, | 
|                     checkType: pageData.checkType, | 
|                     procedureId: pageData.procedureId, | 
|                     workorderId: pageData.workorderId | 
|                 } | 
|             }).then(res => { | 
|                 if (refreshing.value) { | 
|                     listData.value = [] | 
|                     refreshing.value = false; | 
|                 } | 
|                 loading.value = false | 
|                 if (res.code === 200 && res.data.records && res.data.records.length !== 0) { | 
|                     pageData.total = res.data.total | 
|                     listData.value.push(...res.data.records) | 
|                 } else { | 
|                     finished.value = true | 
|                 } | 
|             }).catch(err => { | 
|                 loading.value = false | 
|                 finished.value = true | 
|                 if (refreshing.value) { | 
|                     listData.value = [] | 
|                     refreshing.value = false; | 
|                 } | 
|             }) | 
|         } | 
|     } | 
|   | 
|     // 下拉刷新优化页面 | 
|     const onRefresh = () => { | 
|         finished.value = false; | 
|         pageData.page = 0 | 
|         loading.value = true; | 
|         onLoad(); | 
|     } | 
|   | 
|     onMounted(() => { | 
|         status.value = judgmentPlatform() | 
|         getWorkingProcedures() | 
|     }) | 
| </script> | 
|   | 
| <style lang="scss" scoped> | 
|     .content { | 
|         width: 100%; | 
|         height: 100%; | 
|         position: absolute; | 
|         background: white; | 
|         .content_code { | 
|             position: fixed; | 
|             right: 30px; | 
|             bottom: 100px; | 
|             img { | 
|                 width: 138px; | 
|                 height: 138px; | 
|             } | 
|         } | 
|         .content_top { | 
|             top: 0 !important; | 
|         } | 
|         .content_search { | 
|             padding: 30px; | 
|             background: white; | 
|             position: sticky; | 
|             top: 88px; | 
|             z-index: 9; | 
|             .Search_item { | 
|                 margin-bottom: 40px; | 
|                 .Search_item_label { | 
|                     font-size: 30px; | 
|                     font-weight: 500; | 
|                     color: #222222; | 
|                 } | 
|                 .Search_item_content { | 
|                     display: flex; | 
|                     align-items: center; | 
|                     justify-content: space-between; | 
|                     margin-top: 30px; | 
|                     input { | 
|                         width: 100%; | 
|                         height: 70px; | 
|                         border-radius: 10px; | 
|                         padding: 0 20px; | 
|                         box-sizing: border-box; | 
|                         border: 1px solid #939393; | 
|                         color: black; | 
|                         font-size: 26px; | 
|                     } | 
|                     input::-webkit-input-placeholder { | 
|                         color: #999999; | 
|                         font-size: 26px; | 
|                     } | 
|                     input:-moz-placeholder { | 
|                         color: #999999; | 
|                         font-size: 26px; | 
|                     } | 
|                     input::-moz-placeholder { | 
|                         color: #999999; | 
|                         font-size: 26px; | 
|                     } | 
|                     input:-ms-input-placeholder { | 
|                         color: #999999; | 
|                         font-size: 26px; | 
|                     } | 
|                     .tag { | 
|                         display: flex; | 
|                         flex-wrap: wrap; | 
|                         align-items: center; | 
|                         .tag_active { | 
|                             background: $nav-color !important; | 
|                             color: #ffffff !important; | 
|                         } | 
|                         .tag_item { | 
|                             width: 156px; | 
|                             height: 70px; | 
|                             box-sizing: border-box; | 
|                             background: #F2F2F2; | 
|                             border-radius: 8px; | 
|                             font-size: 26px; | 
|                             font-weight: 400; | 
|                             color: #333333; | 
|                             display: flex; | 
|                             align-items: center; | 
|                             justify-content: center; | 
|                             margin-right: 22px; | 
|                             margin-bottom: 22px; | 
|                             &:nth-child(4n) { | 
|                                 margin-right: 0; | 
|                             } | 
|                         } | 
|                     } | 
|                     span { | 
|                         font-size: 26px; | 
|                         font-weight: 400; | 
|                         color: #333333; | 
|                     } | 
|                     .Search_item_content_a { | 
|                         width: 308px; | 
|                         height: 70px; | 
|                         background: #F7F7F7; | 
|                         border-radius: 8px; | 
|                         border: 1px solid #EEEEEE; | 
|                         font-size: 26px; | 
|                         font-weight: 400; | 
|                         color: #B2B2B2; | 
|                         display: flex; | 
|                         align-items: center; | 
|                         justify-content: center; | 
|                     } | 
|                 } | 
|             } | 
|         } | 
|         .content_total { | 
|             padding: 24px 30px; | 
|             background: #F7F7F7; | 
|             font-size: 24px; | 
|             font-weight: 400; | 
|             color: #666666; | 
|         } | 
|         .content_list { | 
|             width: 100%; | 
|             height: 100%; | 
|             display: flex; | 
|             flex-direction: column; | 
|             .content_list_item { | 
|                 padding: 30px; | 
|                 background: #ffffff; | 
|                 margin-bottom: 20px; | 
|                 .content_list_item_title { | 
|                     display: flex; | 
|                     align-items: center; | 
|                     justify-content: space-between; | 
|                     .warning { | 
|                         color: $nav-stateColor1 !important; | 
|                     } | 
|                     .green { | 
|                         color: $nav-stateColor6 !important; | 
|                     } | 
|                     span { | 
|                         font-size: 32px; | 
|                         font-weight: 500; | 
|                         color: #333333; | 
|                     } | 
|                 } | 
|                 .content_list_item_nr { | 
|                     padding: 24px 30px; | 
|                     background: #F7F7F7; | 
|                     border-radius: 16px; | 
|                     margin-top: 30px; | 
|                     display: flex; | 
|                     justify-content: space-between; | 
|                     flex-wrap: wrap; | 
|                     .content_list_item_nr_boxs { | 
|                         width: 45%; | 
|                         display: flex; | 
|                         margin-top: 24px; | 
|                         &:nth-child(1) { | 
|                             margin-top: 0; | 
|                         } | 
|                         &:nth-child(2) { | 
|                             margin-top: 0; | 
|                         } | 
|                         .warning { | 
|                             color: $nav-stateColor4 !important; | 
|                         } | 
|                         .label { | 
|                             flex-shrink: 0; | 
|                             font-size: 24px; | 
|                             font-weight: 400; | 
|                             color: #666666; | 
|                         } | 
|                         .cr { | 
|                             flex: 1; | 
|                             font-size: 24px; | 
|                             font-weight: 400; | 
|                             color: #222222; | 
|                             overflow: hidden; | 
|                             white-space: nowrap; | 
|                             text-overflow: ellipsis; | 
|                             -o-text-overflow:ellipsis; | 
|                         } | 
|                     } | 
|                     .content_list_item_nr_box { | 
|                         width: 55%; | 
|                         display: flex; | 
|                         margin-top: 24px; | 
|                         &:nth-child(1) { | 
|                             margin-top: 0; | 
|                         } | 
|                         &:nth-child(2) { | 
|                             margin-top: 0; | 
|                         } | 
|                         .label { | 
|                             font-size: 24px; | 
|                             font-weight: 400; | 
|                             color: #666666; | 
|                             flex-shrink: 0; | 
|                         } | 
|                         .cr { | 
|                             font-size: 24px; | 
|                             font-weight: 400; | 
|                             color: #222222; | 
|                         } | 
|                     } | 
|                 } | 
|             } | 
|         } | 
|     } | 
| </style> |