123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451 |
- <template>
- <view class="tabs">
- <scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false" :scroll-into-view="scrollInto">
- <view class="uni-tab-item" v-for="(tab,index) in tabBars" :key="tab.id" :id="tab.id" :data-current="index" @click="ontabtap">
- <text class="uni-tab-item-title" :class="tabIndex==index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
- </view>
- </scroll-view>
- <view class="line-h"></view>
- <swiper :current="tabIndex" class="swiper-box" style="flex: 1;" :duration="300" @change="ontabchange">
- <swiper-item class="swiper-item" v-for="(tab,index1) in newsList" :key="index1">
- <!-- Tab0 页面渲染 关键件Bom清单明细-->
- <list class="scroll-v list" v-if="index1 === 0" enableBackToTop="true" scroll-y loadmoreoffset="15">
- <cell>
- <view class="customDeliver">
- <text style="text-align: center;font-weight: bold;">{{"关键件Bom单号: " + bomNo}}</text>
- </view>
- </cell>
- <cell v-for="(newsitem,index2) in tab.data" :key="newsitem.id">
- <view class="myDeliverDetail" style="border: 1px #cccccc ;border-radius: 5px; margin-top: 1px;" @click="myDeliverDetailClick(newsitem)">
- <view style="flex-direction: row;flex-direction: row;height: 25px;display: flex;padding: 2px;border-radius: 5px 5px;">
- <text style="align-self: center;">物料编号:</text>
- <text style="align-self: center;">{{newsitem.materialCode}}</text>
- <text :class="newsitem.keyFlag ? 'keyFlagRed' : 'keyFlagGray'" style="align-self: center;margin-left: 20px;">{{newsitem.keyFlag ? '★' : '■'}}</text>
- </view>
- <view class="line-h"></view>
- <view style="flex-direction: row;flex-direction: row;display: flex;-webkit-justify-content: space-between;justify-content: space-between;">
- <view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">物料名称:</text>
- <text style="align-self: center;font-size: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.materialName}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">规格型号/图号:</text>
- <text style="align-self: center;font-size: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.materialSpec}}</text>
- </view>
- <!-- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">生产令号:</text>
- <text style="align-self: center;font-size: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.bomNo}}</text>
- </view> -->
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">需求数量:</text>
- <text style="align-self: center;font-size: 30rpx;font-weight: bold;">{{newsitem.qty}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">已装配数量:</text>
- <text style="align-self: center;font-size: 30rpx;font-weight: bold;color: blue;">{{newsitem.assembleQty}}</text>
- </view>
- </view>
- <view v-if="newsitem.assembleQty < newsitem.qty" style="border-radius: 35px;width: 35px; background-color: lime;height: 35px;align-self: center;margin-right: 5px;"></view>
- <view v-else style="border-radius: 35px;width: 35px; background-color: lightgray;height: 35px;align-self: center;margin-right: 5px;"></view>
- </view>
- </view>
- </cell>
- </list>
- <!-- Tab1 页面渲染 已录入的出库记录-->
- <list v-else class="scroll-v list">
- <cell v-for="(newsitem,index2) in tab.data1" :key="newsitem.Id">
- <view class="myDeliverDetail" style="border: 1px #cccccc ;border-radius: 5px; margin-top: 1px;">
- <view style="flex-direction: row;flex-direction: row;height: 25px;display: flex;padding: 2px;border-radius: 5px 5px;">
- <text style="align-self: center;">物料编号:</text>
- <text style="align-self: center;">{{newsitem.materialCode}}</text>
- <text :class="newsitem.keyFlag ? 'keyFlagRed' : 'keyFlagGray'" style="align-self: center;margin-left: 20px;">{{newsitem.keyFlag ? '★' : '■'}}</text>
- </view>
- <view class="line-h"></view>
- <view style="flex-direction: row;flex-direction: row;display: flex;-webkit-justify-content: space-between;justify-content: space-between;">
- <view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">物料名称:</text>
- <text style="align-self: center;font-size: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.materialName}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">规格型号/图号:</text>
- <text style="align-self: center;font-size: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.materialSpec}}</text>
- </view>
- <!-- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">生产令号:</text>
- <text style="align-self: center;font-size: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.bomNo}}</text>
- </view> -->
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">BN/SN:</text>
- <text style="align-self: center;font-size: 30rpx;font-weight: bold;word-wrap: break-word;width: 200px;">{{newsitem.BnSnCode}}</text>
- </view>
- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px;">
- <text style="align-self: center;color: #555;font-size: 25rpx;">装配数量:</text>
- <text style="align-self: center;font-size: 30rpx;font-weight: bold;">{{newsitem.assembleNum}}</text>
- </view>
- </view>
- </view>
- </view>
- </cell>
- </list>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- // 缓存每页最多
- const MAX_CACHE_DATA = 100;
- // 缓存Tab页签数量
- const MAX_CACHE_PAGE = 3;
-
- export default {
- data() {
- return {
- data: [],
- bomNo: '',
- newsList: [],
- cacheTab: [],
- tabIndex: 0, // 当前Tab页的index索引
- tabBars: [{
- name: '关键件清单明细',
- id: 'jiaoyandan'
- },
- {
- name: '已装配记录',
- id: 'zhijianjilu'
- }
- ], // Tab页初始化数据
- scrollInto: "", // Tab滚动到某元素的id
- showTips: false,
- navigateFlag: false,
- pulling: false,
- imageSrc: '',
- refreshIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg=="
- }
- },
- onLoad(option) {
- this.bomNo = option.bomNo;
- this.tabBars.forEach((tabBar) => {
- this.newsList.push({
- data: [],
- data1: [],
- isLoading: false,
- refreshText: "",
- loadingText: '加载更多...'
- });
- });
- this.getList(0);
- uni.$on('addAssembleDtlData', this.addAssembleDtlData)
- },
- onUnload() {
- uni.$off('addAssembleDtlData', this.addAssembleDtlData)
- },
- methods: {
- async getList(index) {
- let activeTab = this.newsList[index];
- let parm = {
- url : '/business/SapBomRecord/QuerySapBomRecordList?bomNo=' + this.bomNo,
- data: { },
- method: 'POST',
- isHaveToken : true
- }
- let retData = await getApp().RequestData(parm)
- if(retData.isSuccess) {
- if(retData.data.code == 200) {
- activeTab.data = retData.data.data;
- // console.log(retData.data.data)
- }
- else {
-
- }
- }
- else {
-
- }
- },
- loadMore(e) {
- setTimeout(() => {
- this.getList(this.tabIndex);
- }, 500)
- },
- ontabtap(e) { // Tab页面点击事件
- let index = e.target.dataset.current || e.currentTarget.dataset.current;
- this.switchTab(index);
- },
- ontabchange(e) {
- let index = e.target.current || e.detail.current;
- this.switchTab(index);
- },
- switchTab(index) { // 切换Tab页面
- if (this.newsList[index].data.length === 0) {
- this.getList(index);
- }
- if (this.tabIndex === index) {
- return;
- }
- // 缓存 tabId
- if (this.newsList[this.tabIndex].data.length > MAX_CACHE_DATA) {
- // console.log(this.tabIndex)
- // console.log('123121!!')
- let isExist = this.cacheTab.indexOf(this.tabIndex);
- if (isExist < 0) {
- this.cacheTab.push(this.tabIndex);
- //console.log("cache index:: " + this.tabIndex);
- }
- }
- this.tabIndex = index;
- this.scrollInto = this.tabBars[index].id;
- // 释放 tabId
- if (this.cacheTab.length > MAX_CACHE_PAGE) {
- let cacheIndex = this.cacheTab[0];
- this.clearTabData(cacheIndex);
- this.cacheTab.splice(0, 1);
- }
- },
- clearTabData(e) {
- this.newsList[e].data.length = 0;
- this.newsList[e].loadingText = "加载更多...";
- },
- onrefresh(e) {
- // console.log('触发下拉完成事件!!!!!!!!!!!')
- var tab = this.newsList[this.tabIndex];
- if (!tab.refreshFlag) {
- return;
- }
- tab.refreshing = true;
- tab.refreshText = "正在刷新...";
- setTimeout(() => {
- this.pulling = true;
- tab.refreshing = false;
- tab.refreshFlag = false;
- tab.refreshText = "已刷新";
- setTimeout(() => { // TODO fix ios和Android 动画时间相反问题
- this.pulling = false;
- }, 500);
- }, 2000);
- },
- onpullingdown(e) {
- // console.log('触发下拉动作事件。')
- var tab = this.newsList[this.tabIndex];
- if (tab.refreshing || this.pulling) {
- return;
- }
- if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
- tab.refreshFlag = true;
- tab.refreshText = "释放立即刷新";
- } else {
- tab.refreshFlag = false;
- tab.refreshText = "下拉可以刷新";
- }
- },
- myDeliverDetailClick(model) {
- model.outTaskNo = this.outTaskNo;
- if(model.assembleQty >= model.qty) {
- uni.showToast({
- title: '已全部装配完成',
- icon: 'error',
- duration: 1000
- })
- } else {
- uni.navigateTo({
- url: '/pages/Outstore/outassembleOperate',
- success() {
- uni.$emit('sendCheckedDeliverDtlData',model)
- }
- });
- }
- },
- addAssembleDtlData(data) {
- let tabMd = this.newsList[1];
- tabMd.data1.push(data);
- this.updateSapBomListDtl(data);
- // console.log(data)
- },
- updateSapBomListDtl(data) {
- let tabMd0 = this.newsList[0];
- tabMd0.data.forEach((item) => {
- if(item.id === data.id) {
- item.assembleQty += Number(data.assembleNum);
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/common/uni-nvue.css';
- /* #ifndef APP-PLUS */
- page {
- width: 100%;
- min-height: 100%;
- display: flex;
- }
- /* #endif */
- .myDeliverDetail:active {
- background-color: aliceblue;
- }
- .customDeliver {
- padding: 5px;
- font-weight: bold;
- }
- .keyFlagRed {
- color: red;
- }
- .keyFlagGray {
- color: lightgray;
- }
-
- .tabs {
- flex: 1;
- flex-direction: column;
- overflow: hidden;
- background-color: white;
- /* #ifndef APP-PLUS */
- height: 100vh;
- /* #endif */
- padding: 5px;
- }
- .scroll-h {
- width: 750rpx;
- /* #ifdef H5 */
- width:100%;
- /* #endif */
- height: 80rpx;
- flex-direction: row;
- /* #ifndef APP-PLUS */
- white-space: nowrap;
- /* #endif */
- /* flex-wrap: nowrap; */
- /* border-color: #cccccc;
- border-bottom-style: solid;
- border-bottom-width: 1px; */
- }
- .line-h {
- height: 1rpx;
- background-color: #cccccc;
- }
- .uni-tab-item {
- /* #ifndef APP-PLUS */
- display: inline-block;
- /* #endif */
- flex-wrap: nowrap;
- padding-left: 60rpx;
- padding-right: 60rpx;
- }
- .uni-tab-item-title {
- color: #555;
- font-size: 40rpx;
- height: 80rpx;
- line-height: 80rpx;
- flex-wrap: nowrap;
- /* #ifndef APP-PLUS */
- white-space: nowrap;
- /* #endif */
- }
- .uni-tab-item-title-active {
- color: #007AFF;
- font-weight: bold;
- }
- .swiper-box {
- flex: 1;
- }
- .swiper-item {
- flex: 1;
- flex-direction: row;
- }
- .scroll-v {
- flex: 1;
- /* #ifndef MP-ALIPAY */
- flex-direction: column;
- /* #endif */
- width: 750rpx;
- width:100%;
- }
- .update-tips {
- position: absolute;
- left: 0;
- top: 41px;
- right: 0;
- padding-top: 5px;
- padding-bottom: 5px;
- background-color: #FDDD9B;
- align-items: center;
- justify-content: center;
- text-align: center;
- }
- .update-tips-text {
- font-size: 14px;
- color: #ffffff;
- }
- .refresh {
- width: 850rpx;
- /* width:100%; */
- height: 64px;
- justify-content: center;
- }
- .refresh-view {
- flex-direction: row;
- flex-wrap: nowrap;
- align-items: center;
- /* justify-content: center; */
- }
- .refresh-icon {
- width: 30px;
- height: 30px;
- transition-duration: .5s;
- transition-property: transform;
- transform: rotate(0deg);
- transform-origin: 15px 15px;
- margin-left: 5px;
- }
- .refresh-icon-active {
- transform: rotate(180deg);
- }
- .loading-icon {
- width: 20px;
- height: 20px;
- margin-right: 5px;
- color: #999999;
- }
- .loading-text {
- margin-left: 1px;
- font-size: 16px;
- color: #999999;
- }
- .loading-more {
- align-items: center;
- justify-content: center;
- padding-top: 10px;
- padding-bottom: 10px;
- text-align: center;
- }
- .loading-more-text {
- font-size: 28rpx;
- color: #999;
- }
- </style>
|