Browse Source

feat: 清单库增加清单类型列

vian 1 năm trước cách đây
mục cha
commit
9c84994629

+ 1 - 1
modules/all_models/stdBills_bills.js

@@ -26,7 +26,7 @@ const stdBills_bills = new Schema({
     quantityIndexType: String,//工程量指标类别
     quantityIndexUnit: String,//工程量指标单位
     quantityIndexCoe: Number,//单位转换系数
-
+    kind: Number, // 清单类型
     deleted: Boolean
 },
     { versionKey: false }

+ 26 - 1
web/maintain/bills_lib/html/qingdan.html

@@ -368,6 +368,8 @@
     codeEditor.setSize('auto','350px');
     autoFlashHeight();
     let BillsFixedFlagList = JSON.parse('<%- BillsFixedFlagList %>');
+    // 清单类型下拉
+    const kindList = [{ name: '分部', value: 2 }, { name: '清单', value: 3 }];
     let userAccount = '<%= userAccount %>';
     let maxJobsNumber;
     let maxItemsNumber;
@@ -478,6 +480,11 @@
         sheet.resumeEvent();
     }
 
+    // 获取清单类型名称
+    function getKindName(kind) {
+        return (kindList.find(item => item.value === kind))?.name || '';
+    }
+
     function showBillsSheet(datas, jobsSheet, itemsSheet, setting) {
         billsSpread = new GC.Spread.Sheets.Workbook($('#spreadBills')[0], {sheetCount: 1});
         let billsSheet = billsSpread.getSheet(0);
@@ -493,6 +500,9 @@
                     data.fixedFlag = findData.name;
                 }
             }
+            if (data.kind) {
+                data.kind = getKindName(data.kind);
+            }
         }
         billsTree.loadDatas(datas);
         let controller = TREE_SHEET_CONTROLLER.createNew(billsTree.tree, billsSpread.getActiveSheet(), setting);
@@ -532,6 +542,10 @@
         let nameList = BillsFixedFlagList.map((data) => data.name);
         let comboCol = setting.cols.findIndex((data) => data.data.field === 'fixedFlag');
         setCombo(billsSheet, comboCol, nameList);
+        // 设置清单类型下拉
+        let kindComboList = kindList.map((data) => data.name);
+        let kindCol = setting.cols.findIndex((data) => data.data.field === 'kind');
+        setCombo(billsSheet, kindCol, kindComboList);
     }
 
     function switchFcs(controller, billsSheet, billsSpread, jobsSheet, itemsSheet){
@@ -836,6 +850,7 @@
                     sheet.setValue(i, 3, sheetBillsDatas.datasIdx['rowIdx'+ i].ruleText);
                     // sheet.setValue(i, 4, sheetBillsDatas.datasIdx['rowIdx'+ i].engineering);
                     sheet.setValue(i, 9, sheetBillsDatas.datasIdx['rowIdx'+ i].fixedFlag);
+                    sheet.setValue(i, 10, sheetBillsDatas.datasIdx['rowIdx'+ i].kind);
                 }
                 else {
                     sheet.clear(i, 0, 1, sheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport,GC.Spread.Sheets.StorageType.data);
@@ -872,6 +887,11 @@
                     if (findData) {
                         value = findData.value;
                     }
+                } else if (field === 'kind') {
+                    const findData = kindList.find((x) => x.name === value);
+                    if (findData) {
+                        value = findData.value;
+                    }
                 }
                 curData[field] = value;
             });
@@ -884,7 +904,12 @@
                         const findData = BillsFixedFlagList.find((x) => x.value === value);
                         if (findData) {
                         value = findData.name;
-                    }
+                        }
+                    } else if (field === 'kind') {
+                        const findData = kindList.find((x) => x.value === value);
+                        if (findData) {
+                        value = findData.name;
+                        }
                     }
                     node.data[field] = value;
                     sheetBillsDatas.datasIdx['rowIdx' + row][field] = value;

+ 5 - 0
web/maintain/bills_lib/scripts/bills_lib_ajax.js

@@ -322,6 +322,11 @@ var billsAjax = {
             if (findData) {
                 data = findData.value;
             }
+        } else if (field === 'kind') {
+            let findData = kindList.find((x) => x.name === data);
+            if (findData) {
+                data = findData.value;
+            }
         }
         $.ajax({
             type: 'post',

+ 17 - 0
web/maintain/bills_lib/scripts/bills_lib_setting.js

@@ -172,6 +172,23 @@ var billsLibSetting = {
                 font: 'Arial'
             },
             width: 100
+        },
+        {
+            head: {
+                titleNames: ['类型'],
+                spanCols: [1],
+                spanRows: [2],
+                vAlign: [1, 1],
+                hAlign: [1, 1],
+                font: ' Arial'
+            },
+            data: {
+                field: 'kind',
+                vAlign: 1,
+                hAlign: 1,
+                font: 'Arial'
+            },
+            width: 100
         }
     ],
     headRows: 1,

+ 9 - 4
web/maintain/bills_lib/scripts/db_controller.js

@@ -701,8 +701,12 @@ var tools = {
                         if (findData) {
                             validData[setting.cols[j].data.field] = findData.value;
                         }
-                    }
-                    else {
+                    } else if (setting.cols[j].data.field === 'kind') {
+                        let findData = kindList.find((x) => x.name === value);
+                        if (findData) {
+                            validData[setting.cols[j].data.field] = findData.value;
+                        }
+                    } else {
                         validData[setting.cols[j].data.field] = value;
                     }
                 }
@@ -1019,8 +1023,9 @@ var tools = {
             for (let i = 0; i < controller.tree.items.length; i++) {
                 let code = sheet.getValue(i, 0), name = sheet.getValue(i, 1),
                     unit = sheet.getValue(i, 2), ruleText = sheet.getValue(i, 3),
-                    fixedFlag = sheet.getValue(i, 9);
-                let data = { code: code, name: name, unit: unit, ruleText: ruleText, fixedFlag, rowIdx: i };
+                    fixedFlag = sheet.getValue(i, 9),
+                    kind = sheet.getValue(i, 10);
+                let data = { code: code, name: name, unit: unit, ruleText: ruleText, fixedFlag, kind, rowIdx: i };
                 sheetDatas.datas.push(data);
                 sheetDatas.datasIdx['rowIdx' + i] = data;
             }