2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<style>
    .x-form-text {
        padding: 4px !important;
    }
 
    .upload-file {
        position: relative;
        vertical-align: baseline;
    }
 
    .upload-file input[type='file'] {
        height: 100%;
        width: 100%;
        position: absolute;
        top: 0;
        right: 0;
        opacity: 0;
        filter: alpha(opacity = 0);
        cursor: pointer;
    }
</style>
<form class="form-horizontal" id="xgfjform" method="post">
    <div class="portlet box ltblue">
        <div class="portlet-title" id="fujiangl">
            附件管理
            <div class="caption">
                <i class="fa fa-reorder"></i>
            </div>
            <div class="tools">
                <a class="collapse" onclick="portlet_body_ShowOrHide(this);"></a>
            </div>
        </div>
        <div class="portlet-body">
            <div class="row">
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">文件名称<span style="color: red;">*</span></label>
                        <div class="controls input-icon">
                            <input id="filename" name="filename" type="text" class="form-control col-sm-9" required="" />
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="icon-warning-sign" style="display: none;"></i>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">文件上传<span style="color: red;">*</span></label>
                        <div class="controls input-icon">
                            <input id="fjserverurl" name="serverurl" type="text" class="form-control col-sm-9" required="" />
                            <button type="button" class="btn btn-primary" style="vertical-align: baseline;display: none;" onclick="openDialog('fjfilepath')">
                                <span class="fa fa-upload"></span> 上传
                            </button>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="icon-warning-sign" style="display: none;"></i>
                            </span>
                            <div class="upload-file btn btn-primary">
                                <input type="file" id="filepath" name="filepath" onchange="openDialog(this)">
                                <span class="fa fa-upload"></span> 上传
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="portlet box ltblue">
        <div class="portlet-title">
            文件管理
            <div class="caption">
                <i class="fa fa-reorder"></i>
            </div>
            <div class="tools">
                <a class="collapse" onclick="portlet_body_ShowOrHide(this);"></a>
            </div>
        </div>
        <div class="portlet-body">
            <div style="width:100%;text-align: center;">
                <div style="text-align:center;height:20px;line-height:40px;font-size:15px;margin-top:5px;"></div>
                <div id="grid" style="background: #0a6aa1"></div>
                <div style="height:20px;"></div>
            </div>
        </div>
    </div>
</form>
<script src="/js/ZiYuanZhongXin/FJGL_Ext.js"></script>
<script>
    $(function () {
        cheackForm("xgfjform");
    });
    var resMainInfoId = $("#resMainInfoId").val();
    //上传文件
    function openDialog(dom) {
        if (dom.value != '') {
            var formdata = new FormData();
            formdata.append('myFile', dom.files[0]);
            $.ajax({
                url: "/res/resFile/uploadfile?resourceid=" + resMainInfoId,
                type: "POST",
                data: formdata,
                cache: false,
                async: false,
                processData: false,  // 告诉jQuery不要去处理发送的数据
                contentType: false,  // 告诉jQuery不要去设置Content-Type请求头
                success: function (data) {
                    var json = eval('(' + data + ')');
                    if (json.result != '0') {
                        $("#fjserverurl").val(json.Path);
                        if($("#filename").val() == "") $("#filename").val(json.Filename);
                        filesize = json.size;
                        unit = json.unit;
                        filetype = json.FileType;
                    } else {
                        alert("上传失败");
                    }
                }
            });
        }
    }
    //删除
    function Deletefile(id) {
        if (confirm("确定删除该文件?")) {
            $.ajax({
                url: '/res/resFiles/deleteFileData',
                type: "post",
                async: false,
                data: { "fileid": id },
                cache: false,
                success: function (res) {
                    if (res == "1") {
                        alert("删除成功");
                        ZYMLZiYuanStore.load();
                    } else {
                        alert("删除失败!");
                    }
                },
                error: function () {
                    alert("error");
                }
            });
            return true;
        } else {
            return false;
        }
    }
</script>