8040c7286d3fcf634dbfc509cdbbbaff11641e46.svn-base 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author LJP
  6. * @date 2015/11/03
  7. */
  8. // 获取用户部门
  9. var dept_id = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
  10. // 获取公司
  11. var comp_id = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
  12. // 获取用户Id
  13. var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
  14. // 获取用户角色
  15. var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
  16. // 取得用户真实名字
  17. var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
  18. /** 定义变量* */
  19. var _this = this;
  20. _this.listGrid = null;// 数据列表
  21. _this.searchPanel = null; // 查询面板
  22. $queryForm = null;// 查询区域表单
  23. $searchButt = null;// 查询按钮
  24. $more = null; // 更多
  25. _this.loadParams = null;// 列表加载参数
  26. _this.gridData = "";
  27. var nowDate = getDateTime();
  28. var flagggg = true;//判断是否有错
  29. levelData = {
  30. "list" : [ {
  31. "value" : "0",
  32. "key" : "在岗值班"
  33. }, {
  34. "value" : "1",
  35. "key" : "电话值班"
  36. }, {
  37. "value" : "2",
  38. "key" : "应急指挥中心值班"
  39. } ]
  40. };
  41. // 表头1
  42. var mycolumns1 = [
  43. {
  44. display : '开始时间',
  45. name : 'START_TIME_234',
  46. align : 'center',
  47. width : "12%",
  48. editor : {
  49. type : 'date',
  50. dateFmt : "yyyy-MM-dd"
  51. },
  52. render : function(rowdata, rowindex, value, column){
  53. if(/*compareTime(nowDate,rowdata.START_TIME_234)
  54. || */compareTime(rowdata.START_TIME_234,rowdata.END_TIME_234) && !checkName(value,"sj")){
  55. //flagggg = false;
  56. value = "<span class='errorData'>"+value+"</span>";
  57. }
  58. return value;
  59. }
  60. },
  61. {
  62. display : '结束时间',
  63. name : 'END_TIME_234',
  64. align : 'center',
  65. width : "12%",
  66. //showTitle : true,
  67. editor : {
  68. type : 'date',
  69. dateFmt : "yyyy-MM-dd"
  70. },
  71. render : function(rowdata, rowindex, value, column){
  72. if(compareTime(rowdata.START_TIME_234,rowdata.END_TIME_234) && !checkName(value,"sj")){
  73. //flagggg = false;
  74. value = "<div class='errorData'>"+value+"</div>";
  75. }
  76. return value;
  77. }
  78. },
  79. {
  80. display : '值班领导',
  81. name : 'LEADER_NAME_234',
  82. align : 'center',
  83. width : "10%",
  84. isSort : true,
  85. editor : {
  86. type : 'text',
  87. maxlength : 5,
  88. tip : '不超过5个字的中文'
  89. },
  90. render : function(rowdata, rowindex, value, column){
  91. if(!checkName(value,"rm")){
  92. //flagggg = false;
  93. value = "<div class='errorData'>"+value+"</div>";
  94. }
  95. return value;
  96. }
  97. },
  98. {
  99. display : '领导电话',
  100. name : 'LEADER_TEL_234',
  101. align : 'center',
  102. width : "10%",
  103. // showTitle : true,
  104. editor : {
  105. type : 'text',
  106. inputMode : "numberOnly",
  107. maxlength : 13,
  108. tip : '不超过13个数字'
  109. },
  110. render : function(rowdata, rowindex, value, column){
  111. if(!checkName(value,"dh")){
  112. //flagggg = false;
  113. value = "<div class='errorData'>"+value+"</div>";
  114. }
  115. return value;
  116. }
  117. },
  118. {
  119. display : '值班人员',
  120. name : 'NAME_234',
  121. align : 'center',
  122. width : "10%",
  123. // showTitle : true,
  124. editor : {
  125. type : 'text',
  126. maxlength : 5,
  127. tip : '不超过5个字的中文'
  128. },
  129. render : function(rowdata, rowindex, value, column){
  130. if(!checkName(value,"rm")){
  131. //flagggg = false;
  132. value = "<div class='errorData'>"+value+"</div>";
  133. }
  134. return value;
  135. }
  136. },
  137. {
  138. display : '联系电话',
  139. name : 'TELEPHONE_234',
  140. align : 'center',
  141. width : "10%",
  142. editor : {
  143. type : 'text',
  144. inputMode : "numberOnly",
  145. maxlength : 13,
  146. tip : '不超过13个数字'
  147. },
  148. render : function(rowdata, rowindex, value, column){
  149. if(!checkName(value,"dh")){
  150. //flagggg = false;
  151. value = "<div class='errorData'>"+value+"</div>";
  152. }
  153. return value;
  154. }
  155. },
  156. {
  157. display : '值班方式',
  158. name : 'DUTY_WAY_234',
  159. align : 'center',
  160. width : "10%",
  161. editor : {
  162. type : 'select',
  163. data : levelData,
  164. selWidth : 100
  165. },
  166. render : function(rowdata, rowindex, value, column) {
  167. var thisvalue = value;
  168. for (var i = 0; i < levelData["list"].length; i++) {
  169. if (levelData["list"][i]['value'] == value)
  170. thisvalue = levelData["list"][i]['key'];
  171. }
  172. if(!checkName(thisvalue,"zbfs")){
  173. thisvalue = "<div class='errorData'>"+thisvalue+"</div>";
  174. }
  175. return thisvalue;
  176. }
  177. },
  178. {
  179. display : '操作',
  180. align : 'center',
  181. width : "15%",
  182. isSort : false,
  183. render : function(rowdata, rowindex, value) {
  184. var h = "";
  185. if (!rowdata._editing) {
  186. h += "<a onclick='beginEdit(" + rowindex + ")'><span class='icon_edit'>修改</span></a> ";
  187. h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
  188. } else {
  189. h += "<a onclick='endEdit(" + rowindex + ")'><span class='icon_ok'>提交</span></a> ";
  190. h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
  191. h += "<a onclick='cancelEdit(" + rowindex + ")'><span class='icon_no'>取消</span></a> ";
  192. }
  193. return h;
  194. }
  195. } ];
  196. // 表头2
  197. //var mycolumns2 = $.extend([], mycolumns1);
  198. //mycolumns2.splice(0, 0, {
  199. // display : '单位',
  200. // name : 'DEPTNAME',
  201. // align : 'center',
  202. // width : "15%",
  203. // showTitle : true
  204. //});
  205. //// 表头3
  206. //var mycolumns3 = $.extend([], mycolumns1, []);
  207. //mycolumns3.splice(0, 0, {
  208. // display : '日期',
  209. // name : 'GROUPDATE',
  210. // align : 'center',
  211. // width : "15%",
  212. // showTitle : true
  213. //});
  214. //mycolumns3.splice(mycolumns3.length-1,0,{
  215. // display : '单位',
  216. // name : 'DEPTNAME',
  217. // align : 'center',
  218. // width : "15%",
  219. // showTitle : true
  220. //});
  221. /** 私有方法* */
  222. // 导入方法
  223. /*function submitInfo() {
  224. var val = $("#import_report").val();
  225. var end = val.substring(val.indexOf(".") + 1);
  226. if (end == "xls" || end == "xlsx") {
  227. addfn();
  228. } else {
  229. top.Dialog.alert("请导入正确的excel文件");
  230. return;
  231. }
  232. };
  233. function fileToSave($form) {
  234. // showProgressBar("正在提交中...");
  235. // 表单异步提交处理
  236. $form
  237. .ajaxSubmit({
  238. url : $.pathname()
  239. + "/ws/importGpsUser/BaoGongDianTaskService/importBaoGongDiantask1?report_type=3",
  240. type : 'post',
  241. success : function(responseText, statusText, xhr, $form) {
  242. responseText = eval('(' + responseText + ')');
  243. _this.gridData = responseText;
  244. var data = JSON.stringify(_this.gridData);
  245. // alert(encodeURI(encodeURI(_this.gridData)));
  246. _this.listGrid.setOptions({
  247. "data" : JSON.parse(decodeURI(data))
  248. });
  249. _this.listGrid.resetHeight();
  250. _this.listGrid.loadData();
  251. $("#onviewtype").hide();
  252. setThisHeight();
  253. },
  254. error : function(e) {
  255. $.messager.alert('导入值班信息失败!');
  256. }
  257. });
  258. }
  259. // 导入excle
  260. function addfn() {
  261. var $form = $("#editForm");
  262. fileToSave($form);
  263. };*/
  264. // 切换查看方式
  265. function changeviewtype(type,self) {
  266. $(".viewop").removeClass("viewcurrent");
  267. $(self).addClass("viewcurrent");
  268. var _params = {
  269. task_id : fd_id,
  270. dept : dept_id,
  271. type : type
  272. };
  273. changegrid(type, _params);
  274. }
  275. // 导入后保存
  276. // 新增
  277. function save() {
  278. _this.listGrid.endEdit();
  279. /*if(!flagggg){
  280. top.Dialog.alert("请修改表格中红色的错误数据后,再尝试保存!");
  281. return;
  282. }*/
  283. var urls = $.pathname()
  284. + "/ws/importGpsUser/BaoGongDianTaskService/saveGridData";
  285. var row = _this.listGrid.getData();
  286. if (row == "") {
  287. top.Dialog.alert("表格中无任何数据,请重新导入!");
  288. return;
  289. }
  290. /*for (var int = 0; int < row.length; int++) {
  291. if(compareTime(nowDate,row[int].START_TIME_234)
  292. || compareTime(row[int].START_TIME_234,row[int].END_TIME_234)){
  293. top.Dialog.alert("请修改表格中红色的错误数据后,再尝试保存!");
  294. return;
  295. }
  296. }*/
  297. if($(".errorData").text()!=""){
  298. top.Dialog.alert("请修改表格中红色的错误数据后,再尝试保存!");
  299. return;
  300. }
  301. var json = JSON.stringify(row);
  302. $.ajax({
  303. url : urls,
  304. type : 'post',
  305. timeout : 15000,
  306. data : {
  307. json : json,
  308. // user_id:user_id,
  309. comp_id : dept_id,
  310. report_type : '3',
  311. real_name : realName,
  312. task_id : fd_id,
  313. user_id:user_id
  314. },
  315. dataType : 'json',
  316. success : function(data) {
  317. changeDutyStateForTask();
  318. },
  319. error : function(e) {
  320. $.messager.alert('保存失败!', '访问服务失败!', 'error');
  321. }
  322. });
  323. }
  324. function changeDutyStateForTask() {
  325. var url = $.pathname() + '/ws/crud/CRUDService/update/';
  326. var params = {
  327. classid : "234",
  328. FD_OBJECTID610 : fd_id,
  329. HAS_DUTY_610 : "1"
  330. };
  331. $.ajax({
  332. url : url,
  333. type : 'post',
  334. data : params,
  335. dataType : 'json',
  336. success : function(data) {
  337. if (data.Msg.sucsess == true) {
  338. top.Dialog.alert("保存成功");
  339. $("#onviewtype").show();
  340. } else {
  341. top.Dialog.alert("保存失败");
  342. }
  343. },
  344. error : function(e) {
  345. $.messager.alert('保存失败!', '访问服务失败!', 'error');
  346. }
  347. });
  348. }
  349. function changegrid(type, _params) {
  350. $.ajax({
  351. url : $.pathname()
  352. + '/ws/importGpsUser/BaoGongDianTaskService/quiTaskDutyByType',
  353. type : 'post',
  354. data : _params,
  355. dataType : 'json',
  356. asncy:false,
  357. success : function(data) {
  358. // var griddata = data.griddata;
  359. // var groupdata = data.groupdata;
  360. //alert(JSON.stringify(data));
  361. intgrid(type, data);
  362. },
  363. error : function(e) {
  364. $.messager.alert('查询值班详细失败!', 'error');
  365. }
  366. }).done(function(){
  367. //alert($(window.document.body).height()+","+$(parent.document.body).height()+","+$(parent.parent.document.body).height());
  368. //var pheight = $(parent.document.body).height()>$(window.document.body).height()?$(parent.document.body).height():$(window.document.body).height();
  369. setThisHeight();
  370. //alert($(window.document.body).height()+","+$(parent.document.body).height()+","+$(parent.parent.document.body).height());
  371. });
  372. }
  373. function intgrid(type, griddata) {
  374. if (type == 1) {
  375. /* if(_this.listGrid !=null&&_this.listGrid.options.groupColumnName!="") {
  376. _this.listGrid.setOptions({
  377. groupColumnName:"LEADER_234",
  378. groupColumnDisplay: "值班领导",
  379. groupRender: ""
  380. });
  381. }*/
  382. _this.listGrid = $("#dataGrid").quiGrid({// 只看本单位
  383. columns : mycolumns1,
  384. // url : $.pathname() +
  385. // '/ws/importGpsUser/BaoGongDianTaskService/quiTaskDutyByType',
  386. // params :params,
  387. data : griddata,
  388. sortOrder : 'desc', // 排序方式
  389. rownumbers : true,
  390. checkbox : false,
  391. width : '100%',
  392. //height:"100%",
  393. usePager : false,
  394. percentWidthMode : true,
  395. enabledEdit : true,
  396. asncy:false,
  397. clickToEdit : false,
  398. onDblClickRow : function(rowdata, rowindex) {
  399. _this.listGrid.beginEdit(rowindex);
  400. },
  401. onBeforeEdit : onBeforeEdit,
  402. onBeforeSubmitEdit : onBeforeSubmitEdit,
  403. onAfterSubmitEdit : onAfterSubmitEdit,
  404. percentWidthMode : true,
  405. sortName : 'UPDATEDATE_234',
  406. groupColumnName:"LEADER_234",
  407. groupColumnDisplay: "值班领导",
  408. groupRender: function(groupValue, groupData, groupColumnDisplay){
  409. return "<font color=red>值班领导:"+groupValue+"【共" + groupData.length + "条记录】</font>";
  410. }
  411. });
  412. } else if (type == 2) {
  413. _this.listGrid = $("#dataGrid").quiGrid({// 按单位分组
  414. columns : mycolumns2,
  415. // url : $.pathname() +
  416. // '/ws/importGpsUser/BaoGongDianTaskService/quiTaskDutyByType',
  417. // params :params,
  418. data : griddata,
  419. sortOrder : 'desc', // 排序方式
  420. //rownumbers : true,
  421. checkbox : false,
  422. width : '100%',
  423. usePager : false,
  424. asncy:false,
  425. pageSize : 10,
  426. percentWidthMode : true,
  427. enabledEdit : true,
  428. clickToEdit : false,
  429. onDblClickRow : function(rowdata, rowindex) {
  430. _this.listGrid.beginEdit(rowindex);
  431. },
  432. onBeforeEdit : onBeforeEdit,
  433. onBeforeSubmitEdit : onBeforeSubmitEdit,
  434. onAfterSubmitEdit : onAfterSubmitEdit,
  435. percentWidthMode : true,
  436. sortName : 'UPDATEDATE_234',
  437. groupColumnName : "DEPTNAME",
  438. groupColumnDisplay: '单位',
  439. groupRender: function(groupValue, groupData, groupColumnDisplay){
  440. return "<font color=red>"+groupValue+"【共" + groupData.length + "条记录】</font>";
  441. }
  442. });
  443. } else if (type == 3) {
  444. _this.listGrid = $("#dataGrid").quiGrid({// 按日期分组
  445. columns : mycolumns3,
  446. // url : $.pathname() +
  447. // '/ws/importGpsUser/BaoGongDianTaskService/quiTaskDutyByType',
  448. // params :params,
  449. data : griddata,
  450. sortOrder : 'desc', // 排序方式
  451. //rownumbers : true,
  452. checkbox : false,
  453. width : '100%',
  454. usePager : false,
  455. asncy:false,
  456. pageSize : 10,
  457. percentWidthMode : true,
  458. enabledEdit : true,
  459. clickToEdit : false,
  460. onDblClickRow : function(rowdata, rowindex) {
  461. _this.listGrid.beginEdit(rowindex);
  462. },
  463. onBeforeEdit : onBeforeEdit,
  464. onBeforeSubmitEdit : onBeforeSubmitEdit,
  465. onAfterSubmitEdit : onAfterSubmitEdit,
  466. percentWidthMode : true,
  467. // sortName : 'GROUPDATE',
  468. groupColumnName : "GROUPDATE",
  469. groupColumnDisplay: '日期',
  470. groupRender: function(groupValue, groupData, groupColumnDisplay){
  471. return "<font color=red>"+groupValue+"【共" + groupData.length + "条记录】</font>";
  472. }
  473. });
  474. }
  475. setThisHeight();
  476. }
  477. function setThisHeight(){
  478. $("#formContent").height($(".box_middleright").height());
  479. $(parent.document.body).find("iframe").height($(window.document.body).height()+30);
  480. $(top.document.body).find("iframe").height($(parent.document.body).height());
  481. }
  482. // 删除
  483. /*
  484. * function onDelete(rowidx){ top.Dialog.confirm("确定要删除该记录吗?",function(){ //删除记录
  485. * var row = _this.listGrid.getRow(rowidx);
  486. * alert(JSON.stringify(row.FD_OBJECTID_234));
  487. * $.post("/qui/userdbAction.do?method=deleteUser", {"ids":row.userId},
  488. * function(result){ handleResult(result); },"json"); //刷新表格
  489. * _this.listGrid.loadData(); }); }
  490. */
  491. // 批量删除
  492. function onDelete(rowidx) {
  493. _this.listGrid.select(rowidx);
  494. var rows = _this.listGrid.getSelectedRows(rowidx);
  495. var rowsLength = rows.length;
  496. if (rowsLength == 0) {// 请选中要删除的记录!
  497. top.Dialog.alert("请选中要删除的记录!");
  498. return;
  499. }
  500. var ids = "";
  501. for (var i = 0; i < rowsLength; i++) {
  502. ids += rows[i].FD_OBJECTID234 + ",";
  503. }
  504. if(ids=="undefined,"){
  505. _this.listGrid.deleteSelectedRow();
  506. _this.listGrid.loadData();
  507. }else{
  508. var url = $.pathname() + "/ws/crud/CRUDService/delete/";
  509. var params = {
  510. objectIDs : ids,
  511. classid : 234
  512. };
  513. top.Dialog.confirm("确定要删除吗?|删除", function() {
  514. $.request.del(url, params, function(result) {
  515. if (result.Msg.sucsess == true) {
  516. top.Dialog.alert("删除成功!");
  517. // 刷新表格数据
  518. // _this.listGrid.loadData();
  519. // _this.listGrid.rend();
  520. changegrid("1", _this.loadParams);
  521. } else {
  522. top.Dialog.alert("删除失败!");
  523. }
  524. });
  525. });
  526. }
  527. }
  528. // 删除
  529. /*
  530. * function onDelete(rowidx) { top.Dialog.confirm("确定要删除吗?|删除", function() {
  531. * isValida = false; flag = false; endEdit(rowidx); //删除记录 var row =
  532. * _this.listGrid.getRow(rowidx); //删除操作 var url = $.pathname() +
  533. * "/ws/crud/CRUDService/delete/"; var params = { objectIDs :
  534. * row.FD_OBJECTID_234, classid : 234, }; $.request.del(url, params,
  535. * function(result) { if (result.Msg.sucsess == true) {
  536. * top.Dialog.alert("删除成功!"); // 刷新表格数据 _this.listGrid.rend(); } else {
  537. * top.Dialog.alert("删除失败!"); } }); _this.listGrid.deleteRow(row); });
  538. * }
  539. */
  540. // 编辑
  541. function beginEdit(rowid) {
  542. _this.listGrid.beginEdit(rowid);
  543. }
  544. // 取消编辑
  545. function cancelEdit(rowid) {
  546. _this.listGrid.cancelEdit(rowid);
  547. }
  548. // 结束编辑
  549. function endEdit(rowid) {
  550. // _this.listGrid.endEdit(rowid);
  551. // alert(JSON.stringify(_this.listGrid.getRow(rowid)));
  552. /* var row = _this.listGrid.getRow(rowid);
  553. var nowDate = getNowDate();
  554. if(row.START_TIME_234 < nowDate){//如果开始时间小于当前时间
  555. top.Dialog.alert("开始时间不能小于当前时间!"); //_this.listGrid.endEdit(rowid);
  556. return false;
  557. }else if(row.START_TIME_234 > row.END_TIME_234){//如果开始时间大于结束时间
  558. top.Dialog.alert("开始时间不能大于结束时间!");
  559. return false;
  560. }*/
  561. _this.listGrid.endEdit(rowid);
  562. }
  563. function rowToBO(row) {
  564. var params = row.FD_OBJECTID_234 + '&' + row.START_TIME_234 + '&'
  565. + row.END_TIME_234 + '&' + row.LEADER_234 + '&'
  566. + row.LEADER_TEL_234+ '&' + row.LEADER_DUTY_MODE_234 + '&' + row.WATCH_MAN_234 + '&'
  567. + row.WATCH_TEL_234 + '&' + row.DUTY_MODE_234;
  568. return params;
  569. }
  570. // 删除后的提示
  571. function handleResult(result) {
  572. if (result == 1) {
  573. top.Dialog.alert("删除成功!", null, null, null, 1);
  574. _this.listGrid.loadData();
  575. } else {
  576. top.Dialog.alert("删除失败!");
  577. }
  578. }
  579. // 全部确认修改
  580. function endAllEdit() {
  581. _this.listGrid.endEdit();
  582. }
  583. // 全部取消修改
  584. function cancelAllEdit() {
  585. _this.listGrid.cancelEdit();
  586. }
  587. // 编辑前事件
  588. function onBeforeEdit(e) {
  589. var str = "编辑前事件,可阻止某些行或列进行编辑。列名:" + e.column.name + ";行号:" + e.rowindex
  590. + ";编辑前的值:" + e.value + "\n";
  591. // if(e.record.id=="121"){
  592. // top.Dialog.alert("此行不可编辑",null,null,null,2);
  593. // return false;
  594. // }
  595. }
  596. //获得当前系统时间:年月日时分
  597. function getDateTime(){
  598. var s="";
  599. var d = allGetServerTime();
  600. var vYear = d.getFullYear();
  601. var vMon = d.getMonth() + 1;
  602. var vDay = d.getDate();
  603. var h = d.getHours();
  604. var m = d.getMinutes();
  605. //var se = d.getSeconds();
  606. s=vYear+"-"+(vMon<10 ? "0" + vMon : vMon)+"-"+(vDay<10 ? "0"+ vDay : vDay)+" "+(h<10 ? "0"+ h : h)+":"+(m<10 ? "0" + m : m);//+":"+(se<10 ? "0" +se : se);
  607. return s;
  608. }
  609. // 编辑提交前事件
  610. function onBeforeSubmitEdit(e) {// ====================================================================================================================================
  611. var nowDate = getDateTime();
  612. /*if (compareTime(nowDate,e.newdata.START_TIME_234)) {// 如果开始时间小于当前时间
  613. top.Dialog.alert("开始时间不能小于当前时间!");
  614. return false;
  615. }*/
  616. // 做验证判断
  617. // alert(JSON.stringify(e));//先看传过来的参数是什么
  618. // alert(JSON.stringify(e.record);
  619. // alert(JSON.stringify(e.record.START_TIME_234));
  620. // alert(e.record.START_TIME_234);
  621. if (compareTime(e.newdata.START_TIME_234,e.newdata.END_TIME_234)) {
  622. top.Dialog.alert("开始时间不能大于结束时间!");
  623. return false;
  624. }
  625. if (e.newdata.START_TIME_234 == "") {
  626. top.Dialog.alert("开始时间不能为空!");
  627. return false;
  628. }
  629. if (e.newdata.END_TIME_234 == "") {
  630. top.Dialog.alert("结束时间不能为空!");
  631. return false;
  632. }
  633. if (e.newdata.LEADER_234 == "") {
  634. top.Dialog.alert("值班领导列不能为空!");
  635. return false;
  636. }
  637. if (e.newdata.LEADER_TEL_234 == "") {
  638. top.Dialog.alert("领导电话列不能为空!");
  639. return false;
  640. }
  641. if (e.newdata.LEADER_DUTY_MODE_234 == "") {
  642. top.Dialog.alert("值班类型列不能为空!");
  643. return false;
  644. }
  645. if (e.newdata.WATCH_MAN_234 == "") {
  646. top.Dialog.alert("值班人员列不能为空!");
  647. return false;
  648. }
  649. if (e.newdata.WATCH_TEL_234 == "") {
  650. top.Dialog.alert("值班人电话列不能为空!");
  651. return false;
  652. }
  653. if (e.newdata.DUTY_MODE_234 == "") {
  654. top.Dialog.alert("值班类型列不能为空!");
  655. return false;
  656. }
  657. }
  658. // 编辑后事件
  659. function onAfterSubmitEdit(e) {// ======================================================================================================================================
  660. // 在这里一律作修改处理
  661. var rowData = e.newdata;
  662. rowData.FD_OBJECTID_234 = e.record.FD_OBJECTID234;
  663. // ajax方式提交数据到数据库
  664. var _url = $.pathname()
  665. + '/ws/importGpsUser/BaoGongDianTaskService/saveGpsDuty';
  666. $.ajax({
  667. url : _url,
  668. type : 'post',
  669. async : false,
  670. data : rowToBO(rowData),
  671. dataType : 'text',
  672. success : function(data) {
  673. top.Dialog.alert("保存用户成功");
  674. _this.listGrid.loadData();
  675. },
  676. error : function(e) {
  677. $.messager.alert('保存失败!', '访问服务失败!', 'error');
  678. }
  679. });
  680. // var row =certInfoGrid.getRow(e.rowindex);
  681. // $.post("/material/certInfo/saveCertInfo.do?",rowToBO(row),function(){},"json");
  682. }
  683. $(function() {
  684. $queryForm = $("#queryForm");
  685. // 列表加载参数
  686. _this.loadParams = {
  687. task_id:fd_id,
  688. type:1,
  689. dept:dept_id
  690. };
  691. //$("#import_gpsUser").live("click", submitInfo);
  692. $("#save").live("click", save);
  693. changegrid("1", _this.loadParams);
  694. });
  695. function compareTime(time1,time2){
  696. return time1>time2;
  697. }
  698. //检查数据格式是否正确
  699. function checkName(data,type){
  700. var flag = true;
  701. var c = "";
  702. if(type=="rm"){//人名
  703. checkRex = /^[\u4e00-\u9fa5]{1,5}$/;
  704. }else if(type=="dh"){//电话
  705. //checkRex = /^1{1}[0,9]{10}$/;
  706. checkRex = /^(\+\d{2,3}\-)?\d{11}$/;
  707. }else if(type=="sj"){//时间
  708. checkRex = /^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))\\s{1}[0-5]{1}[0-9]{1}\\:[0-5]{1}[0-9]{1}$/;
  709. }
  710. if(type=="zbfs"){//值班方式
  711. if(data=='在岗值班' || data=='电话值班' || data=='应急指挥中心值班'){
  712. flag = true;
  713. }else{
  714. flag = false;
  715. }
  716. }else if(!checkRex.test(data)){
  717. flag = false;
  718. }
  719. return flag;
  720. }