Browse Source

动态投资,项目信息相关

MaiXinRong 1 year ago
parent
commit
5e47ab77e2
6 changed files with 192 additions and 54 deletions
  1. 67 28
      app/public/js/sp_data.js
  2. 9 9
      app/service/sub_proj_info.js
  3. 0 17
      app/view/setting/info.ejs
  4. 71 0
      app/view/sub_proj/info.ejs
  5. 1 0
      config/web.js
  6. 44 0
      sql/update.sql

+ 67 - 28
app/public/js/sp_data.js

@@ -5,16 +5,31 @@ $(document).ready(() => {
             this.spread = SpreadJsObj.createNewSpread(setting.obj);
             this.sheet = this.spread.getActiveSheet();
             SpreadJsObj.initSheet(this.sheet, setting.spreadSetting);
-            this.data = setting.data;
+            if (setting.treeSetting) {
+                this.tree = createNewPathTree('base', setting.treeSetting);
+                this.tree.loadDatas(setting.data);
+            } else {
+                this.data = setting.data;
+            }
             this.type = setting.type;
-            SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Data, this.data);
+            if (setting.treeSetting) {
+                SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Tree, this.tree);
+            } else {
+                SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Data, this.data);
+            }
 
             const self = this;
             this.sheet.bind(spreadNS.Events.EditEnded, function(e, info) {
-                if (!info.sheet.zh_setting || !info.sheet.zh_data) return;
+                if (!info.sheet.zh_setting) {
+                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
+                    return;
+                }
 
-                const node = info.sheet.zh_data[info.row];
-                if (!node) return;
+                const node = SpreadJsObj.getRowObject(info.sheet, info.row);
+                if (!node || (self.tree && node.children && node.children.length > 0)) {
+                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
+                    return;
+                }
 
                 const col = info.sheet.zh_setting.cols[info.col];
                 const data = {};
@@ -44,10 +59,10 @@ $(document).ready(() => {
                 });
             });
             this.sheet.bind(spreadNS.Events.ClipboardPasting, function(e, info) {
-                const setting = info.sheet.zh_setting, sortData = info.sheet.zh_data;
                 info.cancel = true;
+                const setting = info.sheet.zh_setting;
 
-                if (!setting || !sortData) return;
+                if (!setting) return;
                 const pasteData = info.pasteData.html
                     ? SpreadJsObj.analysisPasteHtml(info.pasteData.html)
                     : (info.pasteData.text === ''
@@ -57,7 +72,8 @@ $(document).ready(() => {
                 const uDatas = [];
                 for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
                     const curRow = info.cellRange.row + iRow;
-                    const node = sortData[curRow];
+                    const node = SpreadJsObj.getRowObject(info.sheet, curRow);
+                    if (self.tree && node.children && node.children.length > 0) continue;
 
                     let bPaste = false;
                     const data = {};
@@ -94,16 +110,15 @@ $(document).ready(() => {
                 }
             });
             SpreadJsObj.addDeleteBind(this.spread, function(sheet) {
-                if (!sheet.zh_setting || !sheet.zh_data) return;
+                if (!sheet.zh_setting) return;
 
-                const sortData = sheet.zh_data;
                 const datas = [];
                 const sels = sheet.getSelections();
                 if (!sels || !sels[0]) return;
 
                 for (let iRow = sels[0].row; iRow < sels[0].row + sels[0].rowCount; iRow++) {
                     let bDel = false;
-                    const node = sortData[iRow];
+                    const node = SpreadJsObj.getRowObject(info.sheet, iRow);
                     if (node) {
                         const data = { id: node.id };
                         for (let iCol = sels[0].col; iCol < sels[0].col + sels[0].colCount; iCol++) {
@@ -131,7 +146,9 @@ $(document).ready(() => {
         }
         loadUpdateData(data) {
             for (const d of data) {
-                const source = this.data.find(x => { return x.id === d.id });
+                const source = this.tree
+                    ? this.tree.getItems(d.id)
+                    : this.data.find(x => { return x.id === d.id });
                 if (!source) continue;
 
                 source.dgn_qty = d.dgn_qty;
@@ -140,30 +157,52 @@ $(document).ready(() => {
         }
     }
 
-    const spreadSetting = {
-        cols: [
-            {title: '工程名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 300, formatter: '@', readOnly: true},
-            {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
-            {title: '设计', colSpan: '1', rowSpan: '1', field: 'dgn_qty', hAlign: 2, width: 100, type: 'Number'},
-            {title: '竣工', colSpan: '1', rowSpan: '1', field: 'final_qty', hAlign: 2, width: 100, type: 'Number'},
-        ],
-        emptyRows: 0,
-        headRows: 1,
-        headRowHeight: [32],
-        defaultRowHeight: 21,
-        headerFont: '12px 微软雅黑',
-        font: '12px 微软雅黑',
-    };
     const mainQtyObj = new QtyObj({
         obj: $('#main_qty_spread')[0],
-        spreadSetting,
+        spreadSetting: {
+            cols: [
+                {title: '工程名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 300, formatter: '@', readOnly: true},
+                {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
+                {title: '设计', colSpan: '1', rowSpan: '1', field: 'dgn_qty', hAlign: 2, width: 100, type: 'Number'},
+                {title: '竣工', colSpan: '1', rowSpan: '1', field: 'final_qty', hAlign: 2, width: 100, type: 'Number'},
+            ],
+            emptyRows: 0,
+            headRows: 1,
+            headRowHeight: [32],
+            defaultRowHeight: 21,
+            headerFont: '12px 微软雅黑',
+            font: '12px 微软雅黑',
+        },
         data: mainQty,
+        isTree: false,
         type: 'main_quantity',
     });
     const gclQtyObj = new QtyObj({
         obj: $('#gcl_qty_spread')[0],
-        spreadSetting,
+        spreadSetting: {
+            cols: [
+                {title: '工程名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 300, formatter: '@', readOnly: true, cellType: 'tree'},
+                {title: '单位', colSpan: '1', rowSpan: '1', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
+                {title: '设计', colSpan: '1', rowSpan: '1', field: 'dgn_qty', hAlign: 2, width: 100, type: 'Number'},
+                {title: '竣工', colSpan: '1', rowSpan: '1', field: 'final_qty', hAlign: 2, width: 100, type: 'Number'},
+            ],
+            emptyRows: 0,
+            headRows: 1,
+            headRowHeight: [32],
+            defaultRowHeight: 21,
+            headerFont: '12px 微软雅黑',
+            font: '12px 微软雅黑',
+        },
         data: gclQty,
         type: 'gcl_quantity',
+        isTree: true,
+        treeSetting: {
+            id: 'id',
+            pid: 'pid',
+            order: 'order',
+            level: 'level',
+            fullPath: 'full_path',
+            rootId: -1,
+        }
     })
 });

+ 9 - 9
app/service/sub_proj_info.js

@@ -27,15 +27,15 @@ const defaultInfo = {
         { id: 15, name: '管理及养护房屋', unit: 'm2', dgn_qty: 0, final_qty: 0, },
     ],
     gcl_quantity: [
-        { id: 1, name: '主要人工消耗', unit: '工日', dgn_qty: 0, final_qty: 0, },
-        { id: 2, name: '主要材料消耗', unit: '', dgn_qty: 0, final_qty: 0, },
-        { id: 3, name: '钢材', unit: '吨', dgn_qty: 0, final_qty: 0, },
-        { id: 4, name: '沥青', unit: '吨', dgn_qty: 0, final_qty: 0, },
-        { id: 6, name: '汽油、柴油', unit: '吨', dgn_qty: 0, final_qty: 0, },
-        { id: 7, name: '水泥', unit: '吨', dgn_qty: 0, final_qty: 0, },
-        { id: 8, name: '碎石、砂', unit: 'm3', dgn_qty: 0, final_qty: 0, },
-        { id: 9, name: '电', unit: 'km.h', dgn_qty: 0, final_qty: 0, },
-        { id: 10, name: '主要机械消耗', unit: '台班', dgn_qty: 0, final_qty: 0, },
+        { id: 1, pid: -1, full_path: '1', level: 1, is_leaf: 1, order: 1, name: '主要人工消耗', unit: '工日', dgn_qty: 0, final_qty: 0, },
+        { id: 2, pid: -1, full_path: '2', level: 1, is_leaf: 0, order: 2, name: '主要材料消耗', unit: '', dgn_qty: 0, final_qty: 0, },
+        { id: 3, pid: 2, full_path: '2-3', level: 2, is_leaf: 1, order: 1, name: '钢材', unit: '吨', dgn_qty: 0, final_qty: 0, },
+        { id: 4, pid: 2, full_path: '2-4', level: 2, is_leaf: 1, order: 2, name: '沥青', unit: '吨', dgn_qty: 0, final_qty: 0, },
+        { id: 5, pid: 2, full_path: '2-5', level: 2, is_leaf: 1, order: 3, name: '汽油、柴油', unit: '吨', dgn_qty: 0, final_qty: 0, },
+        { id: 6, pid: 2, full_path: '2-6', level: 2, is_leaf: 1, order: 4, name: '水泥', unit: '吨', dgn_qty: 0, final_qty: 0, },
+        { id: 7, pid: 2, full_path: '2-7', level: 2, is_leaf: 1, order: 5, name: '碎石、砂', unit: 'm3', dgn_qty: 0, final_qty: 0, },
+        { id: 8, pid: 2, full_path: '2-8', level: 2, is_leaf: 1, order: 6, name: '电', unit: 'km.h', dgn_qty: 0, final_qty: 0, },
+        { id: 9, pid: 2, full_path: '2-9', level: 2, is_leaf: 1, order: 7, name: '主要机械消耗', unit: '台班', dgn_qty: 0, final_qty: 0, },
     ],
 };
 

+ 0 - 17
app/view/setting/info.ejs

@@ -54,23 +54,6 @@
                                 <label>创建时间</label>
                                 <input class="form-control form-control-sm" value="<%= dateStr%>" type="text" readonly>
                             </div>
-                            <legend>其他信息(报表显示)</legend>
-                            <div class="form-group">
-                                <label>主管部门</label>
-                                <input class="form-control form-control-sm" type="text" value="<%= projectData.rpt_authority %>" <% if (projectData.user_account !== ctx.session.sessionUser.account) { %>readonly<% } else { %>name="rpt_authority" id="rpt_authority"<% } %>>
-                            </div>
-                            <div class="form-group">
-                                <label>建设项目类别</label>
-                                <input class="form-control form-control-sm" type="text" value="<%= projectData.rpt_items %>" value="<%= projectData.rpt_authority %>" <% if (projectData.user_account !== ctx.session.sessionUser.account) { %>readonly<% } else { %>name="rpt_items" id="rpt_items"<% } %>>
-                            </div>
-                            <div class="form-group">
-                                <label>级别</label>
-                                <input class="form-control form-control-sm" type="text" value="<%= projectData.rpt_level %>" <% if (projectData.user_account !== ctx.session.sessionUser.account) { %>readonly<% } else { %>name="rpt_level" id="rpt_level"<% } %>>
-                            </div>
-                            <div class="form-group">
-                                <label>建设性质</label>
-                                <input class="form-control form-control-sm" type="text" value="<%= projectData.rpt_nature %>" <% if (projectData.user_account !== ctx.session.sessionUser.account) { %>readonly<% } else { %>name="rpt_nature" id="rpt_nature"<% } %>>
-                            </div>
                             <% if (projectData.user_account === ctx.session.sessionUser.account) { %></form><% } %>
                     </div>
                 </div>

+ 71 - 0
app/view/sub_proj/info.ejs

@@ -14,6 +14,77 @@
             <div class="sjs-height-0" style="height: 570px;">
                 <div class="col-9 px-3">
                     <div>
+                        <div class="py-2 font-weight-bold">项目信息</div>
+                        <div class="form-group">
+                            <label for="">建设项目名称:</label>
+                            <input type="text" class="form-control form-control-sm" name="proj_name" value="<%- info.proj_name %>" org="<%- info.proj_name %>" maxlength="100" placeholder="请输入建设项目名称" oninput="limitMaxLength(this)" onblur="changeInfo(this)">
+                        </div>
+                        <div class="form-group">
+                            <label for="">主管部门:</label>
+                            <input type="text" class="form-control form-control-sm" name="chief_department" value="<%- info.chief_department %>" org="<%- info.chief_department %>" maxlength="100" placeholder="指建设单位的主管部门" oninput="limitMaxLength(this)" onblur="changeInfo(this)">
+                        </div>
+                        <div class="row">
+                            <div class="col-3">
+                                <div class="form-group">
+                                    <label for="">建设项目类型:</label>
+                                    <select class="form-control form-control-sm" name="proj_type" value="<%- info.proj_type %>" org="<%- info.proj_type %>" onchange="changeInfo(this)">
+                                        <option value="">请选择</option>
+                                        <option value="大中型" <%if (info.proj_type === '大中型') { %>selected<% } %>>大中型</option>
+                                        <option value="小型" <%if (info.proj_type === '小型') { %>selected<% } %>>小型</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-3">
+                                <div class="form-group">
+                                    <label for="">建设性质:</label>
+                                    <select class="form-control form-control-sm" name="proj_quality" value="<%- info.proj_quality %>" org="<%- info.proj_quality %>" onchange="changeInfo(this)">
+                                        <option value="">请选择</option>
+                                        <option value="新建" <%if (info.proj_quality === '新建') { %>selected<% } %>>新建</option>
+                                        <option value="改建" <%if (info.proj_quality === '改建') { %>selected<% } %>>改建</option>
+                                        <option value="扩建" <%if (info.proj_quality === '扩建') { %>selected<% } %>>扩建</option>
+                                        <option value="改扩建" <%if (info.proj_quality === '改扩建') { %>selected<% } %>>改扩建</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-3">
+                                <div class="form-group">
+                                    <label for="">级别:</label>
+                                    <select class="form-control form-control-sm" name="proj_level" value="<%- info.proj_level %>" org="<%- info.proj_level %>" onchange="changeInfo(this)">
+                                        <option value="">请选择</option>
+                                        <option value="中央级" <%if (info.proj_level === '中央级') { %>selected<% } %>>中央级</option>
+                                        <option value="地方级" <%if (info.proj_level === '地方级') { %>selected<% } %>>地方级</option>
+                                        <option value="其他" <%if (info.proj_level === '其他') { %>selected<% } %>>其他</option>
+                                    </select>
+                                </div>
+                            </div>
+                            <div class="col-3"></div>
+                        </div>
+                        <div class="row">
+                            <div class="col-3">
+                                <div class="form-group">
+                                    <label for="">计划开工:</label>
+                                    <input type="date" class="form-control form-control-sm" name="plan_start_date" value="<%- info.plan_start_date %>" org="<%- info.plan_start_date %>" placeholder="请输入" onchange="changeInfo(this)">
+                                </div>
+                            </div>
+                            <div class="col-3">
+                                <div class="form-group">
+                                    <label for="">计划完成:</label>
+                                    <input type="date" class="form-control form-control-sm" name="plan_finish_date" value="<%- info.plan_finish_date %>" org="<%- info.plan_finish_date %>" placeholder="请输入" onchange="changeInfo(this)">
+                                </div>
+                            </div>
+                            <div class="col-3">
+                                <div class="form-group">
+                                    <label for="">实际开工:</label>
+                                    <input type="date" class="form-control form-control-sm" name="real_start_date" value="<%- info.real_start_date %>" org="<%- info.real_start_date %>" placeholder="请输入" onchange="changeInfo(this)">
+                                </div>
+                            </div>
+                            <div class="col-3">
+                                <div class="form-group">
+                                    <label for="">实际完成:</label>
+                                    <input type="date" class="form-control form-control-sm" name="real_finish_date" value="<%- info.real_finish_date %>" org="<%- info.real_finish_date %>"placeholder="请输入" onchange="changeInfo(this)">
+                                </div>
+                            </div>
+                        </div>
                         <div class="py-2 font-weight-bold">立项批准(核准)情况:</div>
                         <div class="row">
                             <div class="col-6">

+ 1 - 0
config/web.js

@@ -1046,6 +1046,7 @@ const JsFiles = {
                     '/public/js/spreadjs/sheets/v11/gc.spread.sheets.all.11.2.2.min.js',
                 ],
                 mergeFiles: [
+                    '/public/js/path_tree.js',
                     '/public/js/spreadjs_rela/spreadjs_zh.js',
                     '/public/js/sub_menu.js',
                     '/public/js/sp_data.js',

+ 44 - 0
sql/update.sql

@@ -22,5 +22,49 @@ ADD COLUMN `state` tinyint(1) NOT NULL DEFAULT 3 COMMENT '变更令状态(计量
 ALTER TABLE `zh_change`
 ADD COLUMN `delimit` int(4) NOT NULL DEFAULT 100 COMMENT '计量上限值(用于对比项目及更新清单上限值)' AFTER `state`;
 
+CREATE TABLE `zh_sub_project_info` (
+  `id` varchar(36) COLLATE utf8_unicode_ci NOT NULL COMMENT 'uuid',
+  `project_id` int(11) unsigned NOT NULL COMMENT '项目id',
+  `proj_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '建设项目名称',
+  `chief_department` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '主管部门',
+  `proj_type` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '建设项目类型',
+  `proj_quality` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '建设项目性质',
+  `proj_level` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '级别',
+  `plan_start_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '计划开工',
+  `plan_finish_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '计划完工',
+  `real_start_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '实际开工',
+  `real_finish_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '实际完工',
+  `lx_department` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '立项-部门',
+  `lx_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '立项-日期',
+  `lx_code` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '立项-文号',
+  `cb_department` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '初步-部门',
+  `cb_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '初步-日期',
+  `cb_code` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '初步-文号',
+  `sg_department` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '施工许可批复-部门',
+  `sg_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '施工许可批复-日期',
+  `sg_code` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '施工许可批复-文号',
+  `jg_department` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '交工-部门',
+  `jg_date` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '交工-日期',
+  `jg_code` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '交工-文号',
+  `jg_quality_score` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '交工-工程质量评分',
+  `jg_level` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '交工-等级',
+  `unit_construction` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '单位-建设单位',
+  `unit_qa` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '单位-质量监督机构',
+  `unit_design` varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '单位-主要设计单位',
+  `unit_supervision` varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '单位-主要监理单位',
+  `unit_contract` varchar(1000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '单位-主要施工单位',
+  `mainline_length` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '主线公路里程',
+  `branch_length` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '支线里程',
+  `road_level` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '公路等级',
+  `design_speed` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '公路设计速度',
+  `design_load` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '设计荷载',
+  `bed_width` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '路基宽度',
+  `tunnel_width` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '隧道净宽',
+  `quake_peak_value` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT '地震动峰值系数',
+  `main_quantity` json DEFAULT NULL COMMENT '主要工程数据',
+  `gcl_quantity` json DEFAULT NULL COMMENT '工料机消耗',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
 -- 更新所有已勾选计量不计价项目的负批复变更数量值清单为不计价
 UPDATE `calculation`.zh_change_audit_list SET `is_valuation` = 0 WHERE `id` IN (SELECT id FROM (SELECT a.id FROM `calculation`.zh_change_audit_list as a LEFT JOIN `calculation`.`zh_tender` as t ON a.tid = t.id LEFT JOIN `calculation`.`zh_project` as p ON p.id = t.project_id LEFT JOIN `calculation`.`zh_change` as c ON c.cid = a.cid WHERE c.`status` = 3 AND a.`spamount` < 0 AND p.fun_rela != '' AND p.fun_rela IS NOT NULL AND JSON_CONTAINS(p.fun_rela, JSON_OBJECT('minusNoValue', true))) as aa)