lsc 2 달 전
부모
커밋
fffde0537e

+ 7 - 1
build/webpack.base.conf.js

@@ -45,7 +45,13 @@ module.exports = {
 			{
 				test: /\.js$/,
 				loader: 'babel-loader',
-				include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
+				include: [
+					resolve('src'), 
+					resolve('test'), 
+					resolve('node_modules/webpack-dev-server/client'), 
+					resolve('node_modules/r2r-js'), 
+					resolve('node_modules/posthog-node')
+				]
 			},
 			{
 				test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 216 - 186
package-lock.json


+ 4 - 0
src/common/axios.config.js

@@ -28,6 +28,10 @@ axios.interceptors.request.use((config) => {
     // }
     if (config.url === 'https://gpt.cocorobo.cn/search_image' || config.url === 'https://gpt.cocorobo.cn/chat' || config.url === 'https://gpt4.cocorobo.cn/create_free_assistants' || config.url === 'https://gpt4.cocorobo.cn/assistants_completion_response') {
         config.data = config.data//序列化post 参数
+    } else if (config.url.indexOf('https://r2rserver.cocorobo.cn') != -1) {
+        config.headers = {
+            'Content-Type': 'application/json',
+        }
     } else if (config.url.indexOf('https://gpt4.cocorobo.cn/') != -1 || config.url.indexOf('https://claude3.cocorobo.cn/') != -1 || config.url.indexOf('llm.cocorobo.cn/') != -1 || config.url.indexOf('https://appapi.cocorobo.cn/')!=-1) {
         config.headers = {
             'Content-Type': 'application/json',

+ 47 - 0
src/components/pages/knowledge/components/dialog.vue

@@ -0,0 +1,47 @@
+<template>
+  <el-dialog
+    title="关联文件"
+    :visible.sync="dialogVisible"
+    width="calc(100% - 20px)"
+    class="el-dialogClass"
+    :before-close="handleClose">
+    <span></span>
+    <span slot="footer">
+        <el-button @click="dialogVisible = false">关 闭</el-button>
+    </span>
+  </el-dialog>
+  
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            dialogVisible: false
+        }
+    },
+    methods: {
+        handleClose(done) {
+            done();
+        },
+        openG(){
+            this.dialogVisible = true;
+        }
+    },
+}
+</script>
+
+<style scoped>
+    .el-dialogClass >>> .el-dialog{
+        margin: 10px auto 0 !important;
+        height: calc(100% - 20px);
+    }
+
+    .el-dialogClass >>> .el-dialog__body{
+        height: calc(100% - 70px - 55px);
+        overflow-y: auto;
+        overflow-x: hidden;
+        box-sizing: border-box;
+        padding: 20px;
+    }
+</style>

+ 741 - 0
src/components/pages/knowledge/components/relateFiles.vue

@@ -0,0 +1,741 @@
+<template>
+  <el-dialog
+    title="关联文件"
+    :visible.sync="dialogVisible"
+    width="calc(100% - 20px)"
+    class="el-dialogClass"
+    :before-close="handleClose"
+  >
+    <div class="f_box">
+      <div class="f_box_top">
+        <div class="f_box_top_left">
+          <div class="f_box_top_title">我的文件</div>
+        </div>
+        <div class="f_box_top_right">
+          <div class="btn" @click="serchFile">刷新</div>
+        </div>
+      </div>
+      <div class="f_box_top">
+        <div class="f_box_top_left">
+          <el-select v-model="mofolderid" filterable @change="serchFile">
+            <el-option v-for="item in myFolderArray"
+              :key="item.folderid"
+              :label="item.name"
+              :value="item.folderid">
+            </el-option>
+          </el-select>
+        </div>
+        <div class="f_box_top_right">
+          <div class="input">
+            <input
+              type="text"
+              v-model="fileName"
+              placeholder="请输入你需要搜索的文件名字"
+              @keyup.enter="serchFile"
+            />
+            <div class="serch" @click="serchFile"></div>
+          </div>
+        </div>
+      </div>
+      <div class="none_box" v-if="fileArray.length == 0">暂无上传文件</div>
+      <div
+        class="f_box_file_list"
+        v-else-if="fileArray.length"
+        v-loading.body="isLoading"
+      >
+        <div class="list_file_box">
+          <el-table
+            :data="fileArray"
+            border
+            stripe
+            style="width: 100%"
+            @selection-change="handleSelectionChange"
+            ref="myTable"
+            :row-key="row => row.id"
+          >
+            <el-table-column
+              type="selection"
+              width="50px"
+              :reserve-selection="true"
+            ></el-table-column>
+            <el-table-column
+              prop="name"
+              label="文件名"
+              show-overflow-tooltip
+              min-width="15"
+            ></el-table-column>
+            <el-table-column
+              prop="username"
+              label="拥有者"
+              show-overflow-tooltip
+              min-width="20"
+            ></el-table-column>
+            <el-table-column
+              prop="folderName"
+              label="所属文件夹"
+              show-overflow-tooltip
+              min-width="20"
+            ></el-table-column>
+            <el-table-column label="处理状态" width="80px">
+              <template slot-scope="scope">
+                {{ getState(scope.row.ingestionStatus) }}
+              </template>
+            </el-table-column>
+            <el-table-column label="是否已提取知识图谱" width="150px">
+              <template slot-scope="scope">
+                {{ getState2(scope.row.extractionStatus) }}
+              </template>
+            </el-table-column>
+            <el-table-column
+              label="文件类型"
+              show-overflow-tooltip
+              min-width="10"
+            >
+              <template slot-scope="scope">
+                {{ scope.row.documentType ? scope.row.documentType : "-" }}
+              </template>
+            </el-table-column>
+            <!-- <el-table-column label="公开状态" show-overflow-tooltip width="80px"></el-table-column> -->
+            <el-table-column
+              prop="time"
+              label="上传时间"
+              show-overflow-tooltip
+              min-width="20"
+            ></el-table-column>
+            <!-- <el-table-column label="操作" width="200px">
+              <template slot-scope="scope">
+                <div>
+                  <el-button
+                    type="primary"
+                    size="small"
+                    v-if="userid == data.userid && data.isMo == '2'"
+                    @click="removeFile(scope.row.id, scope.row.documentid)"
+                    >移除</el-button
+                  >
+                  <el-button
+                    type="danger"
+                    size="small"
+                    v-if="userid == scope.row.userid"
+                    @click="deleteFile(scope.row.id, scope.row.documentid)"
+                    >删除</el-button
+                  >
+                </div>
+              </template>
+            </el-table-column> -->
+          </el-table>
+        </div>
+        <el-pagination
+          style="margin-top: 10px"
+          background
+          layout="prev, pager, next"
+          :page-size="limit"
+          :total="total"
+          @current-change="handleCurrentChange"
+        >
+        </el-pagination>
+      </div>
+    </div>
+    <span slot="footer">
+      <el-button @click="dialogVisible = false">关 闭</el-button>
+      <el-button @click="batchRemove" type="primary">添 加</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      dialogVisible: false,
+      isLoading: false,
+      fileArray: [],
+      checkArray: [],
+      checkArray2: [],
+      userid: "",
+      folderid: "",
+      mofolderid: "",
+      fileName: "",
+      page: 1,
+      total: 0,
+      limit: 10,
+      folderLoading: false,
+      myFolderArray: [],
+    };
+  },
+  computed: {
+    getState() {
+      return function(item) {
+        if (item == "success") {
+          return "成功";
+        } else if (item == "failed") {
+          return "失败";
+        } else if (item == "augmenting") {
+          return "上传中";
+        } else if (item == "pending") {
+          return "待处理";
+        } else if (item == "enriched") {
+          return "enriched";
+        } else if (!item) {
+          return "上传中";
+        } else {
+          return item;
+        }
+      };
+    },
+    getState2() {
+      return function(item) {
+        if (item == "success") {
+          return "成功";
+        } else if (item == "failed") {
+          return "失败";
+        } else if (item == "pending") {
+          return "待处理";
+        } else if (item == "processing") {
+          return "处理中";
+        } else if (item == "enriched") {
+          return "enriched";
+        } else if (!item) {
+          return "上传中";
+        } else {
+          return item;
+        }
+      };
+    }
+  },
+  methods: {
+    handleClose(done) {
+      done();
+    },
+    openG(uid, fid, mofid) {
+      this.dialogVisible = true;
+      this.userid = uid;
+      this.folderid = fid;
+      this.mofolderid = mofid;
+      (this.page = 1), (this.fileName = "");
+      this.getData();
+      this.getFolder();
+      this.$forceUpdate();
+    },
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getData();
+    },
+    serchFile() {
+      this.page = 1;
+      this.getData();
+    },
+    getFolder() {
+      this.folderLoading = true;
+      let params = {
+        uid: this.userid,
+      };
+      this.ajax
+        .post(this.$store.state.api + "getFolder", [params])
+        .then((res) => {
+          this.folderLoading = false;
+          let data = res.data[0]
+          this.myFolderArray = data.filter(el => el.folderid != this.folderid)
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    getData() {
+      this.isLoading = true;
+      let params = {
+        uid: this.userid,
+        folderid: this.mofolderid,
+        cfolderid: this.folderid,
+        n: this.fileName,
+        page: this.page,
+        num: this.limit
+      };
+      this.ajax
+        .post(this.$store.state.fileApi + "getFile2", [params])
+        .then(res => {
+          this.isLoading = false;
+          console.log(res.data);
+          this.total = res.data.result.length ? res.data.result[0].num : 0;
+          this.fileArray = res.data.result;
+        })
+        .catch(err => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    handleSelectionChange(selectedRows) {
+      this.checkArray = selectedRows.map(row => row.id);
+      this.checkArray2 = selectedRows.map(row => ({
+        id: row.id,
+        documentid: row.documentid
+      }));
+    },
+    async batchRemove() {
+      if (this.checkArray2.length == 0) {
+        this.$message.error("请先选择要关联的文件");
+        return;
+      }
+      let array = this.checkArray2.map(item => item.id);
+      let array2 = this.checkArray2.map(item => item.documentid);
+      let params = {
+        documentids: array2.join(","),
+        ids: array.join(","),
+        folderid: this.folderid
+      };
+      await this.ajax.post(this.$store.state.fileApi + "moveFile", [params]);
+      this.$parent.getData();
+      this.checkArray = []
+      this.checkArray2 = []
+      this.$refs.myTable.clearSelection();
+      this.dialogVisible = false
+      this.$message.success("添加成功")
+    }
+  }
+};
+</script>
+
+<style scoped>
+.el-dialogClass >>> .el-dialog {
+  margin: 10px auto 0 !important;
+  height: calc(100% - 20px);
+}
+
+.el-dialogClass >>> .el-dialog__body {
+  height: calc(100% - 70px - 55px);
+  overflow-y: auto;
+  overflow-x: hidden;
+  box-sizing: border-box;
+  padding: 20px;
+}
+
+.f_box {
+  width: 100%;
+  /* height: 100%; */
+  position: relative;
+  min-height: 400px;
+}
+
+.f_box_top {
+  display: flex;
+  align-items: center;
+  padding: 10px 0;
+  width: 100%;
+  box-sizing: border-box;
+}
+
+.f_box_top_left {
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_title {
+  font-size: 16px;
+  /* font-weight: bold; */
+}
+
+.btn {
+  display: flex;
+  cursor: pointer;
+  align-items: center;
+  height: 30px;
+  padding: 0 8px;
+  background: rgb(0, 97, 255);
+  color: #fff;
+  box-sizing: border-box;
+  border-radius: 4px;
+  font-size: 14px;
+  align-items: center;
+}
+
+.btn2 {
+  display: flex;
+  cursor: pointer;
+  align-items: center;
+  height: 30px;
+  padding: 0 8px;
+  background: #fff;
+  color: rgb(0, 97, 255);
+  border: 1px solid rgb(0, 97, 255);
+  box-sizing: border-box;
+  border-radius: 4px;
+  font-size: 14px;
+  align-items: center;
+}
+
+.f_box_top .delBtn {
+  background: rgb(255, 0, 13);
+}
+
+.btn + .btn2,
+.btn + .btn,
+.btn2 + .btn2,
+.btn2 + .delBtn {
+  margin-left: 15px;
+}
+
+.f_box_top_right {
+  margin-left: auto;
+  max-width: calc(100% - 280px);
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_right > .input {
+  position: relative;
+  width: 250px;
+  height: 35px;
+}
+
+.f_box_top_right > .input > input {
+  width: 100%;
+  height: 100%;
+  border: 1px solid #d9d9d9;
+  border-radius: 5px;
+  padding: 0 45px 0 10px;
+  box-sizing: border-box;
+  font-size: 12px;
+  outline: none;
+}
+
+.f_box_top_right > .input > .serch {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../../assets/icon/sourceFile/search.png");
+  background-size: 100% 100%;
+  position: absolute;
+  right: 13px;
+  top: 50%;
+  transform: translateY(-50%);
+  cursor: pointer;
+}
+
+.f_box_top_right > .tab {
+  height: 30px;
+  width: 80px;
+  margin-left: 15px;
+  background: #e7e7e7;
+  border: 2px solid #d9d9d9;
+  border-radius: 5px;
+  box-sizing: border-box;
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_right > .tab > .table,
+.f_box_top_right > .tab > .list {
+  width: 50%;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+}
+
+.f_box_top_right > .tab > .list::before {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../../assets/icon/sourceFile/list.png");
+  background-size: 100% 100%;
+}
+
+.f_box_top_right > .tab > .list.active,
+.f_box_top_right > .tab > .table.active {
+  background: #fff;
+}
+
+.f_box_top_right > .tab > .table::before {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../../assets/icon/sourceFile/table.png");
+  background-size: 100% 100%;
+}
+
+.mask {
+  background-color: rgb(0 0 0 / 30%);
+  /* position: fixed; */
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 90;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.progressBox {
+  width: 300px;
+  height: 150px;
+  background: #fff;
+  border-radius: 10px;
+  box-shadow: 0 0 6px 1px #bfbfbf;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+  position: relative;
+  color: #6c6c6c;
+}
+
+.progressBox >>> .el-progress-bar__outer {
+  background-color: #d1dfff !important;
+}
+
+.progressBox .lbox {
+  height: 50px;
+  font-size: 19px;
+  display: flex;
+  align-items: center;
+  color: #747474;
+}
+
+.progressBox .lbox img {
+  width: 40px;
+  margin-right: 20px;
+}
+
+.closeCss {
+  position: absolute;
+  top: 8px;
+  right: 8px;
+  cursor: pointer;
+  width: 20px;
+  height: 20px;
+}
+
+.closeCss > img {
+  width: 100%;
+  height: 100%;
+}
+
+.f_box_file_square {
+  height: calc(100% - 55px);
+  overflow: auto;
+  width: 100%;
+  padding: 55px;
+  box-sizing: border-box;
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+  position: relative;
+}
+
+.f_box_file_square > .f_box_file {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  width: 160px;
+  height: 160px;
+  cursor: pointer;
+  margin: 0 36px 36px 0;
+  border-radius: 20px;
+  position: relative;
+}
+
+.f_box_file_square > .f_box_file:hover {
+  background: #f0f2f5;
+}
+
+.f_box_file_square > .f_box_file:hover > .check {
+  display: block;
+}
+
+.f_box_file_square > .f_box_file.check {
+  background: #e0eafb;
+}
+
+.f_box_file_square > .f_box_file.check > .check {
+  display: block;
+}
+
+.f_box_file_square > .f_box_file > .check {
+  position: absolute;
+  left: 15px;
+  top: 15px;
+  width: 16px;
+  height: 16px;
+  background-size: 100%;
+  display: none;
+}
+
+.f_box_file_square > .f_box_file > .check > img {
+  width: 100%;
+  height: 100%;
+  object-fit: cover;
+}
+
+.f_box_file_square > .f_box_file > img {
+  width: 90px;
+  height: 90px;
+  object-fit: cover;
+}
+
+.f_box_file_square > .f_box_file > .name {
+  white-space: nowrap;
+  font-size: 14px;
+  max-width: 80%;
+  overflow: hidden;
+  margin: 4px auto 0;
+  text-overflow: ellipsis;
+  text-align: center;
+}
+
+.f_box_file_list {
+  /* height: calc(100% - 55px); */
+  /* overflow: auto; */
+  width: 100%;
+  padding: 10px 0;
+  box-sizing: border-box;
+}
+
+.f_box_file_list > .f_box_file {
+}
+
+.f_box_file_allCheck {
+  display: flex;
+  align-items: center;
+  position: absolute;
+  font-size: 14px;
+  top: 20px;
+  left: 10px;
+  cursor: pointer;
+}
+
+.f_box_file_allCheck > img {
+  width: 16px;
+  height: 16px;
+  object-fit: cover;
+  margin-right: 5px;
+}
+
+.dialog >>> .el-dialog__body {
+  padding: 10px 20px;
+}
+
+.type_nav_box {
+}
+
+.type_nav_box > .nav {
+  height: 40px;
+  border-radius: 5px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  width: 100%;
+  padding: 0 10px;
+  box-sizing: border-box;
+  margin-bottom: 10px;
+  font-size: 16px;
+  color: #000;
+}
+
+.type_nav_box > .nav > .down {
+  min-width: 14px;
+  height: 14px;
+  background-image: url("../../../../assets/icon/sourceFile/icon_arrow.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
+  transition: all 0.3s;
+  transform: rotate(-90deg);
+}
+
+.type_nav_box > .nav.active > .down {
+  transform: rotate(0deg);
+}
+
+.type_nav_box > .nav > .file {
+  min-width: 18px;
+  height: 18px;
+  background-image: url("../../../../assets/icon/sourceFile/file.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
+}
+
+.type_nav_box > .nav > .name {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.type_nav_box > .child {
+}
+
+.type_nav_box > .child > .nav {
+  height: 40px;
+  border-radius: 5px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  width: 100%;
+  padding: 0 10px 0 50px;
+  box-sizing: border-box;
+  margin-bottom: 10px;
+  font-size: 16px;
+  color: #000;
+}
+
+.type_nav_box > .child > .nav.active {
+  background: #e0eafb;
+}
+
+.type_nav_box > .child > .nav > .file {
+  min-width: 18px;
+  height: 18px;
+  background-image: url("../../../../assets/icon/sourceFile/file.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
+}
+
+.type_nav_box > .child > .nav > .name {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.none_box {
+  height: calc(100% - 55px);
+  overflow: auto;
+  width: 100%;
+  padding: 10px;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.list_file_box {
+  width: 100%;
+}
+
+.list_file_name {
+  display: flex;
+  align-items: center;
+}
+
+.list_file_name > img {
+  width: 24px;
+  height: 24px;
+  object-fit: cover;
+  margin-right: 5px;
+}
+
+.list_file_name > div {
+  max-width: 100%;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+}
+</style>

+ 741 - 1147
src/components/pages/knowledge/fileBox.vue

@@ -1,1292 +1,886 @@
 <template>
-    <div class="f_box">
-        <div class="f_box_top">
-            <div class="f_box_top_left">
-                <div class="f_box_top_title">
-                    所有文件
-                </div>
-            </div>
-            <div class="f_box_top_right">
-                <div class="btn">
-                    上传文件
-                </div>
-                <div class="btn delBtn">
-                    删除
-                </div>
-            </div>
+  <div class="f_box" @dragover.prevent @drop="handleDrop">
+    <div class="f_box_top">
+      <div class="f_box_top_left">
+        <div class="f_box_top_title">所有文件</div>
+      </div>
+      <div class="f_box_top_right">
+        <div class="btn" @click="serchFile">刷新</div>
+        <div class="btn" @click="addImg($event)">
+          上传文件
+          <input
+            type="file"
+            accept="*"
+            style="display: none"
+            multiple="multiple"
+            @change="beforeUpload($event)"
+          />
         </div>
-        <div class="f_box_top">
-            <div class="f_box_top_left">
-                
-            </div>
-            <div class="f_box_top_right">
-                <div class="input">
-                    <input type="text" v-model="fileName" placeholder="请输入你需要搜索的文件名字" @keyup.enter="serchFile">
-                    <div class="serch" @click="serchFile"></div>
-                </div>
-            </div>
-        </div>
-        <div class="none_box" v-if="fileArray.length == 0">
-            暂无上传文件
-        </div>
-        <div class="f_box_file_list" v-else-if="stype == '2' && fileArray.length" v-loading.body="isLoading">
-            <div class="list_file_box">
-                <div class="list_top">
-                    <div class="check">
-                        <div class="list_allcheck" @click="checkAll" v-if="fileArray.length">
-                            <img :src="checkImg" alt="" v-if="checkArray.length != fileArray.length">
-                            <img :src="checkIsImg" alt="" v-else>
-                        </div>
-                    </div>
-                    <div class="name">文件名</div>
-                    <div class="size">大小</div>
-                    <div class="type">类型</div>
-                    <div class="time">上传时间</div>
-                </div>
-                <div class="list_content" :class="{ active: checkArray.indexOf(item.id) != -1 }"
-                    @click="checkFile(item.id)" v-for="(item, index) in fileArray" :key="index">
-                    <div class="check">
-                        <div class="list_allcheck">
-                            <img :src="checkImg" alt="" v-if="checkArray.indexOf(item.id) == -1">
-                            <img :src="checkIsImg" alt="" v-else>
-                        </div>
-                    </div>
-                    <div class="name">
-                        <div class="list_file_name">
-                            <img :src="officeImg" alt="" v-if="item.type == 1">
-                            <img :src="pdfImg" alt="" v-if="item.type == 4">
-                            <img :src="videoImg" alt="" v-if="item.type == 2">
-                            <img :src="otherImg" alt="" v-if="item.type == 5">
-                            <img :src="item.file" alt="" v-if="item.type == 3">
-                            <el-tooltip :content="item.name" placement="top" effect="dark">
-                                <div>{{ item.name }}</div>
-                            </el-tooltip>
-                        </div>
-                    </div>
-                    <div class="size">
-                        {{ item.size }}
-                    </div>
-                    <div class="type">
-                        {{ retrunType(item) }}
-                    </div>
-                    <div class="time">
-                        {{ item.time }}
-                    </div>
-                </div>
-            </div>
+        <div class="btn delBtn" @click="batchDelete">删除</div>
+      </div>
+    </div>
+    <div class="f_box_top">
+      <div class="f_box_top_left">
+        <el-select v-model="checkFolderid" filterable @change="serchFile">
+          <el-option v-for="item in myFolderArray"
+            :key="item.folderid"
+            :label="item.name"
+            :value="item.folderid">
+          </el-option>
+        </el-select>
+        
+      </div>
+      <div class="f_box_top_right">
+        <div class="input">
+          <input
+            type="text"
+            v-model="fileName"
+            placeholder="请输入你需要搜索的文件名字"
+            @keyup.enter="serchFile"
+          />
+          <div class="serch" @click="serchFile"></div>
         </div>
-        <div v-if="proVisible" class="mask">
-            <div class="progressBox">
-                <div class="lbox">
-                    <img src="../../../assets/loading.gif" />上传中,请稍后
-                </div>
-            </div>
+      </div>
+    </div>
+    <div class="none_box" v-if="fileArray.length == 0">暂无上传文件</div>
+    <div
+      class="f_box_file_list"
+      v-else-if="stype == '2' && fileArray.length"
+      v-loading.body="isLoading"
+    >
+      <div class="list_file_box">
+        <el-table
+          :data="fileArray"
+          border
+          stripe
+          style="width: 100%"
+          @selection-change="handleSelectionChange"
+          :row-key="(row) => row.id"
+          ref="myTable"
+        >
+          <el-table-column type="selection" width="50px" :reserve-selection="true"></el-table-column>
+          <el-table-column prop="name" label="文件名" show-overflow-tooltip min-width="15"></el-table-column>
+          <el-table-column prop="username" label="拥有者" show-overflow-tooltip min-width="20"></el-table-column>
+          <el-table-column prop="folderName" label="所属文件夹" show-overflow-tooltip min-width="20"></el-table-column>
+          <el-table-column label="处理状态" width="80px">
+            <template slot-scope="scope">
+              {{ getState(scope.row.ingestionStatus) }}
+            </template>
+          </el-table-column>
+           <el-table-column label="是否已提取知识图谱" width="150px">
+            <template slot-scope="scope">
+              {{ getState2(scope.row.extractionStatus) }}
+            </template>
+          </el-table-column>
+          <el-table-column prop="documentType" label="文件类型" show-overflow-tooltip min-width="10"></el-table-column>
+          <!-- <el-table-column label="公开状态" show-overflow-tooltip width="80px"></el-table-column> -->
+          <el-table-column prop="time" label="上传时间" show-overflow-tooltip min-width="20"></el-table-column>
+          <el-table-column label="操作" width="200px">
+            <template slot-scope="scope">
+              <div>
+                <!-- <el-button type="primary" size="small">查看</el-button> -->
+                <el-button type="danger" size="small"  v-if="scope.row.userid == userid"  @click="deleteFile(scope.row.id, scope.row.documentid)">删除</el-button>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <el-pagination
+        style="margin-top: 10px"
+        background
+        layout="prev, pager, next"
+        :page-size="limit"
+        :total="total"
+        @current-change="handleCurrentChange"
+      >
+      </el-pagination>
+    </div>
+    <div v-if="proVisible" class="mask">
+      <div class="progressBox">
+        <div class="lbox">
+          <img src="../../../assets/loading.gif" />上传中,请稍后
         </div>
-        <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
-        <wVideo :dialogVisibleVideo.sync="dialogVisibleVideo" :url="wurl"></wVideo>
-        <wOffice :dialogVisibleOffice.sync="dialogVisibleOffice" :url="wurl"></wOffice>
-        <el-dialog title="移动至" :visible.sync="moveBox" width="400px" @close="moveBox = false" class="dialog">
-            <div>
-                <div class="type_nav_box" v-for="(item, index) in checkTypeArray" :key="index">
-                    <div class="nav" :class="{ active: item.open }" @click.stop="openChild(index)">
-                        <span class="down"></span>
-                        <span class="file"></span>
-                        <el-tooltip :content="item.name" placement="top" effect="dark">:
-                            <!-- content to trigger tooltip here -->
-                            <span class="name">{{ item.name }}</span>
-                        </el-tooltip>
-                    </div>
-                    <div class="child" v-if="item.open">
-                        <div class="nav" v-for="(item2, index2) in item.child" :key="index + '-' + index2"
-                            :class="{ active: moveChild.id == item2.id }" @click.stop="checkMoveChild(item2)">
-                            <span class="file"></span>
-                            <el-tooltip :content="item2.name" placement="top" effect="dark">:
-                                <!-- content to trigger tooltip here -->
-                                <span class="name">{{ item2.name }}</span>
-                            </el-tooltip>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <span slot="footer">
-                <el-button @click="moveBox = false">取 消</el-button>
-                <el-button type="primary" @click="confirmMove">确 定</el-button>
-            </span>
-        </el-dialog>
-
+      </div>
     </div>
+    <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
+    <wVideo :dialogVisibleVideo.sync="dialogVisibleVideo" :url="wurl"></wVideo>
+    <wOffice
+      :dialogVisibleOffice.sync="dialogVisibleOffice"
+      :url="wurl"
+    ></wOffice>
+  </div>
 </template>
 
 <script>
-import officeImg from '../../../assets/icon/sourceFile/office.png'
-import pdfImg from '../../../assets/icon/sourceFile/pdf.png'
-import videoImg from '../../../assets/icon/sourceFile/video.png'
-import otherImg from '../../../assets/icon/sourceFile/other.png'
-import checkImg from '../../../assets/icon/sourceFile/check.png'
-import checkIsImg from '../../../assets/icon/sourceFile/check_is.png'
-
+import officeImg from "../../../assets/icon/sourceFile/office.png";
+import pdfImg from "../../../assets/icon/sourceFile/pdf.png";
+import videoImg from "../../../assets/icon/sourceFile/video.png";
+import otherImg from "../../../assets/icon/sourceFile/other.png";
+import checkImg from "../../../assets/icon/sourceFile/check.png";
+import checkIsImg from "../../../assets/icon/sourceFile/check_is.png";
 
 import wVideo from "../test/file/wVideo.vue";
 import wpdf from "../test/file/wPdf2.vue";
 import wOffice from "../test/file/wOffice.vue";
 
-import JSZip from "jszip";
-import FileSaver from "file-saver";
+import { v4 as uuidv4 } from "uuid";
 
 const getFile = (url) => {
-    return new Promise((resolve, reject) => {
-        var credentials = {
-            accessKeyId: "AKIATLPEDU37QV5CHLMH",
-            secretAccessKey: "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",
-        }; //秘钥形式的登录上传
-        window.AWS.config.update(credentials);
-        window.AWS.config.region = "cn-northwest-1"; //设置区域
-        let url2 = url;
-        let _url2 = "";
-        if (
-            url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
-        ) {
-            _url2 = url2.split(
-                "https://view.officeapps.live.com/op/view.aspx?src="
-            )[1];
-        } else {
-            _url2 = url2;
-        }
-        var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
-        let name = decodeURIComponent(_url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1].replace(/\+/g, ' '))
-        var params = {
-            Bucket: "ccrb",
-            Key: name
-        };
-        s3.getObject(params, function (err, data) {
-            if (err) {
-                console.log(err, err.stack)
-                resolve({ data: 1 });
-            } else {
-                resolve({ data: data.Body });
-                console.log(data);
-            }          // sxuccessful response
-
-        });
-        // axios({
+  return new Promise((resolve, reject) => {
+    var credentials = {
+      accessKeyId: "AKIATLPEDU37QV5CHLMH",
+      secretAccessKey: "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",
+    }; //秘钥形式的登录上传
+    window.AWS.config.update(credentials);
+    window.AWS.config.region = "cn-northwest-1"; //设置区域
+    let url2 = url;
+    let _url2 = "";
+    if (
+      url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
+    ) {
+      _url2 = url2.split(
+        "https://view.officeapps.live.com/op/view.aspx?src="
+      )[1];
+    } else {
+      _url2 = url2;
+    }
+    var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
+    let name = decodeURIComponent(
+      _url2
+        .split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
+        .replace(/\+/g, " ")
+    );
+    var params = {
+      Bucket: "ccrb",
+      Key: name,
+    };
+    s3.getObject(params, function (err, data) {
+      if (err) {
+        console.log(err, err.stack);
+        resolve({ data: 1 });
+      } else {
+        resolve({ data: data.Body });
+        console.log(data);
+      } // sxuccessful response
     });
+    // axios({
+  });
 };
 export default {
-    components: {
-        wVideo,
-        wpdf,
-        wOffice,
+  components: {
+    wVideo,
+    wpdf,
+    wOffice,
+  },
+  props: {
+    userid: {
+      type: String,
     },
-    props: {
-        userid: {
-            type: String,
-        },
-        typeArray: {
-            type: Array,
-        },
-        pid: {
-            type: String,
-        },
-        type: {
-            type: String
-        }
+    typeArray: {
+      type: Array,
+    },
+    pid: {
+      type: String,
+    },
+    type: {
+      type: String,
     },
-    watch: {
-        pid: {
-            immediate: true,
-            deep: true,
-            handler(newValue, oldValue) {
-                this.fileArray = []
-                this.checkArray = []
-                this.fileName = ''
-                this.getData()
-            },
-        },
+    moFolderid: {
+      type: String
     },
-    data() {
-        return {
-            isLoading: false,
-            proVisible: false,
-            stype: 2,
-            fileArray: [],
-            officeImg: officeImg,
-            pdfImg: pdfImg,
-            videoImg: videoImg,
-            otherImg: otherImg,
-            checkImg: checkImg,
-            checkIsImg: checkIsImg,
-            checkArray: [],
-            dialogVisiblePdf: false,
-            dialogVisibleVideo: false,
-            dialogVisibleOffice: false,
-            wurl: '',
-            moveBox: false,
-            checkTypeArray: [],
-            moveChild: '',
-            fileName: '',
+    myFolderArray: {
+      type: Array,
+    }
+  },
+  watch: {
+    pid: {
+      immediate: true,
+      deep: true,
+      handler(newValue, oldValue) {
+        this.fileArray = [];
+        this.checkArray = [];
+        this.fileName = "";
+        this.checkFolderid = this.moFolderid
+        // this.getData();
+      },
+    },
+  },
+  data() {
+    return {
+      isLoading: false,
+      proVisible: false,
+      stype: 2,
+      fileArray: [],
+      officeImg: officeImg,
+      pdfImg: pdfImg,
+      videoImg: videoImg,
+      otherImg: otherImg,
+      checkImg: checkImg,
+      checkIsImg: checkIsImg,
+      checkArray: [],
+      checkArray2: [],
+      dialogVisiblePdf: false,
+      dialogVisibleVideo: false,
+      dialogVisibleOffice: false,
+      wurl: "",
+      moveBox: false,
+      checkTypeArray: [],
+      moveChild: "",
+      fileName: "",
+      limit: 10,
+      total: 0,
+      page: 1,
+      checkFolderid: "",
+    };
+  },
+  computed: {
+    getState() {
+      return function (item) {
+        if (item == "success") {
+          return "成功";
+        } else if (item == "failed") {
+          return "失败";
+        } else if (item == "augmenting") {
+          return "上传中";
+        } else if (item == "pending") {
+          return "待处理";
+        } else if (item == "enriched") {
+          return "enriched";
+        } else if(!item){
+          return "上传中"
+        } else {
+          return item
         }
+      };
     },
-    computed: {
-        retrunType() {
-            return function (item) {
-                if (item.type == 1) {
-                    return 'OFFICE文件'
-                } else if (item.type == 2) {
-                    return '视频文件'
-                } else if (item.type == 3) {
-                    return '图片'
-                } else if (item.type == 4) {
-                    return 'PDF文件'
-                } else if (item.type == 5) {
-                    return '其他文件'
-                }
-            };
+    getState2() {
+      return function (item) {
+        if (item == "success") {
+          return "成功";
+        } else if (item == "failed") {
+          return "失败";
+        } else if (item == "pending") {
+          return "待处理";
+        } else if (item == "processing") {
+          return "处理中";
+        } else if (item == "enriched") {
+          return "enriched";
+        } else if(!item){
+          return "上传中"
+        } else {
+          return item
         }
+      };
     },
-    methods: {
-        getData() {
-            let type = this.pid.split('/')
-            let id = ''
-            if (type.length == 1) {
-                if (type[0] == 'wu') {
-                    id = '0'
-                } else {
-                    id = this.typeArray[type[0]].id
-                }
-            } else {
-                id = this.typeArray[type[0]].child[type[1]].id
-            }
-            this.isLoading = true;
-            let params = {
-                uid: this.userid,
-                pid: id,
-                n: this.fileName
-            };
-            this.ajax
-                .get(this.$store.state.api + "getSourceFile", params)
-                .then((res) => {
-                    this.isLoading = false;
-                    // this.fileArray = res.data[0];
-                })
-                .catch((err) => {
-                    this.isLoading = false;
-                    console.error(err);
-                });
-        },
-        addImg(e) {
-            var el = e.currentTarget;
-            el.getElementsByTagName("input")[0].click();
-            e.target.value = "";
-        },
-        serchFile() {
-            this.getData();
-        },
-        beforeUpload(event) {
-            // const loading = this.openLoading();
-            let file = "";
-            let cfindex2 = 0;
-            for (var cfindex = 0; cfindex < event.target.files.length; cfindex++) {
-                file = event.target.files[cfindex];
-
-                var credentials = {
-                    accessKeyId: "AKIATLPEDU37QV5CHLMH",
-                    secretAccessKey: "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",
-                }; //秘钥形式的登录上传
-                window.AWS.config.update(credentials);
-                window.AWS.config.region = "cn-northwest-1"; //设置区域
-
-                var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
-                var _this = this;
-                let _name = file.name;
-                // _this.progress = 0;
-                _this.proVisible = true;
-                // _this.isFinishSize = 0;
-                // _this.isAllSize = (file.size / 1024 / 1024).toFixed(2);
-                let size = file.size;
-                _this.$forceUpdate();
-                if (file) {
-                    var params = {
-                        Key:
-                            file.name.split(".")[0] +
-                            new Date().getTime() +
-                            "." +
-                            file.name.split(".")[file.name.split(".").length - 1],
-                        ContentType: file.type,
-                        Body: file,
-                        "Access-Control-Allow-Credentials": "*",
-                        ACL: "public-read",
-                    }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
-                    var options = {
-                        partSize: 2048 * 1024 * 1024,
-                        queueSize: 2,
-                        leavePartsOnError: true,
-                    };
-                    bucket
-                        .upload(params, options)
-                        .on("httpUploadProgress", function (evt) {
-                            //这里可以写进度条
-                            // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
-                            // _this.progress = parseInt((evt.loaded / evt.total) * 100);
-                            // _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2);
-                            // _this.$forceUpdate();
-                        })
-                        .send(function (err, data) {
-                            cfindex2++;
-
-                            // _this.progress = 100;
-                            // _this.isFinishSize = _this.isAllSize;
-                            // _this.$forceUpdate();
-                            // setTimeout(() => {
-                            //     _this.proVisible = false;
-                            //     _this.$forceUpdate();
-                            // }, 1000);
-                            setTimeout(() => {
-                                if (
-                                    cfindex2 == event.target.files.length ||
-                                    cfindex2 > event.target.files.length
-                                ) {
-                                    _this.proVisible = false;
-                                }
-                            }, 1000);
-                            // loading.close();
-                            if (err) {
-                                _this.$message.error("上传失败");
-                            } else {
-                                let _type = 2;
-                                var imgA = [
-                                    "png",
-                                    "jpg",
-                                    "jpeg",
-                                    "bmp",
-                                    "gif",
-                                    "webp",
-                                    "psd",
-                                    "svg",
-                                    "tiff",
-                                ];
-                                var fileA = [
-                                    "DOC",
-                                    "DOCX",
-                                    "DOCM",
-                                    "DOTM",
-                                    "DOTX",
-                                    "PPTX",
-                                    "PPSX",
-                                    "PPT",
-                                    "PPS",
-                                    "PPTM",
-                                    "POTM",
-                                    "PPAM",
-                                    "POTX",
-                                    "PPSM",
-                                    "XLSX",
-                                    "XLS",
-                                ];
-                                var videoA = [
-                                    "AVI",
-                                    "NAVI",
-                                    "MPEG",
-                                    "ASF",
-                                    "MOV",
-                                    "WMV",
-                                    "3GP",
-                                    "RM",
-                                    "RMVB",
-                                    "FLV",
-                                    "F4V",
-                                    "H.264",
-                                    "H.265",
-                                    "REAL VIDEO",
-                                    "MKV",
-                                    "WebM",
-                                    "HDDVD",
-                                    "MP4",
-                                    "MPG",
-                                    "M4V",
-                                    "MGV",
-                                    "OGV",
-                                    "QTM",
-                                    "STR",
-                                    "AMC",
-                                    "DVX",
-                                    "EVO",
-                                    "DAT",
-                                    "OGG",
-                                    "OGM",
-                                ];
-                                if (
-                                    fileA.indexOf(
-                                        data.Location.split(".")[
-                                            data.Location.split(".").length - 1
-                                        ].toLocaleUpperCase()
-                                    ) != -1
-                                ) {
-                                    _type = 1; //word 文件
-                                } else if (
-                                    videoA.indexOf(
-                                        data.Location.split(".")[
-                                            data.Location.split(".").length - 1
-                                        ].toLocaleUpperCase()
-                                    ) != -1
-                                ) {
-                                    _type = 2; //视频
-                                } else if (
-                                    imgA.indexOf(
-                                        data.Location.split(".")[
-                                            data.Location.split(".").length - 1
-                                        ].toLocaleLowerCase()
-                                    ) != -1
-                                ) {
-                                    _type = 3; //图片
-                                } else if (
-                                    'pdf'.indexOf(
-                                        data.Location.split(".")[
-                                            data.Location.split(".").length - 1
-                                        ].toLocaleLowerCase()
-                                    ) != -1
-                                ) {
-                                    _type = 4; //pdf
-                                } else {
-                                    _type = 5; //文件
-                                }
-                                let _file = {
-                                    name: _name,
-                                    url: data.Location,
-                                    type: _type,
-                                    size: _this.formatFileSize(size)
-                                }
-                                // if (_this.checkJson.file) {
-                                //     _this.checkJson.file.push({
-                                //         name: file.name,
-                                //         url: data.Location,
-                                //         type: _type,
-                                //     });
-                                // } else {
-                                //     _this.checkJson.file = []
-                                //     _this.checkJson.file.push({
-                                //         name: file.name,
-                                //         url: data.Location,
-                                //         type: _type,
-                                //     });
-                                // }
-                                let type = 1
-                                if (
-                                    cfindex2 == event.target.files.length ||
-                                    cfindex2 > event.target.files.length
-                                ) {
-                                    type = 2
-                                }
-                                _this.addSource(_file, type)
-                                _this.$forceUpdate();
-
-                                console.log(_file);
-                                console.log(data.Location);
-                            }
-                        });
-                }
-            }
-        },
-        addSource(file, ctype) {
-            let _ctype = ctype
-            let type = this.pid.split('/')
-            let id = ''
-            if (type.length == 1) {
-                if (type[0] == 'wu') {
-                    id = '0'
-                } else {
-                    id = this.typeArray[type[0]].id
-                }
-            } else {
-                id = this.typeArray[type[0]].child[type[1]].id
-            }
-            let params = [{
-                n: file.name,
-                file: file.url,
-                type: file.type,
-                pid: id,
-                uid: this.userid,
-                size: file.size,
-            }];
-            this.ajax
-                .post(this.$store.state.api + "addSourceFile", params)
-                .then((res) => {
-                    if (_ctype == 2) {
-                        this.$message.success('上传成功');
-                        this.getData()
-                    }
-                })
-                .catch((err) => {
-                    console.error(err);
-                });
-        },
-        formatFileSize(bytes) {
-            if (bytes < 1024) {
-                return bytes + "B";
-            } else if (bytes < 1048576) {
-                return (bytes / 1024).toFixed(2) + "KB";
-            } else if (bytes < 1073741824) {
-                return (bytes / 1048576).toFixed(2) + "MB";
-            } else {
-                return (bytes / 1073741824).toFixed(2) + "GB";
-            }
-        },
-        checkFile(id) {
-            if (this.checkArray.indexOf(id) == -1) {
-                this.checkArray.push(id)
-            } else {
-                this.checkArray.splice(this.checkArray.indexOf(id), 1)
-            }
-        },
-        selectFile(item) {
-            if (item.type == 3) {
-                this.$hevueImgPreview(item.file);
-            } else if (item.type == 5) {
-                this.downloadFile(item);
-            } else if (item.type == 1) {
-                this.dialogVisibleOffice = true
-                this.wurl = item.file
-            } else if (item.type == 2) {
-                this.dialogVisibleVideo = true
-                this.wurl = item.file
-            } else if (item.type == 4) {
-                this.dialogVisiblePdf = true
-                this.wurl = item.file
-            }
-        },
-        downloadFile(f) {
-            this.isLoading = true;
-            var credentials = {
-                accessKeyId: "AKIATLPEDU37QV5CHLMH",
-                secretAccessKey: "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",
-            }; //秘钥形式的登录上传
-            window.AWS.config.update(credentials);
-            window.AWS.config.region = "cn-northwest-1"; //设置区域
-            let url2 = f.file;
-            let _url2 = "";
+  },
+  methods: {
+    handleCurrentChange(val) {
+        this.page = val;
+        this.getData();
+    },
+    getData() {
+      this.isLoading = true;
+      let params = {
+        uid: this.userid,
+        folderid: this.checkFolderid,
+        n: this.fileName,
+        page: this.page,
+        num: this.limit,
+      };
+      this.ajax
+        .post(this.$store.state.fileApi + "getFile", [params])
+        .then((res) => {
+          this.isLoading = false;
+          console.log(res.data);
+          this.total = res.data.result.length ? res.data.result[0].num : 0;
+          this.fileArray = res.data.result;
+          this.$parent.$refs.folder.getData();
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    handleSelectionChange(selectedRows) {
+      this.checkArray = selectedRows.map((row) => row.id);
+      this.checkArray2 = selectedRows.map(row => ({ id: row.id, documentid: row.documentid }));
+    },
+    addImg(e) {
+      var el = e.currentTarget;
+      el.getElementsByTagName("input")[0].click();
+      e.target.value = "";
+    },
+    handleDrop(event) {
+      event.preventDefault(); // 阻止默认的浏览器下载行为
+      const files = event.dataTransfer.files;
+      if (files.length) {
+        this.beforeUpload({target:{files}});
+      }
+    },
+    serchFile() {
+      this.page = 1;
+      this.getData();
+    },
+    async beforeUpload(event) {
+      // const loading = this.openLoading();
+      let file = "";
+      let cfindex2 = 0;
+      this.proVisible = true;
+      const allowedExtensions = [
+        "csv","xls","xlsx","md","pdf","txt","ppt","pptx","docx"
+      ];
+      
+      for (var cfindex = 0; cfindex < event.target.files.length; cfindex++) {
+        file = event.target.files[cfindex];
+        const fileExtension = file.name.split('.').pop().toLowerCase();
+        
+        if (!allowedExtensions.includes(fileExtension)) {
+          this.$message.error(`不支持的文件格式: ${file.name}`);
+          cfindex2++;
+          setTimeout(() => {
             if (
-                url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
+              cfindex2 == event.target.files.length ||
+              cfindex2 > event.target.files.length
             ) {
-                _url2 = url2.split(
-                    "https://view.officeapps.live.com/op/view.aspx?src="
-                )[1];
-            } else {
-                _url2 = url2;
-            }
-            let _this = this;
-
-            var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
-            let name = decodeURIComponent(_url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1].replace(/\+/g, ' '))
-            var params = {
-                Bucket: "ccrb",
-                Key: name
-            };
-            s3.getObject(params, function (err, data) {
-                _this.isLoading = false
-                if (err) console.log(err, err.stack); // an error occurred
-                else {
-                    let url = window.URL.createObjectURL(new Blob([data.Body]));
-                    let a = document.createElement("a");
-                    a.name = f.name;
-                    a.href = url;
-                    a.download = f.name;
-                    a.click();
-                    console.log(data);
-                }          // sxuccessful response
-
-            });
-        },
-        checkAll() {
-            if (this.checkArray.length === this.fileArray.length) {
-                this.checkArray = []
-            } else {
-                this.checkArray = []
-                this.fileArray.forEach(item => {
-                    this.checkArray.push(item.id)
-                });
-            }
-        },
-        deleteFile() {
-            this.$confirm("确定删除这些文件吗?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            })
-                .then(() => {
-                    let params = [
-                        { ids: this.checkArray.join(",") }
-                    ]
-                    this.ajax
-                        .post(this.$store.state.api + "deleteSourceFile", params)
-                        .then((res) => {
-                            this.$message({
-                                message: "删除成功",
-                                type: "success",
-                            });
-                            this.checkArray = []
-                            this.getData();
-                        })
-                        .catch((err) => {
-                            this.$message.error("删除失败");
-                            console.error(err);
-                        });
-                })
-                .catch(() => { });
-        },
-        openMoveBox() {
-            if (this.checkArray.length == 0) {
-                this.$message.error("请添加分类再移动");
-                return
-            }
-            let type = this.pid.split('/')
-            let id = ''
-            if (type.length == 1) {
-                if (type[0] == 'wu') {
-                    id = '0'
-                } else {
-                    id = this.typeArray[type[0]].id
-                }
-            } else {
-                id = this.typeArray[type[0]].child[type[1]].id
+              this.proVisible = false;
             }
-            let array = JSON.parse(JSON.stringify(this.typeArray)).filter((item) => {
-                item.open = false
-                return item.child.length > 0
-            })
+          }, 1000);
+          continue; // 跳过不支持的文件
+        }
+        let uuid = uuidv4();
+        let formData = new FormData();
+        const timestamp = Date.now();
+        const baseName = file.name.slice(0, -(fileExtension.length + 1));
+        formData.append('file', new File([file], `${baseName}${timestamp}.${fileExtension}`));
+        formData.append('collection_ids', JSON.stringify([this.moFolderid]));
+        formData.append('id', uuid);
+        formData.append('metadata', JSON.stringify({title: file.name}));
+        formData.append('ingestion_mode', "fast");
+
+        // 使用同步方式上传文件
+        await this.uploadFile(formData, file.name, uuid);
+        cfindex2++;
+
+        setTimeout(() => {
+          if (
+            cfindex2 == event.target.files.length ||
+            cfindex2 > event.target.files.length
+          ) {
+            this.proVisible = false;
+          }
+        }, 1000);
+      }
+    },
+    async uploadFile(formData, name, uuid) {
+      try {
+        // 确保formData是正确的格式
+        // this.$store.state.fileApi + "upload"
+        this.ajax.post("https://r2rserver.cocorobo.cn/v3/documents", formData, {
+          headers: {
+            'Content-Type': 'multipart/form-data' 
+          }
+        });
 
-            array = array.filter((item) => {
-                item.child = item.child.filter((item2) => {
-                    return item2.id != id
-                })
-                return item.child.length > 0
-            })
-            this.moveChild = ''
-            this.checkTypeArray = array
-            this.moveBox = true
-        },
-        openChild(index) {
-            this.checkTypeArray[index].open = !this.checkTypeArray[index].open
-        },
-        checkMoveChild(item) {
-            this.moveChild = item
-        },
-        confirmMove() {
-            if (!this.moveChild) {
-                this.$message.error("请选择移动的分类");
-                return
-            }
-            this.$confirm("确定将文件移动到" + this.moveChild.name + "下吗?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
+        let params = {
+          n: name,
+          did: uuid,
+          uid: this.userid,
+          fid: this.moFolderid,
+          mofid: "",
+        }
+        const res2 = await this.ajax.post(this.$store.state.api + 'addFile', [params]);
+        this.$message.success("上传成功");
+        this.getData();
+      } catch (err) {
+        console.error(err);
+        this.$message.error("上传失败");
+      }
+    },
+    formatFileSize(bytes) {
+      if (bytes < 1024) {
+        return bytes + "B";
+      } else if (bytes < 1048576) {
+        return (bytes / 1024).toFixed(2) + "KB";
+      } else if (bytes < 1073741824) {
+        return (bytes / 1048576).toFixed(2) + "MB";
+      } else {
+        return (bytes / 1073741824).toFixed(2) + "GB";
+      }
+    },
+    deleteFile(fileid, documentid) {
+      this.$confirm("确定删除该文件吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+       .then(() => {
+          let params = [{ 
+            ids: fileid,
+            documentids: documentid,
+          }];
+          this.ajax
+           .post(this.$store.state.fileApi + "deleteFile", params)
+           .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              this.checkArray = []
+              this.checkArray2 = []
+              this.$refs.myTable.clearSelection();
+              this.getData();
             })
-                .then(() => {
-                    let params = [
-                        {
-                            ids: this.checkArray.join(","),
-                            pid: this.moveChild.id
-                        }
-                    ]
-                    this.ajax
-                        .post(this.$store.state.api + "updateSourceFilePid", params)
-                        .then((res) => {
-                            this.$message({
-                                message: "移动成功",
-                                type: "success",
-                            });
-                            this.checkArray = []
-                            this.moveChild = ''
-                            this.moveBox = false
-                            this.getData();
-                        })
-                        .catch((err) => {
-                            this.$message.error("删除失败");
-                            console.error(err);
-                        });
-                })
-                .catch(() => { });
-        },
-        downPan() {
-            this.downloadFile({file:'https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/icons1712477416633.png',name:"icons1712477416633.png"})
-            // let array = []
-            // this.fileArray.forEach(item => {
-            //     if (this.checkArray.includes(item.id)) {
-            //         array.push(item)
-            //     }
-            // })
-            // if (array.length == 1) {
-            //     this.downloadFile(array[0])
-            // } else {
-            //     this.uploadCourse(array)
-            // }
-        },
-        uploadCourse(item) {
-            this.isLoading = true;
-            const _chapInfo = item;
-            let url = [];
-            for (let i = 0; i < _chapInfo.length; i++) {
-                url.push({
-                    name: _chapInfo[i].name,
-                    url: _chapInfo[i].file,
-                });
-            }
-            console.log(url);
-            this.downLoadAll(url);
-        },
-        downLoadAll(url) {
-            const data = url; // 需要下载打包的路径, 可以是本地相对路径, 也可以是跨域的全路径
-            const zip = new JSZip();
-            const cache = {};
-            const promises = [];
-            data.forEach((item) => {
-                const promise = getFile(item.url).then((data) => {
-                    if (data.data != 1) {
-                        // 下载文件, 并存成ArrayBuffer对象
-                        const file_name = item.name; // 获取文件名
-                        zip.file(file_name, data.data, { binary: true }); // 逐个添加文件
-                        cache[file_name] = data.data;
-                    }
-                });
-                promises.push(promise);
-            });
-            Promise.all(promises).then(() => {
-                zip.generateAsync({ type: "blob" }).then((content) => {
-                    // 生成二进制流
-                    FileSaver.saveAs(content, "附件.zip"); // 利用file-saver保存文件  自定义文件名
-                    setTimeout(() => {
-                        this.isLoading = false;
-                    }, 2000);
-                });
+           .catch((err) => {
+              this.$message.error("删除失败");
+              console.error(err);
             });
-        },
-        addFileToTest(){
-            if(!this.checkArray.length){
-                return
-            }
-            let file = []
-            for(let i = 0; i < this.fileArray.length; i++){
-                if(this.checkArray.includes(this.fileArray[i].id)){
-                    file.push(this.fileArray[i])
-                }
-            }
-            this.$emit('addFile', file)
-            this.checkArray = []
-        }
+        })
+       .catch(() => {});
     },
-    mounted() {
-        this.getData();
+    batchDelete(){
+      if(!this.checkArray.length){
+        this.$message.warning("请选择要删除的文件")
+        return;
+      }
+      let array = this.checkArray2.map(item => item.id);
+      let array2 = this.checkArray2.map(item => item.documentid);
+      this.deleteFile(array.join(","), array2.join(","))
     },
-}
+  },
+  mounted() {
+    this.getData();
+  },
+};
 </script>
 
 <style scoped>
 .f_box {
-    width: 100%;
-    /* height: 100%; */
-    position: relative;
+  width: 100%;
+  /* height: 100%; */
+  position: relative;
+  min-height: 400px;
 }
 
 .f_box_top {
-    display: flex;
-    align-items: center;
-    padding: 10px;
-    width: 100%;
-    box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  padding: 10px;
+  width: 100%;
+  box-sizing: border-box;
 }
 
 .f_box_top_left {
-    display: flex;
-    align-items: center;
+  display: flex;
+  align-items: center;
 }
 
-.f_box_top_title{
-    font-size: 16px;
-    /* font-weight: bold; */
+.f_box_top_title {
+  font-size: 16px;
+  /* font-weight: bold; */
 }
 
 .f_box_top .btn {
-    display: flex;
-    cursor: pointer;
-    align-items: center;
-    height: 30px;
-    padding: 0 8px;
-    background: rgb(0, 97, 255);
-    color: #fff;
-    box-sizing: border-box;
-    border-radius: 4px;
-    font-size: 14px;
-    align-items: center;
+  display: flex;
+  cursor: pointer;
+  align-items: center;
+  height: 30px;
+  padding: 0 8px;
+  background: rgb(0, 97, 255);
+  color: #fff;
+  box-sizing: border-box;
+  border-radius: 4px;
+  font-size: 14px;
+  align-items: center;
 }
 
 .f_box_top .btn2 {
-    display: flex;
-    cursor: pointer;
-    align-items: center;
-    height: 30px;
-    padding: 0 8px;
-    background: #fff;
-    color: rgb(0, 97, 255);
-    border: 1px solid rgb(0, 97, 255);
-    box-sizing: border-box;
-    border-radius: 4px;
-    font-size: 14px;
-    align-items: center;
+  display: flex;
+  cursor: pointer;
+  align-items: center;
+  height: 30px;
+  padding: 0 8px;
+  background: #fff;
+  color: rgb(0, 97, 255);
+  border: 1px solid rgb(0, 97, 255);
+  box-sizing: border-box;
+  border-radius: 4px;
+  font-size: 14px;
+  align-items: center;
 }
 
 .f_box_top .delBtn {
-    background: rgb(255, 0, 13);
+  background: rgb(255, 0, 13);
 }
 
-.f_box_top .btn+.btn2,
-.f_box_top .btn+.btn,
-.f_box_top .btn2+.btn2,
-.f_box_top .btn2+.delBtn {
-    margin-left: 15px;
+.f_box_top .btn + .btn2,
+.f_box_top .btn + .btn,
+.f_box_top .btn2 + .btn2,
+.f_box_top .btn2 + .delBtn {
+  margin-left: 15px;
 }
 
 .f_box_top_right {
-    margin-left: auto;
-    max-width: calc(100% - 280px);
-    overflow: hidden;
-    display: flex;
-    align-items: center;
-}
-
-.f_box_top_right>.input {
-    position: relative;
-    width: 250px;
-    height: 35px;
-}
-
-.f_box_top_right>.input>input {
-    width: 100%;
-    height: 100%;
-    border: 1px solid #D9D9D9;
-    border-radius: 5px;
-    padding: 0 45px 0 10px;
-    box-sizing: border-box;
-    font-size: 12px;
-    outline: none;
-}
-
-.f_box_top_right>.input>.serch {
-    content: '';
-    display: block;
-    width: 20px;
-    height: 20px;
-    background-image: url('../../../assets/icon/sourceFile/search.png');
-    background-size: 100% 100%;
-    position: absolute;
-    right: 13px;
-    top: 50%;
-    transform: translateY(-50%);
-    cursor: pointer;
-}
-
-.f_box_top_right>.tab {
-    height: 30px;
-    width: 80px;
-    margin-left: 15px;
-    background: #e7e7e7;
-    border: 2px solid #D9D9D9;
-    border-radius: 5px;
-    box-sizing: border-box;
-    overflow: hidden;
-    display: flex;
-    align-items: center;
-}
-
-.f_box_top_right>.tab>.table,
-.f_box_top_right>.tab>.list {
-    width: 50%;
-    height: 100%;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    cursor: pointer;
-}
-
-.f_box_top_right>.tab>.list::before {
-    content: '';
-    display: block;
-    width: 20px;
-    height: 20px;
-    background-image: url('../../../assets/icon/sourceFile/list.png');
-    background-size: 100% 100%;
-}
-
-.f_box_top_right>.tab>.list.active,
-.f_box_top_right>.tab>.table.active {
-    background: #fff;
-}
-
-.f_box_top_right>.tab>.table::before {
-    content: '';
-    display: block;
-    width: 20px;
-    height: 20px;
-    background-image: url('../../../assets/icon/sourceFile/table.png');
-    background-size: 100% 100%;
+  margin-left: auto;
+  max-width: calc(100% - 280px);
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_right > .input {
+  position: relative;
+  width: 250px;
+  height: 35px;
+}
+
+.f_box_top_right > .input > input {
+  width: 100%;
+  height: 100%;
+  border: 1px solid #d9d9d9;
+  border-radius: 5px;
+  padding: 0 45px 0 10px;
+  box-sizing: border-box;
+  font-size: 12px;
+  outline: none;
+}
+
+.f_box_top_right > .input > .serch {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/search.png");
+  background-size: 100% 100%;
+  position: absolute;
+  right: 13px;
+  top: 50%;
+  transform: translateY(-50%);
+  cursor: pointer;
+}
+
+.f_box_top_right > .tab {
+  height: 30px;
+  width: 80px;
+  margin-left: 15px;
+  background: #e7e7e7;
+  border: 2px solid #d9d9d9;
+  border-radius: 5px;
+  box-sizing: border-box;
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_right > .tab > .table,
+.f_box_top_right > .tab > .list {
+  width: 50%;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+}
+
+.f_box_top_right > .tab > .list::before {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/list.png");
+  background-size: 100% 100%;
+}
+
+.f_box_top_right > .tab > .list.active,
+.f_box_top_right > .tab > .table.active {
+  background: #fff;
+}
+
+.f_box_top_right > .tab > .table::before {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/table.png");
+  background-size: 100% 100%;
 }
 
 .mask {
-    background-color: rgb(0 0 0 / 30%);
-    /* position: fixed; */
-    position: absolute;
-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%;
-    z-index: 90;
-    display: flex;
-    align-items: center;
-    justify-content: center;
+  background-color: rgb(0 0 0 / 30%);
+  /* position: fixed; */
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 90;
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }
 
 .progressBox {
-    width: 300px;
-    height: 150px;
-    background: #fff;
-    border-radius: 10px;
-    box-shadow: 0 0 6px 1px #bfbfbf;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    flex-direction: column;
-    position: relative;
-    color: #6c6c6c;
+  width: 300px;
+  height: 150px;
+  background: #fff;
+  border-radius: 10px;
+  box-shadow: 0 0 6px 1px #bfbfbf;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+  position: relative;
+  color: #6c6c6c;
 }
 
-.progressBox>>>.el-progress-bar__outer {
-    background-color: #d1dfff !important;
+.progressBox >>> .el-progress-bar__outer {
+  background-color: #d1dfff !important;
 }
 
 .progressBox .lbox {
-    height: 50px;
-    font-size: 19px;
-    display: flex;
-    align-items: center;
-    color: #747474;
+  height: 50px;
+  font-size: 19px;
+  display: flex;
+  align-items: center;
+  color: #747474;
 }
 
 .progressBox .lbox img {
-    width: 40px;
-    margin-right: 20px;
+  width: 40px;
+  margin-right: 20px;
 }
 
 .closeCss {
-    position: absolute;
-    top: 8px;
-    right: 8px;
-    cursor: pointer;
-    width: 20px;
-    height: 20px;
+  position: absolute;
+  top: 8px;
+  right: 8px;
+  cursor: pointer;
+  width: 20px;
+  height: 20px;
 }
 
-.closeCss>img {
-    width: 100%;
-    height: 100%;
+.closeCss > img {
+  width: 100%;
+  height: 100%;
 }
 
-
 .f_box_file_square {
-    height: calc(100% - 55px);
-    overflow: auto;
-    width: 100%;
-    padding: 55px;
-    box-sizing: border-box;
-    display: flex;
-    flex-wrap: wrap;
-    align-content: flex-start;
-    position: relative;
+  height: calc(100% - 55px);
+  overflow: auto;
+  width: 100%;
+  padding: 55px;
+  box-sizing: border-box;
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+  position: relative;
 }
 
-.f_box_file_square>.f_box_file {
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-    width: 160px;
-    height: 160px;
-    cursor: pointer;
-    margin: 0 36px 36px 0;
-    border-radius: 20px;
-    position: relative;
+.f_box_file_square > .f_box_file {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  width: 160px;
+  height: 160px;
+  cursor: pointer;
+  margin: 0 36px 36px 0;
+  border-radius: 20px;
+  position: relative;
 }
 
-.f_box_file_square>.f_box_file:hover {
-    background: #F0F2F5;
+.f_box_file_square > .f_box_file:hover {
+  background: #f0f2f5;
 }
 
-.f_box_file_square>.f_box_file:hover>.check {
-    display: block;
+.f_box_file_square > .f_box_file:hover > .check {
+  display: block;
 }
 
-.f_box_file_square>.f_box_file.check {
-    background: #E0EAFB;
+.f_box_file_square > .f_box_file.check {
+  background: #e0eafb;
 }
 
-.f_box_file_square>.f_box_file.check>.check {
-    display: block;
+.f_box_file_square > .f_box_file.check > .check {
+  display: block;
 }
 
-.f_box_file_square>.f_box_file>.check {
-    position: absolute;
-    left: 15px;
-    top: 15px;
-    width: 16px;
-    height: 16px;
-    background-size: 100%;
-    display: none;
+.f_box_file_square > .f_box_file > .check {
+  position: absolute;
+  left: 15px;
+  top: 15px;
+  width: 16px;
+  height: 16px;
+  background-size: 100%;
+  display: none;
 }
 
-.f_box_file_square>.f_box_file>.check>img {
-    width: 100%;
-    height: 100%;
-    object-fit: cover;
+.f_box_file_square > .f_box_file > .check > img {
+  width: 100%;
+  height: 100%;
+  object-fit: cover;
 }
 
-.f_box_file_square>.f_box_file>img {
-    width: 90px;
-    height: 90px;
-    object-fit: cover;
+.f_box_file_square > .f_box_file > img {
+  width: 90px;
+  height: 90px;
+  object-fit: cover;
 }
 
-.f_box_file_square>.f_box_file>.name {
-    white-space: nowrap;
-    font-size: 14px;
-    max-width: 80%;
-    overflow: hidden;
-    margin: 4px auto 0;
-    text-overflow: ellipsis;
-    text-align: center;
+.f_box_file_square > .f_box_file > .name {
+  white-space: nowrap;
+  font-size: 14px;
+  max-width: 80%;
+  overflow: hidden;
+  margin: 4px auto 0;
+  text-overflow: ellipsis;
+  text-align: center;
 }
 
 .f_box_file_list {
-    /* height: calc(100% - 55px); */
-    /* overflow: auto; */
-    width: 100%;
-    padding: 10px;
-    box-sizing: border-box;
+  /* height: calc(100% - 55px); */
+  /* overflow: auto; */
+  width: 100%;
+  padding: 10px;
+  box-sizing: border-box;
 }
 
-.f_box_file_list>.f_box_file {}
-
-
-.f_box_file_allCheck {
-    display: flex;
-    align-items: center;
-    position: absolute;
-    font-size: 14px;
-    top: 20px;
-    left: 10px;
-    cursor: pointer;
+.f_box_file_list > .f_box_file {
 }
 
-.f_box_file_allCheck>img {
-    width: 16px;
-    height: 16px;
-    object-fit: cover;
-    margin-right: 5px;
-}
-
-.dialog>>>.el-dialog__body {
-    padding: 10px 20px;
-}
-
-.type_nav_box {}
-
-.type_nav_box>.nav {
-    height: 40px;
-    border-radius: 5px;
-    cursor: pointer;
-    display: flex;
-    align-items: center;
-    width: 100%;
-    padding: 0 10px;
-    box-sizing: border-box;
-    margin-bottom: 10px;
-    font-size: 16px;
-    color: #000;
-}
-
-.type_nav_box>.nav>.down {
-    min-width: 14px;
-    height: 14px;
-    background-image: url('../../../assets/icon/sourceFile/icon_arrow.png');
-    background-size: 100% 100%;
-    margin-right: 10px;
-    transition: all 0.3s;
-    transform: rotate(-90deg);
-}
-
-.type_nav_box>.nav.active>.down {
-    transform: rotate(0deg);
-}
-
-.type_nav_box>.nav>.file {
-    min-width: 18px;
-    height: 18px;
-    background-image: url('../../../assets/icon/sourceFile/file.png');
-    background-size: 100% 100%;
-    margin-right: 10px;
-}
-
-.type_nav_box>.nav>.name {
-    max-width: 100%;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
-}
-
-.type_nav_box>.child {}
-
-.type_nav_box>.child>.nav {
-    height: 40px;
-    border-radius: 5px;
-    cursor: pointer;
-    display: flex;
-    align-items: center;
-    width: 100%;
-    padding: 0 10px 0 50px;
-    box-sizing: border-box;
-    margin-bottom: 10px;
-    font-size: 16px;
-    color: #000;
-}
-
-.type_nav_box>.child>.nav.active {
-    background: #e0eafb;
-}
-
-.type_nav_box>.child>.nav>.file {
-    min-width: 18px;
-    height: 18px;
-    background-image: url('../../../assets/icon/sourceFile/file.png');
-    background-size: 100% 100%;
-    margin-right: 10px;
-}
-
-.type_nav_box>.child>.nav>.name {
-    max-width: 100%;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
-}
-
-.none_box {
-    height: calc(100% - 55px);
-    overflow: auto;
-    width: 100%;
-    padding: 10px;
-    box-sizing: border-box;
-    display: flex;
-    align-items: center;
-    justify-content: center;
+.f_box_file_allCheck {
+  display: flex;
+  align-items: center;
+  position: absolute;
+  font-size: 14px;
+  top: 20px;
+  left: 10px;
+  cursor: pointer;
 }
 
-
-.list_file_box {
-    width: 100%;
+.f_box_file_allCheck > img {
+  width: 16px;
+  height: 16px;
+  object-fit: cover;
+  margin-right: 5px;
 }
 
-.list_file_box>.list_top {
-    width: 100%;
-    display: flex;
-    align-items: center;
-    height: 50px;
+.dialog >>> .el-dialog__body {
+  padding: 10px 20px;
 }
 
-.list_file_box .check {
-    width: 21px;
-    margin: 0 10px;
-    display: flex;
-    align-items: center;
-    justify-content: center;
+.type_nav_box {
 }
 
-.list_allcheck {
-    cursor: pointer;
-    width: 14px;
-    height: 14px;
+.type_nav_box > .nav {
+  height: 40px;
+  border-radius: 5px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  width: 100%;
+  padding: 0 10px;
+  box-sizing: border-box;
+  margin-bottom: 10px;
+  font-size: 16px;
+  color: #000;
 }
 
-.list_allcheck>img {
-    width: 100%;
-    height: 100%;
-    object-fit: cover;
+.type_nav_box > .nav > .down {
+  min-width: 14px;
+  height: 14px;
+  background-image: url("../../../assets/icon/sourceFile/icon_arrow.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
+  transition: all 0.3s;
+  transform: rotate(-90deg);
 }
 
-.list_file_box .name {
-    width: calc(100% - 21px - 100px - 100px - 200px - 50px);
-    margin-right: 10px;
+.type_nav_box > .nav.active > .down {
+  transform: rotate(0deg);
 }
 
-.list_file_box .size {
-    width: 100px;
-    margin-right: 10px;
+.type_nav_box > .nav > .file {
+  min-width: 18px;
+  height: 18px;
+  background-image: url("../../../assets/icon/sourceFile/file.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
 }
 
-.list_file_box .type {
-    width: 100px;
-    margin-right: 10px;
+.type_nav_box > .nav > .name {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
 }
 
-.list_file_box .time {
-    width: 200px;
+.type_nav_box > .child {
 }
 
-.list_top>.check,
-.list_top>.name,
-.list_top>.size,
-.list_top>.type,
-.list_top>.time {
-    font-size: 16px;
+.type_nav_box > .child > .nav {
+  height: 40px;
+  border-radius: 5px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  width: 100%;
+  padding: 0 10px 0 50px;
+  box-sizing: border-box;
+  margin-bottom: 10px;
+  font-size: 16px;
+  color: #000;
 }
 
-.list_content {
-    width: 100%;
-    display: flex;
-    align-items: center;
-    height: 50px;
-    cursor: pointer;
+.type_nav_box > .child > .nav.active {
+  background: #e0eafb;
 }
 
-.list_content:hover {
-    background: #f0f2f5;
+.type_nav_box > .child > .nav > .file {
+  min-width: 18px;
+  height: 18px;
+  background-image: url("../../../assets/icon/sourceFile/file.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
 }
 
-.list_content.active {
-    background: #e0eafb;
+.type_nav_box > .child > .nav > .name {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
 }
 
-.list_content>.name {
-    font-size: 14px;
-    color: #000000e6;
+.none_box {
+  height: calc(100% - 55px);
+  overflow: auto;
+  width: 100%;
+  padding: 10px;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }
 
-.list_content>.size,
-.list_content>.type,
-.list_content>.time {
-    font-size: 12px;
-    color: #00000099;
+.list_file_box {
+  width: 100%;
 }
 
 .list_file_name {
-    display: flex;
-    align-items: center;
+  display: flex;
+  align-items: center;
 }
 
-.list_file_name>img {
-    width: 24px;
-    height: 24px;
-    object-fit: cover;
-    margin-right: 5px;
+.list_file_name > img {
+  width: 24px;
+  height: 24px;
+  object-fit: cover;
+  margin-right: 5px;
 }
 
-.list_file_name>div {
-    max-width: 100%;
-    overflow: hidden;
-    white-space: nowrap;
-    text-overflow: ellipsis;
+.list_file_name > div {
+  max-width: 100%;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
 }
 </style>

+ 793 - 645
src/components/pages/knowledge/folder.vue

@@ -1,95 +1,197 @@
 <template>
-    <div class="f_box">
-        <div class="f_box_top">
-            <div class="f_box_top_left">
-                <div class="f_box_top_title">
-                    所有文件夹
-                </div>
-            </div>
-            <div class="f_box_top_right">
-                <div class="btn" @click="openAdd">
-                    新建文件夹
-                </div>
-                <div class="btn delBtn" @click="deleteFolder">
-                    删除
-                </div>
-            </div>
+  <div class="f_box">
+    <div class="f_box_top">
+      <div class="f_box_top_left">
+        <div class="f_box_top_title">
+          所有文件夹
         </div>
-        <div class="f_box_top">
-            <div class="f_box_top_left">
-                
-            </div>
-            <div class="f_box_top_right">
-                <div class="input">
-                    <input type="text" v-model="fileName" placeholder="请输入你需要搜索的文件夹名字" @keyup.enter="serchFile">
-                    <div class="serch" @click="serchFile"></div>
-                </div>
-            </div>
+      </div>
+      <div class="f_box_top_right">
+        <div class="btn" @click="openAdd">
+          新建文件夹
         </div>
-        <div class="none_box" v-if="fileArray.length == 0">
-            暂无文件夹
+        <div class="btn delBtn" @click="deleteFolder">
+          删除
         </div>
-        <div class="f_box_file_list" v-else-if="stype == '2' && fileArray.length" v-loading.body="isLoading">
-            <div class="list_file_box">
-                <el-table :data="fileArray" border stripe style="width: 100%" @selection-change="handleSelectionChange" :row-key="row => row.id">
-                    <el-table-column type="selection" width="50px"></el-table-column>
-                    <el-table-column prop="name" label="文件夹名字" show-overflow-tooltip min-width="15"></el-table-column>
-                    <el-table-column prop="detail" label="描述" show-overflow-tooltip min-width="20"></el-table-column>
-                    <el-table-column prop="fileCount" label="文件数" width="80px"></el-table-column>
-                    <el-table-column prop="username" label="拥有者" show-overflow-tooltip min-width="10"></el-table-column>
-                    <el-table-column label="标签" show-overflow-tooltip min-width="10">
-                        <template slot-scope="scope">
-                            {{ getTag(scope.row)}}
-                        </template>
-                    </el-table-column>
-                    <el-table-column label="公开权限" width="80px">
-                        <template slot-scope="scope">
-                            {{ getJuri(scope.row.juri)}}
-                        </template>
-                    </el-table-column>
-                    <el-table-column prop="time" label="编辑时间" min-width="15"></el-table-column>
-                    <el-table-column label="操作" width="200px">
-                        <template slot-scope="scope">
-                            <div>
-                                <el-button @click="editFile(scope.row.id)" type="primary" size="small">查看</el-button>
-                                <el-button @click="deleteFile(scope.row.id)" type="danger" size="small">删除</el-button>
-                            </div>
-                        </template>
-                    </el-table-column>
-                </el-table>
-            </div>
-            <el-pagination
-                style="margin-top: 10px;"
-                background
-                layout="prev, pager, next"
-                :page-size="10"
-                :total="total"
-                @current-change="handleCurrentChange"
-                >
-            </el-pagination>
+      </div>
+    </div>
+    <div class="f_box_top">
+      <div class="f_box_top_left">
+        <el-select
+          style="margin-right: 10px; width: 100px;"
+          v-loading="tagLoading1"
+          v-model="check1"
+          placeholder="学科"
+          clearable
+          filterable
+          collapse-tags
+          @change="serchFile()"
+        >
+          <el-option
+            v-for="(item, index) in tagData1"
+            :key="index"
+            :label="item.name"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+        <el-select
+          style="width: 100px;"
+          v-loading="tagLoading2"
+          v-model="check2"
+          placeholder="年级"
+          clearable
+          filterable
+          @change="serchFile()"
+        >
+          <el-option
+            v-for="(item, index) in tagData2"
+            :key="index"
+            :label="item.name"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+      </div>
+      <div class="f_box_top_right">
+        <div class="input">
+          <input
+            type="text"
+            v-model="fileName"
+            placeholder="请输入你需要搜索的文件夹名字"
+            @keyup.enter="serchFile"
+          />
+          <div class="serch" @click="serchFile"></div>
         </div>
-        <el-dialog title="新建文件夹" :visible.sync="moveBox" width="550px" @close="moveBox = false" class="dialog">
-            <div>
-                <el-input v-model="folderName" placeholder="请输入知识库名称"></el-input>
-                <el-input v-model="folderDescription" type="textarea" rows="4" resize="none" placeholder="请输入知识库描述" style="margin-top: 10px;"></el-input>
-            </div>
-            <span slot="footer">
-                <el-button @click="moveBox = false">取 消</el-button>
-                <el-button type="primary" @click="createFolder">确 定</el-button>
-            </span>
-        </el-dialog>
-
+      </div>
+    </div>
+    <div class="none_box" v-if="fileArray.length == 0">
+      暂无文件夹
+    </div>
+    <div
+      class="f_box_file_list"
+      v-else-if="stype == '2' && fileArray.length"
+      v-loading.body="isLoading"
+    >
+      <div class="list_file_box">
+        <el-table
+          ref="myTable"
+          :data="fileArray"
+          border
+          stripe
+          style="width: 100%"
+          @selection-change="handleSelectionChange"
+          :row-key="row => row.id"
+        >
+          <el-table-column
+            type="selection"
+            width="50px"
+            :reserve-selection="true"
+            :selectable="isSelectable"
+          ></el-table-column>
+          <el-table-column
+            prop="name"
+            label="文件夹名字"
+            show-overflow-tooltip
+            min-width="15"
+          ></el-table-column>
+          <el-table-column
+            prop="detail"
+            label="描述"
+            show-overflow-tooltip
+            min-width="20"
+          ></el-table-column>
+          <el-table-column
+            prop="fileCount"
+            label="文件数"
+            width="80px"
+          ></el-table-column>
+          <el-table-column
+            prop="username"
+            label="拥有者"
+            show-overflow-tooltip
+            min-width="10"
+          ></el-table-column>
+          <el-table-column label="标签" show-overflow-tooltip min-width="10">
+            <template slot-scope="scope">
+              {{ getTag(scope.row) }}
+            </template>
+          </el-table-column>
+          <el-table-column label="公开权限" width="80px">
+            <template slot-scope="scope">
+              {{ getJuri(scope.row.juri) }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            prop="time"
+            label="编辑时间"
+            min-width="15"
+          ></el-table-column>
+          <el-table-column label="操作" width="200px">
+            <template slot-scope="scope">
+              <div>
+                <el-button
+                  @click="editFile(scope.row.id, scope.row.folderid)"
+                  type="primary"
+                  size="small"
+                  >查看</el-button
+                >
+                <el-button
+                  @click="deleteFile(scope.row.id, scope.row.folderid)"
+                  type="danger"
+                  size="small"
+                  v-if="scope.row.userid == userid && scope.row.isMo == '2'"
+                  >删除</el-button
+                >
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <el-pagination
+        style="margin-top: 10px;"
+        background
+        layout="prev, pager, next"
+        :page-size="10"
+        :total="total"
+        @current-change="handleCurrentChange"
+      >
+      </el-pagination>
     </div>
+    <el-dialog
+      title="新建文件夹"
+      :visible.sync="moveBox"
+      width="550px"
+      @close="moveBox = false"
+      class="dialog"
+    >
+      <div>
+        <el-input
+          v-model="folderName"
+          placeholder="请输入知识库名称"
+        ></el-input>
+        <el-input
+          v-model="folderDescription"
+          type="textarea"
+          rows="4"
+          resize="none"
+          placeholder="请输入知识库描述"
+          style="margin-top: 10px;"
+        ></el-input>
+      </div>
+      <span slot="footer">
+        <el-button @click="moveBox = false">取 消</el-button>
+        <el-button type="primary" @click="createFolder(2)">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import officeImg from '../../../assets/icon/sourceFile/office.png'
-import pdfImg from '../../../assets/icon/sourceFile/pdf.png'
-import videoImg from '../../../assets/icon/sourceFile/video.png'
-import otherImg from '../../../assets/icon/sourceFile/other.png'
-import checkImg from '../../../assets/icon/sourceFile/check.png'
-import checkIsImg from '../../../assets/icon/sourceFile/check_is.png'
-
+import officeImg from "../../../assets/icon/sourceFile/office.png";
+import pdfImg from "../../../assets/icon/sourceFile/pdf.png";
+import videoImg from "../../../assets/icon/sourceFile/video.png";
+import otherImg from "../../../assets/icon/sourceFile/other.png";
+import checkImg from "../../../assets/icon/sourceFile/check.png";
+import checkIsImg from "../../../assets/icon/sourceFile/check_is.png";
 
 import wVideo from "../test/file/wVideo.vue";
 import wpdf from "../test/file/wPdf2.vue";
@@ -98,682 +200,728 @@ import wOffice from "../test/file/wOffice.vue";
 import JSZip from "jszip";
 import FileSaver from "file-saver";
 
-const getFile = (url) => {
-    return new Promise((resolve, reject) => {
-        var credentials = {
-            accessKeyId: "AKIATLPEDU37QV5CHLMH",
-            secretAccessKey: "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",
-        }; //秘钥形式的登录上传
-        window.AWS.config.update(credentials);
-        window.AWS.config.region = "cn-northwest-1"; //设置区域
-        let url2 = url;
-        let _url2 = "";
-        if (
-            url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
-        ) {
-            _url2 = url2.split(
-                "https://view.officeapps.live.com/op/view.aspx?src="
-            )[1];
-        } else {
-            _url2 = url2;
-        }
-        var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
-        let name = decodeURIComponent(_url2.split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1].replace(/\+/g, ' '))
-        var params = {
-            Bucket: "ccrb",
-            Key: name
-        };
-        s3.getObject(params, function (err, data) {
-            if (err) {
-                console.log(err, err.stack)
-                resolve({ data: 1 });
-            } else {
-                resolve({ data: data.Body });
-                console.log(data);
-            }          // sxuccessful response
-
-        });
-        // axios({
+const getFile = url => {
+  return new Promise((resolve, reject) => {
+    var credentials = {
+      accessKeyId: "AKIATLPEDU37QV5CHLMH",
+      secretAccessKey: "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"
+    }; //秘钥形式的登录上传
+    window.AWS.config.update(credentials);
+    window.AWS.config.region = "cn-northwest-1"; //设置区域
+    let url2 = url;
+    let _url2 = "";
+    if (
+      url2.indexOf("https://view.officeapps.live.com/op/view.aspx?src=") != -1
+    ) {
+      _url2 = url2.split(
+        "https://view.officeapps.live.com/op/view.aspx?src="
+      )[1];
+    } else {
+      _url2 = url2;
+    }
+    var s3 = new window.AWS.S3({ params: { Bucket: "ccrb" } });
+    let name = decodeURIComponent(
+      _url2
+        .split("https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/")[1]
+        .replace(/\+/g, " ")
+    );
+    var params = {
+      Bucket: "ccrb",
+      Key: name
+    };
+    s3.getObject(params, function(err, data) {
+      if (err) {
+        console.log(err, err.stack);
+        resolve({ data: 1 });
+      } else {
+        resolve({ data: data.Body });
+        console.log(data);
+      } // sxuccessful response
     });
+    // axios({
+  });
 };
 export default {
-    components: {
-        wVideo,
-        wpdf,
-        wOffice,
+  components: {
+    wVideo,
+    wpdf,
+    wOffice
+  },
+  props: {
+    userid: {
+      type: String
     },
-    props: {
-        userid: {
-            type: String,
-        },
-        typeArray: {
-            type: Array,
-        },
-        pid: {
-            type: String,
-        },
-        type: {
-            type: String
-        }
+    typeArray: {
+      type: Array
     },
-    watch: {
-        pid: {
-            immediate: true,
-            deep: true,
-            handler(newValue, oldValue) {
-                this.fileArray = []
-                this.checkArray = []
-                this.fileName = ''
-                this.page = 1
-                this.getData()
-            },
-        },
+    pid: {
+      type: String
     },
-    data() {
-        return {
-            isLoading: false,
-            proVisible: false,
-            stype: 2,
-            fileArray: [],
-            officeImg: officeImg,
-            pdfImg: pdfImg,
-            videoImg: videoImg,
-            otherImg: otherImg,
-            checkImg: checkImg,
-            checkIsImg: checkIsImg,
-            checkArray: [],
-            dialogVisiblePdf: false,
-            dialogVisibleVideo: false,
-            dialogVisibleOffice: false,
-            wurl: '',
-            moveBox: false,
-            checkTypeArray: [],
-            moveChild: '',
-            fileName: '',
-            folderName: "",
-            folderDescription: "",
-            page: 1,
-            total: 0,
+    type: {
+      type: String
+    }
+  },
+  watch: {
+    pid: {
+      immediate: true,
+      deep: true,
+      handler(newValue, oldValue) {
+        this.fileArray = [];
+        this.checkArray = [];
+        this.fileName = "";
+        this.page = 1;
+        this.getData();
+        this.getTagArray(1);
+        this.getTagArray(2);
+      }
+    }
+  },
+  data() {
+    return {
+      isLoading: false,
+      proVisible: false,
+      stype: 2,
+      fileArray: [],
+      officeImg: officeImg,
+      pdfImg: pdfImg,
+      videoImg: videoImg,
+      otherImg: otherImg,
+      checkImg: checkImg,
+      checkIsImg: checkIsImg,
+      checkArray: [],
+      checkArray2: [],
+      dialogVisiblePdf: false,
+      dialogVisibleVideo: false,
+      dialogVisibleOffice: false,
+      wurl: "",
+      moveBox: false,
+      checkTypeArray: [],
+      moveChild: "",
+      fileName: "",
+      folderName: "",
+      folderDescription: "",
+      page: 1,
+      total: 0,
+      tagLoading1: false,
+      tagLoading2: false,
+      tagData1: [],
+      tagData2: [],
+      check1: [],
+      check2: []
+    };
+  },
+  computed: {
+    retrunType() {
+      return function(item) {
+        if (item.type == 1) {
+          return "OFFICE文件";
+        } else if (item.type == 2) {
+          return "视频文件";
+        } else if (item.type == 3) {
+          return "图片";
+        } else if (item.type == 4) {
+          return "PDF文件";
+        } else if (item.type == 5) {
+          return "其他文件";
         }
+      };
     },
-    computed: {
-        retrunType() {
-            return function (item) {
-                if (item.type == 1) {
-                    return 'OFFICE文件'
-                } else if (item.type == 2) {
-                    return '视频文件'
-                } else if (item.type == 3) {
-                    return '图片'
-                } else if (item.type == 4) {
-                    return 'PDF文件'
-                } else if (item.type == 5) {
-                    return '其他文件'
-                }
-            };
-        },
-        getJuri() {
-            return function (juri) {
-                if (juri == 1) {
-                    return '私有'
-                } else if (juri == 2) {
-                    return '组织内'
-                } else if (juri == 3) {
-                    return '全部'
-                }
-            };
-        },
-        getTag() {
-            return function (row) {
-                const tags = [row.classTagName, row.subTagName, row.tag]
-                    .filter(tag => tag) // 过滤掉空值
-                    .flatMap(tag => tag.split(",")); // 展开并分割
-                return tags.length ? tags.join(",") : '-';
-            };
-        },
+    getJuri() {
+      return function(juri) {
+        if (juri == 1) {
+          return "私有";
+        } else if (juri == 2) {
+          return "组织内";
+        } else if (juri == 3) {
+          return "全部";
+        }
+      };
     },
-    methods: {
-        handleCurrentChange(val) {
-            this.page = val;
-            this.getData();
-        },
-        getData() {
-            let type = this.pid.split("/")
-            let id = ''
-            if (type[0] == '0') {
-                id = this.userid
-            }
-            this.isLoading = true;
-            let params = {
-                uid: id,
-                page: this.page,
-                num: 10
-            };
-            this.ajax
-                .post(this.$store.state.api + "getFolderPage", [params])
-                .then((res) => {
-                    this.isLoading = false;
-                    this.total = res.data[0][0].num;
-                    this.fileArray = res.data[0];
-                    this.$parent.getData();
-                })
-                .catch((err) => {
-                    this.isLoading = false;
-                    console.error(err);
-                });
-        },
-        serchFile() {
-            this.getData();
-        },
-        handleSelectionChange(selectedRows) {
-            this.checkArray = selectedRows.map(row => row.id);
-        },
-        checkFile(id) {
-            if (this.checkArray.indexOf(id) == -1) {
-                this.checkArray.push(id)
-            } else {
-                this.checkArray.splice(this.checkArray.indexOf(id), 1)
-            }
-        },
-        checkAll() {
-            if (this.checkArray.length === this.fileArray.length) {
-                this.checkArray = []
-            } else {
-                this.checkArray = []
-                this.fileArray.forEach(item => {
-                    this.checkArray.push(item.id)
-                });
-            }
-        },
-        deleteFile(id) {
-            this.$confirm("确定删除文件夹吗?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            })
-            .then(() => {
-                let params = [
-                    { ids: id }
-                ]
-                this.ajax
-                    .post(this.$store.state.api + "deleteFolder", params)
-                    .then((res) => {
-                        this.$message({
-                            message: "删除成功",
-                            type: "success",
-                        });
-                        this.checkArray = []
-                        this.getData();
-                    })
-                    .catch((err) => {
-                        this.$message.error("删除失败");
-                        console.error(err);
-                    });
+    getTag() {
+      return function(row) {
+        const tags = [row.classTagName, row.subTagName, row.tag]
+          .filter(tag => tag) // 过滤掉空值
+          .flatMap(tag => tag.split(",")); // 展开并分割
+        return tags.length ? tags.join(",") : "-";
+      };
+    }
+  },
+  methods: {
+    getTagArray(type) {
+      const tagLoadings = [
+        this.tagLoading1,
+        this.tagLoading2,
+        this.tagLoading3
+      ];
+      tagLoadings[type - 1] = true;
+
+      let params = {
+        type: type,
+        uid: this.userid
+      };
+      this.ajax
+        .post(this.$store.state.api + "getKnowledgeTag", [params])
+        .then(res => {
+          tagLoadings[type - 1] = false;
+          this[`tagData${type}`] = res.data[0];
+          const checkKey = `check${type}`;
+          this[checkKey] = this[checkKey].filter(tag =>
+            this[`tagData${type}`].some(item => item.id === tag)
+          );
+        })
+        .catch(err => {
+          tagLoadings[type - 1] = false;
+          console.error(err);
+        });
+    },
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getData();
+    },
+    getData() {
+      let type = this.pid.split("/");
+      let id = "";
+      if (type[0] == "0") {
+        id = this.userid;
+      }
+      this.isLoading = true;
+      let params = {
+        uid: id,
+        sub: this.check1,
+        class: this.check2,
+        page: this.page,
+        num: 10
+      };
+      this.ajax
+        .post(this.$store.state.api + "getFolderPage", [params])
+        .then(res => {
+          this.isLoading = false;
+          this.total = res.data[0].length ? res.data[0][0].num : 0;
+          this.fileArray = res.data[0];
+          if (
+            res.data[0].length == 0 &&
+            this.check1 == "" &&
+            this.check2 == ""
+          ) {
+            this.folderName = "默认文件夹";
+            this.folderDescription = "默认文件夹";
+            this.createFolder(1);
+          }
+          this.$parent.getData();
+          this.$forceUpdate();
+        })
+        .catch(err => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    serchFile() {
+      this.page = 1;
+      this.getData();
+    },
+    handleSelectionChange(selectedRows) {
+      this.checkArray = selectedRows.map(row => row.id);
+      this.checkArray2 = selectedRows.map(row => ({
+        id: row.id,
+        folderid: row.folderid
+      }));
+    },
+    deleteFile(id, folderid) {
+      this.$confirm("确定删除文件夹吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          let params = [{ ids: id, folderids: folderid }];
+          this.ajax
+            .post(this.$store.state.fileApi + "deleteFolder", params)
+            .then(res => {
+              this.$message({
+                message: "删除成功",
+                type: "success"
+              });
+              this.checkArray = [];
+              this.checkArray2 = [];
+              this.$refs.myTable.clearSelection();
+              this.getData();
             })
-            .catch(() => { });
-        },
-        deleteFolder(){
-            if(!this.checkArray.length){
-                this.$message.warning("请选择要删除的文件夹")
-                return;
-            }
-            this.deleteFile(this.checkArray.join(","))
-        },
-        checkMoveChild(item) {
-            this.moveChild = item
-        },
-        openAdd(){
-            this.moveBox = true
-        },
-        createFolder(){
-            if (!this.folderName) {
-                this.$message.error("文件夹名字必填");
-                return;
-            }
-            let params = [
-                { 
-                    n: this.folderName,
-                    fd: this.folderDescription,
-                    uid: this.userid,
-                }
-            ]
-            this.ajax
-                .post(this.$store.state.api + "addFolder", params)
-                .then((res) => {
-                    this.$message({
-                        message: "创建成功",
-                        type: "success",
-                    });
-                    this.moveBox = false;
-                    this.getData();
-                })
-                .catch((err) => {
-                    this.$message.error("删除失败");
-                    console.error(err);
-                });
-        },
-        editFile(id){
-            console.log(id);
-            
-            let array = [this.pid.split("/")[0], id];
-            this.$emit('checkType', array.join('/'));
+            .catch(err => {
+              this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+        .catch(() => {});
+    },
+    deleteFolder() {
+      if (!this.checkArray.length) {
+        this.$message.warning("请选择要删除的文件夹");
+        return;
+      }
+      let array = this.checkArray2.map(item => item.id);
+      let array2 = this.checkArray2.map(item => item.folderid);
+      this.deleteFile(array.join(","), array2.join(","));
+    },
+    checkMoveChild(item) {
+      this.moveChild = item;
+    },
+    openAdd() {
+      this.folderName = "";
+      this.folderDescription = "";
+      this.moveBox = true;
+    },
+    createFolder(im) {
+      if (!this.folderName) {
+        this.$message.error("文件夹名字必填");
+        return;
+      }
+      let params = [
+        {
+          n: this.folderName,
+          fd: this.folderDescription,
+          uid: this.userid,
+          im: im ? im : 2
         }
+      ];
+      this.ajax
+        .post(this.$store.state.fileApi + "addFolder", params)
+        .then(res => {
+          this.$message({
+            message: "创建成功",
+            type: "success"
+          });
+          this.moveBox = false;
+          this.getData();
+        })
+        .catch(err => {
+          this.$message.error("删除失败");
+          console.error(err);
+        });
     },
-    mounted() {
-        this.getData();
+    editFile(id, folderid) {
+      console.log(id);
+
+      let array = [this.pid.split("/")[0], id];
+      this.$emit("checkType", array.join("/"), folderid);
     },
-}
+    isSelectable(row) {
+      return row.isMo == "2";
+    }
+  },
+  mounted() {
+    // this.getData();
+  }
+};
 </script>
 
 <style scoped>
 .f_box {
-    width: 100%;
-    /* height: 100%; */
-    position: relative;
+  width: 100%;
+  /* height: 100%; */
+  position: relative;
 }
 
 .f_box_top {
-    display: flex;
-    align-items: center;
-    padding: 10px;
-    width: 100%;
-    box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  padding: 10px;
+  width: 100%;
+  box-sizing: border-box;
 }
 
 .f_box_top_left {
-    display: flex;
-    align-items: center;
+  display: flex;
+  align-items: center;
 }
 
-.f_box_top_title{
-    font-size: 16px;
-    /* font-weight: bold; */
+.f_box_top_title {
+  font-size: 16px;
+  /* font-weight: bold; */
 }
 
 .f_box_top .btn {
-    display: flex;
-    cursor: pointer;
-    align-items: center;
-    height: 30px;
-    padding: 0 8px;
-    background: rgb(0, 97, 255);
-    color: #fff;
-    box-sizing: border-box;
-    border-radius: 4px;
-    font-size: 14px;
-    align-items: center;
+  display: flex;
+  cursor: pointer;
+  align-items: center;
+  height: 30px;
+  padding: 0 8px;
+  background: rgb(0, 97, 255);
+  color: #fff;
+  box-sizing: border-box;
+  border-radius: 4px;
+  font-size: 14px;
+  align-items: center;
 }
 
 .f_box_top .btn2 {
-    display: flex;
-    cursor: pointer;
-    align-items: center;
-    height: 30px;
-    padding: 0 8px;
-    background: #fff;
-    color: rgb(0, 97, 255);
-    border: 1px solid rgb(0, 97, 255);
-    box-sizing: border-box;
-    border-radius: 4px;
-    font-size: 14px;
-    align-items: center;
+  display: flex;
+  cursor: pointer;
+  align-items: center;
+  height: 30px;
+  padding: 0 8px;
+  background: #fff;
+  color: rgb(0, 97, 255);
+  border: 1px solid rgb(0, 97, 255);
+  box-sizing: border-box;
+  border-radius: 4px;
+  font-size: 14px;
+  align-items: center;
 }
 
 .f_box_top .delBtn {
-    background: rgb(255, 0, 13);
+  background: rgb(255, 0, 13);
 }
 
-.f_box_top .btn+.btn2,
-.f_box_top .btn+.btn,
-.f_box_top .btn2+.btn2,
-.f_box_top .btn2+.delBtn {
-    margin-left: 15px;
+.f_box_top .btn + .btn2,
+.f_box_top .btn + .btn,
+.f_box_top .btn2 + .btn2,
+.f_box_top .btn2 + .delBtn {
+  margin-left: 15px;
 }
 
 .f_box_top_right {
-    margin-left: auto;
-    max-width: calc(100% - 280px);
-    overflow: hidden;
-    display: flex;
-    align-items: center;
-}
-
-.f_box_top_right>.input {
-    position: relative;
-    width: 250px;
-    height: 35px;
-}
-
-.f_box_top_right>.input>input {
-    width: 100%;
-    height: 100%;
-    border: 1px solid #D9D9D9;
-    border-radius: 5px;
-    padding: 0 45px 0 10px;
-    box-sizing: border-box;
-    font-size: 12px;
-    outline: none;
-}
-
-.f_box_top_right>.input>.serch {
-    content: '';
-    display: block;
-    width: 20px;
-    height: 20px;
-    background-image: url('../../../assets/icon/sourceFile/search.png');
-    background-size: 100% 100%;
-    position: absolute;
-    right: 13px;
-    top: 50%;
-    transform: translateY(-50%);
-    cursor: pointer;
-}
-
-.f_box_top_right>.tab {
-    height: 30px;
-    width: 80px;
-    margin-left: 15px;
-    background: #e7e7e7;
-    border: 2px solid #D9D9D9;
-    border-radius: 5px;
-    box-sizing: border-box;
-    overflow: hidden;
-    display: flex;
-    align-items: center;
-}
-
-.f_box_top_right>.tab>.table,
-.f_box_top_right>.tab>.list {
-    width: 50%;
-    height: 100%;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    cursor: pointer;
-}
-
-.f_box_top_right>.tab>.list::before {
-    content: '';
-    display: block;
-    width: 20px;
-    height: 20px;
-    background-image: url('../../../assets/icon/sourceFile/list.png');
-    background-size: 100% 100%;
-}
-
-.f_box_top_right>.tab>.list.active,
-.f_box_top_right>.tab>.table.active {
-    background: #fff;
-}
-
-.f_box_top_right>.tab>.table::before {
-    content: '';
-    display: block;
-    width: 20px;
-    height: 20px;
-    background-image: url('../../../assets/icon/sourceFile/table.png');
-    background-size: 100% 100%;
+  margin-left: auto;
+  max-width: calc(100% - 280px);
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_right > .input {
+  position: relative;
+  width: 250px;
+  height: 35px;
+}
+
+.f_box_top_right > .input > input {
+  width: 100%;
+  height: 100%;
+  border: 1px solid #d9d9d9;
+  border-radius: 5px;
+  padding: 0 45px 0 10px;
+  box-sizing: border-box;
+  font-size: 12px;
+  outline: none;
+}
+
+.f_box_top_right > .input > .serch {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/search.png");
+  background-size: 100% 100%;
+  position: absolute;
+  right: 13px;
+  top: 50%;
+  transform: translateY(-50%);
+  cursor: pointer;
+}
+
+.f_box_top_right > .tab {
+  height: 30px;
+  width: 80px;
+  margin-left: 15px;
+  background: #e7e7e7;
+  border: 2px solid #d9d9d9;
+  border-radius: 5px;
+  box-sizing: border-box;
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_right > .tab > .table,
+.f_box_top_right > .tab > .list {
+  width: 50%;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+}
+
+.f_box_top_right > .tab > .list::before {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/list.png");
+  background-size: 100% 100%;
+}
+
+.f_box_top_right > .tab > .list.active,
+.f_box_top_right > .tab > .table.active {
+  background: #fff;
+}
+
+.f_box_top_right > .tab > .table::before {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/table.png");
+  background-size: 100% 100%;
 }
 
 .mask {
-    background-color: rgb(0 0 0 / 30%);
-    /* position: fixed; */
-    position: absolute;
-    top: 0;
-    left: 0;
-    width: 100%;
-    height: 100%;
-    z-index: 90;
-    display: flex;
-    align-items: center;
-    justify-content: center;
+  background-color: rgb(0 0 0 / 30%);
+  /* position: fixed; */
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 90;
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }
 
 .progressBox {
-    width: 300px;
-    height: 150px;
-    background: #fff;
-    border-radius: 10px;
-    box-shadow: 0 0 6px 1px #bfbfbf;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    flex-direction: column;
-    position: relative;
-    color: #6c6c6c;
+  width: 300px;
+  height: 150px;
+  background: #fff;
+  border-radius: 10px;
+  box-shadow: 0 0 6px 1px #bfbfbf;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+  position: relative;
+  color: #6c6c6c;
 }
 
-.progressBox>>>.el-progress-bar__outer {
-    background-color: #d1dfff !important;
+.progressBox >>> .el-progress-bar__outer {
+  background-color: #d1dfff !important;
 }
 
 .progressBox .lbox {
-    height: 50px;
-    font-size: 19px;
-    display: flex;
-    align-items: center;
-    color: #747474;
+  height: 50px;
+  font-size: 19px;
+  display: flex;
+  align-items: center;
+  color: #747474;
 }
 
 .progressBox .lbox img {
-    width: 40px;
-    margin-right: 20px;
+  width: 40px;
+  margin-right: 20px;
 }
 
 .closeCss {
-    position: absolute;
-    top: 8px;
-    right: 8px;
-    cursor: pointer;
-    width: 20px;
-    height: 20px;
+  position: absolute;
+  top: 8px;
+  right: 8px;
+  cursor: pointer;
+  width: 20px;
+  height: 20px;
 }
 
-.closeCss>img {
-    width: 100%;
-    height: 100%;
+.closeCss > img {
+  width: 100%;
+  height: 100%;
 }
 
-
 .f_box_file_square {
-    height: calc(100% - 55px);
-    overflow: auto;
-    width: 100%;
-    padding: 55px;
-    box-sizing: border-box;
-    display: flex;
-    flex-wrap: wrap;
-    align-content: flex-start;
-    position: relative;
+  height: calc(100% - 55px);
+  overflow: auto;
+  width: 100%;
+  padding: 55px;
+  box-sizing: border-box;
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+  position: relative;
 }
 
-.f_box_file_square>.f_box_file {
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-    width: 160px;
-    height: 160px;
-    cursor: pointer;
-    margin: 0 36px 36px 0;
-    border-radius: 20px;
-    position: relative;
+.f_box_file_square > .f_box_file {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  width: 160px;
+  height: 160px;
+  cursor: pointer;
+  margin: 0 36px 36px 0;
+  border-radius: 20px;
+  position: relative;
 }
 
-.f_box_file_square>.f_box_file:hover {
-    background: #F0F2F5;
+.f_box_file_square > .f_box_file:hover {
+  background: #f0f2f5;
 }
 
-.f_box_file_square>.f_box_file:hover>.check {
-    display: block;
+.f_box_file_square > .f_box_file:hover > .check {
+  display: block;
 }
 
-.f_box_file_square>.f_box_file.check {
-    background: #E0EAFB;
+.f_box_file_square > .f_box_file.check {
+  background: #e0eafb;
 }
 
-.f_box_file_square>.f_box_file.check>.check {
-    display: block;
+.f_box_file_square > .f_box_file.check > .check {
+  display: block;
 }
 
-.f_box_file_square>.f_box_file>.check {
-    position: absolute;
-    left: 15px;
-    top: 15px;
-    width: 16px;
-    height: 16px;
-    background-size: 100%;
-    display: none;
+.f_box_file_square > .f_box_file > .check {
+  position: absolute;
+  left: 15px;
+  top: 15px;
+  width: 16px;
+  height: 16px;
+  background-size: 100%;
+  display: none;
 }
 
-.f_box_file_square>.f_box_file>.check>img {
-    width: 100%;
-    height: 100%;
-    object-fit: cover;
+.f_box_file_square > .f_box_file > .check > img {
+  width: 100%;
+  height: 100%;
+  object-fit: cover;
 }
 
-.f_box_file_square>.f_box_file>img {
-    width: 90px;
-    height: 90px;
-    object-fit: cover;
+.f_box_file_square > .f_box_file > img {
+  width: 90px;
+  height: 90px;
+  object-fit: cover;
 }
 
-.f_box_file_square>.f_box_file>.name {
-    white-space: nowrap;
-    font-size: 14px;
-    max-width: 80%;
-    overflow: hidden;
-    margin: 4px auto 0;
-    text-overflow: ellipsis;
-    text-align: center;
+.f_box_file_square > .f_box_file > .name {
+  white-space: nowrap;
+  font-size: 14px;
+  max-width: 80%;
+  overflow: hidden;
+  margin: 4px auto 0;
+  text-overflow: ellipsis;
+  text-align: center;
 }
 
 .f_box_file_list {
-    /* height: calc(100% - 55px); */
-    /* overflow: auto; */
-    width: 100%;
-    padding: 10px;
-    box-sizing: border-box;
+  /* height: calc(100% - 55px); */
+  /* overflow: auto; */
+  width: 100%;
+  padding: 10px;
+  box-sizing: border-box;
 }
 
-.f_box_file_list>.f_box_file {}
-
+.f_box_file_list > .f_box_file {
+}
 
 .f_box_file_allCheck {
-    display: flex;
-    align-items: center;
-    position: absolute;
-    font-size: 14px;
-    top: 20px;
-    left: 10px;
-    cursor: pointer;
+  display: flex;
+  align-items: center;
+  position: absolute;
+  font-size: 14px;
+  top: 20px;
+  left: 10px;
+  cursor: pointer;
 }
 
-.f_box_file_allCheck>img {
-    width: 16px;
-    height: 16px;
-    object-fit: cover;
-    margin-right: 5px;
+.f_box_file_allCheck > img {
+  width: 16px;
+  height: 16px;
+  object-fit: cover;
+  margin-right: 5px;
 }
 
-.dialog>>>.el-dialog__body {
-    padding: 10px 20px;
+.dialog >>> .el-dialog__body {
+  padding: 10px 20px;
 }
 
-.type_nav_box {}
+.type_nav_box {
+}
 
-.type_nav_box>.nav {
-    height: 40px;
-    border-radius: 5px;
-    cursor: pointer;
-    display: flex;
-    align-items: center;
-    width: 100%;
-    padding: 0 10px;
-    box-sizing: border-box;
-    margin-bottom: 10px;
-    font-size: 16px;
-    color: #000;
+.type_nav_box > .nav {
+  height: 40px;
+  border-radius: 5px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  width: 100%;
+  padding: 0 10px;
+  box-sizing: border-box;
+  margin-bottom: 10px;
+  font-size: 16px;
+  color: #000;
 }
 
-.type_nav_box>.nav>.down {
-    min-width: 14px;
-    height: 14px;
-    background-image: url('../../../assets/icon/sourceFile/icon_arrow.png');
-    background-size: 100% 100%;
-    margin-right: 10px;
-    transition: all 0.3s;
-    transform: rotate(-90deg);
+.type_nav_box > .nav > .down {
+  min-width: 14px;
+  height: 14px;
+  background-image: url("../../../assets/icon/sourceFile/icon_arrow.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
+  transition: all 0.3s;
+  transform: rotate(-90deg);
 }
 
-.type_nav_box>.nav.active>.down {
-    transform: rotate(0deg);
+.type_nav_box > .nav.active > .down {
+  transform: rotate(0deg);
 }
 
-.type_nav_box>.nav>.file {
-    min-width: 18px;
-    height: 18px;
-    background-image: url('../../../assets/icon/sourceFile/file.png');
-    background-size: 100% 100%;
-    margin-right: 10px;
+.type_nav_box > .nav > .file {
+  min-width: 18px;
+  height: 18px;
+  background-image: url("../../../assets/icon/sourceFile/file.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
 }
 
-.type_nav_box>.nav>.name {
-    max-width: 100%;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
+.type_nav_box > .nav > .name {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
 }
 
-.type_nav_box>.child {}
+.type_nav_box > .child {
+}
 
-.type_nav_box>.child>.nav {
-    height: 40px;
-    border-radius: 5px;
-    cursor: pointer;
-    display: flex;
-    align-items: center;
-    width: 100%;
-    padding: 0 10px 0 50px;
-    box-sizing: border-box;
-    margin-bottom: 10px;
-    font-size: 16px;
-    color: #000;
+.type_nav_box > .child > .nav {
+  height: 40px;
+  border-radius: 5px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  width: 100%;
+  padding: 0 10px 0 50px;
+  box-sizing: border-box;
+  margin-bottom: 10px;
+  font-size: 16px;
+  color: #000;
 }
 
-.type_nav_box>.child>.nav.active {
-    background: #e0eafb;
+.type_nav_box > .child > .nav.active {
+  background: #e0eafb;
 }
 
-.type_nav_box>.child>.nav>.file {
-    min-width: 18px;
-    height: 18px;
-    background-image: url('../../../assets/icon/sourceFile/file.png');
-    background-size: 100% 100%;
-    margin-right: 10px;
+.type_nav_box > .child > .nav > .file {
+  min-width: 18px;
+  height: 18px;
+  background-image: url("../../../assets/icon/sourceFile/file.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
 }
 
-.type_nav_box>.child>.nav>.name {
-    max-width: 100%;
-    overflow: hidden;
-    text-overflow: ellipsis;
-    white-space: nowrap;
+.type_nav_box > .child > .nav > .name {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
 }
 
 .none_box {
-    height: calc(100% - 55px);
-    overflow: auto;
-    width: 100%;
-    padding: 10px;
-    box-sizing: border-box;
-    display: flex;
-    align-items: center;
-    justify-content: center;
+  height: calc(100% - 55px);
+  overflow: auto;
+  width: 100%;
+  padding: 10px;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }
 
-
 .list_file_box {
-    width: 100%;
+  width: 100%;
 }
-
-</style>
+</style>

+ 24 - 8
src/components/pages/knowledge/folderDetail.vue

@@ -8,7 +8,7 @@
           <div
             class="btn"
             @click="deleteFile(pid.split('/')[1])"
-            v-if="userid == data.userid"
+            v-if="userid == data.userid && data.isMo == '2'"
           >
             删除文件夹
           </div>
@@ -29,13 +29,13 @@
           v-html="data.detail ? data.detail : '暂无描述'"
           v-else
         ></div>
-        <div class="editbox" v-if="userid == data.userid">
+        <div class="editbox" v-if="userid == data.userid && data.isMo == '2'">
           <div class="edit_btn" @click="editConfirm">
             {{ canEdit ? "确定" : "编辑" }}
           </div>
         </div>
       </div>
-      <div class="tag_box" v-if="data.userid == userid">
+      <div class="tag_box" v-if="data.userid == userid && data.isMo == '2'">
         <div class="tag">
           <div class="tag_title">标签:</div>
           <div class="tag_check">
@@ -117,7 +117,7 @@
           </div>
         </div>
       </div>
-      <div class="tag_box" v-else>
+      <div class="tag_box" v-else-if="data.isMo == '2'">
         <div class="tag_check">
           <div class="tag_check_box" v-if="this.check1.length">
             <span>学科:</span>
@@ -133,11 +133,14 @@
           </div>
         </div>
       </div>
+      <folderFileBoxVue :pid="pid" :userid="userid" :typeArray="typeArray" :folderid="folderid"  :moFolderid="moFolderid" :data="data"></folderFileBoxVue>
     </div>
   </div>
 </template>
 
 <script>
+import folderFileBoxVue from './folderFileBox.vue';
+
 export default {
   props: {
     pid: {
@@ -145,8 +148,20 @@ export default {
     },
     userid: {
       type: String
+    },
+    typeArray: {
+        type: Array,
+    },
+    folderid: {
+      String: String
+    },
+    moFolderid: {
+      String: String
     }
   },
+  components: {
+    folderFileBoxVue,
+  },
   data() {
     return {
       data: {},
@@ -277,9 +292,9 @@ export default {
         type: "warning"
       })
         .then(() => {
-          let params = [{ ids: id }];
+          let params = [{ ids: id, folderids: this.folderid }];
           this.ajax
-            .post(this.$store.state.api + "deleteFolder", params)
+            .post(this.$store.state.fileApi + "deleteFolder", params)
             .then(res => {
               this.$message({
                 message: "删除成功",
@@ -315,10 +330,11 @@ export default {
         st: this.check1.join(","),
         ct: this.check2.join(","),
         t: this.check3.join(","),
-        j: this.data.juri
+        j: this.data.juri,
+        folderid: this.folderid
       };
       this.ajax
-        .post(this.$store.state.api + "updateFolder", [params])
+        .post(this.$store.state.fileApi + "updateFolder", [params])
         .then(res => {
           this.$message.success("修改成功");
           this.getData();

+ 911 - 0
src/components/pages/knowledge/folderFileBox.vue

@@ -0,0 +1,911 @@
+<template>
+  <div class="f_box" @dragover.prevent @drop="handleDrop">
+    <div class="f_box_top">
+      <div class="f_box_top_left">
+        <div class="f_box_top_title">文件</div>
+      </div>
+      <div class="f_box_top_right">
+        <div class="btn" @click="serchFile">刷新</div>
+        <div class="btn" @click="addImg($event)">
+          上传文件
+          <input
+            type="file"
+            accept="*"
+            style="display: none"
+            multiple="multiple"
+            @change="beforeUpload($event)"
+          />
+        </div>
+        <div class="btn" @click="openG" v-if="userid == data.userid && data.isMo == '2'">关联文件</div>
+        <div class="btn" @click="batchRemove">移除</div>
+        <div class="btn delBtn" @click="batchDelete">删除</div>
+      </div>
+    </div>
+    <div class="f_box_top">
+      <div class="f_box_top_left"></div>
+      <div class="f_box_top_right">
+        <div class="input">
+          <input
+            type="text"
+            v-model="fileName"
+            placeholder="请输入你需要搜索的文件名字"
+            @keyup.enter="serchFile"
+          />
+          <div class="serch" @click="serchFile"></div>
+        </div>
+      </div>
+    </div>
+    <div class="none_box" v-if="fileArray.length == 0">暂无上传文件</div>
+    <div
+      class="f_box_file_list"
+      v-else-if="stype == '2' && fileArray.length"
+      v-loading.body="isLoading"
+    >
+      <div class="list_file_box">
+        <el-table
+          :data="fileArray"
+          border
+          stripe
+          style="width: 100%"
+          @selection-change="handleSelectionChange"
+          ref="myTable"
+          :row-key="(row) => row.id"
+        >
+          <el-table-column
+            type="selection"
+            width="50px"
+            :reserve-selection="true"
+          ></el-table-column>
+          <el-table-column prop="name" label="文件名" show-overflow-tooltip min-width="15"></el-table-column>
+          <el-table-column prop="username" label="拥有者" show-overflow-tooltip min-width="20"></el-table-column>
+          <el-table-column prop="folderName" label="所属文件夹" show-overflow-tooltip min-width="20"></el-table-column>
+          <el-table-column label="处理状态" width="80px">
+            <template slot-scope="scope">
+              {{ getState(scope.row.ingestionStatus) }}
+            </template>
+          </el-table-column>
+           <el-table-column label="是否已提取知识图谱" width="150px">
+            <template slot-scope="scope">
+              {{ getState2(scope.row.extractionStatus) }}
+            </template>
+          </el-table-column>
+          <el-table-column label="文件类型" show-overflow-tooltip min-width="10">
+             <template slot-scope="scope">
+              {{ scope.row.documentType ? scope.row.documentType : '-' }}
+            </template>
+          </el-table-column>
+          <!-- <el-table-column label="公开状态" show-overflow-tooltip width="80px"></el-table-column> -->
+          <el-table-column prop="time" label="上传时间" show-overflow-tooltip min-width="20"></el-table-column>
+          <el-table-column label="操作" width="200px">
+            <template slot-scope="scope">
+              <div>
+                <!-- <el-button type="primary" size="small">查看</el-button> -->
+                <el-button type="primary" size="small" v-if="userid == data.userid && data.isMo == '2'" @click="removeFile(scope.row.id, scope.row.documentid)">移除</el-button>
+                <el-button type="danger" size="small" v-if="userid == scope.row.userid" @click="deleteFile(scope.row.id, scope.row.documentid)">删除</el-button>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <el-pagination
+        style="margin-top: 10px"
+        background
+        layout="prev, pager, next"
+        :page-size="limit"
+        :total="total"
+        @current-change="handleCurrentChange"
+      >
+      </el-pagination>
+    </div>
+    <div v-if="proVisible" class="mask">
+      <div class="progressBox">
+        <div class="lbox">
+          <img src="../../../assets/loading.gif" />上传中,请稍后
+        </div>
+      </div>
+    </div>
+    <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
+    <wVideo :dialogVisibleVideo.sync="dialogVisibleVideo" :url="wurl"></wVideo>
+    <wOffice
+      :dialogVisibleOffice.sync="dialogVisibleOffice"
+      :url="wurl"
+    ></wOffice>
+    <relateFiles ref="relateFiles"></relateFiles>
+  </div>
+</template>
+
+<script>
+import officeImg from "../../../assets/icon/sourceFile/office.png";
+import pdfImg from "../../../assets/icon/sourceFile/pdf.png";
+import videoImg from "../../../assets/icon/sourceFile/video.png";
+import otherImg from "../../../assets/icon/sourceFile/other.png";
+import checkImg from "../../../assets/icon/sourceFile/check.png";
+import checkIsImg from "../../../assets/icon/sourceFile/check_is.png";
+
+import wVideo from "../test/file/wVideo.vue";
+import wpdf from "../test/file/wPdf2.vue";
+import wOffice from "../test/file/wOffice.vue";
+
+import { v4 as uuidv4 } from "uuid";
+import relateFiles from './components/relateFiles'
+export default {
+  components: {
+    wVideo,
+    wpdf,
+    wOffice,
+    relateFiles
+  },
+  props: {
+    userid: {
+      type: String,
+    },
+    typeArray: {
+      type: Array,
+    },
+    pid: {
+      type: String,
+    },
+    folderid: {
+      type: String,
+    },
+    moFolderid: {
+      type: String,
+    },
+    data: {
+      type: Object,
+    }
+  },
+  watch: {
+    pid: {
+      immediate: true,
+      deep: true,
+      handler(newValue, oldValue) {
+        this.fileArray = [];
+        this.checkArray = [];
+        this.fileName = "";
+        this.proVisible = false
+        this.page = 1
+        this.getData();
+      },
+    },
+  },
+  data() {
+    return {
+      isLoading: false,
+      proVisible: false,
+      stype: 2,
+      fileArray: [],
+      officeImg: officeImg,
+      pdfImg: pdfImg,
+      videoImg: videoImg,
+      otherImg: otherImg,
+      checkImg: checkImg,
+      checkIsImg: checkIsImg,
+      checkArray: [],
+      checkArray2: [],
+      dialogVisiblePdf: false,
+      dialogVisibleVideo: false,
+      dialogVisibleOffice: false,
+      wurl: "",
+      moveBox: false,
+      checkTypeArray: [],
+      moveChild: "",
+      fileName: "",
+      limit: 10,
+      total: 0,
+      page: 1,
+    };
+  },
+  computed: {
+     getState() {
+      return function (item) {
+        if (item == "success") {
+          return "成功";
+        } else if (item == "failed") {
+          return "失败";
+        } else if (item == "augmenting") {
+          return "上传中";
+        } else if (item == "pending") {
+          return "待处理";
+        } else if (item == "enriched") {
+          return "enriched";
+        } else if(!item){
+          return "上传中"
+        } else {
+          return item
+        }
+      };
+    },
+    getState2() {
+      return function (item) {
+        if (item == "success") {
+          return "成功";
+        } else if (item == "failed") {
+          return "失败";
+        } else if (item == "pending") {
+          return "待处理";
+        } else if (item == "processing") {
+          return "处理中";
+        } else if (item == "enriched") {
+          return "enriched";
+        } else if(!item){
+          return "上传中"
+        } else {
+          return item
+        }
+      };
+    },
+  },
+  methods: {
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getData();
+    },
+    getData() {
+      this.isLoading = true;
+      let params = {
+        uid: this.userid,
+        folderid: this.folderid,
+        n: this.fileName,
+        page: this.page,
+        num: this.limit,
+      };
+      this.ajax
+        .post(this.$store.state.fileApi + "getFile", [params])
+        .then((res) => {
+          this.isLoading = false;
+          console.log(res.data);
+          this.total = res.data.result.length ? res.data.result[0].num : 0;
+          this.fileArray = res.data.result;
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    handleSelectionChange(selectedRows) {
+      this.checkArray = selectedRows.map((row) => row.id);
+      this.checkArray2 = selectedRows.map(row => ({ id: row.id, documentid: row.documentid }));
+    },
+    addImg(e) {
+      var el = e.currentTarget;
+      el.getElementsByTagName("input")[0].click();
+      e.target.value = "";
+    },
+    handleDrop(event) {
+      event.preventDefault(); // 阻止默认的浏览器下载行为
+      const files = event.dataTransfer.files;
+      if (files.length) {
+        this.beforeUpload({target:{files}});
+      }
+    },
+    serchFile() {
+      this.getData();
+    },
+    async beforeUpload(event) {
+      // const loading = this.openLoading();
+      let file = "";
+      let cfindex2 = 0;
+      this.proVisible = true;
+      const allowedExtensions = [
+        "csv","xls","xlsx","md","pdf","txt","ppt","pptx","docx"
+      ];
+      
+      for (var cfindex = 0; cfindex < event.target.files.length; cfindex++) {
+        file = event.target.files[cfindex];
+        const fileExtension = file.name.split('.').pop().toLowerCase();
+        
+        if (!allowedExtensions.includes(fileExtension)) {
+          this.$message.error(`不支持的文件格式: ${file.name}`);
+          cfindex2++;
+          setTimeout(() => {
+            if (
+              cfindex2 == event.target.files.length ||
+              cfindex2 > event.target.files.length
+            ) {
+              this.proVisible = false;
+            }
+          }, 1000);
+          continue; // 跳过不支持的文件
+        }
+
+        let uuid = uuidv4();
+        let formData = new FormData();
+        const timestamp = Date.now();
+        const baseName = file.name.slice(0, -(fileExtension.length + 1));
+        let string = [this.folderid, this.moFolderid].filter(id => id)
+        // if(string.length > 1){
+        //   string = JSON.stringify([string[0], string[1]])
+        // }
+        formData.append('file', new File([file], `${baseName}${timestamp}.${fileExtension}`));
+        formData.append('collection_ids', JSON.stringify(string));
+        formData.append('id', uuid);
+        formData.append('metadata', JSON.stringify({title: file.name, collection_ids: string}));
+        formData.append('ingestion_mode', "fast");
+
+// , this.moFolderid
+        // 使用同步方式上传文件
+        await this.uploadFile(formData, file.name, uuid);
+        cfindex2++;
+
+        setTimeout(() => {
+          if (
+            cfindex2 == event.target.files.length ||
+            cfindex2 > event.target.files.length
+          ) {
+            this.proVisible = false;
+          }
+        }, 1000);
+      }
+    },
+    async uploadFile(formData, name, uuid) {
+      try {
+        // 确保formData是正确的格式
+        // this.$store.state.fileApi + "upload"
+        this.ajax.post("https://r2rserver.cocorobo.cn/v3/documents", formData, {
+          headers: {
+            'Content-Type': 'multipart/form-data' // 修改为multipart/form-data以避免乱码
+          }
+        });
+
+        let docid = uuid
+        let params = {
+          n: name,
+          did: docid,
+          uid: this.userid,
+          fid: this.folderid,
+          mofid: this.moFolderid != this.folderid ? this.moFolderid : ""
+        }
+        const res2 = await this.ajax.post(this.$store.state.api + 'addFile', [params]);
+
+        console.log(res2);
+        let id2 = res2.data[0][0].id
+        // if(this.moFolderid != this.folderid){
+        //   let params = {
+        //     documentids: docid,
+        //     ids: id2,
+        //     folderid: this.moFolderid,
+        //   }
+        //   await this.ajax.post(this.$store.state.fileApi + 'moveFile', [params]);
+        // }
+        this.$message.success("上传成功");
+        this.getData();
+      } catch (err) {
+        console.error(err);
+        this.$message.error("上传失败");
+      }
+    },
+    formatFileSize(bytes) {
+      if (bytes < 1024) {
+        return bytes + "B";
+      } else if (bytes < 1048576) {
+        return (bytes / 1024).toFixed(2) + "KB";
+      } else if (bytes < 1073741824) {
+        return (bytes / 1048576).toFixed(2) + "MB";
+      } else {
+        return (bytes / 1073741824).toFixed(2) + "GB";
+      }
+    },
+    deleteFile(fileid, documentid) {
+      this.$confirm("确定删除该文件吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+       .then(() => {
+          let params = [{ 
+            ids: fileid,
+            documentids: documentid,
+          }];
+          this.ajax
+           .post(this.$store.state.fileApi + "deleteFile", params)
+           .then((res) => {
+              this.$message({
+                message: "删除成功",
+                type: "success",
+              });
+              this.checkArray = []
+              this.checkArray2 = []
+              this.$refs.myTable.clearSelection();
+              this.getData();
+            })
+           .catch((err) => {
+              this.$message.error("删除失败");
+              console.error(err);
+            });
+        })
+       .catch(() => {});
+    },
+    batchDelete(){
+      if(!this.checkArray.length){
+        this.$message.warning("请选择要删除的文件")
+        return;
+      }
+      let array = this.checkArray2.map(item => item.id);
+      let array2 = this.checkArray2.map(item => item.documentid);
+      this.deleteFile(array.join(","), array2.join(","))
+    },
+    removeFile(fileid, documentid){
+      this.$confirm("确定移除该文件吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+       .then(() => {
+          let params = [{ 
+            ids: fileid,
+            documentids: documentid,
+            folderid: this.folderid
+          }];
+          this.ajax
+           .post(this.$store.state.fileApi + "removeFile", params)
+           .then((res) => {
+              this.$message({
+                message: "移除成功",
+                type: "success",
+              });
+              this.checkArray = []
+              this.checkArray2 = []
+              this.$refs.myTable.clearSelection();
+              this.getData();
+            })
+           .catch((err) => {
+              this.$message.error("移除失败");
+              console.error(err);
+            });
+        })
+       .catch(() => {});
+    },
+    batchRemove(){
+      if(!this.checkArray.length){
+        this.$message.warning("请选择要移除的文件")
+        return;
+      }
+      let array = this.checkArray2.map(item => item.id);
+      let array2 = this.checkArray2.map(item => item.documentid);
+      this.removeFile(array.join(","), array2.join(","))
+    },
+    isSelectable(row) {
+      return row.isMo !== '2';
+    },
+    openG(){
+      this.$refs.relateFiles.openG(this.userid, this.folderid, this.moFolderid)
+    }
+  },
+  mounted() {
+    // this.getData();
+  },
+};
+</script>
+
+<style scoped>
+.f_box {
+  width: 100%;
+  /* height: 100%; */
+  position: relative;
+  min-height: 400px;
+}
+
+.f_box_top {
+  display: flex;
+  align-items: center;
+  padding: 10px 0;
+  width: 100%;
+  box-sizing: border-box;
+}
+
+.f_box_top_left {
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_title {
+  font-size: 16px;
+  /* font-weight: bold; */
+}
+
+.btn {
+  display: flex;
+  cursor: pointer;
+  align-items: center;
+  height: 30px;
+  padding: 0 8px;
+  background: rgb(0, 97, 255);
+  color: #fff;
+  box-sizing: border-box;
+  border-radius: 4px;
+  font-size: 14px;
+  align-items: center;
+}
+
+.btn2 {
+  display: flex;
+  cursor: pointer;
+  align-items: center;
+  height: 30px;
+  padding: 0 8px;
+  background: #fff;
+  color: rgb(0, 97, 255);
+  border: 1px solid rgb(0, 97, 255);
+  box-sizing: border-box;
+  border-radius: 4px;
+  font-size: 14px;
+  align-items: center;
+}
+
+.f_box_top .delBtn {
+  background: rgb(255, 0, 13);
+}
+
+.btn + .btn2,
+.btn + .btn,
+.btn2 + .btn2,
+.btn2 + .delBtn {
+  margin-left: 15px;
+}
+
+.f_box_top_right {
+  margin-left: auto;
+  max-width: calc(100% - 280px);
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_right > .input {
+  position: relative;
+  width: 250px;
+  height: 35px;
+}
+
+.f_box_top_right > .input > input {
+  width: 100%;
+  height: 100%;
+  border: 1px solid #d9d9d9;
+  border-radius: 5px;
+  padding: 0 45px 0 10px;
+  box-sizing: border-box;
+  font-size: 12px;
+  outline: none;
+}
+
+.f_box_top_right > .input > .serch {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/search.png");
+  background-size: 100% 100%;
+  position: absolute;
+  right: 13px;
+  top: 50%;
+  transform: translateY(-50%);
+  cursor: pointer;
+}
+
+.f_box_top_right > .tab {
+  height: 30px;
+  width: 80px;
+  margin-left: 15px;
+  background: #e7e7e7;
+  border: 2px solid #d9d9d9;
+  border-radius: 5px;
+  box-sizing: border-box;
+  overflow: hidden;
+  display: flex;
+  align-items: center;
+}
+
+.f_box_top_right > .tab > .table,
+.f_box_top_right > .tab > .list {
+  width: 50%;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+}
+
+.f_box_top_right > .tab > .list::before {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/list.png");
+  background-size: 100% 100%;
+}
+
+.f_box_top_right > .tab > .list.active,
+.f_box_top_right > .tab > .table.active {
+  background: #fff;
+}
+
+.f_box_top_right > .tab > .table::before {
+  content: "";
+  display: block;
+  width: 20px;
+  height: 20px;
+  background-image: url("../../../assets/icon/sourceFile/table.png");
+  background-size: 100% 100%;
+}
+
+.mask {
+  background-color: rgb(0 0 0 / 30%);
+  /* position: fixed; */
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  z-index: 90;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.progressBox {
+  width: 300px;
+  height: 150px;
+  background: #fff;
+  border-radius: 10px;
+  box-shadow: 0 0 6px 1px #bfbfbf;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+  position: relative;
+  color: #6c6c6c;
+}
+
+.progressBox >>> .el-progress-bar__outer {
+  background-color: #d1dfff !important;
+}
+
+.progressBox .lbox {
+  height: 50px;
+  font-size: 19px;
+  display: flex;
+  align-items: center;
+  color: #747474;
+}
+
+.progressBox .lbox img {
+  width: 40px;
+  margin-right: 20px;
+}
+
+.closeCss {
+  position: absolute;
+  top: 8px;
+  right: 8px;
+  cursor: pointer;
+  width: 20px;
+  height: 20px;
+}
+
+.closeCss > img {
+  width: 100%;
+  height: 100%;
+}
+
+.f_box_file_square {
+  height: calc(100% - 55px);
+  overflow: auto;
+  width: 100%;
+  padding: 55px;
+  box-sizing: border-box;
+  display: flex;
+  flex-wrap: wrap;
+  align-content: flex-start;
+  position: relative;
+}
+
+.f_box_file_square > .f_box_file {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  width: 160px;
+  height: 160px;
+  cursor: pointer;
+  margin: 0 36px 36px 0;
+  border-radius: 20px;
+  position: relative;
+}
+
+.f_box_file_square > .f_box_file:hover {
+  background: #f0f2f5;
+}
+
+.f_box_file_square > .f_box_file:hover > .check {
+  display: block;
+}
+
+.f_box_file_square > .f_box_file.check {
+  background: #e0eafb;
+}
+
+.f_box_file_square > .f_box_file.check > .check {
+  display: block;
+}
+
+.f_box_file_square > .f_box_file > .check {
+  position: absolute;
+  left: 15px;
+  top: 15px;
+  width: 16px;
+  height: 16px;
+  background-size: 100%;
+  display: none;
+}
+
+.f_box_file_square > .f_box_file > .check > img {
+  width: 100%;
+  height: 100%;
+  object-fit: cover;
+}
+
+.f_box_file_square > .f_box_file > img {
+  width: 90px;
+  height: 90px;
+  object-fit: cover;
+}
+
+.f_box_file_square > .f_box_file > .name {
+  white-space: nowrap;
+  font-size: 14px;
+  max-width: 80%;
+  overflow: hidden;
+  margin: 4px auto 0;
+  text-overflow: ellipsis;
+  text-align: center;
+}
+
+.f_box_file_list {
+  /* height: calc(100% - 55px); */
+  /* overflow: auto; */
+  width: 100%;
+  padding: 10px 0;
+  box-sizing: border-box;
+}
+
+.f_box_file_list > .f_box_file {
+}
+
+.f_box_file_allCheck {
+  display: flex;
+  align-items: center;
+  position: absolute;
+  font-size: 14px;
+  top: 20px;
+  left: 10px;
+  cursor: pointer;
+}
+
+.f_box_file_allCheck > img {
+  width: 16px;
+  height: 16px;
+  object-fit: cover;
+  margin-right: 5px;
+}
+
+.dialog >>> .el-dialog__body {
+  padding: 10px 20px;
+}
+
+.type_nav_box {
+}
+
+.type_nav_box > .nav {
+  height: 40px;
+  border-radius: 5px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  width: 100%;
+  padding: 0 10px;
+  box-sizing: border-box;
+  margin-bottom: 10px;
+  font-size: 16px;
+  color: #000;
+}
+
+.type_nav_box > .nav > .down {
+  min-width: 14px;
+  height: 14px;
+  background-image: url("../../../assets/icon/sourceFile/icon_arrow.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
+  transition: all 0.3s;
+  transform: rotate(-90deg);
+}
+
+.type_nav_box > .nav.active > .down {
+  transform: rotate(0deg);
+}
+
+.type_nav_box > .nav > .file {
+  min-width: 18px;
+  height: 18px;
+  background-image: url("../../../assets/icon/sourceFile/file.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
+}
+
+.type_nav_box > .nav > .name {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.type_nav_box > .child {
+}
+
+.type_nav_box > .child > .nav {
+  height: 40px;
+  border-radius: 5px;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  width: 100%;
+  padding: 0 10px 0 50px;
+  box-sizing: border-box;
+  margin-bottom: 10px;
+  font-size: 16px;
+  color: #000;
+}
+
+.type_nav_box > .child > .nav.active {
+  background: #e0eafb;
+}
+
+.type_nav_box > .child > .nav > .file {
+  min-width: 18px;
+  height: 18px;
+  background-image: url("../../../assets/icon/sourceFile/file.png");
+  background-size: 100% 100%;
+  margin-right: 10px;
+}
+
+.type_nav_box > .child > .nav > .name {
+  max-width: 100%;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.none_box {
+  height: calc(100% - 55px);
+  overflow: auto;
+  width: 100%;
+  padding: 10px;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.list_file_box {
+  width: 100%;
+}
+
+.list_file_name {
+  display: flex;
+  align-items: center;
+}
+
+.list_file_name > img {
+  width: 24px;
+  height: 24px;
+  object-fit: cover;
+  margin-right: 5px;
+}
+
+.list_file_name > div {
+  max-width: 100%;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+}
+</style>

+ 13 - 5
src/components/pages/knowledge/index.vue

@@ -14,7 +14,7 @@
           </div>
           <div class="nav_child_box" v-if="item.open && item.child.length">
             <div class="nav_box" :class="{ active: pid == item.id + '/' + item2.id }" v-for="(item2, index2) in item.child"
-              :key="index + '-' + index2" @click="checkType(item.id + '/' + item2.id)">
+              :key="index + '-' + index2" @click="checkType(item.id + '/' + item2.id, item2.folderid)">
               <span class="icon"></span>
               <el-tooltip :content="item2.name" placement="top" effect="dark">
                 <span class="name">{{ item2.name }}</span>
@@ -28,10 +28,10 @@
       <div class="bread_box">
         <span class="bread" :class="{is: getPid(item.name) == pid}" v-for="(item, index) in getBread()" :key="index" @click="checkType2(getPid(item.name) == pid, getPid(item.name))">{{ item.name }}</span>
         </div>
-      <folder :userid="userid" :typeArray="typeArray" :pid="pid" @checkType="checkType" v-if="pid.split('/').length == 1"></folder>
-      <fileBox :userid="userid" :typeArray="typeArray" :pid="pid" :type='type' ref="fileBox" v-if="pid.split('/').length == 1">
+      <folder :userid="userid" :typeArray="typeArray" :pid="pid" @checkType="checkType" v-if="pid.split('/').length == 1" ref="folder"></folder>
+      <fileBox :userid="userid" :typeArray="typeArray" :pid="pid" :type='type' ref="fileBox" v-if="pid.split('/').length == 1 && moFolderid" :moFolderid="moFolderid" :myFolderArray="myFolderArray">
       </fileBox>
-      <folderDetail :userid="userid" :pid="pid"  v-if="pid.split('/').length > 1" @checkType="checkType"></folderDetail>
+      <folderDetail :userid="userid" :pid="pid" :typeArray="typeArray"  v-if="pid.split('/').length > 1 && folderid && moFolderid" :folderid="folderid" :moFolderid="moFolderid" @checkType="checkType"></folderDetail>
 
     </div>
   </div>
@@ -69,6 +69,9 @@ export default {
       renameType: '',
       renameInput: '',
       pidArray: [],
+      folderid: "",
+      moFolderid: "",
+      myFolderArray: [],
     }
   },
   computed: {
@@ -120,7 +123,10 @@ export default {
         .then((res) => {
           this.isLoading = false;
           let data = res.data[0]
+          let data2 = res.data[1]
           this.typeArray[0].child = data
+          this.moFolderid = res.data[1][0].folderid;
+          this.myFolderArray = data
           // this.$refs['fileBox'].getData()
           // console.log(this.$refs['fileBox']);
         })
@@ -135,7 +141,7 @@ export default {
         this.$forceUpdate();
       }
     },
-    checkType(pid) {
+    checkType(pid, folderid) {
       if (this.pid == pid) {
         return
       }
@@ -145,10 +151,12 @@ export default {
         this.typeArray[index].open = true;
       }
       this.pid = pid;
+      this.folderid = folderid;
       this.$forceUpdate()
     },
     checkType2(is, pid) {
       if(!is){  
+        this.folderid = ""
         this.checkType(pid)
       }
     }

+ 3 - 0
src/config/config.js

@@ -11,6 +11,9 @@ const store = new Vuex.Store({
         nCount: 0,
         report:"",
         api: 'https://pbl.cocorobo.cn/api/pbl/',
+        // fileApi: 'http://localhost:7004/file/',
+        // fileApi: 'http://10.3.16.166:7004/file/',
+        fileApi: 'https://r2rapi.cocorobo.cn/file/',
         socket: "https://poll.cocorobo.cn",
         // socket: "http://localhost:1473",
         // api: 'http://localhost:7003/api/pbl/',

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.