Browse Source

1.修复工料机汇总页面错误提示
2.新增项目管理页面侧滑功能

olym 7 years ago
parent
commit
dac69e4dfe

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

@@ -77,7 +77,8 @@ module.exports = {
         ProjectsData.getUserProject(req.session.sessionUser.ssoId, data.proj_id, async function(err, message, data){
         ProjectsData.getUserProject(req.session.sessionUser.ssoId, data.proj_id, async function(err, message, data){
             if (err === 0) {
             if (err === 0) {
                 let engineeringLibModel = new EngineeringLibModel();
                 let engineeringLibModel = new EngineeringLibModel();
-                let engineeringInfo = await engineeringLibModel.getEngineering(data.property.engineering_id);
+                let engineeringInfo = data.property !== null && data.property.engineering_id !== undefined ?
+                    await engineeringLibModel.getEngineering(data.property.engineering_id) : [];
                 let strData = JSON.stringify(data);
                 let strData = JSON.stringify(data);
                 let projInfo = JSON.parse(strData);
                 let projInfo = JSON.parse(strData);
                 projInfo.engineeringInfo = engineeringInfo;
                 projInfo.engineeringInfo = engineeringInfo;

+ 0 - 4
web/building_saas/js/global.js

@@ -26,10 +26,6 @@ function getQueryString(name) {
 $(window).resize(autoFlashHeight);
 $(window).resize(autoFlashHeight);
 /*全局自适应高度结束*/
 /*全局自适应高度结束*/
 $(function(){
 $(function(){
-/*侧滑*/
-$(".open-sidebar").click(function(){
-    $(".slide-sidebar").animate({width:"800"}).addClass("open");
-});
 $("body").click(function(event){
 $("body").click(function(event){
         var e = event || window.event; //浏览器兼容性
         var e = event || window.event; //浏览器兼容性
         if(!$(event.target).is('a')) {
         if(!$(event.target).is('a')) {

+ 10 - 55
web/building_saas/pm/html/project-management.html

@@ -21,6 +21,9 @@
         .hidden-area{
         .hidden-area{
             display: none;
             display: none;
         }
         }
+        #summary-engineering,#summary-project{
+            display: none;
+        }
     </style>
     </style>
 </head>
 </head>
 
 
@@ -158,9 +161,9 @@
     <div class="slide-sidebar">
     <div class="slide-sidebar">
         <div class="side-content">
         <div class="side-content">
             <!--建设项目汇总-->
             <!--建设项目汇总-->
-            <div class="p-3">
-                <legend>船体生产车间 汇总</legend>
-                <table class="table table-bordered table-hover table-sm">
+            <div class="p-3" id="summary-project">
+                <legend><span id="summary-project-name">船体生产车间</span> 汇总</legend>
+                <table class="table table-bordered table-hover table-sm" id="summary-project-table">
                     <thead>
                     <thead>
                     <tr>
                     <tr>
                         <th rowspan="2"></th>
                         <th rowspan="2"></th>
@@ -175,55 +178,7 @@
                         <th>规费(元)</th>
                         <th>规费(元)</th>
                     </tr>
                     </tr>
                     </thead>
                     </thead>
-                    <tbody>
-                    <tr>
-                        <td>1</td>
-                        <td>1</td>
-                        <td>6号生产车间</td>
-                        <td>12345.67</td>
-                        <td>5436.87</td>
-                        <td>54345.68</td>
-                        <td>514.54</td>
-                    </tr>
-                    <tr>
-                        <td>2</td>
-                        <td>2</td>
-                        <td>7号生产车间</td>
-                        <td>12345.67</td>
-                        <td>5436.87</td>
-                        <td>54345.68</td>
-                        <td>514.54</td>
-                    </tr>
-                    <tr>
-                        <td>3</td>
-                        <td>3</td>
-                        <td>8号生产车间</td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                    </tr>
-                    <tr>
-                        <td>4</td>
-                        <td>4</td>
-                        <td>9号生产车间</td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                        <td> </td>
-                    </tr>
-                    <tr>
-                        <td>4</td>
-                        <td> </td>
-                        <td>合计</td>
-                        <td>110789.36</td>
-                        <td>5971.32</td>
-                        <td>58900.46</td>
-                        <td>1049.41
-
-                        </td>
-                    </tr>
-                    </tbody>
+                    <tbody></tbody>
                 </table>
                 </table>
                 <div class="row">
                 <div class="row">
                     <div class="col-md-6">
                     <div class="col-md-6">
@@ -251,9 +206,9 @@
                 </div>
                 </div>
             </div>
             </div>
             <!--单项工程汇总-->
             <!--单项工程汇总-->
-            <div class="p-3">
-                <legend>6号生产车间 汇总</legend>
-                <table class="table table-bordered table-hover table-sm">
+            <div class="p-3" id="summary-engineering">
+                <legend><span id="summary-engineering-name">6号生产车间</span> 汇总</legend>
+                <table class="table table-bordered table-hover table-sm" id="summary-engineering-table">
                     <thead>
                     <thead>
                     <tr>
                     <tr>
                         <th rowspan="2"></th>
                         <th rowspan="2"></th>

+ 63 - 0
web/building_saas/pm/js/pm_main.js

@@ -40,6 +40,7 @@ let ProjTreeSetting = {
             event: {
             event: {
                 getText: function (html, node, text) {
                 getText: function (html, node, text) {
                     let className = '';
                     let className = '';
+                    let aClassName = '';
                     switch (node.data.projType) {
                     switch (node.data.projType) {
                         case projectType.folder:
                         case projectType.folder:
                             className = "fa fa-folder-open-o";
                             className = "fa fa-folder-open-o";
@@ -49,14 +50,19 @@ let ProjTreeSetting = {
                             break;
                             break;
                         case projectType.project:
                         case projectType.project:
                             className = "fa fa-cubes";
                             className = "fa fa-cubes";
+                            aClassName = "open-sidebar";
                             break;
                             break;
                         case projectType.engineering:
                         case projectType.engineering:
                             className = "fa fa-cube";
                             className = "fa fa-cube";
+                            aClassName = "open-sidebar";
                             break;
                             break;
                     }
                     }
                     let icon = '<i class ="tree-icon '+ className +'"></i>';
                     let icon = '<i class ="tree-icon '+ className +'"></i>';
                     html.push((node && node.data && node.data.projType === projectType.folder) ? '&nbsp;' : '');
                     html.push((node && node.data && node.data.projType === projectType.folder) ? '&nbsp;' : '');
                     html.push('<a ');
                     html.push('<a ');
+                    if (aClassName !== '') {
+                        html.push('class="'+ aClassName +'" ');
+                    }
                     if (node && node.data) {
                     if (node && node.data) {
                         //html.push('href="/main?project=', node.id(), '"');
                         //html.push('href="/main?project=', node.id(), '"');
                         html.push('href="javacript:void(0);"');
                         html.push('href="javacript:void(0);"');
@@ -144,6 +150,12 @@ let ProjTreeSetting = {
 $(document).ready(function() {
 $(document).ready(function() {
     init();
     init();
 
 
+    // 侧滑数据
+    $(".poj-list").on('click', ".open-sidebar", function() {
+        setDataToSideBar();
+        $(".slide-sidebar").animate({width:"800"}).addClass("open");
+    });
+
     // 新增建设项目点击
     // 新增建设项目点击
     $('#add-project-btn').click(function () {
     $('#add-project-btn').click(function () {
         let selectedItem = Tree.selected();
         let selectedItem = Tree.selected();
@@ -1065,4 +1077,55 @@ function getUnitFile(parentID) {
         }
         }
     });
     });
 
 
+}
+
+/**
+ * 加载数据到侧边栏
+ *
+ * @return {void}
+ */
+function setDataToSideBar() {
+    // 获取当前点击的数据
+    let selectedItem = Tree.selected();
+    let name = selectedItem.data.name;
+    let target = selectedItem.data.projType === projectType.project ? '#summary-project' : '#summary-engineering';
+    $(".side-content .p-3").hide();
+    $(target).show();
+    $(target + '-name').html(name);
+
+    // if (selectedItem.data.projType === projectType.project) {
+        if (selectedItem.children.length <= 0) {
+            return;
+        }
+        // 建设项目相关
+        let counter = 1;
+        let html = '';
+        for(let tmp of selectedItem.children) {
+            html += '<tr>' +
+                '<td>'+ counter +'</td>' +
+                '<td>'+ counter +'</td>' +
+                '<td>'+ tmp.data.name +'</td>' +
+                '<td></td>' +
+                '<td></td>' +
+                '<td></td>' +
+                '<td></td>' +
+                '</tr>';
+
+        }
+        html += '<tr>' +
+            '<td>'+ (counter + 1) +'</td>' +
+            '<td> </td>' +
+            '<td>合计</td>' +
+            '<td></td>' +
+            '<td></td>' +
+            '<td></td>' +
+            '<td></td>' +
+            '</tr>';
+        $(target + '-table tbody').html(html);
+    // } else {
+        // 单项工程相关
+
+    // }
+
+
 }
 }