| | |
| | | }); |
| | | |
| | | } |
| | | let files = []; |
| | | |
| | | //20250416 添加打印按鈕 |
| | | document.getElementById('cameraBtn').addEventListener('tap', function() { |
| | | selectPhoto(); |
| | | }); |
| | | const mid = order; // 检验单号 |
| | | const pid = fdid; // 当前项目 ID |
| | | |
| | | function selectPhoto() { |
| | | if (mui.os.plus) { |
| | | plus.nativeUI.actionSheet({ |
| | | title: "选择操作", |
| | | cancel: "取消", |
| | | buttons: [{ title: "拍照" }, { title: "从相册选择" }] |
| | | }, function(b) { |
| | | if (b.index === 1) captureImage(); |
| | | if (b.index === 2) pickGalleryImages(); |
| | | }); |
| | | } |
| | | } |
| | | // if (!mid || !pid) { |
| | | // mui.toast("请先确认检验项目"); |
| | | // return; |
| | | // } |
| | | |
| | | function captureImage() { |
| | | const cmr = plus.camera.getCamera(); |
| | | cmr.captureImage(function(path) { |
| | | plus.io.resolveLocalFileSystemURL(path, function(entry) { |
| | | const url = entry.toLocalURL(); |
| | | files.push(url); |
| | | mui.toast("已添加拍照"); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | function pickGalleryImages() { |
| | | plus.gallery.pick(function(e) { |
| | | e.files.forEach(path => { |
| | | files.push(path); |
| | | }); |
| | | mui.toast("已选择相册图片"); |
| | | }, { multiple: true }); |
| | | } |
| | | |
| | | function uploadImages() { |
| | | const url = storage["_basePath"] + 'ht_file/uploadFilepqc'; |
| | | const task = plus.uploader.createUpload(url, { method: 'POST' }, function(t, status) { |
| | | if (status === 200) { |
| | | mui.toast('照片上传成功'); |
| | | } else { |
| | | mui.toast('照片上传失败'); |
| | | mui.openWindow({ |
| | | id: 'pictrue_add', |
| | | url: 'ftp/pictrue_add.html?mid=' + mid + '&pid=' + pid, |
| | | waiting: { |
| | | autoShow: true, |
| | | title: '加载中' |
| | | } |
| | | }); |
| | | |
| | | files.forEach((file, i) => { |
| | | task.addFile(file, { key: `file${i}` }); |
| | | }); |
| | | |
| | | task.addData('checkNo', order); |
| | | task.addData('pid', fdid); |
| | | task.addData('userNo', api_localStorageGet("code")); |
| | | task.addData('remark', $("#remark").val()); |
| | | |
| | | task.start(); |
| | | } |
| | | }); |
| | | |
| | | </script> |
| | | </body> |