Parcourir la source

计量台账,附件,删除前确认

MaiXinRong il y a 4 jours
Parent
commit
e0a0b1bfad
1 fichiers modifiés avec 21 ajouts et 17 suppressions
  1. 21 17
      app/public/js/stage.js

+ 21 - 17
app/public/js/stage.js

@@ -5152,25 +5152,29 @@ $(document).ready(() => {
             });
             });
             $('#change-att-btn').val('');
             $('#change-att-btn').val('');
         } else if (content === 'del') {
         } else if (content === 'del') {
-            const data = {id: fid};
-            postData('/tender/' + tender.id + '/measure/stage/' + stage.order + '/delete/file', data, function (result) {
-                // 删除到attData中
-                const att_index = attData.findIndex(function (item) {
-                    return item.id === parseInt(fid);
-                });
-                attData.splice(att_index, 1);
-                // 重新生成List
+            const att = attData.find(function (item) { return item.id === parseInt(fid); });
+            deleteAfterHint(function () {
+                const data = {id: fid};
+                postData('/tender/' + tender.id + '/measure/stage/' + stage.order + '/delete/file', data, function (result) {
+                    // 删除到attData中
+                    const att_index = attData.findIndex(function (item) {
+                        return item.id === parseInt(fid);
+                    });
+                    attData.splice(att_index, 1);
+                    // 重新生成List
 
 
-                if ($('#alllist-table tr').length === 1) {
-                    getAllList(parseInt($('#currentPage').text()) - 1);
+                    if ($('#alllist-table tr').length === 1) {
+                        getAllList(parseInt($('#currentPage').text()) - 1);
+
+                    } else {
+                        getAllList(parseInt($('#currentPage').text()));
+                    }
+                    getNodeList(node.id);
+                    $('#showAttachment').hide();
+                    $('#showAttachment').attr('file-id', '');
+                });
+            }, `确认删除附件「${att.filename}」?`);
 
 
-                } else {
-                    getAllList(parseInt($('#currentPage').text()));
-                }
-                getNodeList(node.id);
-                $('#showAttachment').hide();
-                $('#showAttachment').attr('file-id', '');
-            });
         } else if (content === 'view') {
         } else if (content === 'view') {
             const data = {id: fid};
             const data = {id: fid};
             postData('/tender/' + tender.id + '/measure/stage/' + stage.order + '/check/file', data, function (result) {
             postData('/tender/' + tender.id + '/measure/stage/' + stage.order + '/check/file', data, function (result) {