You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

267 lines
5.9 KiB

<template>
<div class="throm-before3">
<a-card style="width:100%" :tab-list="tabList" :active-tab-key="activeTabKey"
@tabChange="key => onTabChange(key, 'key')">
<div class="image-container">
<!-- <div class="notImg">单次检验影像安全区域</div> -->
<div v-if="list.length">
<img :src="apiUrl+ img.path" :alt="img.name" v-for="img in list" style="width: 100%;" />
</div>
<div class="emtpy" v-else>
<a-empty :image="emptyImage" description="未检测到影像信息" />
</div>
</div>
</a-card>
<div class="btns" v-if="!outside">
<a-button :disabled="writeAble" class="common-button" block size="large" v-if="fileList.length < 5"
@click="openCamera">上传院前CT图片</a-button>
<a-button :disabled="writeAble" class="common-button" block type="primary" size="large"
@click="onSubmit">下一步</a-button>
</div>
</div>
</template>
<script>
import {
mapState
} from 'vuex';
import {
apiUrl
} from '@/config/setting.js';
import emptyImage from '@/assets/images/slice/empty.png'
import {
queryFirstAidInspectData,
queryVideo
} from 'api';
export default {
name: 'ThromBefore3',
data() {
return {
apiUrl,
emptyImage,
activeTabKey: 'tab1',
previewVisible: false,
previewImage: '',
fileList: [],
list: [],
tabList: [{
key: 'tab1',
tab: '影像',
},
// {
// key: 'tab2',
// tab: '影像2',
// },
// {
// key: 'tab3',
// tab: '影像3',
// },
{
key: 'ct',
tab: '院前CT(0张)',
},
],
}
},
props: ['outside'],
components: {},
computed: {
...mapState('patient', ['patientData', 'writeAble']),
},
mounted() {
const {
recordValDict
} = this.patientData;
if (recordValDict) {
this.$nextTick(() => {
this.echo(recordValDict);
});
}
},
created() {
this.queryVideo()
},
methods: {
echo(data) {
if (data['JMRS-YQ-CT']) {
const {
answer
} = data['JMRS-YQ-CT'][0];
this.fileList = answer;
}
},
del(index) {
if (this.writeAble) {
this.$message.success('患者已审核,内容不可更改')
return
}
this.fileList.splice(index, 1);
},
handleCancel() {
this.previewVisible = false;
},
async handlePreview(path) {
this.previewImage = path;
this.previewVisible = true;
},
async queryVideo() {
const res = await queryVideo({
firstAidId: this.patientData.firstAidId,
type: 0
})
// let res = await queryFirstAidInspectData({
// firstAidId: this.patientData.firstAidId
// });
const {
data,
code,
msg
} = res;
if (code === 200) {
// this.setVideo(data.list);
this.list = data.list
}
},
openCamera() {
if (this.writeAble) {
this.$message.success('患者已审核,内容不可更改')
return
}
const cmr = plus.camera.getCamera();
const res = cmr.supportedImageResolutions[0];
const fmt = cmr.supportedImageFormats[0];
cmr.captureImage(
(path) => {
plus.io.resolveLocalFileSystemURL(
path,
(entry) => {
//压缩图片
this.compressImage(entry.toLocalURL(), entry.name);
},
(e) => {
plus.nativeUI.toast(
'读取拍照文件错误:' + e.message
);
}
);
},
(error) => {
// alert("Capture image failed: " + error.message);
}, {
resolution: res,
format: fmt,
filter: 'image',
}
);
},
//压缩图片
compressImage(url, filename) {
var name = '_doc/upload/' + filename;
plus.zip.compressImage({
src: url, //src: (String 类型 )压缩转换原始图片的路径
dst: name, //压缩转换目标图片的路径
quality: 90, //quality: (Number 类型 )压缩图片的质量.取值范围为1-100
overwrite: true, //overwrite: (Boolean 类型 )覆盖生成新文件
width: '250',
height: '320',
},
(zip) => {
//页面显示图片
this.showPics(zip.target, name);
},
(error) => {
plus.nativeUI.toast('压缩图片失败,请稍候再试');
}
);
},
//显示图片
showPics(url, name) {
let _this = this;
//根据路径读取到文件
plus.io.resolveLocalFileSystemURL(url, (entry) => {
entry.file((file) => {
var fileReader = new plus.io.FileReader();
fileReader.readAsDataURL(file);
fileReader.onloadend = (e) => {
var picUrl = e.target.result.toString();
this.uploadBase64(picUrl, file.name);
};
});
});
},
// 上传成功回
async uploadBase64(base64, fileName) {
if (!base64) return '您还未选择图片';
let res = await uploadBase64({
base64,
fileName,
});
const {
realPath,
code,
msg
} = res;
if (code === 200) {
this.fileList.push(realPath);
const index = this.tabList.findIndex(a => a.key == 'ct')
this.tabList[index].tab = `院前CT (${this.fileList.length}张)`
} else {
this.$message.error(res.msg);
}
},
async onSubmit(e) {
e.preventDefault();
let codeAndAnswerList = [];
codeAndAnswerList.push({
questionCode: 'JMRS-YQ-CT',
answer: this.fileList,
time: '',
});
await this.home.updateAidCode({
codeAndAnswerList,
}, false);
this.$emit('next')
},
onTabChange(key, type) {
this.activeTabKey = key;
},
}
}
</script>
<style lang="less" scoped>
.throm-before3 {
.image-container {
min-height: 30vh;
.notImg {
background-color: #000000;
color: #ffffff;
text-align: center;
line-height: 40vh;
font-size: 2rem;
}
.emtpy {
height: 30vh;
display: flex;
justify-content: center;
align-items: center;
}
}
.btns {
margin-top: 2rem;
}
}
</style>
<style lang="less">
.throm-before3 {
.ant-empty-description {
color: #AAAAAA;
}
}
</style>