YYC
2023-05-10 4eb67cf34eb65f8a1365287b15a756d1a0f0fe7e
igds-app/js/admin/inout-out-handle.js
@@ -65,7 +65,7 @@
         contentType: "application/json;charset=utf-8",
         data: JSON.stringify(data),
         success: function(result) {
            if (result.data.code == '0000') {
            if (result.code == '0000') {
               //判断该值仓是否处于在值仓状态
               if (result.data.progress == 'HANDLE') {
                  //判断单子是否已经开始进行值仓
@@ -110,7 +110,7 @@
         contentType: "application/json;charset=utf-8",
         data: JSON.stringify(data),
         success: function(result) {
            if (result.data.code == '0000') {
            if (result.code == '0000') {
               //判断该值仓是否处于在值仓状态
               if (result.data.progress == 'HANDLE') {
                  //判断单子是否已经开始进行值仓
@@ -165,75 +165,87 @@
}
//拍照上传
function choosePic(typeNum) {
   //获取定位信息
   // //获取定位信息
   // if (latitude == null || longitude == null) {
   //    return;
   // }
   //上传图片前,请求查看单子是都已经开始卸粮
   // mui.ajax(url, {
   //    type: "POST",
   //    dataType: "json",
   //    crossDomain: true,
   //    contentType: "application/json;charset=utf-8",
   //    data: JSON.stringify(data),
   //    success: function(result) {
   //       if (result.code == '0000') {
   //          if (result.data.handleStart != null) {
   //             var btnArray = [{
   //                title: "拍照上传"
   //             }, {
   //                title: "从相册选择"
   //             }];
   //             plus.nativeUI.actionSheet({
   //                   title: "请选择",
   //                   cancel: "取消",
   //                   buttons: btnArray
   //                },
   //                function(e) {
   //                   var index = e.index;
   //                   switch (index) {
   //                      case 1:
   //                         cameraImg(typeNum);
   //                         break;
   //                      case 2:
   //                         galleryImg(typeNum);
   //                         break;
   //                   }
   //                });
   //          } else {
   //             mui.toast("请先点击开始装粮!");
   //          }
   //       } else {
   //          mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
   //       }
   //    },
   //    error: function() {
   //       mui.alert('系统繁忙,请重试!', '提示', ["确定"], function() {}, "div");
   // 上传图片前,请求查看单子是都已经开始卸粮
   mui.ajax(url, {
      type: "POST",
      dataType: "json",
      crossDomain: true,
      contentType: "application/json;charset=utf-8",
      data: JSON.stringify(data),
      success: function(result) {
         if (result.code == '0000') {
            if (result.data.handleStart != null) {
               var btnArray = [{
                  title: "拍照上传"
               }, {
                  title: "从相册选择"
               }];
               plus.nativeUI.actionSheet({
                     title: "请选择",
                     cancel: "取消",
                     buttons: btnArray
                  },
                  function(e) {
                     var index = e.index;
                     switch (index) {
                        case 1:
                           cameraImg(typeNum);
                           break;
                        case 2:
                           galleryImg(typeNum);
                           break;
                     }
                  });
               var picker = new mui.PopPicker();
               picker.setData([{
                  value: "cameraImg",
                  text: "拍照上传"
               }, {
                  value: "galleryImg",
                  text: "从相册选择"
               }])
               picker.show(function(SelectedItem) {
                  console.log(JSON.stringify(SelectedItem));
                  if (SelectedItem == 'cameraImg') {
                     cameraImg(typeNum);
                  } else {
                     galleryImg(typeNum);
                  }
               })
            } else {
               mui.toast("请先点击开始装粮!");
            }
         } else {
            mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
         }
      },
      error: function() {
         mui.alert('系统繁忙,请重试!', '提示', ["确定"], function() {}, "div");
      }
   })
   // var picker = new mui.PopPicker();
   // picker.setData([{
   //    value: "cameraImg",
   //    text: "拍照上传"
   // }, {
   //    value: "galleryImg",
   //    text: "从相册选择"
   // }])
   // picker.show(function(SelectedItem) {
   //    console.log(JSON.stringify(SelectedItem));
   //    if (SelectedItem == 'cameraImg') {
   //       cameraImg(typeNum);
   //    } else {
   //       galleryImg(typeNum);
   //    }
   // })
   var btnArray = [{
      title: "拍照上传"
   }, {
      title: "从相册选择"
   }];
   plus.nativeUI.actionSheet({
         title: "请选择",
         cancel: "取消",
         buttons: btnArray
      },
      function(e) {
         var index = e.index;
         switch (index) {
            case 1:
               cameraImg(typeNum);
               break;
            case 2:
               galleryImg(typeNum);
               break;
         }
      });
};
//使用相机拍照
@@ -245,10 +257,10 @@
         var path = entry.toLocalURL(); //获得图片路径
         uploadImg(path, typeNum);
      }, function(e) {
         mui.toast("读取拍照图片错误,请重试!" + e.msg);
         mui.toast("读取拍照图片错误,请重试!");
      });
   }, function(e) {
      mui.toast("拍照失败,请重试!" + e.msg);
      mui.toast("拍照失败,请重试!");
   });
}
@@ -257,7 +269,7 @@
   plus.gallery.pick(function(path) {
      uploadImg(path, typeNum);
   }, function(e) {
      mui.toast("没有选择图片" + e.msg);
      mui.toast("没有选择图片");
   });
}
@@ -275,13 +287,13 @@
            var obj = JSON.parse(t.responseText);
            mui.toast("上传成功!");
            if (typeNum == "1") {
               html += '<img src="'+path+'">'
               html += '<img src="' + path + '">'
               $("#boxImg1").html(html);
               base64Img1 = path;
               fileName1 = obj.data.fileName;
            }
            if (typeNum == "2") {
               html += '<img src="'+path+'">'
               html += '<img src="' + path + '">'
               $("#boxImg2").html(html);
               base64Img2 = path;
               fileName2 = obj.data.fileName;