Procházet zdrojové kódy

新建文件类型、计税方法相关

zhongzewei před 6 roky
rodič
revize
45ee9a49c6

+ 2 - 0
modules/pm/controllers/pm_controller.js

@@ -611,6 +611,8 @@ module.exports = {
                     if (proj.projType === projType.tender) {
                     if (proj.projType === projType.tender) {
                         //设置工程专业
                         //设置工程专业
                         proj._doc.feeStandardName = proj.property.feeStandardName || '';
                         proj._doc.feeStandardName = proj.property.feeStandardName || '';
+                        //设置计税方法
+                        proj._doc.taxType = proj.property.taxType;
                     }
                     }
                     delete proj._doc.property;
                     delete proj._doc.property;
                 }
                 }

+ 35 - 16
web/building_saas/main/js/models/exportStandardInterface.js

@@ -40,6 +40,16 @@ const XMLStandard = (function () {
         [fixedFlag.ENVIRONMENTAL_PROTECTION_TAX]: '9003',
         [fixedFlag.ENVIRONMENTAL_PROTECTION_TAX]: '9003',
         0: '1800',  //其他未定义的大项费用
         0: '1800',  //其他未定义的大项费用
     };
     };
+    //文件类型
+    const FILE_KIND = {
+        '1': '投标',
+        '2': '招标',
+    };
+    //计税方法
+    const TAX_TYPE = {
+        '1': '一般计税法',
+        '2': '简易计税法',
+    };
     //加载数据间隔,减少服务器压力
     //加载数据间隔,减少服务器压力
     const TIMEOUT_TIME = 500;
     const TIMEOUT_TIME = 500;
     function isDef(v) {
     function isDef(v) {
@@ -169,8 +179,8 @@ const XMLStandard = (function () {
                 {name: '建设单位', value: getValueByKey(source.basicInformation, 'constructionUnit'), required: true},
                 {name: '建设单位', value: getValueByKey(source.basicInformation, 'constructionUnit'), required: true},
                 {name: '标准版本号', value: '3.2.2', required: true},
                 {name: '标准版本号', value: '3.2.2', required: true},
                 {name: '标准名称', value: '重庆造价软件数据交换标准(清单计价)', required: true,},
                 {name: '标准名称', value: '重庆造价软件数据交换标准(清单计价)', required: true,},
-                {name: '文件类型', value: getValueByKey(source.basicInformation, 'fileKind'), required: true, enumeration: ['招标', '投标', '控制价', '结算', '其他']},
-                {name: '计税方法', value: 'todo', required: true},
+                {name: '文件类型', value: source.fileKind, required: true, enumeration: ['招标', '投标', '控制价', '结算', '其他']},
+                {name: '计税方法', value: source.taxType, required: true, enumeration: ['营业税', '一般计税法', '简易计税法']},
             ];
             ];
             //唯一约束
             //唯一约束
             this.constraints = {
             this.constraints = {
@@ -221,7 +231,7 @@ const XMLStandard = (function () {
                 {name: '投标工期', value: getValueByKey(source.basicInformation, 'biddingPeriod')},
                 {name: '投标工期', value: getValueByKey(source.basicInformation, 'biddingPeriod')},
                 {name: '投标保证金', value: getValueByKey(source.basicInformation, 'biddingMargin'), type: TYPE.NUM2},
                 {name: '投标保证金', value: getValueByKey(source.basicInformation, 'biddingMargin'), type: TYPE.NUM2},
                 {name: '质量承诺', value: getValueByKey(source.basicInformation, 'qualityCommitment')},
                 {name: '质量承诺', value: getValueByKey(source.basicInformation, 'qualityCommitment')},
-                {name: '担保类型', value: getValueByKey(source.basicInformation, 'guaranteeType')},
+                {name: '担保类型', value: getValueByKey(source.basicInformation, 'guaranteeType'), enumeration: ['支票', '现金', '电汇', '汇票']},
                 {name: '投标总价', value: source.summaryInfo.engineeringCost, required: true, type: TYPE.NUM2},
                 {name: '投标总价', value: source.summaryInfo.engineeringCost, required: true, type: TYPE.NUM2},
             ];
             ];
             element.call(this, '投标信息', attrs);
             element.call(this, '投标信息', attrs);
@@ -273,8 +283,8 @@ const XMLStandard = (function () {
         //单位工程定义
         //单位工程定义
         function Tender(source) {
         function Tender(source) {
             const TAX = {
             const TAX = {
-                1: '一般计税',
-                2: '简易计税'
+                '1': '一般计税',
+                '2': '简易计税',
             };
             };
             let attrs = [
             let attrs = [
                 {name: '编号', value: source.code, required: true, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '编号', value: source.code, required: true, minLen: 1, maxLen: 255, whiteSpace: WHITE_SPACE.COLLAPSE},
@@ -286,8 +296,11 @@ const XMLStandard = (function () {
                     '房屋安装修缮工程', '房屋修缮单拆除'
                     '房屋安装修缮工程', '房屋修缮单拆除'
                 ]},
                 ]},
                 {name: '金额', value: source.summaryInfo.engineeringCost, type: TYPE.NUM2},
                 {name: '金额', value: source.summaryInfo.engineeringCost, type: TYPE.NUM2},
-                {name: '定额库编码', value: source.defaultRationLibCode},
-                {name: '计税方法', value: TAX[source.taxType], required: true},
+                {name: '定额库编码', value: source.defaultRationLibCode, enumeration: [
+                    'CQ18TJ', 'CQ18ZS', 'CQ18AZ', 'CQ18SZ', 'CQ18YL', 'CQ18FG', 'CQ18GD', 'CQ18FS',
+                    'CQ18LS', 'CQ18GZW', 'CQ18BP', 'CQ18ZP'
+                ]},
+                {name: '计税方法', value: TAX[source.taxType], required: true, enumeration: ['营业税', '一般计税', '简易计税']},
             ];
             ];
             this.constraints = {
             this.constraints = {
                 billsCode: [],                 //清单项目项目编码
                 billsCode: [],                 //清单项目项目编码
@@ -340,7 +353,7 @@ const XMLStandard = (function () {
                 {name: '费率', value: source.feeRate},
                 {name: '费率', value: source.feeRate},
                 {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2},
                 {name: '金额', value: getFee(source.fees, 'common.totalFee'), type: TYPE.NUM2},
                 {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), type: TYPE.NUM2},
                 {name: '其中暂估价', value: getFee(source.fees, 'estimate.totalFee'), type: TYPE.NUM2},
-                {name: '费用类别', value: source.feeType, type: TYPE.INT, required: true},
+                {name: '费用类别', value: source.feeType, type: TYPE.INT, required: true, enumeration: ['1100', '1200', '1204', '1300', '800', '900', '1800', '1']},
                 {name: '备注', value: source.remark},
                 {name: '备注', value: source.remark},
             ];
             ];
             element.call(this, '计价程序费用行', attrs);
             element.call(this, '计价程序费用行', attrs);
@@ -434,7 +447,7 @@ const XMLStandard = (function () {
                 {name: '人材机代码', value: source.code, required: true, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '人材机代码', value: source.code, required: true, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE},
                 {name: '消耗量', value: source.quantity, required: true, type: TYPE.DECIMAL},
                 {name: '消耗量', value: source.quantity, required: true, type: TYPE.DECIMAL},
                 {name: '总消耗量', value: source.totalQuantity, required: true, type: TYPE.DECIMAL},
                 {name: '总消耗量', value: source.totalQuantity, required: true, type: TYPE.DECIMAL},
-                {name: '数量计算方式', value: 1, required: true, type: TYPE.INT},
+                {name: '数量计算方式', value: 1, required: true, type: TYPE.INT, enumeration: ['1', '2']},
             ];
             ];
             element.call(this, '人材机含量', attrs);
             element.call(this, '人材机含量', attrs);
         }
         }
@@ -699,7 +712,7 @@ const XMLStandard = (function () {
                 {name: '主要材料类别', value: source.mainMaterialType, type: TYPE.INT},
                 {name: '主要材料类别', value: source.mainMaterialType, type: TYPE.INT},
                 {name: '主要材料单位系数', value: source.materialCoe, type: TYPE.DECIMAL},
                 {name: '主要材料单位系数', value: source.materialCoe, type: TYPE.DECIMAL},
                 {name: '材料耗用类型', value: 0, type: TYPE.INT, required: true},
                 {name: '材料耗用类型', value: 0, type: TYPE.INT, required: true},
-                {name: '供货方式', value: source.supply, type: TYPE.INT},
+                {name: '供应方式', value: source.supply, type: TYPE.INT, enumeration: ['1', '2']},
                 {name: '暂估材料标志', value: source.is_evaluate, type: TYPE.BOOL},
                 {name: '暂估材料标志', value: source.is_evaluate, type: TYPE.BOOL},
                 {name: '不计税设备标志', value: source.no_tax_eqp, type: TYPE.BOOL, required: true},
                 {name: '不计税设备标志', value: source.no_tax_eqp, type: TYPE.BOOL, required: true},
                 {name: '单价不从明细汇总标志', value: source.notFromDetail, type: TYPE.BOOL},
                 {name: '单价不从明细汇总标志', value: source.notFromDetail, type: TYPE.BOOL},
@@ -947,7 +960,12 @@ const XMLStandard = (function () {
                 engData.children = sortByNext(engData.children);
                 engData.children = sortByNext(engData.children);
             }
             }
             //标段
             //标段
-            let project = new Project({basicInformation: projectData.property.basicInformation, name: projectData.name});
+            let project = new Project({
+                basicInformation: projectData.property.basicInformation,
+                name: projectData.name,
+                fileKind: projectData.property.fileKind ? FILE_KIND[projectData.property.fileKind] : '',
+                taxType: projectData.property.taxType ? TAX_TYPE[projectData.property.taxType] : ''
+            });
             curProjectEle = project;
             curProjectEle = project;
             //项目信息
             //项目信息
             let projectInfo = new ProjectInfo({basicInformation: projectData.property.basicInformation});
             let projectInfo = new ProjectInfo({basicInformation: projectData.property.basicInformation});
@@ -1124,7 +1142,7 @@ const XMLStandard = (function () {
                     calcBase: node.data.calcBase,
                     calcBase: node.data.calcBase,
                     feeRate: node.data.feeRate !== '' ? node.data.feeRate : 100,
                     feeRate: node.data.feeRate !== '' ? node.data.feeRate : 100,
                     fees: node.data.fees,
                     fees: node.data.fees,
-                    feeType: FEE_TYPE[flag],
+                    feeType: FEE_TYPE[flag] || FEE_TYPE['0'],
                     remark: node.data.remark
                     remark: node.data.remark
                 };
                 };
                 let dxfy = new DXFYRow(source);
                 let dxfy = new DXFYRow(source);
@@ -1449,9 +1467,10 @@ const XMLStandard = (function () {
                 otherEle.children.push(loadEngEstimate(engEstimateNode));
                 otherEle.children.push(loadEngEstimate(engEstimateNode));
             }
             }
             //添加计日工元素
             //添加计日工元素
+            debugger;
             let dayWorkNode = detail.Bills.tree.items.find(node => getNodeFlag(node) === fixedFlag.DAYWORK);
             let dayWorkNode = detail.Bills.tree.items.find(node => getNodeFlag(node) === fixedFlag.DAYWORK);
-            let dayWorkEle = new DayWorkItem({fees: dayWorkNode.data.fees});
-            if (dayWorkNode && dayWorkNode.children.length > 0) {
+            let dayWorkEle = new DayWork({fees: dayWorkNode.data.fees});
+                if (dayWorkNode && dayWorkNode.children.length > 0) {
                 //要显示计日工元素,人工、材料、施工机械,最少有一条含有子项(计日工项目)
                 //要显示计日工元素,人工、材料、施工机械,最少有一条含有子项(计日工项目)
                 let filterNodes = dayWorkNode.children.filter(node => [fixedFlag.LABOUR, fixedFlag.MATERIAL, fixedFlag.MACHINE].includes(getNodeFlag(node)));
                 let filterNodes = dayWorkNode.children.filter(node => [fixedFlag.LABOUR, fixedFlag.MATERIAL, fixedFlag.MACHINE].includes(getNodeFlag(node)));
                 for (let fNode of filterNodes) {
                 for (let fNode of filterNodes) {
@@ -1679,7 +1698,7 @@ const XMLStandard = (function () {
                     calcBase: node.data.calcBase,
                     calcBase: node.data.calcBase,
                     feeRate: node.data.feeRate !== '' ? node.data.feeRate : 100,
                     feeRate: node.data.feeRate !== '' ? node.data.feeRate : 100,
                     fees: node.data.fees,
                     fees: node.data.fees,
-                    feeType: FEE_TYPE[getNodeFlag(node)],
+                    feeType: FEE_TYPE[getNodeFlag(node)] || FEE_TYPE['0'],
                     remark: node.data.remark
                     remark: node.data.remark
                 };
                 };
                 //序号唯一
                 //序号唯一
@@ -1945,7 +1964,7 @@ const XMLStandard = (function () {
             //格式化
             //格式化
             xmlStr = formatXml(xmlStr);
             xmlStr = formatXml(xmlStr);
             let blob = new Blob([xmlStr], {type: 'text/plain;charset=utf-8'});
             let blob = new Blob([xmlStr], {type: 'text/plain;charset=utf-8'});
-            saveAs(blob, '重庆标准交换数据.xml');
+            saveAs(blob, '重庆标准交换数据.qtf');
         }
         }
     }
     }
 })();
 })();

+ 66 - 3
web/building_saas/pm/html/project-management.html

@@ -226,11 +226,46 @@
             </div>
             </div>
             <div class="modal-body">
             <div class="modal-body">
                 <form id="projFirstStep">
                 <form id="projFirstStep">
-                    <div class="form-group">
+               <!--     <div class="form-group">
                         <label>建设项目</label>
                         <label>建设项目</label>
                         <input type="text" class="form-control" placeholder="输入建设项目名称" id="project-name">
                         <input type="text" class="form-control" placeholder="输入建设项目名称" id="project-name">
                         <span class="form-text text-danger" id="project-name-info" style="display: none;">已存在 “建筑工程1”</span>
                         <span class="form-text text-danger" id="project-name-info" style="display: none;">已存在 “建筑工程1”</span>
+                    </div>-->
+                    <div class="form-group row">
+                        <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">建设项目</label>
+                        <div class="col">
+                            <input type="text" class="form-control form-control-sm" placeholder="输入建设项目名称" id="project-name">
+                            <span class="form-text text-danger" id="project-name-info" style="display: none;">已存在 “建筑工程1”</span>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">文件类型</label>
+                        <div class="col">
+                            <div class="custom-control custom-radio custom-control-inline">
+                                <input type="radio" value="1" checked id="radioTender" name="fileKind" class="custom-control-input">
+                                <label class="custom-control-label" for="radioTender">投标</label>
+                            </div>
+                             <div class="custom-control custom-radio custom-control-inline">
+                                 <input type="radio" value="2" id="radioBid" name="fileKind" class="custom-control-input">
+                                 <label class="custom-control-label" for="radioBid">招标</label>
+                             </div>
+                        </div>
                     </div>
                     </div>
+                    <span class="form-text text-danger" id="fileKind-info" style="display: none;">请选择文件类型</span>
+                    <div class="form-group row">
+                        <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计税方法</label>
+                        <div class="col">
+                            <div class="custom-control custom-radio custom-control-inline">
+                                <input type="radio" value="1" checked id="radioCommon" name="taxType" class="custom-control-input">
+                                <label class="custom-control-label" for="radioCommon">一般计税法</label>
+                            </div>
+                             <div class="custom-control custom-radio custom-control-inline">
+                                 <input type="radio" value="2" id="radioSimple" name="taxType" class="custom-control-input">
+                                 <label class="custom-control-label" for="radioSimple">简易计税法</label>
+                             </div>
+                        </div>
+                    </div>
+                    <span class="form-text text-danger" id="taxType-info" style="display: none;">请选择计税方法</span>
                 </form>
                 </form>
                 <form id="projInfoStep" class="hidden-area"></form>
                 <form id="projInfoStep" class="hidden-area"></form>
                 <p id="project-required-warn" class="text-muted hidden-area"><i class="fa fa-warning text-warning"></i> 注:为响应重庆地区指标采集标准数据要求,以上工程信息及特征必填项为必填项,请正确填写。</p>
                 <p id="project-required-warn" class="text-muted hidden-area"><i class="fa fa-warning text-warning"></i> 注:为响应重庆地区指标采集标准数据要求,以上工程信息及特征必填项为必填项,请正确填写。</p>
@@ -299,6 +334,34 @@
                         </div>
                         </div>
                     </div>
                     </div>
                     <span class="form-text text-info" id="poj-name-info" style="display: none;">新建 “汽车生产车间5”</span>
                     <span class="form-text text-info" id="poj-name-info" style="display: none;">新建 “汽车生产车间5”</span>
+                    <div id="newProjectSet" style="display: none">
+                        <div class="form-group row">
+                            <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">文件类型</label>
+                            <div class="col">
+                                <div class="custom-control custom-radio custom-control-inline">
+                                    <input type="radio" value="1" checked id="radioTender-tender" name="fileKind-tender" class="custom-control-input">
+                                    <label class="custom-control-label" for="radioTender-tender">投标</label>
+                                </div>
+                                <div class="custom-control custom-radio custom-control-inline">
+                                    <input type="radio" value="2" id="radioBid-tender" name="fileKind-tender" class="custom-control-input">
+                                    <label class="custom-control-label" for="radioBid-tender">招标</label>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="form-group row">
+                            <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计税方法</label>
+                            <div class="col">
+                                <div class="custom-control custom-radio custom-control-inline">
+                                    <input type="radio" value="1" checked id="radioCommon-tender" name="taxType-tender" class="custom-control-input">
+                                    <label class="custom-control-label" for="radioCommon-tender">一般计税法</label>
+                                </div>
+                                <div class="custom-control custom-radio custom-control-inline">
+                                    <input type="radio" value="2" id="radioSimple-tender" name="taxType-tender" class="custom-control-input">
+                                    <label class="custom-control-label" for="radioSimple-tender">简易计税法</label>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
                     <div class="form-group row">
                     <div class="form-group row">
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">单项工程</label>
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">单项工程</label>
                         <div class="col">
                         <div class="col">
@@ -383,7 +446,7 @@
                         </div>
                         </div>
                     </div>
                     </div>
                     <span class="form-text text-danger" id="feeStandard-info" style="display: none;">请选择费用标准</span>
                     <span class="form-text text-danger" id="feeStandard-info" style="display: none;">请选择费用标准</span>
-                    <div class="form-group row" id="taxType_div">
+                    <!--<div class="form-group row" id="taxType_div">
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计税方式</label>
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计税方式</label>
                         <div class="col">
                         <div class="col">
                             <select class="form-control  form-control-sm" id="taxType">
                             <select class="form-control  form-control-sm" id="taxType">
@@ -391,7 +454,7 @@
                                 <option value="2">简易计税</option>&ndash;&gt;
                                 <option value="2">简易计税</option>&ndash;&gt;
                             </select>
                             </select>
                         </div>
                         </div>
-                    </div>
+                    </div>-->
                     <div class="form-group row">
                     <div class="form-group row">
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计算程序</label>
                         <label for="staticEmail" class="col-auto col-form-label col-form-label-sm">计算程序</label>
                         <div class="col">
                         <div class="col">

+ 152 - 109
web/building_saas/pm/js/pm_newMain.js

@@ -31,7 +31,12 @@ let taxTypeMap = {
     1:"一般计税",
     1:"一般计税",
     2:"简易计税"
     2:"简易计税"
 };
 };
-
+//文件类型:招标,投标
+const FileKind = {
+    tender: 1, //投标
+    bid: 2  //招标
+};
+let curTaxType = 1; //1:"一般计税",2:"简易计税"
 /*
 /*
 * 地区,同一费用定额下不同地区有不同单价,则新建单位工程时需要选择地区项
 * 地区,同一费用定额下不同地区有不同单价,则新建单位工程时需要选择地区项
 * 地区项为空的时候,前端不显示该下拉项,地区的赋值覆盖在over_write相关文件中
 * 地区项为空的时候,前端不显示该下拉项,地区的赋值覆盖在over_write相关文件中
@@ -1654,6 +1659,9 @@ $(document).ready(function() {
         projDialog.on('hidden.bs.modal', function () {
         projDialog.on('hidden.bs.modal', function () {
             setDangerInfo($('#project-name-info'), '', false);
             setDangerInfo($('#project-name-info'), '', false);
             $('#project-name').val('');
             $('#project-name').val('');
+            //文件类型、计税方法恢复默认选项
+            $('input[name="fileKind"]:eq(0)').prop('checked', true);
+            $('input[name="taxType"]:eq(0)').prop('checked', true);
         });
         });
         projDialog.on('show.bs.modal', function () {
         projDialog.on('show.bs.modal', function () {
             infoData = null;
             infoData = null;
@@ -1700,6 +1708,11 @@ $(document).ready(function() {
             }
             }
         });
         });
     }
     }
+    //单位工程-新建建设项目-选择计税方法
+    $('input[name="taxType-tender"]').click(function () {
+        curTaxType = parseInt($(this).val());
+        getStdCalcProgramFiles();
+    });
     // 选择计价方式
     // 选择计价方式
     $("input[name='valuation_type']").click(function() {
     $("input[name='valuation_type']").click(function() {
         let type = $(this).val();
         let type = $(this).val();
@@ -1749,10 +1762,17 @@ $(document).ready(function() {
         let isExist = hasListName(nameList, pojName);
         let isExist = hasListName(nameList, pojName);
         if(!isExist){
         if(!isExist){
             if(pojName !== ''){
             if(pojName !== ''){
+                //新建建设项目,显示文件类型、计税方法选项
+                $('#newProjectSet').show();
+                $('input[name="fileKind-tender"]:eq(0)').prop('checked', true);
+                $('input[name="taxType-tender"]:eq(0)').prop('checked', true);
+                curTaxType = 1;
+                getStdCalcProgramFiles();
                 replaceClass($('#poj-name-info'), 'text-danger', 'text-info');
                 replaceClass($('#poj-name-info'), 'text-danger', 'text-info');
                 setDangerInfo($('#poj-name-info'), `新建“${pojName}”`);
                 setDangerInfo($('#poj-name-info'), `新建“${pojName}”`);
             }
             }
             else {
             else {
+                $('#newProjectSet').hide();//隐藏文件类型、计税方法选项
                 $('#poj-name-info').hide();
                 $('#poj-name-info').hide();
             }
             }
             //清空单项工程下拉和文件下拉
             //清空单项工程下拉和文件下拉
@@ -1850,6 +1870,10 @@ $(document).ready(function() {
         $('#engineering-info').hide();
         $('#engineering-info').hide();
         $('#unit-price').find('option:first-child').text('新建单价文件');
         $('#unit-price').find('option:first-child').text('新建单价文件');
         $('#tender-fee-rate').find('option:first-child').text('新建费率文件');
         $('#tender-fee-rate').find('option:first-child').text('新建费率文件');
+        $('#newProjectSet').hide(); //隐藏文件类型、计税方法选项
+        $('input[name="fileKind-tender"]:eq(0)').prop('checked', true);
+        $('input[name="taxType-tender"]:eq(0)').prop('checked', true);
+        curTaxType = 1;
         //获取建设项目
         //获取建设项目
         let selected = projTreeObj.tree.selected;
         let selected = projTreeObj.tree.selected;
         let projs = getProjs(selected);
         let projs = getProjs(selected);
@@ -2292,15 +2316,23 @@ $(document).ready(function() {
     $("#copy-to-confirm").click(function() {
     $("#copy-to-confirm").click(function() {
         let originalNode = projTreeObj.tree.selected;
         let originalNode = projTreeObj.tree.selected;
         let toNode = projTreeObj.copySelected;
         let toNode = projTreeObj.copySelected;
+        let projectNode;    //建设项目节点
         let parent = null,next = null,projectMap={};
         let parent = null,next = null,projectMap={};
         if(toNode.data.projType == projectType.engineering){//复制为目标的子节点
         if(toNode.data.projType == projectType.engineering){//复制为目标的子节点
+            projectNode = toNode.parent;
             parent = toNode;
             parent = toNode;
             next = toNode.firstChild();
             next = toNode.firstChild();
         }else if(toNode.data.projType == projectType.tender){//复制为目标的后兄弟
         }else if(toNode.data.projType == projectType.tender){//复制为目标的后兄弟
+            projectNode = toNode.parent.parent;
             parent = toNode.parent;
             parent = toNode.parent;
             next = toNode.nextSibling;
             next = toNode.nextSibling;
             projectMap['update'] = {query:{ID:toNode.id()}};//前一节点的下一个节点更新;
             projectMap['update'] = {query:{ID:toNode.id()}};//前一节点的下一个节点更新;
         }
         }
+        //目标建设项目的计税方法与单位工程的一致时,才可复制到,否则提示“当前单位工程计税方法与目标建设项目不一致,不可复制。 确定”。
+        if (projectNode.data.property.taxType != originalNode.data.property.taxType) {
+            alert('当前单位工程计税方法与目标建设项目不一致,不可复制。');
+            return false;
+        }
         let nextID = next?next.id():-1;
         let nextID = next?next.id():-1;
         let projectData = _.cloneDeep(originalNode.data);
         let projectData = _.cloneDeep(originalNode.data);
         projectData['ParentID'] = parent.id();
         projectData['ParentID'] = parent.id();
@@ -2331,112 +2363,113 @@ $(document).ready(function() {
         projTreeObj.confirmFileChange();
         projTreeObj.confirmFileChange();
     });
     });
 
 
-    function changeEngineering(){
-        featureData = null;
-        $('#engineering-info').hide();
-        initFeeStandardSel();
-    }
+    // 选择工程专业后动态更改费率文件等数据
+    $("#tender-engineering").change(function() {
+        changeEngineering()
+    });
+    $('#tender-feeStandard').change(function () {
+       changeFeeStandard();
+    });
+});
+function changeEngineering(){
+    featureData = null;
+    $('#engineering-info').hide();
+    initFeeStandardSel();
+}
 
 
-    function changeFeeRate(engLib) {
-        if(engLib){
-           /*
-             if (engLib.fee_lib !== undefined && engLib.fee_lib.length > 0) {
-                $("#tender-fee-rate").children("option").first().val("newFeeRate-"+engLib.fee_lib[0].id);
-            }*/
-           //2018-08-29  费率改为和计税方式绑定在一起 所以在这里还不能确定标准费率库ID
-            $("#tender-fee-rate").children("option").first().val("newFeeRate@@");
-            $("#tender-engineering").parent().siblings('.hidden-area').slideDown('fast');
-        }
-        else {
-            $("#tender-fee-rate").children("option").first().val($('#tender-name').val());
-        }
+function changeFeeRate(engLib) {
+    if(engLib){
+        /*
+         if (engLib.fee_lib !== undefined && engLib.fee_lib.length > 0) {
+         $("#tender-fee-rate").children("option").first().val("newFeeRate-"+engLib.fee_lib[0].id);
+         }*/
+        //2018-08-29  费率改为和计税方式绑定在一起 所以在这里还不能确定标准费率库ID
+        $("#tender-fee-rate").children("option").first().val("newFeeRate@@");
+        $("#tender-engineering").parent().siblings('.hidden-area').slideDown('fast');
     }
     }
+    else {
+        $("#tender-fee-rate").children("option").first().val($('#tender-name').val());
+    }
+}
 
 
-    function initFeeStandardSel() {
-        $('#tender-feeStandard').empty();
-        let feeStandards = [];
-        let engineeringList = getEngineeringList();
-        let currentEngName = $('#tender-engineering').val();
-        for(let eng of engineeringList){
-            if(eng.lib.name && eng.lib.name === currentEngName && eng.lib.feeName && eng.lib.feeName !== ''){
-                feeStandards.push(eng.lib.feeName);
-            }
-        }
-        for(let feeName of feeStandards){
-            let $opt = $(`<option value="${feeName}">${feeName}</option>`);
-            $('#tender-feeStandard').append($opt);
-        }
-        if(feeStandards.length > 0){
-            if($('#feeStandard-info').is(':visible')){
-                $('#feeStandard-info').hide();
-            }
+function initFeeStandardSel() {
+    $('#tender-feeStandard').empty();
+    let feeStandards = [];
+    let engineeringList = getEngineeringList();
+    let currentEngName = $('#tender-engineering').val();
+    for(let eng of engineeringList){
+        if(eng.lib.name && eng.lib.name === currentEngName && eng.lib.feeName && eng.lib.feeName !== ''){
+            feeStandards.push(eng.lib.feeName);
         }
         }
-        let currentEngLib = getEngineeringLib(currentEngName + $('#tender-feeStandard').val(), engineeringList);
-        changeFeeRate(currentEngLib);
-        setTaxGroupHtml();
-        getStdCalcProgramFiles();
     }
     }
-
-    function changeFeeStandard() {
-        featureData = null;
-        let currentEngLib = getEngineeringLib($('#tender-engineering').val() + $('#tender-feeStandard').val(), getEngineeringList());
-        changeFeeRate(currentEngLib);
-        setTaxGroupHtml();
-        getStdCalcProgramFiles();
+    for(let feeName of feeStandards){
+        let $opt = $(`<option value="${feeName}">${feeName}</option>`);
+        $('#tender-feeStandard').append($opt);
     }
     }
-
-    function setTaxGroupHtml() {
-        let groups = getTaxGroupList();
-        let taxTypeArray = [];
-        let htmlString = "";
-        if(groups && groups.length > 0){
-            taxTypeArray = _.uniq(_.map(groups,'taxType'));
-        }
-        for(let t of taxTypeArray){
-             htmlString += "<option value='"+t+"'>"+taxTypeMap[t]+"</option>"
-        }
-        $('#taxType').html(htmlString);
-        if(taxTypeArray.length <2){
-            $('#taxType_div').hide();
-        }else {
-            $('#taxType_div').show();
+    if(feeStandards.length > 0){
+        if($('#feeStandard-info').is(':visible')){
+            $('#feeStandard-info').hide();
         }
         }
     }
     }
+    let currentEngLib = getEngineeringLib(currentEngName + $('#tender-feeStandard').val(), engineeringList);
+    changeFeeRate(currentEngLib);
+    //setTaxGroupHtml();
+    getStdCalcProgramFiles();
+}
 
 
-    function getStdCalcProgramFiles(){
-        function getStdCPFilesHtml(taxGroups) {
-            let result = '';
-            if (taxGroups.length <= 0) {
-                return result;
-            };
+function changeFeeStandard() {
+    featureData = null;
+    let currentEngLib = getEngineeringLib($('#tender-engineering').val() + $('#tender-feeStandard').val(), getEngineeringList());
+    changeFeeRate(currentEngLib);
+    //setTaxGroupHtml();
+    getStdCalcProgramFiles();
+}
 
 
-            for (let group of taxGroups){
-                let groupString = ""; //把计算程序、清单模板、列设置的ID生成一个组合的值
-                let p_id = group.program_lib?group.program_lib.id:"";
-                let t_id = group.template_lib?group.template_lib.id:"";
-                let c_id = group.col_lib?group.col_lib.id:"";
-                let f_id = group.fee_lib?group.fee_lib.id:"";
-                groupString = p_id + "|-|" +t_id+"|-|"+c_id+"|-|"+f_id;
-                result += '<option value='+ groupString +'>'+ group.program_lib.name +'</option>';
-            };
-            return result;
-        };
-        let taxType = $("#taxType").val();
-        let stdCPHtml = getStdCPFilesHtml(getTaxGroupList(taxType));
-        $("#tender-calcProgram").html(stdCPHtml);
-        if ($("#tender-calcProgram")[0].options.length > 1)
-            $("#tender-calcProgram")[0].selectedIndex = 0;
+function setTaxGroupHtml() {
+    let groups = getTaxGroupList();
+    let taxTypeArray = [];
+    let htmlString = "";
+    if(groups && groups.length > 0){
+        taxTypeArray = _.uniq(_.map(groups,'taxType'));
     }
     }
+    for(let t of taxTypeArray){
+        htmlString += "<option value='"+t+"'>"+taxTypeMap[t]+"</option>"
+    }
+    $('#taxType').html(htmlString);
+    if(taxTypeArray.length <2){
+        $('#taxType_div').hide();
+    }else {
+        $('#taxType_div').show();
+    }
+}
 
 
-    // 选择工程专业后动态更改费率文件等数据
-    $("#tender-engineering").change(function() {
-        changeEngineering()
-    });
-    $('#tender-feeStandard').change(function () {
-       changeFeeStandard();
-    });
-});
+function getStdCalcProgramFiles(){
+    function getStdCPFilesHtml(taxGroups) {
+        let result = '';
+        if (taxGroups.length <= 0) {
+            return result;
+        };
 
 
+        for (let group of taxGroups){
+            let groupString = ""; //把计算程序、清单模板、列设置的ID生成一个组合的值
+            let p_id = group.program_lib?group.program_lib.id:"";
+            let t_id = group.template_lib?group.template_lib.id:"";
+            let c_id = group.col_lib?group.col_lib.id:"";
+            let f_id = group.fee_lib?group.fee_lib.id:"";
+            groupString = p_id + "|-|" +t_id+"|-|"+c_id+"|-|"+f_id;
+            result += '<option value='+ groupString +'>'+ group.program_lib.name +'</option>';
+        };
+        return result;
+    };
+    //let taxType = $("#taxType").val();
+    let taxType = curTaxType; //计税方法取建设项目的
+    //let selected = projTreeObj.tree.selected;
+
+    let stdCPHtml = getStdCPFilesHtml(getTaxGroupList(taxType));
+    $("#tender-calcProgram").html(stdCPHtml);
+    if ($("#tender-calcProgram")[0].options.length > 1)
+        $("#tender-calcProgram")[0].selectedIndex = 0;
+}
 //获取工作表总宽度
 //获取工作表总宽度
 function getWorkBookWidth(){
 function getWorkBookWidth(){
     return workBookWidth = $(window).width() - $('.pm-side').width() - 90;
     return workBookWidth = $(window).width() - $('.pm-side').width() - 90;
@@ -2548,6 +2581,16 @@ function AddProject() {
         return false;
         return false;
     }
     }
     name = whiteSpaceCollapse(name);
     name = whiteSpaceCollapse(name);
+    let fileKind = $('input[name="fileKind"]:checked').val();
+    if (!fileKind) {
+        setDangerInfo($('#fileKind-info'));
+        return false;
+    }
+    let taxType = $('input[name="taxType"]:checked').val();
+    if (!taxType) {
+        setDangerInfo($('#taxType-info'));
+        return false;
+    }
     let existCallback = function () {
     let existCallback = function () {
         setDangerInfo($('#project-name-info'), `已存在“${$("#project-name").val()}”`);
         setDangerInfo($('#project-name-info'), `已存在“${$("#project-name").val()}”`);
     };
     };
@@ -2564,7 +2607,7 @@ function AddProject() {
      (3)、当前定位在建设项目,新建建设项目为其后兄弟。
      (3)、当前定位在建设项目,新建建设项目为其后兄弟。
      (4)、当前定位在单项工程或单位工程,新建项目为当前所属建设项目的后兄弟。
      (4)、当前定位在单项工程或单位工程,新建项目为当前所属建设项目的后兄弟。
      * */
      * */
-    let property = {basicInformation: infoData ? infoData : []};
+    let property = {basicInformation: infoData ? infoData : [], fileKind: fileKind, taxType: taxType};
     if(!selectedItem){
     if(!selectedItem){
         AddSiblingsItem(selectedItem, name, property, projectType.project, existCallback, sucCallback);
         AddSiblingsItem(selectedItem, name, property, projectType.project, existCallback, sucCallback);
     }
     }
@@ -2673,7 +2716,8 @@ function AddTenderItems(selected, projName, engName, tenderName, property, callb
                 pre = selectedProj;
                 pre = selectedProj;
                 next = selectedProj ? selectedProj.nextSibling : projTreeObj.tree.firstNode();
                 next = selectedProj ? selectedProj.nextSibling : projTreeObj.tree.firstNode();
             }
             }
-            let updateProjs = GetUpdateData(pre, parent, next, projName, {basicInformation: infoData ? infoData : []}, projID, {updateType: 'new', projectType: projectType.project});
+            let fileKind = $('input[name="fileKind-tender"]:checked').val();
+            let updateProjs = GetUpdateData(pre, parent, next, projName, {basicInformation: infoData ? infoData : [], fileKind: parseInt(fileKind), taxType: curTaxType}, projID, {updateType: 'new', projectType: projectType.project});
             let updateEng = {updateType: 'new', updateData: {ID: engID, ParentID: projID, NextSiblingID: -1, name: engName, projType: projectType.engineering}};
             let updateEng = {updateType: 'new', updateData: {ID: engID, ParentID: projID, NextSiblingID: -1, name: engName, projType: projectType.engineering}};
             property.rootProjectID = projID;
             property.rootProjectID = projID;
             let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: engID, NextSiblingID: -1, shareInfo: [], name: tenderName, projType: projectType.tender, property: property}};
             let updateTender = {updateType: 'new', updateData: {ID: tenderID, ParentID: engID, NextSiblingID: -1, shareInfo: [], name: tenderName, projType: projectType.tender, property: property}};
@@ -3028,6 +3072,8 @@ function setProjOptions(projs, selected){
     $("#poj-name").val("");
     $("#poj-name").val("");
     if(projs.length > 0){
     if(projs.length > 0){
         let firstProj = selected && selected.data.projType === projectType.project ? selected: projs[0];
         let firstProj = selected && selected.data.projType === projectType.project ? selected: projs[0];
+        curTaxType = firstProj.data.property.taxType || 1;
+        getStdCalcProgramFiles();
         $("#poj-name").val(firstProj.data.name);
         $("#poj-name").val(firstProj.data.name);
         setFileOptions(firstProj.data.ID);
         setFileOptions(firstProj.data.ID);
         setEngOptions(firstProj.data.ID);
         setEngOptions(firstProj.data.ID);
@@ -3036,20 +3082,14 @@ function setProjOptions(projs, selected){
             $proj.addClass("dropdown-item");
             $proj.addClass("dropdown-item");
             $proj.attr("href", "javascript:void(0);");
             $proj.attr("href", "javascript:void(0);");
             $proj.click(function () {
             $proj.click(function () {
+                curTaxType = projs[i].data.property.taxType || 1;
+                getStdCalcProgramFiles();
+                $('#newProjectSet').hide();//隐藏文件类型、计税方法选项
                 $("#poj-name").val(projs[i].data.name);
                 $("#poj-name").val(projs[i].data.name);
                 setFileOptions(projs[i].data.ID);
                 setFileOptions(projs[i].data.ID);
                 setEngOptions(projs[i].data.ID);
                 setEngOptions(projs[i].data.ID);
                 $('#poj-name-info').hide();
                 $('#poj-name-info').hide();
             });
             });
-            /*let proj = $("<button>").val(projs[i].data.ID).text(projs[i].data.name);
-            proj.addClass("dropdown-item");
-            proj.attr("type", "button");
-            proj.click(function () {
-                $("#poj-name").val(projs[i].data.name);
-                setFileOptions(projs[i].data.ID);
-                setEngOptions(projs[i].data.ID);
-                $('#poj-name-info').hide();
-            });*/
             $("#poj-name-list").append($proj);
             $("#poj-name-list").append($proj);
         }
         }
     }
     }
@@ -3141,7 +3181,9 @@ function replaceClass(selector, orgClass, newClass){
 }
 }
 //设置提示信息
 //设置提示信息
 function setDangerInfo(area, info, show = true){
 function setDangerInfo(area, info, show = true){
-    area.text(info);
+    if (info) {
+        area.text(info);
+    }
     if(show)
     if(show)
         area.show();
         area.show();
     else
     else
@@ -3235,8 +3277,9 @@ function AddTender() {
             setDangerInfo($('#feeStandard-info'), '请选择费用标准');
             setDangerInfo($('#feeStandard-info'), '请选择费用标准');
             return false;
             return false;
         }
         }
-
-        let taxType = $("#taxType").val();
+        //
+        //计税方法由原本的跟单位工程绑定,改成跟建设项目绑定,为了减少项目出错几率,新建时保留单位工程的计税方法,值为建设项目的计税方法值
+        let taxTypeTender = curTaxType;
         let IDGroup = $("#tender-calcProgram").val();
         let IDGroup = $("#tender-calcProgram").val();
         if (!IDGroup || IDGroup === '') {
         if (!IDGroup || IDGroup === '') {
             setDangerInfo($('#calcProgram-info'), '请选择计算程序');
             setDangerInfo($('#calcProgram-info'), '请选择计算程序');
@@ -3309,7 +3352,7 @@ function AddTender() {
             unitPriceFile: {name: unitPriceFileObj.name, id: unitPriceFileObj.id},
             unitPriceFile: {name: unitPriceFileObj.name, id: unitPriceFileObj.id},
             feeFile: {name: feeFileObj.name, id: feeFileObj.id},
             feeFile: {name: feeFileObj.name, id: feeFileObj.id},
             calcProgram: {name: calcProgramName, id: calcProgram},
             calcProgram: {name: calcProgramName, id: calcProgram},
-            taxType:taxType,
+            taxType:taxTypeTender,
             templateLibID:templateLibID,
             templateLibID:templateLibID,
             colLibID:colLibID,
             colLibID:colLibID,
             featureLibID:featureLibID,
             featureLibID:featureLibID,

+ 13 - 4
web/building_saas/pm/js/pm_share.js

@@ -18,6 +18,7 @@ const pmShare = (function () {
     const oprType = {copy: 'copy', cancel: 'cancel'};
     const oprType = {copy: 'copy', cancel: 'cancel'};
     let tree = null,
     let tree = null,
         actualIDShareInfo = {};//项目真实树ID与项目分享信息映射
         actualIDShareInfo = {};//项目真实树ID与项目分享信息映射
+    let curCopySelTree = null;  //拷贝工程建设项目选项树
     const treeCol = 0;
     const treeCol = 0;
     const treeSetting = {
     const treeSetting = {
         tree: {
         tree: {
@@ -893,9 +894,9 @@ const pmShare = (function () {
     //从其他建设项目中复制中,建设项目的文件层次结构名称和顺序
     //从其他建设项目中复制中,建设项目的文件层次结构名称和顺序
     //@param {Array}treeData @return {Array}
     //@param {Array}treeData @return {Array}
     function getFileHierarchyInfo(treeData){
     function getFileHierarchyInfo(treeData){
-        let tree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1});
-        tree.loadDatas(treeData);
-        let items = tree.items;
+        curCopySelTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1});
+        curCopySelTree.loadDatas(treeData);
+        let items = curCopySelTree.items;
         let rst = [];
         let rst = [];
         function getFileHierarchyName(node){
         function getFileHierarchyName(node){
             let nodeName = node.data.name;
             let nodeName = node.data.name;
@@ -920,7 +921,7 @@ const pmShare = (function () {
     function setCopyModal(){
     function setCopyModal(){
         //获取建设项目
         //获取建设项目
         let projQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], projType: {$in: [projectType.project, projectType.folder]}, userID: userID};
         let projQuery = {$or: [{deleteInfo: null}, {'deleteInfo.deleted': false}], projType: {$in: [projectType.project, projectType.folder]}, userID: userID};
-        CommonAjax.post('/pm/api/getProjectsByQuery', {user_id: userID, query: projQuery, options: '-_id -property'}, function (rstData) {
+        CommonAjax.post('/pm/api/getProjectsByQuery', {user_id: userID, query: projQuery, options: '-_id'}, function (rstData) {
             let fileHierarchyData = getFileHierarchyInfo(rstData);
             let fileHierarchyData = getFileHierarchyInfo(rstData);
             $('#copyShare_selectProj').empty();
             $('#copyShare_selectProj').empty();
             for(let proj of fileHierarchyData){
             for(let proj of fileHierarchyData){
@@ -1057,6 +1058,14 @@ const pmShare = (function () {
                 $('#copyShareProj-info').show();
                 $('#copyShareProj-info').show();
                 return;
                 return;
             }
             }
+            //目标建设项目的计税方法与单位工程的一致时,才可拷贝
+            if (curCopySelTree) {
+                let projectNode = curCopySelTree.nodes[curCopySelTree.prefix + selProj];
+                if (!projectNode || !projectNode.data.property || projectNode.data.property.taxType != tree.selected.data.taxType){
+                    alert('当前单位工程计税方法与目标建设项目不一致,不可复制。');
+                    return;
+                }
+            }
             let selEng = $('#copyShare_selectEng').select().val();
             let selEng = $('#copyShare_selectEng').select().val();
             if(!selEng){
             if(!selEng){
                 $('#copyShareEng-info').show();
                 $('#copyShareEng-info').show();

+ 1 - 1
web/over_write/js/chongqing_2018.js

@@ -176,7 +176,7 @@ function overwriteRationCalcBases (taxType){
         // };
         // };
     };
     };
 };
 };
-
+//code为标准接口所需,值是字典规定的
 var cpFeeTypes2018 = [
 var cpFeeTypes2018 = [
     {type: 'rationUnitPrice', name: '定额综合单价', code: '1800'},
     {type: 'rationUnitPrice', name: '定额综合单价', code: '1800'},
     {type: 'labour', name: '人工费', code: '101'},
     {type: 'labour', name: '人工费', code: '101'},