<template> 
 | 
  <div class="content"> 
 | 
    <div :class="{ content_top: status }" class="content_search"> 
 | 
      <v-Search 
 | 
        ref="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="listData.outPlanDateStart ? 'color: #000' : ''" 
 | 
              > 
 | 
                {{ listData.outPlanDateStart ? listData.outPlanDateStart : "开始日期" }} 
 | 
              </div> 
 | 
              <span>-</span> 
 | 
              <div 
 | 
                class="Search_item_content_a" 
 | 
                :style="listData.outPlanDateEnd ? 'color: #000' : ''" 
 | 
              > 
 | 
                {{ listData.outPlanDateEnd ? listData.outPlanDateEnd : "结束日期" }} 
 | 
              </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 types" 
 | 
                  :key="item.id" 
 | 
                  @click="changeTag(i)" 
 | 
                > 
 | 
                  {{ item.name }} 
 | 
                </div> 
 | 
              </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">共{{ listData.total }}条数据</div> 
 | 
    <van-pull-refresh v-model="refreshing" @refresh="onRefresh"> 
 | 
      <van-list 
 | 
        v-model:loading="loading" 
 | 
        :finished="finished" 
 | 
        finished-text="没有更多了~" 
 | 
        @load="loadData" 
 | 
      > 
 | 
        <div class="content_list"> 
 | 
          <div 
 | 
            class="content_list_item" 
 | 
            v-for="(item, i) in lists" 
 | 
            :key="i" 
 | 
            @click="jump(item)" 
 | 
          > 
 | 
          <!-- item头部视图 --> 
 | 
            <div class="content_list_item_top"> 
 | 
              <div class="content_list_item_top_left"> 
 | 
<!--                <span>转库单号:</span>--> 
 | 
                <span>{{ item.code }}</span> 
 | 
              </div> 
 | 
              <div class="content_list_item_top_right"> 
 | 
                <span class="created" v-if="item.status === 0">待出库</span> 
 | 
                <span class="warning" v-else-if="item.status === 1">已出库</span> 
 | 
                <span class="green" v-else-if="item.status === 2">已入库</span> 
 | 
                <span class="info" v-else-if="item.status === 3">已取消</span> 
 | 
                <span class="info" v-else-if="item.status === 4">已退回</span> 
 | 
              </div> 
 | 
            </div> 
 | 
            <!-- item主题信息部分 --> 
 | 
            <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"> 
 | 
                  {{ tyepToStr(item.type) }} 
 | 
                </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.outWarehouseName }} 
 | 
                </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.outUserName }} 
 | 
                </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.inWarehouseName }} 
 | 
                </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.inUserName }} 
 | 
                </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.outPlandate }} 
 | 
                </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.inPlandate }} 
 | 
                </div> 
 | 
              </div> 
 | 
            </div> 
 | 
          </div> 
 | 
        </div> 
 | 
      </van-list> 
 | 
    </van-pull-refresh> 
 | 
    <van-calendar 
 | 
      v-model:show="isOpenDate" 
 | 
      type="range" 
 | 
      :min-date="minDate" 
 | 
      :max-date="maxDate" 
 | 
      @confirm="onConfirm" 
 | 
      color="#4275FC" 
 | 
    /> 
 | 
  </div> 
 | 
</template> 
 | 
  
 | 
<script setup lang="ts"> 
 | 
import { reactive, ref, onMounted } from "vue"; 
 | 
import { useRouter } from "vue-router"; 
 | 
import { gsdate } from "@/utils/utils"; 
 | 
// import { getList, pageCount } from "@/apis/PlanningAPI"; 
 | 
import { getTransferList, ZKPageCount } from "@/apis/materialStorage"; 
 | 
import { judgmentPlatform } from "@/utils/utils"; 
 | 
import { model } from '@/interface'; 
 | 
import vSearch from "@/components/common/Search.vue"; 
 | 
import vLableSelection from "@/components/common/LabelSelection.vue"; 
 | 
  
 | 
// 分页/查询-----接口 
 | 
interface PagingType extends model { 
 | 
  total: number; 
 | 
  outPlanDateEnd: string; // 计划转出开始时间 
 | 
  outPlanDateStart: string; // 计划转出结束时间 
 | 
  code: string; // 转库单号 
 | 
  status: string; // 状态 
 | 
  type: string; // 状态 
 | 
} 
 | 
  
 | 
// 分页/查询-----数据 
 | 
const listData = reactive<PagingType>({ 
 | 
  capacity: 10, 
 | 
  page: 0, 
 | 
  total: 0, 
 | 
  outPlanDateEnd: "", 
 | 
  outPlanDateStart: "", 
 | 
  code: "", 
 | 
  type: "", 
 | 
  status: "", 
 | 
}); 
 | 
  
 | 
const router = useRouter(); 
 | 
  
 | 
const minDate: Date = new Date(new Date().getFullYear() - 1, 1, 1) 
 | 
  
 | 
const maxDate: Date = new Date(new Date().getFullYear() + 1, 12, 30) 
 | 
  
 | 
// 类型 
 | 
let types: Array<{ name: string, id: string, isActive: boolean }> = reactive( 
 | 
[ 
 | 
    // { name: '全部', id: '', isActive: false }, 
 | 
    // { name: '车间领料', id: '1', isActive: false }, 
 | 
    // { name: '车间备料', id: '2', isActive: false }, 
 | 
    // { name: '其他', id: '3', isActive: false }, 
 | 
    { name: '车间领料', id: '1', isActive: false }, 
 | 
    { name: '计划领料', id: '2', isActive: false }, 
 | 
    { name: '机台备料', id: '3', isActive: false }, 
 | 
    { name: '完工入库', id: '4', isActive: false }, 
 | 
    { name: '车间转库', id: '5', isActive: false }, 
 | 
    { name: '外协领料转库', id: '6', isActive: false }, 
 | 
    { name: '外协完工转库', id: '7', isActive: false }, 
 | 
    { name: '产品入库', id: '8', isActive: false }, 
 | 
    { name: '产品转库', id: '9', isActive: false }, 
 | 
    { name: '让步放行入库', id: '10', isActive: false }, 
 | 
    { name: '让步放行转库', id: '11', isActive: false }, 
 | 
    { name: '客返返修领料', id: '12', isActive: false }, 
 | 
    { name: '客返返修入库', id: '13', isActive: false }, 
 | 
    { name: '跨组织转库', id: '14', isActive: false }, 
 | 
    { name: '工序报废', id: '15', isActive: false }, 
 | 
    { name: '客退返修领料', id: '16', isActive: false }, 
 | 
    { name: '客退返修入库', id: '17', isActive: false }, 
 | 
    { name: '废品入库', id: '30', isActive: false } 
 | 
  ] 
 | 
) 
 | 
  
 | 
// 列表数据 
 | 
let lists: any = ref([]); 
 | 
  
 | 
// 控制打开日历插件 
 | 
const isOpenDate = ref<boolean>(false); 
 | 
  
 | 
// 根据平台是否需要设置top 
 | 
let status = ref<boolean>(false); 
 | 
  
 | 
const loading = ref<boolean>(false); 
 | 
const finished = ref<boolean>(false); 
 | 
const refreshing = ref(false) 
 | 
  
 | 
const orderType = reactive<Array<{name: string; id: Number;}>>([ 
 | 
        { name: '车间领料', id: 1 }, 
 | 
        { name: '计划领料', id: 2 }, 
 | 
        { name: '机台备料', id: 3 }, 
 | 
        { name: '完工入库', id: 4 }, 
 | 
        { name: '车间转库', id: 5 }, 
 | 
        { name: '外协领料转库', id: 6 }, 
 | 
        { name: '外协完工转库', id: 7 }, 
 | 
        { name: '产品入库', id: 8 }, 
 | 
        { name: '产品转库', id: 9 }, 
 | 
        { name: '让步放行入库', id: 10 }, 
 | 
        { name: '让步放行转库', id: 11 }, 
 | 
        { name: '客返返修领料', id: 12 }, 
 | 
        { name: '客返返修入库', id: 13 }, 
 | 
        { name: '跨组织转库', id: 14 }, 
 | 
        { name: '工序报废', id: 15 }, 
 | 
        { name: '客退返修领料', id: 16 }, 
 | 
        { name: '客退返修入库', id: 17 }, 
 | 
        { name: '废品入库', id: 30 } 
 | 
      ]); 
 | 
  
 | 
// 搜索标签数据 0已计划、1已转出、2已转入、3已取消 
 | 
const tagList = reactive<Array<{ id: string; name: string; num: string }>>([ 
 | 
  { 
 | 
    id: "", 
 | 
    name: "全部", 
 | 
    num: "10", 
 | 
  }, 
 | 
  { 
 | 
    id: "0", 
 | 
    name: "已计划", 
 | 
    num: "132", 
 | 
  }, 
 | 
  { 
 | 
    id: "1", 
 | 
    name: "已转出", 
 | 
    num: "3", 
 | 
  }, 
 | 
  { 
 | 
    id: "2", 
 | 
    name: "已转入", 
 | 
    num: "12", 
 | 
  }, 
 | 
  { 
 | 
    id: "3", 
 | 
    name: "已取消", 
 | 
    num: "12", 
 | 
  }, 
 | 
]); 
 | 
  
 | 
const reset = () => { 
 | 
  listData.code = ''; 
 | 
  listData.page = 0; 
 | 
  finished.value = false; 
 | 
  lists.value = []; 
 | 
  listData.type = '' 
 | 
  listData.outPlanDateEnd = '' 
 | 
  listData.outPlanDateStart = '' 
 | 
  types.forEach((item: {name: string, id: string, isActive: boolean }) => { 
 | 
    item.isActive = false 
 | 
  }) 
 | 
  getLists(); 
 | 
  getZKPageCount() 
 | 
} 
 | 
  
 | 
// 统计总数 
 | 
const getZKPageCount = () => { 
 | 
  ZKPageCount({ 
 | 
    code: listData.code, 
 | 
    outPlanDateEnd: listData.outPlanDateEnd, 
 | 
    outPlanDateStart: listData.outPlanDateStart, 
 | 
    type: listData.type 
 | 
  }) 
 | 
    .then(res => { 
 | 
      if (res.code === 200) { 
 | 
        tagList[0].num = res.data.allNum 
 | 
        tagList[1].num = res.data.startNum 
 | 
        tagList[2].num = res.data.outNum 
 | 
        tagList[3].num = res.data.inNum 
 | 
        tagList[4].num = res.data.cancelNum 
 | 
      } 
 | 
    }) 
 | 
} 
 | 
  
 | 
onMounted(() => { 
 | 
  getZKPageCount() 
 | 
  status.value = judgmentPlatform(); 
 | 
  listData.page = 0 
 | 
}); 
 | 
  
 | 
const clickTag = (val: string) => { 
 | 
  console.log(val) 
 | 
  listData.status = val 
 | 
  listData.page = 0; 
 | 
  finished.value = false; 
 | 
  lists.value = []; 
 | 
  getLists() 
 | 
} 
 | 
  
 | 
// 获取列表统计 
 | 
// const pageCounts = () => { 
 | 
//   pageCount({}).then((res) => { 
 | 
//     if (res.code === 200 && res.data) { 
 | 
//       tagList[0].num = res.data.allNum; 
 | 
//       tagList[1].num = res.data.startNum; 
 | 
//       tagList[2].num = res.data.ingNum; 
 | 
//       tagList[3].num = res.data.endNum; 
 | 
//     } 
 | 
//   }); 
 | 
// }; 
 | 
  
 | 
const tyepToStr = (type: number): string => { 
 | 
  //  <!-- 1、车间领料;2、车间备料;3、其他;4、完工入库 --> 
 | 
  for (const item of orderType) { 
 | 
    if (item.id == type) { 
 | 
      return item.name 
 | 
    } 
 | 
  } 
 | 
  return '-' 
 | 
} 
 | 
  
 | 
const loadData = (): void => { 
 | 
  getLists() 
 | 
} 
 | 
  
 | 
// 获取计划列表数据 
 | 
const getLists = (): void => { 
 | 
  if (!finished.value) { 
 | 
    loading.value = true; 
 | 
    listData.page = listData.page + 1; 
 | 
    getTransferList({ 
 | 
      capacity: listData.capacity, 
 | 
      model: { 
 | 
        code: listData.code, 
 | 
        outPlanDateEnd: listData.outPlanDateEnd, 
 | 
        outPlanDateStart: listData.outPlanDateStart, 
 | 
        type: listData.type, 
 | 
        status: listData.status, 
 | 
      }, 
 | 
      page: listData.page, 
 | 
      sorts: [ 
 | 
        { 
 | 
          direction: "ASC", 
 | 
          property: "publishDate", 
 | 
        }, 
 | 
      ], 
 | 
    }) 
 | 
      .then((res: any) => { 
 | 
        if (refreshing.value) { 
 | 
          lists.value = [] 
 | 
          refreshing.value = false; 
 | 
        } 
 | 
        loading.value = false; 
 | 
        listData.total = res.data.total; 
 | 
        if (res.code === 200) { 
 | 
          if (res.data.records.length < listData.capacity) { 
 | 
            finished.value = true; 
 | 
          } 
 | 
          if (listData.page === 1) { 
 | 
            lists.value = res.data.records; 
 | 
          } else { 
 | 
            lists.value.push(...res.data.records); 
 | 
          } 
 | 
        } 
 | 
      }) 
 | 
      .catch((err: any) => { 
 | 
        loading.value = false; 
 | 
        finished.value = true; 
 | 
        if (refreshing.value) { 
 | 
          lists.value = [] 
 | 
          refreshing.value = false; 
 | 
        } 
 | 
      }) 
 | 
  } 
 | 
}; 
 | 
  
 | 
// 下拉刷新优化页面 
 | 
const onRefresh = () => { 
 | 
  finished.value = false; 
 | 
  listData.page = 0 
 | 
  loading.value = true; 
 | 
  getLists(); 
 | 
} 
 | 
  
 | 
// 接收子组件传来的输入框值 
 | 
const searchInput = (val: string): void => { 
 | 
  listData.code = val; 
 | 
  listData.page = 0; 
 | 
  finished.value = false; 
 | 
  lists.value = []; 
 | 
  getLists(); 
 | 
  getZKPageCount() 
 | 
} 
 | 
  
 | 
// 搜索弹框提交 
 | 
const submit = (): void => { 
 | 
  listData.page = 0; 
 | 
  finished.value = false; 
 | 
  lists.value = []; 
 | 
  getLists(); 
 | 
  getZKPageCount() 
 | 
}; 
 | 
  
 | 
// 打开日期插件 
 | 
const openDate = (): void => { 
 | 
  isOpenDate.value = true; 
 | 
}; 
 | 
  
 | 
// 确认选择时间 
 | 
const onConfirm = (values: any): void => { 
 | 
  const [start, end] = values; 
 | 
  listData.outPlanDateStart = gsdate(start); 
 | 
  listData.outPlanDateEnd = gsdate(end); 
 | 
  isOpenDate.value = false; 
 | 
}; 
 | 
  
 | 
// 切换工序 
 | 
const changeTag = (i: any): void => { 
 | 
  types[i].isActive = !types[i].isActive; 
 | 
  listData.type = types[i].id 
 | 
  for (const index in types) { 
 | 
    if (index != i) { 
 | 
      console.log(index, i) 
 | 
      const item = types[index] 
 | 
      item.isActive = false 
 | 
    } 
 | 
  } 
 | 
}; 
 | 
  
 | 
  
 | 
  
 | 
// 跳转详情 
 | 
const jump = (item: any): void => { 
 | 
  router.push({ name: "wTransferDetail", query: { id: item.id } }); 
 | 
}; 
 | 
</script> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
.content { 
 | 
  .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 { 
 | 
            padding: 22px 26px; 
 | 
            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; 
 | 
          } 
 | 
        } 
 | 
        span { 
 | 
          font-size: 26px; 
 | 
          font-weight: 400; 
 | 
          color: #333333; 
 | 
          margin: 0 30px; 
 | 
        } 
 | 
        .Search_item_content_a { 
 | 
          padding: 20px 0; 
 | 
          flex: 1; 
 | 
          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%; 
 | 
    background-color: #fff; 
 | 
    display: flex; 
 | 
    flex-direction: column; 
 | 
    .content_list_item { 
 | 
      padding: 30px; 
 | 
      display: flex; 
 | 
      flex-direction: column; 
 | 
      border-bottom: 1px solid #ececec; 
 | 
      background: white; 
 | 
      .content_list_item_top { 
 | 
        display: flex; 
 | 
        align-items: center; 
 | 
        justify-content: space-between; 
 | 
        .content_list_item_top_left { 
 | 
          display: flex; 
 | 
          align-items: center; 
 | 
          span { 
 | 
            font-size: 32px; 
 | 
            font-weight: 500; 
 | 
            color: #333333; 
 | 
          } 
 | 
        } 
 | 
        .content_list_item_top_right { 
 | 
          font-size: 26px; 
 | 
          font-weight: 400; 
 | 
          .created { 
 | 
            color: $nav-stateColor1 !important; 
 | 
          } 
 | 
          .warning { 
 | 
            color: $nav-stateColor5 !important; 
 | 
          } 
 | 
          .green { 
 | 
            color: $nav-stateColor6 !important; 
 | 
          } 
 | 
          .info { 
 | 
            color: $nav-stateColor3 !important; 
 | 
          } 
 | 
        } 
 | 
      } 
 | 
      .content_list_item_content { 
 | 
        padding: 24px 30px; 
 | 
        background: #f7f7f7; 
 | 
        border-radius: 16px; 
 | 
        display: flex; 
 | 
        flex-wrap: wrap; 
 | 
        justify-content: space-between; 
 | 
        margin-top: 32px; 
 | 
        .content_list_item_content_item { 
 | 
          width: 100%; 
 | 
          display: flex; 
 | 
          margin-top: 24px; 
 | 
          &:first-child { 
 | 
            margin-top: 0; 
 | 
          } 
 | 
          // &: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 { 
 | 
            font-size: 24px; 
 | 
            font-weight: 400; 
 | 
            color: #222222; 
 | 
            margin-right: 10px; 
 | 
          } 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
  } 
 | 
} 
 | 
</style> 
 |