Prechádzať zdrojové kódy

附件,兼容无任何台账节点

MaiXinRong 1 rok pred
rodič
commit
3ffcc60963
1 zmenil súbory, kde vykonal 10 pridanie a 2 odobranie
  1. 10 2
      app/public/js/shares/tools_att.js

+ 10 - 2
app/public/js/shares/tools_att.js

@@ -74,7 +74,7 @@
         };
         const refreshCurAttHtml = function () {
             const html = [];
-            const atts = (nodeIndexes[curNode[setting.key]]) || [];
+            const atts = curNode ? (nodeIndexes[curNode[setting.key]]) || [] : [];
             for (const att of atts) {
                 html.push(getAttHtml(att));
             }
@@ -103,7 +103,11 @@
         };
         const getCurAttHtml = function (node) {
             curNode = node;
-            $('#att-cur-hint').text(`${curNode.code || curNode.b_code || ''}/${curNode.name || ''}`);
+            if (curNode) {
+                $('#att-cur-hint').text(`${curNode.code || curNode.b_code || ''}/${curNode.name || ''}`);
+            } else {
+                $('#att-cur-hint').text('');
+            }
             refreshCurAttHtml();
         };
 
@@ -178,6 +182,10 @@
         });
         // 上传附件
         $('#upload-file-btn').click(function () {
+            if (!curNode) {
+                toastr.error('请先选择台账节点');
+                return false;
+            }
             const files = $('#upload-file')[0].files;
             const formData = new FormData();
             formData.append('lid', curNode[setting.key]);