Просмотр исходного кода

处理文档基本信息,加入目录功能。
在线编辑弹出窗口处理。

wukai 2 лет назад
Родитель
Сommit
dbca941c84

+ 4 - 2
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/OnlyOfficeController.java

@@ -8,6 +8,7 @@ import com.jjt.common.core.web.domain.AjaxResult;
 import com.jjt.common.core.web.page.TableDataInfo;
 import com.jjt.common.log.annotation.Log;
 import com.jjt.common.log.enums.BusinessType;
+import com.jjt.common.security.annotation.InnerAuth;
 import com.jjt.common.security.annotation.RequiresPermissions;
 import com.jjt.doc.domain.DocGroupUser;
 import com.jjt.doc.service.IDocGroupUserService;
@@ -44,13 +45,14 @@ public class OnlyOfficeController extends BaseController {
      *
      * @param id       文档ID
      * @param year     文档创建年份,分表用
+     * @param name     当前登录的用户名
      * @param request  请求参数
      * @param response 响应参数
      * @throws Exception
      */
     @RequestMapping("/callback")
     @ResponseBody
-    public void save(@RequestParam("id") Long id, @RequestParam("year") Long year, HttpServletRequest request, HttpServletResponse response) throws Exception {
+    public void save(@RequestParam("id") Long id, @RequestParam("year") Long year, @RequestParam("name") String name, HttpServletRequest request, HttpServletResponse response) throws Exception {
         PrintWriter writer = null;
         String body = "";
         try {
@@ -82,7 +84,7 @@ public class OnlyOfficeController extends BaseController {
         if (status == 2 || status == 3 || status == 6) {
             //MustSave, Corrupted
             String downloadUri = (String) jsonObj.get("url");
-            docInfoService.updateFile(id, year, downloadUri);
+            docInfoService.updateFile(id, year, name, downloadUri);
 //            System.err.println(downloadUri);
 //            try {
 //                URL url = new URL(downloadUri);

+ 11 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocInfo.java

@@ -1,5 +1,6 @@
 package com.jjt.doc.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -93,6 +94,16 @@ public class DocInfo extends BaseEntity {
      */
     @Excel(name = "逻辑删除标志;1/非1")
     private String isDel;
+    @TableField(exist = false)
+    private Long dirId;
+
+    public Long getDirId() {
+        return dirId;
+    }
+
+    public void setDirId(Long dirId) {
+        this.dirId = dirId;
+    }
 
     public void setDocId(Long docId) {
         this.docId = docId;

+ 8 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocInfoMapper.java

@@ -28,6 +28,14 @@ public interface DocInfoMapper {
     public DocInfo selectDocInfoByDocInfo(DocInfo docInfo);
 
     /**
+     * 查询文档基本信息
+     *
+     * @param docInfo 文档基本信息主键
+     * @return 文档基本信息
+     */
+    public List<DocInfo> selectDocInfoListDir(DocInfo docInfo);
+
+    /**
      * 查询文档基本信息列表
      *
      * @param docInfo 文档基本信息

+ 5 - 3
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocInfoService.java

@@ -69,9 +69,11 @@ public interface IDocInfoService {
 
     /**
      * onlyoffice修改文件保存
-     * @param id 文档ID
-     * @param year 创建年份
+     *
+     * @param id          文档ID
+     * @param year        创建年份
+     * @param name        用户名
      * @param downloadUri onlyoffice文件下载路径
      */
-    public void updateFile(Long id, Long year, String downloadUri);
+    public void updateFile(Long id, Long year, String name, String downloadUri);
 }

+ 64 - 43
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocInfoServiceImpl.java

@@ -14,10 +14,10 @@ import com.jjt.common.core.utils.StringUtils;
 import com.jjt.common.core.utils.file.FileTypeUtils;
 import com.jjt.common.core.utils.uuid.Seq;
 import com.jjt.common.security.utils.SecurityUtils;
+import com.jjt.doc.domain.DocInfoDir;
 import com.jjt.doc.domain.DocVersion;
 import com.jjt.doc.domain.EsDocInfo;
-import com.jjt.doc.service.EsDocInfoService;
-import com.jjt.doc.service.IDocVersionService;
+import com.jjt.doc.service.*;
 import com.jjt.system.api.RemoteFileService;
 import org.apache.commons.io.FilenameUtils;
 import org.springframework.stereotype.Service;
@@ -26,8 +26,6 @@ import com.jjt.doc.domain.DocInfo;
 
 import javax.annotation.Resource;
 
-import com.jjt.doc.service.IDocInfoService;
-
 /**
  * 文档基本信息Service业务层处理
  *
@@ -44,6 +42,8 @@ public class DocInfoServiceImpl implements IDocInfoService {
     private EsDocInfoService esDocInfoService;
     @Resource
     private IDocVersionService docVersionService;
+    @Resource
+    private IDocInfoDirService infoDirService;
 
     /**
      * 查询文档基本信息
@@ -75,7 +75,7 @@ public class DocInfoServiceImpl implements IDocInfoService {
      */
     @Override
     public List<DocInfo> selectDocInfoList(DocInfo docInfo) {
-        return docInfoMapper.selectDocInfoList(docInfo);
+        return docInfoMapper.selectDocInfoListDir(docInfo);
     }
 
     /**
@@ -86,36 +86,55 @@ public class DocInfoServiceImpl implements IDocInfoService {
      */
     @Override
     public int insertDocInfo(DocInfo docInfo) {
-        docInfo.setCreateTime(DateUtils.getNowDate());
-        docInfo.setCreateYear(DateUtils.getCurrentYear());
-        int re = docInfoMapper.insertDocInfo(docInfo);
-
-        String localFilePath = remoteFileService.localFilePath4RemoteFilePath(docInfo.getDocPath()).getData();
-        File file = new File(localFilePath);
-        //文件大小
-        docInfo.setDocSize(file.length());
-        //获取文件扩展名
-        int dot = localFilePath.lastIndexOf(".");
-        String ext = localFilePath.substring(dot + 1);
-        Map<String, Function<File, String>> handlerMap = new HashMap<>(16);
-        handlerMap.put("docx", FileContentUtils::getContentDocx);
-        handlerMap.put("doc", FileContentUtils::getContentDoc);
-        handlerMap.put("wps", FileContentUtils::getContentWps);
-        handlerMap.put("txt", FileContentUtils::getContentTxt);
-
-        Function<File, String> handler = handlerMap.get(ext);
-        if (handler != null) {
-            String content = handler.apply(file);
-            System.err.println(content);
-            EsDocInfo esDocInfo = new EsDocInfo();
-            esDocInfo.setId(docInfo.getDocId());
-            esDocInfo.setYear(docInfo.getCreateYear());
-            esDocInfo.setContent(content);
-            esDocInfoService.save(esDocInfo);
+        try {
+            docInfo.setCreateTime(DateUtils.getNowDate());
+            docInfo.setCreateYear(DateUtils.getCurrentYear());
+            int re = docInfoMapper.insertDocInfo(docInfo);
+
+            //插入文件与目录关系表
+            DocInfoDir infoDir = new DocInfoDir();
+            infoDir.setDirId(docInfo.getDirId());
+            infoDir.setDocId(docInfo.getDocId());
+            infoDir.setDocYear(docInfo.getCreateYear());
+            infoDirService.insertDocInfoDir(infoDir);
+
+            //读取文件内容存储至ES数据库 START
+            String localFilePath = remoteFileService.localFilePath4RemoteFilePath(docInfo.getDocPath()).getData();
+            File file = new File(localFilePath);
+
+            //获取文件扩展名
+            int dot = localFilePath.lastIndexOf(".");
+            String ext = localFilePath.substring(dot + 1);
+            Map<String, Function<File, String>> handlerMap = new HashMap<>(16);
+            handlerMap.put("docx", FileContentUtils::getContentDocx);
+            handlerMap.put("doc", FileContentUtils::getContentDoc);
+            handlerMap.put("wps", FileContentUtils::getContentWps);
+            handlerMap.put("txt", FileContentUtils::getContentTxt);
+
+            Function<File, String> handler = handlerMap.get(ext);
+            if (handler != null) {
+                String content = handler.apply(file);
+                System.err.println(content);
+                EsDocInfo esDocInfo = new EsDocInfo();
+                esDocInfo.setId(docInfo.getDocId());
+                esDocInfo.setYear(docInfo.getCreateYear());
+                esDocInfo.setContent(content);
+                esDocInfoService.save(esDocInfo);
+            }
+            System.err.println(file.length());
+            //读取文件内容存储至ES数据库 END
+
+            //文件大小
+            docInfo.setDocSize(file.length());
+            //文件类型
+            docInfo.setDocType(ext);
+
+            docInfoMapper.updateDocInfo(docInfo);
+            return re;
+        } catch (Exception e) {
+            e.printStackTrace();
         }
-        System.err.println(file.length());
-        docInfo.setUpdateTime(DateUtils.getNowDate());
-        return re;
+        return 0;
     }
 
     /**
@@ -157,35 +176,35 @@ public class DocInfoServiceImpl implements IDocInfoService {
      *
      * @param id          文档ID
      * @param year        创建年份
+     * @param name        用户名
      * @param downloadUri onlyoffice文件下载路径
      */
     @Override
-    public void updateFile(Long id, Long year, String downloadUri) {
+    public void updateFile(Long id, Long year, String name, String downloadUri) {
         try {
-
+            //获取文件上传相关配置信息
             Map<String, String> config = remoteFileService.getConfig().getData();
-
             String prefix = config.get("prefix");
             String path = config.get("path");
             String domain = config.get("domain");
+            //根据ID和year获取文件基本信息
             DocInfo docInfo = new DocInfo();
             docInfo.setDocId(id);
             docInfo.setCreateYear(year);
             docInfo = docInfoMapper.selectDocInfoByDocInfo(docInfo);
             String docPath = docInfo.getDocPath();
-
-
             //保存历史版本记录--start
             DocVersion version = new DocVersion();
             version.setDocId(id);
             version.setCreateYear(year);
+            version.setCreateBy(name);
             version.setDocPath(docPath);
             docVersionService.insertDocVersion(version);
             //保存历史版本记录--end
 
             //获取文件扩展名
             String ext = docPath.substring(docPath.lastIndexOf(".") + 1);
-            //生成文件名
+            //生成文件名
             String fileName = StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
                     docInfo.getDocName(), Seq.getId(Seq.uploadSeqType), ext);
             //下载文件 start
@@ -194,6 +213,10 @@ public class DocInfoServiceImpl implements IDocInfoService {
             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
             InputStream stream = connection.getInputStream();
             File savedFile = new File(path + "/" + fileName);
+            //创建目录
+            if (!savedFile.getParentFile().exists()) {
+                savedFile.getParentFile().mkdirs();
+            }
             try (FileOutputStream out = new FileOutputStream(savedFile)) {
                 int read;
                 final byte[] bytes = new byte[1024];
@@ -206,15 +229,13 @@ public class DocInfoServiceImpl implements IDocInfoService {
             connection.disconnect();
             //下载文件 end
 
-
             //修改文件保存信息
             docPath = domain + prefix + "/" + fileName;
             docInfo.setDocPath(docPath);
-            docInfo.setUpdateBy(SecurityUtils.getUsername());
+            docInfo.setUpdateBy(name);
             docInfo.setUpdateTime(DateUtils.getNowDate());
             docInfoMapper.updateDocInfo(docInfo);
 
-
         } catch (Exception ex) {
             ex.printStackTrace();
         }

+ 27 - 0
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocInfoMapper.xml

@@ -67,6 +67,33 @@
             <if test="updateTime != null ">and UPDATE_TIME = #{updateTime}</if>
             <if test="remark != null  and remark != ''">and REMARK = #{remark}</if>
             <if test="isDel != null  and isDel != ''">and IS_DEL = #{isDel}</if>
+            <if test="dirId != null  and dirId != ''">and IS_DEL = #{dirId}</if>
+        </where>
+    </select>
+
+    <select id="selectDocInfoListDir" parameterType="DocInfo" resultMap="DocInfoResult">
+        select A.DOC_ID, DOC_NAME, DOC_TYPE, DOC_SIZE, CLASSIFY_ID, DOC_DESC, DOC_PATH, DOC_LEVEL, ALLOW_EDIT, DOC_OF,
+        OWNER, CREATE_YEAR, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK, IS_DEL
+        from doc_info a,(select DOC_ID,DOC_YEAR from DOC_INFO_DIR where dir_id=#{dirId}) B
+        <where>
+            a.CREATE_YEAR=b.doc_year and a.doc_id=b.doc_id
+            <if test="docName != null  and docName != ''">and DOC_NAME like concat('%', #{docName}, '%')</if>
+            <if test="docType != null  and docType != ''">and DOC_TYPE = #{docType}</if>
+            <if test="docSize != null ">and DOC_SIZE = #{docSize}</if>
+            <if test="classifyId != null ">and CLASSIFY_ID = #{classifyId}</if>
+            <if test="docDesc != null  and docDesc != ''">and DOC_DESC = #{docDesc}</if>
+            <if test="docPath != null  and docPath != ''">and DOC_PATH = #{docPath}</if>
+            <if test="docLevel != null ">and DOC_LEVEL = #{docLevel}</if>
+            <if test="allowEdit != null  and allowEdit != ''">and ALLOW_EDIT = #{allowEdit}</if>
+            <if test="docOf != null  and docOf != ''">and DOC_OF = #{docOf}</if>
+            <if test="owner != null ">and OWNER = #{owner}</if>
+            <if test="createYear != null ">and CREATE_YEAR = #{createYear}</if>
+            <if test="createBy != null ">and CREATE_BY = #{createBy}</if>
+            <if test="createTime != null ">and CREATE_TIME = #{createTime}</if>
+            <if test="updateBy != null ">and UPDATE_BY = #{updateBy}</if>
+            <if test="updateTime != null ">and UPDATE_TIME = #{updateTime}</if>
+            <if test="remark != null  and remark != ''">and REMARK = #{remark}</if>
+            <if test="isDel != null  and isDel != ''">and IS_DEL = #{isDel}</if>
         </where>
     </select>
 

+ 1 - 1
lzga-modules/lzga-file/src/main/java/com/jjt/file/utils/FileUploadUtils.java

@@ -25,7 +25,7 @@ public class FileUploadUtils {
     /**
      * 默认大小 2GB
      */
-    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
+    public static final long DEFAULT_MAX_SIZE = 1024 * 1024 * 1024;
 
     /**
      * 默认的文件名最大长度 100

+ 3 - 3
lzga-ui/src/components/FileUpload/index.vue

@@ -55,12 +55,12 @@ export default {
     // 大小限制(MB)
     fileSize: {
       type: Number,
-      default: 5,
+      default: 1024,
     },
     // 文件类型, 例如['png', 'jpg', 'jpeg']
     fileType: {
       type: Array,
-      default: () => ["doc","docx", "xls","xlsx", "ppt", "txt", "pdf"],
+      default: () => ["doc","docx", "xls","xlsx", "ppt", "txt", "pdf","gz"],
     },
     // 是否显示提示
     isShowTip: {
@@ -211,4 +211,4 @@ export default {
 .ele-upload-list__item-content-action .el-link {
   margin-right: 10px;
 }
-</style>
+</style>

+ 82 - 62
lzga-ui/src/router/index.js

@@ -29,17 +29,14 @@ import Layout from '@/layout'
  */
 
 // 公共路由
-export const constantRoutes = [
-  {
+export const constantRoutes = [{
     path: '/redirect',
     component: Layout,
     hidden: true,
-    children: [
-      {
-        path: '/redirect/:path(.*)',
-        component: () => import('@/views/redirect')
-      }
-    ]
+    children: [{
+      path: '/redirect/:path(.*)',
+      component: () => import('@/views/redirect')
+    }]
   },
   {
     path: '/login',
@@ -65,35 +62,37 @@ export const constantRoutes = [
     path: '',
     component: Layout,
     redirect: 'index',
-    children: [
-      {
-        path: 'index',
-        component: () => import('@/views/index'),
-        name: 'Index',
-        meta: { title: '首页', icon: 'dashboard', affix: true }
+    children: [{
+      path: 'index',
+      component: () => import('@/views/index'),
+      name: 'Index',
+      meta: {
+        title: '首页',
+        icon: 'dashboard',
+        affix: true
       }
-    ]
+    }]
   },
   {
     path: '/user',
     component: Layout,
     hidden: true,
     redirect: 'noredirect',
-    children: [
-      {
-        path: 'profile',
-        component: () => import('@/views/system/user/profile/index'),
-        name: 'Profile',
-        meta: { title: '个人中心', icon: 'user' }
+    children: [{
+      path: 'profile',
+      component: () => import('@/views/system/user/profile/index'),
+      name: 'Profile',
+      meta: {
+        title: '个人中心',
+        icon: 'user'
       }
-    ]
+    }]
   },
   {
     path: '/home',
     component: () => import('@/views1/HomeView.vue'),
     hidden: true,
-    children: [
-      {
+    children: [{
         path: "/home/page",
         component: () => import('@/views1/Page/PageView.vue')
       },
@@ -123,76 +122,95 @@ export const constantRoutes = [
 ]
 
 // 动态路由,基于用户权限动态去加载
-export const dynamicRoutes = [
-  {
+export const dynamicRoutes = [{
     path: '/system/user-auth',
     component: Layout,
     hidden: true,
     permissions: ['system:user:edit'],
-    children: [
-      {
-        path: 'role/:userId(\\d+)',
-        component: () => import('@/views/system/user/authRole'),
-        name: 'AuthRole',
-        meta: { title: '分配角色', activeMenu: '/system/user' }
+    children: [{
+      path: 'role/:userId(\\d+)',
+      component: () => import('@/views/system/user/authRole'),
+      name: 'AuthRole',
+      meta: {
+        title: '分配角色',
+        activeMenu: '/system/user'
       }
-    ]
+    }]
   },
   {
     path: '/system/role-auth',
     component: Layout,
     hidden: true,
     permissions: ['system:role:edit'],
-    children: [
-      {
-        path: 'user/:roleId(\\d+)',
-        component: () => import('@/views/system/role/authUser'),
-        name: 'AuthUser',
-        meta: { title: '分配用户', activeMenu: '/system/role' }
+    children: [{
+      path: 'user/:roleId(\\d+)',
+      component: () => import('@/views/system/role/authUser'),
+      name: 'AuthUser',
+      meta: {
+        title: '分配用户',
+        activeMenu: '/system/role'
       }
-    ]
+    }]
   },
   {
     path: '/system/dict-data',
     component: Layout,
     hidden: true,
     permissions: ['system:dict:list'],
-    children: [
-      {
-        path: 'index/:dictId(\\d+)',
-        component: () => import('@/views/system/dict/data'),
-        name: 'Data',
-        meta: { title: '字典数据', activeMenu: '/system/dict' }
+    children: [{
+      path: 'index/:dictId(\\d+)',
+      component: () => import('@/views/system/dict/data'),
+      name: 'Data',
+      meta: {
+        title: '字典数据',
+        activeMenu: '/system/dict'
       }
-    ]
+    }]
   },
   {
     path: '/monitor/job-log',
     component: Layout,
     hidden: true,
     permissions: ['monitor:job:list'],
-    children: [
-      {
-        path: 'index/:jobId(\\d+)',
-        component: () => import('@/views/monitor/job/log'),
-        name: 'JobLog',
-        meta: { title: '调度日志', activeMenu: '/monitor/job' }
+    children: [{
+      path: 'index/:jobId(\\d+)',
+      component: () => import('@/views/monitor/job/log'),
+      name: 'JobLog',
+      meta: {
+        title: '调度日志',
+        activeMenu: '/monitor/job'
       }
-    ]
+    }]
   },
   {
     path: '/tool/gen-edit',
     component: Layout,
     hidden: true,
     permissions: ['tool:gen:edit'],
-    children: [
-      {
-        path: 'index/:tableId(\\d+)',
-        component: () => import('@/views/tool/gen/editTable'),
-        name: 'GenEdit',
-        meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
+    children: [{
+      path: 'index/:tableId(\\d+)',
+      component: () => import('@/views/tool/gen/editTable'),
+      name: 'GenEdit',
+      meta: {
+        title: '修改生成配置',
+        activeMenu: '/tool/gen'
+      }
+    }]
+  },
+  {
+    path: '/doc/oo-edit',
+    component: Layout,
+    hidden: true,
+    permissions: ['tool:gen:edit'],
+    children: [{
+      path: 'index/:docId(\\d+)',
+      component: () => import('@/views/doc/oo/edit'),
+      name: 'OoEdit',
+      meta: {
+        title: '文件在线编辑',
+        activeMenu: '/doc/info'
       }
-    ]
+    }]
   }
 ]
 
@@ -204,6 +222,8 @@ Router.prototype.push = function push(location) {
 
 export default new Router({
   mode: 'history', // 去掉url中的#
-  scrollBehavior: () => ({ y: 0 }),
+  scrollBehavior: () => ({
+    y: 0
+  }),
   routes: constantRoutes
 })

+ 1 - 1
lzga-ui/src/views/doc/groupUser/index.vue

@@ -15,7 +15,7 @@
 </template>
 
 <script>
-  import vabOnlyOffice from '@/views/tool/onlyoffice.vue'
+  import vabOnlyOffice from '@/views/doc/oo/onlyoffice.vue'
 
   export default {
     name: 'App',

+ 120 - 101
lzga-ui/src/views/doc/info/index.vue

@@ -1,80 +1,92 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="文档名称" prop="docName">
-        <el-input v-model="queryParams.docName" placeholder="请输入文档名称" clearable @keyup.enter.native="handleQuery" />
-      </el-form-item>
-      <el-form-item label="文档级别" prop="docLevel">
-        <el-input v-model="queryParams.docLevel" placeholder="请输入文档级别" clearable @keyup.enter.native="handleQuery" />
-      </el-form-item>
-      <el-form-item label="文档年份" prop="createYear">
-        <el-input v-model="queryParams.createYear" placeholder="请输入文档创建年份" clearable
-          @keyup.enter.native="handleQuery" />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
-
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-          v-hasPermi="['doc:info:add']">新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-          v-hasPermi="['doc:info:edit']">修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
-          v-hasPermi="['doc:info:remove']">删除</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-          v-hasPermi="['doc:info:export']">导出</el-button>
+    <el-row :gutter="20">
+      <!--目录数据-->
+      <el-col :span="4" :xs="24">
+        <div class="head-container">
+          <el-tree :data="dirList" :props="defaultProps" :expand-on-click-node="false" ref="tree" node-key="id"
+            default-expand-all highlight-current @node-click="handleNodeClick" />
+        </div>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
-    </el-row>
+      <!--文档数据-->
+      <el-col :span="16" :xs=24>
+        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
+          label-width="68px">
+          <el-form-item label="文档名称" prop="docName">
+            <el-input v-model="queryParams.docName" placeholder="请输入文档名称" clearable @keyup.enter.native="handleQuery" />
+          </el-form-item>
+          <el-form-item label="文档级别" prop="docLevel">
+            <el-input v-model="queryParams.docLevel" placeholder="请输入文档级别" clearable
+              @keyup.enter.native="handleQuery" />
+          </el-form-item>
+          <el-form-item label="文档年份" prop="createYear">
+            <el-input v-model="queryParams.createYear" placeholder="请输入文档创建年份" clearable
+              @keyup.enter.native="handleQuery" />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <el-row :gutter="10" class="mb8">
+          <el-col :span="1.5">
+            <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+              v-hasPermi="['doc:info:add']">上传</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
+              v-hasPermi="['doc:info:edit']">修改</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
+              v-hasPermi="['doc:info:remove']">删除</el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+              v-hasPermi="['doc:info:export']">导出</el-button>
+          </el-col>
+          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+        </el-row>
 
-    <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="文档ID" align="center" prop="docId" />
-      <el-table-column label="文档名称" align="center" prop="docName" />
-      <el-table-column label="文档级别" align="center" prop="docLevel" />
-      <el-table-column label="文档年份" align="center" prop="createYear" />
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button size="mini" type="text" icon="el-icon-view" @click="handlePreview(scope.row)">预览</el-button>
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-            v-hasPermi="['doc:info:edit']">修改</el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-            v-hasPermi="['doc:info:remove']">删除</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
+        <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="55" align="center" />
+          <el-table-column label="文档ID" align="center" prop="docId" />
+          <el-table-column label="文档名称" align="center" prop="docName" />
+          <el-table-column label="文档级别" align="center" prop="docLevel" />
+          <el-table-column label="文档年份" align="center" prop="createYear" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button size="mini" type="text" icon="el-icon-view" @click="handlePreview(scope.row)">预览</el-button>
+              <el-button size="mini" type="text" icon="el-icon-view" @click="handleEdit(scope.row)">在线编辑</el-button>
+              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+                v-hasPermi="['doc:info:edit']">修改</el-button>
+              <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+                v-hasPermi="['doc:info:remove']">删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
 
-    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-      @pagination="getList" />
+        <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+          @pagination="getList" />
 
+      </el-col>
+    </el-row>
     <!-- 添加或修改文档基本信息对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="文档名称" prop="docName">
-          <el-input v-model="form.docName" placeholder="请输入文档名称" />
-        </el-form-item>
-        <el-form-item label="文档描述">
-          <editor v-model="form.docDesc" :min-height="192" />
-        </el-form-item>
-        <el-form-item label="文档存储路径" prop="docPath">
+        <el-form-item label="" prop="docPath">
           <!-- <el-input v-model="form.docPath" placeholder="请输入文档路径" /> -->
           <file-upload v-model="form.docPath" />
         </el-form-item>
-        <el-form-item label="文档级别" prop="docLevel">
-          <el-input v-model="form.docLevel" placeholder="请输入文档级别" />
+        <el-form-item label="文件名称" prop="docName">
+          <el-input v-model="form.docName" placeholder="请输入文档名称" />
+        </el-form-item>
+        <el-form-item label="文件描述">
+          <el-input v-model="form.docDesc" type="textarea" placeholder="请输入内容" />
         </el-form-item>
-        <el-form-item label="文档年份" prop="createYear">
-          <el-input v-model="form.createYear" placeholder="请输入文档创建年份" />
+        <el-form-item label="文件级别" prop="docLevel">
+          <el-input v-model="form.docLevel" placeholder="请输入文档级别" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -82,9 +94,6 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
-    <div v-if='show' class='qualityManual-container-office'>
-      <vab-only-office :option='option' />
-    </div>
   </div>
 </template>
 
@@ -96,14 +105,23 @@
     addInfo,
     updateInfo
   } from "@/api/doc/info";
+  import {
+    listDir,
+    getDir,
+    delDir,
+    addDir,
+    updateDir,
+    personalList
+  } from "@/api/doc/dir";
 
-  import vabOnlyOffice from '@/views/tool/onlyoffice.vue';
+  import Treeselect from "@riophae/vue-treeselect";
+  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 
   export default {
+    name: "Info",
     components: {
-      vabOnlyOffice
+      Treeselect
     },
-    name: "Info",
     data() {
       return {
         // 遮罩层
@@ -120,6 +138,8 @@
         total: 0,
         // 文档基本信息表格数据
         infoList: [],
+        dirId: undefined, //目录ID
+        dirList: undefined,
         // 弹出层标题
         title: "",
         // 是否显示弹出层
@@ -134,6 +154,11 @@
         },
         // 表单参数
         form: {},
+        defaultProps: {
+          children: "children",
+          label: "dirName",
+          id: "dirId"
+        },
         // 表单校验
         rules: {
           docName: [{
@@ -146,44 +171,37 @@
             message: "文档创建年份;文档创建年份,分表用不能为空",
             trigger: "blur"
           }],
-        },
-        option: {
-          key: '', //key 使用文档ID+年份
-          url: '', //在线文档地址
-          isEdit: '', //是否允许编辑
-          fileType: '', //文件扩展名
-          title: '', //文件标题
-          user: {
-            id: null, //用户ID
-            name: '' //用户姓名
-          },
-          editUrl: '' //回调地址
-        },
-        show: true //是否显示
+        }
       }
     },
     created() {
       this.getList();
+      this.dirTree();
     },
     methods: {
+      //目录树
+      dirTree() {
+        personalList().then(response => {
+          this.dirId = response.data[0].dirId;
+          this.dirList = this.handleTree(response.data, "dirId");
+          this.loading = false;
+        });
+      },
+      // 节点单击事件
+      handleNodeClick(data) {
+        this.queryParams.dirId = data.dirId;
+        this.dirId = data.dirId;
+        this.handleQuery();
+      },
+      //预览
       handlePreview(row) {
-        console.log(row);
-        //获取当前登录用户名:this.$store.state.user.name
-        //获取当前登录用户ID:this.$store.state.user.uid
-        //获取当前登录用户昵称:this.$store.state.user.uname
-        this.show = true;
-        // getAction('/file/selectById', { id: this.id }).then(res => {
-        this.option.isEdit = true;
-        this.option.url = row.docPath;
-        //'http://192.168.1.26:9300/statics/2023/04/03/产品研发会议纪要20230314_20230403170635A001.doc';
-        this.option.title = row.docName; //'测试word';
-        this.option.fileType = row.docType;
-
-        this.option.user = {
-          id: this.$store.state.user.uid,
-          name: this.$store.state.user.uname
-        };
-        this.option.editUrl = 'http://192.168.1.26:8080/doc/only-office/callback?id='+row.docId+"&year="+row.createYear
+        row.isEdit = false;
+        this.$tab.openPage("文件[" + row.docName + "]预览", '/doc/oo-edit/index/' + row.docId, row);
+      },
+      //在线编辑
+      handleEdit(row) {
+        row.isEdit = true;
+        this.$tab.openPage("文件[" + row.docName + "]在线编辑", '/doc/oo-edit/index/' + row.docId, row);
       },
       /** 查询文档基本信息列表 */
       getList() {
@@ -203,6 +221,7 @@
       reset() {
         this.form = {
           docId: null,
+          dirId: this.dirId,
           docName: null,
           docType: null,
           docSize: null,

+ 90 - 0
lzga-ui/src/views/doc/oo/edit.vue

@@ -0,0 +1,90 @@
+<template>
+  <div v-if='show' class='qualityManual-container-office'>
+    <vab-only-office :option='option' />
+  </div>
+</template>
+
+<script>
+  import vabOnlyOffice from '@/views/doc/oo/onlyoffice.vue'
+
+  export default {
+    name: 'OoEdit',
+    components: {
+      vabOnlyOffice
+    },
+    data() {
+      return {
+        //参考vabOnlyOffice组件参数配置
+        option: {
+          key: '',
+          url: '', //在线文档地址
+          isEdit: '', //是否允许编辑
+          fileType: '', //文件扩展名
+          title: '', //文件标题
+          user: {
+            id: null, //用户ID
+            name: '' //用户姓名
+          },
+          editUrl: '' //回调地址
+        },
+        show: true //是否显示
+      }
+    },
+    created() {
+      this.getFile();
+    },
+    methods: {
+      getFile() {
+        //获取当前登录用户名:this.$store.state.user.name
+        //获取当前登录用户ID:this.$store.state.user.uid
+        //获取当前登录用户昵称:this.$store.state.user.uname
+        let row = this.$route.query;
+        let isEdit = row.isEdit == 'true';
+        this.show = true;
+        // getAction('/file/selectById', { id: this.id }).then(res => {
+        this.option.isEdit = isEdit;
+        this.option.url = row.docPath;
+        //'http://192.168.1.26:9300/statics/2023/04/03/产品研发会议纪要20230314_20230403170635A001.doc';
+        this.option.title = row.docName; //'测试word';
+        this.option.fileType = row.docType;
+
+        this.option.user = {
+          id: this.$store.state.user.uid,
+          name: this.$store.state.user.uname
+        };
+        this.option.editUrl = 'http://192.168.1.26:8080/doc/only-office/callback?id=' + row.docId +
+          "&year=" + row.createYear + "&name=" + this.$store.state.user.name;
+      },
+      close() {
+        this.show = false
+      }
+    }
+  }
+</script>
+
+<style>
+  html,
+  body {
+    height: '900px';
+  }
+
+  #app {
+    font-family: Avenir, Helvetica, Arial, sans-serif;
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+    text-align: center;
+    color: #2c3e50;
+    height: '900px';
+
+  }
+
+  .qualityManual-container {
+    padding: 0 !important;
+    height: '900px';
+  }
+
+  .qualityManual-container-office {
+    width: 100%;
+    height: '900px';
+  }
+</style>

+ 0 - 0
lzga-ui/src/views/tool/onlyoffice.vue → lzga-ui/src/views/doc/oo/onlyoffice.vue