Przeglądaj źródła

新增清单调整

ellisran 1 rok temu
rodzic
commit
86f96199c0
1 zmienionych plików z 45 dodań i 9 usunięć
  1. 45 9
      app/public/js/change_revise.js

+ 45 - 9
app/public/js/change_revise.js

@@ -2591,10 +2591,10 @@ $(document).ready(() => {
     const jlzfBills = new Jlzf('#jlzf-spread', {
         cols: [
             // {title: '项目节编号', field: 'code', hAlign: 0, width: 85, formatter: '@'},
-            {title: '清单编号', field: 'b_code', hAlign: 0, width: 85, formatter: '@'},
-            {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@'},
-            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
-            {title: '单价', field: 'unit_price', hAlign: 2, width: 50},
+            {title: '清单编号', field: 'b_code', hAlign: 0, width: 127, formatter: '@'},
+            {title: '名称', field: 'name', hAlign: 0, width: 225, formatter: '@'},
+            {title: '单位', field: 'unit', hAlign: 1, width: 75, formatter: '@'},
+            {title: '单价', field: 'unit_price', hAlign: 2, width: 75},
         ],
         emptyRows: 0,
         headRows: 1,
@@ -2626,6 +2626,19 @@ $(document).ready(() => {
             };
             this.obj.html(
                 '<div class="sjs-bar d-flex">\n' +
+                '    <div class="dropdown mr-1">\n' +
+                '        <button class="btn btn-sm btn-light dropdown-toggle text-primary" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">\n' +
+                '             <i class="fa fa-list-ol"></i> 显示层级\n' +
+                '        </button>\n' +
+                '        <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">\n' +
+                `            <a class="dropdown-item" href="javascript: void(0);" tag="1" name="${relaSelect.showLevel}">第一层</a>\n` +
+                `            <a class="dropdown-item" href="javascript: void(0);" tag="2" name="${relaSelect.showLevel}">第二层</a>\n` +
+                `            <a class="dropdown-item" href="javascript: void(0);" tag="3" name="${relaSelect.showLevel}">第三层</a>\n` +
+                `            <a class="dropdown-item" href="javascript: void(0);" tag="4" name="${relaSelect.showLevel}">第四层</a>\n` +
+                `            <a class="dropdown-item" href="javascript: void(0);" tag="5" name="${relaSelect.showLevel}">第五层</a>\n` +
+                `            <a class="dropdown-item" href="javascript: void(0);" tag="last" name="${relaSelect.showLevel}">最底层</a>\n` +
+                '        </div>\n' +
+                '    </div>' +
                 `    <div class="input-group input-group-sm pr-1"><select class="form-control form-control-sm col-auto" id="change-dsk-project">${dskProjectHtml.join('')}</select></div>\n` +
                 `    <div class="input-group input-group-sm pr-1"><select class="form-control form-control-sm col-auto" id="change-dsk-project-tree"></select></div>\n` +
                 '    <div class="ml-1">\n' +
@@ -2665,6 +2678,29 @@ $(document).ready(() => {
             this.spread = SpreadJsObj.createNewSpread($(`#cb-${spreadSetting.stdType}-spread`)[0]);
             const searchSheet = this.spread.getActiveSheet();
             SpreadJsObj.initSheet(searchSheet, this.spreadSetting);
+            (function (select, sheet) {
+                $(select).click(function () {
+                    if (!sheet.zh_tree) return;
+                    const tag = $(this).attr('tag');
+                    const tree = sheet.zh_tree;
+                    setTimeout(() => {
+                        switch (tag) {
+                            case "1":
+                            case "2":
+                            case "3":
+                            case "4":
+                            case "5":
+                                tree.expandByLevel(parseInt(tag));
+                                SpreadJsObj.refreshTreeRowVisible(sheet);
+                                break;
+                            case "last":
+                                tree.expandByCustom(() => { return true; });
+                                SpreadJsObj.refreshTreeRowVisible(sheet);
+                                break;
+                        }
+                    }, 100);
+                });
+            })(`a[name=${relaSelect.showLevel}]`, searchSheet);
             if (!readOnly) {
                 this.spread.bind(spreadNS.Events.CellDoubleClick, function (e, info) {
                     const dealSheet = info.sheet;
@@ -2830,11 +2866,11 @@ $(document).ready(() => {
     }
     const dskBills = new Dsk('#dsk-spread', {
         cols: [
-            {title: '编号', field: 'code', hAlign: 0, width: 150, formatter: '@', cellType: 'tree'},
-            {title: '名称', field: 'name', hAlign: 0, width: 100, formatter: '@'},
-            {title: '单位', field: 'unit', hAlign: 1, width: 50, formatter: '@'},
-            {title: '单价', field: 'unitPrice', hAlign: 2, width: 80, formatter: '@'},
-            {title: '数量', field: 'quantity', hAlign: 2, width: 80, formatter: '@'},
+            {title: '编号', field: 'code', hAlign: 0, width: 225, formatter: '@', cellType: 'tree'},
+            {title: '名称', field: 'name', hAlign: 0, width: 150, formatter: '@'},
+            {title: '单位', field: 'unit', hAlign: 1, width: 75, formatter: '@'},
+            {title: '单价', field: 'unitPrice', hAlign: 2, width: 120, formatter: '@'},
+            {title: '数量', field: 'quantity', hAlign: 2, width: 120, formatter: '@'},
         ],
         emptyRows: 0,
         headRows: 1,