Browse Source

标段列表排序同步

laiguoran 3 năm trước cách đây
mục cha
commit
1a4a2e02fe

+ 11 - 2
app/public/js/setting_datacollect_tender.js

@@ -16,6 +16,12 @@ function findNode (key, value, arr) {
         }
     }
 }
+// 分类数据排序
+function sortCategory() {
+    category.sort(function (a, b) {
+        return a.level ? (b.level ? a.level - b.level : -1) : a.id - b.id;
+    });
+}
 // 初始化TenderTree数据
 function initTenderTree () {
     const levelCategory = category.filter(function (c) {
@@ -81,6 +87,7 @@ function initTenderTree () {
             tenderTree.push(t);
         }
     }
+    sortTenderTree();
 }
 function recursiveGetTenderNodeHtml (node, arr, pid) {
     // console.log(node, tender)
@@ -133,10 +140,12 @@ function getTenderTreeHtml () {
     }
 }
 $(document).ready(function () {
+    sortCategory();
     initTenderTree();
     $('#tenderBtn').click(() => {
-        const html = getTenderTreeHtml();
-        $('#copyModalContent').html(html);
+        tenderListOrder.reOrderTenders('', '#copyModalContent', false);
+        // const html = getTenderTreeHtml();
+        // $('#copyModalContent').html(html);
         $('#sort input[value="'+ addDataCollect +'"]').prop('checked', true);
         if($('#copyModalContent input[type="checkbox"]:not(:checked)').length === 0) {
             $('#select-tender-all').prop('checked', true);

+ 3 - 3
app/public/js/shares/tender_list_order.js

@@ -28,7 +28,7 @@ const tenderListOrder = (function () {
         // }
         return pinyin.compareWord(x, y);
     }
-    function reOrderTenders (orderStr) {
+    function reOrderTenders (orderStr, htmlClass = '.c-body', loadHide = true) {
         if (orderStr) {
             orderSetting = orderStr;
             setLocalCache('zh-calc-tender-list-order', orderStr);
@@ -51,8 +51,8 @@ const tenderListOrder = (function () {
             })
         }
         initTenderTree();
-        $('.c-body').html(getTenderTreeHtml());
-        localHideList();
+        $(htmlClass).html(getTenderTreeHtml());
+        if (loadHide) localHideList();
     }
     function getOrderButton(field) {
         const orders = orderSetting.split('|');

+ 4 - 1
app/view/setting/datacollect.ejs

@@ -45,11 +45,14 @@
     </div>
 </div>
 <script src="/public/js/setting_datacollect_tender.js"></script>
+<script src="/public/js/PinYinOrder.bundle.js"></script>
+<script src="/public/js/tender_showhide.js"></script>
+<script src="/public/js/shares/tender_list_order.js"></script>
 <script>
     let dataCollectPages = JSON.parse(unescape('<%- escape(JSON.stringify(projectData.data_collect_pages)) %>'));
     let dataCollect = parseInt('<%- ctx.session.sessionProject.dataCollect %>');
-    const tenders = JSON.parse(unescape('<%- escape(JSON.stringify(tenders)) %>'));
     const category = JSON.parse(unescape('<%- escape(JSON.stringify(categoryData)) %>'));
+    const tenders = JSON.parse(unescape('<%- escape(JSON.stringify(tenders)) %>'));
     let dcTenders = JSON.parse(unescape('<%- escape(JSON.stringify(dcTenders)) %>'));
     let addDataCollect = JSON.parse(unescape('<%- escape(JSON.stringify(ctx.session.sessionProject.page_show.addDataCollect)) %>'));
     $(function () {

+ 10 - 10
package-lock.json

@@ -2989,7 +2989,7 @@
         },
         "charenc": {
             "version": "0.0.2",
-            "resolved": "https://registry.npm.taobao.org/charenc/download/charenc-0.0.2.tgz",
+            "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
             "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
         },
         "chokidar": {
@@ -3220,12 +3220,12 @@
             "dependencies": {
                 "sax": {
                     "version": "0.6.1",
-                    "resolved": "http://registry.npm.taobao.org/sax/download/sax-0.6.1.tgz",
+                    "resolved": "https://registry.npmjs.org/sax/-/sax-0.6.1.tgz",
                     "integrity": "sha1-VjsZx8HeiS4Jv8Ty/DDjwn8JUrk="
                 },
                 "xml2js": {
                     "version": "0.4.4",
-                    "resolved": "https://registry.npm.taobao.org/xml2js/download/xml2js-0.4.4.tgz?cache=0&sync_timestamp=1584990425260&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxml2js%2Fdownload%2Fxml2js-0.4.4.tgz",
+                    "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.4.tgz",
                     "integrity": "sha1-MREBAAMAiuGSQOuhdJe1fHKcVV0=",
                     "requires": {
                         "sax": "0.6.x",
@@ -3261,7 +3261,7 @@
         },
         "co-wechat-oauth": {
             "version": "2.0.1",
-            "resolved": "https://registry.npm.taobao.org/co-wechat-oauth/download/co-wechat-oauth-2.0.1.tgz",
+            "resolved": "https://registry.npmjs.org/co-wechat-oauth/-/co-wechat-oauth-2.0.1.tgz",
             "integrity": "sha1-n/pS3fuTWdAwAYiBw/jWIQSKKVQ=",
             "requires": {
                 "httpx": "^2.1.1"
@@ -3269,7 +3269,7 @@
         },
         "co-wechat-payment": {
             "version": "0.2.0",
-            "resolved": "https://registry.npm.taobao.org/co-wechat-payment/download/co-wechat-payment-0.2.0.tgz",
+            "resolved": "https://registry.npmjs.org/co-wechat-payment/-/co-wechat-payment-0.2.0.tgz",
             "integrity": "sha1-6V2uUqYEPHDZADDbHzPQFg0hEkA=",
             "requires": {
                 "md5": "^2.1.0",
@@ -3767,7 +3767,7 @@
         },
         "crypt": {
             "version": "0.0.2",
-            "resolved": "https://registry.npm.taobao.org/crypt/download/crypt-0.0.2.tgz",
+            "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
             "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
         },
         "csrf": {
@@ -10290,7 +10290,7 @@
         },
         "md5": {
             "version": "2.2.1",
-            "resolved": "https://registry.npm.taobao.org/md5/download/md5-2.2.1.tgz",
+            "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz",
             "integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=",
             "requires": {
                 "charenc": "~0.0.1",
@@ -13656,7 +13656,7 @@
         },
         "sha1": {
             "version": "1.1.1",
-            "resolved": "https://registry.npm.taobao.org/sha1/download/sha1-1.1.1.tgz",
+            "resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz",
             "integrity": "sha1-rdqnqTFo85PxnrKxUJFhjicA+Eg=",
             "requires": {
                 "charenc": ">= 0.0.1",
@@ -14830,7 +14830,7 @@
         },
         "ueditor": {
             "version": "1.2.3",
-            "resolved": "https://registry.npmjs.org/ueditor/-/ueditor-1.0.0.tgz",
+            "resolved": "https://registry.npmjs.org/ueditor/-/ueditor-1.2.3.tgz",
             "integrity": "sha1-HsihLT8VutOkAReGpzpIZJY2twQ=",
             "requires": {
                 "busboy": "^0.2.9",
@@ -15328,7 +15328,7 @@
         },
         "wechat-crypto": {
             "version": "0.0.2",
-            "resolved": "https://registry.npm.taobao.org/wechat-crypto/download/wechat-crypto-0.0.2.tgz",
+            "resolved": "https://registry.npmjs.org/wechat-crypto/-/wechat-crypto-0.0.2.tgz",
             "integrity": "sha1-pVRD7AgQ9MGZKik6J4YIOXAMY2k="
         },
         "whatwg-fetch": {