123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476 |
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>应急响应值班安排表填报</title>
- <!--引入QUI框架js -->
- <%@include file="need.jsp"%>
- <script type="text/javascript" src="<%=path%>/scripts/setiframeheight.js"></script>
- <script>
- var flag = false;
- var isNew = false; //是否是新增记录
- var editingRow; // 双击的当前编辑行
- var isValida = true; //是否需要验证
- var task_id;
- var g;
- var dutyData = {"list" : [ {"value" : "0","key" : "在岗值班"},
- {"value" : "1","key" : "电话值班"},
- {"value" : "2","key" : "应急指挥中心值班"}]};
- function initComplete() {
- // 部门id
- var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //取得用户真实姓名
- var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- //部门名称
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- //父部门id
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
-
-
-
-
- //初始化页面
- task_id = "<%=request.getParameter("task_id")%>";
- if((window.location.href).indexOf('?')>-1 ){//修改表单
- $("#biaoti").text("保供电值班安排表");
-
- //加载任务id
- $("#TASK_ID_632").initYewuSelect("610", "FD_OBJECTID", "PROGRAM_NAME","FD_OBJECTID = '"+task_id+"'");
- initGrid();
-
- }
- }
-
- //获取系统时间
- function getNowDate() {
- var s = "";
- var d = allGetServerTime();
- var vYear = d.getFullYear();
- var vMon = d.getMonth() + 1;
- var vDay = d.getDate();
- var h = d.getHours();
- var m = d.getMinutes();
- var se = d.getSeconds();
- s = vYear + "-" + (vMon < 10 ? "0" + vMon : vMon) + "-" + (vDay < 10 ? "0" + vDay : vDay) + " " + (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m) + ":" + "00";
- return s;
- }
- function initGrid() {
- var hurl;
- var loadParms;
-
- hurl= $.pathname() + '/ws/bgd_duty/BgdDutyService/getDutyByTaskId';
- loadParms={taskid:task_id};
-
- g = $("#maingrid").quiGrid({
- columns : [
- /* {name:'fd_objectid',hide:true},
- {name:'duty_id',hide:true},
- { display: '日期', name: 'duty_date', align: 'center', width: "10%",editor: { type: 'date',dateFmt:'yyyy-MM-dd' }},
- */
-
- {name:'FD_OBJECTID',hide:true},
- {display : '任务名称', name : 'TASK_ID', hide : true,align : 'center',width : "10%",editor : {type : 'text',maxlength : '15'}},
- {display : '更新时间', name : 'UPDATEDATE', hide : true,align : 'center',width : "10%",editor : {type : 'text',maxlength : '15'}},
- {display : '填报时间', name : 'TIANBAO_TIME',hide : true,align : 'center',width : "10%",editor : {type : 'text',maxlength : '15'}},
- {display : '部门', name : 'DEPT', hide : true,align : 'center',width : "10%",editor : {type : 'text',maxlength : '15'}},
- {display : '填报人', name : 'TIANBAO_PERSON',hide : true,align : 'center',width : "10%", editor : {type : 'text',maxlength : '15'}},
- {display : '开始时间', name : 'START_TIME', align : 'center',width : "15%"/* , editor : {type : 'date',dateFmt: 'yyyy-MM-dd HH:mm:00'} */},
- {display : '结束时间', name : 'END_TIME', align : 'center',width : "15%"/* , editor : {type : 'date',dateFmt : 'yyyy-MM-dd HH:mm:00'} */},
- {display : '值班领导', name : 'LEADER', align : 'center',width : "10%"/* , editor : {type : 'text',maxlength : '15'} */},
- {display : '领导电话', name : 'LEADER_TEL', align : 'center',width : "12%"/* , editor : {type : 'text',maxlength : '11',inputMode : 'numberOnly',tip : '只能输入数字'} */},
- {display : '值班成员', name : 'WATCH_MAN',/* showTitle:true, */align : 'center',width : "10%"/* ,editor : {type : 'text'} */},
- {display : '联系电话', name : 'WATCH_TEL', align : 'center',width : "12%"/* ,editor : {type : 'text',maxlength : '11',inputMode : 'numberOnly',tip : '只能输入数字'} */},
- {display : '值班方式', name : 'DUTY_MODE', align : 'center',width : "13%"/* ,editor : {type : 'select',data : dutyData,selWidth : 155} */,render : function(item) {
- for (var i = 0; i < dutyData["list"].length; i++) {
- if (dutyData["list"][i]['value'] == item.DUTY_MODE)
- return dutyData["list"][i]['key']
- }
- return item.DUTY_MODE;
- }
- }
- /* {display : '操作',isSort : false,width : "12%", render : function(rowdata, rowindex, value) {
- var h = "";
- if (!rowdata._editing) {
- flag = false;
- h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
- } else {
- flag = true;
- h += "<a onclick='endEdit(" + rowindex + ")'><span class='icon_ok'>确认</span></a> ";
- h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>取消</span></a> ";
- }
- return h;
- }
- } */ ],
-
- // url : $.pathname() + '/ws/bgd_duty/BgdDutyService/getDutyByTaskId',
- url:hurl,
- rownumbers : true,
- params:loadParms,
- usePager : false,
- percentWidthMode : true,
- height : '600',
- width : '100%',
- enabledEdit : true,
- clickToEdit : false,
- onDblClickRow : function(rowdata, rowindex) {
- if (flag) {
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- editingRow = parseInt(rowindex.slice(1)) - 1001;
- g.beginEdit(rowindex);
- },
- onBeforeEdit : onBeforeEdit,
- onBeforeSubmitEdit : onBeforeSubmitEdit,
- onAfterSubmitEdit : onAfterSubmitEdit
- /* toolbar : {
- items : [ { text : '新增',click : addUser,iconClass : 'icon_add'},
- { line : true }]
- } */
-
-
- });
- }
- //查看
- function onView(rowidx) {
- }
- //删除
- function onDelete(rowidx) {
- if (rowidx != editingRow && flag == true) {
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- top.Dialog.confirm("确定要删除该记录吗?", function() {
- isValida = false;
- flag = false;
- endEdit(rowidx);
- //删除记录
- var row = g.getRow(rowidx)
- // alert(row.fd_objectid)
- //删除操作
- g.deleteRow(row);
- });
- }
- //编辑
- function beginEdit(rowid) {
- g.beginEdit(rowid);
- }
- //取消编辑
- function cancelEdit(rowid) {
- g.cancelEdit(rowid);
- }
- //结束编辑
- function endEdit(rowid) {
- editingRow = '';
- g.endEdit(rowid);
- }
- //新增
- /* function addUser() {
- alert("iuuiu");
- if (flag) {
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- editingRow = 0;
- isNew = true;
- var row = g.getRow(0);
- var rowData = {
- duty_way : 0
- };
- g.addEditRow(rowData, row, true);
- //在这里做新增处理
- var $duty_man_input = $("#maingrid .l-grid2 .l-grid-body-table").children("tbody").children("tr").children("td").eq(4);
-
- } */
- function addUser(){
- alert("iiiiii")
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- editingRow=0;
- isNew=true;
- var row = g.getRow(0);
- //var row = "11";
- alert(row+"--------row");
- var rowData={
- //duty_date:getNowDate() ,
- DUTY_MODE:0
- };
- alert(1111);
- g.addEditRow(rowData, row, true);
- alert(1111);
- //在这里做新增处理
- var $duty_man_input = $("#maingrid .l-grid2 .l-grid-body-table").children("tbody").children("tr").children("td").eq(4);
- $duty_man_input.on("click",openaddwindow)
-
- }
-
- //将row JSON对象转化为bo对象
- function rowToBO(row) {
- // var params = '&userinfor.userId='+row.userId+'&userinfor.userName='+row.userName+'&userinfor.userSex='+row.userSex+'&userinfor.userAge='+Math.ceil(row.userAge)+'&userinfor.userDepartment='+row.userDepartment+'&userinfor.userEmployTime='+row.userEmployTime+'&userinfor.userPassword='+row.userPassword+'&userinfor.userEducation='+row.userEducation+'&userinfor.userLoginName='+row.userLoginName;
- var params = '&EcmDutyDetail.fd_objectid=' + row.fd_objectid + '&EcmDutyDetail.duty_id=' + dutyid + '&EcmDutyDetail.duty_date=' + row.duty_date + '&EcmDutyDetail.start_time=' + row.start_time + '&EcmDutyDetail.end_time=' + row.end_time + '&EcmDutyDetail.leader=' + row.leader + '&EcmDutyDetail.leader_tel=' + row.leader_tel + '&EcmDutyDetail.name=' + row.name + '&EcmDutyDetail.telephone=' + row.telephone + '&EcmDutyDetail.duty_way=' + row.duty_way;
- return params;
- }
- //删除后的提示
- function handleResult(result) {
- if (result == 1) {
- top.Dialog.alert("删除成功!", null, null, null, 1);
- g.loadData();
- } else {
- top.Dialog.alert("删除失败!");
- }
- }
- //全部确认修改
- function endAllEdit() {
- g.endEdit();
- }
- //全部取消修改
- function cancelAllEdit() {
- g.cancelEdit();
- }
- //编辑前事件
- function onBeforeEdit(e) {
- }
- //编辑提交前事件
- function onBeforeSubmitEdit(e) {
- if (isValida) {
- if (e.newdata.duty_date == "") {
- top.Dialog.alert("日期列有输入值为空!");
- return false;
- }
- if (e.newdata.start_time == "") {
- top.Dialog.alert("开始时间列有输入值为空!");
- return false;
- }
- if (e.newdata.end_time == "") {
- top.Dialog.alert("结束时间列有输入值为空!");
- return false;
- }
- if (e.newdata.start_time > e.newdata.end_time) {
- top.Dialog.alert("开始时间晚于结束时间!");
- return false;
- }
- if (e.newdata.leader == "" || validateInput(e.newdata.leader, "^[\" \"]+$")) {
- top.Dialog.alert("值班领导列有输入值为空或全是空格!");
- return false;
- }
- if (e.newdata.leader_tel == "") {
- top.Dialog.alert("领导电话列有输入值为空!");
- return false;
- }
- if (e.newdata.name == "" || validateInput(e.newdata.name, "^[\" \"]+$")) {
- top.Dialog.alert("值班成员列有输入值为空或全是空格!");
- return false;
- }
- if (e.newdata.telephone == "") {
- top.Dialog.alert("联系电话列有输入值为空!");
- return false;
- }
- if (e.newdata.duty_way == "") {
- top.Dialog.alert("值班方式列有输入值为空!");
- return false;
- }
- }
- isValida = true;
- }
- //编辑后事件
- function onAfterSubmitEdit(e) {
- isNew = false;
- }
-
- //保存方法bg
- var token = 0;
- function saveDuty(validaFormId) {
- var valid = $(validaFormId).validationEngine({
- returnIsValid : true
- });
- if (valid) {
- if (token > 0) {
- top.Dialog.alert("已经保存过!");
- return;
- }
- token++;
- var rows = g.getData();
- //保存数据时为隐藏域的东西赋值
- for (var i = 0; i < rows.length; i++) {
- //填报人
- rows[i].TIANBAO_PERSON = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- //填报部门
- rows[i].DEPT = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //填报时间
- rows[i].TIANBAO_TIME = getNowDate();
- rows[i].UPDATEDATE = getNowDate();
- //加载任务名称数据
- rows[i].TASK_ID = $("#TASK_ID_632").val();
- }
- var rowsjson = JSON.stringify(rows);
-
- var forms = $('#RespDutyForm').serialize();
- // forms =forms +"#;#"+rowsjson;
- var gurl ;
- if(task_id == ""){
- gurl = $.pathname() + '/ws/bgd_duty/BgdDutyService/saveDuty';
- }else{
- gurl = $.pathname() + '/ws/bgd_duty/BgdDutyService/updateBgdDuty';
- }
-
-
- alert(gurl);
- $.ajax({
- url : gurl,
- type : 'post',
- timeout : 15000,
- data : encodeURI(rowsjson, "UTF-8"),
- dataType : 'text',
- success : function(result) {
-
- alert(result.sucsess);
- if (result.sucsess) {
- top.Dialog.alert("保存成功!");
- history.go(-1);
- } else {
- top.Dialog.alert("保存失败!");
- }
- },
- error : function(e) {
- alert(JSON.stringify(e));
- top.Dialog.alert("保存失败");
- }
- });
- }
- }
- function resetDuty() {
- window.location.href = "duty_edit.jsp";
- }
-
- function alter_reset(){
- alert("修改重置");
- $("#biaoti").text("保供电值班安排表填报修改1");
- //加载修改的页面方法
- initGrid();
- }
- </script>
- </head>
- <body style="height: 650px;overflow:auto; overflow-x:hidden;background-color:white">
- <div style="height: 50px;background: #F8F8F8;" align="center">
- <a href="javascript:;"> <img id="back" align="left" alt="返回" src="/nwyj/images/temp/back.png" onclick="javascript:window.location.href='bgd_duty_list.jsp';" />
- </a> <font id="biaoti" style="font-weight: bold;font-size: 20px;line-height: 45px;">保供电值班安排表填报</font>
- </div>
- <form id="RespDutyForm" method="post">
- <table width="100%" border='0'>
- <!-- <tr>
- <td colspan="6" align="right">
- <input type="button" onclick="javascript:saveDuty('#RespDutyForm');" value="保存" />
- <input id="add_reset" type="button" onclick="javascript:resetDuty();" value="重置" />
- <input id="alter_reset" type="button" onclick="javascript:alter_reset();" value="重置" />
-
- </td>
- </tr> -->
- <tr>
- <!-- <td width="10%" align="right"><span class="star">*</span>名称:</td><td width="20%"><input id="name" maxlength="15" name="name" type="text" class="validate[required,length[0,50],custom[illegalLetter]]"></td> -->
- <td width="10%" align="right"><span class="star">*</span>名称:</td>
- <td width="20%"><select editable=false name="TASK_ID_632" class="validate[required]" id="TASK_ID_632" selAlign="" selWidth="200"></select> <!-- <div class="selectTree validate[required]" id="TASK_ID_632" name="TASK_ID_632" selWidth="200" boxHeight="260"></div> --></td>
- <!-- <td width="10%" align="right"><span class="star">*</span>部门:</td>
- <td width="20%"><div class="selectTree validate[required]" id="dept_names" name="dept_names" selWidth="200" boxHeight="260"></div></td>
- -->
- <td width="10%"></td>
- <td width="20%"></td>
- </tr>
- <!-- <tr>
- <td align="right"><span class="star">*</span>填报人员:</td>
- <td><input name="oper_name" id="oper_name" maxlength="15" type="text" class="validate[required,length[0,20],custom[illegalLetter]]"></td>
- <td align="right"><span class="star">*</span>填报部门:</td>
- <td>
-
- <input name="oper_dept" id="oper_dept" type="text" />
-
- <div class="selectTree validate[required]" id="oper_dept" name="oper_dept" selWidth="200" boxHeight="260"></div> <input name="duty_type" id="duty_type" type="hidden" value="3">
- </td>
- <td align="right"><span class="star">*</span>填报时间:</td>
- <td><input name="oper_time" id="oper_time" type="text" class="date validate[required]" dateFmt="yyyy-MM-dd HH:mm"></td>
- </tr> -->
- </table>
- </form>
- <div>
- <div class="padding_right5">
- <div id="maingrid"></div>
- </div>
- </div>
- </div>
- </body>
- </html>
|