Преглед на файлове

资料归集,设置权限相关

MaiXinRong преди 1 година
родител
ревизия
00cbcb0b17
променени са 1 файла, в които са добавени 8 реда и са изтрити 3 реда
  1. 8 3
      app/service/sub_project.js

+ 8 - 3
app/service/sub_project.js

@@ -369,7 +369,14 @@ module.exports = app => {
             const users = await this.ctx.service.projectAccount.getAllDataByCondition({ where: { project_id: subProject.project_id, company: data.management }});
             const orgMember = await this.ctx.service.subProjPermission.getAllDataByCondition({ where: { spid: subProject.id } });
             const dm = [], um = [], im = [];
-            const filing_type = this.ctx.service.filing.allFilingType.join(','), file_permission = '1,2';
+
+            const template = await this.ctx.service.filingTemplateList.getDataById(data.filingTemplate);
+            if (!template) throw '选择的文件类别不存在';
+
+            const templateFiling = await this.ctx.service.filingTemplate.getAllDataByCondition({
+                where: { temp_id: template.id, tree_level: 1 },
+            });
+            const filing_type = templateFiling.map(x => { return x.filing_type; }).join(','), file_permission = '1,2';
             for (const u of users) {
                 const nm = orgMember.find(x => { return u.id === x.uid; });
                 if (nm) {
@@ -378,8 +385,6 @@ module.exports = app => {
                     im.push({ id: this.uuid.v4(), spid: subProject.id, pid: subProject.project_id, uid: u.id, file_permission, filing_type });
                 }
             }
-            const template = await this.ctx.service.filingTemplateList.getDataById(data.filingTemplate);
-            if (!template) throw '选择的文件类别不存在';
 
             const conn = await this.db.beginTransaction();
             try {