|
@@ -36,7 +36,6 @@
|
|
|
<el-image :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px"
|
|
|
:preview-teleported="true" fit="contain" :preview-src-list="preList" :initial-index="index"
|
|
|
/>
|
|
|
- <Delete @click="deleteCol(o.id,o.fileUrl)" style="width: 130px; height: 20px;" />
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -44,6 +43,23 @@
|
|
|
|
|
|
</div>
|
|
|
<div ref="uploadDiv" v-else>
|
|
|
+ <el-form-item>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col v-for="(o, index) in fileEntityList" :key="o.id" :span="8"
|
|
|
+ style="margin-bottom: 10px; position: relative">
|
|
|
+ <el-card :body-style="{ padding: '0px' }">
|
|
|
+ <!-- <img :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px" @click="handleImageView(o.fileUrl)" /> -->
|
|
|
+ <el-image :src="`${baseUrl}${o.fileUrl}`" class="image" style=" background-color: black;max-width: 100%; height: 200px"
|
|
|
+ :preview-teleported="true" fit="contain" :preview-src-list="viewList" :initial-index="index"
|
|
|
+ />
|
|
|
+
|
|
|
+ <Delete @click="deleteCol(o.id,o.fileUrl)" style="width: 130px; height: 20px;" />
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-col>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item v-if="handlerId === useUserStore().user.userId">
|
|
|
<el-upload
|
|
|
|
|
@@ -66,21 +82,7 @@
|
|
|
将文件拖入或复制此处,或点击上传(文件可以多选)
|
|
|
</div>
|
|
|
</el-upload>
|
|
|
- <el-col v-show="!uploadHidden" :span="24">
|
|
|
- <el-row :gutter="10">
|
|
|
- <el-col v-for="(o, index) in fileEntityList" :key="o.id" :span="8"
|
|
|
- style="margin-bottom: 10px; position: relative">
|
|
|
- <el-card :body-style="{ padding: '0px' }">
|
|
|
- <!-- <img :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px" @click="handleImageView(o.fileUrl)" /> -->
|
|
|
- <el-image :src="`${baseUrl}${o.fileUrl}`" class="image" style="max-width: 100%; height: 200px"
|
|
|
- :preview-teleported="true" fit="contain" :preview-src-list="viewList" :initial-index="index"
|
|
|
- />
|
|
|
|
|
|
- <Delete @click="deleteCol(o.id,o.fileUrl)" style="width: 130px; height: 20px;" />
|
|
|
- </el-card>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
</el-form-item>
|
|
|
<input type="text" style="opacity: 0" ref="fileIpt">
|
|
|
</div>
|
|
@@ -221,8 +223,10 @@ function openView(id,status,userId,resultStatus,view){
|
|
|
fileEntityList.value = [];
|
|
|
FileList({"masterTableName":"biz_work_order_record","masterId":id}).then((response) => {
|
|
|
filesTable.value = response.data
|
|
|
+ fileEntityList.value =response.data
|
|
|
filesTable.value.forEach((file)=>{
|
|
|
preList.value.push(baseUrl+file.fileUrl)
|
|
|
+ viewList.value.push(baseUrl+file.fileUrl)
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -241,8 +245,10 @@ const onsumbit = () => {
|
|
|
uploadFiles(workOrderId.value,fileEntityList.value);
|
|
|
FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
|
|
|
filesTable.value = response.data
|
|
|
+ fileEntityList.value =response.data
|
|
|
filesTable.value.forEach((file)=>{
|
|
|
preList.value.push(baseUrl+file.fileUrl)
|
|
|
+ viewList.value.push(baseUrl+file.fileUrl)
|
|
|
})
|
|
|
})
|
|
|
})
|
|
@@ -271,6 +277,7 @@ function handleBeforeUpload(file) {
|
|
|
}
|
|
|
const handlePase = (e)=>{
|
|
|
pasteList.value = [];
|
|
|
+
|
|
|
for(let i =0 ;i<e.clipboardData.files.length;i++){
|
|
|
pasteList.value.push(e.clipboardData.files[i])
|
|
|
|
|
@@ -293,7 +300,7 @@ const handlePase = (e)=>{
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
- uploadHidden.value = false;
|
|
|
+ fileList.value = [];
|
|
|
}
|
|
|
const handleEnter = ()=>{
|
|
|
if(fileList.value !== null){
|
|
@@ -304,26 +311,20 @@ const handleEnter = ()=>{
|
|
|
const deleteCol = (id,fileUrl)=>{
|
|
|
fullscreenLoading.value = true;
|
|
|
fileEntityList.value = fileEntityList.value.filter((file:Ifile)=>{
|
|
|
- return file.fileUrl !== fileUrl
|
|
|
- })
|
|
|
- viewList.value = viewList.value.filter((file)=>{
|
|
|
- return !file.includes(fileUrl);
|
|
|
- })
|
|
|
- filesTable.value = filesTable.value.filter((file:Ifile)=>{
|
|
|
if(file.fileUrl == fileUrl){
|
|
|
+ console.log("进来了2")
|
|
|
if(file.id !== null){
|
|
|
delFile(file.id).then(()=>{
|
|
|
- FileList({"masterTableName":"biz_work_order_record","masterId":workOrderId.value}).then((response) => {
|
|
|
- filesTable.value = response.data
|
|
|
- filesTable.value.forEach((file)=>{
|
|
|
- preList.value.push(baseUrl+file.fileUrl)
|
|
|
- })
|
|
|
- })
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- return file.fileUrl !== fileUrl
|
|
|
+
|
|
|
+ return file.fileUrl !== fileUrl
|
|
|
})
|
|
|
+ viewList.value = viewList.value.filter((file)=>{
|
|
|
+ return !file.includes(fileUrl);
|
|
|
+ })
|
|
|
+
|
|
|
if(fileEntityList.value.length === 0){
|
|
|
uploadHidden.value = true;
|
|
|
fileList.value = [];
|
|
@@ -331,11 +332,13 @@ const deleteCol = (id,fileUrl)=>{
|
|
|
fullscreenLoading.value = false;
|
|
|
}
|
|
|
const handleOnChange = (e)=>{
|
|
|
+ fileList.value = [];
|
|
|
if(e.status ==="ready"){
|
|
|
const formData2 = new FormData();
|
|
|
formData2.append("file", e.raw);
|
|
|
uploadFile(formData2).then((res:any) => {
|
|
|
let fileEntity:Ifile = {};
|
|
|
+ console.log(res);
|
|
|
if (res.code === 200) {
|
|
|
fileEntity.id = res.id;
|
|
|
fileEntity.fileName = res.newFileName;
|
|
@@ -346,7 +349,6 @@ const handleOnChange = (e)=>{
|
|
|
viewList.value.push(`${baseUrl}+${res.url}`);
|
|
|
fileEntityList.value.push(fileEntity);
|
|
|
})
|
|
|
- uploadHidden.value = false;
|
|
|
}
|
|
|
}
|
|
|
defineExpose({
|