Browse Source

错误修正

sugangqiang 2 years ago
parent
commit
0a63521226

+ 23 - 9
public/static/modular/gate/enterprise/enterprise_change_edit.js

@@ -176,7 +176,11 @@ EpChangeEdit.initFileTable = function () {
                 if (data == null || data.length == 0) {
                     return;
                 }
-                var files = $("#files").val().split(",");
+                var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
+                var files = "";
+                if (checkState != 1) {
+                    files = $("#files").val().split(",");
+                }
                 var html = '<ul class="imgs"><li style="width: 80%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">操作</li>';
                 for (var key in data) {
                     var sn = data[key].url.lastIndexOf(".");
@@ -194,7 +198,7 @@ EpChangeEdit.initFileTable = function () {
                     html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
                             '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
                             '<li style="width: 10%;">' + imgStr + '</li>\n' +
-                            '<li style="width: 10%;padding-top: 2px;">' + (files.indexOf(data[key].typeId.toString()) > -1 ? btn : "") + '</li>';
+                            '<li style="width: 10%;padding-top: 2px;">' + (checkState == 1 ? btn : (files.indexOf(data[key].typeId.toString()) > -1 ? btn : "")) + '</li>';
                 }
                 html = html + '</ul>';
                 $detail.html(html);
@@ -245,13 +249,20 @@ EpChangeEdit.initFileTypeColumn = function () {
         },
         {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
             formatter: function (value, row, index) {
-                var files = $("#files").val().split(",");
-                if (files.indexOf(value.toString()) != -1) {
+                var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
+                if (checkState == 1) {
                     return "<button type='button' onclick=\"EpChangeEdit.checkFile('" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
                             "<i class=\"fa fa-upload\"></i>上传" +
                             "</button>";
                 } else {
-                    return "";
+                    var files = $("#files").val().split(",");
+                    if (files.indexOf(value.toString()) != -1) {
+                        return "<button type='button' onclick=\"EpChangeEdit.checkFile('" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
+                                "<i class=\"fa fa-upload\"></i>上传" +
+                                "</button>";
+                    } else {
+                        return "";
+                    }
                 }
             }
         }
@@ -449,9 +460,12 @@ $(function () {
     } else {
         $("#fileLi").attr("style", "pointer-events: none");
     }
-    $("#baseForm :input").prop("disabled", true);
-    var fields = $("#fields").val().split(",");
-    for (var i in fields) {
-        $("#" + fields[i]).removeAttr("disabled");
+    var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
+    if (checkState != 1) {
+        $("#baseForm :input").prop("disabled", true);
+        var fields = $("#fields").val().split(",");
+        for (var i in fields) {
+            $("#" + fields[i]).removeAttr("disabled");
+        }
     }
 });

+ 23 - 9
public/static/modular/gate/enterprise/enterprise_change_edit1.js

@@ -151,7 +151,11 @@ EpChangeEdit.initFileTable = function () {
                 if (data == null || data.length == 0) {
                     return;
                 }
-                var files = $("#files").val().split(",");
+                var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
+                var files = "";
+                if (checkState != 1) {
+                    files = $("#files").val().split(",");
+                }
                 var html = '<ul class="imgs"><li style="width: 80%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">操作</li>';
                 for (var key in data) {
                     var sn = data[key].url.lastIndexOf(".");
@@ -169,7 +173,7 @@ EpChangeEdit.initFileTable = function () {
                     html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
                             '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
                             '<li style="width: 10%;">' + imgStr + '</li>\n' +
-                            '<li style="width: 10%;padding-top: 2px;">' + (files.indexOf(data[key].typeId.toString()) > -1 ? btn : "") + '</li>';
+                            '<li style="width: 10%;padding-top: 2px;">' + (checkState == 1 ? btn : (files.indexOf(data[key].typeId.toString()) > -1 ? btn : "")) + '</li>';
                 }
                 html = html + '</ul>';
                 $detail.html(html);
@@ -210,13 +214,20 @@ EpChangeEdit.initFileTypeColumn = function () {
         },
         {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "10%",
             formatter: function (value, row, index) {
-                var files = $("#files").val().split(",");
-                if (files.indexOf(value.toString()) != -1) {
+                var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
+                if (checkState == 1) {
                     return "<button type='button' onclick=\"EpChangeEdit.checkFile('" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
                             "<i class=\"fa fa-upload\"></i>上传" +
                             "</button>";
                 } else {
-                    return "";
+                    var files = $("#files").val().split(",");
+                    if (files.indexOf(value.toString()) != -1) {
+                        return "<button type='button' onclick=\"EpChangeEdit.checkFile('" + value + "','" + null + "')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
+                                "<i class=\"fa fa-upload\"></i>上传" +
+                                "</button>";
+                    } else {
+                        return "";
+                    }
                 }
             }
         }
@@ -414,9 +425,12 @@ $(function () {
     } else {
         $("#fileLi").attr("style", "pointer-events: none");
     }
-    $("#baseForm :input").prop("disabled", true);
-    var fields = $("#fields").val().split(",");
-    for (var i in fields) {
-        $("#" + fields[i]).removeAttr("disabled");
+    var checkState = $("#checkState").length > 0 ? $("#checkState").val() : 1;
+    if (checkState != 1) {
+        $("#baseForm :input").prop("disabled", true);
+        var fields = $("#fields").val().split(",");
+        for (var i in fields) {
+            $("#" + fields[i]).removeAttr("disabled");
+        }
     }
 });