applicationBorrow.jsp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html;charset=GBK">
  7. <title>合同借阅申请-applicationBorrow</title>
  8. <script type="text/javascript" src="/shares/js/jquery-1.3.2.min.js"></script>
  9. <script type="text/javascript" src="/shares/js/file.js"></script>
  10. <link href="${pageContext.request.contextPath}/main.css" rel="stylesheet" type="text/css" />
  11. <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  12. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  13. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  14. <script type="text/javascript" src="/shares/js/constant.js"></script>
  15. <script type="text/javascript" src="/shares/js/common.js"></script>
  16. <script src="/shares/xheditor/xheditor-1.1.14/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
  17. <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
  18. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  19. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
  20. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
  21. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
  22. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
  23. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
  24. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
  25. <script type="text/javascript" src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"></script>
  26. <script type="text/javascript">
  27. var requestProductData = [];
  28. var rowsBorrowType; //借阅类型
  29. $(function() {
  30. f_initRequestGrid();
  31. var initDialog;
  32. var isFinish = "${requestScope.finish }";
  33. var isStart = "${requestScope.flowOnOff }";
  34. $(function() {
  35. if(isStart == "off"){
  36. initDialog = $.ligerDialog({content:"对不起,合同借阅审批流程未配置,请通知流程管理员配置后,再借阅!", title:"系统提示",type:"warn",width:300,height:70,allowClose : false,
  37. buttons:[ { text:"确定",onclick:function(){closeWindow();}}
  38. ]
  39. });
  40. }
  41. });
  42. $(function() {
  43. if(isFinish == "finish"){
  44. initDialog = $.ligerDialog({content:"借阅申请提交成功!是否继续申请?", title:"系统提示",type:"question",width:300,height:70,allowClose : false,
  45. buttons:[ { text:"是",onclick:function(){initDialog.close();} } ,
  46. {text:"否",onclick:function(){closeWindow();} }
  47. ]
  48. });
  49. }
  50. });
  51. });
  52. var isDefaultEditor = { type: 'select', data: isDefaultEditorSelect, valueColumnName: 'value', displayColumnName: 'text'};
  53. var isDefaultEditorSelect = [{ dvalue: 1, dname: '在线阅读'},{ dvalue: 2, dname: '下载附件'}, { dvalue: 3, dname: '纸质借阅'}];
  54. var rowsBorrowType = [] ; //借阅类型
  55. if('${requestScope.rowsBorrowType}'!="" && typeof('${requestScope.rowsBorrowType}')!="undefined"){
  56. rowsBorrowType = eval('${requestScope.rowsBorrowType}');
  57. }
  58. /* alert(rowsBorrowType); */
  59. /* } */
  60. var rowsBorrowType2 = [{ dvalue: 1, dname: '男' }, { dvalue: 2, dname: '女'}];
  61. var rowsBorrowType3 = [{ dvalue: 1, dname: '1' }, { dvalue: 2, dname: '2'}];
  62. var rowsBorrowHours = []; //借阅小时数
  63. if('${requestScope.rowsBorrowHours}'!="" && typeof('${requestScope.rowsBorrowHours}')!="undefined"){
  64. rowsBorrowHours = eval('${requestScope.rowsBorrowHours}');
  65. }
  66. var g = null;
  67. function f_initRequestGrid() {
  68. g = $("#maingrid").ligerGrid({
  69. columns: [
  70. {display : '操作',isAllowHide : false,width : 100,
  71. render : function(row) {
  72. var html = '<a href=\"#\" style=\"color: blue;\" onclick=\"deleteRow('+row.contract_id+')\">移除</a>&nbsp;';
  73. return html;}},
  74. { display: '合同编号', name: 'contract_number',type:'text',isSort:false,
  75. render :function(item){
  76. var s = item.contract_number;
  77. if(s==""){
  78. return '未搜索到合同编号';
  79. }else{
  80. return item.contract_number;
  81. }}},
  82. { display: '合同名称', name: 'contract_name',type:'text',isSort:false,width : 350},
  83. { display: '合同类别', name: 'contract_type_name',type:'text',isSort:false},
  84. { display: '借阅类型', name: 'borrow_type', align: 'center', isSort:false,
  85. editor: { type: 'select',data: rowsBorrowType, valueColumnName: 'dvalue', displayColumnName: 'dname'},
  86. render: function (item){
  87. for (var i = 0; i < rowsBorrowType.length; i++){
  88. if (rowsBorrowType[i]['dvalue'] == item.borrow_type)
  89. return rowsBorrowType[i]['dname'];
  90. }
  91. return item.borrow_type;
  92. }
  93. },
  94. { display: '合同ID', name: 'archive_id',type:'text',isSort:false, hide: true},
  95. { display: '借阅天数', name: 'borrow_days',editor: {type: 'int',minValue :0},width : 130,isSort:false,
  96. render: function (e) {
  97. return "<div>" + e.borrow_days + " 天 </div>";
  98. }},
  99. { display: '借阅小时数', name: 'borrow_hours', align: 'center', width : 130,isSort:false,
  100. editor: { type: 'select', data: rowsBorrowHours, valueColumnName: 'dvalue', displayColumnName: 'dname' },
  101. render: function (item){
  102. for (var i = 0; i < rowsBorrowHours.length; i++){
  103. if (rowsBorrowHours[i]['dvalue'] == item.borrow_hours)
  104. return "<div>" + rowsBorrowHours[i]['dname'] + " 小时</div>";
  105. }
  106. return "<div>" +item.borrow_hours + " 小时</div>";
  107. }
  108. },
  109. { display: '记录ID', name: 'universalid',type:'text',isSort:false, hide: true}],
  110. data:{Rows:requestProductData},
  111. enabledEdit: true,
  112. //checkbox : true,
  113. width :'99.8%',
  114. usePager: false,
  115. height : '230'
  116. });
  117. }
  118. //选择合同搜索
  119. function archive_search(){
  120. var checkValue = $("#checkValue").val();
  121. //var obj = window.top;
  122. //var obj;
  123. //if (obj != undefined && obj != null) {
  124. $.ligerDialog.open({
  125. title : '合同搜索',
  126. width : 860,
  127. height : 350,
  128. url : 'contractApplicationBorrowAction.do?task=toSelectBorrowList&checkbox=true&checkValue='+checkValue,
  129. buttons : [ {
  130. text : '确定',
  131. onclick : f_importOK1
  132. }, {
  133. text : '取消',
  134. onclick : f_importCancel
  135. } ]
  136. });
  137. //}
  138. }
  139. //手工添加合同
  140. function handwork_add(){
  141. //var obj = window.top;
  142. //if (obj != undefined && obj != null) {
  143. //obj.$.ligerDialog.open({
  144. $.ligerDialog.open({
  145. title : '手工添加',
  146. width : 450,
  147. height : 200,
  148. url : 'amsApplicationBorrowAction.do?task=toArchiveList&checkbox=false',
  149. buttons : [ {
  150. text : '确定',
  151. onclick : f_importOK2
  152. }, {
  153. text : '取消',
  154. onclick : f_importCancel
  155. } ]
  156. });
  157. }
  158. //选择合同确定
  159. function f_importOK1(item, dialog) {
  160. var check_value = dialog.frame.f_select();
  161. if(check_value != ''){
  162. $.ajax({
  163. type:"POST",
  164. url:"contractApplicationBorrowAction.do?task=borrowSelectContract",
  165. data : {"contract_ids":check_value},
  166. timeout:10000,
  167. cache:false,
  168. dataType:"json",
  169. success:function(data){
  170. var rows = data.Rows;
  171. filterData(rows,check_value, dialog);
  172. },
  173. error:showAjaxError
  174. });
  175. }else{
  176. $.ligerDialog.warn('请选择合同!');
  177. return;
  178. }
  179. }
  180. function filterData(rows,check_value, dialog){
  181. var newrows = new Array();
  182. for ( var i = 0; i < rows.length; i++) {
  183. newrows[i] = new Array();
  184. }
  185. if (check_value=="") {
  186. $.ligerDialog.warn('请选择合同!');
  187. return;
  188. }
  189. var manager = $("#maingrid").ligerGetGridManager();
  190. var data = manager.getData();
  191. for ( var i = 0; i < rows.length; i++) {
  192. var flag = true;
  193. for ( var j = 0; j < data.length; j++) {
  194. if (data[j].contract_id == rows[i].universalid) {
  195. flag = false;
  196. }
  197. }
  198. //判断是否重复
  199. if (flag) {
  200. newrows[i].contract_number = rows[i].contract_number;
  201. newrows[i].contract_name = rows[i].contract_name;
  202. newrows[i].contract_type = rows[i].contract_type;
  203. newrows[i].contract_type_name = rows[i].contract_type_name;
  204. newrows[i].contract_id = rows[i].universalid;
  205. newrows[i].borrow_type = 1;
  206. newrows[i].borrow_days = 2;
  207. newrows[i].borrow_hours = 0;
  208. manager.addRow(newrows[i]);
  209. }
  210. }
  211. $("#checkValue").val(check_value);
  212. dialog.close();
  213. }
  214. function f_importOK2(item, dialog) {
  215. var rows = dialog.frame.f_select2();
  216. var newrows = new Array();
  217. if (rows == "" || rows == null) {
  218. $.ligerDialog.warn('请输入合同名!');
  219. return;
  220. }
  221. var manager = $("#maingrid").ligerGetGridManager();
  222. var data = manager.getData();
  223. var flag = true;
  224. for ( var j = 0; j < data.length; j++) {
  225. if (data[j].archive_name == rows) {
  226. flag = false;
  227. }
  228. }
  229. //判断是否重复
  230. if (flag) {
  231. newrows.archive_num = "";
  232. newrows.archive_name = rows;
  233. newrows.archive_type = "";
  234. newrows.archive_medium = "";
  235. newrows.archive_id = new Date().getTime();
  236. newrows.borrow_type = 1;
  237. newrows.borrow_days = 2;
  238. newrows.borrow_hours = 0;
  239. manager.addRow(newrows);
  240. }
  241. dialog.close();
  242. }
  243. //取消选择
  244. function f_importCancel(item, dialog) {
  245. dialog.close();
  246. }
  247. //删除合同
  248. function deleteRow(contract_id) {
  249. var manager5 = $("#maingrid").ligerGetGridManager();
  250. var archiveData = manager5.getData();
  251. if (confirm("确定要移除吗?")) {
  252. var ids = "";
  253. //删除合同
  254. for ( var i = 0; i < archiveData.length; i++) {
  255. if (archiveData[i].contract_id == contract_id) {
  256. manager5.deleteRow(archiveData[i]);
  257. filterCheckValue(contract_id);
  258. }
  259. }
  260. requestProductData = archiveData;
  261. f_initRequestGrid();
  262. }
  263. }
  264. function filterCheckValue(contract_id){
  265. var checkValue = $("#checkValue").val();
  266. var ids=checkValue.split(",");
  267. var newCheckValue = "";
  268. for ( var i = 0; i < ids.length; i++) {
  269. if(contract_id!=ids[i]){
  270. if ("" == newCheckValue) {
  271. newCheckValue += ids[i];
  272. } else {
  273. newCheckValue += "," + ids[i];
  274. }
  275. }
  276. }
  277. $("#checkValue").val(newCheckValue);
  278. }
  279. //获取全部合同数据
  280. function getDataProduct() {
  281. var manager = $("#maingrid").ligerGetGridManager();
  282. var data = manager.getData();
  283. var t1 = $.ligerui.toJSON(data);
  284. $("#jsonRequestData").val(t1);
  285. }
  286. //重新加载数据
  287. function f_reload() {
  288. var manager2 = $("#maingrid").ligerGetGridManager();
  289. var productData = manager2.getData();
  290. if (productData != "" && typeof (productData) != "undefined"
  291. && null != productData) {
  292. requestProductData = productData;
  293. } else {
  294. requestProductData = [];
  295. }
  296. f_initRequestGrid();
  297. }
  298. function checkForm() {
  299. var rs = $.validate({
  300. name : "borrow_aim",
  301. model : [ {
  302. type : "require",
  303. msg : "借阅目的不能为空!"
  304. }, {
  305. type : "len",
  306. min : 1,
  307. max : 1000,
  308. msg : "借阅目的长度不能超过1000个字!"
  309. } ]
  310. });
  311. if (rs) {
  312. return true;
  313. } else {
  314. return false;
  315. }
  316. }
  317. //提交请购单
  318. function submitRquestForm() {
  319. if (checkForm()) {
  320. //获取列表全部数据
  321. var manager = $("#maingrid").ligerGetGridManager();
  322. var data = manager.getData();
  323. var t1 = $.ligerui.toJSON(data);
  324. $("#jsonRequestData").val(t1);
  325. var jsonRequestData = document.getElementById("jsonRequestData");
  326. var jsonRequestDatas;
  327. if (jsonRequestData.value != ""
  328. && typeof (jsonRequestData.value) != "undefined") {
  329. jsonRequestDatas = encodeURI(encodeURI(jsonRequestData.value));
  330. }
  331. var borrow_aim = document.getElementById("borrow_aim");
  332. var borrow_aims;
  333. if (borrow_aim.value != ""
  334. && typeof (borrow_aim.value) != "undefined") {
  335. borrow_aims = encodeURI(encodeURI(borrow_aim.value));
  336. }
  337. var jsonRequestData = $("#jsonRequestData").val();
  338. var modelId = $("#modelId").val();
  339. var tmodelId = $("#tmodelId").val();
  340. var borrow_aim = $("#borrow_aim").val();
  341. if (jsonRequestData != ""
  342. && typeof (jsonRequestData) != "undefined"
  343. && null != jsonRequestData && data.length > 0) {
  344. $("#btnSave").attr({
  345. "disabled" : "disabled"
  346. });
  347. var myDate = new Date();
  348. var myDate3 = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
  349. var myDate4 = myDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
  350. var myDate5 = myDate.getDate(); //获取当前日(1-31)
  351. var myDate6 = myDate.toLocaleDateString(); //获取当前日期
  352. var mytime7 = myDate.toLocaleTimeString(); //获取当前时间
  353. var time = myDate3 + "-" + myDate4 + "-" + myDate5;
  354. // $("#flowTitle").val(value);
  355. $("#requestForm").submit();
  356. // var name = '${session.name}';
  357. // var title = "流程:合同借阅流程("+time+")"+name+"";
  358. // var manager = $.ligerDialog.prompt('借阅流程名',''+title+'',
  359. // function (yes, value){
  360. // if (yes) {
  361. // $("#flowTitle").val(value);
  362. // $("#requestForm").submit();
  363. // }else{
  364. // manager.close();
  365. // }
  366. // });
  367. } else {
  368. $.ligerDialog.warn("借阅列表不能为空!");
  369. return;
  370. }
  371. }
  372. }
  373. function refresh(obj) {
  374. if (obj == "1") {
  375. parent.location.reload();
  376. }
  377. }
  378. $(document).ready(function() {
  379. $("[name='borrow_aim']").focus();
  380. });
  381. </script>
  382. <style type="text/css">
  383. .file-style {
  384. width: 550px;
  385. }
  386. .file-style input[type='file'] {
  387. width: 385px;
  388. height: 24px;
  389. line-height: 22px;
  390. vertical-align: bottom;
  391. background-color: #fff;
  392. border: 1px solid #cccccc;
  393. margin-top: 2px;
  394. margin-bottom: 2px;
  395. }
  396. </style>
  397. </head>
  398. <body>
  399. <%@ include file="/include/message.jsp"%>
  400. <form id="requestForm" action="contractApplicationBorrowAction.do" method="post">
  401. <div id="title" class="form-button">
  402. <input type="hidden" id="archiveId" name="archiveId" value="1">
  403. <input type="button" class="l-button" value="提交申请" onclick="submitRquestForm()" ${flowOnOff=='off'? 'disabled="disabled"':'' }>
  404. <c:if test="${flowOnOff=='off' }">
  405. <span style="color:red;">请先配置审核流程</span>
  406. </c:if>
  407. <input type="button" value="关闭" class="l-button" onclick="closeWindow();" />
  408. </div>
  409. <div class="container-layout">
  410. <div class="forum-container">
  411. <div class="forum-container">
  412. <table class="l-table-edit line">
  413. <tr>
  414. <th colspan="4"><B>借阅申请</B></th>
  415. </tr>
  416. <tr>
  417. <td colspan="4" height="300">
  418. <!-- 申请合同 start -->
  419. <div>
  420. <a class="l-button" style="width:100px;float:left; margin-left:10px; margin-top: 10px" onclick="archive_search()">合同搜索</a>
  421. <!-- <a class="l-button" style="width:100px;float:left; margin-left:10px; margin-top: 10px" onclick="handwork_add()">手工添加</a> -->
  422. </div>
  423. <div class="l-clear"></div>
  424. <div id="maingrid" style="margin-top:5px"></div><br />
  425. <div style="display:none;"></div>
  426. <!-- 申请合同 end -->
  427. </td>
  428. </tr>
  429. </table>
  430. </div>
  431. <center>
  432. <table class="l-table-edit line">
  433. <tr>
  434. <td class="l-table-edit-text">借阅目的<FONT COLOR="red">*</FONT>:</td>
  435. <td class="l-table-edit-td" colspan="3">
  436. <textarea id="borrow_aim" name="borrow_aim" rows="5" cols="70"></textarea>
  437. </tr>
  438. <tr>
  439. <td class="l-table-edit-text">借阅人:</td>
  440. <td class="l-table-edit-td" colspan="3">
  441. ${session.name}
  442. </tr>
  443. <tr>
  444. <td class="l-table-edit-text">借阅部门:</td>
  445. <td class="l-table-edit-td" colspan="3">
  446. ${session.group.groupName }
  447. </tr>
  448. </table>
  449. <input type="hidden" id="dev_id" name="dev_id" value="">
  450. <input type="hidden" id="universalid" name="universalid" value="">
  451. <input type="hidden" id="task" name="task" value="doAddApplication">
  452. <input type="hidden" id="tabid" name="tabid" value="${requestScope.tabid}">
  453. <input type="hidden" id="jsonRequestData" name="jsonRequestData" value="">
  454. <input type="hidden" id="tabid" name="tabid" value="${param.tabid }">
  455. <!-- 流程ID -->
  456. <input type="hidden" id="flowTitle" name="flowTitle" value="">
  457. <input type="hidden" id="tmodelId" name="tmodelId" value="${requestScope.tmodel.tmodelId }">
  458. <input type="hidden" id="modelId" name="modelId" value="${requestScope.fmodel.modelId }">
  459. <input type="hidden" id="checkValue" name="checkValue" value=""/>
  460. </center>
  461. </div>
  462. </div>
  463. </form>
  464. </body>
  465. </html>