Browse Source

billsLib to uuid

zhongzewei 7 years ago
parent
commit
e50d2ae9ac

+ 3 - 3
modules/bills_lib/models/bills_lib_schemas.js

@@ -37,9 +37,9 @@ let itemsSchema = mongoose.Schema({
     {versionKey: false});
 
 let billsSchema = mongoose.Schema({
-    ID: Number,
-    ParentID: Number,
-    NextSiblingID: Number,
+    ID: String,
+    ParentID: String,
+    NextSiblingID: String,
     code: String,
     name: String,
     unit: String,

+ 2 - 1
public/counter/counter.js

@@ -33,7 +33,8 @@ const COUNTER_MODULE_NAME = {
     billsLib: 'billsLib',
     billsLib_jobs: 'billsLib_jobs',
     billsLib_items: 'billsLib_items',
-    coeList: 'coeList'
+    coeList: 'coeList',
+    installation: 'installation'
 }
 /*const PROJECT_COUNTER = 'projects', USER_COUNTER = 'users', BILL_COUNTER = 'bills', RATION_COUNTER = 'rations',
     REPORT_COUNTER = 'rptTemplates', FEE_COUNTER = 'fees'*/

+ 8 - 8
public/web/id_tree.js

@@ -422,7 +422,7 @@ var idTree = {
             }
         })();
         Tree.prototype.newNodeID = function () {
-            if (this.rangeNodeID() === -1) {
+            if (this.rangeNodeID() == -1) {
                 return this.maxNodeID() + 1;
             } else {
                 if (this.maxNodeID() < this.rangeNodeID()) {
@@ -460,7 +460,7 @@ var idTree = {
             // set parent by pid, set nextSibling by nid
             datas.forEach(function (data) {
                 node = that.nodes[prefix + data[that.setting.id]];
-                if (data[that.setting.pid] === that.setting.rootId) {
+                if (data[that.setting.pid] == that.setting.rootId) {
                     that.roots.push(node);
                 } else {
                     parent = that.nodes[prefix + data[that.setting.pid]];
@@ -500,8 +500,8 @@ var idTree = {
 
         Tree.prototype.insert = function (parentID, nextSiblingID) {
             var newID = this.newNodeID(), node = null, data = {};
-            var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
-            var nextSibling = nextSiblingID === -1 ? null: this.nodes[this.prefix + nextSiblingID];
+            var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
+            var nextSibling = nextSiblingID == -1 ? null: this.nodes[this.prefix + nextSiblingID];
             if (newID !== -1) {
                 data = {};
                 data[this.setting.id] = newID;
@@ -522,8 +522,8 @@ var idTree = {
         Tree.prototype.getInsertData = function (parentID, nextSiblingID) {
             var data = [];
             var newID = this.newNodeID();
-            var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
-            var nextSibling = nextSiblingID === -1 ? null: this.nodes[this.prefix + nextSiblingID];
+            var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
+            var nextSibling = nextSiblingID == -1 ? null: this.nodes[this.prefix + nextSiblingID];
             if (newID !== -1) {
                 data.push({type: 'new', data: this.getDataTemplate(newID, parent ? parent.getID() : this.setting.rootId, nextSibling ? nextSibling.getID() : this.setting.rootId)});
 
@@ -538,8 +538,8 @@ var idTree = {
             return data;
         };
         Tree.prototype.insertByData = function (data, parentID, nextSiblingID) {
-            var parent = parentID === -1 ? null : this.nodes[this.prefix + parentID];
-            var nextSibling = nextSiblingID === -1 ? null : this.nodes[this.prefix + nextSiblingID];
+            var parent = parentID == -1 ? null : this.nodes[this.prefix + parentID];
+            var nextSibling = nextSiblingID == -1 ? null : this.nodes[this.prefix + nextSiblingID];
             var node = this.nodes[this.prefix + data[this.setting.id]];
             if (node) {
                 return node;

File diff suppressed because it is too large
+ 1 - 0
public/web/uuid.js


+ 1 - 0
web/maintain/bills_lib/html/qingdan.html

@@ -238,6 +238,7 @@
     <!-- JS. -->
     <script src="/lib/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js"></script>
     <script>GC.Spread.Sheets.LicenseKey = "559432293813965#A0y3iTOzEDOzkjMyMDN9UTNiojIklkI1pjIEJCLi4TPB9mM5AFNTd4cvZ7SaJUVy3CWKtWYXx4VVhjMpp7dYNGdx2ia9sEVlZGOTh7NRlTUwkWR9wEV4gmbjBDZ4ElR8N7cGdHVvEWVBtCOwIGW0ZmeYVWVr3mI0IyUiwCMzETN8kzNzYTM0IicfJye&Qf35VfiEzRwEkI0IyQiwiIwEjL6ByUKBCZhVmcwNlI0IiTis7W0ICZyBlIsIyNyMzM5ADI5ADNwcTMwIjI0ICdyNkIsIibj9SbvNmL4N7bjRnch56ciojIz5GRiwiI8+Y9sWY9QmZ0Jyp96uL9v6L0wap9biY9qiq95q197Wr9g+89iojIh94Wiqi";</script>
+    <script src="/public/web/uuid.js"></script>
     <script src="/lib/jquery/jquery.min.js"></script>
     <script src="/lib/tether/tether.min.js"></script>
     <script src="/lib/bootstrap/bootstrap.min.js"></script>

+ 9 - 3
web/maintain/bills_lib/scripts/db_controller.js

@@ -8,7 +8,9 @@ var dbController = {
         btn.attr('doing', 'true');
         if(controller.tree.items.length === 0){
             controller.tree.maxNodeID(0);
-            let newNodeId = controller.tree.newNodeID();
+           // let newNodeId = controller.tree.newNodeID();
+            let newNodeId = uuid.v1();
+            console.log(newNodeId);
             let sectionInfo = {first: null, second: null, third: null};
             billsAjax.createBills(userAccount, billsLibId, newNodeId, -1 , -1, null, sectionInfo, function(){
                 controller.insert();
@@ -24,7 +26,9 @@ var dbController = {
             let node = controller.tree.selected;
             if(node){
                 var updateId = node.getID(), createpid = node.getParentID(), createnid = node.getNextSiblingID();
-                let newNodeId = controller.tree.newNodeID();
+                //let newNodeId = controller.tree.newNodeID();
+                let newNodeId = uuid.v1();
+                console.log(newNodeId);
                 let updatePreData = {ID: updateId, NextSiblingID: newNodeId};
                 let sectionInfo = tools.getSectionInfo(node);
                 billsAjax.createBills(userAccount, billsLibId, newNodeId, createpid, createnid, updatePreData, sectionInfo, function(){
@@ -40,7 +44,9 @@ var dbController = {
             else {
                 let updateNode = controller.tree.roots[controller.tree.roots.length - 1];
                 let updateId = updateNode.getID();
-                let newNodeId = controller.tree.newNodeID();
+                //let newNodeId = controller.tree.newNodeID();
+                let newNodeId = uuid.v1();
+                console.log(newNodeId);
                 let updatePreData = {ID: updateId, NextSiblingID: newNodeId};
                 let sectionInfo = tools.getSectionInfo(node);
                 billsAjax.createBills(userAccount, billsLibId, newNodeId, -1, -1, updatePreData, sectionInfo, function(){