Просмотр исходного кода

加载例题“纵横”改为大司空

vian 6 лет назад
Родитель
Сommit
6ed90ff98d
2 измененных файлов с 20 добавлено и 6 удалено
  1. 2 1
      web/building_saas/pm/js/pm_newMain.js
  2. 18 5
      web/building_saas/pm/js/pm_tree.js

+ 2 - 1
web/building_saas/pm/js/pm_newMain.js

@@ -1724,6 +1724,7 @@ $(document).ready(function() {
 
     //绑定新建建设项目、新建单项工程、新建文件夹、重命名Enter键事件
     bindInputs($('#project-name'), $('#engineering-name'), $('#folder-name'), $('#rename-name'));
+    //绑定新建窗口显示事件
     bindModalShown($('#add-folder-dialog'), $('#add-project-dialog'), $('#add-engineering-dialog'), $('#add-tender-dialog'));
     //绑定新建建设项目、新建单项工程、新建文件夹、重命名弹窗隐藏事件
     bindModalsHidden($('#add-project-dialog'), $('#add-engineering-dialog'), $('#add-folder-dialog'), $('#rename-dialog'));
@@ -2840,7 +2841,7 @@ function init(refresh = false) {
     if(refresh == false) socketObject.connect('pm');//socket 连接;
     if (isFirst) {
         let pr = new SCComponent.InitProgressBar();
-        pr.start('欢迎使用纵横建筑计价', '首次加载例题,请稍候……');
+        pr.start('欢迎使用大司空计价', '首次加载例题,请稍候……');
         CommonAjax.post('/pm/api/prepareInitialData', {user_id: userID}, function () {
             initProjects(function () {
                 pr.end();

+ 18 - 5
web/building_saas/pm/js/pm_tree.js

@@ -4,11 +4,10 @@
 const pmTree = {
     createNew: function (setting, arrData) {
         function sortTreeItems(tree) {
-            var addItems = function (items) {
-                var i;
-                for (i = 0; i < items.length; i++) {
-                    tree.items.push(items[i]);
-                    addItems(items[i].children);
+            const addItems = function (items) {
+                for (const item of items) {
+                    tree.items.push(item);
+                    addItems(item.children);
                 }
             };
             tree.items.splice(0, tree.items.length);
@@ -254,6 +253,7 @@ const pmTree = {
             };
 
             Tree.prototype.loadData = function (arrData) {
+                this.sourceData = arrData;
                 let i, that = this;
                 let nodesIndex = {};
                 function getPreNode(id){
@@ -380,6 +380,15 @@ const pmTree = {
             };
 
             Tree.prototype.check = function (_root) {
+                if (this.sourceData.length !== this.items.length) {
+                    const data = this.sourceData.filter(item => {
+                        const findData = this.items.find(node => node.data.ID === item.ID);
+                        return !findData;
+                    });
+                    console.log('丢失数据:');
+                    console.log(data);
+                    return false;
+                }
                 return isValid(_root.children);
                 function isValid(nodes) {
                     for (let node of nodes) {
@@ -408,6 +417,10 @@ const pmTree = {
                             console.log(`${node.serialNo() + 1}:${node.data.name} node索引大于next索引`);
                             return false;
                         }
+                        if (node.nextSibling && node.parent !== node.nextSibling.parent) {
+                            console.log(`${node.serialNo() + 1}:${node.data.name} 与兄弟节点 ${node.nextSibling.serialNo() + 1}:${node.nextSibling.data.name} 父节点不同`);
+                            return false;
+                        }
                         if (node.children.length) {
                             let v = isValid(node.children);
                             if (!v) {