123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- <%@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="list_add_need.jsp"%>
- <script type="text/javascript" src="<%=path%>/scripts/setiframeheight.js"></script>
- <script>
- var fd_id ="<%=request.getParameter("fd_id")%>";
- var listid=fd_id;
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- var flag=false;
- var isNew=false; //是否是新增记录
- var isNewSave=true; //新增记录是否保存
- var editingRow; // 双击的当前编辑行
- var isValida=true; //是否需要验证
- var g;
- function initComplete(){
- $("#fd_objectid").val(fd_id);
- $("#task_name").initYewuSelect("610","FD_OBJECTID","PROGRAM_NAME");//保供电任务名称
- $("#level").initCanstSelect('BM_GPS_PROGRAM_MANAGE_GPS_LEVEL');//级别
- var deptUrl = $.pathname() + '/ws/dept/DeptService/getDepartTree';
- $.post(deptUrl,{id:parentId,name:''},function(data){
- $("#dept").data("data",data);
- $("#dept").render();
- $("#write_dept").data("data",data);
- $("#write_dept").render();
- }, "json");
- if((window.location.href).indexOf('?')>-1){
- var url = $.pathname() + "/ws/saveList/BGDmingxibiaoaddService/getListById/";
- var params = {
- listid : listid
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data){
- $('#listForm').ajaxWrite({data:data});
- },
- error : function(e){
- top.Dialog.alert("访问服务失败!");
- }
- });
- };
- initGrid(listid);
- };
-
- function initGrid(listid){
- g = $("#maingrid").quiGrid({
- columns: [
- { display: '任务时间',name: 'task_time', align: 'center', width: "25%",editor: { type: 'date',dateFmt:'yyyy-MM-dd HH:mm:ss' }},
- { display: '投入人员(人次)', name: 'input_men', align: 'center', width: "25%",editor: { type: 'text',tip:'只能输入数字',inputMode:'numberOnly'}},
- { display: '投入车辆(车次)', name: 'input_car', align: 'center', width: "25%",editor: { type: 'text',tip:'只能输入数字',inputMode:'numberOnly'}},
- { display: '操作', isSort: false, width: "15%", 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/saveList/BGDmingxibiaoaddService/queryList2ByListId',
- params :{"listid":listid,"is_del":0},
- rownumbers:true,
- usePager: false,
- percentWidthMode : true,
- height: '100%',
- 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 onDelete(rowidx){
- if(rowidx!=editingRow && flag==true){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- };
- if(rowidx != editingRow){
- top.Dialog.confirm("此删除操作将无法撤回,是否继续?",function(){
- //删除记录
- var row = g.getRow(rowidx);
- //删除操作
- //$.post($.pathname() + '/ws/duty/DutyRecordsService/delDetailByID',
- $.post($.pathname() + '/ws/saveList/BGDmingxibiaoaddService/delList2ByID',
- /* {"fd_objectid":row.fd_objectid}, */
- function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("删除成功!");
- g.loadData();
- } else {
- top.Dialog.alert("删除失败!");
- }
- },
- "json");
- });
- }else if(isNew){
- top.Dialog.confirm("确定要删除该记录吗?",function(){
- isNewSave=false;
- isValida=false;
- endEdit(rowidx);
- //删除记录
- var row = g.getRow(rowidx);
- //删除操作
- g.deleteRow(row);
- });
- }else{
- isNewSave=false;
- isValida=false;
- endEdit(rowidx);
- g.loadData();
- };
- };
-
-
-
- //编辑
- function beginEdit(rowid) {
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- };
- g.beginEdit(rowid);
- }
-
-
-
- //结束编辑
- function endEdit(rowid){
- //editingRow='';
- g.endEdit(rowid);
- };
-
- //新增(一行)
- function addUser(){
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- }
- editingRow=0;
- isNew=true;
- var row = g.getRow(0);
- var rowData={};
- g.addEditRow(rowData, row, true);
- //在这里做新增处理
- };
- //删除后的提示
- 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.task_time == ""){
- top.Dialog.alert("任务时间列有输入值为空!");
- return false;
- };
- if(e.newdata.input_men == ""){
- top.Dialog.alert("投入人员(人次)列有输入值为空!");
- return false;
- };
- if(e.newdata.input_car == ""){
- top.Dialog.alert("投入车辆(台次)列有输入值为空");
- return false;
- };
- };
- isValida=true;
- };
- //编辑后事件 (保存修改后的第二张表)
- function onAfterSubmitEdit(e){
- //isNew=false;
- if(isNewSave){
- var fd_Objectid1 = e.record.fd_objectid;
- var rowData = e.newdata;
- var row = JSON.stringify(rowData);
- row += "#"+listid+"#"+fd_Objectid1;
- //ajax方式提交数据到数据库
- // $.post($.pathname() + '/ws/duty/DutyRecordsService/saveDetail',row,function(data){
- // g.loadData();
- // },"json");
- $.ajax({
- //url : $.pathname() + '/ws/duty/DutyRecordsService/saveDetail',
- url:$.pathname() + '/ws/savelist/BGDmingxibiaoaddService/savelList2',
- type : 'post',
- timeout : 15000,
- data : row,
- dataType : 'text',
- success : function(result){
- top.Dialog.alert("保存成功!");
- isNew=false;
- },
- error : function(e){
- top.Dialog.alert("保存失败");
- }
- });
- };
- isNewSave=true;
- };
-
- var token = 0;//???????????????????????????????????????????????????????????
- function saveList(validaFormId){
- if(flag){
- top.Dialog.alert("请先完成当前记录的编辑!");
- return;
- };
- var valid=$(validaFormId).validationEngine({returnIsValid: true});
- // CHECKREDBOX='请检查标红输入框!';
- if(!valid){
- //top.Dialog.alert(CHECKREDBOX);
- if($("#task_name").setValue() == undefined){
- top.Dialog.alert("请先填写任务名称!");
- return;
- }else if($("#dept").setValue() == undefined){
- top.Dialog.alert("请先填写部门!");
- return;
- }else if($("#level").setValue() == undefined){
- top.Dialog.alert("请先填写任务级别!");
- return;
- }else if($("#writer").html() == ""){
- top.Dialog.alert("请先填写填报人员!");
- return;
- }else if($("#write_dept").setValue() == undefined){
- top.Dialog.alert("请先填写填报部门!");
- return;
- }else if($("#write_time").html() == ""){
- top.Dialog.alert("请先填写填报时间!");
- return;
- };
- };
- if(valid){
- if(token>0){
- top.Dialog.alert("已经保存过!");
- return;
- };
- token++;
- var rows = g.getData();
- var rowsjson=JSON.stringify(rows);
- var forms = $('#listForm').serialize();
- forms =forms +"#;#"+rowsjson;
- $.ajax({
- /* url : $.pathname() + '/ws/duty/DutyRecordsService/saveDuty', */
- url : $.pathname() + '/ws/saveList/BGDmingxibiaoaddService/updateList',
- type : 'post',
- timeout : 15000,
- data : forms,
- dataType : 'json',
- success : function(result){
- if (result.Msg.sucsess == true) {
- top.Dialog.alert("保存成功!");
- history.go(-1);//???????????????????????????????????????????????????????????
- } else {
- top.Dialog.alert("保存失败!");
- };
- },
- error : function(e){
- top.Dialog.alert("保存失败");
- }
- });
- };
- };
-
- //重置----重新加载页面
- function resetList(){
- window.location.href="List_edit.jsp";
- };
-
- function goback(){
- //top.Dialog.confirm("您已修改了表单,是否需要离开?|离开", function() {
- var url = "/nwyj/page/business/gps/queryStatistics/list/List.jsp";
- top.parent.document.getElementById("frmright").setAttribute("src", ""+encodeURI(url));
- //});
- };
- </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 align="left" alt="返回" src="/nwyj/images/temp/back.png" onclick="goback()" />
- </a>
- <font style="font-weight: bold;font-size: 20px;line-height: 45px;">特级、一级保供电任务明细表修改</font>
- </div>
- <form id="listForm" method="post">
- <input name="classid" value="615" type="hidden"/>
- <input name="fd_objectid" id="fd_objectid" type="hidden"/>
- <table width="100%" border='0'>
- <tr>
- <td colspan="6" align="right">
- <input type="button" onclick="javascript:saveList('#listForm');" value="保存" />
- <input type="button" onclick="javascript:resetList();" value="重置" />
- </td>
- </tr>
- <tr>
- <td width="10%" align="right"><span class="star">*</span>任务名称:</td>
- <td width="20%"><select id="task_name" name="task_name" type="text" prompt="请选择" maxlength="15" class="validate[required]"></select></td>
- <td width="10%" align="right"><span class="star">*</span>部门:</td>
- <td width="20%"><div class="selectTree validate[required]" id="dept" name="dept" selWidth="200" boxHeight="260"></div></td>
- <td width="10%" align="right"><span class="star">*</span>级别:</td>
- <td width="20%"><select id="level" name="level" class="validate[required]" prompt="请选择"></select></td>
- </tr>
-
- <tr>
- <td align="right"><span class="star">*</span>填报人员:</td>
- <td>
- <input name="writer" id="writer" maxlength="15" style="width:192px" type="text" class="validate[required]">
- </td>
- <td align="right"><span class="star">*</span>填报部门:</td>
- <td>
- <div class="selectTree validate[required]" id="write_dept" name="write_dept" selWidth="200" boxHeight="260"></div>
- </td>
- <td align="right"><span class="star">*</span>填报时间:</td>
- <td><input readonly="readonly" name="write_time" id="write_time" style="width:192px" 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>
|