Jelajahi Sumber

测试文档

yusheng 1 tahun lalu
induk
melakukan
11a22abefc

TEMPAT SAMPAH
dist.zip


+ 1 - 0
package.json

@@ -21,6 +21,7 @@
     "core-js": "^3.25.0",
     "cropperjs": "^1.5.13",
     "ele-admin": "^1.11.2",
+    "element-tree-line": "^0.2.1",
     "element-ui": "2.15.7",
     "github-markdown-css": "^5.1.0",
     "json-bigint": "^1.0.0",

TEMPAT SAMPAH
src/assets/wjj.png


+ 129 - 0
src/components/addDoc/api/index.js

@@ -0,0 +1,129 @@
+import request from '@/utils/request';
+
+/**
+ * 查询文件夹分类数据
+ * @data data
+ */
+export async function getDocTreeListAPI(data) {
+  const res = await request.post('/fm/directory/selectTreeList', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 查询文件数据
+ * @data data
+ */
+export async function filePageAPI(data) {
+  const res = await request.post('/fm/file/pageBusiness', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 保存
+ * @data data
+ */
+export async function fileSaveAPI(data) {
+  const res = await request.post('/fm/file/save', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 详情
+ * @id id
+ */
+export async function fileGetByIdAPI(id) {
+  const res = await request.get(`/fm/file/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * ids查询文件列表
+ * @data data
+ */
+export async function queryIds(data) {
+  const res = await request.post('/fm/file/queryIds', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取编码树
+export async function selectTreeList(data) {
+  const res = await request.post(
+    `/main/business_code_category/selectTreeList`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 获取右侧列表
+export async function listParentId(data) {
+  const res = await request.post(
+    `/main/business_code_category/listPageParentId`,
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 获取右侧码段列表
+export async function pageSegment(data) {
+  const res = await request.post(`/main/business_code_manage/page`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 生成编码
+export async function getCode(id) {
+  const res = await request.get(
+    `/main/business_code_category/applyForCode/` + id
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 上传文件
+ * @param file 文件
+ */
+export async function uploadFileNew(data) {
+  const formData = new FormData();
+  formData.append('multiPartFile', data.multiPartFile);
+  formData.append('module', data.module);
+  const res = await request.post('/main/file/uploadFile', formData);
+  if (res.data.code === '0') {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 编码方案
+export async function listCode(data = {}) {
+  const res = await request.get(
+    `/main/business_code_category/listCode/${data.id || '0'}` +
+      '?parentId=' +
+      (data.parentId || '')
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 61 - 0
src/components/addDoc/browse.vue

@@ -0,0 +1,61 @@
+<template>
+  <ele-modal
+    :visible.sync="showEditFlag"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    append-to-body
+    :fullscreen="true"
+  >
+    <iframe
+      :src="fileUrl"
+      width="100%"
+      v-if="showEditFlag"
+      style="height: calc(100vh - 100px)"
+      frameborder="0"
+      allowfullscreen="true"
+    ></iframe
+  ></ele-modal>
+</template>
+
+<script>
+import { getFileType } from './util.js';
+
+export default {
+  data() {
+    return {
+      fileUrl: '',
+      showEditFlag: false
+    };
+  },
+
+  methods: {
+    open(row){
+      this.showEditFlag=true
+      this.setFileUrl(row)
+    },
+    setFileUrl(row) {
+      let file = row.storagePath[0];
+      let fileNames=file.storePath.split('/')
+      let url = window.location.origin+'/api/main/file/getFile?objectName='+file.storePath+'&fullfilename='+fileNames[fileNames.length-1]
+      this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
+      
+      // const fileExt = file.name.substr(file.name.lastIndexOf('.') + 1);
+      // this.fileType = getFileType().includes(fileExt) ? 2 : 1;
+      // if (this.fileType == 2) {
+      //   this.fileUrl =
+      //     '/fm/' +
+      //     (['dxf', 'dwg'].includes(fileExt) ? '2DViewer' : '3DViewer') +
+      //     '/view.html?url=' +
+      //     sessionStorage.filePath +
+      //     '/' +
+      //     row.outputNdsFiles;
+      // } else {
+      //   this.fileUrl = '/kkfile/onlinePreview?url=' + btoa(url);
+      //   // 'http://192.168.1.107:18082/kkfile/onlinePreview?url=' + btoa(url);
+      // }
+    }
+  }
+};
+</script>
+<style scoped lang="scss">
+</style>

+ 176 - 0
src/components/addDoc/doc_template.vue

@@ -0,0 +1,176 @@
+<template>
+  <div class="ele-body" style="height:60vh;overflow: auto;">
+    <el-card shadow="never" v-loading="loading">
+      <ele-split-layout
+        width="210px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div>
+          <!-- 操作按钮 -->
+          <ele-toolbar class="ele-toolbar-actions">
+            <div style="margin: 5px 0"> </div>
+          </ele-toolbar>
+             
+          <div class="ele-border-lighter sys-organization-list"  style="height: 65vh">
+            <el-tree
+              ref="tree"
+              :data="data"
+              highlight-current
+              :draggable="true"
+              node-key="id"
+              :props="{ label: 'name', children: 'sonDirectoryList' }"
+              :expand-on-click-node="false"
+              :default-expand-all="true"
+              @node-click="onNodeClick"
+            >
+              <span class="custom-tree-node" slot-scope="{ node, data }">
+                <ElementTreeLine
+                  :node="node"
+                  :showLabelLine="true"
+                  :indent="20"
+                >
+                  <img src="../../assets/wjj.png" />
+
+                  <span>{{ node.label }}</span>
+                </ElementTreeLine>
+              </span>
+            </el-tree>
+          </div>
+        </div>
+        <template v-slot:content>
+          <FileTableList
+            ref="tableRef"
+            :parentData="current"
+            :disabledTableList="disabledTableList"
+          />
+        </template>
+      </ele-split-layout>
+    </el-card>
+
+    <!-- {{current?.id}} -->
+  </div>
+</template>
+
+<script>
+//
+import FileTableList from './file-table-listTemplate.vue';
+import { getDocTreeListAPI } from './api';
+import { mapGetters } from 'vuex';
+
+import ElementTreeLine from 'element-tree-line';
+// css
+import 'element-tree-line/dist/style.scss';
+export default {
+  components: { FileTableList, ElementTreeLine },
+
+  data() {
+    return {
+      loading: true,
+      // 列表数据
+      data: [],
+      fileType:0,
+      // 选中数据
+      current: {}
+    };
+  },
+  props: {
+    lcyStatus: '', //1:文档工作区 2:文档归档区 3:文档发布区 4:文档废止区
+
+    disabledTableList: {
+      //已选择列表
+      default: () => []
+    }
+  },
+  computed: {
+    ...mapGetters(['user'])
+  },
+  created() {
+    this.query();
+  },
+
+  methods: {
+    /* 查询 */
+    async query() {
+      this.loading = true;
+      let query = {
+        type: this.fileType,
+        currentUserId: this.user.info.userId
+      };
+      this.data = await getDocTreeListAPI(query);
+
+      this.current = null;
+      this.$nextTick(() => {
+        this.$refs.tree.setCurrentKey(this.data[0].id);
+
+        this.onNodeClick(this.data[0]);
+      });
+      this.loading = false;
+    },
+    /* 选择数据 */
+    onNodeClick(row) {
+      if (row) {
+        this.current = row;
+        this.$nextTick(() => {
+          this.$refs.tableRef.reload();
+        });
+      } else {
+        this.current = null;
+      }
+    },
+
+    getTableList() {
+      return this.$refs.tableRef.getTableList();
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.sys-organization-list {
+  height: calc(100vh - 180px);
+  box-sizing: border-box;
+  border-width: 1px;
+  border-style: solid;
+  overflow: auto;
+}
+
+.sys-organization-list :deep(.el-tree-node__content) {
+  height: 30px;
+
+  & > .el-tree-node__expand-icon {
+    margin-left: 10px;
+  }
+}
+.custom-tree-node {
+  display: flex;
+  align-items: center;
+}
+:deep(.el-popover) {
+  min-width: 50px;
+  position: fixed;
+}
+:deep(.el-link--inner) {
+  padding: 3px 0;
+}
+// :deep(.element-tree-node-line-hor) {
+//   border-bottom: 1px solid #dcdfe6;
+// }
+// :deep(.element-tree-node-line-ver) {
+//   border-left: 1px solid #dcdfe6;
+// }
+</style>
+<style lang="scss">
+.el-tree
+  > .el-tree-node
+  > .el-tree-node__content:nth-of-type(1)
+  .element-tree-node-line-hor {
+  border: none;
+}
+.el-tree
+  > .el-tree-node
+  > .el-tree-node__content:nth-of-type(1)
+  .element-tree-node-line-ver {
+  border: none;
+}
+</style>

+ 293 - 0
src/components/addDoc/file-edit.vue

@@ -0,0 +1,293 @@
+<!-- 用户编辑弹窗 -->
+<template>
+  <ele-modal
+    width="500px"
+    :visible.sync="showEditFlag"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    append-to-body
+    @close="cancel"
+    :title="title"
+    ref="Emodal"
+    :maxable="true"
+    :resizable="true"
+  >
+    <el-form ref="form" :model="form" :rules="rules" label-width="82px">
+      <el-row :gutter="15">
+        <el-col :span="24">
+          <el-form-item label="文档位置" prop="directoryId">
+            <el-cascader
+              style="width: 100%"
+              v-model="form.directoryId"
+              :options="folderList"
+              @change="initFileCode"
+              ref="cascaderRef"
+              :props="{
+                value: 'id',
+                label: 'name',
+                children: 'sonDirectoryList',
+                emitPath: false,
+                checkStrictly: true
+              }"
+            ></el-cascader>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="编码分类" prop="codeType">
+            <ele-tree-select
+              clearable
+              :data="list"
+              v-model="form.codeType"
+              placeholder="请选择"
+              default-expand-all
+              labelKey="name"
+              childrenKey="sonDirectoryList"
+              valueKey="id"
+              @change="typeChange"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="编码方案" prop="businessCodeId">
+            <el-select
+              v-model="form.businessCodeId"
+              placeholder="请选择"
+              style="width: 100%"
+            >
+              <el-option
+                v-for="item in options"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="文档类型" prop="type">
+            <DictSelection
+              dictName="文档类型"
+              v-model="form.type"
+            ></DictSelection>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="24">
+          <el-form-item label="文档" prop="storagePath">
+            <div style="display: flex; align-items: center">
+              <fileUpload
+                v-model="form.storagePath"
+                module="main"
+                :limit="100"
+                :multiple="true"
+                @fileChange="fileChange"
+              >
+              </fileUpload>
+            </div>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="24">
+          <el-form-item label="备注" prop="remark">
+            <el-input
+              v-model="form.remark"
+              type="textarea"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <template v-slot:footer>
+      <el-button @click="cancel">取消</el-button>
+      <el-button type="primary" :loading="loading" @click="save">
+        确认
+      </el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import {
+    fileSaveAPI,
+    selectTreeList,
+    listParentId,
+    getDocTreeListAPI,
+    listCode
+  } from './api/index';
+  import FileUpload from './fileUpload.vue';
+  import { setFolderList } from './util.js';
+  import { mapGetters } from 'vuex';
+  export default {
+    components: { FileUpload },
+
+    data() {
+      const defaultForm = {
+        name: '', //名称
+        type: '1', //类型
+        sizeUnit: '', //大小,
+        unit: '', //单位
+        remark: '', //备注
+        status: '', //状态
+        storagePathId: '',
+        directoryId: '',
+        businessCodeId: '',
+        storagePath: [],
+        id: '',
+        lcyStatus: 1,
+        fileType: 0
+      };
+      return {
+        rules: {
+          businessCodeId: [
+            { required: true, message: '请选择', trigger: 'blur' }
+          ],
+          // codeType: [{ required: true, message: '请选择', trigger: 'blur' }],
+          directoryId: [{ required: true, message: '请选择', trigger: 'blur' }],
+          storagePath: [{ required: true, message: '请选择', trigger: 'blur' }]
+        },
+        templateVisible: false,
+        folderList: [],
+        list: [],
+        options: [],
+        defaultForm,
+        code: '',
+        // 表单数据
+        form: { ...defaultForm },
+
+        // 提交状态
+        loading: false,
+        showEditFlag: false,
+        title: '',
+        type: '新建附件',
+        nodeData: {}
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      },
+      ...mapGetters(['user'])
+    },
+    async created() {
+      let query = {
+        type: 0,
+        currentUserId: this.user.info.userId
+      };
+      this.folderList = await getDocTreeListAPI(query);
+      setFolderList(this.folderList); //权限过滤
+    },
+    methods: {
+      async getTreeCode() {
+        let nodeData = {};
+        await this.$nextTick(() => {
+          nodeData = this.$refs.cascaderRef.getCheckedNodes();
+        });
+        this.nodeData = {
+          id: nodeData[0]?.data?.id,
+          parentId:
+            nodeData[0]?.data?.parentId != 0 ? nodeData[0]?.data?.parentId : ''
+        };
+      },
+      async initFileCode() {
+        await this.getTreeCode();
+        this.options = this.nodeData.id ? await listCode(this.nodeData) : [];
+        if (this.options.length > 0) {
+          this.form.businessCodeId = this.options[0].id;
+        } else {
+          this.form.businessCodeId = '';
+        }
+      },
+      async open() {
+        this.showEditFlag = true;
+        this.list = await selectTreeList();
+        await this.initFileCode();
+        this.setTree(this.list);
+      },
+
+      setTree(data) {
+        data.forEach((item) => {
+          item.sonDirectoryList = item.sonDirectoryList.filter(
+            (item) => item.type == 1
+          );
+          if (item.sonDirectoryList.length > 0) {
+            this.setTree(item.sonDirectoryList);
+          }
+        });
+      },
+      async typeChange(val) {
+        let data = await listParentId({
+          pageNum: 1,
+          size: 100,
+          parentId: val,
+          objId: this.nodeData?.id,
+          objParentId: this.nodeData?.parentId
+        });
+        this.options = data.list.filter((item) => item.type == 2);
+        this.form.businessCodeId = '';
+      },
+
+      fileChange(file) {
+        this.form.name = file.name.replace(/\.[^/.]+$/, '');
+      },
+
+      /* 保存编辑 */
+      save() {
+        this.$refs.form.validate(async (valid) => {
+          if (!valid) {
+            return false;
+          }
+
+          const data = {
+            ...this.form
+          };
+
+          this.loading = true;
+          fileSaveAPI(data)
+            .then((msg) => {
+              this.loading = false;
+
+              this.cancel();
+              this.$emit('done', msg);
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      },
+
+      cancel() {
+        this.form = { ...this.defaultForm, directoryId: this.form.directoryId };
+        this.$refs.form.clearValidate();
+        this.showEditFlag = false;
+      }
+    }
+  };
+</script>
+<style scoped lang="scss">
+  .aaa {
+    width: 100%;
+
+    ::v-deep .upload-demo {
+      width: 100%;
+
+      .el-upload--text {
+        width: 100%;
+
+        button {
+          width: 100%;
+          background: #ffffff;
+          border: 1px solid #dbdbdb;
+          border-radius: 5px;
+        }
+      }
+
+      .el-upload-list {
+        transform: translate(10px, -39px);
+        position: absolute;
+      }
+    }
+  }
+</style>

+ 198 - 0
src/components/addDoc/file-table-listTemplate.vue

@@ -0,0 +1,198 @@
+<template>
+  <div>
+    <!-- 数据表格 -->
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :datasource="datasource"
+      tool-class="ele-toolbar-form"
+      row-key="id"
+      :selection.sync="selection"
+      :toolbar="false"
+    >
+      <!-- 操作列 -->
+      <template v-slot:action="{ row }">
+        <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-edit"
+          @click="browseOpen(row)"
+        >
+          浏览
+        </el-link>
+      </template>
+    </ele-pro-table>
+    <browse ref="browseRef"></browse>
+  </div>
+</template>
+
+<script>
+import { filePageAPI } from './api';
+import browse from './browse.vue';
+
+export default {
+  components: { browse },
+  props: {
+    // 上级
+    parentData: {
+      type: Object,
+      default: () => {}
+    },
+
+    disabledTableList: {
+      //已选择列表
+      default: () => []
+    }
+  },
+
+  data() {
+    return {
+      selection: [],
+      columns: [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          selectable: (row, index) => {
+            return !this.disabledTableList
+              .map((item) => item.id)
+              .includes(row.id);
+          }
+        },
+        {
+          label: '编码',
+          prop: 'code',
+          width: 180,
+          align: 'center',
+          fixed: 'left',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'name',
+          label: '文档名称',
+          align: 'center',
+          slot: 'name',
+          showOverflowTooltip: true,
+          minWidth: 200
+        },
+        {
+          prop: 'storagePath',
+          label: '文件名称',
+          align: 'center',
+
+          showOverflowTooltip: true,
+          minWidth: 200,
+          formatter: (_row, _column, cellValue) => {
+            return cellValue[0]?.name;
+          }
+        },
+        {
+          prop: 'version',
+          label: '版本',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+        {
+          prop: 'checkOutUserName',
+          label: '检出人',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+        {
+          prop: 'checkOutStatus',
+          label: '检出状态',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100,
+          formatter: (_row, _column, cellValue) => {
+            return cellValue == 1 ? '已检出' : '';
+          }
+        },
+        {
+          prop: 'checkOutTime',
+          label: '检出时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 160
+        },
+        {
+          prop: 'createUserName',
+          label: '创建人',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 160,
+          formatter: (_row, _column, cellValue) => {
+            return this.$util.toDateString(cellValue);
+          }
+        },
+        {
+          prop: 'updateUserName',
+          label: '修改人',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+        {
+          prop: 'updateTime',
+          label: '修改时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 160
+        },
+        {
+          prop: 'sizeUnit',
+          label: '文档大小',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 150,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true,
+          fixed: 'right'
+        }
+      ]
+    };
+  },
+  created() {},
+
+  methods: {
+    /* 表格数据源 */
+    datasource({ page, limit, where, order }) {
+      return filePageAPI({
+        ...where,
+        ...order,
+        pageNum: page,
+        size: limit,
+        directoryId: this.parentData?.id
+      });
+    },
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ pageNum: 1, where: where });
+    },
+
+    browseOpen(row) {
+      this.$refs.browseRef.open(row);
+    },
+    getTableList() {
+      return JSON.parse(JSON.stringify(this.selection));
+    }
+  }
+};
+</script>

+ 262 - 0
src/components/addDoc/fileUpload.vue

@@ -0,0 +1,262 @@
+<template>
+  <div class="upload-file">
+    <el-upload
+      class="upload-demo"
+      action="#"
+      v-loading="loading"
+      element-loading-text="上传中"
+      :http-request="handlRequest"
+      :before-remove="beforeRemove"
+      :on-remove="handleRemove"
+      :on-preview="handleItem"
+      :multiple="multiple"
+      :before-upload="beforeUpload"
+      :file-list="fileList"
+      :show-file-list="!showLib"
+      :disabled="disabled"
+    >
+      <!-- <slot>
+        <el-button :disabled="disabled" type="primary" icon="el-icon-plus" size="mini">点击上传</el-button>
+      </slot> -->
+      <el-button
+        slot="trigger"
+        :disabled="disabled"
+        type="primary"
+        icon="el-icon-plus"
+        size="mini"
+        >点击上传</el-button
+      >
+      <slot name="templateBtn"> </slot>
+    </el-upload>
+  </div>
+</template>
+
+<script>
+import {
+  getFileList,
+  getFile,
+  removeFile
+} from '@/api/system/file/index.js';
+import {
+  uploadFileNew,
+} from './api';
+import { getImageUrl, getImagePath } from '@/utils/file';
+export default {
+  props: {
+    value: {
+      type: [Array, String],
+      default: () => []
+    },
+    multiple: {
+      type: Boolean,
+      default: false
+    },
+    // 所属模块
+    module: {
+      type: String,
+      required: true
+    },
+    // 文档库
+    showLib: {
+      type: Boolean,
+      default: false
+    },
+    // 限制数量
+    limit: {
+      type: Number,
+      default: -1
+    },
+    // 限制大小 mb
+    size: {
+      type: Number,
+      default: 1000
+    },
+    disabled: {
+      default: false,
+      type: Boolean
+    }
+  },
+  data() {
+    return {
+      documentVisible: false,
+      selectItem: null,
+      loading: false,
+      documentForm: {
+        name: ''
+      },
+      columns: [
+        {
+          label: '序号',
+          type: 'index',
+          width: 55,
+          align: 'center'
+        },
+        {
+          label: '文档名称',
+          prop: 'name',
+          minWidth: '180',
+          showOverflowTooltip: true
+        },
+        {
+          label: '文档类型',
+          prop: 'type'
+        },
+        {
+          label: '系统'
+        },
+        {
+          label: '储存路径',
+          prop: 'storePath',
+          minWidth: '180',
+          showOverflowTooltip: true
+        },
+        {
+          label: '模块名',
+          prop: 'module'
+        },
+        {
+          label: '上传时间',
+          prop: 'createTime'
+        }
+      ]
+    };
+  },
+  computed: {
+    fileList: {
+      set(val) {
+        // console.log(val);
+        this.$emit(
+          'input',
+          val.map((item) => ({
+            ...item,
+            url: getImagePath(item.url)
+          }))
+        );
+      },
+      get() {
+        // console.log(this.value, 2);
+        if (!Array.isArray(this.value)) return [];
+        const arr =
+          (this.value &&
+            this.value.map((item) => ({
+              ...item,
+              url: getImageUrl(item.url)
+            }))) ||
+          [];
+        return arr;
+      }
+    }
+  },
+
+  methods: {
+    //点击查看图片
+    handleItem(file) {
+      getFile({ objectName: file.storePath }, file.name);
+    },
+    delFileList() {
+      this.$emit('input', []);
+    },
+    handleOpenLib() {
+      this.documentVisible = true;
+      this.$nextTick(() => {
+        this.reload();
+      });
+    },
+    //图文档勾选
+    submitDocument() {
+      this.$emit('input', [
+        { url: this.selectItem.storePath, ...this.selectItem }
+      ]);
+      this.documentVisible = false;
+    },
+    datasource({ page, limit }) {
+      return getFileList({
+        ...this.documentForm,
+        pageNum: page,
+        size: limit
+      });
+    },
+    reload() {
+      this.$refs.table.reload();
+    },
+    beforeRemove(file) {
+      if (file.id) {
+        return removeFile({
+          fileId: file.id
+        }).then(() => {
+          return true;
+        });
+        return true;
+      } else {
+        return true;
+      }
+    },
+    handleRemove(file, fileList) {
+      this.fileList = fileList;
+    },
+    beforeUpload(file) {
+      // if (file.size / 1024 / 1024 > this.size) {
+      //   this.$message.error(`大小不能超过 ${this.size}MB`);
+      //   return false;
+      // }
+
+      if (this.limit > 0 && this.fileList.length === this.limit) {
+        this.$message.error(`最多上传 ${this.limit}个文件`);
+        return false;
+      }
+      this.loading = true;
+      return uploadFileNew({
+        module: this.module,
+        multiPartFile: file
+      })
+        .then((res) => {
+          if (res.data) {
+            this.$emit('input', [
+              ...(this.value || []),
+              { ...file, url: res.data.storePath, ...res.data }
+            ]);
+          }
+          this.$emit('fileChange', res.data);
+          return res.data;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+    handlRequest() {
+      return Promise.resolve();
+    }
+    // onSuccess(response, file, fileList){
+    //   alert(1)
+    //    this.$emit('fileChange',file)
+    // },
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.upload-file {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
+
+  .lib {
+    margin-left: 12px;
+  }
+
+  .imgs-box {
+    margin-left: 10px;
+    flex: 1;
+  }
+  .imgs-box .imgs-p {
+    height: 30px;
+    background: #f0f3f3;
+    line-height: 30px;
+    min-width: 480px;
+    margin-bottom: 5px;
+    padding: 0 10px;
+    display: flex;
+    justify-content: space-between;
+  }
+}
+</style>

+ 162 - 0
src/components/addDoc/getCode.vue

@@ -0,0 +1,162 @@
+<!-- 用户编辑弹窗 -->
+<template>
+  <ele-modal
+    width="500px"
+    :visible.sync="showEditFlag"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    append-to-body
+    @close="cancel"
+    title="申请编码"
+    :maxable="true"
+    :resizable="true"
+  >
+    <el-form ref="form" :model="form" :rules="rules" label-width="82px">
+      <el-row :gutter="15">
+        <el-col :span="24">
+          <el-form-item label="编码分类" prop="type">
+            <ele-tree-select
+              clearable
+              :data="list"
+              v-model="form.type"
+              placeholder="请选择"
+              default-expand-all
+              labelKey="name"
+              childrenKey="sonDirectoryList"
+              valueKey="id"
+              @change="typeChange"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="编码方案" prop="type1">
+            <el-select
+              v-model="form.type1"
+              placeholder="请选择"
+              style="width: 100%"
+              @change="type1Change"
+            >
+              <el-option
+                v-for="item in options"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24">
+          <el-form-item label="编码预览" prop="code">
+            <el-input v-model="form.code" disabled></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <headerTitle title="编码码段"></headerTitle>
+    <template v-slot:footer>
+      <el-button @click="cancel">取消</el-button>
+      <el-button type="primary" @click="save"> 确认 </el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import { selectTreeList, listParentId, getCode } from './api';
+
+  export default {
+    data() {
+      return {
+        rules: {
+          type: [{ required: true, message: '请选择', trigger: 'blur' }],
+          type1: [{ required: true, message: '请选择', trigger: 'blur' }],
+          code: [{ required: true, message: '请申请', trigger: 'blur' }]
+        },
+        list: [],
+        options: [],
+        // 表单数据
+        form: {
+          type: '',
+          code: '',
+          type1: ''
+        },
+
+        showEditFlag: false
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    components: {
+    },
+    created() {},
+    methods: {
+      async open() {
+        this.list = await selectTreeList();
+        this.setTree(this.list);
+        this.showEditFlag = true;
+      },
+      setTree(data) {
+        data.forEach((item) => {
+          item.sonDirectoryList = item.sonDirectoryList.filter(
+            (item) => item.type == 1
+          );
+          if (item.sonDirectoryList.length > 0) {
+            this.setTree(item.sonDirectoryList);
+          }
+        });
+      },
+      async typeChange(val) {
+        let data = await listParentId({
+          pageNum: 1,
+          size: 100,
+          parentId: val
+        });
+        this.options = data.list.filter((item) => item.type == 2);
+        this.form.type1 = '';
+      },
+      async type1Change(val) {
+        this.form.code = await getCode(val);
+      },
+      /* 保存编辑 */
+      save() {
+        this.$emit('success', this.form.code);
+        this.cancel();
+      },
+
+      cancel() {
+        this.form.type = '';
+        this.form.code = '';
+        this.showEditFlag = false;
+      }
+    }
+  };
+</script>
+<style scoped lang="scss">
+  .aaa {
+    width: 100%;
+
+    ::v-deep .upload-demo {
+      width: 100%;
+
+      .el-upload--text {
+        width: 100%;
+
+        button {
+          width: 100%;
+          background: #ffffff;
+          border: 1px solid #dbdbdb;
+          border-radius: 5px;
+        }
+      }
+
+      .el-upload-list {
+        transform: translate(10px, -39px);
+        position: absolute;
+      }
+    }
+  }
+</style>

+ 73 - 0
src/components/addDoc/index.vue

@@ -0,0 +1,73 @@
+<template>
+  <div>
+    <el-badge :value="value.length" class="item">
+      <el-button
+        icon="el-icon-plus"
+        v-if="type != 'view'"
+        type="primary"
+        @click="handleUpload"
+      >
+        上传</el-button
+      >
+      <el-button
+        icon="el-icon-view"
+        v-else
+        type="primary"
+        @click="handleUpload"
+      >
+        查看</el-button
+      >
+    </el-badge>
+
+    <file-upload @success="getFiles" ref="fileUploadRef"></file-upload>
+  </div>
+</template>
+
+<script>
+  import fileUpload from './main.vue';
+
+  export default {
+    name: 'index',
+    components: { fileUpload },
+    model: {
+      prop: 'value',
+      event: 'updateVal'
+    },
+    props: {
+      type: {
+        type: String,
+        default: ''
+      },
+      value: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      }
+    },
+    data() {
+      return {
+        selectVal: ''
+      };
+    },
+    watch: {
+      value: {
+        handler(newVal) {
+          this.selectVal = newVal || [];
+        },
+        immediate: true
+      }
+    },
+    created() {},
+    methods: {
+      handleUpload() {
+        this.$refs.fileUploadRef.open(this.selectVal, this.type);
+      },
+      getFiles(val = []) {
+        this.$emit('updateVal', val);
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss"></style>

+ 218 - 0
src/components/addDoc/main.vue

@@ -0,0 +1,218 @@
+<template>
+  <ele-modal
+    width="60%"
+    :visible.sync="showEditFlag"
+    :close-on-click-modal="false"
+    custom-class="ele-dialog-form"
+    append-to-body
+    ref="Emodal"
+    :maxable="true"
+    :resizable="true"
+  >
+    <!-- 数据表格 -->
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :datasource="tableList"
+      tool-class="ele-toolbar-form"
+      :needPage="false"
+      row-key="id"
+    >
+      <template v-slot:toolbar v-if="type != 'view'">
+        <el-button type="primary" @click="fileEditOpen">本地上传</el-button>
+        <el-button type="primary" @click="fileShow = true">
+          关联文档库
+        </el-button>
+      </template>
+      <!-- 操作列 -->
+      <template v-slot:action="{ row }">
+        <el-link
+          type="primary"
+          :underline="false"
+          icon="el-icon-edit"
+          @click="browseOpen(row)"
+        >
+          浏览
+        </el-link>
+
+        <el-popconfirm
+          v-if="type != 'view'"
+          class="ele-action"
+          title="确定要删除吗?"
+          @confirm="remove(row)"
+        >
+          <template v-slot:reference>
+            <el-link type="danger" :underline="false" icon="el-icon-delete">
+              删除
+            </el-link>
+          </template>
+        </el-popconfirm>
+      </template>
+    </ele-pro-table>
+    <template v-slot:footer>
+      <el-button @click="showEditFlag = false">取消</el-button>
+      <el-button type="primary" @click="addFile" v-if="type != 'view'">
+        确认
+      </el-button>
+    </template>
+    <fileEdit ref="fileEditRef" @done="done"></fileEdit>
+    <ele-modal
+      width="80%"
+      :visible.sync="fileShow"
+      :close-on-click-modal="false"
+      custom-class="ele-dialog-form"
+      append-to-body
+      :maxable="true"
+    :resizable="true"
+    >
+      <doc_template
+        :disabledTableList="tableList"
+        ref="doc_templateRef"
+      ></doc_template>
+      <template v-slot:footer>
+        <el-button @click="fileShow = false">取消</el-button>
+        <el-button type="primary" @click="addTemplate"> 确认 </el-button>
+      </template>
+    </ele-modal>
+    <browse ref="browseRef"></browse>
+  </ele-modal>
+</template>
+
+<script>
+import doc_template from './doc_template.vue';
+import fileEdit from './file-edit.vue';
+import browse from './browse.vue';
+import { queryIds } from './api';
+
+export default {
+  components: { doc_template, fileEdit, browse },
+
+  data() {
+    return {
+      fileId: [],
+      fileShow: false,
+      showEditFlag: false,
+      tableList: [],
+      type: 'add',
+      columns: [
+        {
+          label: '编码',
+          prop: 'code',
+          width: 180,
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'name',
+          label: '文档名称',
+          align: 'center',
+          slot: 'name',
+          showOverflowTooltip: true,
+          minWidth: 200
+        },
+        {
+          prop: 'storagePath',
+          label: '文件名称',
+          align: 'center',
+
+          showOverflowTooltip: true,
+          minWidth: 200,
+          formatter: (_row, _column, cellValue) => {
+            return cellValue && cellValue[0]?.name;
+          }
+        },
+        {
+          prop: 'version',
+          label: '版本',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+
+        {
+          prop: 'createUserName',
+          label: '创建人',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 160
+        },
+
+        {
+          prop: 'sizeUnit',
+          label: '文档大小',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 100
+        },
+
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 200,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ]
+    };
+  },
+  created() {},
+
+  methods: {
+    open(fileId, type) {
+      //查看详情:view 新增:add
+      this.showEditFlag = true;
+      this.fileId = fileId || [];
+      if (type) {
+        this.type = type;
+      }
+      this.init();
+    },
+    fileEditOpen() {
+      this.$refs.fileEditRef.open();
+    },
+    remove(row) {
+      this.tableList = this.tableList.filter((item) => item.code != row.code);
+      this.fileId = this.tableList.map((item) => item.id);
+    },
+    async init() {
+      if (this.fileId.length > 0) {
+        this.tableList = await queryIds({ ids: "'" + this.fileId + "'" });
+      } else {
+        this.tableList = [];
+      }
+    },
+    done(id) {
+      this.fileId.push(...id);
+      this.init();
+    },
+    browseOpen(row) {
+      this.$refs.browseRef.open(row);
+    },
+    addFile() {
+      this.$emit(
+        'success',
+        this.tableList.map((item) => item.id)
+      );
+      this.showEditFlag = false;
+    },
+    addTemplate() {
+      let list = this.$refs.doc_templateRef.getTableList();
+      this.fileShow = false;
+      if (list.length == 0) {
+        this.$message.error('请选择一条数据');
+        return;
+      }
+      this.tableList.push(...list);
+    }
+  }
+};
+</script>

+ 65 - 0
src/components/addDoc/util.js

@@ -0,0 +1,65 @@
+import store from '@/store';
+const userId = store.state.user?.info?.userId
+const userName = store.state.user?.info?.name
+export function isPower(data = {}, power, selection = []) {
+
+    if (power == 'add' && data.userAuthority.length == 0) { //文件夹默认开放新增权限
+        return true
+    }
+    if (!data?.id && selection.length == 0) {
+        return false
+
+    }
+    if (power == 'checkEnter' && data?.checkOutUserId != userId) { //检入特殊处理
+        return false
+    }
+    if (selection.length > 0) { //多选情况处理
+        let isPower = true
+        let userAuthorityS = []
+        let createUserIdS = selection.map(item => item.createUserId).filter(createUserId => createUserId == userId)
+        if (createUserIdS.length == selection.length || userName == 'admin') {
+            return true
+        }
+        selection.forEach(val => {
+            const powerObj = val.userAuthority.find(item => item.id == userId)
+            if (powerObj) {
+                userAuthorityS.push(powerObj)
+            }
+        })
+
+        if (userAuthorityS.length == 0) {
+            isPower = false
+        }
+        userAuthorityS.forEach(item => {
+            if (item[power] != '1') {
+                isPower = false
+            }
+        })
+        return isPower
+    }
+
+    if (data.createUserId == userId || userName == 'admin') { //创建人/admin所有权限
+        return true
+    }
+    if (!power) {
+        return false
+    }
+    const powerObj = data.userAuthority.find(item => item.id == userId)
+    if (powerObj) {
+
+        return powerObj[power] == '1'
+    }
+}
+
+export function setFolderList(data) { //递归过滤文件夹权限
+    data.forEach((item) => {
+        item['disabled'] = !isPower(item, 'add');
+        if (item.sonDirectoryList && item.sonDirectoryList.length > 0) {
+            setFolderList(item.sonDirectoryList);
+        }
+    });
+}
+//新迪预览工具支持的文件格式
+export function getFileType() {
+    return ['par', 'asm', 'psm', 'dft', 'sldprt', 'sldasm', 'ipt', 'iam', 'prt', '3dxml', 'CATPart', 'CATProduct', 'cgr', 'model', 'exp', 'session', 'x_t', 'xmt_txt', 'x_b', 'xmp_bin', 'xmp_txt', 'sat', 'sab', 'igs', 'iges', 'stp', 'step', 'jt', 'xcgm', '3dm', 'stl', 'obj', '3mf', 'fbx', 'vda', 'dxf', 'dwg', 'pdf', 'idf', 'idb', 'emn', 'brd']
+}

+ 4 - 1
src/micro-app.js

@@ -1,4 +1,5 @@
 import store from './store';
+import fileMain from '@/components/addDoc/index.vue';
 
 const microApps = [
   {
@@ -41,7 +42,8 @@ const microApps = [
 
   {
     name: 'eos',
-    entry: '/eos/',
+    // entry: '/qms/',
+    entry: process.env.NODE_ENV == 'development'?'http://localhost:8081/eos/':'/qms/',
     activeRule: '/page-eos'
   },
 
@@ -69,6 +71,7 @@ const apps = microApps.map((item) => {
     props: {
       routerBase: item.activeRule, // 下发基础路由
       // actions
+      fileMain,
       store
     }
   };

+ 45 - 0
src/utils/file.js

@@ -0,0 +1,45 @@
+import { getToken } from './token-util';
+import { TOKEN_HEADER_NAME } from '@/config/setting';
+
+// 获取图片反显url
+export function getImageUrl(path) {
+  return `${sessionStorage.filePath}${path}`;
+  // if (process.env.NODE_ENV === 'development') {
+  //   return `http://192.168.3.51:18086/main/file/getFile?${TOKEN_HEADER_NAME}=${getToken()}&objectName=${path}`;
+  // } else {
+  //   return `${
+  //     sessionStorage.filePath
+  //   }${path}`;
+  // }
+}
+// 从反显url上获取接口需要path
+export function getImagePath(url) {
+  if (!url) {
+    return '';
+  }
+
+  const match = url.match(/&objectName=([\S\s]*)/);
+
+  return (match && match[1].split('&')[0]) || '';
+}
+
+// 下载方法
+
+export function download (data, name) {
+  const a = document.createElement('a');
+  const url = window.URL.createObjectURL(data);
+  const filename = name;
+  a.href = url;
+  a.download = filename;
+  a.click();
+  window.URL.revokeObjectURL(url);
+}
+// 下载方法
+
+export function download1 (url, name) {
+  const a = document.createElement('a');
+  const filename = name;
+  a.href = url;
+  a.download = filename;
+  a.click();
+}

+ 5 - 1
vue.config.js

@@ -18,11 +18,15 @@ module.exports = {
   devServer: {
     // 代理跨域的配置
     port: 9999,
+    headers: {			
+      // 允许跨域访问子应用页面
+      'Access-Control-Allow-Origin': '*',
+    },
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://124.71.68.31:50001',
-        target: 'http://192.168.1.251:18086',
+        target: 'http://192.168.1.105:18086',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {