Browse Source

1. 台账分解,上传附件问题
2. 导入大司空数据,新增浙江编号
3. 导入大司空数据,识别文件类别

MaiXinRong 5 months ago
parent
commit
11dc69f0fa
5 changed files with 80 additions and 25 deletions
  1. 2 1
      app/lib/dsk.js
  2. 25 3
      app/public/js/shares/dsk.js
  3. 27 0
      app/service/project_account.js
  4. 20 21
      app/view/ledger/explode_modal.ejs
  5. 6 0
      config/menu.js

+ 2 - 1
app/lib/dsk.js

@@ -71,10 +71,11 @@ class DSK {
     }
 
     async getCompilation() {
+        const validName = ['全国公路(2018)', '广东公路(2018)', '浙江公路(2025)'];
         const url = this.url + 'api/compilation/external/list';
         const postData = {};
         const result = this.dealWith(await this.ctx.helper.sendRequest(url, postData, 'GET', 'json', true));
-        return result.filter(item => { return item.type === 'highway' && (item.name === '全国公路(2018)' || item.name === '广东公路(2018)'); });
+        return result.filter(item => { return item.type === 'highway' && validName.indexOf(item.name) >= 0; });
     }
 
     async getProjectList(mobile, compilationId) {

+ 25 - 3
app/public/js/shares/dsk.js

@@ -7,6 +7,24 @@ const dsk = (function () {
         { key: 'item', value: 3, name: '单项工程' },
         { key: 'unit', value: 4, name: '单位工程' },
     ];
+    const DefaultFileType = [
+        { key: 'submission', value: 1, name: '投标' },
+        { key: 'invitation', value: 2, name: '招标/预算' },
+        { key: 'control', value: 3, name: '控制价' },
+        { key: 'change_budget', value: 4, name: '变更预算' },
+        { key: 'estimate', value: 5, name: '概算' },
+        { key: 'settlement', value: 10, name: '结算' },
+        { key: 'gusuan', value: 15, name: '估算(可行性估算)' },
+        { key: 'suggest_gusuan', value: 16, name: '建议估算' },
+        { key: 'three_bill_budget', value: 18, name: '三级清单预算' },
+        { key: 'bills_budget', value: 19, name: '清单预算' },
+    ];
+    // todo 每个编办下,文件类型对应的值不同,待需求整理数据
+    const CompilationFileType = [
+        { compliationId: '5de61133d46f6f000d15d347', name: '全国公路(2018)', fileType: DefaultFileType },
+        { compliationId: '63f31fe113566500140e4902', name: '广东公路(2018)', fileType: DefaultFileType },
+        { compliationId: '66b1f3f6ad66620013c13883', name: '浙江公路(2025)', fileType: DefaultFileType },
+    ];
     const projectTypeKey = (function(arr) {
         const result = {};
         for (const a of arr) {
@@ -147,8 +165,11 @@ const dsk = (function () {
                 if (data.type === projectTypeKey.project) {
                     cur = parent;
                 } else {
+                    console.log(data);
                     const type = projectType.find(x => { return x.value === data.type; });
-                    const node = { type: type.value, type_str: type.name, dsk_id: data.ID, name: data.name, project_id: project.ID, compilation_id: compilation.ID };
+                    const FileType = CompilationFileType.find(x => { return x.compliationId === compilation.ID; }) || DefaultFileType;
+                    const pftype = data.property && data.property.file_type ? FileType.find(x => { return x.value === data.file_type; }) : null;
+                    const node = { type: type.value, type_str: type.name, file_type_str: pftype ? pftype.name : '', dsk_id: data.ID, name: data.name, project_id: project.ID, compilation_id: compilation.ID };
                     cur = subjectTree.addNode(node, parent);
                 }
                 if (data.children) {
@@ -235,8 +256,9 @@ const dsk = (function () {
             SpreadJsObj.initSheet(this.subjectSheet, {
                 cols: [
                     {title: '选择', field: 'selected', hAlign: 1, width: 60, formatter: '@', cellType: 'checkbox'},
-                    {title: '项目/分段名称', field: 'name', hAlign: 0, width: 740, formatter: '@', cellType: 'tree'},
-                    {title: '类型', field: 'type_str', hAlign: 0, width: 80, formatter: '@' },
+                    {title: '项目/分段名称', field: 'name', hAlign: 0, width: 660, formatter: '@', cellType: 'tree'},
+                    {title: '项目类型', field: 'file_type_str', hAlign: 1, width: 80, formatter: '@' },
+                    {title: '类型', field: 'type_str', hAlign: 1, width: 80, formatter: '@' },
                 ],
                 emptyRows: 0,
                 headRows: 1,

+ 27 - 0
app/service/project_account.js

@@ -1044,6 +1044,33 @@ module.exports = app => {
             const sql = `SELECT ${columnsSql} FROM ${this.ctx.service.subProjPermission.tableName} spp LEFT JOIN ${this.tableName} pa ON spp.uid = pa.id WHERE spp.spid = ? and pa.enable = 1`;
             return await this.db.query(sql, [subProject.id]);
         }
+
+        _getFilterSql(filter, tableName) {
+            const rstFilter = [];
+            for (const prop in filter) {
+                if (!filter[prop]) continue;
+                rstFilter.push(this.db.format(`${tableName}.${prop} = ?`, [filter[prop]]));
+            }
+            return rstFilter.join(' AND ');
+        }
+
+        async getSubProjectAccountCount(subProject, filter) {
+            filter.spid = subProject.id;
+            const filterSql = this._getFilterSql(filter, 'pa');
+            const sql = `SELECT count(pa.id) as count FROM FROM ${this.ctx.service.subProjPermission.tableName} spp LEFT JOIN ${this.tableName} pa ON spp.uid = pa.id WHERE ` + filterSql;
+            const result = await this.db.queryOne(sql);
+            return result.count;
+        }
+
+        async getSubProjectAccountListWithPermission(subProject, filter) {
+            filter.spid = subProject.id;
+            const filterSql = this._getFilterSql(filter, 'pa');
+            const limit = this.ctx.pageSize ? this.ctx.pageSize : this.app.config.pageSize;
+            const offset = this.sqlBuilder.limit * (this.ctx.page - 1);
+            const sql = `SELECT pa.*, spp.file_permission, budget_permission as count FROM FROM ${this.ctx.service.subProjPermission.tableName} spp LEFT JOIN ${this.tableName} pa ON spp.uid = pa.id WHERE ` + filterSql + ' ORDER BY pa.id ASC LIMIT ?, ?';
+            const result = await this.db.query(sql, [limit, offset]);
+            return result;
+        }
     }
 
     return ProjectAccount;

+ 20 - 21
app/view/ledger/explode_modal.ejs

@@ -257,6 +257,26 @@
     </div>
 </div>
 <% } %>
+<!--上传附件-->
+<div class="modal fade" id="upload" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">上传附件</h5>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <label for="formGroupExampleInput">单个文件大小限制:30MB,支持<span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="doc,docx,xls,xlsx,ppt,pptx,pdf">office等文档格式</span>、<span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="jpg,png,bmp">图片格式</span>、<span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="rar,zip">压缩包格式</span></label>
+                    <input type="file" class="" id="upload-file" multiple>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
+                <button type="button" class="btn btn-primary btn-sm" id="upload-file-btn">确认</button>
+            </div>
+        </div>
+    </div>
+</div>
 <% if ((tender.ledger_status !== auditConst.status.uncheck) || (tender.ledger_times > 1)) { %>
 <!--审批流程/结果-->
 <div class="modal fade" id="sp-list" data-backdrop="static">
@@ -434,27 +454,6 @@
         </div>
     </div>
 </div>
-
-<!--上传附件-->
-<div class="modal fade" id="upload" data-backdrop="static">
-    <div class="modal-dialog" role="document">
-        <div class="modal-content">
-            <div class="modal-header">
-                <h5 class="modal-title">上传附件</h5>
-            </div>
-            <div class="modal-body">
-                <div class="form-group">
-                    <label for="formGroupExampleInput">单个文件大小限制:30MB,支持<span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="doc,docx,xls,xlsx,ppt,pptx,pdf">office等文档格式</span>、<span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="jpg,png,bmp">图片格式</span>、<span data-toggle="tooltip" data-placement="bottom" title="" data-original-title="rar,zip">压缩包格式</span></label>
-                    <input type="file" class="" id="upload-file" multiple>
-                </div>
-            </div>
-            <div class="modal-footer">
-                <button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">关闭</button>
-                <button type="button" class="btn btn-primary btn-sm" id="upload-file-btn">确认</button>
-            </div>
-        </div>
-    </div>
-</div>
 <% if (ctx.session.sessionProject.page_show.openContractExpr) { %>
 <div class="modal fade" id="contract_expr" data-backdrop="static">
     <div class="modal-dialog modal-xl" role="document">

+ 6 - 0
config/menu.js

@@ -409,6 +409,12 @@ const projectSettingMenu = {
         url: '/setting/category',
         caption: '标段自定义类别',
     },
+    user: {
+        name: '账号设置',
+        display: true,
+        url: '/setting/user',
+        caption: '账号设置',
+    },
     fun: {
         name: '功能设置',
         display: true,