更新
This commit is contained in:
parent
2ffecbe1d2
commit
37d65dd416
@ -93,7 +93,7 @@ export const caseplatformCaseApi = {
|
||||
return download('列表数据导出.xlsx',`/caseplatformCase/exportEasyExcel`, param);
|
||||
},
|
||||
exportSettlementExcel: (param) => {
|
||||
return download('结算数据导出.xlsx',`/caseplatformCase/settlementExcel`, param,'multipart/form-data');
|
||||
return download('结算数据导出.xlsx',`/caseplatformCase/settlementExcel`, param);
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@ -59,6 +59,8 @@ smartAxios.interceptors.response.use(
|
||||
location.href = '/';
|
||||
}, 300);
|
||||
return Promise.reject(response);
|
||||
}else if(res.code === 200){
|
||||
return Promise.resolve(res);
|
||||
}
|
||||
message.error(res.msg);
|
||||
return Promise.reject(response);
|
||||
|
||||
@ -307,7 +307,7 @@
|
||||
:width="200"
|
||||
:src="newSrc"
|
||||
/> -->
|
||||
<div class="save" @click="save">
|
||||
<div class="save" @click="saveEditor">
|
||||
<a-button type="primary" shape="round">
|
||||
<template #icon>
|
||||
<save-outlined />
|
||||
@ -315,7 +315,7 @@
|
||||
保存
|
||||
</a-button>
|
||||
</div>
|
||||
<imgEditor ref="imgEditorRef" :imgIndex="imgIndex" :caseId="current_caseId" :caseObj="caseVO" v-if="showEdit" @freshDetail="getDetail" :type="imgType"></imgEditor>
|
||||
<imgEditor ref="imgEditorRef" :dpmasId="current_dpmasId" :imgIndex="imgIndex" :caseId="current_caseId" :caseObj="caseVO" v-if="showEdit" @freshDetail="freshDetail" :imgType="imgType"></imgEditor>
|
||||
</div>
|
||||
</a-modal>
|
||||
</template>
|
||||
@ -343,6 +343,7 @@ const imgIndex = ref(0);
|
||||
const current_reason = ref();
|
||||
const current_caseId = ref();
|
||||
const imgType = ref('');
|
||||
const current_dpmasId = ref(0);
|
||||
const caseVO = ref({
|
||||
name: undefined,
|
||||
uid: undefined,
|
||||
@ -595,7 +596,10 @@ function cancelExamine() {
|
||||
cancelExamineVisible.value = true;
|
||||
}
|
||||
// ------------------------ 表单 ------------------------
|
||||
|
||||
const freshDetail=()=>{
|
||||
showEdit.value=false;
|
||||
getDetail(current_caseId.value)
|
||||
}
|
||||
async function getDetail(id) {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
@ -612,6 +616,7 @@ const openEditor = (data) => {
|
||||
showEdit.value = true;
|
||||
imgType.value = data.type;
|
||||
imgIndex.value = data.imgIndex;
|
||||
current_dpmasId.value = data.dpmasId;
|
||||
nextTick(() => {
|
||||
imgEditorRef.value?.init(data.src);
|
||||
});
|
||||
|
||||
@ -36,7 +36,11 @@ const props = defineProps({
|
||||
imgIndex:{
|
||||
type: Number,
|
||||
default: 0,
|
||||
}
|
||||
},
|
||||
dpmasId:{
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['openEditor']);
|
||||
const visible = ref(false);
|
||||
@ -47,7 +51,8 @@ const showeditor = () => {
|
||||
emits('openEditor', {
|
||||
src:props.src,
|
||||
type:props.type,
|
||||
imgIndex:props.imgIndex
|
||||
imgIndex:props.imgIndex,
|
||||
dpmasId:props.dpmasId
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -9,7 +9,9 @@ import 'tui-image-editor/dist/tui-image-editor.css';
|
||||
import 'tui-color-picker/dist/tui-color-picker.css';
|
||||
import ImageEditor from 'tui-image-editor';
|
||||
import { caseplatformCaseApi } from '/@/api/business/case/caseplatform-case-api';
|
||||
const prosp=defineProps({
|
||||
import { FileUtil } from '/@/utils/fileutil'
|
||||
import { SmartLoading } from '/@/components/framework/smart-loading';
|
||||
const props=defineProps({
|
||||
imgsrc:{
|
||||
type:String,
|
||||
default:''
|
||||
@ -23,12 +25,12 @@ const prosp=defineProps({
|
||||
default:''
|
||||
},
|
||||
dpmasId:{
|
||||
type:String,
|
||||
default:'',
|
||||
type:Number,
|
||||
default:0,
|
||||
},
|
||||
caseId:{
|
||||
type:String,
|
||||
default:'',
|
||||
type:Number,
|
||||
default:0,
|
||||
},
|
||||
caseObj:{
|
||||
type:Object,
|
||||
@ -198,13 +200,18 @@ const HandleMainDiagnoseImg=()=>{
|
||||
obj.mainDiagnoseImg=uploadImgSrc.value;
|
||||
|
||||
caseplatformCaseApi.updateMainDiagnose({
|
||||
caseId:current_caseId.value,
|
||||
caseId:props.caseId,
|
||||
mainDiagnose:JSON.stringify(obj)
|
||||
}).then(res=>{
|
||||
message.success('保存成功')
|
||||
emit('freshDetail')
|
||||
SmartLoading.hide();
|
||||
message.success('保存成功');
|
||||
}).catch(err=>{
|
||||
SmartLoading.hide();
|
||||
message.error('保存失败');
|
||||
})
|
||||
};
|
||||
const HandleDpmasImg=(dmpsId)=>{
|
||||
const HandleDpmasImg=()=>{
|
||||
let dpmasList = props.caseObj.dpmas;
|
||||
let dpmasIndex=0;
|
||||
for (let i = 0; i < dpmasList.length; i++) {
|
||||
@ -213,8 +220,9 @@ const HandleDpmasImg=(dmpsId)=>{
|
||||
break;
|
||||
}
|
||||
}
|
||||
console.log(dpmasList[dpmasIndex].dpmasImg)
|
||||
let newImgList = dpmasList[dpmasIndex].dpmasImg.split(',');
|
||||
newImgList[imgIndex]=uploadImgSrc.value;
|
||||
newImgList[props.imgIndex]=uploadImgSrc.value;
|
||||
let dpmasImg='';
|
||||
newImgList.forEach(item=>{
|
||||
if(dpmasImg){
|
||||
@ -226,15 +234,22 @@ const HandleDpmasImg=(dmpsId)=>{
|
||||
|
||||
caseplatformCaseApi.updateDpmas({
|
||||
caseId:props.caseId,
|
||||
dmpsId:props.dmpsId,
|
||||
dmpsId:props.dpmasId,
|
||||
dpmasImg:dpmasImg
|
||||
}).then(res=>{
|
||||
message.success('保存成功')
|
||||
emit('freshDetail')
|
||||
SmartLoading.hide();
|
||||
message.success('保存成功');
|
||||
|
||||
}).catch(err=>{
|
||||
SmartLoading.hide();
|
||||
message.error('保存失败');
|
||||
})
|
||||
};
|
||||
const HandleCheckImg=()=>{
|
||||
let newImgList=props.caseObj.checkImg.split(',');
|
||||
newImgList[imgIndex]=uploadImgSrc.value;
|
||||
console.log(newImgList)
|
||||
newImgList[props.imgIndex]=uploadImgSrc.value;
|
||||
let checkImg='';
|
||||
newImgList.forEach(item=>{
|
||||
if(checkImg){
|
||||
@ -244,11 +259,17 @@ const HandleCheckImg=()=>{
|
||||
}
|
||||
})
|
||||
|
||||
caseplatformCaseApi.updatecheck({
|
||||
caseplatformCaseApi.updateCheck({
|
||||
caseId:props.caseId,
|
||||
checkImg:checkImg
|
||||
}).then(res=>{
|
||||
message.success('保存成功')
|
||||
emit('freshDetail')
|
||||
SmartLoading.hide();
|
||||
message.success('保存成功');
|
||||
|
||||
}).catch(err=>{
|
||||
SmartLoading.hide();
|
||||
message.error('保存失败');
|
||||
})
|
||||
};
|
||||
const getImageFormat=(imageUrl)=>{
|
||||
@ -259,27 +280,35 @@ const getImageFormat=(imageUrl)=>{
|
||||
const getImg=(file)=>{
|
||||
return new Promise((resolve, reject) => {
|
||||
caseplatformCaseApi.getOssSign(1).then(res=>{
|
||||
let { accessid, dir,policy,signature,host} = res;
|
||||
let imgUrl = file;
|
||||
let filename = FileUtil.UUID()+'.'+this.getImageFormat(imgUrl);
|
||||
console.log(res.data)
|
||||
let { accessid, dir,policy,signature,host} = res.data;
|
||||
let filename = FileUtil.UUID()+'.'+'png';
|
||||
let formData = new FormData();
|
||||
formData.append('OSSAccessKeyId', access_id);
|
||||
formData.append('OSSAccessKeyId',accessid);
|
||||
formData.append('policy', policy);
|
||||
formData.append('signature', signature);
|
||||
formData.append('key', dir + time + random +imgType);
|
||||
formData.append('key', dir + filename);
|
||||
formData.append('file', file, filename);
|
||||
formData.append('success_action_status',200);
|
||||
caseplatformCaseApi.ossUpload(host,formData).then(res => {
|
||||
resolve(host+"/"+ dir + time + random + imgType);
|
||||
console.log(host + dir + filename);
|
||||
resolve(host + dir + filename);
|
||||
|
||||
}).catch((err) => {
|
||||
message.error('上传失败')
|
||||
SmartLoading.hide();
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
SmartLoading.hide();
|
||||
|
||||
}
|
||||
const blobToFile = (blob,name)=>{
|
||||
return new File([blob],name,{type:blob.type});
|
||||
}
|
||||
|
||||
const save = () => {
|
||||
SmartLoading.show();
|
||||
instance.value.resetZoom();
|
||||
const base64String = instance.value.toDataURL(); // base64 文件
|
||||
const data = window.atob(base64String.split(',')[1]);
|
||||
@ -293,12 +322,20 @@ const save = () => {
|
||||
// fileToBase64(file).then((res) => {
|
||||
// newSrc.value = res;
|
||||
// });
|
||||
|
||||
this.getImg(blob).then(res=>{
|
||||
let file= blobToFile(blob,new Date().getTime() + '.png');
|
||||
console.log(file)
|
||||
getImg(file).then(res=>{
|
||||
uploadImgSrc.value=res;
|
||||
if(props.imgType==='mainDiagnose'){
|
||||
HandleMainDiagnoseImg();
|
||||
}else if(props.imgType==='dpmas'){
|
||||
HandleDpmasImg();
|
||||
}else if(props.imgType==='check'){
|
||||
HandleCheckImg();
|
||||
}
|
||||
|
||||
}).catch(err=>{
|
||||
SmartLoading.hide();
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user