DESKTOP-H1V7IUO\51019 2 سال پیش
والد
کامیت
8c88cd2257

+ 1 - 1
app.js

@@ -3,7 +3,7 @@ var domain = "http://192.168.5.4:8088"
 // domain = "http://192.168.2.90:8088"
 // domain = "https://cansino-fxcapi.vandh.cn/prod-api"
 // domain = "https://fxc.vandh.cn/prod-api"
-// domain = "https://fxcapi.zhongyihz.cn/prod-api"
+domain = "https://fxcapi.zhongyihz.cn/prod-api"
 var serverDomain = domain + ""
 var downloadDomain = "https://oss.zhongyihz.cn"
 App({

BIN
img/dev_img3.png


BIN
img/dev_img4.png


BIN
img/dev_img5.png


BIN
img/dev_img6.png


BIN
img/doctor_img1.png


BIN
img/line.png


BIN
img/line_left.png


BIN
img/malBox.png


BIN
img/obj_four.png


BIN
img/obj_one.png


BIN
img/obj_three.png


BIN
img/obj_two.png


BIN
img/wechart_img1.jpg


+ 86 - 532
pages/index/index.js

@@ -5,21 +5,10 @@ import {path} from '../../utils/circle';
 const app = getApp()
 Page({
   data: {
-    showRight:1,
-    transportStatusData:{},
-    transportBusinessData:{},
-    transportBusinessNum:1,
-    orderWaringStatusData:{},
-    waringStatus:0,
-    waringStatusList:["当天","本周","本月",],
-    transportCityData:[],
-    transOrderList:[],
-    transOrderIndex:0,
+    showRight:false,
     polyline:[],
     tempList:[],
     hisLocal:[],
-    urlLeft:'/group156/default/20211216/16/58/6/bde42061736d8dfcd68bbe33fd9464a0.jpg"',
-    banner: "/group156/default/20211216/16/58/6/bde42061736d8dfcd68bbe33fd9464a0.jpg",
     ossPath: app.globalData.$filePath,
     title: '冷链追溯系统',
     token: '',
@@ -31,45 +20,9 @@ Page({
       showCapsule: true,
       share: false
     },
-    alarmDTO: {
-      chipNum: 0,
-      allTimeNum: 0,
-      realTimeNum: 0
-    },
-    temperatureDTO: { //温度监测数量
-      normal: 0,
-      warning: 0,
-      alarm: 0
-    },
-    waringDTO: {
-      chipNum: 0,
-      allTimeNum: 0,
-      realTimeNum: 0
-    },
-    inTrans: 0, //已出库(个)
-    inStore: 0, //已入库(个)
-    inEnd: 0, //已结束(个)
-    total: 0, //已生产(个)
-
-    error11: 0, //一型有源报警数量
-    error20: 0, //二型报警数量
-    total10: 0, //一型无源数量
-    total11: 0, //一型有源数量
-    total20: 0, //二型数量
-    warning11: 0, //一型有源预警数量
-    warning20: 0, //一型无源预警数量
-    mapTopData: {
-      name: '暂无',
-      status: '暂无',
-      updateTime: '暂无',
-      lastTemperature: '暂无',
-      minTemperature: '暂无',
-      maxTemperature: '暂无'
-    },
     llzsEc: {
       lazyLoad: true,
     },
-    chainTempList: [],
     tempList:[],
     Ec: {
       lazyLoad: true,
@@ -120,10 +73,6 @@ Page({
       },
     ],
     isAuth: false,
-    showAuthWin: false,
-    showChaType: false,
-    isPrem: false,
-    device: false,
     modalHidden: true,
     scrollTop:0,//滚动监听
     // 沃森新
@@ -134,7 +83,7 @@ Page({
       {name:'流感',remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常'}
     ],
     tabLeftTop_remark:'本公司现有100个产品温度正常温度不正常0个,原料辅料20种状态正常,产品有100种,所有产品状态全部正常',
-    orderCardList:[{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50},{createTime:'2022-07-01',num:50}]
+    orderCardList:[{city:'泰州市',used:50,stack: 2},{city:'北京市',used:50,stack: 2},{city:'西安市',used:50,stack: 2},{city:'天津市',stack: 2,used:50},{city:'廊坊市',stack: 2,used:50},{city:'广州市',used:50,stack: 2},{city:'郑州市',used:50,stack: 2}]
   },
   // 事件处理函数
   onLoad() {
@@ -151,27 +100,11 @@ Page({
   gopage1(){
     this.setData({
       showRight:false,
+    },()=>{
+      this.setCardLeft();
     })
   },
   onReady: function () {
-    var that = this;
-    // that.canvasRingA = that.selectComponent("#canvasRingA");
-    // that.canvasRingB = that.selectComponent("#canvasRingB");
-    // that.canvasRingC = that.selectComponent("#canvasRingC");
-    // that.canvasRingG = that.selectComponent("#canvasRingG");
-    // that.canvasRingA.showCanvasRing();
-    // that.canvasRingB.showCanvasRing();
-    // that.canvasRingC.showCanvasRing();
-    // that.canvasRingG.showCanvasRing();
-
-    // that.canvasRingD = that.selectComponent("#canvasRingD");
-    // that.canvasRingE = that.selectComponent("#canvasRingE");
-    // that.canvasRingF = that.selectComponent("#canvasRingF");
-    // that.canvasRingL = that.selectComponent("#canvasRingL");
-    // that.canvasRingD.showCanvasRing();
-    // that.canvasRingE.showCanvasRing();
-    // that.canvasRingF.showCanvasRing();
-    // that.canvasRingL.showCanvasRing();
   },
   onShow: function (options) {
     var that = this;
@@ -185,17 +118,11 @@ Page({
     })
     //获取新闻
     this.getNewsList();
-    /**沃森新 */
-    // this.setPie4Chart({total:8,abnormal:3,normal:8});
-    // this.setCard_top_right_butChart([{"name":"北京","orderNum":50},{"name":"上海","orderNum":30},{"name":"安徽","orderNum":20},{"name":"成都","orderNum":20},{"name":"广东","orderNum":20},]);
-    // this.product_two_left_two([
-    //   {name:'标签1',data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]},
-    //   {name:'标签2',data:[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]},
-    //   {name:'',data:[30.0, 42.2, 43.3, 44.5, 46.3, 80.2, 200.3, 123.4, 223.0, 26.5, 12.0, 6.2]},
-    // ])
-    // this.setCardPieTwo();
-    // this.setCard3dBar();
-    // this.setKLine();
+    // 加载
+    this.setCardLeft();
+  
+  },
+  setCardLeft(){
     var diagamList = [
       {name: "标签1",value: 0,unNormalTotal:0,symbolSize:40},
       {name: "标签2",value: 0,unNormalTotal:0,symbolSize:40},
@@ -216,34 +143,11 @@ Page({
       {data:[{ name: "标签1", value: 50 },{ name: "标签2", value: 20 },{ name: "标签3", value: 10 }]},
     ]
     this.setSevenCardPie(sevenCardPieList);
-    // var sevenCardPieList = [
-    //   { name: "标签1", value: 50 },
-    //   { name: "标签2", value: 20 },
-    // ]
-    // this.setCardSenvenPie(sevenCardPieList);
-    // var eightBarLeftList = [
-    //   {name:'标签1',data:[2.0, 4.9, 7.0, 23.2,]},
-    //   {name:'标签2',data:[2.6, 5.9, 9.0, 21.4,]},
-    //   {name:'标签3',data:[3.6, 6.9, 8.0, 18.4,]},
-    //   {name:'标签4',data:[4.6, 7.9, 7.0, 16.4,]},
-    // ]
-    // this.setCardEightBar(eightBarLeftList);
-    // var eightRightBarList = [
-    //   {name:'标签1',data:[10, 20, 30, 40, 50, 60]},
-    //   {name:'标签2',data:[10, 20, 30, 40, 50, 60]},
-    //   {name:'标签3',data:[10, 20, 30, 40, 50, 60]},
-    //   {name:'',data:[15,22,32,45,48,67]}
-    // ]
-    // this.setCardEightRightBar(eightRightBarList);
-    // this.setCardNineBar([{"name":"二价流脑","orderNum":50},{"name":"胶囊","orderNum":30},{"name":"产品1","orderNum":20},{"name":"颗粒","orderNum":20},]);
-    // var nineRightBarList = [{name:'生产',data:[120, 132, 101, 134, 90, 230, 210]},{name:'销售',data:[220, 182, 191, 234, 290, 330, 310]},{name:'在途',data:[150, 232, 201, 154, 190, 330, 410]},{name:'交付',data:[158, 242, 141, 164, 180, 230, 510]}]
-    // this.setCardNineRightBar(nineRightBarList);
     /**沃森新 */
     //获取token,若无则判定用户是游客访问,不进行任何请求
     var token = wx.getStorageSync('token');
     this.setData({
       token,
-      chainTempList:[],
       tempList:[]
     })
 
@@ -278,61 +182,10 @@ Page({
     this.getSignProductUsedProduceState();
     // 主产品不同年度 使用量统计
     this.getSignPrroductYearUsedProduceState();
-  },
-  getOrderWarnOption(list){
-    var fontSize = 12
-    var fontColor = "#999999"
-    return {
-      color:["#0079FF","#FF723A","#EA1C43"],
-      title: {
-        show:false
-      },
-      grid:{
-        top:"5%",
-        left:"5%",
-        right:"5%",
-        bottom:"5%",
-      },
-      tooltip: {
-        show:true
-      },
-      legend: {
-        data:list.map(item=>item.name),
-        icon:"rect",
-        orient:"vertical",
-        top:"middle",
-        right:"10%",
-        itemWidth:fontSize,
-        itemHeight:fontSize,
-        textStyle:{
-          fontSize:fontSize,
-          color:fontColor,
-        },
-        formatter(name){
-          return name+" " + list.filter(item=>item.name == name)[0].num
-        },
-      },
-      series: [
-        {
-          type: 'pie',
-          silent:0,
-          radius: ["40%", '90%'],
-          center: ["30%", '50%'],
-          label:{
-            position:'inside',
-            formatter:"{d}%",
-          },
-          itemStyle:{
-            borderColor:"#ffffff",
-            borderWidth:2,
-          },
-          data: list.filter(item=>{
-            item.value = item.num
-            return item
-          }),
-        },
-      ]
-    }
+    // 主产品在不同地区库存、使用数据统计
+    this.getSignProductCityState();
+    // 主产品最近一周每一天的使用量统计 
+    this.getSignProductEveryWeekState();
   },
   getCysOrderOption(list){
     var fontSize=8;
@@ -504,7 +357,6 @@ Page({
     ]
     this.showMap(markerList);
     this.setData({
-      chainTempList:temp,
       tempList:temp,
     },()=>{
       this.setTemp(temp);
@@ -549,6 +401,19 @@ Page({
     ]
     var cardSixLineList = ["阿莫西林", "红霉素", "新型冠状病毒疫苗"];
     this.setCardSixBar(seriesSixBar,cardSixLineList);
+    var klineList = [
+      {
+        maps:[{total:10,},{total:15,},{total:19,},{total:13,},{total:18,},],
+        productInfo:{name:'阿莫西林'}
+      },{
+        maps:[{total:16,},{total:11,},{total:14,},{total:13,},{total:18,},],
+        productInfo:{name:'红霉素'}
+      },{
+        maps:[{total:18,},{total:14,},{total:11,},{total:8,},{total:17,},],
+        productInfo:{name:'新型冠状病毒疫苗'}
+      }
+    ];
+    this.setKLine(klineList);
   },
   showMap1(markers) {
     var that = this;
@@ -572,7 +437,6 @@ Page({
     },()=>{
       if(markers.length!=0 && token){
         //地图数据加载完成后,获取第一条数据的详情
-        that.getListInfo(markers[0].bId);
         that.getListChainTemperature(markers[0].bId);
       }else{
         var temp = [
@@ -601,10 +465,8 @@ Page({
     if (that.data.token) {
       for (var i in that.data.markers) {
         if (that.data.markers[i].id == index) {
-          //冷链信息
-          that.getListInfo(that.data.markers[i].bId);
-          //冷链温度曲线
-          that.getListChainTemperature(that.data.markers[i].bId);
+          
+
           return;
         }
       }
@@ -637,174 +499,6 @@ Page({
       app.showToptip(that,'error',err.data.msg)
     })
   },
-  getListInfo(id) {
-    var that = this;
-    app.requestP({
-      url: '/index/getChainInfo',
-      method: 'post',
-      contentType: 'application/json',
-      data: {
-        id
-      }
-    }).then(res => {
-      const {
-        name,
-        status,
-        updateTime,
-        lastTemperature,
-        minTemperature,
-        maxTemperature
-      } = res.data.data;
-      that.setData({ //数据处理
-        mapTopData: {
-          name: name || '暂无',
-          status: status == '00' ? '正常' : status == '10' ? '黄色预警' : status == '20' ? '红色预警' : '暂无',
-          updateTime: updateTime || '暂无',
-          lastTemperature: lastTemperature ? lastTemperature + '℃' : '暂无',
-          minTemperature: minTemperature ? minTemperature + '℃' : '暂无',
-          maxTemperature: maxTemperature || '暂无'
-        },
-      })
-    }).catch(err=>{
-      app.showToptip(that,'error',err.data.msg)
-    })
-  },
-  getListChainTemperature(id) {
-    var that = this;
-    app.requestP({
-      url: '/index/listChainTemperature',
-      method: 'post',
-      contentType: 'application/json',
-      data: {
-        id
-      },
-    }).then(res => {
-      that.setData({
-        chainTempList: res.data.data,
-        tempList:res.data.data
-      })
-      that.setTemp(res.data.data);
-    }).catch(err => {
-      app.showToptip(that, 'error', '暂无温度数据');
-    })
-  },
-  setTransOption(temperature) {
-    var that = this;
-    that.ecWen = that.selectComponent('#llzsChartDom');
-    that.ecWen.init((canvas, width, height, dpr) => {
-      const chart = echarts.init(canvas, null, {
-        width: width,
-        height: height,
-        devicePixelRatio: dpr
-      });
-      var option = that.getTransOption();
-      option.xAxis.data = temperature.map(v => v.productTypeName);
-      option.series[0].data = temperature.map(v => v.state10);
-      option.series[1].data = temperature.map(v => v.state11);
-      option.series[2].data = temperature.map(v => v.state20);
-      chart.setOption(option);
-      that.wenChart = chart;
-      return chart;
-    });
-  },
-  getTransOption() {
-    return {
-      title: {
-        text: '数量',
-        textStyle: {
-          color: '#74788D',
-          fontWeight: 'normal',
-          fontSize: '16rpx'
-        }
-      },
-      tooltip: {
-        show: false,
-        trigger: 'axis'
-      },
-      color: ['#7661FF', '#5AC8FA', '#00B972'],
-      legend: {
-        data: ['全程温控', '实时追溯', '追溯标签'],
-        icon: "rect", //  设置形状  类型包括 circle,rect ,roundRect,triangle
-        itemHeight: 11,
-        itemWidth: 11,
-        align: 'left',
-        itemGap: 5,
-        right: 10,
-        top: 0,
-        textStyle:{
-          color:'#999',
-        }      
-      },
-      grid: {
-        left: '0%',
-        right: '0%',
-        bottom: '3%',
-        containLabel: true
-      },
-      xAxis: {
-        type: 'category',
-        nameTextStyle: {
-          color: "#77869E",
-          fontSize: 10
-        },
-        axisLine: {
-          onZero: false,
-          lineStyle: {
-            color: "#999"
-          }
-        },
-        axisTick: {
-          show: false
-        },
-        splitLine: {
-          show: false,
-        },
-        data: ["产品一", "产品二", "产品三", "产品四"],
-      },
-      yAxis: [{
-        type: 'value'
-      }],
-      series: [{
-          name: '追溯标签',
-          type: 'bar',
-          label: {
-            show: true,
-            position: 'top'
-          },
-          symbolSize: '0',
-          lineStyle: {
-            width: 1
-          },
-          data: [50, 180, 290, 50]
-        },
-        {
-          name: '全程温控',
-          type: 'bar',
-          label: {
-            show: true,
-            position: 'top'
-          },
-          symbolSize: '0',
-          lineStyle: {
-            width: 1
-          },
-          data: [200, 200, 292, 200]
-        }, {
-          name: '实时追溯',
-          type: 'bar',
-          label: {
-            show: true,
-            position: 'top'
-          },
-          symbolSize: '0',
-          lineStyle: {
-            width: 1
-          },
-          data: [248, 290, 290, 240]
-        }
-      ]
-    }
-  },
   getTempOption() {
     return {
       title: {
@@ -901,26 +595,6 @@ Page({
       }]
     }
   },
-  productTypeChipCount(userId) {
-    var that = this;
-    app.requestP({
-      url: '/index/productTypeChipCount',
-      method: 'post',
-      data: {
-        userId
-      }
-    }).then(res => {
-      that.setData({
-        productTypeChipCount: res.data.data
-      })
-      const temperature = res.data.data;
-      that.setPieChart(temperature.slice(0,6));
-    }).catch(err => {
-      that.setData({
-        productTypeChipCount: []
-      })
-    })
-  },
   setPieChart(temperature) {
     var that = this;
     var num = 0;
@@ -1008,76 +682,6 @@ Page({
       }]
     }
   },
-  getChainStatus(userId) {
-    var that = this;
-    app.requestP({
-      url: '/index/getChainStatus',
-      method: 'post',
-      data: {
-        userId
-      }
-    }).then(res => {
-      const {
-        alarmDTO,
-        temperatureDTO,
-        waringDTO,
-        inTrans,
-        inStore,
-        inEnd,
-        total
-      } = res.data.data;
-      that.setData({
-        temperatureDTO,
-        waringDTO,
-        inTrans,
-        inStore,
-        inEnd,
-        total
-      })
-    }).catch(err=>{
-      app.showToptip(that,'error',err.data.msg)
-    })
-  },
-  getWarningState(userId) {
-    var that = this;
-    app.requestP({
-      url: '/index/warningState',
-      method: 'post',
-      data: {
-        userId
-      }
-    }).then(res => {
-      const {
-        error11,
-        error20,
-        total10,
-        total11,
-        total20,
-        warning11,
-        warning20
-      } = res.data.data;
-      that.setData({
-        error11,
-        error20,
-        total10,
-        total11,
-        total20,
-        warning11,
-        warning20
-      }, () => {
-        // that.canvasRingA.showCanvasRing();
-        // that.canvasRingB.showCanvasRing();
-        // that.canvasRingC.showCanvasRing();
-        // that.canvasRingD.showCanvasRing();
-        // that.canvasRingE.showCanvasRing();
-        // that.canvasRingF.showCanvasRing();
-        // that.canvasRingG.showCanvasRing();
-        // that.canvasRingL.showCanvasRing();
-      })
-    }).catch(err=>{
-      app.showToptip(that,'error',err.data.msg)
-    })
-  },
   setMapCenter() {
     var that = this;
     var locations = that.data.markers;
@@ -1094,39 +698,10 @@ Page({
     }).then(function (res) {
       var userId = res.data.data.userId;
       // that.getProductChipState();
-      that.productTypeChipCount(userId);
-      that.getChainStatus(userId);
-      // that.getWarningState(userId);
     }).catch(err => {
       app.showToptip(that, 'error', '请刷新重试');
     })
   },
-  transportationInfo() {
-    var token = wx.getStorageSync('token');
-    if(!token){
-      wx.navigateTo({
-        url: '/pages/login/login',
-      })
-      return;
-    }
-    var transportationJson = JSON.stringify(this.data.productChipStateList);
-    wx.navigateTo({
-      url: '/pages/index/transportationInfo/transportationInfo?list=' + transportationJson,
-    })
-  },
-  monitoringNum() {
-    var token = wx.getStorageSync('token');
-    if(!token){
-      wx.navigateTo({
-        url: '/pages/login/login',
-      })
-      return;
-    }
-    var productTypeChipCountJson = JSON.stringify(this.data.productTypeChipCount);
-    wx.navigateTo({
-      url: '/pages/index/monitoringNum/monitoringNum?list=' + productTypeChipCountJson,
-    })
-  },
   packageInfo(){
     var token = wx.getStorageSync('token');
     if(!token){
@@ -1140,64 +715,6 @@ Page({
       url: '/pages/index/packageInfo/packageinfo?list=' + packageList,
     })
   },
-  expressInfo(){
-    var token = wx.getStorageSync('token');
-    if(!token){
-      wx.navigateTo({
-        url: '/pages/login/login',
-      })
-      return;
-    }
-    var expressData = JSON.stringify(this.data.expressData);
-    var title = JSON.stringify([{name:'出库',type:'o'},{name:'入库',type:'i'}]);
-    var titleName = JSON.stringify({titleName:'出入库统计'});
-    wx.navigateTo({
-      url: '/pages/index/statics/statics?list=' +encodeURIComponent(expressData)+'&title='+title+'&titleName='+titleName,
-    })
-  },
-  goAbnormal(){
-    wx.navigateTo({
-      url: '/pages/index/abnormal/abnormal',
-    })
-  },
-  ordersInfo(){
-    wx.navigateTo({
-      url: '/pages/index/ordersList/ordersList',
-    })
-  },
-  transporDetails(){
-    var temp = this.data.temp;
-    var productName = this.data.productName;
-    var {product10,product20,product30,product40,product50} = this.data;
-    var token = wx.getStorageSync('token');
-    if(!token){
-      wx.navigateTo({
-        url: '/pages/login/login',
-      })
-      return;
-    }
-    wx.navigateTo({
-      url: '/pages/index/transporDetails/transporDetails?temp='+encodeURIComponent(JSON.stringify(temp))+'&productName='+encodeURIComponent(JSON.stringify(productName))+'&productNum='+encodeURIComponent(JSON.stringify([product10,product20,product30,product40,product50])),
-    })
-  },
-  onShareAppMessage() {
-    return {
-      title: 'cover-view',
-    }
-  },
-  monitoringNum() {
-    var token = wx.getStorageSync('token');
-    if(!token){
-      wx.navigateTo({
-        url: '/pages/login/login',
-      })
-      return;
-    }
-    var transportCityDataJson = JSON.stringify(this.data.transportCityData);
-    wx.navigateTo({
-      url: '/pages/index/monitoringNum/monitoringNum?list=' + transportCityDataJson,
-    })
-  },
   getNewsList() {
     var that = this;
     app.requestP({
@@ -1319,7 +836,6 @@ Page({
       method: 'post',
     }).then(res=>{
       this.setCard_top_right_butChart(res.data.data);
-      this.setKLine(res.data.data);
     }).catch(err=>{
       app.showToptip(this,'err',err.data.msg)
     })
@@ -1510,7 +1026,6 @@ Page({
       method: 'post',
     }).then(res=>{
       this.setCard_two_left_one(res.data.data);
-      this.setKLine(res.data.data);
     }).catch(err=>{
       app.showToptip(this,'err',err.data.msg)
     })
@@ -1922,24 +1437,32 @@ Page({
         height: height,
         devicePixelRatio: dpr
       });
-      list = list.map(item=>{
-        return {orderNum:item.total,name:item.city || 'N/A'}
+      var option = that.getStaticBarChart();
+      option.color = ['#2D59E6','#FFAF36','#7FD1FF']
+      option.grid.top='20%';
+      option.grid.bottom='13%';
+      option.series = [];
+      option.xAxis.data = [];
+      const echartsData = [];
+      list.map(item=>{
+        echartsData.push({
+          name:item.productInfo.name,data:item.maps.map(itemChild=>itemChild.total)
+        })
+      })
+      option.xAxis.data = list.map(item=>item.productInfo.name);
+      echartsData.map((item,index)=>{
+        option.series.push({
+          name:item.name,
+          type: "bar",
+          stack: "Ad",
+          barMaxWidth: 25,
+          // barMinHeight: 10,
+          emphasis: {
+            focus: "series",
+          },
+          data:item.data
+        })
       })
-      var option = that.getCysOrderOption(list);
-      // lenged
-      option.series = [{
-        type:'bar',
-        barMaxWidth: 15,
-        barMinHeight: 10,
-        data:list.map(item=>item.orderNum),
-        label: {
-          show: true,
-          position: 'inside'
-        },
-        itemStyle:{
-          normal:{color:'#333FFF'}
-        }
-      }]
       chart.setOption(option);
       return chart;
     })
@@ -2468,8 +1991,8 @@ Page({
         },
       }
       var option = this.getStaticPieChart();
-      option.color = ['rgb(247,20,4)','rgb(127,210,255)','rgb(44,88,288)'];
-      var center = [["50%", "10%"],["50%", "35%"],["50%", "60%"],["50%", "85%"]];
+      option.color = ['rgb(127,210,255)','rgb(44,88,288)','rgb(247,20,4)',];
+      var center = [["50%", "12%"],["50%", "35%"],["50%", "60%"],["50%", "85%"]];
       option.series = [];
       list.map((item,index)=>{
         option.series.push({
@@ -2830,4 +2353,35 @@ Page({
       return chart;
     })
   },
+  // 图15 主产品在不同地区库存、使用数据统计 /daping/signProductCityState
+  getSignProductCityState(){
+    app.requestP({
+      url: '/daping/signProductCityState',
+      method: 'post',
+    }).then(res=>{
+      this.setData({
+        orderCardList:res.data.data,
+      })
+      var sevenCardPieNum = [];
+      res.data.data.map(item=>{
+        sevenCardPieNum.push({
+          data:[{name:item.city,value:item.stack},{name:item.city+'1',value:item.used}]
+        })
+      })
+      this.setSevenCardPie(sevenCardPieNum);
+    }).catch(err=>{
+      app.showToptip(this,'err',err.data.msg)
+    })
+  },
+  // 主产品最近一周每一天的使用量统计 
+  getSignProductEveryWeekState(){
+    app.requestP({
+      url: '/daping/signProductEveryWeekState',
+      method: 'post',
+    }).then(res=>{
+      this.setKLine(res.data.data);
+    }).catch(err=>{
+      app.showToptip(this,'err',err.data.msg)
+    })
+  },
 })

+ 3 - 3
pages/index/index.wxml

@@ -281,12 +281,12 @@
           <view class="card_right_pie" style="padding:20rpx 0 0 0;">
             <view class="sj_yc_item">
               <view class="sj_yc_tr1">
-                <view>订单号</view>
+                <view>地区</view>
                 <view>已生产</view>
               </view>
               <view class="sj_yc_tr2" wx:for="{{orderCardList}}" wx:for-item="item">
-                <view>{{item.createTime}}</view>
-                <view>{{item.num}}</view>
+                <view>{{item.city}}</view>
+                <view>{{item.used}}</view>
               </view>
             </view>
           </view>

+ 25 - 0
pages/index/indexRight/indexRight.js

@@ -1,6 +1,31 @@
 const app = getApp();
 Component({
+  data:{
+    productList:[],
+    prductIndex:'',
+  },
+  lifetimes: {
+    attached: function () {
+      this.getProductName()
+    },
+    moved: function () { },
+    detached: function () { },
+  },
   methods:{
+    getProductName(){
+      app.requestP({
+        url: '/showApi/getProductList',
+        method: 'get',
+        needToken:false
+      }).then(res=>{
+        this.setData({
+          productList:res.data.data,
+          prductIndex:res.data.data[0]
+        })
+      }).catch(err=>{
+        app.showToptip(this,'error',err.data.msg);
+      })
+    },
     goPage1(){
       console.log(112)
       this.triggerEvent('goPage1', {}, {})

+ 3 - 3
pages/index/indexRight/indexRight.wxml

@@ -6,15 +6,15 @@
     </view>
     <view class="cptj_con">
       <view class="cptj_item">
-        <right-pie></right-pie>
+        <right-pie prductIndex="{{prductIndex}}"></right-pie>
       </view>
       <view class="cptj_item">
-        <right-bar1></right-bar1>
+        <right-bar1 prductIndex="{{prductIndex}}"></right-bar1>
       </view>
     </view>
     <view class="cptj_con">
       <view class="cptj_item">
-        <right-bar2></right-bar2>
+        <right-bar2 prductIndex="{{prductIndex}}"></right-bar2>
       </view>
     </view>
   </view>

+ 51 - 11
pages/index/indexRight/rightBar1/rightPie.js

@@ -6,13 +6,59 @@ Component({
   },
   lifetimes: {
     attached: function () {
-      this.init()
+      var token = wx.getStorageSync('token');
+      if(!token){
+        var list = [
+          {name:"支",data:[{name:"北京",value:30,},{name:"上海",value:30,},{name:"杭州",value:20,},{name:"天津",value:30,}]},
+          {name:"包",data:[{name:"北京",value:50,},{name:"上海",value:30,},{name:"杭州",value:30,},{name:"天津",value:30,}]},
+          {name:"箱",data:[{name:"北京",value:50,},{name:"上海",value:30,},{name:"杭州",value:30,},{name:"天津",value:30,}]},
+          {name:"托盘",data:[{name:"北京",value:50,},{name:"上海",value:30,},{name:"杭州",value:30,},{name:"天津",value:30,}]},
+        ]
+        this.init(list);
+      }
     },
     moved: function () { },
     detached: function () { },
   },
+  properties:{
+    prductIndex:{
+      type:String,
+      value:'',
+    }
+  },
+  observers:{
+    'prductIndex':function(nv,ol){
+      var token = wx.getStorageSync('token');
+      if(token && nv){
+        this.getCityPackageTypeState(nv);
+      }
+    }
+  },
   methods:{
-    init(){
+    getCityPackageTypeState(productName){
+      app.requestP({
+        url: '/daping/cityPackageTypeState?productName='+productName,
+        method: 'post',
+      }).then(res=>{
+        var packageType = [{name:'支',type:10},{name:'包',type:20},{name:'箱',type:30},{name:'托盘',type:40},{name:'其他',type:50}];
+        var datas = [];
+        for (var index = 0; index < packageType.length; index++) {
+          var types = [];
+          res.data.data.map((item,i)=>{
+            types.push({
+              name:item.city,value:item[packageType[index].type],
+            })
+            if(i == res.data.data.length-1){
+              datas.push(
+                {name:packageType[index].name, data:types}
+              )
+            }
+          })
+        }
+        this.initChart(datas);
+      })
+    },
+    initChart(list){
       var that = this;
       that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
         const chart = echarts.init(canvas, null, {
@@ -20,18 +66,12 @@ Component({
           height: height,
           devicePixelRatio: dpr
         });
-        var option = that.getOrderWarnOption();
+        var option = that.getOrderWarnOption(list);
         chart.setOption(option);
         return chart;
       });
     },
-    getOrderWarnOption(){
-      var list = [
-        {name:"支",data:[{name:"北京",value:30,},{name:"上海",value:30,},{name:"杭州",value:20,},{name:"天津",value:30,}]},
-        {name:"包",data:[{name:"北京",value:50,},{name:"上海",value:30,},{name:"杭州",value:30,},{name:"天津",value:30,}]},
-        {name:"箱",data:[{name:"北京",value:50,},{name:"上海",value:30,},{name:"杭州",value:30,},{name:"天津",value:30,}]},
-        {name:"托盘",data:[{name:"北京",value:50,},{name:"上海",value:30,},{name:"杭州",value:30,},{name:"天津",value:30,}]},
-      ]
+    getOrderWarnOption(list){
       var fontSize = 10
       var fontColor = "#999999"
       return {
@@ -86,7 +126,7 @@ Component({
             fontSize:fontSize,
             color:fontColor,
           },
-          data: list[0].data.map(item=>item.name)
+          data:list.length ? list[0].data.map(item=>item.name) : []
         },
 			  series:this.setOptItem(list),
       }

+ 52 - 10
pages/index/indexRight/rightBar2/index.js

@@ -6,13 +6,60 @@ Component({
   },
   lifetimes: {
     attached: function () {
-      this.init()
+      
+      var token = wx.getStorageSync('token');
+      if(!token){
+        var list = [
+          {name:"已使用",data:[{name:"2022",value:35,},{name:"2021",value:30,},{name:"2020",value:20,},{name:"2019",value:30,}]},
+          {name:"未使用",data:[{name:"2022",value:50,},{name:"2021",value:30,},{name:"2020",value:30,},{name:"2019",value:30,}]},
+          {name:"不良率",data:[{name:"2022",value:10,},{name:"2021",value:5,},{name:"2020",value:10,},{name:"2019",value:10,}]},
+        ]
+        this.initChart(list);
+      }
     },
     moved: function () { },
     detached: function () { },
   },
+  properties:{
+    prductIndex:{
+      type:String,
+      value:'',
+    }
+  },
+  observers:{
+    'prductIndex':function(nv,ol){
+      var token = wx.getStorageSync('token');
+      if(token && nv){
+        this.getYearStatusStateList(nv);
+      }
+    }
+  },
   methods:{
-    init(){
+    getYearStatusStateList(productName){
+      app.requestP({
+        url: '/daping/yearStatusState?productName=',
+        method: 'post',
+      }).then(res=>{
+        console.log(res.data.data);
+        var yearType = [{name:'已使用',type:'use'},{name:'未使用',type:'unuse'},{name:'不良率',type:'fail'}];
+        var datas = [];
+        for (var index = 0; index < yearType.length; index++) {
+          var types = [];
+          res.data.data.map((item,i)=>{
+            types.push({
+              name:item.year,value:item[yearType[index].type],
+            })
+            if(i == res.data.data.length-1){
+              datas.push(
+                {name:yearType[index].name, data:types}
+              )
+            }
+          })
+        }
+        this.initChart(datas)
+      })
+    },
+    initChart(list){
       var that = this;
       that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
         const chart = echarts.init(canvas, null, {
@@ -20,17 +67,12 @@ Component({
           height: height,
           devicePixelRatio: dpr
         });
-        var option = that.getOrderWarnOption();
+        var option = that.getOrderWarnOption(list);
         chart.setOption(option);
         return chart;
       });
     },
-    getOrderWarnOption(){
-      var list = [
-        {name:"已使用",data:[{name:"2022",value:35,},{name:"2021",value:30,},{name:"2020",value:20,},{name:"2019",value:30,}]},
-        {name:"未使用",data:[{name:"2022",value:50,},{name:"2021",value:30,},{name:"2020",value:30,},{name:"2019",value:30,}]},
-        {name:"不良率",data:[{name:"2022",value:10,},{name:"2021",value:5,},{name:"2020",value:10,},{name:"2019",value:10,}]},
-      ]
+    getOrderWarnOption(list){
       var fontSize = 10
       var fontColor = "#999999"
       return {
@@ -113,7 +155,7 @@ Component({
             fontSize:fontSize,
             color:fontColor,
           },
-          data: list[0].data.map(item=>item.name)
+          data: list.length? list[0].data.map(item=>item.name) : []
         },
 			  series:this.setOptItem(list),
       }

+ 23 - 5
pages/index/indexRight/rightBar3/index.js

@@ -6,13 +6,32 @@ Component({
   },
   lifetimes: {
     attached: function () {
-      this.init()
+      var token = wx.getStorageSync('token');
+      if(token){
+        this.getProductTypeStateList();
+      }else{
+        var list = [{name:"生化诊断",value:50,},{name:"免疫诊断",value:30,},{name:"分子诊断",value:30,},{name:"血液检测",value:30,}]
+        this.init(list);
+      }
     },
     moved: function () { },
     detached: function () { },
   },
   methods:{
-    init(){
+    getProductTypeStateList(){
+      app.requestP({
+        url: '/daping/productTypeState',
+        method: 'post',
+      }).then(res=>{
+        var statisticProductList = res.data.data.map(item=>{
+          var name = item.product_type_name || 'N/A';
+          name = name.length > 5 ? name.slice(0,2)+'...':name;
+          return {...item,name,value:item.num}
+        });
+        this.init(statisticProductList);
+      })
+    },
+    init(list){
       var that = this;
       that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
         const chart = echarts.init(canvas, null, {
@@ -20,13 +39,12 @@ Component({
           height: height,
           devicePixelRatio: dpr
         });
-        var option = that.getOrderWarnOption();
+        var option = that.getOrderWarnOption(list);
         chart.setOption(option);
         return chart;
       });
     },
-    getOrderWarnOption(){
-      var list = [{name:"生化诊断",value:50,},{name:"免疫诊断",value:30,},{name:"分子诊断",value:30,},{name:"血液检测",value:30,}]
+    getOrderWarnOption(list){
       var fontSize = 10
       var fontColor = "#999999"
       return {

+ 20 - 5
pages/index/indexRight/rightHuan/index.js

@@ -6,13 +6,29 @@ Component({
   },
   lifetimes: {
     attached: function () {
-      this.init()
+      var token = wx.getStorageSync('token');
+      if(token){
+        this.getRetransProductState();
+      }else{
+        var list = [{name:"追溯产品",value:999,},{name:"非追溯产品",value:666,},]
+        this.init(list);
+      }
     },
     moved: function () { },
     detached: function () { },
   },
   methods:{
-    init(){
+    getRetransProductState(){
+      app.requestP({
+        url: '/daping/retransProductState?productName=',
+        method: 'post',
+      }).then(res=>{
+        var data = res.data.data[0];
+        var list = [{name:"追溯产品",value:data.zs,},{name:"非追溯产品",value:data.normal,},]
+        this.init(list);
+      })
+    },
+    init(list){
       var that = this;
       that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
         const chart = echarts.init(canvas, null, {
@@ -20,13 +36,12 @@ Component({
           height: height,
           devicePixelRatio: dpr
         });
-        var option = that.getOrderWarnOption();
+        var option = that.getOrderWarnOption(list);
         chart.setOption(option);
         return chart;
       });
     },
-    getOrderWarnOption(){
-      var list = [{name:"追溯产品",value:999,},{name:"非追溯产品",value:666,},]
+    getOrderWarnOption(list){
       var fontSize = 10
       var fontColor = "#999999"
       return {

+ 40 - 12
pages/index/indexRight/rightLine1/index.js

@@ -6,13 +6,47 @@ Component({
   },
   lifetimes: {
     attached: function () {
-      this.init()
+      var token = wx.getStorageSync('token');
+      if(token){
+        this.getYearProduceSatateList();
+      }else{
+        var list = [
+          {name:"生产",data:[{name:"2022",value:30,},{name:"2021",value:30,},{name:"2020",value:20,},{name:"2019",value:30,}]},
+          {name:"销售",data:[{name:"2022",value:50,},{name:"2021",value:30,},{name:"2020",value:30,},{name:"2019",value:30,}]},
+          {name:"在途",data:[{name:"2022",value:50,},{name:"2021",value:30,},{name:"2020",value:30,},{name:"2019",value:30,}]},
+          {name:"交付",data:[{name:"2022",value:50,},{name:"2021",value:30,},{name:"2020",value:30,},{name:"2019",value:30,}]},
+        ]
+        this.init(list);
+      }
     },
     moved: function () { },
     detached: function () { },
   },
   methods:{
-    init(){
+    getYearProduceSatateList(){
+      app.requestP({
+        url: '/daping/yearProduceSatate',
+        method: 'post',
+      }).then(res=>{
+        var orderType = [{name:'生产',type:'produce'},{name:'销售',type:'sell'},{name:'在途',type:'trans'},{name:'交付',type:'end'}];
+        var datas = [];
+        for (var index = 0; index < orderType.length; index++) {
+          var types = [];
+          res.data.data.map((item,i)=>{
+            types.push({
+              name:item.year,value:item[orderType[index].type],
+            })
+            if(i == res.data.data.length-1){
+              datas.push(
+                {name:orderType[index].name, data:types}
+              )
+            }
+          })
+        }
+        this.init(datas)
+      })
+    },
+    init(list){
       var that = this;
       that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
         const chart = echarts.init(canvas, null, {
@@ -20,18 +54,12 @@ Component({
           height: height,
           devicePixelRatio: dpr
         });
-        var option = that.getOrderWarnOption();
+        var option = that.getOrderWarnOption(list);
         chart.setOption(option);
         return chart;
       });
     },
-    getOrderWarnOption(){
-      var list = [
-        {name:"生产",data:[{name:"2022",value:30,},{name:"2021",value:30,},{name:"2020",value:20,},{name:"2019",value:30,}]},
-        {name:"销售",data:[{name:"2022",value:50,},{name:"2021",value:30,},{name:"2020",value:30,},{name:"2019",value:30,}]},
-        {name:"在途",data:[{name:"2022",value:50,},{name:"2021",value:30,},{name:"2020",value:30,},{name:"2019",value:30,}]},
-        {name:"交付",data:[{name:"2022",value:50,},{name:"2021",value:30,},{name:"2020",value:30,},{name:"2019",value:30,}]},
-      ]
+    getOrderWarnOption(list){
       var fontSize = 10
       var fontColor = "#999999"
       return {
@@ -60,9 +88,9 @@ Component({
           }
         },
         legend:{
-          show:0,
+          show:true,
           icon:"circle",
-          right:'10%',
+          right:'',
           top:0,
           itemWidth:fontSize*0.8,
           itemHeight:fontSize*0.8,

+ 23 - 5
pages/index/indexRight/rightLine2/index.js

@@ -6,13 +6,32 @@ Component({
   },
   lifetimes: {
     attached: function () {
-      this.init()
+      var token = wx.getStorageSync('token');
+      if(token){
+        this.getProductStateList();
+      }else{
+        var list = [{name:"生化诊断",value:50,},{name:"免疫诊断",value:30,},{name:"分子诊断",value:30,},{name:"血液检测",value:30,}]
+        this.init(list)
+      }
     },
     moved: function () { },
     detached: function () { },
   },
   methods:{
-    init(){
+    getProductStateList(){
+      app.requestP({
+        url: '/daping/productState',
+        method: 'post',
+      }).then(res=>{
+        var statisticProductLine = res.data.data.map(item=>{
+          var name = item.product_name || 'N/A';
+          name = name.length > 5 ? name.slice(0,2)+'...':name;
+          return {...item,name,value:item.num}
+        });
+        this.init(statisticProductLine);
+      })
+    },
+    init(list){
       var that = this;
       that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
         const chart = echarts.init(canvas, null, {
@@ -20,13 +39,12 @@ Component({
           height: height,
           devicePixelRatio: dpr
         });
-        var option = that.getOrderWarnOption();
+        var option = that.getOrderWarnOption(list);
         chart.setOption(option);
         return chart;
       });
     },
-    getOrderWarnOption(){
-      var list = [{name:"生化诊断",value:50,},{name:"免疫诊断",value:30,},{name:"分子诊断",value:30,},{name:"血液检测",value:30,}]
+    getOrderWarnOption(list){
       var fontSize = 10
       var fontColor = "#999999"
       return {

+ 33 - 5
pages/index/indexRight/rightPie/rightPie.js

@@ -6,13 +6,41 @@ Component({
   },
   lifetimes: {
     attached: function () {
-      this.init()
+      var token = wx.getStorageSync('token');
+      if(!token){
+        var list = [{name:"追溯产品",value:999,},{name:"非追溯产品",value:666,},]
+        this.initChart(list);
+      }
     },
     moved: function () { },
     detached: function () { },
   },
+  properties:{
+    prductIndex:{
+      type:String,
+      value:'',
+    }
+  },
+  observers:{
+    'prductIndex':function(nv,ol){
+      var token = wx.getStorageSync('token');
+      if(token && nv){
+        this.getRetransProductState(nv);
+      }
+    }
+  },
   methods:{
-    init(){
+    getRetransProductState(productName){
+      app.requestP({
+        url: '/daping/retransProductState?productName='+productName,
+        method: 'post',
+      }).then(res=>{
+        var data = res.data.data[0];
+        var list = [{name:"追溯产品",value:data.zs,},{name:"非追溯产品",value:data.normal,},]
+        this.initChart(list);
+      })
+    },
+    initChart(list){
       var that = this;
       that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
         const chart = echarts.init(canvas, null, {
@@ -20,13 +48,13 @@ Component({
           height: height,
           devicePixelRatio: dpr
         });
-        var option = that.getOrderWarnOption();
+        var option = that.getOrderWarnOption(list);
         chart.setOption(option);
         return chart;
       });
     },
-    getOrderWarnOption(){
-      var list = [{name:"追溯产品",value:999,},{name:"非追溯产品",value:666,},]
+    getOrderWarnOption(list){
+      
       var fontSize = 10
       var fontColor = "#999999"
       return {