tSysFileList.jsp 6.5 KB

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