| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=GBK">
- <title>合同借阅申请-applicationBorrow</title>
- <script type="text/javascript" src="/shares/js/jquery-1.3.2.min.js"></script>
- <script type="text/javascript" src="/shares/js/file.js"></script>
- <link href="${pageContext.request.contextPath}/main.css" rel="stylesheet" type="text/css" />
- <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
- <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
- <script type="text/javascript" src="/shares/js/constant.js"></script>
- <script type="text/javascript" src="/shares/js/common.js"></script>
- <script src="/shares/xheditor/xheditor-1.1.14/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
- <script type="text/javascript" src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"></script>
- <script type="text/javascript">
- var requestProductData = [];
- var rowsBorrowType; //借阅类型
- $(function() {
- f_initRequestGrid();
- var initDialog;
- var isFinish = "${requestScope.finish }";
- var isStart = "${requestScope.flowOnOff }";
- $(function() {
- if(isStart == "off"){
- initDialog = $.ligerDialog({content:"对不起,合同借阅审批流程未配置,请通知流程管理员配置后,再借阅!", title:"系统提示",type:"warn",width:300,height:70,allowClose : false,
- buttons:[ { text:"确定",onclick:function(){closeWindow();}}
- ]
- });
- }
- });
- $(function() {
- if(isFinish == "finish"){
- initDialog = $.ligerDialog({content:"借阅申请提交成功!是否继续申请?", title:"系统提示",type:"question",width:300,height:70,allowClose : false,
- buttons:[ { text:"是",onclick:function(){initDialog.close();} } ,
- {text:"否",onclick:function(){closeWindow();} }
- ]
- });
- }
- });
-
- });
- var isDefaultEditor = { type: 'select', data: isDefaultEditorSelect, valueColumnName: 'value', displayColumnName: 'text'};
- var isDefaultEditorSelect = [{ dvalue: 1, dname: '在线阅读'},{ dvalue: 2, dname: '下载附件'}, { dvalue: 3, dname: '纸质借阅'}];
- var rowsBorrowType = [] ; //借阅类型
- if('${requestScope.rowsBorrowType}'!="" && typeof('${requestScope.rowsBorrowType}')!="undefined"){
- rowsBorrowType = eval('${requestScope.rowsBorrowType}');
- }
- /* alert(rowsBorrowType); */
- /* } */
- var rowsBorrowType2 = [{ dvalue: 1, dname: '男' }, { dvalue: 2, dname: '女'}];
- var rowsBorrowType3 = [{ dvalue: 1, dname: '1' }, { dvalue: 2, dname: '2'}];
- var rowsBorrowHours = []; //借阅小时数
- if('${requestScope.rowsBorrowHours}'!="" && typeof('${requestScope.rowsBorrowHours}')!="undefined"){
- rowsBorrowHours = eval('${requestScope.rowsBorrowHours}');
- }
- var g = null;
- function f_initRequestGrid() {
- g = $("#maingrid").ligerGrid({
- columns: [
- {display : '操作',isAllowHide : false,width : 100,
- render : function(row) {
- var html = '<a href=\"#\" style=\"color: blue;\" onclick=\"deleteRow('+row.contract_id+')\">移除</a> ';
- return html;}},
- { display: '合同编号', name: 'contract_number',type:'text',isSort:false,
- render :function(item){
- var s = item.contract_number;
- if(s==""){
- return '未搜索到合同编号';
- }else{
- return item.contract_number;
- }}},
- { display: '合同名称', name: 'contract_name',type:'text',isSort:false,width : 350},
- { display: '合同类别', name: 'contract_type_name',type:'text',isSort:false},
- { display: '借阅类型', name: 'borrow_type', align: 'center', isSort:false,
- editor: { type: 'select',data: rowsBorrowType, valueColumnName: 'dvalue', displayColumnName: 'dname'},
- render: function (item){
- for (var i = 0; i < rowsBorrowType.length; i++){
- if (rowsBorrowType[i]['dvalue'] == item.borrow_type)
- return rowsBorrowType[i]['dname'];
- }
- return item.borrow_type;
- }
- },
- { display: '合同ID', name: 'archive_id',type:'text',isSort:false, hide: true},
- { display: '借阅天数', name: 'borrow_days',editor: {type: 'int',minValue :0},width : 130,isSort:false,
- render: function (e) {
- return "<div>" + e.borrow_days + " 天 </div>";
- }},
- { display: '借阅小时数', name: 'borrow_hours', align: 'center', width : 130,isSort:false,
- editor: { type: 'select', data: rowsBorrowHours, valueColumnName: 'dvalue', displayColumnName: 'dname' },
- render: function (item){
- for (var i = 0; i < rowsBorrowHours.length; i++){
- if (rowsBorrowHours[i]['dvalue'] == item.borrow_hours)
- return "<div>" + rowsBorrowHours[i]['dname'] + " 小时</div>";
- }
- return "<div>" +item.borrow_hours + " 小时</div>";
- }
- },
- { display: '记录ID', name: 'universalid',type:'text',isSort:false, hide: true}],
- data:{Rows:requestProductData},
- enabledEdit: true,
- //checkbox : true,
- width :'99.8%',
- usePager: false,
- height : '230'
- });
- }
- //选择合同搜索
- function archive_search(){
- var checkValue = $("#checkValue").val();
- //var obj = window.top;
- //var obj;
- //if (obj != undefined && obj != null) {
- $.ligerDialog.open({
- title : '合同搜索',
- width : 860,
- height : 350,
- url : 'contractApplicationBorrowAction.do?task=toSelectBorrowList&checkbox=true&checkValue='+checkValue,
- buttons : [ {
- text : '确定',
- onclick : f_importOK1
- }, {
- text : '取消',
- onclick : f_importCancel
- } ]
- });
- //}
- }
- //手工添加合同
- function handwork_add(){
- //var obj = window.top;
- //if (obj != undefined && obj != null) {
- //obj.$.ligerDialog.open({
- $.ligerDialog.open({
- title : '手工添加',
- width : 450,
- height : 200,
- url : 'amsApplicationBorrowAction.do?task=toArchiveList&checkbox=false',
- buttons : [ {
- text : '确定',
- onclick : f_importOK2
- }, {
- text : '取消',
- onclick : f_importCancel
- } ]
- });
- }
- //选择合同确定
- function f_importOK1(item, dialog) {
- var check_value = dialog.frame.f_select();
- if(check_value != ''){
- $.ajax({
- type:"POST",
- url:"contractApplicationBorrowAction.do?task=borrowSelectContract",
- data : {"contract_ids":check_value},
- timeout:10000,
- cache:false,
- dataType:"json",
- success:function(data){
- var rows = data.Rows;
- filterData(rows,check_value, dialog);
- },
- error:showAjaxError
- });
- }else{
- $.ligerDialog.warn('请选择合同!');
- return;
- }
-
- }
- function filterData(rows,check_value, dialog){
- var newrows = new Array();
- for ( var i = 0; i < rows.length; i++) {
- newrows[i] = new Array();
- }
- if (check_value=="") {
- $.ligerDialog.warn('请选择合同!');
- return;
- }
- var manager = $("#maingrid").ligerGetGridManager();
- var data = manager.getData();
-
- for ( var i = 0; i < rows.length; i++) {
- var flag = true;
- for ( var j = 0; j < data.length; j++) {
- if (data[j].contract_id == rows[i].universalid) {
- flag = false;
- }
- }
- //判断是否重复
- if (flag) {
- newrows[i].contract_number = rows[i].contract_number;
- newrows[i].contract_name = rows[i].contract_name;
- newrows[i].contract_type = rows[i].contract_type;
- newrows[i].contract_type_name = rows[i].contract_type_name;
- newrows[i].contract_id = rows[i].universalid;
- newrows[i].borrow_type = 1;
- newrows[i].borrow_days = 2;
- newrows[i].borrow_hours = 0;
- manager.addRow(newrows[i]);
- }
- }
- $("#checkValue").val(check_value);
- dialog.close();
- }
- function f_importOK2(item, dialog) {
- var rows = dialog.frame.f_select2();
- var newrows = new Array();
- if (rows == "" || rows == null) {
- $.ligerDialog.warn('请输入合同名!');
- return;
- }
- var manager = $("#maingrid").ligerGetGridManager();
- var data = manager.getData();
- var flag = true;
- for ( var j = 0; j < data.length; j++) {
- if (data[j].archive_name == rows) {
- flag = false;
- }
- }
- //判断是否重复
- if (flag) {
- newrows.archive_num = "";
- newrows.archive_name = rows;
- newrows.archive_type = "";
- newrows.archive_medium = "";
- newrows.archive_id = new Date().getTime();
- newrows.borrow_type = 1;
- newrows.borrow_days = 2;
- newrows.borrow_hours = 0;
- manager.addRow(newrows);
- }
- dialog.close();
- }
- //取消选择
- function f_importCancel(item, dialog) {
- dialog.close();
- }
- //删除合同
- function deleteRow(contract_id) {
- var manager5 = $("#maingrid").ligerGetGridManager();
- var archiveData = manager5.getData();
- if (confirm("确定要移除吗?")) {
- var ids = "";
- //删除合同
- for ( var i = 0; i < archiveData.length; i++) {
- if (archiveData[i].contract_id == contract_id) {
- manager5.deleteRow(archiveData[i]);
- filterCheckValue(contract_id);
- }
- }
- requestProductData = archiveData;
- f_initRequestGrid();
- }
- }
- function filterCheckValue(contract_id){
- var checkValue = $("#checkValue").val();
- var ids=checkValue.split(",");
- var newCheckValue = "";
- for ( var i = 0; i < ids.length; i++) {
- if(contract_id!=ids[i]){
- if ("" == newCheckValue) {
- newCheckValue += ids[i];
- } else {
- newCheckValue += "," + ids[i];
- }
- }
- }
- $("#checkValue").val(newCheckValue);
- }
- //获取全部合同数据
- function getDataProduct() {
- var manager = $("#maingrid").ligerGetGridManager();
- var data = manager.getData();
- var t1 = $.ligerui.toJSON(data);
- $("#jsonRequestData").val(t1);
- }
- //重新加载数据
- function f_reload() {
- var manager2 = $("#maingrid").ligerGetGridManager();
- var productData = manager2.getData();
- if (productData != "" && typeof (productData) != "undefined"
- && null != productData) {
- requestProductData = productData;
- } else {
- requestProductData = [];
- }
- f_initRequestGrid();
- }
- function checkForm() {
- var rs = $.validate({
- name : "borrow_aim",
- model : [ {
- type : "require",
- msg : "借阅目的不能为空!"
- }, {
- type : "len",
- min : 1,
- max : 1000,
- msg : "借阅目的长度不能超过1000个字!"
- } ]
- });
- if (rs) {
- return true;
- } else {
- return false;
- }
- }
- //提交请购单
- function submitRquestForm() {
- if (checkForm()) {
- //获取列表全部数据
- var manager = $("#maingrid").ligerGetGridManager();
- var data = manager.getData();
- var t1 = $.ligerui.toJSON(data);
- $("#jsonRequestData").val(t1);
- var jsonRequestData = document.getElementById("jsonRequestData");
- var jsonRequestDatas;
- if (jsonRequestData.value != ""
- && typeof (jsonRequestData.value) != "undefined") {
- jsonRequestDatas = encodeURI(encodeURI(jsonRequestData.value));
- }
- var borrow_aim = document.getElementById("borrow_aim");
- var borrow_aims;
- if (borrow_aim.value != ""
- && typeof (borrow_aim.value) != "undefined") {
- borrow_aims = encodeURI(encodeURI(borrow_aim.value));
- }
- var jsonRequestData = $("#jsonRequestData").val();
- var modelId = $("#modelId").val();
- var tmodelId = $("#tmodelId").val();
- var borrow_aim = $("#borrow_aim").val();
- if (jsonRequestData != ""
- && typeof (jsonRequestData) != "undefined"
- && null != jsonRequestData && data.length > 0) {
- $("#btnSave").attr({
- "disabled" : "disabled"
- });
- var myDate = new Date();
- var myDate3 = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
- var myDate4 = myDate.getMonth() + 1; //获取当前月份(0-11,0代表1月)
- var myDate5 = myDate.getDate(); //获取当前日(1-31)
- var myDate6 = myDate.toLocaleDateString(); //获取当前日期
- var mytime7 = myDate.toLocaleTimeString(); //获取当前时间
- var time = myDate3 + "-" + myDate4 + "-" + myDate5;
- // $("#flowTitle").val(value);
- $("#requestForm").submit();
- // var name = '${session.name}';
- // var title = "流程:合同借阅流程("+time+")"+name+"";
- // var manager = $.ligerDialog.prompt('借阅流程名',''+title+'',
- // function (yes, value){
- // if (yes) {
- // $("#flowTitle").val(value);
- // $("#requestForm").submit();
- // }else{
- // manager.close();
- // }
- // });
- } else {
- $.ligerDialog.warn("借阅列表不能为空!");
- return;
- }
- }
- }
- function refresh(obj) {
- if (obj == "1") {
- parent.location.reload();
- }
- }
- $(document).ready(function() {
- $("[name='borrow_aim']").focus();
- });
- </script>
- <style type="text/css">
- .file-style {
- width: 550px;
- }
- .file-style input[type='file'] {
- width: 385px;
- height: 24px;
- line-height: 22px;
- vertical-align: bottom;
- background-color: #fff;
- border: 1px solid #cccccc;
- margin-top: 2px;
- margin-bottom: 2px;
- }
- </style>
- </head>
- <body>
- <%@ include file="/include/message.jsp"%>
- <form id="requestForm" action="contractApplicationBorrowAction.do" method="post">
- <div id="title" class="form-button">
- <input type="hidden" id="archiveId" name="archiveId" value="1">
- <input type="button" class="l-button" value="提交申请" onclick="submitRquestForm()" ${flowOnOff=='off'? 'disabled="disabled"':'' }>
- <c:if test="${flowOnOff=='off' }">
- <span style="color:red;">请先配置审核流程</span>
- </c:if>
- <input type="button" value="关闭" class="l-button" onclick="closeWindow();" />
- </div>
- <div class="container-layout">
- <div class="forum-container">
- <div class="forum-container">
- <table class="l-table-edit line">
- <tr>
- <th colspan="4"><B>借阅申请</B></th>
- </tr>
- <tr>
- <td colspan="4" height="300">
- <!-- 申请合同 start -->
- <div>
- <a class="l-button" style="width:100px;float:left; margin-left:10px; margin-top: 10px" onclick="archive_search()">合同搜索</a>
- <!-- <a class="l-button" style="width:100px;float:left; margin-left:10px; margin-top: 10px" onclick="handwork_add()">手工添加</a> -->
- </div>
- <div class="l-clear"></div>
- <div id="maingrid" style="margin-top:5px"></div><br />
- <div style="display:none;"></div>
- <!-- 申请合同 end -->
- </td>
- </tr>
- </table>
- </div>
- <center>
- <table class="l-table-edit line">
- <tr>
- <td class="l-table-edit-text">借阅目的<FONT COLOR="red">*</FONT>:</td>
- <td class="l-table-edit-td" colspan="3">
- <textarea id="borrow_aim" name="borrow_aim" rows="5" cols="70"></textarea>
- </tr>
- <tr>
- <td class="l-table-edit-text">借阅人:</td>
- <td class="l-table-edit-td" colspan="3">
- ${session.name}
- </tr>
- <tr>
- <td class="l-table-edit-text">借阅部门:</td>
- <td class="l-table-edit-td" colspan="3">
- ${session.group.groupName }
- </tr>
- </table>
- <input type="hidden" id="dev_id" name="dev_id" value="">
- <input type="hidden" id="universalid" name="universalid" value="">
- <input type="hidden" id="task" name="task" value="doAddApplication">
- <input type="hidden" id="tabid" name="tabid" value="${requestScope.tabid}">
- <input type="hidden" id="jsonRequestData" name="jsonRequestData" value="">
- <input type="hidden" id="tabid" name="tabid" value="${param.tabid }">
- <!-- 流程ID -->
- <input type="hidden" id="flowTitle" name="flowTitle" value="">
- <input type="hidden" id="tmodelId" name="tmodelId" value="${requestScope.tmodel.tmodelId }">
- <input type="hidden" id="modelId" name="modelId" value="${requestScope.fmodel.modelId }">
- <input type="hidden" id="checkValue" name="checkValue" value=""/>
- </center>
- </div>
- </div>
- </form>
- </body>
- </html>
|