<template>
|
<div class="content">
|
<div :class="{ 'content_top': status }" class="content_search">
|
<v-Search @searchInput="searchInput" @submit="submit" @reset="reset" :isShow="true" placeholder="搜索工单编码/工序名称">
|
<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="form.startDate ? 'color: #000;' : ''">{{ form.startDate ? form.startDate : '开始日期'}}</div>
|
<span>-</span>
|
<div class="Search_item_content_a" :style="form.endDate ? 'color: #000;' : ''">{{ form.endDate ? form.endDate : '结束日期'}}</div>
|
</div>
|
</div>
|
</template>
|
</v-Search>
|
<div class="content_search_x"></div>
|
<v-LableSelection :TagList="tagList" :isShow="true" @change="clickTag"></v-LableSelection>
|
</div>
|
<div class="content_total">共{{form.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">
|
<div class="content_list_item" v-for="(item, i) in list" :key="i" @click="jump(item)">
|
<div class="content_list_item_top">
|
<div class="content_list_item_top_left">
|
<span v-if="item.mmodel">{{item.mmodel.name}} | {{item.procedureName}}</span>
|
<div class="content_list_item_top_left_tag" v-if="item.urgent">优先{{item.urgent}}</div>
|
<div class="content_list_item_top_left_tag backgreen" v-if="item.type === 0">正常</div>
|
<div class="content_list_item_top_left_tag backyellow" v-if="item.type === 2">返工返修</div>
|
<div class="content_list_item_top_left_tagW" v-if="item.paused === 1">停</div>
|
</div>
|
<div class="content_list_item_top_right">
|
<span class="yellow" v-if="item.status === 0">已创建</span>
|
<span class="green" v-if="item.status === 1">已备料</span>
|
<span v-if="item.status === 2">已完工检</span>
|
<span class="purple" v-if="item.status === 3">已检验</span>
|
<span v-if="item.status === 4">已报工</span>
|
<span v-if="item.status === 5">已入库</span>
|
<span v-if="item.status === 6">已取消</span>
|
</div>
|
</div>
|
<span>工单编号: {{item.code}}</span>
|
<div class="content_list_item_content">
|
<div class="content_list_item_content_item">
|
<div class="content_list_item_content_item_label">物料编码:</div>
|
<div class="content_list_item_content_item_nr" v-if="item.mmodel">{{item.mmodel.code}}</div>
|
</div>
|
<div class="content_list_item_content_item">
|
<div class="content_list_item_content_item_label">计划开工:</div>
|
<div class="content_list_item_content_item_nr">{{item.planDate}}</div>
|
</div>
|
<div class="content_list_item_content_item">
|
<div class="content_list_item_content_item_label">生产批次:</div>
|
<div class="content_list_item_content_item_nr">{{item.batch}}</div>
|
</div>
|
<div class="content_list_item_content_item">
|
<div class="content_list_item_content_item_label">计划数量:</div>
|
<div class="content_list_item_content_item_nr" v-if="item.umodel">{{item.planNum}}{{item.umodel.name}}</div>
|
</div>
|
<!-- <div class="content_list_item_content_item">-->
|
<!-- <div class="content_list_item_content_item_label">生产人员:</div>-->
|
<!-- <div class="content_list_item_content_item_nr">{{item.proUserName}}/{{item.proUserDepartName}}</div>-->
|
<!-- </div>-->
|
<div class="content_list_item_content_item">
|
<div class="content_list_item_content_item_label">生产设备:</div>
|
<!-- <div class="content_list_item_content_item_nr" v-if="item.pgmodel">{{item.pgmodel.code}} - {{item.pgmodel.name}}</div>-->
|
<div class="content_list_item_content_item_nr" v-if="item.pgmodel">{{item.pgmodel.code}}</div>
|
</div>
|
<!-- <div class="content_list_item_content_item" v-if="item.status === 5">-->
|
<!-- <div class="content_list_item_content_item_label">完工日期:</div>-->
|
<!-- <div class="content_list_item_content_item_nr">{{item.proNum}}</div>-->
|
<!-- </div>-->
|
<div class="content_list_item_content_item" v-if="item.status === 5">
|
<div class="content_list_item_content_item_label">完工数量:</div>
|
<div class="content_list_item_content_item_nr">{{item.proNum}}</div>
|
</div>
|
</div>
|
</div>
|
</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" type="range" :min-date="minDate" :max-date="maxDate" 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, onActivated } from "vue"
|
import { useRouter } from "vue-router"
|
import { gsdate, judgmentPlatform } from '@/utils/utils'
|
import { getList, pageCount } from '@/apis/WorkOrderAPI'
|
import { model } from '@/interface'
|
import vSearch from '@/components/common/Search.vue'
|
import vLableSelection from '@/components/common/LabelSelection.vue'
|
|
const router = useRouter()
|
|
// 搜索数据接口
|
interface form extends model {
|
startDate: string,
|
endDate: string,
|
total: number,
|
statusList: Array<any>
|
}
|
|
const form = reactive<form>({
|
capacity: 10,
|
page: 0,
|
total: 0,
|
startDate: '',
|
endDate: gsdate(new Date()),
|
mixParam: '',
|
statusList: []
|
})
|
|
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
|
|
const openCode = ref<boolean>(false)
|
|
const isOpenDate = ref(false);
|
|
// 列表数据
|
const list: any = ref([]);
|
const loading = ref(false);
|
const finished = ref(false);
|
const refreshing = ref(false)
|
|
// 搜索分类标签
|
let tagList: any = reactive([
|
{
|
id: [0,1],
|
name: '待生产',
|
num: '0'
|
},
|
{
|
id: [2,3],
|
name: '生产中',
|
num: '0'
|
},
|
{
|
id: [4,5,6],
|
name: '已完成',
|
num: '0'
|
}
|
])
|
|
// 重置
|
const reset = () => {
|
form.startDate = ''
|
form.endDate = ''
|
form.mixParam = ''
|
form.page = 0
|
finished.value = false
|
list.value = []
|
onLoad()
|
}
|
|
// 搜索框
|
const searchInput = (data: any) => {
|
form.mixParam = data
|
form.page = 0
|
finished.value = false
|
list.value = []
|
onLoad()
|
}
|
|
// 搜索提交
|
const submit = (): void => {
|
form.page = 0
|
finished.value = false
|
list.value = []
|
onLoad()
|
}
|
|
const openDate = () => {
|
isOpenDate.value = true
|
}
|
|
// 打开扫码组件
|
const openScanCode = () => {
|
openCode.value = true
|
}
|
|
// 关闭扫码组件
|
const closePopup = (): void => {
|
openCode.value = false
|
}
|
|
// 确认选择日期
|
const onConfirm = (values: any) => {
|
const [start, end] = values
|
form.startDate = gsdate(start)
|
form.endDate = gsdate(end)
|
isOpenDate.value = false
|
};
|
|
// 切换分类
|
const clickTag = (id: any): void => {
|
form.total = 0
|
form.statusList = id
|
form.page = 0
|
finished.value = false
|
list.value = []
|
onLoad()
|
}
|
|
// 获取扫码值
|
// const onDecode = (data: string[]): void => {
|
// console.log(data)
|
// }
|
|
// 跳转详情(报工前/报工后)
|
const jump = (item: any) => {
|
if (item.status === 4 || item.status === 6 || item.paused === 1) {
|
router.push({ name: 'afterWorkReport', query: { id: item.id } })
|
} else {
|
router.push({ name: 'workOrderReporting', query: { id: item.id } })
|
}
|
}
|
|
// 获取工单列表数据
|
const onLoad = () => {
|
if (!finished.value) {
|
loading.value = true;
|
form.page = form.page + 1
|
getList({
|
capacity: form.capacity,
|
page: form.page,
|
model: {
|
mixParam: form.mixParam,
|
startDate: form.startDate,
|
endDate: form.endDate,
|
statusList: form.statusList.length === 0 ? tagList[0].id : form.statusList
|
}
|
}).then(res => {
|
if (refreshing.value) {
|
list.value = []
|
refreshing.value = false;
|
}
|
loading.value = false;
|
if (res.code === 200 && res.data.records && res.data.records.length !== 0) {
|
form.total = res.data.total
|
list.value.push(...res.data.records)
|
} else {
|
finished.value = true;
|
}
|
}).catch((err: any) => {
|
loading.value = false;
|
finished.value = true;
|
if (refreshing.value) {
|
list.value = []
|
refreshing.value = false;
|
}
|
})
|
}
|
}
|
|
// 下拉刷新优化页面
|
const onRefresh = () => {
|
finished.value = false;
|
form.page = 0
|
loading.value = true;
|
onLoad()
|
pageCounts()
|
}
|
|
// 查询工单分类数量
|
const pageCounts = () => {
|
pageCount({
|
mixParam: form.mixParam,
|
startDate: form.startDate,
|
endDate: form.endDate,
|
statusList: form.statusList.length === 0 ? tagList[0].id : form.statusList
|
}).then(res => {
|
if (res.code === 200) {
|
tagList[0].num = String(res.data.startNum)
|
tagList[1].num = String(res.data.ingNum)
|
tagList[2].num = String(res.data.endNum)
|
}
|
})
|
}
|
|
onMounted(() => {
|
pageCounts()
|
status.value = judgmentPlatform()
|
})
|
|
// onActivated(() => {
|
// form.page = 0
|
// finished.value = false
|
// list.value = []
|
// pageCounts()
|
// onLoad()
|
// })
|
</script>
|
|
<style lang="scss" scoped>
|
.content {
|
.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;
|
.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_search_x {
|
height: 24px;
|
}
|
}
|
.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 {
|
background: white;
|
padding: 30px;
|
display: flex;
|
flex-direction: column;
|
border-bottom: 1px solid #ececec;
|
span {
|
color: #5a5a5a;
|
margin-top: 15px;
|
}
|
.content_list_item_top {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
.content_list_item_top_left {
|
display: flex;
|
align-items: center;
|
width: 80%;
|
span {
|
font-size: 32px;
|
font-weight: 500;
|
color: #333333;
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
-o-text-overflow: ellipsis;
|
}
|
.content_list_item_top_left_tagW {
|
margin-top: 14px;
|
flex-shrink: 0;
|
box-sizing: border-box;
|
padding: 5px 10px;
|
background: $nav-stateColor5;
|
border-radius: 8px;
|
font-size: 22px;
|
font-weight: 400;
|
color: #FFFFFF;
|
margin-left: 16px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
.content_list_item_top_left_tag {
|
margin-top: 14px;
|
flex-shrink: 0;
|
padding: 5px 10px;
|
background: $nav-stateColor4;
|
border-radius: 8px;
|
font-size: 22px;
|
font-weight: 400;
|
color: #FFFFFF;
|
margin-left: 16px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
}
|
.content_list_item_top_right {
|
font-size: 26px;
|
font-weight: 400;
|
color: #666666;
|
flex-shrink: 0;
|
.purple {
|
color: $nav-color !important;
|
}
|
.green {
|
color: $nav-stateColor6 !important;
|
}
|
.yellow {
|
color: $nav-stateColor1 !important;
|
}
|
}
|
}
|
.content_list_item_content {
|
padding: 24px 30px;
|
background: #F7F7F7;
|
border-radius: 16px;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
margin-top: 25px;
|
.content_list_item_content_item {
|
width: 50%;
|
display: flex;
|
margin-top: 24px;
|
&:nth-child(1) {
|
margin-top: 0 !important;
|
}
|
&:nth-child(2) {
|
margin-top: 0 !important;
|
}
|
.content_list_item_content_item_label {
|
font-size: 24px;
|
font-weight: 400;
|
color: #666666;
|
flex-shrink: 0;
|
}
|
.content_list_item_content_item_nr {
|
flex: 1;
|
overflow: hidden;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
-o-text-overflow: ellipsis;
|
font-size: 24px;
|
font-weight: 400;
|
color: #222222;
|
margin-right: 10px;
|
}
|
}
|
}
|
}
|
}
|
}
|
</style>
|