审核跟踪上传截图
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2024-05-08 09:28:08 +08:00
parent 0699b35a06
commit 9b34069354
2 changed files with 161 additions and 126 deletions

View File

@ -186,7 +186,6 @@ export default {
this.dialogVisible = true;
},
handleRemove(file) {
console.log(1111111111);
this.fileList = [];
this.$emit("update:path", null);
},

View File

@ -8,7 +8,7 @@
:rules="rules"
class="audit-form"
>
<div class="base-dialog-body" style="min-height: 500px;">
<div class="base-dialog-body" style="min-height: 500px">
<!-- 是否认可 -->
<el-form-item
:label="$t('trials:auditRecord:table:auditResult')"
@ -31,14 +31,14 @@
<!-- 不认可原因 -->
<el-form-item
v-if="form.PIAuditState===1"
v-if="form.PIAuditState === 1"
:label="$t('trials:pendingReview:title:notAgreeReason')"
prop="NotAgreeReason"
>
<el-input
v-model="form.NotAgreeReason"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:autosize="{ minRows: 2, maxRows: 4 }"
:placeholder="$t('common:ruleMessage:specify')"
maxlength="500"
show-word-limit
@ -52,16 +52,14 @@
<el-input
v-model="form.PIAuditNote"
type="textarea"
:autosize="{ minRows: 2, maxRows: 4}"
:autosize="{ minRows: 2, maxRows: 4 }"
:placeholder="$t('common:ruleMessage:specify')"
maxlength="500"
show-word-limit
/>
</el-form-item>
<!-- 相关截图 -->
<el-form-item
:label="$t('trials:pendingReview:title:screenshots')"
>
<el-form-item :label="$t('trials:pendingReview:title:screenshots')">
<el-upload
action=""
:accept="accept"
@ -73,13 +71,13 @@
:file-list="fileList"
>
<i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{file}">
<div slot="file" slot-scope="{ file }">
<img
class="el-upload-list__item-thumbnail"
:src="OSSclientConfig.basePath + file.url"
alt=""
crossorigin="anonymous"
>
/>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@ -97,42 +95,35 @@
</span>
</div>
</el-upload>
<el-dialog
append-to-body
:visible.sync="imgVisible"
width="600px"
>
<el-dialog append-to-body :visible.sync="imgVisible" width="600px">
<el-image :src="OSSclientConfig.basePath + imageUrl" width="100%">
<div slot="placeholder" class="image-slot">
{{ $t('trials:medicalFeedback:message:loading') }}<span class="dot">...</span>
{{ $t("trials:medicalFeedback:message:loading")
}}<span class="dot">...</span>
</div>
</el-image>
</el-dialog>
</el-form-item>
<!-- 阅片结果 -->
<el-form-item
:label="$t('trials:auditRecord:table:readingResult')"
>
<el-button type="text" @click="handleView">{{ $t('common:button:view') }}</el-button>
<el-form-item :label="$t('trials:auditRecord:table:readingResult')">
<el-button type="text" @click="handleView">{{
$t("common:button:view")
}}</el-button>
</el-form-item>
</div>
<div class="base-dialog-footer" style="text-align:right;margin-top:10px;">
<el-form-item style="text-align:right;">
<div class="base-dialog-footer" style="text-align: right; margin-top: 10px">
<el-form-item style="text-align: right">
<!-- 取消 -->
<el-button
size="small"
type="primary"
@click="handleClose"
>
{{ $t('common:button:cancel') }}
<el-button size="small" type="primary" @click="handleClose">
{{ $t("common:button:cancel") }}
</el-button>
<!-- 保存 -->
<el-button
size="small"
type="primary"
@click="handleSave"
>
{{ rowData.PIAuditState?$t('trials:pendingReview:button:modify'):$t('trials:pendingReview:button:confirm') }}
<el-button size="small" type="primary" @click="handleSave">
{{
rowData.PIAuditState
? $t("trials:pendingReview:button:modify")
: $t("trials:pendingReview:button:confirm")
}}
</el-button>
</el-form-item>
</div>
@ -140,178 +131,223 @@
</template>
<script>
// import { iRSendMedicalReviewDialog, UploadMedicalReviewImage } from '@/api/trials'
import { pIAuditTask } from '@/api/reading'
import { pIAuditTask } from "@/api/reading";
export default {
name: 'FeedbackFrom',
name: "FeedbackFrom",
props: {
rowData: {
type: Object,
default() {
return {}
}
}
return {};
},
},
},
data() {
return {
form: {
VisitTaskId: '',
VisitTaskId: "",
NotAgreeReason: null,
PIAuditNote: '',
PIAuditNote: "",
PIAuditImagePathList: [],
PIAuditState: null
PIAuditState: null,
},
rules: {
PIAuditState: [{ required: true, message: this.$t('common:ruleMessage:select'), trigger: 'blur', type: 'number', min: 1 }],
PIAuditState: [
{
required: true,
message: this.$t("common:ruleMessage:select"),
trigger: "blur",
type: "number",
min: 1,
},
],
NotAgreeReason: [
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
{ max: 500, message: `${this.$t('common:ruleMessage:maxLength')} 500` }],
{
required: true,
message: this.$t("common:ruleMessage:specify"),
trigger: "blur",
},
{
max: 500,
message: `${this.$t("common:ruleMessage:maxLength")} 500`,
},
],
PIAuditNote: [
{ max: 500, message: `${this.$t('common:ruleMessage:maxLength')} 500` }]
{
max: 500,
message: `${this.$t("common:ruleMessage:maxLength")} 500`,
},
],
},
loading: false,
accept: '.png,.jpg,.jpeg',
accept: ".png,.jpg,.jpeg",
imgVisible: false,
imageUrl: '',
imageUrl: "",
uploadDisabled: false,
listLoading: false,
fileList: [],
userTypeEnumInt: zzSessionStorage.getItem('userTypeEnumInt') * 1
}
userTypeEnumInt: zzSessionStorage.getItem("userTypeEnumInt") * 1,
};
},
mounted() {
this.initForm()
this.initForm();
},
methods: {
initForm() {
this.loading = true
this.loading = true;
if (Object.keys(this.rowData).length > 0) {
for (const k in this.form) {
if (this.rowData.hasOwnProperty(k)) {
if (k === 'PIAuditImagePathList' && this.rowData.PIAuditImagePathList) {
this.rowData.PIAuditImagePathList.map(filePath => {
if (!filePath) return
this.fileList.push({ url: filePath })
})
if (
k === "PIAuditImagePathList" &&
this.rowData.PIAuditImagePathList
) {
this.rowData.PIAuditImagePathList.map((filePath) => {
if (!filePath) return;
this.fileList.push({ url: filePath });
});
} else {
this.form[k] = this.rowData[k]
this.form[k] = this.rowData[k];
}
}
}
}
this.loading = false
this.loading = false;
},
// qc
handleSave() {
this.$refs.auditForm.validate(valid => {
if (!valid) return
this.loading = true
var files = []
this.fileList.map(file => {
this.$refs.auditForm.validate((valid) => {
if (!valid) return;
this.loading = true;
var files = [];
this.fileList.map((file) => {
if (file && file.url) {
files.push(file.url)
files.push(file.url);
}
})
this.form.PIAuditImagePathList = files
this.form.VisitTaskId = this.rowData.Id
pIAuditTask(this.form).then(res => {
this.loading = false
if (res.IsSuccess) {
//
this.$emit('close')
this.$emit('getList')
this.$message.success(this.$t('common:message:savedSuccessfully'))
}
}).catch(() => { this.loading = false })
})
});
this.form.PIAuditImagePathList = files;
this.form.VisitTaskId = this.rowData.Id;
pIAuditTask(this.form)
.then((res) => {
this.loading = false;
if (res.IsSuccess) {
//
this.$emit("close");
this.$emit("getList");
this.$message.success(
this.$t("common:message:savedSuccessfully")
);
}
})
.catch(() => {
this.loading = false;
});
});
},
handlePIAuditStateChange(val) {
this.form.NotAgreeReason = ''
this.form.NotAgreeReason = "";
},
handleClose() {
this.$emit('close')
this.$emit("close");
},
handleBeforeUpload(file) {
//
if (this.checkFileSuffix(file.name)) {
return true
return true;
} else {
var msg = this.$t('trials:medicalFeedback:message:format')
msg = msg.replace('xxx', this.accept)
this.$alert(msg)
return false
var msg = this.$t("trials:medicalFeedback:message:format");
msg = msg.replace("xxx", this.accept);
this.$alert(msg);
return false;
}
},
checkFileSuffix(fileName) {
var index = fileName.lastIndexOf('.')
var suffix = fileName.substring(index + 1, fileName.length)
if (this.accept.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) === -1) {
return false
var index = fileName.lastIndexOf(".");
var suffix = fileName.substring(index + 1, fileName.length);
if (
this.accept.toLocaleLowerCase().search(suffix.toLocaleLowerCase()) ===
-1
) {
return false;
} else {
return true
return true;
}
},
async uploadScreenshots(param) {
try {
this.loading = true
var file = await this.fileToBlob(param.file)
var trialId = this.$route.query.trialId
const res = await this.OSSclient.put(`/${trialId}/PIReview/${param.file.name}`, file)
this.fileList.push({ name: param.file.name, url: this.$getObjectName(res.url) })
this.loading = false
this.loading = true;
var file = await this.fileToBlob(param.file);
var trialId = this.$route.query.trialId;
const res = await this.OSSclient.put(
`/${trialId}/PIReview/${param.file.name}`,
file
);
console.log(res);
this.fileList.push({
name: param.file.name,
path: res.name,
fullPath: this.OSSclientConfig.basePath + res.name,
url: res.name,
});
// this.fileList.push({
// name: param.file.name,
// url: this.$getObjectName(res.url),
// });
this.loading = false;
} catch (e) {
console.log(e)
this.loading = false
console.log(e);
this.loading = false;
}
},
fileToBlob(file) {
// FileReader
const reader = new FileReader()
return new Promise(resolve => {
const reader = new FileReader();
return new Promise((resolve) => {
// FileReader load
reader.addEventListener('load', (e) => {
let blob
if (typeof e.target.result === 'object') {
blob = new Blob([e.target.result])
reader.addEventListener("load", (e) => {
let blob;
if (typeof e.target.result === "object") {
blob = new Blob([e.target.result]);
} else {
blob = e.target.result
blob = e.target.result;
}
resolve(blob)
})
resolve(blob);
});
// FileReader ArrayBuffer File
reader.readAsArrayBuffer(file)
})
reader.readAsArrayBuffer(file);
});
},
//
handlePictureCardPreview(file) {
this.imageUrl = file.url
this.imgVisible = true
this.imageUrl = file.url;
this.imgVisible = true;
},
//
handleRemove(file, fileList) {
var idx = this.fileList.findIndex(i => i.url === file.url)
if (idx === -1) return
this.fileList.splice(idx, 1)
var idx = this.fileList.findIndex((i) => i.url === file.url);
if (idx === -1) return;
this.fileList.splice(idx, 1);
},
handleView() {
this.$emit('viewReaingResult')
}
}
}
this.$emit("viewReaingResult");
},
},
};
</script>
<style lang="scss" scoped>
.audit-form{
.disabled{
>>>.el-upload--picture-card {
display: none;
.audit-form {
.disabled {
>>> .el-upload--picture-card {
display: none;
}
}
}
>>> .el-upload-list__item {
>>> .el-upload-list__item {
transition: none !important;
}
>>> .el-upload-list__item-thumbnail {
/* 图片在方框内显示长边 */
object-fit: scale-down !important;
/* 图片在方框内显示长边 */
object-fit: scale-down !important;
}
}
</style>