yusheng 10 bulan lalu
induk
melakukan
6f8774f6da

+ 22 - 15
src/components/addDoc/api/index.js

@@ -13,9 +13,9 @@ export async function getDocTreeListAPI(data) {
 }
 
 /**
-* 查询文件数据
-* @data data
-*/
+ * 查询文件数据
+ * @data data
+ */
 export async function filePageAPI(data) {
   const res = await request.post('/fm/file/pageBusiness', data);
   if (res.data.code == 0) {
@@ -51,7 +51,7 @@ export async function fileGetByIdAPI(id) {
  * ids查询文件列表
  * @data data
  */
- export async function queryIds(data) {
+export async function queryIds(data) {
   const res = await request.post('/fm/file/queryIds', data);
   if (res.data.code == 0) {
     return res.data.data;
@@ -59,12 +59,12 @@ export async function fileGetByIdAPI(id) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
-
 // 获取编码树
 export async function selectTreeList(data) {
-  const res = await request.post(`/main/business_code_category/selectTreeList`, data);
+  const res = await request.post(
+    `/main/business_code_category/selectTreeList`,
+    data
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -72,7 +72,10 @@ export async function selectTreeList(data) {
 }
 // 获取右侧列表
 export async function listParentId(data) {
-  const res = await request.post(`/main/business_code_category/listPageParentId`, data);
+  const res = await request.post(
+    `/main/business_code_category/listPageParentId`,
+    data
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -87,10 +90,11 @@ export async function pageSegment(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);
+  const res = await request.get(
+    `/main/business_code_category/applyForCode/` + id
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -101,7 +105,7 @@ export async function getCode(id) {
  * 上传文件
  * @param file 文件
  */
- export async function uploadFileNew (data) {
+export async function uploadFileNew(data) {
   const formData = new FormData();
   formData.append('multiPartFile', data.multiPartFile);
   formData.append('module', data.module);
@@ -112,11 +116,14 @@ export async function getCode(id) {
   return Promise.reject(new Error(res.data.message));
 }
 // 编码方案
-export async function listCode(code) {
-  const res = await request.get(`/main/business_code_category/listCode/`+code);
+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));
 }
-

+ 2 - 1
src/components/addDoc/doc_template.vue

@@ -11,7 +11,8 @@
           <ele-toolbar class="ele-toolbar-actions">
             <div style="margin: 5px 0"> </div>
           </ele-toolbar>
-          <div class="ele-border-lighter sys-organization-list">
+             
+          <div class="ele-border-lighter sys-organization-list"  style="height: 65vh">
             <el-tree
               ref="tree"
               :data="data"

+ 19 - 12
src/components/addDoc/file-edit.vue

@@ -161,7 +161,7 @@
         showEditFlag: false,
         title: '',
         type: '新建附件',
-        nodeDataCode: ''
+        nodeData: {}
       };
     },
     computed: {
@@ -183,26 +183,32 @@
       async getTreeCode() {
         let nodeData = {};
         await this.$nextTick(() => {
-          nodeData = this.$refs.cascaderRef.getCheckedNodes();
+          // console.log(this.$refs,'this.$refs')
+          nodeData = this.$refs.cascaderRef&&this.$refs.cascaderRef.getCheckedNodes();
         });
-        this.nodeDataCode = nodeData[0]?.data?.code;
+        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.nodeDataCode
-          ? await listCode(this.nodeDataCode)
-          : [];
+        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=''
+          this.form.codeType = this.options[0].parentId;
+        } else {
+          this.form.businessCodeId = '';
         }
       },
       async open() {
         this.showEditFlag = true;
-        this.list = await selectTreeList();
-        await this.initFileCode();
-        this.setTree(this.list);
+        this.$nextTick(async () => {
+          this.list = await selectTreeList();
+          await this.initFileCode();
+          this.setTree(this.list);
+        });
       },
 
       setTree(data) {
@@ -220,7 +226,8 @@
           pageNum: 1,
           size: 100,
           parentId: val,
-          code: this.nodeDataCode
+          objId: this.nodeData?.id,
+          objParentId: this.nodeData?.parentId
         });
         this.options = data.list.filter((item) => item.type == 2);
         this.form.businessCodeId = '';

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

@@ -6,7 +6,6 @@
       :columns="columns"
       :datasource="datasource"
       tool-class="ele-toolbar-form"
-      :needPage="false"
       row-key="id"
       :selection.sync="selection"
       :toolbar="false"

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

@@ -63,7 +63,6 @@
 
 <script>
   import { selectTreeList, listParentId, getCode } from './api';
-  import headerTitle from '@/components/header-title/index.vue';
 
   export default {
     data() {
@@ -92,7 +91,6 @@
       }
     },
     components: {
-      headerTitle
     },
     created() {},
     methods: {

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

@@ -6,6 +6,7 @@
         v-if="type != 'view'"
         type="primary"
         @click="handleUpload"
+        :size="size"
       >
         上传</el-button
       >
@@ -43,6 +44,10 @@
         default: () => {
           return [];
         }
+      },
+      size: {
+        type: String,
+        default: 'mini'
       }
     },
     data() {

+ 2 - 2
src/components/addDoc/util.js

@@ -1,6 +1,6 @@
 import store from '@/store';
-const userId = store.state.user.info.userId
-const userName = store.state.user.info.name
+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) { //文件夹默认开放新增权限

+ 4 - 2
src/main.js

@@ -24,12 +24,14 @@ import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';
 import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css';
 import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css';
 import seekPage from '@/components/seekPage';
+import fileMain from '@/components/addDoc/index.vue';
 
 // // register globally
 import '@/icons';
 Vue.component('seekPage', seekPage);
 
 Vue.component('DictSelection', DictSelection);
+  Vue.component('fileMain', fileMain);
 Vue.config.productionTip = false;
 
 Vue.use(EleAdmin, {
@@ -46,8 +48,8 @@ Vue.use(VueClipboard);
 let instance = null;
 
 function render(props = {}) {
-  const { container, routerBase, fileMain } = props;
-  Vue.component('fileMain', fileMain);
+  const { container, routerBase } = props;
+
   // const router = new VueRouter({
   //   base: window.__POWERED_BY_QIANKUN__ ? routerBase : process.env.BASE_URL,
   //   mode: 'history',