Browse Source

修改新建文件和样式

“yueshang” 2 years ago
parent
commit
b25a0db0bb
4 changed files with 219 additions and 207 deletions
  1. 39 6
      src/views/myfile/MyFile.vue
  2. 179 126
      src/views/myjoin/components/AddFile.vue
  3. 1 1
      src/views/publicment/MyFile.vue
  4. 0 74
      vite.config.js

+ 39 - 6
src/views/myfile/MyFile.vue

@@ -48,7 +48,13 @@
                                <template #content><span>安全级别: {{ item.encryptLevel == 'L1'?'敏感':(item.encryptLevel == 'L2'?'涉密':(item.encryptLevel == 'L3'?'机密':'绝密')) }}</span>  </template>
                                <img src="../../assets/images/fileStyle.png" style="width: 72px;height: 72px;"></el-tooltip>
                                <img src="../../assets/images/fileStyle.png" style="width: 72px;height: 72px;" v-else>
-                              <p class="ellipsis-text shouzhi">{{ item.dirName }}</p>
+                               <el-tooltip
+                                  class="box-item tool-tip"
+                                  effect="dark"
+                                  placement="top-start"
+                               > <template #content> <span class="shouzhi">{{ item.dirName }}</span></template>
+                               <p class="ellipsis-text shouzhi">{{ item.dirName }}</p>
+                               </el-tooltip>
                               <img class="levelImg shouzhi" v-if="item.isEncrypt === 'Y'" :src="getLevelImg(item.encryptLevel)" alt="">
                           </div>
                         </div>
@@ -141,7 +147,7 @@
                                     <Plus />
                                 </el-icon>
                             </div>
-                            <div style="margin-left: 5px;" @click="thisFolder.dirType?createNewMenu(1):null">
+                            <div style="margin-left: 5px;" @click="thisFolder.dirType?createNewMenu(2):null">
                                 <span style="font-size: 14px;" class="shouzhi">新建文档</span>
                             </div>
                         </div>
@@ -413,7 +419,7 @@
     <inputPassword v-if="showInputPassword" @surePass="surePass" @closeIptPass="closeIptPass" :showInputPassword="showInputPassword"></inputPassword>
     <div v-loading.fullscreen="loadingPreview" v-if="loadingPreview" class="lodingBox"></div>
     <!-- 新增文档 -->
-    <AddFile v-if="newAdd" :newAdd="newAdd" @threeBe="threeBe"></AddFile>
+    <AddFile v-if="newAdd" :newAdd="newAdd" @threeBe="threeBe" :clickFileData="clickFileData"></AddFile>
 </template>
 
 <script>
@@ -650,10 +656,12 @@ export default {
         const filePageNum = ref(1) //获取文件分页
         const tableBeEnd = ref(true)//控制下拉是否到底
         const tableTotal = ref(0)//表格数据总数
+        const clickFileData = ref(null);
         // 获取文件夹,中栏,文件
         function getAllTop() {
             documents.getTop(3).then(res => {
-                let userMe = [res]
+                let userMe;
+                userMe = [res];
                 impDirId.value = userMe[0].dirId//固定
                 impSpaceId.value = userMe[0].spaceId//固定
                 newSpaceId.value = userMe[0].spaceId//变化
@@ -994,10 +1002,33 @@ export default {
                 oneOrTwo.value = num
                 folderCase.value = true
             }
-            console.log('num', num,newAdd.value)
         }
         function threeBe(data){
             newAdd.value = data
+            console.log('cli', clickFileData.value)
+            let obj = {
+                    pageNum: 1,
+                    pageSize: 10
+            }
+            myfile.getById(clickFileData.value.dirId, obj).then(res => {
+                    if (res.code === 200) {
+                        fileList.value = res.rows
+                        fileTotal.value = res.total
+                        if (fileTotal.value / 10 != 1) {
+                            let x = Math.trunc(fileTotal.value / 10) + 1
+                            for (var i = 1; i <= x; i++) {
+                                obj.pageNum = i
+                                myfile.getById(clickFileData.value.dirId, obj).then(res => {
+                                    fileList.value = fileList.value.concat(res.rows)
+                                    const uniqueFileList = Array.from(new Set(fileList.value.map(item => item.docId)))
+                                        .map(docId => fileList.value.find(item => item.docId === docId));
+                                    // 合并数组并更新 fileList.value
+                                    fileList.value = uniqueFileList
+                                })
+                            }
+                        }
+                    }
+                })
         }
         function cancleHistoryPrew(val) {
             historyPrew.value = false
@@ -1193,6 +1224,7 @@ export default {
             // console.log('topPath',toRaw(topPath.value));
             newDirId.value = row.dirId
             newSpaceId.value = row.spaceId
+            clickFileData.value = row
             const query = `${newDirId.value}?pageSize=10&pageNum=${filePageNum.value}`
             documents.getALLdocument({
                 parentId: newDirId.value - 0,
@@ -1872,7 +1904,8 @@ export default {
             filePageNum,
             setScroll,
             tableBeEnd,
-            tableTotal
+            tableTotal,
+            clickFileData
         }
     },
     watch: {

+ 179 - 126
src/views/myjoin/components/AddFile.vue

@@ -1,138 +1,191 @@
 <template>
-    <el-dialog v-model="addFile" title="新建文件" width="30%" @close="backTo">
-        <el-form :model="createFile">
-            <el-form-item label="文件目录">
+  <el-dialog v-model="addFile" title="新建文件" width="30%" @close="backTo">
+    <el-form
+      :model="createFile"
+      :label-position="labelPosition"
+      label-width="80px"
+      ref="labelRef"
+      :rules="rules"
+    >
+      <!-- <el-form-item label="文件目录">
                 <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick" />
-            </el-form-item>
-            <el-form-item label="你选择的目录是">
-                <p>{{ nowFolder }}</p>
-            </el-form-item>
-            <el-form-item label="文件名">
+            </el-form-item> -->
+      <el-form-item label="目录" class="title-name">
+        <!-- <p>{{ nowFolder }}</p> -->
+        <span>{{ clickFileData.dirName }}</span>
+      </el-form-item>
+      <!-- <el-form-item label="文件名">
                 <el-input v-model="createFile.name" maxlength="150" placeholder="请输入文件名" type="textarea" />
-            </el-form-item>
-            <el-form-item label="文件类型">
-                <el-select v-model="createFile.fileType" clearable placeholder="Select" @change="optChange">
-                    <el-option v-for="item in typeF" :key="item.value" :label="item.label" :value="item.value" />
-                </el-select>
-            </el-form-item>
-        </el-form>
-        <template #footer>
-            <span class="dialog-footer">
-                <el-button @click="back">取消</el-button>
-                <el-button type="primary" @click="sureAddFile">
-                    确定
-                </el-button>
-            </span>
-        </template>
-    </el-dialog>
+            </el-form-item> -->
+      <el-form-item
+        label="文件类型"
+        prop="fileType"
+      >
+        <el-select
+          v-model="createFile.fileType"
+          clearable
+          placeholder="Select"
+          @change="optChange"
+        >
+          <el-option
+            v-for="item in typeF"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <span class="dialog-footer">
+        <el-button @click="back">取消</el-button>
+        <el-button type="primary" @click="sureAddFile"> 确定 </el-button>
+      </span>
+    </template>
+  </el-dialog>
 </template>
 
 <script>
-import { ref, onMounted, toRef } from 'vue'
-import fileCount from "../../../api/fileCount/fileCount"
-import documents from '../../../api/document/document';
-import { ElMessage } from 'element-plus'
+import { ref, onMounted, toRef } from "vue";
+import fileCount from "../../../api/fileCount/fileCount";
+import documents from "../../../api/document/document";
+import { ElMessage } from "element-plus";
 export default {
-    props: {
-        newAdd: {
-            type: Boolean,
-            required: true
-        }
+  props: {
+    newAdd: {
+      type: Boolean,
+      required: true,
     },
-    setup(props, { emit }) {
-        let { sureAddFile, back } = toRef(props)
-        let result = props.newAdd
-        let createFile = ref({
-            name: "",
-            fileType: ""
-        })
-        let treeData = ref([])
-        let defaultProps = ref({
-            label: "label",
-            value: "id",
-            disable: false
-        })
-        let typeF = ref([
-            {
-                label: "word",
-                value: "word"
-            },
-            {
-                label: "excel",
-                value: "excel"
-            },
-            {
-                label: "ppt",
-                value: "ppt"
-            },
-            {
-                label: "txt",
-                value: "txt"
-            }
-        ])
-        let noChangeSpaceId = ref(0)
-        let dirIds = ref(0)
-        let addFile = ref(false)
-        let nowFolder = ref("")
-        function inlineList() {
-            addFile.value = result
-        }
-        //获取文件树
-        function getFileTree() {
-            documents.fileTree(3).then(res => {
-                treeData.value = [res]
-            })
-            documents.getTop(3).then(res => {
-                noChangeSpaceId.value = res.spaceId
-            })
-        }
-        function handleNodeClick(data) {
-            console.log(data, 'data');
-            dirIds.value = data.id
-            nowFolder.value = data.label
-        }
-        function backTo() {
-            addFile.value = false
-            emit('threeBe', addFile.value)
-        }
-        function everyDunk() {
-            fileCount.createFiles({
-                dirId: dirIds.value - 0,
-                spaceId: noChangeSpaceId.value - 0,
-                type: createFile.value.fileType + ""
-            }).then(res => {
-                console.log(res, 'rrr');
-                addFile.value = false
-                ElMessage({ message: "新增成功", type: "success" })
-                emit('threeBe', addFile.value)
-            })
-
-        }
-        function optChange(e) {
-            createFile.value.fileType = e
-        }
-        onMounted(() => {
-            inlineList()
-            getFileTree()
+    clickFileData: {
+      type: Object,
+      required: true,
+    },
+  },
+  setup(props, { emit }) {
+    const rules = {
+        fileType:{ required: true, message: '请选择文件类型', trigger: 'change' }
+    }
+    const { proxy } = getCurrentInstance();
+    const labelPosition = ref("right");
+    let { sureAddFile, back } = toRef(props);
+    let result = props.newAdd;
+    let createFile = ref({
+      name: "",
+      fileType: "",
+    });
+    let treeData = ref([]);
+    let defaultProps = ref({
+      label: "label",
+      value: "id",
+      disable: false,
+    });
+    let typeF = ref([
+      {
+        label: "word",
+        value: "word",
+      },
+      {
+        label: "excel",
+        value: "excel",
+      },
+      {
+        label: "ppt",
+        value: "ppt",
+      },
+      {
+        label: "txt",
+        value: "txt",
+      },
+    ]);
+    let noChangeSpaceId = ref(0);
+    let dirIds = ref(0);
+    let addFile = ref(false);
+    let nowFolder = ref("");
+    function inlineList() {
+      addFile.value = result;
+    }
+    //获取文件树
+    function getFileTree() {
+      documents.fileTree(3).then((res) => {
+        treeData.value = [res];
+      });
+      documents.getTop(3).then((res) => {
+        noChangeSpaceId.value = res.spaceId;
+      });
+    }
+    function handleNodeClick(data) {
+      console.log(data, "data");
+      dirIds.value = data.id;
+      nowFolder.value = data.label;
+    }
+    function backTo() {
+      addFile.value = false;
+      emit("threeBe", addFile.value);
+    }
+    function everyDunk() {
+      // fileCount.createFiles({
+      //     dirId: dirIds.value - 0,
+      //     spaceId: noChangeSpaceId.value - 0,
+      //     type: createFile.value.fileType + ""
+      // }).then(res => {
+      //     console.log(res, 'rrr');
+      //     addFile.value = false
+      //     ElMessage({ message: "新增成功", type: "success" })
+      //     emit('threeBe', addFile.value)
+      // })
+      proxy.$refs.labelRef.validate(valid => {
+        if (valid) {
+        fileCount
+        .createFiles({
+          dirId: props.clickFileData.dirId,
+          spaceId: props.clickFileData.spaceId,
+          type: createFile.fileType,
         })
-        return {
-            createFile,
-            getFileTree,
-            treeData,
-            defaultProps,
-            handleNodeClick,
-            typeF,
-            addFile,
-            backTo,
-            noChangeSpaceId,
-            dirIds,
-            back: backTo,
-            sureAddFile: everyDunk,
-            nowFolder,
-            optChange,
-        }
+        .then((res) => {
+          addFile.value = false;
+          ElMessage({ message: "新增成功", type: "success" });
+          emit("threeBe", addFile.value);
+        });
+      }
+    })
     }
-}
+    function optChange(e) {
+      createFile.fileType = e;
+    }
+    onMounted(() => {
+      inlineList();
+      getFileTree();
+    });
+    return {
+      createFile,
+      getFileTree,
+      treeData,
+      defaultProps,
+      handleNodeClick,
+      typeF,
+      addFile,
+      backTo,
+      noChangeSpaceId,
+      dirIds,
+      back: backTo,
+      sureAddFile: everyDunk,
+      nowFolder,
+      optChange,
+      labelPosition,
+      rules
+    };
+  },
+};
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.el-form-item__label {
+  color: #505870;
+}
+:deep(.el-select) {
+  width: 100% !important;
+}
+.el-dialog__title {
+  color: #000;
+}
+</style>

+ 1 - 1
src/views/publicment/MyFile.vue

@@ -180,7 +180,7 @@
                                                 <template #content> {{ scope.row.encryptLevel == 'L1'?'敏感':(scope.row.encryptLevel == 'L2'?'涉密':(scope.row.encryptLevel == 'L3'?'机密':'绝密')) }} </template>
                                                   <span class="shouzhi"> {{ scope.row.dirName }}</span>
                                                 </el-tooltip>
-                                                <span class="shouzhi" v-else>{{ scope.row.fileName }}</span>
+                                                <span class="shouzhi" v-else>{{ scope.row.dirName }}</span>
                                         </span>
                                     </template>
                                 </el-table-column>

+ 0 - 74
vite.config.js

@@ -1,74 +0,0 @@
-import {
-	defineConfig,
-	loadEnv
-} from 'vite'
-import path from 'path'
-import createVitePlugins from './vite/plugins'
-
-// https://vitejs.dev/config/
-export default defineConfig(({
-								 mode,
-								 command
-							 }) => {
-	const env = loadEnv(mode, process.cwd())
-	const {
-		VITE_APP_ENV
-	} = env
-	return {
-		// 部署生产环境和开发环境下的URL。
-		// 默认情况下,vite 会假设你的应用是被部署在一个域名的根路径上
-		// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
-		base: VITE_APP_ENV === 'production' ? '/' : '/',
-		plugins: createVitePlugins(env, command === 'build'),
-		resolve: {
-			// https://cn.vitejs.dev/config/#resolve-alias
-			alias: {
-				// 设置路径
-				'~': path.resolve(__dirname, './'),
-				// 设置别名
-				'@': path.resolve(__dirname, './src')
-			},
-			// https://cn.vitejs.dev/config/#resolve-extensions
-			extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
-		},
-		// vite 相关配置
-		server: {
-			port: 80,
-			host: true,
-			open: true,
-			proxy: {
-				// https://cn.vitejs.dev/config/#server-proxy
-				'/dev-api': {
-					target: 'http://192.168.1.28:8080/',
-					// target: 'http://localhost:8080/',
-					// target:'http://8.142.173.95:19527/',
-					changeOrigin: true,
-					rewrite: (p) => p.replace(/^\/dev-api/, '')
-				},
-				//websocket代理
-				'/websocket': {
-					// target:'ws://localhost:8080/websocket',
-					target:'ws://192.168.1.28:8080/websocket',
-					// target:'ws://8.142.173.95:19527/websocket',
-					changeOrigin: true,
-					rewrite: (p) => p.replace(/^\/websocket/, '')
-				}
-			}
-		},
-		//fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
-		css: {
-			postcss: {
-				plugins: [{
-					postcssPlugin: 'internal:charset-removal',
-					AtRule: {
-						charset: (atRule) => {
-							if (atRule.name === 'charset') {
-								atRule.remove();
-							}
-						}
-					}
-				}]
-			}
-		}
-	}
-})