123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545 |
- <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" item-id="0">
- <list class="scroll-v list" enableBackToTop="true" scroll-y loadmoreoffset="15" @loadmore="loadMore(0)">
- <!-- <refresh class="refresh" @refresh="onrefresh(0)" @pullingdown="onpullingdown" :display="isShowTab0Refresh ? 'show' : 'hide'">
- <div class="refresh-view">
- <image class="refresh-icon" :src="refreshIcon" :style="{width: (isShowTab0Refresh || pulling) ? 0: '30px'}" :class="{'refresh-icon-active': refreshTab0Flag}"></image>
- <loading-indicator class="loading-icon" animating="true" v-if="isShowTab0Refresh"></loading-indicator>
- <text class="loading-text">{{refreshTab0Text}}</text>
- </div>
- </refresh> -->
- <cell>
- <view class="customDeliver">
- <text style="text-align: center;font-weight: bold;">{{"交验单号: " + deliverNo}}</text>
- </view>
- </cell>
- <cell v-for="(newsitem,index2) in data" :key="newsitem.Id">
- <view 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: 25rpx;word-wrap: break-word;width: 200px;">100877-231</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.check_qty}}</text>
- </view>
- </view>
- <view style="border-radius: 35px;width: 35px; background-color: lime;height: 35px;align-self: center;margin-right: 5px;"></view>
- </view>
- </view>
- </cell>
- <!-- <cell class="loading-more" v-if="isTab0Loading || data.length > 4">
- <text class="loading-more-text">加载更多...</text>
- </cell> -->
- </list>
- <!-- <view> Tab 0</view> -->
- </swiper-item>
- <swiper-item class="swiper-item" item-id="1">
- <view> Tab 1</view>
- </swiper-item>
- </swiper>
- </view>
- </template>
- <script>
- // 引入新闻详细组件
- import mediaItem from './news-item.nvue';
- // 缓存每页最多
- const MAX_CACHE_DATA = 100;
- // 缓存Tab页签数量
- const MAX_CACHE_PAGE = 3;
- // 定义新闻样例数据
- const newsData = {
- data0: {
- "datetime": "40分钟前",
- "article_type": 0,
- "title": "uni-app行业峰会频频亮相,开发者反响热烈!",
- "source": "DCloud",
- "comment_count": 639
- },
- data1: {
- "datetime": "一天前",
- "article_type": 1,
- "title": "DCloud完成B2轮融资,uni-app震撼发布!",
- "image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg",
- "source": "DCloud",
- "comment_count": 11395
- },
- data2: {
- "datetime": "一天前",
- "article_type": 2,
- "title": "中国技术界小奇迹:HBuilder开发者突破200万",
- "image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4cd3000-517d-11eb-a16f-5b3e54966275.jpg",
- "source": "DCloud",
- "comment_count": 11395
- },
- data3: {
- "article_type": 3,
- "image_list": [{
- "url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b2e201d0-517d-11eb-8a36-ebb87efcf8c0.jpg",
- "width": 563,
- "height": 316
- }, {
- "url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4cd3000-517d-11eb-a16f-5b3e54966275.jpg",
- "width": 641,
- "height": 360
- }, {
- "url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg",
- "width": 640,
- "height": 360
- }],
- "datetime": "5分钟前",
- "title": "uni-app 支持使用 npm 安装第三方包,生态更趋丰富",
- "source": "DCloud",
- "comment_count": 11
- },
- data4: {
- "datetime": "2小时前",
- "article_type": 4,
- "title": "uni-app 支持原生小程序自定义组件,更开放、更自由",
- "image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b2e201d0-517d-11eb-8a36-ebb87efcf8c0.jpg",
- "source": "DCloud",
- "comment_count": 69
- }
- };
-
- const testSapDeliverData = [
- {
- Id: 1,
- deliverNo: this.deliverNo,
- purchaseOrder: '6200003425',
- checkName: 'MM125210',
- bomNo: 'T2-22001',
- materialCode: '10110-673030A',
- materialName: '合页垫板',
- materialSpec: 'BME75-01080-03',
- keyFlag: 1,
- qty: 1,
- check_qty: 0
- },
- {
- Id: 2,
- deliverNo: this.deliverNo,
- purchaseOrder: '6200003425',
- checkName: 'MM125210',
- bomNo: 'T2-22001',
- materialCode: '10110-673031A',
- materialName: '旋转开关垫板',
- materialSpec: 'BME75-01080-04',
- keyFlag: 0,
- qty: 1,
- check_qty: 0
- },
- {
- Id: 3,
- deliverNo: this.deliverNo,
- purchaseOrder: '6200003425',
- checkName: 'MM125210',
- bomNo: 'T1-21344',
- materialCode: '10110-673773A',
- materialName: '侧板主体2',
- materialSpec: 'BMF15-01100-02',
- keyFlag: 1,
- qty: 4,
- check_qty: 0
- },
- {
- Id: 4,
- deliverNo: this.deliverNo,
- purchaseOrder: '6200003425',
- checkName: 'MM125210',
- bomNo: 'T2-22001',
- materialCode: '10125-067445A',
- materialName: '脚轮组件连接件1',
- materialSpec: 'BME75-01020-01',
- keyFlag: 1,
- qty: 4,
- check_qty: 0
- },
- {
- Id: 5,
- deliverNo: this.deliverNo,
- purchaseOrder: '6200003425',
- checkName: 'MM125210',
- bomNo: 'T2-22001',
- materialCode: '10125-067449A',
- materialName: '旋转开关垫板',
- materialSpec: 'BME75-06000-04',
- keyFlag: 1,
- qty: 1,
- check_qty: 0
- }
- ];
- export default {
- components: {
- mediaItem
- },
- data() {
- return {
- data: [],
- deliverNo: '',
- newsList: [], // 新闻列表数据
- cacheTab: [],
- tabIndex: 0, // 当前Tab页的index索引
- tabBars: [{
- name: '交验单明细',
- id: 'jiaoyandan'
- },
- {
- name: '已录入的质检记录',
- id: 'zhijianjilu'
- }
- ], // Tab页初始化数据
- scrollInto: "", // Tab滚动到某元素的id
- showTips: false,
- navigateFlag: false,
- pulling: false,
- isShowTab0Refresh: false,
- isTab0Loading: false,
- refreshTab0Text: '',
- refreshTab0Flag: false,
- refreshIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg=="
- }
- },
- onLoad(option) {
- this.deliverNo = option.deliverNo;
- // setTimeout(()=>{
- // this.tabBars.forEach((tabBar) => {
- // this.newsList.push({
- // data: [],
- // isLoading: false,
- // refreshText: "",
- // loadingText: '加载更多...'
- // });
- // });
- // this.getList(0);
- // },350)
- setTimeout(()=>{
- for(let i = 0; i < testSapDeliverData.length; i++) {
- this.data.push(testSapDeliverData[i]);
- }
- },600)
- console.log(this.data)
- },
- methods: {
- getList(index) { // 获取新闻数据
- let activeTab = this.newsList[index];
- let list = [];
- for (let i = 1; i <= 10; i++) {
- let item = Object.assign({}, newsData['data' + Math.floor(Math.random() * 5)]);
- item.id = this.newGuid();
- list.push(item);
- }
- activeTab.data = activeTab.data.concat(list);
- },
- goDetail(e) { // 打开新闻详细信息组件
- if (this.navigateFlag) {
- return;
- }
- this.navigateFlag = true;
- uni.navigateTo({
- url: '/pages/Inspect/detail/detail?title=' + e.title
- });
- setTimeout(() => {
- this.navigateFlag = false;
- }, 200)
- },
- close(index1, index2) {
- uni.showModal({
- content: '是否删除本条信息?',
- success: (res) => {
- if (res.confirm) {
- this.newsList[index1].data.splice(index2, 1);
- }
- }
- })
- },
- 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) {
- 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);
- //console.log("remove cache index:: " + cacheIndex);
- }
- },
- clearTabData(e) {
- this.newsList[e].data.length = 0;
- this.newsList[e].loadingText = "加载更多...";
- },
- refreshData() {},
- onrefresh(e) {
- var tab = this.newsList[this.tabIndex];
- if (!tab.refreshFlag) {
- return;
- }
- tab.refreshing = true;
- tab.refreshText = "正在刷新...";
- setTimeout(() => {
- this.refreshData();
- this.pulling = true;
- tab.refreshing = false;
- tab.refreshFlag = false;
- tab.refreshText = "已刷新";
- setTimeout(() => { // TODO fix ios和Android 动画时间相反问题
- this.pulling = false;
- }, 500);
- }, 2000);
- },
- onpullingdown(e) {
- 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 = "下拉可以刷新";
- }
- },
- newGuid() {
- let s4 = function() {
- return (65536 * (1 + Math.random()) | 0).toString(16).substring(1);
- }
- return (s4() + s4() + "-" + s4() + "-4" + s4().substr(0, 3) + "-" + s4() + "-" + s4() + s4() + s4()).toUpperCase();
- }
- }
- }
- </script>
- <style lang="scss">
- @import '@/common/uni-nvue.css';
- /* #ifndef APP-PLUS */
- page {
- width: 100%;
- min-height: 100%;
- display: flex;
- }
- /* #endif */
- .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>
|