|
@@ -2,8 +2,8 @@
|
|
|
* 公共附件管理初始化
|
|
|
*/
|
|
|
var CommonFile = {
|
|
|
- id: "CommonFileTable", //表格id
|
|
|
- seItem: null, //选中的条目
|
|
|
+ id: "CommonFileTable", //表格id
|
|
|
+ seItem: null, //选中的条目
|
|
|
table: null,
|
|
|
layerIndex: -1
|
|
|
};
|
|
@@ -14,20 +14,20 @@ var CommonFile = {
|
|
|
CommonFile.initColumn = function () {
|
|
|
return [
|
|
|
{field: 'selectItem', radio: true},
|
|
|
- {title: '附件原名', field: 'originalName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip',width:"20%"},
|
|
|
- {title: '下载地址', field: 'url', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip',width:"40%",
|
|
|
- formatter : function(value,row,index){
|
|
|
- return "<a href=\'javascript:void(0)\' onclick=\"CommonFile.downloadFileByUrl('"+value+"')\">"+value+"</a>";
|
|
|
+ {title: '附件原名', field: 'originalName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "20%"},
|
|
|
+ {title: '下载地址', field: 'id', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "40%",
|
|
|
+ formatter: function (value, row, index) {
|
|
|
+ return "<a href=\'javascript:void(0)\' onclick=\"CommonFile.downloadFileById('" + value + "')\">" + row.url + "</a>";
|
|
|
}
|
|
|
},
|
|
|
- {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip',width:"20%"},
|
|
|
- {title: '上传时间', field: 'createTime', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip',width:"10%"},
|
|
|
- {title: '创建用户', field: 'createUser', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip',width:"10%"},
|
|
|
+ {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "20%"},
|
|
|
+ {title: '上传时间', field: 'createTime', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "10%"},
|
|
|
+ {title: '创建用户', field: 'createUser', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "10%"},
|
|
|
];
|
|
|
};
|
|
|
|
|
|
-CommonFile.downloadFileByUrl = function(url){
|
|
|
- window.location.href = Feng.ctxPath + "/api/commonDownload/downloadByUrl?url=" + url;
|
|
|
+CommonFile.downloadFileById = function (id) {
|
|
|
+ window.location.href = Feng.ctxPath + "/common/api/downloadFile/type/4/id/" + id;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -36,10 +36,10 @@ CommonFile.downloadFileByUrl = function(url){
|
|
|
*/
|
|
|
CommonFile.check = function () {
|
|
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
|
|
- if(selected.length == 0){
|
|
|
+ if (selected.length == 0) {
|
|
|
Feng.info("请先选中表格中的某一记录!");
|
|
|
return false;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
CommonFile.seItem = selected[0];
|
|
|
return true;
|
|
|
}
|
|
@@ -55,21 +55,21 @@ CommonFile.openAddCommonFile = function () {
|
|
|
area: ['800px', '420px'], //宽高
|
|
|
fix: false, //不固定
|
|
|
maxmin: true,
|
|
|
- content: "<form id=\"commonFileForm\" action=\""+Feng.ctxPath+"/commonFile/add\" method=\"post\" enctype=\"multipart/form-data\" target=\"hiddenIframe\">\n" +
|
|
|
- " <div class=\"panel panel-default\">\n" +
|
|
|
- " <div class=\"panel-heading\" style=\"font-weight: bold\">附件材料</div>\n" +
|
|
|
- " <div class=\"panel-body\">\n" +
|
|
|
- " <input type=\"text\" style=\"display: none\" id=\"index\" name=\"index\" >\n" +
|
|
|
- " <input type=\"file\" style=\"display: none\" id=\"fileUrl\" name=\"fileUrl\" onchange=\"CommonFile.fileChange(this)\">\n" +
|
|
|
- " <input class=\"form-control\" id=\"fileInput\" onclick=\"$('#fileUrl').click()\">\n" +
|
|
|
- " </div>\n" +
|
|
|
- " <div class=\"panel-heading\" style=\"font-weight: bold\">备注</div>\n" +
|
|
|
- " <div class=\"panel-body\">\n" +
|
|
|
- " <textarea class=\"form-control\" id=\"description\" name=\"description\"></textarea>\n" +
|
|
|
- " </div>\n" +
|
|
|
- " </div>\n" +
|
|
|
- " </form>",
|
|
|
- btn: ['<i class="fa fa-eye"></i> 提交' ,'<i class="fa fa-eraser"></i> 关闭'],
|
|
|
+ content: "<form id=\"commonFileForm\" action=\"" + Feng.ctxPath + "/admin/common_file/add\" method=\"post\" enctype=\"multipart/form-data\" target=\"hiddenIframe\">\n" +
|
|
|
+ " <div class=\"panel panel-default\">\n" +
|
|
|
+ " <div class=\"panel-heading\" style=\"font-weight: bold\">附件材料</div>\n" +
|
|
|
+ " <div class=\"panel-body\">\n" +
|
|
|
+ " <input type=\"text\" style=\"display: none\" id=\"index\" name=\"index\" >\n" +
|
|
|
+ " <input type=\"file\" style=\"display: none\" id=\"fileUrl\" name=\"fileUrl\" onchange=\"CommonFile.fileChange(this)\">\n" +
|
|
|
+ " <input class=\"form-control\" id=\"fileInput\" onclick=\"$('#fileUrl').click()\">\n" +
|
|
|
+ " </div>\n" +
|
|
|
+ " <div class=\"panel-heading\" style=\"font-weight: bold\">备注</div>\n" +
|
|
|
+ " <div class=\"panel-body\">\n" +
|
|
|
+ " <textarea class=\"form-control\" id=\"description\" name=\"description\"></textarea>\n" +
|
|
|
+ " </div>\n" +
|
|
|
+ " </div>\n" +
|
|
|
+ " </form>",
|
|
|
+ btn: ['<i class="fa fa-eye"></i> 提交', '<i class="fa fa-eraser"></i> 关闭'],
|
|
|
btnAlign: 'c',
|
|
|
yes: function (index, layero) {
|
|
|
$("#index").val(index);
|
|
@@ -86,35 +86,35 @@ CommonFile.openAddCommonFile = function () {
|
|
|
CommonFile.delete = function () {
|
|
|
if (this.check()) {
|
|
|
var operation = function () {
|
|
|
- var ajax = new $ax(Feng.ctxPath + "/commonFile/delete", function (data) {
|
|
|
- if(data.code == 200){
|
|
|
+ var ajax = new $ax(Feng.ctxPath + "/admin/common_file/delete", function (data) {
|
|
|
+ if (data.code == 200) {
|
|
|
Feng.success(data.msg);
|
|
|
CommonFile.table.refresh();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Feng.info(data.msg);
|
|
|
}
|
|
|
}, function (data) {
|
|
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
|
|
});
|
|
|
- ajax.set("commonFileId",CommonFile.seItem.id);
|
|
|
+ ajax.set("id", CommonFile.seItem.id);
|
|
|
ajax.start();
|
|
|
}
|
|
|
Feng.confirm("确认删除吗?", operation);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-CommonFile.fileChange = function(context){
|
|
|
- var file = $(context).val();
|
|
|
+CommonFile.fileChange = function (context) {
|
|
|
+ var file = $(context).val();
|
|
|
var pos = file.lastIndexOf("\\");
|
|
|
- $("#fileInput").val(file.substring(pos+1));
|
|
|
+ $("#fileInput").val(file.substring(pos + 1));
|
|
|
}
|
|
|
|
|
|
-CommonFile.callback = function(data){
|
|
|
- if(data.code == 200){
|
|
|
+CommonFile.callback = function (data) {
|
|
|
+ if (data.code == 200) {
|
|
|
Feng.success(data.msg);
|
|
|
layer.close(data.obj);
|
|
|
CommonFile.table.refresh();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Feng.info(data.msg);
|
|
|
}
|
|
|
}
|
|
@@ -122,7 +122,7 @@ CommonFile.callback = function(data){
|
|
|
|
|
|
$(function () {
|
|
|
var defaultColunms = CommonFile.initColumn();
|
|
|
- var table = new BSTable(CommonFile.id, "/commonFile/list", defaultColunms);
|
|
|
+ var table = new BSTable(CommonFile.id, "/admin/common_file/list", defaultColunms);
|
|
|
table.setPaginationType("server");
|
|
|
CommonFile.table = table.init();
|
|
|
});
|