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.

317 lines
7.2 KiB

5 months ago
<template>
<div class="throm-before3">
<a-card style="width:100%" :tab-list="tabList" :active-tab-key="activeTabKey"
@tabChange="key => onTabChange(key, 'key')">
5 months ago
<div class="image-container" v-if="activeTabKey == 'tab1'">
5 months ago
<throm-interfere-image-dcm :firstAidId="patientData?.firstAidId"></throm-interfere-image-dcm>
5 months ago
</div>
<div class="image-container" v-else-if="activeTabKey == 'ct'">
5 months ago
<template v-if="fileList && fileList.length">
<div class="image-box" v-for="(img, index) in fileList">
4 months ago
<img :src="imgUrl+ img" :alt="'ct'+index" />
5 months ago
</div>
</template>
<div class="emtpy" v-else>
5 months ago
<a-empty :image="emptyImage" description="暂无数据" />
5 months ago
</div>
</div>
</a-card>
5 months ago
<div class="throm-common-button " v-if="!outside">
<!-- <w-upload @ok="handleUpload" btn-type="button" btn-text="上传院前CT图片"
v-if="fileList.length < 5" /> -->
<a-button :disabled="writeAble" class="" block size="large" v-if="fileList.length < 5"
@click="openCamera">上传院前CT图片</a-button>
<a-button :disabled="writeAble" class="" block type="primary" size="large"
5 months ago
@click="onSubmit">下一步</a-button>
</div>
</div>
</template>
<script>
import {
mapState
} from 'vuex';
import {
4 months ago
apiUrl, imgUrl
5 months ago
} from '@/config/setting.js';
import emptyImage from '@/assets/images/slice/empty.png'
5 months ago
import ThromInterfereImageDcm from './throm-interfere-image-dcm.vue'
5 months ago
import WUpload from '@/components/w-upload/w-upload.vue'
5 months ago
import {
queryFirstAidInspectData,
queryVideo
} from 'api';
export default {
name: 'ThromBefore3',
data() {
return {
apiUrl,
4 months ago
imgUrl,
5 months ago
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'],
5 months ago
components: {
5 months ago
ThromInterfereImageDcm,
WUpload
5 months ago
},
5 months ago
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
}
},
5 months ago
handleUpload({
name,
url
}) {
console.log('upload end', 'http://116.204.114.73:20007' + url) //_doc/upload/
this.fileList.push(url);
const index = this.tabList.findIndex(a => a.key == 'ct')
this.tabList[index].tab = `院前CT (${this.fileList.length}张)`
},
5 months ago
openCamera() {
if (this.writeAble) {
this.$message.success('患者已审核,内容不可更改')
return
}
const cmr = plus.camera.getCamera();
5 months ago
if (!cmr) {
5 months ago
this.$message.success('没有可用的摄像头');
return;
5 months ago
}
5 months ago
const res = cmr.supportedImageResolutions[0]; // 默认分辨率;
const fmt = cmr.supportedImageFormats[0];
5 months ago
if (!res || !fmt) {
5 months ago
plus.nativeUI.toast('摄像头不支持该格式或分辨率');
return;
5 months ago
}
5 months ago
cmr.captureImage(
(path) => {
5 months ago
// console.log('captureImage', path)
5 months ago
plus.io.resolveLocalFileSystemURL(
path,
(entry) => {
//压缩图片
this.compressImage(entry.toLocalURL(), entry.name);
},
(e) => {
plus.nativeUI.toast(
'读取拍照文件错误:' + e.message
);
}
);
},
(error) => {
// alert("Capture image failed: " + error.message);
}, {
5 months ago
resolution: "640*480",
format: "jpg",
5 months ago
filter: 'image',
}
);
5 months ago
5 months ago
},
//压缩图片
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('压缩图片失败,请稍候再试');
}
);
},
5 months ago
onFileChange(event) {
5 months ago
const file = event.target.files[0];
if (file) {
// 处理图片文件
this.compressImage(file);
}
5 months ago
},
5 months ago
//显示图片
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;
5 months ago
// font-size: 2rem;
5 months ago
}
.emtpy {
height: 30vh;
display: flex;
justify-content: center;
align-items: center;
}
5 months ago
.image-box {
padding: .5rem;
box-sizing: border-box;
img {
width: 100%;
height: 100%;
}
}
5 months ago
}
.btns {
5 months ago
// margin-top: 2rem;
5 months ago
}
}
</style>
<style lang="less">
.throm-before3 {
.ant-empty-description {
color: #AAAAAA;
}
}
</style>