소스 검색

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/YangHuOperation

TonyKang 6 년 전
부모
커밋
110d4c2703

+ 2 - 0
modules/all_models/project_feature_lib.js

@@ -12,6 +12,8 @@ const project_feature_lib = new Schema({
         createDate: Number,
         recentOpr: [oprSchema],
         name: String,
+        compilationId: String,
+        compilationName: String,
         feature:{
             type: [Schema.Types.Mixed],
             default: []

+ 4 - 1
modules/all_models/stdRation_ration.js

@@ -19,7 +19,10 @@ const rationAssItemSchema = new Schema({
     decimal: Number,
     carryBit: String,
     minValue: String,
-    maxValue: String
+    maxValue: String,
+    paramName:String,//参数名称
+    param:String,//参数
+    thirdRationCode:String//第三定额
 }, { _id: false });
 
 //定额安装增加费用

+ 13 - 1
modules/project_feature_lib/controllers/project_feature_controller.js

@@ -4,15 +4,27 @@
 import BaseController from "../../common/base/base_controller";
 import featureFacade from "../facade/project_feature_facade";
 let config = require("../../../config/config.js");
+import CompilationModel from '../../users/models/compilation_model';
 
 class FeatureController extends BaseController{
     async main(request, response) {
-        let featureLibs = await featureFacade.findByCondition({},{feature:0},false);
+        let compilationModel = new CompilationModel();
+        let compilationList = await compilationModel.getCompilationList({_id: 1, name: 1});
+        compilationList.unshift({_id: 'all', name: '所有'});
+        let activeCompilation = compilationList.find(compilation => compilation._id.toString() === request.query.filter);
+        if (activeCompilation) {
+            activeCompilation.active = 'active';
+        } else {
+            compilationList[0].active = 'active'
+        }
+        let filter = request.query.filter ? {compilationId: request.query.filter} : {};
+        let featureLibs = await featureFacade.findByCondition(filter,{feature:0},false);
         let randerData = {
             title:'工程特征库',
             userAccount: request.session.managerData.username,
             userID: request.session.managerData.userID,
             featureLibs:featureLibs,
+            compilationList: compilationList,
             layout: 'maintain/common/html/layout'
         };
         response.render("maintain/project_feature_lib/html/main", randerData);

+ 17 - 9
modules/project_feature_lib/facade/project_feature_facade.js

@@ -5,7 +5,7 @@ import mongoose from "mongoose";
 const uuidV1 = require('uuid/v1');
 let moment = require("moment");
 let projectFeatureModel = mongoose.model('std_project_feature_lib');
-
+let compilationModel = mongoose.model('compilation');
 
 let projectFeatureLib = {
     findByCondition:async function(conditions,options,single=true){
@@ -18,14 +18,22 @@ let projectFeatureLib = {
     addLib : async function (data){
         let now = new Date().getTime();
         let dateStr = moment(now).format('YYYY-MM-DD HH:mm:ss');
-        let newLib = {
-            creator: data.userAccount,
-            createDate: now,
-            recentOpr: [{operator: data.userAccount, operateDate: dateStr}],
-            name: data.name,
-        };
-        newLib.ID = uuidV1();
-        return await projectFeatureModel.create(newLib);
+        //取编办信息
+        let compilation = await compilationModel.findOne({_id:data.compilationId});
+        if(compilation){
+            let newLib = {
+                creator: data.userAccount,
+                createDate: now,
+                recentOpr: [{operator: data.userAccount, operateDate: dateStr}],
+                name: data.name,
+                compilationId: data.compilationId,
+                compilationName: compilation.name,
+            };
+            newLib.ID = uuidV1();
+            return await projectFeatureModel.create(newLib);
+        }else {
+            throw  new Error("没有找到该编办!");
+        }
     },
     saveLib:async function(param) {
         return await projectFeatureModel.findOneAndUpdate(param.query,param.data,{new:true});

+ 1 - 1
modules/users/controllers/compilation_controller.js

@@ -246,7 +246,7 @@ class CompilationController extends BaseController {
             billsGuidanceList = await billsGuidanceFc.getBillsGuideLibs({compilationId: selectedCompilation._id, $or: [{deleted: null}, {deleted: false}]});
 
             //获取工程特征库
-            featureList = await projectFeatureFacade.findByCondition({},null,false);
+            featureList = await projectFeatureFacade.findByCondition({compilationId: selectedCompilation._id},null,false);
 
             //获取累进区间库
             progressiveList = await progressiveFacade.findByCondition({},null,false);

+ 1 - 0
public/web/sheet/sheet_common.js

@@ -33,6 +33,7 @@ var sheetCommonObj = {
             allowResizeColumns: true
         };
         sheet.showRowOutline(false);
+        sheet.options.allowCellOverflow = false;
         me.buildHeader(sheet, setting);
         if (rowCount > 0) sheet.setRowCount(rowCount);
         sheet.resumeEvent();

+ 26 - 2
web/maintain/project_feature_lib/html/main.html

@@ -2,14 +2,29 @@
     <div class="content">
         <div class="container-fluid">
             <div class="row">
-                <div class="col-md-5">
+                <div class="col-md-2">
+                    <div class="list-group mt-3">
+                        <% for (let compilation of compilationList) { %>
+                        <% if (compilation._id === 'all') { %>
+                        <a href="/projectFeature/main" class="list-group-item list-group-item-action <%= compilation.active %>">
+                            所有
+                        </a>
+                        <% } else { %>
+                        <a id="<%= compilation._id %>" href="/projectFeature/main?filter=<%= compilation._id %>" class="list-group-item list-group-item-action <%= compilation.active %>">
+                            <%= compilation.name %>
+                        </a>
+                        <% }} %>
+                    </div>
+                </div>
+                <div class="col-md-8">
                     <div class="warp-p2 mt-3">
                         <table class="table table-hover table-bordered">
-                            <thead><tr><th >库名称</th><th width="160">添加时间</th><th width="120">操作</th></tr></thead>
+                            <thead><tr><th >库名称</th><th>费用定额</th><th width="160">添加时间</th><th width="120">操作</th></tr></thead>
                             <tbody id="showArea">
                             <% for(let lib of featureLibs){ %>
                             <tr class="libTr">
                                 <td id="<%= lib.ID%>"><a href="/projectFeature/edit/<%= lib.ID%>"><%= lib.name%></a></td>
+                                <td><%= lib.compilationName%></td>
                                 <td><%= moment(lib.createDate).format('YYYY-MM-DD')%></td>
                                 <td>
                                     <a style="color: #0275d8" onclick='getFeatureLib("<%= lib.ID%>")' title="编辑"><i class="fa fa-pencil-square-o"></i></a>
@@ -43,6 +58,15 @@
                         <input id="name" name="name" class="form-control" placeholder="请输入特征库名称" type="text">
                         <small class="form-text text-danger" id="nameError" style="display: none">请输入特征库名称。</small>
                     </div>
+                    <div class="form-group">
+                        <label>编办名称</label>
+                        <select class="form-control" name="compilationId">
+                            <% for (let compilation of compilationList) { %>
+                            <% if (compilation.name !== '所有') { %>
+                            <option value="<%= compilation._id %>"><%= compilation.name %></option>
+                            <% }} %>
+                        </select>
+                    </div>
                     <input type="hidden" name = "userAccount" value="<%= userAccount%>">
                 </form>
             </div>

+ 14 - 11
web/maintain/ration_repository/js/ration_assist.js

@@ -8,16 +8,19 @@ var rationAssistOprObj = {
     setting: {
         header:[
             {headerName:"调整名称",headerWidth:110,dataCode:"name", dataType: "String", hAlign: "left"},
+            {headerName:"参数",headerWidth:60,dataCode:"param", dataType: "String", hAlign: "right"},
             {headerName:"辅助定额号",headerWidth:90,dataCode:"assistCode", dataType: "String", hAlign: "center", formatter: "@"},
+            {headerName:"参数名称",headerWidth:90,dataCode:"paramName", dataType: "String", hAlign: "left"},
             {headerName:"标准值",headerWidth:60,dataCode:"stdValue", dataType: "String", hAlign: "right"},
             {headerName:"步距",headerWidth:60,dataCode:"stepValue", dataType: "String", hAlign: "right"},
             {headerName:"精度",headerWidth:60,dataCode:"decimal",  dataType: "String", hAlign: "right"},
             {headerName:"进位方式",headerWidth:80,dataCode:"carryBit", dataType: "String", hAlign: "center"},
             {headerName:"最小值",headerWidth:70,dataCode:"minValue", dataType: "String", hAlign: "right"},
-            {headerName:"最大值",headerWidth:70,dataCode:"maxValue", dataType: "String", hAlign: "right"}
+            {headerName:"最大值",headerWidth:70,dataCode:"maxValue", dataType: "String", hAlign: "right"},
+            {headerName:"第三定额",headerWidth:90,dataCode:"thirdRationCode", dataType: "String", hAlign: "center", formatter: "@"}
         ],
         view:{},
-        comboItems: ["四舍五入", "进一"]
+        comboItems: ["四舍五入", "进一",'舍一']
     },
 
     buildSheet: function(sheet) {
@@ -41,7 +44,7 @@ var rationAssistOprObj = {
         let cellType = args.sheet.getCellType(args.row, 5);
         if(cellType.typeName !== 'undefined' && cellType.typeName === '1'){
           //  sheetCommonObj.setStaticCombo(args.sheet, 0, 5, 0, me.setting.comboItems, false);
-            sheetCommonObj.setDynamicCombo(args.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+            sheetCommonObj.setDynamicCombo(args.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         }
     },
 
@@ -72,7 +75,7 @@ var rationAssistOprObj = {
         });
         sheetCommonObj.cleanData(me.sheet, me.setting, -1);
         //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, me.ration.rationAssList.length, me.setting.comboItems, false, false);
-        sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+        sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         sheetCommonObj.showData(me.sheet, me.setting, me.ration.rationAssList);
     },
 
@@ -95,13 +98,13 @@ var rationAssistOprObj = {
         var assList = me.ration.rationAssList;
         var assObj = sheetsOprObj.combineRationRowData(me.sheet, me.setting, args.row);
         let dataCode = me.setting.header[args.col].dataCode;
-        if((args.col === 2 || args.col === 3 || args.col === 6 || args.col === 7)
+        if((dataCode === 'stdValue' || dataCode === 'stepValue' || dataCode === 'minValue' || dataCode === 'maxValue')
             && args.editingText && args.editingText.toString().trim().length > 0 && isNaN(args.editingText)){
             args.sheet.setValue(args.row, args.col, args.row < assList.length ? assList[args.row][dataCode] : '');
             alert(me.setting.header[args.col].headerName + '只能为数值!');
             return;
         }
-        else if(args.col === 4 && args.editingText && (args.editingText.toString().trim().length === 0 ||
+        else if(dataCode === 'decimal' && args.editingText && (args.editingText.toString().trim().length === 0 ||
                 isNaN(args.editingText) || args.editingText % 1 !== 0)){
             args.sheet.setValue(args.row, args.col, args.row < assList.length ? assList[args.row][dataCode] : 0);
             alert(me.setting.header[args.col].headerName + '只能为整数!');
@@ -110,7 +113,7 @@ var rationAssistOprObj = {
         // 新增
         if (args.row >= assList.length) {
             if (assObj.decimal == undefined || assObj.decimal == null){assObj.decimal = '0';};
-            if (assObj.carryBit == undefined || assObj.carryBit == null){assObj.carryBit = '进一';};
+            if (assObj.carryBit == undefined || assObj.carryBit == null){assObj.carryBit = '四舍五入';};
             assList.push(assObj);
         }
         // 修改
@@ -120,7 +123,7 @@ var rationAssistOprObj = {
         });
         sheetCommonObj.cleanData(me.sheet, me.setting, -1);
         //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, assList.length, me.setting.comboItems, false, false);
-        sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+        sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         sheetCommonObj.showData(me.sheet, me.setting, assList);
     },
 
@@ -163,7 +166,7 @@ var rationAssistOprObj = {
                     });
                     sheetCommonObj.cleanData(me.sheet, me.setting, -1);
                     //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, curCahe.length, me.setting.comboItems, false);
-                    sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false);
+                    sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false);
                     sheetCommonObj.showData(me.sheet, me.setting, curCahe);
                 }
             }
@@ -182,12 +185,12 @@ var rationAssistOprObj = {
         if (ration == undefined || ration.rationAssList == undefined ||
             ration.rationAssList.length == 0){
             //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, 0, me.setting.comboItems, false);
-            sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+            sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
             return;
         }
         else {
             //sheetCommonObj.setStaticCombo(me.sheet, 0, 5, ration.rationAssList.length, me.setting.comboItems, false);
-            sheetCommonObj.setDynamicCombo(me.sheet, 0, 5, me.sheet.getRowCount(), me.setting.comboItems, false, false);
+            sheetCommonObj.setDynamicCombo(me.sheet, 0, 7, me.sheet.getRowCount(), me.setting.comboItems, false, false);
         }
         sheetCommonObj.showData(me.sheet, me.setting, ration.rationAssList);
     }

+ 16 - 8
web/maintain/std_glj_lib/js/glj.js

@@ -36,7 +36,11 @@ $(document).ready(function () {
     rightElesObj.left = $('#midContent');
     rightElesObj.right = $('#rightContent');
     SlideResize.horizontalSlide(rightElesObj, {min: 200, max: `$('#dataRow').width() - $('#leftContent').width() - 200`}, function () {
-       refreshALlWorkBook();
+        let resizeRate = 500 / $('#midContent').width(),
+            sheetRate = 100 - resizeRate;
+        $('#leftResize').css('width', `${resizeRate}%`);
+        $('#GLJListSheet').css('width', `${sheetRate}%`);
+        refreshALlWorkBook();
     });
 });
 
@@ -310,6 +314,10 @@ let repositoryGljObj = {
             }
         })
     },
+    //获取工料机类型大类
+    getParentType: function (type) {
+        return parseInt(type.toString()[0]);
+    },
     getGljLib: function (libId, callback) {
         let me = repositoryGljObj;
         $.ajax({
@@ -706,7 +714,7 @@ let repositoryGljObj = {
             let dataCode = me.setting.header[args.col].dataCode;
             me.currentGlj = me.currentCache[args.row];
             if(dataCode === 'code'
-                || (me.feeDataCode.includes(dataCode) && me.currentGlj.gljType !== 201)){//费率数据列只有普通材料能用
+                || (me.feeDataCode.includes(dataCode) && me.getParentType(me.currentGlj.gljType) !== 2)){//费率数据列只有材料能用
                 args.cancel = true;
             }
             else {
@@ -760,8 +768,8 @@ let repositoryGljObj = {
                             if(me.currentGlj){
                                 me.currentGlj.component = [];
                             }
-                            //工料机类型不为普通材料时,情况费率数据
-                            if (me.currentEditingGlj.gljType === 201 && rObj.gljType !== 201) {
+                            //工料机类型不为材料时,情况费率数据
+                            if (me.getParentType(me.currentEditingGlj.gljType) === 2 && me.getParentType(rObj.gljType) !== 2) {
                                 for (let feeCode of me.feeDataCode) {
                                     if (me.currentEditingGlj[feeCode]) {
                                         rObj[feeCode] = null;
@@ -1104,7 +1112,7 @@ let repositoryGljObj = {
                 if(pasteObj.gljType === me.distTypeTree.comboDatas[i].text){
                     pasteObj.gljType = me.distTypeTree.comboDatas[i].value;
                     isExsit = true;
-                    if (pasteObj.gljType !== 201 && tempObj.gljType === 201) {
+                    if (me.getParentType(pasteObj.gljType) !== 2 && me.getParentType(tempObj.gljType) === 2) {
                         for (let feeCode of me.feeDataCode) {
                             tempObj[feeCode] = null;
                         }
@@ -1135,8 +1143,8 @@ let repositoryGljObj = {
         }
         for (let feeCode of me.feeDataCode) {
             if (typeof pasteObj[feeCode] !== 'undefined' && !isNaN(pasteObj[feeCode])) {
-                if ((typeof pasteObj.gljType !== 'undefined' && pasteObj.gljType === 201) ||
-                    (tempObj.gljType && tempObj.gljType === 201)) {
+                if ((typeof pasteObj.gljType !== 'undefined' && me.getParentType(pasteObj.gljType) === 2) ||
+                    (tempObj.gljType && me.getParentType(tempObj.gljType) === 2)) {
                     tempObj[feeCode] = pasteObj[feeCode];
                 } else {
                     isValid = false;
@@ -1224,7 +1232,7 @@ let repositoryGljObj = {
             }
         }
         for (let feeCode of me.feeDataCode) {
-            if (typeof pasteObj[feeCode] !== 'undefined' && (isNaN(pasteObj[feeCode]) || pasteObj.gljType !== 201)) {
+            if (typeof pasteObj[feeCode] !== 'undefined' && (isNaN(pasteObj[feeCode]) || me.getParentType(pasteObj.gljType) !== 2)) {
                 return false;
             }
         }