Kaynağa Gözat

feat:复制粘贴,删除功能

ly 11 ay önce
ebeveyn
işleme
f1fa0f4902

+ 15 - 3
src/views/business/production/onceWork/resultDialog.vue

@@ -74,7 +74,8 @@
                   <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 style="width: 130px; height: 20px;" />
+
+                  <Delete @click="deleteCol(o.id,o.fileUrl)" style="width: 130px; height: 20px;" />
                 </el-card>
               </el-col>
             </el-row>
@@ -182,7 +183,7 @@ const httpRequest = (parm) => {
   // formData.append("workOrderId", workOrderId.value);
   // formData.append("recordStatus", sumbitForm.recordStatus);
   // formData.append("sysFileStorage",fileEntity);
-  uploadFile(formData2).then((res) => {
+  uploadFile(formData2).then((res:any) => {
     if (res.code === 200) {
       fileEntity.fileName = res.newFileName;
       fileEntity.url = res.url;
@@ -212,6 +213,7 @@ function openView(id,status,userId,resultStatus,view){
   handlerId.value = userId;
   filesTable.value = null;
   pasteList.value =[];
+  preList.value = [];
   fileEntityList.value = [];
   FileList({"masterTableName":"biz_work_order_record","masterId":id}).then((response) => {
     filesTable.value = response.data
@@ -273,7 +275,7 @@ const handlePase = (e)=>{
     pasteList.value.forEach((file)=>{
       const formData2 = new FormData();
       formData2.append("file", file);
-      uploadFile(formData2).then((res) => {
+      uploadFile(formData2).then((res:any) => {
         let fileEntity = {};
         if (res.code === 200) {
           fileEntity.id = res.id;
@@ -299,6 +301,16 @@ const handleEnter = ()=>{
   fileIpt.value.focus();
   //document.getElementsByClassName("resultDiv")[0].click();
 }
+const deleteCol = (id,fileUrl)=>{
+    console.log(id,fileUrl);
+  fileEntityList.value = fileEntityList.value.filter((file:Ifile)=>{
+     return file.fileUrl !== fileUrl
+  })
+  viewList.value = viewList.value.filter((file)=>{
+    console.log(file)
+    return !file.includes(fileUrl);
+  })
+}
 defineExpose({
   openView,
 });