YYC
2023-06-09 5132d695e4edc00e2a80f7bf40b5164be34e9499
igds-app/js/admin/inout-out-record.js
@@ -25,17 +25,17 @@
   dateTime = getDate(new Date());
   $("#dateTime").val(dateTime);
   //获取入库记录
   //获取出库记录
   getOutRecordList();
}
//查询入库记录
//查询出库记录
function getOutRecordList() {
   outRecordData = null;
   
   //赋值参数的日期
   data.data.dateTime = dateTime;
   console.log(JSON.stringify(data.data), "inout-out-record")
   //请求
   mui.ajax(url, {
      type: "POST",
@@ -45,27 +45,52 @@
      data: JSON.stringify(data),
      success: function(result) {
         if (result.code == "0000") {
            console.log(JSON.stringify(result))
            outRecordData = result.data;
            renderData();
         } else {
            renderData();
            mui.toast(result.mag);
            renderData();
         }
      },
      error: function() {
         mui.alert("系统繁忙,请重试!", "提示", ["确定"], function() {}, "div")
      }
   })
   // outRecordData = {
   //    "sum": "55",
   //    "listInout": [{
   //          "id": "98",
   //          "plateNum": "39",
   //          "depotId": "83",
   //          "depotName": "能始际法高等",
   //          "foodVariety": "quis Ut",
   //          "foodVarietyName": "被龙济来",
   //          "recordWeight": "25",
   //          "completeTime": "1971-10-20 14:45:38"
   //       },
   //       {
   //          "id": "37",
   //          "plateNum": "50",
   //          "depotId": "16",
   //          "depotName": "准民青共工",
   //          "foodVariety": "aliquip eiusmod laborum nulla",
   //          "foodVarietyName": "号走根形",
   //          "recordWeight": "30",
   //          "completeTime": "1971-04-09 06:42:06"
   //       }
   //    ],
   // }
}
//渲染页面
function renderData() {
   var html = '';
   var sumHtml = '0';
   if(outRecordData){
      sumHtml = outRecordData.sum;
      console.log()
      var outRecordList = outRecordData.listInout;
      if (outRecordList && outRecordList.length > 0) {
         $.each(outRecordList, function(index, item) {
@@ -75,18 +100,18 @@
            html += '<li><div class="con" style="background-image: url(images/icons/g-i24.png);">';
            html += '车牌号:<b>' + (item.plateNum == null ? "" : item.plateNum) + '</b></div></li>';
            html += '<li><div class="con" style="background-image: url(images/icons/g-i25.png);">';
            html += '仓库名称:<b>' + (item.depotId == null ? "" : item.depotId) + '</b></div></li>';
            html += '仓库名称:<b>' + (item.depotName == null ? "" : item.depotName) + '</b></div></li>';
            html += '<li><div class="con" style="background-image: url(images/icons/g-i32.png);">';
            html += '粮食品种:<b>' + (item.foodVariety == null ? "" : item.foodVariety) + '</b></div></li>';
            html += '粮食品种:<b>' + (item.foodVarietyName == null ? "" : item.foodVarietyName) + '</b></div></li>';
            html += '<li><div class="con" style="background-image: url(images/icons/g-i24.png);">';
            html += '结算重量:<span><em>' + (item.recordWeight == null ? "0" : item.recordWeight) + '</em>KG</span></div></li>';
            html += '</ul><div class="time">完成时间:' + getStrDate(item.completeTime) + '</div></div>';
         })
      } else {
         html += '<div class="id" style="text-align: center;font-size: 20px;color:#dd524d">所选日期暂无入库记录信息</div>';
         html += '<div class="id" style="text-align: center;font-size: 20px;color:#dd524d">所选日期暂无出库记录信息</div>';
      }
   }else{
      html += '<div class="id" style="text-align: center;font-size: 20px;color:#dd524d">所选日期暂无入库记录信息</div>';
      html += '<div class="id" style="text-align: center;font-size: 20px;color:#dd524d">所选日期暂无出库记录信息</div>';
   }
   $("#sum").html(sumHtml);
   $("#recordList").html(html);
@@ -107,14 +132,17 @@
//选择日期
function chooseDate() {
   var dtpicker = new mui.DtPicker({
      type: "date" //设置日历初始视图模式
      type: "date" ,//设置日历初始视图模式
      value: dateTime
   })
   var time = dateTime
   dtpicker.show(function(e) {
      dateTime = e.value;
      $("#dateTime").val(dateTime);
      if(time != dateTime){
         getOutRecordList();
      }
   })
   getOutRecordList();
}
//默认获取当前日期(yyyy-MM-dd)