tSysFileList.jsp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  4. <div class="easyui-layout" fit="true">
  5. <div region="center" style="padding:0px;border:0px">
  6. <div id="tSysFileListtb" style="padding: 3px; height: 30px">
  7. <div style="float:left">
  8. <t:webUploader auto="true" busiTable="${webUpload.busiTable}"
  9. busiId="${webUpload.busiId}" bizType="${webUpload.bizType}"
  10. remark="${webUpload.remark}" name="${webUpload.bizType}"
  11. extensions="${webUpload.extensions}"
  12. duplicate="${webUpload.duplicate}"
  13. buttonText="上传附件"
  14. showHis="false" fileNumLimit="100000"
  15. displayTxt="false"
  16. readOnly='${webUpload.readOnly}'
  17. callback="tSysFileListAjaxCallback"
  18. nullMsg='<t:mutiLang langKey="common.file.nullmsg" langArg = "" ></t:mutiLang>'
  19. ></t:webUploader>
  20. </div>
  21. <div style="margin-top:12px">
  22. <span style="margin-left:12px">支持文件类型:jpg,png,pdf,doc,docx,xls,xlsx</span>
  23. </div>
  24. </div>
  25. <t:datagrid name="tSysFileList" checkbox="false" sortName="createDate" pagination="true" fitColumns="true" title="" actionUrl="tSysFileController.do?datagrid" idField="id" fit="true" queryMode="group">
  26. <t:dgCol title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
  27. <t:dgCol title="所属部门" field="sysOrgCode" hidden="true" queryMode="single" width="120"></t:dgCol>
  28. <t:dgCol title="所属公司" field="sysCompanyCode" hidden="true" queryMode="single" width="120"></t:dgCol>
  29. <t:dgCol title="文件访问路径" field="fileUrl" queryMode="single" hidden="true" width="120"></t:dgCol>
  30. <t:dgCol title="物理路径" field="fileRealpath" queryMode="single" hidden="true" width="120"></t:dgCol>
  31. <t:dgCol title="业务表单" field="busiTable" queryMode="single" query="true" hidden="true" defaultVal="${webUpload.busiTable}" width="120"></t:dgCol>
  32. <t:dgCol title="业务id" field="busiId" queryMode="single" query="true" hidden="true" defaultVal="${webUpload.busiId}" width="120"></t:dgCol>
  33. <t:dgCol title="备注" field="remark" queryMode="single" hidden="true" width="120"></t:dgCol>
  34. <t:dgCol title="文件种类" field="tagetType" queryMode="single" query="true" hidden="true" defaultVal="${webUpload.bizType}" width="120"></t:dgCol>
  35. <t:dgCol title="排序" field="orderNum" queryMode="single" hidden="true" width="120"></t:dgCol>
  36. <t:dgCol title="文件名称" field="fileName" queryMode="single" width="120"></t:dgCol>
  37. <t:dgCol title="创建日期" field="createDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single" width="120"></t:dgCol>
  38. <t:dgCol title="上传者" field="createBy" queryMode="single" width="120"></t:dgCol>
  39. <t:dgCol title="是否预览Flg" field="isPreviewFlg" hidden="true" queryMode="single" width="120"></t:dgCol>
  40. <t:dgCol title="操作" field="opt"></t:dgCol>
  41. <c:if test='${"true"!= webUpload.readOnly}'>
  42. <c:if test='${"true"== webUpload.createrDelete}'>
  43. <t:dgFunOpt title="删除" exp='createBy#eq#${curUserName}' funname="deleteFile" urlclass="ace_button" urlfont="fa-trash-o" />
  44. </c:if>
  45. <c:if test='${"true"!= webUpload.createrDelete}'>
  46. <t:dgFunOpt title="删除" funname="deleteFile" urlclass="ace_button" urlfont="fa-trash-o" />
  47. </c:if>
  48. </c:if>
  49. <t:dgFunOpt title="下载" funname="downloadFile" urlclass="ace_button" urlfont="fa-check" />
  50. <t:dgFunOpt title="查看" exp="isPreviewFlg#eq#1" funname="showViewFile" urlclass="ace_button" urlfont="fa-check" />
  51. </t:datagrid>
  52. </div>
  53. </div>
  54. <input type="hidden" id="isreadOnly" value="${webUpload.readOnly}" >
  55. <script type="text/javascript">
  56. var showAndDownUrl = "${showAndDownUrl}";
  57. $(document).ready(function() {
  58. });
  59. function downloadFile(index) {
  60. var rows = $('#tSysFileList').datagrid('getRows');//获取所有当前加载的数据行
  61. var fileUrl = rows[index].fileUrl;
  62. //var downsrc = "tSysFileController/showOrDownByurl.do?dbPath=" + fileUrl + '&down=1';
  63. var downsrc = showAndDownUrl + fileUrl + '&down=1';
  64. location.href = downsrc;
  65. };
  66. function showViewFile(index) {
  67. var rows = $('#tSysFileList').datagrid('getRows');//获取所有当前加载的数据行
  68. var fileUrl = rows[index].fileUrl;
  69. //var downsrc = "tSysFileController/showViewFile.do?fileUrl=" + fileUrl ;
  70. //console.log(downsrc);
  71. //location.href = downsrc;
  72. //var urlSee = showAndDownUrl + fileUrl;
  73. // 默认文件不是在阿里云
  74. var aliyunflg = "0";
  75. var tempStr = "aliyun";
  76. if(showAndDownUrl.indexOf(tempStr) >= 0) {
  77. aliyunflg = "1";
  78. }
  79. $.dialog.setting.zIndex = getzIndex();
  80. $.dialog(
  81. {
  82. content : 'url:tSysFileController/showViewFile.do?fileUrl=' + fileUrl + '&aliyunflg=' + aliyunflg,
  83. //content : 'url:'+ urlSee,
  84. zIndex : getzIndex(),
  85. title : '查看文件',//选择框标题
  86. lock : true,//是否锁定 当为true 时 下层有蒙版,不允许用户在弹出窗口以外有其它操作
  87. width : '600px',// 选择框宽度
  88. height : '600px',//选择框高度
  89. opacity : 0.4,//透明度 (经过测试 效果好像不太明显 )
  90. button : [ {
  91. name : '关闭',
  92. focus : true,
  93. callback : function() {
  94. }
  95. } ]
  96. }).zindex();
  97. };
  98. function deleteFile(index) {
  99. $.messager.confirm("确认", "确定要删除这条数据?", function (r) {
  100. if (r) {
  101. var rows = $('#tSysFileList').datagrid('getRows');//获取所有当前加载的数据行
  102. var id = rows[index].id;
  103. var deleteurl = "tSysFileController.do?doDel&id=" + id;
  104. var readonly = $("#isreadOnly").val();
  105. if (undefined != readonly && 'true' == readonly) {
  106. tip('<t:mutiLang langKey="file.msg.readonly"/>');
  107. } else {
  108. $.post('tSysFileController.do?doDel', {
  109. id : id
  110. }, function(aj) {
  111. var data=JSON.parse(aj);
  112. tip(data.msg);
  113. tSysFileListsearch();
  114. });
  115. }
  116. }
  117. });
  118. };
  119. function tSysFileListAjaxCallback(data) {
  120. tip(data.msg);
  121. tSysFileListsearch();
  122. }
  123. </script>