zhuguifei
2025-09-02 9cc59c17892a7e69de54e06b5931e78c9b05551c
pages/tabBar/general.vue
@@ -1,10 +1,13 @@
<template>
   <view class="app">
      <u-toast ref="uToast"></u-toast>
      <mqtt-view ref="mqttView"></mqtt-view>
      <z-paging ref="paging" v-model="herbList" :auto-show-back-to-top="true" :loading-more-enabled="false" show-refresher-update-time @query="queryList">
         <template #top>
      <cu-custom bgColor="bg-gradual-blue" :isBack="false">
         <block slot="content">兰浦智能干燥</block>
      </cu-custom>
      
      <u-toast ref="uToast"></u-toast>
      <view class="card-box dynamic shadow">
         <view class="title-box margin-bottom-sm">
            <view class="left justify-between">
@@ -23,7 +26,8 @@
            <view class="flex">
               <view class="flex-sub flex flex-direction">
                  <text class="text-df">烘干数量</text>
                  <text class="text-bold text-sl margin-top-xs text-cyan margin-top-sm">{{showValue(model.feed)}}
                        <text
                           class="text-bold text-sl margin-top-xs text-cyan margin-top-sm">{{showValue(model.feed)}}
                     <text class="text-gray text-sm margin-left-xs">筐</text></text>
               </view>
               <view class="flex-twice flex flex-direction justify-between">
@@ -85,6 +89,10 @@
      </view>
         </template>
         <template>
      <view class="card-box dynamic shadow">
         <view class="title-box">
            <view class="left">
@@ -99,26 +107,35 @@
      <view class="card-box dynamic shadow" >
         <view class="title-box">
            <view class="left">
               <uni-text class="cuIcon-titles text-blue"></uni-text>
               <view class="title">明细</view>
                     <view class="title">工单</view>
            </view>
         </view>
         <u-skeleton rows="20" :loading="loading" :title="false">
            <view class="data-item" v-for="(item, index) in herbList" :key="item.id" style="padding: 0 10rpx;">
                  <view class="data-item" v-for="(item, index) in herbList" :key="item.id"
                     style="padding: 0 10rpx;">
               <view class="flex justify-between text-lg align-center padding-tb-xs">
                  <view class="flex">
                     <text>中草药</text>
                     <text>丨</text>
                     <text @click="showLongName(showValue(item.herbName))"
                        class="text-cut flex-twice">{{showValue(item.herbName)}}</text>
                     <!-- <view class="margin-lr-sm">
                     <u-tag text="报警一次" plain size="mini" type="warning"></u-tag>
                  </view> -->
                     <view class="margin-lr-sm">
                        <u-tag text="正常" plain size="mini" type="success"></u-tag>
                              <u-tag v-if="item.orderStatus == 0" text="准备" plain size="mini"
                                 type="warning"></u-tag>
                              <u-tag v-else-if="item.orderStatus == 1" text="上料" plain size="mini"
                                 type="warning"></u-tag>
                              <u-tag v-else-if="item.orderStatus == 2" text="生产" plain size="mini"
                                 type="primary"></u-tag>
                              <u-tag v-else-if="item.orderStatus == 3" text="暂停" plain size="mini"
                                 type="warning"></u-tag>
                              <u-tag v-else-if="item.orderStatus == 4" text="完成" plain size="mini"
                                 type="success"></u-tag>
                     </view>
                  </view>
                  <view style="width:160rpx;" class="flex align-center text-xs ">
@@ -174,51 +191,9 @@
      </view>
      <mqtt-view ref="mqttView"></mqtt-view>
      <!--
      <view class="page-box" v-show="false">
         <view class="order" v-for="(res, index) in dataList" :key="res.id">
            <view class="top">
               <view class="left">
                  <uni-text class="cuIcon-titles text-blue"></uni-text>
                  <view class="store">{{ res.store }}</view>
                  <u-icon name="arrow-right" color="rgb(203,203,203)" :size="12"></u-icon>
               </view>
               <view class="right">
                  <view class='cu-tag radius light bg-blue'>{{res.id}}</view>
               </view>
            </view>
            <view class="item">
               <view class="left">
                  <image :src="res.goodsUrl" mode="aspectFill"></image>
               </view>
               <view class="content">
                  <view>
                     <view class="title u-line-2 text-bold">当归(12:00-13:00)</view>
                     <view class="type">重量:200kg</view>
                     <view class="type">含水率:30% <text style="color: green;">(13%)</text></view>
                     <view class="delivery-time">时间: 60min</view>
                  </view>
               </view>
            </view>
            <u-line color="#f1f1f1" margin="24rpx 0 15rpx 0"></u-line>
            <view class="bottom">
               <view class="bottom_left">
                  <text class="text-blue">干燥进度:</text>
                  <view class="progressBox">
                     <u-line-progress :percentage="res.progre" height="8" :active-color="activeColor"
                        :striped="true" :stripedActive="true"></u-line-progress>
                  </view>
               </view>
         </template>
               <view class="btnBox">
                  <view @click="goCharts" class="evaluate btn">查看图表</view>
               </view>
            </view>
         </view>
      </view> -->
      </z-paging>
   </view>
</template>
@@ -293,6 +268,7 @@
            ],
            model: {
               date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
               month: uni.$u.timeFormat(new Date(), 'yyyy-mm')
            },
            herbList: []
         }
@@ -300,11 +276,7 @@
      onShow() {
      },
      mounted() {
      },
      mounted() {},
      onReady() {
         //接收报警信息,数据预处理(未打开tab无法接收数据)
         uni.$on(this.$constant.MQTT_TOPIC_MESSAGE, (data) => {
@@ -339,10 +311,6 @@
         let month = uni.$u.timeFormat(new Date(), 'yyyy-mm')
         this.getMonth(month)
         let day = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
         this.getOrderList(day, day);
      },
      onLoad() {},
@@ -443,7 +411,7 @@
         },
         dayChange(dayInfo) { // 点击日期
            this.model.date = dayInfo.date
            this.getOrderList(dayInfo.date, dayInfo.date);
            this.$refs.paging.refresh();
         },
         monthChange(monthInfo) { // 切换月份
            let m = monthInfo.month
@@ -464,25 +432,31 @@
               url: "/packageA/pages/charts/charts"
            })
         },
         getOrderList(date1, date2) {
            let params = {
               "orderTime_begin": date1 + " 00:00:00",
               "orderTime_end": date2 + " 23:59:59",
            }
         queryList(pageNo, pageSize) {
            this.loading = true;
            this.$api.getOrderList(params).then((res) => {
               setTimeout(()=>{
                  this.loading = false
               },200)
               if (res.success) {
                  this.herbList = res.result.records
            const params = {
               pageNo: 1,
               pageSize: 30,
               "orderTime_begin": this.model.date + " 00:00:00",
               "orderTime_end": this.model.date + " 23:59:59",
            }
                  let feed = this.countTotal(this.herbList, "feed");
                  let weight = this.countTotal(this.herbList, "originWeight");
                  let dryTime = this.countTotal(this.herbList, "dryTime");
            this.$api.getOrderList(params).then((res) => {
               this.$refs.paging.complete(res.result.records);
               this.loading = false
               const records = res.result.records
               if (!records) {
                  return false;
               }
               let feed = this.countTotal(records, "feed");
               let weight = this.countTotal(records, "originWeight");
               let dryTime = this.countTotal(records, "dryTime");
                  let gList = [];
                  this.herbList.forEach(item => {
               records.forEach(item => {
                     if (!gList.includes(item.herbName)) {
                        gList.push(item.herbName)
                     }
@@ -493,12 +467,19 @@
                  }
                  this.model.feed = feed
                  this.model.group = gList.length
                  this.model.batch = this.herbList.length
               this.model.batch = records.length
                  this.model.weight = weight
                  this.model.dryTime = dryTime
               }
            }).catch(res => {
               this.$refs.paging.complete(false);
               this.loading = false
            })
         },
         getMonth(month) {
            let params = {
               month: month