检测报告查看

This commit is contained in:
zzyuan 2024-08-16 15:33:08 +08:00
parent 5d7df4535e
commit 38fb681bcd
3 changed files with 54 additions and 13 deletions

View File

@ -132,7 +132,7 @@
</template>
<script>
import { getReportList,getReportDetailList,getToolsSelect} from '@/service/url.js';
import { getReportList,getReportDetailList,getToolsSelect,getReport} from '@/service/url.js';
import tabHeader from '@/components/tab-Header.vue';
import eselect from '@/components/eselect.vue';
import searchSelect from '@/components/search-select.vue';
@ -174,12 +174,16 @@
},
methods: {
//
goOriginalData(){
//
goOriginalData(row){
// console.log(row,'row----')
let obj = {
"id":68,
"id":row.id,
"isHg":row.isHg,
"departmentId":row.departmentId,
"sampleTools": row.sampleTools
}
let param = {
// encryptedData: AES.encrypt(JSON.stringify(obj))
encryptedData: JSON.stringify(obj)
@ -187,18 +191,57 @@
let option = {
contentType:'form-data',
}
this.$http.post(readExcel,param,false,option).then(res => {
this.$http.post(getReport,param,false,option).then(res => {
if (res) {
if(res.code == '200'){
this.toolsList=res.data
this.openExcelFromBase64(res.data)
console.log("执行到了");
}else{
this.toolsList=[]
}
}
}).catch(error => {
console.log(error)
})
},
openExcelFromBase64(base64Str) {
var fileName = (new Date()).valueOf() + '.xlsx';
// base64
let index = base64Str.indexOf(',');
base64Str = base64Str.slice(index + 1);
plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function (fs) {
fs.root.getFile(fileName, { create: true }, function (entry) {
const fullPath = entry.fullPath;
const platform = uni.getSystemInfoSync().platform;
if (platform === 'android') {
const Base64 = plus.android.importClass('android.util.Base64');
const FileOutputStream = plus.android.importClass('java.io.FileOutputStream');
try {
const out = new FileOutputStream(fullPath);
const bytes = Base64.decode(base64Str, Base64.DEFAULT);
out.write(bytes);
out.close();
plus.runtime.openFile(entry.toLocalURL());
} catch (e) {
console.error('Error writing file:', e.message);
}
} else if (platform === 'ios') {
const NSData = plus.ios.importClass('NSData');
const nsData = new NSData();
nsData.initWithBase64EncodedString_options(base64Str, 0);
if (nsData) {
nsData.plusCallMethod({ writeToFile: fullPath, atomically: true });
plus.ios.deleteObject(nsData);
}
plus.runtime.openFile(entry.toLocalURL());
}
});
});
},
//
customNavigateBack() {
//
@ -577,9 +620,6 @@
.visitor-form{
width: auto;
padding: 80rpx 20rpx;
}
.visitor-input-box{
}
.search-box{
width: 100%;

View File

@ -91,6 +91,7 @@ export const getReportList = '/szgqj/app/testReport/getList';
export const getReportDetailList = '/szgqj/app/testReport/getDetailsList';
export const getReport = '/szgqj/app/testReport/testReportExcelBase64';
//合格证

File diff suppressed because one or more lines are too long