a3125b1a8731019e765851a1fb9a885f04a9eaef.svn-base 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. /**
  2. * 功能:
  3. *
  4. *
  5. * @author HXB
  6. * @date 2015/09/18
  7. */
  8. // 获取用户部门
  9. var dept_id = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
  10. // 获取公司
  11. var corp_name=top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
  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. var is_import = false;//是导入还是查看,导入时的修改提交只要结束编辑该行就行,若是查看,则修改提交需要访问后台
  27. deptJson = {"list":[]};
  28. var is_edit = false;//false表示没有正在编辑的行,true表示有一行正在编辑
  29. var is_add = false;//是否新增
  30. /** 私有方法* */
  31. //导入方法
  32. function submitInfo() {
  33. var val= $("#import_report").val();
  34. var end = val.substring(val.indexOf(".")+1);
  35. if(end=="xls"||end=="xlsx"){
  36. addfn();
  37. }else{
  38. top.Dialog.alert("请导入正确的excel文件");
  39. return;
  40. }
  41. };
  42. //保存
  43. function fileToSave($form){
  44. //showProgressBar("正在提交中...");
  45. //表单异步提交处理
  46. $form.ajaxSubmit({
  47. url:$.pathname() + "/ws/importGpsUser/BaoGongDianTaskService/importBaoGongDiantask?report_type=2&taskId="+fd_id,
  48. type : 'post',
  49. success: function(responseText, statusText, xhr, $form){
  50. //alert(responseText);
  51. responseText = eval('('+responseText+')');
  52. _this.gridData = responseText;
  53. var data = JSON.stringify(_this.gridData);
  54. //alert(encodeURI(encodeURI(_this.gridData)));
  55. _this.listGrid.setOptions({
  56. "data" :JSON.parse(decodeURI(data))
  57. });
  58. /*if(_this.gridData.rows.length <= 8){
  59. _this.listGrid.options.height ="500px";
  60. loadGridData();
  61. }*/
  62. is_import = true;
  63. is_edit = false;
  64. is_add = false;
  65. //loadGridData();
  66. setThisHeight();
  67. //_this.listGrid.cancelEdit(rowid);
  68. },
  69. error : function(e) {
  70. top.Dialog.alert('导入失败!');
  71. }
  72. });
  73. }
  74. //导入excle
  75. function addfn() {
  76. var $form = $("#editForm");
  77. fileToSave($form);
  78. };
  79. //导入后保存
  80. // 新增报表
  81. function save() {
  82. _this.listGrid.endEdit();
  83. var urls = $.pathname() + "/ws/importGpsUser/BaoGongDianTaskService/saveGridData";
  84. var row = _this.listGrid.getData();
  85. if(row==""){
  86. top.Dialog.alert("表格中无任何数据,请重新导入!");
  87. return;
  88. }
  89. if($(".errorData").text()!=""){
  90. top.Dialog.alert("请修改表格中红色的错误数据后,再尝试保存!");
  91. return;
  92. }
  93. var json=JSON.stringify(row);
  94. $.ajax({
  95. url : urls,
  96. type : 'post',
  97. timeout : 15000,
  98. async : false,
  99. data : {
  100. json:json,
  101. user_id:user_id,
  102. comp_id : dept_id,
  103. report_type:'2',
  104. real_name:realName,
  105. task_id:fd_id,
  106. corp_name:corp_name
  107. },
  108. dataType : 'json',
  109. success : function(data) {
  110. if(data.Msg.sucsess==true){
  111. top.Dialog.alert("保存成功");
  112. is_import = false;
  113. }else{
  114. top.Dialog.alert("保存失败");
  115. is_import = false;
  116. }
  117. loadThisGrid();
  118. },
  119. error : function(e) {
  120. $.messager.alert('保存失败!', '访问服务失败!', 'error');
  121. }
  122. });
  123. }
  124. function loadThisGrid(){
  125. var url = $.pathname() + '/ws/crud/CRUDService/queryQui';
  126. $.ajax({
  127. url : url,
  128. type : 'post',
  129. async : false,
  130. data :_this.loadParams,
  131. dataType : 'json',
  132. success : function(data) {
  133. _this.listGrid.setOptions({data:data});
  134. setThisHeight();
  135. },
  136. error : function(e) {
  137. $.messager.alert('保存失败!', '访问服务失败!', 'error');
  138. }
  139. });
  140. }
  141. function initgrid(){
  142. $queryForm = $("#queryForm");
  143. // 列表加载参数
  144. _this.loadParams = {
  145. listId : '620',
  146. condition : "is_del=0 ",
  147. "TASK_ID_620":fd_id
  148. };
  149. /** grid载入数据* */
  150. _this.listGrid = $("#dataGrid").quiGrid({
  151. columns : [ /*{
  152. display : '编号',
  153. name : 'ID',
  154. hide : true
  155. }, */{
  156. display : '保供电任务编号',
  157. name : 'GPS_TASK_NUMBER_620',
  158. align : 'center',
  159. width : 150,
  160. showTitle:true
  161. }, {
  162. display : '保供电资源投入',
  163. columns :[{
  164. display : '应急发电车(UPS电源)',
  165. columns :[{
  166. display : '单日最大用量/台',
  167. name : 'GPS_TASK_FDC_DAY_620',
  168. showTitle : true,
  169. width : 150,
  170. editor: { type: 'text',maxlength:6,inputMode:"numberOnly" },
  171. render : function(rowdata, rowindex, value, column){
  172. if(!checkName(value,"sl")){
  173. value = value==undefined?"":value;
  174. value = "<div class='errorData'>"+value+"</div>";
  175. }
  176. return value;
  177. }
  178. }, {
  179. display : '投入总量/台次',
  180. name : 'GPS_TASK__FDC_TOTAL_620',
  181. showTitle : true,
  182. width : 150,
  183. editor: { type: 'text',maxlength:6,inputMode:"numberOnly" },
  184. render : function(rowdata, rowindex, value, column){
  185. if(!checkName(value,"sl")){
  186. value = value==undefined?"":value;
  187. value = "<div class='errorData'>"+value+"</div>";
  188. }
  189. return value;
  190. }
  191. }]
  192. }, {
  193. display : '应急发电机(UPS电源)',
  194. columns :[{
  195. display : '单日最大用量/台',
  196. name : 'GPS_TASK_FDJ_DAY_620',
  197. showTitle : true,
  198. width : 150,
  199. editor: { type: 'text',maxlength:6,inputMode:"numberOnly" },
  200. render : function(rowdata, rowindex, value, column){
  201. if(!checkName(value,"sl")){
  202. value = value==undefined?"":value;
  203. value = "<div class='errorData'>"+value+"</div>";
  204. }
  205. return value;
  206. }
  207. }, {
  208. display : '投入总量/台次',
  209. name : 'GPS_TASK_FDJ_TOTAL_620',
  210. showTitle : true,
  211. width : 150,
  212. editor: { type: 'text',maxlength:6,inputMode:"numberOnly"},
  213. render : function(rowdata, rowindex, value, column){
  214. if(!checkName(value,"sl")){
  215. value = value==undefined?"":value;
  216. value = "<div class='errorData'>"+value+"</div>";
  217. }
  218. return value;
  219. }
  220. }]
  221. }, {
  222. display : '车辆/辆次',
  223. name : 'GPS_TASK_CAR_620',
  224. showTitle : true,
  225. width : 150,
  226. editor: { type: 'text',maxlength:6,inputMode:"numberOnly" },
  227. render : function(rowdata, rowindex, value, column){
  228. if(!checkName(value,"sl")){
  229. value = value==undefined?"":value;
  230. value = "<div class='errorData'>"+value+"</div>";
  231. }
  232. return value;
  233. }
  234. }]
  235. }, {
  236. display : '保供电人员投入',
  237. columns :[{
  238. display : '值班指挥管理人员/人日',
  239. name : 'GPS_TASK_ZBZHGLRY_620',
  240. showTitle : true,
  241. width : 150,
  242. editor: { type: 'text',maxlength:6,inputMode:"numberOnly" },
  243. render : function(rowdata, rowindex, value, column){
  244. if(!checkName(value,"sl")){
  245. value = value==undefined?"":value;
  246. value = "<div class='errorData'>"+value+"</div>";
  247. }
  248. return value;
  249. }
  250. }, {
  251. display : '本单位班组人员/人日',
  252. name : 'GPS_TASK_BDWBZRY_620',
  253. showTitle : true,
  254. width : 150,
  255. editor: { type: 'text',maxlength:6,inputMode:"numberOnly" },
  256. render : function(rowdata, rowindex, value, column){
  257. if(!checkName(value,"sl")){
  258. value = value==undefined?"":value;
  259. value = "<div class='errorData'>"+value+"</div>";
  260. }
  261. return value;
  262. }
  263. }, {
  264. display : '安保人员/人日',
  265. name : 'GPS_TASK_ABRY_620',
  266. showTitle : true,
  267. width : 150,
  268. editor: { type: 'text',maxlength:6,inputMode:"numberOnly" },
  269. render : function(rowdata, rowindex, value, column){
  270. if(!checkName(value,"sl")){
  271. value = value==undefined?"":value;
  272. value = "<div class='errorData'>"+value+"</div>";
  273. }
  274. return value;
  275. }
  276. }, {
  277. display : '外委生产人员/人日',
  278. name : 'GPS_TASK_WWSCRY_620',
  279. showTitle : true,
  280. width : 150,
  281. editor: { type: 'text',maxlength:6,inputMode:"numberOnly" },
  282. render : function(rowdata, rowindex, value, column){
  283. if(!checkName(value,"sl")){
  284. value = value==undefined?"":value;
  285. value = "<div class='errorData'>"+value+"</div>";
  286. }
  287. return value;
  288. }
  289. }]
  290. },/*{
  291. display : '保供电任务时间',
  292. columns : [{
  293. display : '开始日期',
  294. name : 'START_TIME_620',
  295. align : 'center',
  296. width : 220,
  297. showTitle:true
  298. },{
  299. display : '结束日期',
  300. name : 'END_TIME_620',
  301. align : 'center',
  302. width : 180,
  303. showTitle:true
  304. },{
  305. display : '持续时间/天',
  306. name : 'GPS_CONTINATION_TIME_620',
  307. align : 'center',
  308. width : 180,
  309. showTitle:true
  310. }]
  311. }, */{
  312. display : '操作',
  313. align : 'center',
  314. width : 150,
  315. isSort : false,
  316. render: function (rowdata, rowindex, value)
  317. {
  318. var h = "";
  319. if (!rowdata._editing)
  320. {
  321. h += "<a onclick='beginEdit(" + rowindex + ")'><span class='icon_edit'>修改</span></a> ";
  322. h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
  323. }
  324. else
  325. {
  326. h += "<a onclick='endEdit(" + rowindex + ")'><span class='icon_ok'>提交</span></a> ";
  327. // h += "<a onclick='onDelete(" + rowindex + ")'><span class='icon_delete'>删除</span></a> ";
  328. h += "<a onclick='cancelEdit(" + rowindex + ")'><span class='icon_no'>取消</span></a> ";
  329. }
  330. return h;
  331. }
  332. }],
  333. //url : $.pathname() + '/ws/crud/CRUDService/queryQui',
  334. //params :_this.loadParams,
  335. data:"",
  336. sortOrder : 'desc', // 排序方式
  337. rownumbers : true,
  338. //checkbox : true,
  339. //width : '100%',
  340. height:'550px',
  341. pageSize : 10,
  342. usePager : true,
  343. percentWidthMode : true,
  344. sortName : 'UPDATEDATE_620',
  345. enabledEdit: true,
  346. clickToEdit: false,
  347. // onDblClickRow:function(rowdata, rowindex){
  348. // beginEdit(rowindex);
  349. // },
  350. onBeforeEdit: onBeforeEdit,
  351. onBeforeSubmitEdit: onBeforeSubmitEdit,
  352. onAfterSubmitEdit: onAfterSubmitEdit,
  353. toolbar : {
  354. items : [ { text : '新增',click : addJournaling,iconClass : 'icon_add'}]
  355. }
  356. });
  357. //setThisHeight();
  358. }
  359. //批量删除
  360. function onDelete(rowidx) {
  361. if(is_edit){
  362. top.Dialog.alert("请先完成当前记录的编辑!");
  363. return;
  364. }
  365. _this.listGrid.select(rowidx);
  366. var rows = _this.listGrid.getSelectedRows(rowidx);
  367. var rowsLength = rows.length;
  368. if (rowsLength == 0) {//请选中要删除的记录!
  369. top.Dialog.alert("请选中要删除的记录!");
  370. return;
  371. }
  372. var ids = "";
  373. for ( var i = 0; i < rowsLength; i++) {
  374. ids += rows[i].FD_OBJECTID620+ ",";
  375. }
  376. if(ids=="undefined,"){
  377. _this.listGrid.deleteSelectedRow();
  378. loadGridData();
  379. }else{
  380. var url = $.pathname() +"/ws/crud/CRUDService/delete/";
  381. var params = {
  382. objectIDs : ids,
  383. classid : 620
  384. };
  385. top.Dialog.confirm("确定要删除吗?|删除", function() {
  386. $.request.del(url,params,function(result){
  387. if (result.Msg.sucsess == true) {
  388. top.Dialog.alert("删除成功!");
  389. is_edit = false;
  390. // 刷新表格数据
  391. loadGridData();
  392. } else {
  393. top.Dialog.alert("删除失败!");
  394. }
  395. });
  396. });
  397. }
  398. }
  399. function addJournaling(){
  400. if(is_edit){
  401. top.Dialog.alert("请先完成当前记录的编辑!");
  402. return;
  403. }
  404. editingRow=0;
  405. isNew=true;
  406. var row = _this.listGrid.getRow(0);
  407. var rowData={
  408. taskid:fd_id,
  409. real_name:realName,
  410. compId:dept_id
  411. };
  412. var rowdata = _this.listGrid.getData();
  413. if(rowdata.length<=8){
  414. /*_this.listGrid.options.height = "500px";
  415. loadGridData();*/
  416. _this.listGrid.setOptions({"height":"500px"});
  417. _this.listGrid.resetHeight();
  418. setThisHeight();
  419. }
  420. _this.listGrid .addEditRow(rowData, row, true);
  421. is_edit = true;
  422. is_add = true;
  423. }
  424. //删除
  425. /*function onDelete(rowidx){
  426. top.Dialog.confirm("确定要删除吗?|删除", function() {
  427. isValida = false;
  428. flag = false;
  429. endEdit(rowidx);
  430. //删除记录
  431. var row = _this.listGrid.getRow(rowidx);
  432. //删除操作
  433. var url = $.pathname() + "/ws/crud/CRUDService/delete/";
  434. var params = {
  435. objectIDs : row.FD_OBJECTID_620,
  436. classid : 620,
  437. };
  438. $.request.del(url, params, function(result) {
  439. if (result.Msg.sucsess == true) {
  440. top.Dialog.alert("删除成功!");
  441. // 刷新表格数据
  442. _this.listGrid.rend();
  443. } else {
  444. top.Dialog.alert("删除失败!");
  445. }
  446. });
  447. _this.listGrid.deleteRow(row);
  448. });
  449. // top.Dialog.confirm("确定要删除该记录吗?",function(){
  450. // isValida = false;
  451. // flag = false;
  452. // endEdit(rowidx);
  453. // //删除记录
  454. // var row = _this.listGrid.getRow(rowidx);
  455. // $.post("/qui/userdbAction.do?method=deleteUser",
  456. // {"ids":row.userId},
  457. // function(result){
  458. // handleResult(result);
  459. // },"json");
  460. // //刷新表格
  461. // loadGridData();
  462. // });
  463. }*/
  464. //编辑
  465. function beginEdit(rowid) {
  466. if(!is_edit){
  467. var rowdata = _this.listGrid.getData();
  468. if(rowdata.length<=8){
  469. _this.listGrid.setOptions({
  470. "height" :"500px"
  471. });//.options.height = "500px";
  472. loadGridData();
  473. setThisHeight();
  474. }
  475. _this.listGrid.beginEdit(rowid);
  476. is_edit = true;
  477. }else{
  478. top.Dialog.alert("请先完成当前记录的编辑!");
  479. return;
  480. }
  481. }
  482. //取消编辑
  483. function cancelEdit(rowid) {
  484. if(is_add){//如果是新增的那一行,则直接调删除的方法
  485. _this.listGrid.select(rowid);
  486. _this.listGrid.deleteSelectedRow();
  487. loadGridData();
  488. }else{
  489. _this.listGrid.cancelEdit(rowid);
  490. }
  491. is_edit = false;
  492. is_add = false;
  493. }
  494. //结束编辑
  495. function endEdit(rowid)
  496. {
  497. _this.listGrid.endEdit(rowid);
  498. is_edit = false;
  499. is_add = false;
  500. }
  501. //将row JSON对象转化为bo对象
  502. function rowToBO(row) {
  503. var params = row.FD_OBJECTID_620+'&'+row.BGD_DW_620+'&'
  504. +row.MAN_COUNT_620+'&'+row.CAR_COUNT_620+'&'+
  505. +row.BGD_FDC_620+'&'+row.BGD_FDJ_620+'&'+
  506. realName+'&'+dept_id+'&'+
  507. row.XINGHAO_620+'&'+row.RONGLIANG_620+'&'+
  508. row.CHANJIA_620+'&'+row.QTZHUNGBEI_620;
  509. return params;
  510. }
  511. //删除后的提示
  512. function handleResult(result){
  513. if(result == 1){
  514. top.Dialog.alert("删除成功!",null,null,null,1);
  515. loadGridData();
  516. }else{
  517. top.Dialog.alert("删除失败!");
  518. }
  519. }
  520. //全部确认修改
  521. function endAllEdit(){
  522. _this.listGrid.endEdit();
  523. is_edit = false;
  524. }
  525. //全部取消修改
  526. function cancelAllEdit()
  527. {
  528. _this.listGrid.cancelEdit();
  529. is_edit = false;
  530. }
  531. //编辑前事件
  532. function onBeforeEdit(e)
  533. {
  534. var str="编辑前事件,可阻止某些行或列进行编辑。列名:"+e.column.name+";行号:"+e.rowindex+";编辑前的值:"+e.value+"\n";
  535. //if(e.record.id=="121"){
  536. //top.Dialog.alert("此行不可编辑",null,null,null,2);
  537. // return false;
  538. //}
  539. }
  540. //编辑提交前事件
  541. function onBeforeSubmitEdit(e){
  542. var ee = e.newdata;
  543. if(!is_edit){
  544. return false;
  545. }
  546. }
  547. function checkDept(value,rowindex){
  548. var flag = false;
  549. for (var i = 0; i < deptJson["list"].length; i++) {
  550. if (deptJson["list"][i]['value'] == value){
  551. flag = true;
  552. break;
  553. }
  554. }
  555. /*if(!flag){
  556. if(rowindex){
  557. top.Dialog.alert("第"+(rowindex+1)+"行数据‘单位’没在该任务保供电责任单位中!");
  558. }
  559. }*/
  560. return flag;
  561. }
  562. //编辑后事件
  563. function onAfterSubmitEdit(e)
  564. {
  565. if(is_import){//如果是导入还未保存
  566. return ;
  567. }
  568. // 在这里一律作修改处理
  569. var rowData = e.newdata;
  570. rowData.classid = "620";
  571. rowData.FD_OBJECTID620 = e.record.FD_OBJECTID620;
  572. rowData.INPUT_UNIT_620 = dept_id;
  573. rowData.INPUT_USER_620 = realName;
  574. rowData.TASK_ID_620 = fd_id;
  575. //ajax方式提交数据到数据库
  576. //var _url = $.pathname() + '/ws/importGpsUser/BaoGongDianTaskService/saveZiYuanBaoBiao';
  577. var _url = $.pathname() + '/ws/crud/CRUDService/create/';
  578. if(e.record.FD_OBJECTID620){
  579. _url = $.pathname() + '/ws/crud/CRUDService/update/';
  580. }
  581. $.ajax({
  582. url : _url,
  583. type : 'post',
  584. async : false,
  585. data : rowData,
  586. dataType : 'json',
  587. success : function(data) {
  588. top.Dialog.alert(data.Msg.info);
  589. loadGridData();
  590. },
  591. error : function(e) {
  592. top.Dialog.alert('保存失败!', '访问服务失败!', 'error');
  593. }
  594. });
  595. //var row =certInfoGrid.getRow(e.rowindex);
  596. //$.post("/material/certInfo/saveCertInfo.do?",rowToBO(row),function(){},"json");
  597. }
  598. $(function() {
  599. //getDeptMsgByTaskId();
  600. $("#import_gpsUser").live("click",submitInfo);
  601. $("#save").live("click",save);
  602. initgrid();
  603. loadGridData();
  604. $("#export_btn").bind("click",exportData);
  605. });
  606. function loadGridData(){
  607. var _url = $.pathname() + '/ws/crud/CRUDService/queryQui';
  608. _this.loadParams = {
  609. listId : '620',
  610. condition : "is_del=0 and TASK_ID='"+fd_id+"'",
  611. "TASK_ID_620":fd_id
  612. };
  613. $.ajax({
  614. url : _url,
  615. type : 'post',
  616. data : _this.loadParams,
  617. dataType : 'json',
  618. success : function(data) {
  619. if(data.rows.length==0){
  620. data.rows = [{aa:""}];
  621. }
  622. _this.listGrid.setOptions({data:data});
  623. _this.listGrid.loadData();
  624. },
  625. error : function(e) {
  626. //$.messager.alert('保存失败!', '访问服务失败!', 'error');
  627. top.Dialog.alert('访问服务失败!');
  628. }
  629. });
  630. }
  631. //导出
  632. function exportData(){
  633. excelExport(
  634. 620,
  635. {condition:"is_del=0 and TASK_ID='"+fd_id+"'"},
  636. "保供电任务报表",
  637. "FD_OBJECTID,INPUT_UNIT_ID,INPUT_UNIT_NAME,INPUT_NAME,INPUT_NAME_ID,START_TIME,END_TIME,UPDATEDATE,INPUT_TIME,IS_DEL,ISSUE_TIME,ISSUE_DEPT,GPS_CONTINATION_TIME,TASK_ID",
  638. "保供电任务报表",
  639. "gps"
  640. );
  641. };
  642. /***
  643. * 通过任务id查询出保供电责任单位的单位及id
  644. */
  645. function getDeptMsgByTaskId(){
  646. var _url = $.pathname() + '/ws/importGpsUser/BaoGongDianTaskService/getDeptMsgByTaskId';
  647. $.ajax({
  648. url : _url,
  649. type : 'post',
  650. async : false,
  651. data : {TaskId:fd_id},
  652. dataType : 'text',
  653. success : function(data) {
  654. data = eval('('+data+')');
  655. var deptArr = data[0].GPS_AREA_NAME;
  656. deptArr = deptArr.split(",");
  657. for (var i = 0; i < deptArr.length; i++) {
  658. deptJson.list.push({"key":deptArr[i],"value":deptArr[i]});
  659. }
  660. },
  661. error : function(e) {
  662. $.messager.alert('保存失败!', '访问服务失败!', 'error');
  663. }
  664. });
  665. }
  666. //检查数据格式是否正确
  667. function checkName(data,type){
  668. var flag = true;
  669. var c = "";
  670. if(type=="rm"){//人名
  671. checkRex = /^[\u4e00-\u9fa5]{1,5}$/;
  672. }else if(type=="dh"){//电话
  673. //checkRex = /^1{1}[0,9]{10}$/;
  674. checkRex = /^(\+\d{2,3}\-)?\d{11}$/;
  675. }else if(type=="sj"){//时间
  676. 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}$/;
  677. }else if(type=="sl"){//数量
  678. checkRex = /^[0-9]{1,5}$/;
  679. }
  680. if(type=="zbfs"){//值班方式
  681. if(data=='在岗值班' || data=='电话值班' || data=='应急指挥中心值班'){
  682. flag = true;
  683. }else{
  684. flag = false;
  685. }
  686. }else if(type=="zf"){//字符
  687. checkRex = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()|{}【】‘;:”“'。,、?]");
  688. if(checkRex.test(data)){
  689. flag=false;
  690. }
  691. }else if(!checkRex.test(data)){
  692. flag = false;
  693. }
  694. return flag;
  695. }
  696. function setThisHeight(){
  697. $("#formContent").height($(".box_middleright").height());
  698. $(parent.document.body).find("iframe").height($(window.document.body).height()+30);
  699. $(top.document.body).find("iframe").height($(parent.document.body).height());
  700. }