|
|
@@ -14,12 +14,172 @@
|
|
|
</el-icon>
|
|
|
</div>
|
|
|
<div class="line">|</div>
|
|
|
- <div></div>
|
|
|
+ <div class="searchFor">
|
|
|
+ <div class="search_title">筛选:</div>
|
|
|
+ <el-tabs
|
|
|
+ v-model="searchType"
|
|
|
+ class="demo-tabs"
|
|
|
+ @tab-change="changeSearchType"
|
|
|
+ >
|
|
|
+ <el-tab-pane label="全部" name="all"></el-tab-pane>
|
|
|
+ <el-tab-pane label="文档" name="doc"></el-tab-pane>
|
|
|
+ <el-tab-pane label="图片" name="img"></el-tab-pane>
|
|
|
+ <el-tab-pane label="音频" name="audio"></el-tab-pane>
|
|
|
+ <el-tab-pane label="视频" name="video"></el-tab-pane>
|
|
|
+ <el-tab-pane label="压缩包" name="zip"></el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="table_box">
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ style="width: 100%; height: calc(88vh - 48px)"
|
|
|
+ ref="container"
|
|
|
+ @row-click="clickRow"
|
|
|
+ >
|
|
|
+ <el-table-column label="名称">
|
|
|
+ <template #default="scope">
|
|
|
+ <div class="flie_name">
|
|
|
+ <img
|
|
|
+ class="table_icon"
|
|
|
+ :src="setIcon(scope.row.fileType)"
|
|
|
+ alt=""
|
|
|
+ style=""
|
|
|
+ />
|
|
|
+ {{ scope.row.fileName }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="createTime" label="时间" width="200" />
|
|
|
+ <el-table-column prop="fileType" label="类型" width="200" />
|
|
|
+ <el-table-column prop="fileSize" label="大小" width="200">
|
|
|
+ <template #default="scope">
|
|
|
+ <div>{{ formatFileSize(scope.row.fileSize) }}</div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import { onMounted, ref, watch, nextTick, inject } from "vue";
|
|
|
+const searchType = ref("all");
|
|
|
+const baseData = ref();
|
|
|
+const tableData = ref()
|
|
|
+
|
|
|
+// 切换搜索分类
|
|
|
+const changeSearchType = (name) => {
|
|
|
+ // let baseDataObj = toRaw(baseData.value);
|
|
|
+ // console.log("baseDataObj", baseDataObj);
|
|
|
+ // if (name == "all") {
|
|
|
+ // tableData.value = baseDataObj;
|
|
|
+ // } else {
|
|
|
+ // // 获取分类具体数据
|
|
|
+ // console.log(name, "name");
|
|
|
+ // console.log(searchFor.value, "searchFor");
|
|
|
+ // const typeArr = setType(name);
|
|
|
+ // console.log(typeArr, "类型");
|
|
|
+ // tableData.value = toRaw(baseDataObj).filter((item) => {
|
|
|
+ // console.log(item, "遍历");
|
|
|
+ // return (
|
|
|
+ // typeArr.includes(item.fileType) &&
|
|
|
+ // (item.space.spaceType == searchFor.value || searchFor.value == "")
|
|
|
+ // );
|
|
|
+ // });
|
|
|
+ // console.log(tableData.value, "数组");
|
|
|
+ // }
|
|
|
+};
|
|
|
+
|
|
|
+//工具函数
|
|
|
+// 设置图标
|
|
|
+const setIcon = (fileType) => {
|
|
|
+ switch (fileType) {
|
|
|
+ case ".docx":
|
|
|
+ return file_DOC;
|
|
|
+ break;
|
|
|
+ case ".pdf":
|
|
|
+ return file_pdf;
|
|
|
+ break;
|
|
|
+ case ".ppt":
|
|
|
+ return file_PPT;
|
|
|
+ break;
|
|
|
+ case ".txt":
|
|
|
+ return file_TXT;
|
|
|
+ break;
|
|
|
+ case ".xlsx":
|
|
|
+ return file_XLSX;
|
|
|
+ break;
|
|
|
+ case ".csv":
|
|
|
+ return file_XLSX;
|
|
|
+ break;
|
|
|
+ case ".png":
|
|
|
+ return file_pic;
|
|
|
+ break;
|
|
|
+ case ".mp3":
|
|
|
+ return file_audio;
|
|
|
+ break;
|
|
|
+ case ".mp4":
|
|
|
+ return file_video;
|
|
|
+ break;
|
|
|
+ case ".zip":
|
|
|
+ return file_zip;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return file_DOC;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+};
|
|
|
+// 设置分类
|
|
|
+const setType = (fileType) => {
|
|
|
+ switch (fileType) {
|
|
|
+ case "doc":
|
|
|
+ return [
|
|
|
+ ".txt",
|
|
|
+ ".ppt",
|
|
|
+ ".pdf",
|
|
|
+ ".docx",
|
|
|
+ ".csv",
|
|
|
+ ".wps",
|
|
|
+ ".xls",
|
|
|
+ ".pptxs",
|
|
|
+ ".dll",
|
|
|
+ ".pptx",
|
|
|
+ ".doc",
|
|
|
+ ];
|
|
|
+ break;
|
|
|
+ case "img":
|
|
|
+ return [".png", ".PNG", ".jpg", ".jpeg"];
|
|
|
+ break;
|
|
|
+ case "audio":
|
|
|
+ return [".mp3"];
|
|
|
+ break;
|
|
|
+ case "video":
|
|
|
+ return [".mp4", ".qlv"];
|
|
|
+ break;
|
|
|
+ case "zip":
|
|
|
+ return [".zip", ".rar", ".7z"];
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return [""];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+};
|
|
|
+function formatFileSize(fileSize) {
|
|
|
+ if (fileSize >= 1024 * 1024 * 1024) {
|
|
|
+ // 大于等于1GB,显示GB
|
|
|
+ return (fileSize / (1024 * 1024 * 1024)).toFixed(2) + "GB";
|
|
|
+ } else if (fileSize >= 1024 * 1024) {
|
|
|
+ // 大于等于1MB,显示MB
|
|
|
+ return (fileSize / (1024 * 1024)).toFixed(2) + "MB";
|
|
|
+ } else if (fileSize >= 1024) {
|
|
|
+ // 大于等于1KB,显示KB
|
|
|
+ return (fileSize / 1024).toFixed(2) + "KB";
|
|
|
+ } else {
|
|
|
+ // 小于1KB,显示字节
|
|
|
+ return fileSize + "B";
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
@@ -29,24 +189,114 @@
|
|
|
border: 1px solid #c1cce3;
|
|
|
background: #f5f7f9;
|
|
|
padding: 0 16px;
|
|
|
-// box-sizing: border-box;
|
|
|
+ // box-sizing: border-box;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- .search_box{
|
|
|
+ .search_box {
|
|
|
width: 320px;
|
|
|
- height: 32px;
|
|
|
+ height: 48px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
position: relative;
|
|
|
- .SearchIcon{
|
|
|
- color: gray;
|
|
|
- position: absolute;
|
|
|
- right: 22px;
|
|
|
+ .SearchIcon {
|
|
|
+ color: gray;
|
|
|
+ position: absolute;
|
|
|
+ right: 22px;
|
|
|
}
|
|
|
}
|
|
|
- .line{
|
|
|
- margin-left: 16px;
|
|
|
- color:#C1CCE3;
|
|
|
+ .line {
|
|
|
+ margin: 0 16px;
|
|
|
+ color: #c1cce3;
|
|
|
+ }
|
|
|
+ .searchFor {
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ // align-items: center;
|
|
|
+ .search_title {
|
|
|
+ height: 100%;
|
|
|
+ line-height: 48px;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: 500;
|
|
|
+ font-family: Inter-Medium;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.table_box {
|
|
|
+ height: calc(88vh - 48px);
|
|
|
+ // border: 1px solid #000;
|
|
|
+}
|
|
|
+// tag间距
|
|
|
+:deep(.el-tabs) {
|
|
|
+ --el-tabs-header-height: 48px !important;
|
|
|
+}
|
|
|
+:deep(.el-tabs__item) {
|
|
|
+ padding: 0 16px !important;
|
|
|
+ color: #505870 !important;
|
|
|
+ font-weight: 400 !important;
|
|
|
+}
|
|
|
+
|
|
|
+// tag选中颜色
|
|
|
+:deep(.el-tabs__item.is-active) {
|
|
|
+ color: #2e6bc8 !important;
|
|
|
+ font-weight: normal;
|
|
|
+ font-family: Inter-SemiBold;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-tabs__active-bar) {
|
|
|
+ background-color: #2e6bc8;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+:deep(.el-table__inner-wrapper::before) {
|
|
|
+ background-color: #fff !important;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-collapse,
|
|
|
+.el-collapse-item__wrap) {
|
|
|
+ border: none;
|
|
|
+}
|
|
|
+
|
|
|
+.table_icon {
|
|
|
+ height: 27px;
|
|
|
+ width: 27px;
|
|
|
+ vertical-align: middle;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-collapse-item__content) {
|
|
|
+ padding-bottom: 0;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-collapse-item__header) {
|
|
|
+ background-color: #ebeff6 !important;
|
|
|
+ width: 100% !important;
|
|
|
+ height: 24px !important;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-collapse-item__arrow ){
|
|
|
+ position: relative;
|
|
|
+ color: #2e6bc8;
|
|
|
+ right: 97%;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-table td.el-table__cell ){
|
|
|
+ border: none;
|
|
|
+ font-size: 14px !important;
|
|
|
+ font-weight: 400 !important;
|
|
|
+ color: #000 !important;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-table__row) {
|
|
|
+ height: 35px !important;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-table .el-table__header-wrapper th) {
|
|
|
+ border-bottom: none;
|
|
|
+ border-right: 1px solid #c1cce3;
|
|
|
+ background-color: #fff !important;
|
|
|
+ color: #505870;
|
|
|
+ font-size: 14px;
|
|
|
+}
|
|
|
</style>
|