MaiXinRong 6 дней назад
Родитель
Сommit
22b8fb70b6
3 измененных файлов с 8 добавлено и 3 удалено
  1. 1 1
      app/public/js/cost_stage_analysis.js
  2. 5 1
      app/service/cost_stage_analysis.js
  3. 2 1
      sql/update.sql

+ 1 - 1
app/public/js/cost_stage_analysis.js

@@ -350,7 +350,7 @@ $(document).ready(function() {
                 case 'num_o':
                 case 'num_o':
                 case 'num_p':
                 case 'num_p':
                     info.cancel = node.tree_level === 1 || (node.children && node.children.length > 0);
                     info.cancel = node.tree_level === 1 || (node.children && node.children.length > 0);
-                    if (!info.cancel) info.cancel = !!node.import_cost_id || (detailRange && detailRange.length > 0);
+                    if (!info.cancel) info.cancel = (!!node.import_cost_id && !!node.import_cost_type) || (detailRange && detailRange.length > 0);
                     break;
                     break;
             }
             }
         }
         }

+ 5 - 1
app/service/cost_stage_analysis.js

@@ -17,7 +17,7 @@ const costFields = {
     hisFields: ['calc_his'],
     hisFields: ['calc_his'],
     taxFields: ['tax'],
     taxFields: ['tax'],
     treeFields: ['tree_id', 'tree_pid', 'tree_level', 'tree_order', 'tree_full_path', 'tree_is_leaf'],
     treeFields: ['tree_id', 'tree_pid', 'tree_level', 'tree_order', 'tree_full_path', 'tree_is_leaf'],
-    baseFields: ['id', 'cost_id', 'tender_id', 'stage_id', 'node_type', 'calc_type', 'has_detail', 'import_cost_id'],
+    baseFields: ['id', 'cost_id', 'tender_id', 'stage_id', 'node_type', 'calc_type', 'has_detail', 'import_cost_id', 'import_cost_type'],
 };
 };
 costFields.sumFields = [...costFields.calcFields, ...costFields.selfCalcFields];
 costFields.sumFields = [...costFields.calcFields, ...costFields.selfCalcFields];
 costFields.preCopyFields = [...costFields.treeFields, ...costFields.textFields, ...costFields.selfTextFields, ...costFields.calcFields, ...costFields.selfCalcFields, ...costFields.taxFields];
 costFields.preCopyFields = [...costFields.treeFields, ...costFields.textFields, ...costFields.selfTextFields, ...costFields.calcFields, ...costFields.selfCalcFields, ...costFields.taxFields];
@@ -185,6 +185,7 @@ module.exports = app => {
                 idata.calc_type = pl.calc_type;
                 idata.calc_type = pl.calc_type;
                 idata.has_detail = pl.has_detail && pl.detail.length > 0;
                 idata.has_detail = pl.has_detail && pl.detail.length > 0;
                 idata.import_cost_id = pl.import_cost_id;
                 idata.import_cost_id = pl.import_cost_id;
+                idata.import_cost_type = pl.import_cost_type;
                 if (!idata.has_detail) {
                 if (!idata.has_detail) {
                     for (const prop of costFields.preCopyFields) {
                     for (const prop of costFields.preCopyFields) {
                         idata[prop] = pl[prop];
                         idata[prop] = pl[prop];
@@ -222,6 +223,7 @@ module.exports = app => {
         //         idata.calc_type = pl.calc_type;
         //         idata.calc_type = pl.calc_type;
         //         idata.has_detail = pl.has_detail && pl.detail.length > 0;
         //         idata.has_detail = pl.has_detail && pl.detail.length > 0;
         //         idata.import_cost_id = pl.import_cost_id;
         //         idata.import_cost_id = pl.import_cost_id;
+        //         idata.import_cost_type = pl.import_cost_type;
         //         if (!idata.has_detail) {
         //         if (!idata.has_detail) {
         //             for (const prop of costFields.preCopyFields) {
         //             for (const prop of costFields.preCopyFields) {
         //                 idata[prop] = pl[prop];
         //                 idata[prop] = pl[prop];
@@ -674,7 +676,9 @@ module.exports = app => {
                         updateData[prop] = this.ctx.helper.add(updateData[prop], id[prop]);
                         updateData[prop] = this.ctx.helper.add(updateData[prop], id[prop]);
                     }
                     }
                 }
                 }
+                updateData.import_cost_type = insertDetails[0].is_deal ? 2 : 1;
             } else {
             } else {
+                updateData.import_cost_type = 0;
                 for (const node of nodes) {
                 for (const node of nodes) {
                     updateData.yf_excl_tax_tp = this.ctx.helper.add(updateData.yf_excl_tax_tp, node.end_yf_excl_tax_tp || 0);
                     updateData.yf_excl_tax_tp = this.ctx.helper.add(updateData.yf_excl_tax_tp, node.end_yf_excl_tax_tp || 0);
                     updateData.sf_excl_tax_tp = this.ctx.helper.add(updateData.sf_excl_tax_tp, node.end_sf_excl_tax_tp || 0);
                     updateData.sf_excl_tax_tp = this.ctx.helper.add(updateData.sf_excl_tax_tp, node.end_sf_excl_tax_tp || 0);

+ 2 - 1
sql/update.sql

@@ -22,7 +22,8 @@ ADD COLUMN `cost_ledger_col_set` json NULL COMMENT '成本报审-列设置' AFTE
 
 
 ALTER TABLE `zh_cost_stage_analysis`
 ALTER TABLE `zh_cost_stage_analysis`
 ADD COLUMN `has_detail` int(1) NOT NULL DEFAULT 0 COMMENT '是否含有明细' AFTER `calc_type`,
 ADD COLUMN `has_detail` int(1) NOT NULL DEFAULT 0 COMMENT '是否含有明细' AFTER `calc_type`,
-ADD COLUMN `import_cost_id` varchar(5000) NOT NULL DEFAULT '' COMMENT '导入的成本id' AFTER `has_detail`;
+ADD COLUMN `import_cost_id` varchar(5000) NOT NULL DEFAULT '' COMMENT '导入的成本id' AFTER `has_detail`,
+ADD COLUMN `import_cost_type` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '导入的成本类型(0无明细,1普通,2合同)' AFTER `import_cost_id`;
 
 
 CREATE TABLE `zh_budget_real`  (
 CREATE TABLE `zh_budget_real`  (
   `id` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '自增id',
   `id` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '自增id',