From 37d65dd4165db1af88e0fcb34f23fb407fa8b64e Mon Sep 17 00:00:00 2001
From: zoujiandong <10130823232@qq.com>
Date: Thu, 10 Jul 2025 15:22:14 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../business/case/caseplatform-case-api.js | 2 +-
src/lib/axios.js | 2 +
.../business/case/caseplatform-case-form.vue | 11 ++-
src/views/business/case/imgCell.vue | 9 +-
src/views/business/case/imgEditor.vue | 83 ++++++++++++++-----
5 files changed, 78 insertions(+), 29 deletions(-)
diff --git a/src/api/business/case/caseplatform-case-api.js b/src/api/business/case/caseplatform-case-api.js
index 18f4fba..ed844a9 100644
--- a/src/api/business/case/caseplatform-case-api.js
+++ b/src/api/business/case/caseplatform-case-api.js
@@ -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);
},
};
diff --git a/src/lib/axios.js b/src/lib/axios.js
index 11e4676..99de3ab 100644
--- a/src/lib/axios.js
+++ b/src/lib/axios.js
@@ -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);
diff --git a/src/views/business/case/caseplatform-case-form.vue b/src/views/business/case/caseplatform-case-form.vue
index 1513942..7566cf5 100644
--- a/src/views/business/case/caseplatform-case-form.vue
+++ b/src/views/business/case/caseplatform-case-form.vue
@@ -307,7 +307,7 @@
:width="200"
:src="newSrc"
/> -->
-
@@ -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);
});
diff --git a/src/views/business/case/imgCell.vue b/src/views/business/case/imgCell.vue
index 6a83cea..b69e6ec 100644
--- a/src/views/business/case/imgCell.vue
+++ b/src/views/business/case/imgCell.vue
@@ -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
});
}
diff --git a/src/views/business/case/imgEditor.vue b/src/views/business/case/imgEditor.vue
index cd42123..a37d3ba 100644
--- a/src/views/business/case/imgEditor.vue
+++ b/src/views/business/case/imgEditor.vue
@@ -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();
})
};