Ver código fonte

阶段进度,参考文件

MaiXinRong 5 meses atrás
pai
commit
71ee68b1eb

+ 1 - 1
app/controller/sub_proj_controller.js

@@ -247,7 +247,7 @@ module.exports = app => {
 
         async progress(ctx) {
             try {
-                const fileReferenceList = await ctx.service.subProject.getFileReference(ctx.subProject, ctx.service.subProject.FileReferenceType.file);
+                const fileReferenceList = await ctx.service.subProject.getFileReference(ctx.subProject, ctx.service.subProject.FileReferenceType.info_progress);
                 const renderData = {
                     jsFiles: this.app.jsFiles.common.concat(this.app.jsFiles.subProject.progress),
                     fileReferenceList,

+ 40 - 24
app/public/js/sp_progress.js

@@ -1,31 +1,8 @@
-const showSideTools = function (show) {
-    const left = $('#left-view'), right = $('#right-view'), parent = left.parent();
-    if (show) {
-        right.show();
-        autoFlashHeight();
-        /**
-         * right.show()后, parent被撑开成2倍left.height, 导致parent.width减少了10px
-         * 第一次left.width调整后,parent的缩回left.height, 此时parent.width又增加了10px
-         * 故需要通过最终的parent.width再计算一次left.width
-         *
-         * Q: 为什么不通过先计算left.width的宽度,以避免计算两次left.width?
-         * A: 右侧工具栏不一定显示,当右侧工具栏显示过一次后,就必须使用parent和right来计算left.width
-         *
-         */
-            //left.css('width', parent.width() - right.outerWidth());
-            //left.css('width', parent.width() - right.outerWidth());
-        const percent = 100 - right.outerWidth() /parent.width() * 100;
-        left.css('width', percent + '%');
-    } else {
-        left.width(parent.width());
-        right.hide();
-    }
-};
 const progressCombo = [{ text: '', value: '' }, { text: '进行中', value: '进行中' }, { text: '已完成', value: '已完成' }];
 
 $(document).ready(() => {
     autoFlashHeight();
-    let datepicker;
+    let datepicker, fileReference;
 
     class ProgressObj {
         constructor() {
@@ -547,6 +524,44 @@ $(document).ready(() => {
             tabPanel.addClass('active');
             // $('.tab-content .tab-pane').removeClass('active');
             showSideTools(tab.hasClass('active'));
+            if (tab.attr('content') === '#reference') {
+                if (!fileReference) {
+                    fileReference = $.stdLib({
+                        selector: '#reference',
+                        stdType: 'reference',
+                        libs: fileReferenceList,
+                        treeSetting: {
+                            id: 'template_id',
+                            pid: 'pid',
+                            order: 'order',
+                            level: 'level',
+                            rootId: -1,
+                            keys: ['id', 'list_id', 'template_id'],
+                        },
+                        spreadSetting: {
+                            cols: [
+                                {title: '名称', field: 'name', hAlign: 0, width: 420, formatter: '@', cellType: 'tree', wordWrap: true},
+                                {title: '备注', field: 'remark', hAlign: 1, width: 150, formatter: '@'}
+                            ],
+                            emptyRows: 0,
+                            headRows: 1,
+                            headRowHeight: [32],
+                            defaultRowHeight: 21,
+                            headerFont: '12px 微软雅黑',
+                            font: '12px 微软雅黑',
+                            headColWidth: [30],
+                            selectedBackColor: '#fffacd',
+                            readOnly: true,
+                            localCache: {
+                                key: 'info_progress_reference',
+                                colWidth: true,
+                            },
+                        },
+                        page: 'ledger',
+                    });
+                }
+                fileReference.spread.refresh();
+            }
         } else { // 收起工具栏
             tab.removeClass('active');
             tabPanel.removeClass('active');
@@ -569,6 +584,7 @@ $(document).ready(() => {
         select: '#right-spr',
         callback: function () {
             progressObj.spread.refresh();
+            if (fileReference) fileReference.spread.refresh();
         }
     });
     // 导航Menu

+ 9 - 1
app/view/sub_proj/progress.ejs

@@ -89,6 +89,8 @@
                             </div>
                         </div>
                     </div>
+                    <div id="reference" class="tab-pane tab-select-show">
+                    </div>
                 </div>
             </div>
         </div>
@@ -98,10 +100,16 @@
                 <li class="nav-item">
                     <a class="nav-link" content="#fujian" href="javascript: void(0);">附件</a>
                 </li>
+                <li>
+                    <a class="nav-link" content="#reference" href="javascript: void(0);">参考文件</a>
+                </li>
             </ul>
         </div>
     </div>
     <div style="display: none">
         <img src="/public/images/ellipsis_horizontal.png" id="ellipsis-icon" />
     </div>
-</div>
+</div>
+<script>
+    const fileReferenceList = JSON.parse('<%- JSON.stringify(fileReferenceList) %>');
+</script>

+ 1 - 0
config/web.js

@@ -1241,6 +1241,7 @@ const JsFiles = {
                     '/public/js/spreadjs_rela/spreadjs_zh.js',
                     '/public/js/shares/tools_att.js',
                     '/public/js/shares/ali_oss.js',
+                    '/public/js/shares/cs_tools.js',
                     '/public/js/sub_menu.js',
                     '/public/js/sp_progress.js',
                 ],