|
|
@@ -12,11 +12,14 @@
|
|
|
<!-- 头部的总计和移动按钮 -->
|
|
|
<div class="statistics">
|
|
|
<el-checkbox v-model="checkedAll" @change="checkAllChange"
|
|
|
- >共{{ props.scannerFiles.length }}项</el-checkbox
|
|
|
+ >共{{ copyList.length }}项</el-checkbox
|
|
|
>
|
|
|
<div class="" v-if="copyList.length>0">
|
|
|
<el-button @click="toDownFile" style="margin-right: 10px;">
|
|
|
- <img src="@/assets/images/download.png" alt="" style="width: 22px; height: 22px;" /> 下载
|
|
|
+ <img src="@/assets/images/download.png" alt="" style="width: 22px; height: 22px;" /> 单页下载
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="toMargeDownFile" style="margin-right: 10px;">
|
|
|
+ <img src="@/assets/images/download.png" alt="" style="width: 22px; height: 22px;" /> 合并下载
|
|
|
</el-button>
|
|
|
<el-button color="#2E6BC8" @click="toMoveMy" style="margin-right: 10px;">
|
|
|
<img src="@/assets/images/folder_white.png" alt="" /> 移动到我的空间
|
|
|
@@ -48,6 +51,7 @@
|
|
|
:showPreview="showPreview"
|
|
|
@closeImgPreview="onCloseImgPreview"
|
|
|
></ImgPreview>
|
|
|
+ <MargeImg v-if="showMargeDownDlg" :showFile="showMargeDownDlg" :copyList="margelistArr" @closeshowFile="closeMargeFileDlg" @changeList="MargeFileDlgOk"></MargeImg>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
@@ -62,8 +66,11 @@ import {
|
|
|
defineExpose,
|
|
|
onDeactivated,
|
|
|
} from "vue";
|
|
|
-
|
|
|
+import { claimFile } from "@/api/scanner/info.js";
|
|
|
+import request from '@/utils/request'
|
|
|
+import documents from "@/api/document/document";
|
|
|
import ImgPreview from "@/components/ImgPreview/ImgPreview.vue";
|
|
|
+import MargeImg from "@/components/MargeFile/MargeImgFile.vue";
|
|
|
import Sortable from "sortablejs";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
|
|
|
@@ -77,7 +84,8 @@ const props = defineProps({
|
|
|
default: () => [],
|
|
|
},
|
|
|
});
|
|
|
-
|
|
|
+const showMargeDownDlg =ref(false)
|
|
|
+const margelistArr =ref([])
|
|
|
const checkedAll = ref(false); //是否全选
|
|
|
const copyList = ref(props.scannerFiles);
|
|
|
const total = ref(333); //总计数量
|
|
|
@@ -129,7 +137,7 @@ const checkAllChange = () => {
|
|
|
const toSave = () => {
|
|
|
// console.log("copyList", copyList.value);
|
|
|
if (!copyList.value.some((item) => item.checked == true)) {
|
|
|
- return ElMessage({ message: "请先勾选文件", type: "error" });
|
|
|
+ return ElMessage({ message: "请先勾选至少1个文件", type: "error" });
|
|
|
}
|
|
|
const arr = [];
|
|
|
copyList.value.forEach((item) => {
|
|
|
@@ -139,21 +147,156 @@ const toSave = () => {
|
|
|
});
|
|
|
emit("saveScanFile", arr);
|
|
|
};
|
|
|
-const toDownFile=()=>{
|
|
|
+//移动到我的空间
|
|
|
+const toMoveMy= async ()=>{
|
|
|
+ const arr = [];
|
|
|
+ copyList.value.forEach((item) => {
|
|
|
+ if (item.checked) {
|
|
|
+ arr.push(item.q);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(arr.length==0){
|
|
|
+ return ElMessage({ message: "请先勾选至少1个文件", type: "error" });
|
|
|
+ }
|
|
|
+ const topdir = await documents.getTop("3")
|
|
|
+ const query = {
|
|
|
+ dirId: topdir.dirId,
|
|
|
+ merge: false,
|
|
|
+ name: '扫描文件_'+Date.now(),
|
|
|
+ q: arr,
|
|
|
+ spaceId: topdir.spaceId,
|
|
|
+ };
|
|
|
+ const res = await claimFile(query);
|
|
|
+ if (res.code == 200) {
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ message: "移动成功",
|
|
|
+ });
|
|
|
+ //更新文件列表
|
|
|
+ let hasFiles=[];
|
|
|
+ copyList.value.forEach((item) => {
|
|
|
+ if (!arr.includes(item.q)) {
|
|
|
+ hasFiles.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ copyList.value = hasFiles
|
|
|
+ props.scannerFiles = hasFiles
|
|
|
+ }else{
|
|
|
+ console.log(res)
|
|
|
+ ElMessage({
|
|
|
+ type: "error",
|
|
|
+ message: "文件移动失败",
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+//打开合并下载窗口
|
|
|
+const toMargeDownFile=()=>{
|
|
|
+ const arr = [];
|
|
|
+ copyList.value.forEach((item) => {
|
|
|
+ if (item.checked) {
|
|
|
+ arr.push(toRaw(item));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(arr.length<2){
|
|
|
+ return ElMessage({ message: "请先勾选至少2个文件", type: "error" });
|
|
|
+ }
|
|
|
+ showMargeDownDlg.value=true
|
|
|
+ margelistArr.value = arr
|
|
|
+}
|
|
|
+//关闭合并下载窗口
|
|
|
+const closeMargeFileDlg=()=>{
|
|
|
+ showMargeDownDlg.value=false
|
|
|
+}
|
|
|
+//合并下载
|
|
|
+const MargeFileDlgOk=async(newfileName,obj)=>{
|
|
|
+ showMargeDownDlg.value=false
|
|
|
+ console.log(obj)
|
|
|
+ var arr=[]
|
|
|
+ obj.forEach((item)=>{
|
|
|
+ arr.push(item.q)
|
|
|
+ })
|
|
|
+ const topdir = await documents.getTop("3")
|
|
|
+ const query = {
|
|
|
+ dirId: topdir.dirId,
|
|
|
+ merge: true,
|
|
|
+ name: newfileName,
|
|
|
+ q: arr,
|
|
|
+ spaceId: topdir.spaceId,
|
|
|
+ };
|
|
|
+ const res = await claimFile(query);
|
|
|
+ if (res.code == 200) {
|
|
|
+ var i=0;
|
|
|
+ res.data.forEach((item)=>{
|
|
|
+ documents.download(item,newfileName+".pdf")
|
|
|
+ i++;
|
|
|
+ })
|
|
|
+ //更新文件列表
|
|
|
+ let hasFiles=[];
|
|
|
+ copyList.value.forEach((item) => {
|
|
|
+ if (!arr.includes(item.q)) {
|
|
|
+ hasFiles.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ copyList.value = hasFiles
|
|
|
+ props.scannerFiles = hasFiles
|
|
|
+ }else{
|
|
|
+ console.log(res)
|
|
|
+ ElMessage({
|
|
|
+ type: "error",
|
|
|
+ message: "文件下载失败",
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+const toDownFile= async()=>{
|
|
|
if (!copyList.value.some((item) => item.checked == true)) {
|
|
|
- return ElMessage({ message: "请先勾选文件", type: "error" });
|
|
|
+ return ElMessage({ message: "请先勾选至少1个文件", type: "error" });
|
|
|
}
|
|
|
+ var arr=[];
|
|
|
copyList.value.forEach((item) => {
|
|
|
if (item.checked) {
|
|
|
+ arr.push(item.q)
|
|
|
+ /*
|
|
|
const img=document.createElement("a");
|
|
|
img.href=wangzhi+item.path;
|
|
|
img.download=item.name;
|
|
|
document.body.appendChild(img)
|
|
|
img.click();
|
|
|
document.body.removeChild(img)
|
|
|
+ */
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+ const topdir = await documents.getTop("3")
|
|
|
+ const query = {
|
|
|
+ dirId: topdir.dirId,
|
|
|
+ merge: false,
|
|
|
+ name: '扫描文件_'+Date.now(),
|
|
|
+ q: arr,
|
|
|
+ spaceId: topdir.spaceId,
|
|
|
+ };
|
|
|
+ const res = await claimFile(query);
|
|
|
+ if (res.code == 200) {
|
|
|
+ var i=0;
|
|
|
+ res.data.forEach((item)=>{
|
|
|
+ documents.download(item,copyList.value[i].name)
|
|
|
+ i++;
|
|
|
+ })
|
|
|
+ //更新文件列表
|
|
|
+ let hasFiles=[];
|
|
|
+ copyList.value.forEach((item) => {
|
|
|
+ if (!arr.includes(item.q)) {
|
|
|
+ hasFiles.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ copyList.value = hasFiles
|
|
|
+ props.scannerFiles = hasFiles
|
|
|
+ }else{
|
|
|
+ console.log(res)
|
|
|
+ ElMessage({
|
|
|
+ type: "error",
|
|
|
+ message: "文件下载失败",
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
const rowDrop = () => {
|
|
|
const el = document.getElementById("bigBox"); //找到想要拖拽的那一列
|
|
|
@@ -220,7 +363,7 @@ const onCloseImgPreview=()=>{
|
|
|
border: 1px solid #c1cce3;
|
|
|
box-sizing: border-box;
|
|
|
margin-bottom: 16px;
|
|
|
- margin-right: 16px;
|
|
|
+ margin-right: 8px;
|
|
|
border-radius: 4px 4px 4px 4px;
|
|
|
box-shadow: 0px 2px 10px 1px rgba(199, 203, 216, 0.4);
|
|
|
position: relative;
|