cbd2c31177dfce3ab1c92a6e7dd542d7a556f653.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. //数据表格使用
  2. var g;
  3. var gridArray=[];
  4. // 公司名称数组--X轴数据
  5. var compIds = "";
  6. var series = "";
  7. var gridData = "";
  8. //单位ID
  9. var deptName = null;
  10. var sUtil = null;
  11. $(function(){
  12. sUtil = new SearchUtil();
  13. deptName = sUtil.resolveUrl().dept_id;
  14. });
  15. var myCols1= [
  16. { display: '线路', name: 'sd_xianlu', width:"5%" ,render:showMsg} ,
  17. { display: '电缆', name: 'sd_xianlang', width:"5%" ,render:showMsg} ,
  18. { display: '合计', name: 'sd_sum', width:"5%" ,render:showMsg }];
  19. var myCols2= [
  20. { display: '一次', name: 'bd_yici', width:"5%" ,render:showMsg} ,
  21. { display: '二次', name: 'bd_erci', width:"5%" ,render:showMsg} ,
  22. { display: '合计', name: 'bd_sum', width:"5%" ,render:showMsg }];
  23. var myCols3= [
  24. { display: '配电线路', name: 'pd_xianlu', width:"5%" ,render:showMsg} ,
  25. { display: '配电电缆', name: 'pd_xianlang', width:"5%" ,render:showMsg} ,
  26. { display: '低压电房', name: 'pd_dianfang', width:"5%" ,render:showMsg} ,
  27. { display: '应急保电', name: 'pd_baodian', width:"5%" ,render:showMsg} ,
  28. { display: '合计', name: 'pd_sum', width:"5%" ,render:showMsg }];
  29. var myCols4= [
  30. { display: '可调拨', name: 'kused', width:"5%" ,render:showMsg } ,
  31. { display: '不可调拨', name: 'bused', width:"5%" ,render:showMsg }];
  32. var myCols5= [
  33. { display: '内部', name: 'team_in', width:"5%" ,render:showMsg } ,
  34. { display: '外部', name: 'team_out', width:"5%" ,render:showMsg },
  35. { display: '合计', name: 'team_count', width:"5%" ,render:showMsg }];
  36. var columns =[
  37. {display : '供电局',"name" : 'name',id : 'name', width : "10%",dept_id:'dept_id',align : 'center',render: addStatus, frozen: true },
  38. { display: '队伍总数(支)', columns: myCols5, width: "5%", align: 'center' ,render:showMsg},//name: 'team_count'
  39. { display: '队伍人数(人)', name: 'team_member', width: "5%", align: 'center' ,render:showMsg},
  40. { display: '输电队伍(人)', columns: myCols1, width: "5%", align: 'center' },
  41. { display: '变电队伍(人)', columns: myCols2, width: "5%", align: 'center' },
  42. { display: '配电队伍(人)', columns: myCols3, width: "5%", align: 'center' },
  43. { display: '通信队伍(人)', name: 'tongxing', width: "5%", align: 'center' ,render:showMsg},
  44. { display: '网络信息队伍(人)', name: 'wangluo', width: "5%", align: 'center' ,render:showMsg},
  45. { display: '试验队伍(人)', name: 'shiyan', width: "5%", align: 'center' ,render:showMsg},
  46. { display: '队伍调拨(支)', columns: myCols4, width: "5%", align: 'center' }
  47. ];
  48. //初始化方法
  49. $(function(){
  50. $("body").eq(0).showLoading();
  51. $.post($.pathname()+ "/ws/Team/TeamService/getTeamInfo",{id : deptName},function (data){
  52. console.log("aaaaaa:"+JSON.stringify(data));
  53. //初始化表格
  54. initCompletes(data);
  55. //重设高度
  56. $(parent.document.body).find("iframe").height($(window.document.body).height()+580);
  57. $(top.document.body).find("iframe").height($(window.document.body).height()+580);
  58. $("body").eq(0).hideLoading();
  59. },"json" );
  60. });
  61. //加载表格
  62. function initCompletes(json){
  63. g = $("#maingrid").quiGrid({
  64. columns: columns,
  65. data:json,
  66. rownumbers : true,
  67. usePager : false
  68. });
  69. };
  70. function addStatus(rowdata, rowindex, value, column){
  71. if("总计"==rowdata.name||rowdata.dept_id==deptName){
  72. return value;
  73. }else{
  74. var comp_id='"'+rowdata.dept_id+'"';
  75. var name = '"'+value+'"';
  76. return "<a href='javascript:newHtml("+comp_id+","+name+")'>" + value +" </a>";
  77. };
  78. };
  79. function newHtml(comp_id,name){
  80. if(name=="总计"){
  81. return;
  82. }else if(deptName==comp_id){
  83. return;
  84. }else{
  85. };
  86. };
  87. function showMsg(rowdata ,rowindex,value,column){
  88. if("总计"==rowdata.name){
  89. return value;
  90. }else{
  91. return '<a href="javascript:void(0)" '
  92. + 'onclick=showDetail("'
  93. + rowdata.dept_id
  94. + '",'+'"'+column.name+ '",'+'"'+value+'") title="'+value+'" >'+value+'</a>';
  95. };
  96. };
  97. function showDetail(index,name,val){
  98. if(index=="11111"){
  99. return;
  100. };
  101. var teamtype = "";
  102. if(name=="team_count"){
  103. teamtype = "";
  104. }else if(name=="team_in"){
  105. teamtype = "AND TEAM_SYSTEM='122'";
  106. }else if(name=="team_out"){
  107. teamtype = "AND TEAM_SYSTEM='123'";
  108. }else if(name=="kused"){
  109. teamtype = "AND (TEAM_STAT=1 OR TEAM_STAT=3)";
  110. }else if(name=="bused"){
  111. teamtype = "AND (TEAM_STAT=2 OR TEAM_STAT=4)";
  112. }else if(name=="sd_xianlu"){
  113. teamtype = "PROFESSIONAL='1'";
  114. }else if(name=="sd_xianlang"){
  115. teamtype = "PROFESSIONAL='2'";
  116. }else if(name=="sd_sum"){
  117. teamtype = "PROFESSIONAL in('1','2')";
  118. }else if(name=="bd_yici"){
  119. teamtype = "PROFESSIONAL='3'";
  120. }else if(name=="bd_erci"){
  121. teamtype = "PROFESSIONAL='4'";
  122. }else if(name=="bd_sum"){
  123. teamtype = "PROFESSIONAL in('3','4')";
  124. }else if(name=="pd_xianlu"){
  125. teamtype = "PROFESSIONAL='5'";
  126. }else if(name=="pd_xianlang"){
  127. teamtype = "PROFESSIONAL='6'";
  128. }else if(name=="pd_dianfang"){
  129. teamtype = "PROFESSIONAL='7'";
  130. }else if(name=="pd_baodian"){
  131. teamtype = "PROFESSIONAL='8'";
  132. }else if(name=="pd_sum"){
  133. teamtype = "PROFESSIONAL in('5','6','7','8')";
  134. }else if(name=="tongxing"){
  135. teamtype = "PROFESSIONAL='9'";
  136. }else if(name=="wangluo"){
  137. teamtype = "PROFESSIONAL='10'";
  138. }else if(name=="shiyan"){
  139. teamtype = "PROFESSIONAL='11'";
  140. };
  141. if(name=="team_count"||name=="team_in"||name=="team_out"||name=="kused"||name=="bused"){
  142. teamtype = encodeURI(teamtype);
  143. }else{
  144. teamtype = encodeURI(teamtype);
  145. };
  146. };
  147. function showMsger(rowdata ,rowindex,value,column){
  148. if("总计"==rowdata.name){
  149. return value;
  150. }else{
  151. var dept_id="<a href='javascript:void(0)'"
  152. + "onclick=showDetailer('"
  153. + rowdata.dept_id
  154. + "',"+"'"+column.name+ "',"+"'"+value+"')>"+value+"</a>";
  155. return dept_id;
  156. };
  157. };
  158. function showDetailer(index,name,val){
  159. if(index=="11111"){
  160. return;
  161. };
  162. var teamtype = "";
  163. var system_team = $('#TEAM_SYSTEM_261').attr("relValue");
  164. if(name=="team_count"){
  165. if(system_team==""){
  166. teamtype = "";
  167. }else if(system_team=="122"){
  168. teamtype = "AND TEAM_SYSTEM='122'";
  169. }else if(system_team=="123"){
  170. teamtype = "AND TEAM_SYSTEM='123'";
  171. };
  172. }else if(name=="kused"){
  173. if(system_team==""){
  174. teamtype = "13";
  175. }else if(system_team=="122"){
  176. teamtype = "AND (TEAM_STAT=1 OR TEAM_STAT=3) AND TEAM_SYSTEM='122'";
  177. }else if(system_team=="123"){
  178. teamtype = "AND (TEAM_STAT=1 OR TEAM_STAT=3) AND TEAM_SYSTEM='123'";
  179. };
  180. }else if(name=="bused"){
  181. if(system_team==""){
  182. teamtype = "AND (TEAM_STAT=2 OR TEAM_STAT=4)";
  183. }else if(system_team=="122"){
  184. teamtype = "AND (TEAM_STAT=2 OR TEAM_STAT=4) AND TEAM_SYSTEM='122'";
  185. }else if(system_team=="123"){
  186. teamtype = "AND (TEAM_STAT=2 OR TEAM_STAT=4) AND TEAM_SYSTEM='123'";
  187. };
  188. }else if(name=="sd_xianlu"){
  189. teamtype = "PROFESSIONAL='1'";
  190. }else if(name=="sd_xianlang"){
  191. teamtype = "PROFESSIONAL='2'";
  192. }else if(name=="sd_sum"){
  193. teamtype = "PROFESSIONAL in('1','2')";
  194. }else if(name=="bd_yici"){
  195. teamtype = "PROFESSIONAL='3'";
  196. }else if(name=="bd_erci"){
  197. teamtype = "PROFESSIONAL='4'";
  198. }else if(name=="bd_sum"){
  199. teamtype = "PROFESSIONAL in('3','4')";
  200. }else if(name=="pd_xianlu"){
  201. teamtype = "PROFESSIONAL='5'";
  202. }else if(name=="pd_xianlang"){
  203. teamtype = "PROFESSIONAL='6'";
  204. }else if(name=="pd_dianfang"){
  205. teamtype = "PROFESSIONAL='7'";
  206. }else if(name=="pd_baodian"){
  207. teamtype = "PROFESSIONAL='8'";
  208. }else if(name=="pd_sum"){
  209. teamtype = "PROFESSIONAL in('5','6','7','8')";
  210. }else if(name=="tongxing"){
  211. teamtype = "PROFESSIONAL='9'";
  212. }else if(name=="wangluo"){
  213. teamtype = "PROFESSIONAL='10'";
  214. }else if(name=="shiyan"){
  215. teamtype = "PROFESSIONAL='11'";
  216. };
  217. if(name=="team_count"||name=="team_in"||name=="team_out"||name=="kused"||name=="bused"){
  218. teamtype = encodeURI(teamtype);
  219. }else{
  220. var teamtype1 = "";
  221. if(system_team=="122"){
  222. teamtype1 = " AND TEAM_SYSTEM='122'";
  223. }else if(system_team=="123"){
  224. teamtype1 = " AND TEAM_SYSTEM='123'";
  225. }
  226. //解决chrome内核传值时空格出现乱码问题
  227. teamtype = encodeURI(teamtype);
  228. teamtype1 = encodeURI(teamtype1);
  229. };
  230. };
  231. /*
  232. var columns = [ { display: '队伍名称', name: 'TEAM_NAME_309', align: 'left', width: 200,isPrimaryKey:true,
  233. render : function(rowdata, rowindex, value, column) {
  234. return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
  235. },editor: { type: 'text',maxlength:64, }
  236. },
  237. { display: '队伍来源', name: 'TEAM_SYSTEM_309', align: 'center', width: 200,showTitle:true,editor: { type: 'select',data:team_source,maxlength:64 }},
  238. { display: '所属单位', name: 'TEAM_COMP_ID_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
  239. { display: '电压等级', name: 'TEAM_LEVEL_309', align: 'center', width: 200,showTitle:true,editor: { type: 'select',data:voltage,maxlength:64 }},
  240. { display: '队伍类型', name: 'TEAM_TYPE_309', align: 'center', width: 200,showTitle:true,editor: { type: 'select',data:team_type,maxlength:64 }},
  241. { display: '负责人', name: 'TEAM_LEADER_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
  242. { display: '值班电话', name: 'TEAM_TEL_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
  243. { display: '手机', name: 'TEAM_PHONE_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
  244. { display: '办公电话', name: 'TEAM_OFFICE_TEL_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
  245. { display: '总人数', name: 'TEAM_MEMBER_NUMBER_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
  246. { display: '操作', isAllowHide:false, width : "130",align : 'left',frozen:true,
  247. render:function(rowdata,rowindex,value,column){
  248. var h = '<div class="padding_top4 padding_left5">&nbsp;';
  249. if (rowdata._editing){
  250. h += '<span class="bul_ok hand" title="提交" onclick="endEdit(' + rowindex + ')"></span>&nbsp;' +
  251. '<span class="img_delete hand" title="取消" onclick="cancelAllEdit(' + rowindex + ')"></span>&nbsp;' ;
  252. }else{
  253. h += '<span class="img_edit hand" title="修改" onclick="beginEdit(' + rowindex + ')"></span>&nbsp;' +
  254. '<span class="img_delete hand" title="删除" onclick="onDelete(\'' + rowdata.FD_OBJECTID_309+"\'" + ')"></span>' ;
  255. };
  256. h += '&nbsp;<span class="team_adjust hand" onclick="adjustEdit(' + rowindex + ')" title="调整"></span></div>';
  257. return h;
  258. }
  259. },
  260. { display: '状态', name: 'TEAM_STAT_309', align: 'center', width: 200,frozen:true,editor: {type: 'select',data:adjust,maxlength:64 } }];
  261. // 表格的初始化
  262. function initComplete() {//gridData
  263. $("body").eq(0).showLoading();
  264. g = $("#maingrid").quiGrid({
  265. columns:columns,
  266. url : $.pathname() + '/ws/crud/CRUDService/queryQui',
  267. params:{"listId":'309', "condition":"IS_DEL='0'"},
  268. rownumbers : true,
  269. usePager : true,
  270. width : "100%",
  271. height:"550",
  272. pageSize : 10,
  273. sortName : "UPDATEDATE",
  274. autoCheckChildren : true,
  275. tree : { columnId : 'name' },
  276. toolbar:{items:[{text: '新增', click: addRow , iconClass: 'icon_add'}, {line : true },
  277. {text: '单位排序', click: orderUnit , iconClass: 'order_icon'}, {line : true },
  278. {text: '等级排序', click: orderVoltage , iconClass: 'order_icon'}, {line : true },
  279. {text: '状态排序', click: orderStat, iconClass: 'order_icon'}, {line : true },
  280. {text: '同步系统队伍', click: synchronizationSystem , iconClass: 'synchronization_icing'}, {line : true },
  281. {text: '查看统计', click: statisticsSystem , iconClass: 'import_tem'}]},
  282. enabledEdit: true,
  283. alternatingRow:false,
  284. rowAttrRender: function(rowdata, rowindex, rowid){
  285. return rowdata["__index"] % 2 == 0 ? "style='background-color:#f5f5f5;'" : "" ;
  286. },
  287. clickToEdit: false,
  288. onDblClickRow:function(rowdata, rowindex){ g.beginEdit(rowindex); },
  289. onBeforeEdit: onBeforeEdit,
  290. onBeforeSubmitEdit: onBeforeSubmitEdit,
  291. onAfterSubmitEdit: onAfterSubmitEdit
  292. });
  293. $("body").eq(0).hideLoading();
  294. }
  295. function openDetail(){
  296. window.open("http://10.112.56.182/login.do");
  297. // var cookie = $.getCookie("openerror");
  298. // //console.log("cookie:"+cookie);
  299. // if("error"!=cookie){
  300. // window.open("http://10.112.56.182/login.do");
  301. // }else{
  302. // //console.log(sessionID+"openerror:错误");
  303. // top.window.location = '../';
  304. // }
  305. };
  306. function addUnit(){
  307. };
  308. function onView(){
  309. };
  310. //编辑整行
  311. function beginEdit(rowid) { g.beginEdit(rowid); }
  312. //任务调整
  313. function adjustEdit(rowid){
  314. var rowData = g.getRow(rowid);
  315. delete rowData.IS_DEL_309;
  316. delete rowData.UPDATEDATE_309;
  317. delete rowData.__id;
  318. delete rowData.__previd;
  319. delete rowData.__index;
  320. delete rowData.__pid;
  321. delete rowData.__level;
  322. delete rowData.__hasChildren;
  323. delete rowData.__status;
  324. delete rowData.rowPosition;
  325. if(rowData.TEAM_STAT_309=="任务中"){
  326. rowData.TEAM_STAT_309="待命";
  327. }else{
  328. rowData.TEAM_STAT_309="任务中";
  329. };
  330. $.post($.pathname() +'/ws/crud/CRUDService/update/',rowToBO(rowData, true),function(result){
  331. if(result.Msg.sucsess){ top.Dialog.alert("调整成功"); }
  332. g.loadData();//刷新表格
  333. },"json");
  334. };
  335. //编辑前事件
  336. function onBeforeEdit(e){
  337. var str="编辑前事件,可阻止某些行或列进行编辑。列名:"+e.column.name+";行号:"+e.rowindex+";编辑前的值:"+e.value+"\n";
  338. }
  339. //编辑提交前事件
  340. function onBeforeSubmitEdit(e){
  341. }
  342. //编辑后事件
  343. function onAfterSubmitEdit(e){
  344. //在这里一律作修改处理
  345. var rowData = e.newdata;
  346. rowData.FD_OBJECTID_309 = e.record.FD_OBJECTID_309;
  347. $.post($.pathname() +'/ws/crud/CRUDService/update/',rowToBO(rowData, true),function(result){
  348. if(result.Msg.sucsess){ top.Dialog.alert(result.Msg.info); }
  349. },"json");
  350. };
  351. //结束编辑
  352. function endEdit(){
  353. g.endEdit();
  354. };
  355. //全部取消修改
  356. function cancelAllEdit(){
  357. g.cancelEdit();
  358. };
  359. //查询
  360. function searchHandler(){
  361. var tn = $.trim($("#TEAM_NAME_309").val());
  362. //去掉水印
  363. if(tn!="" && tn=="请输入名称"){
  364. $("#TEAM_NAME_309").val("");
  365. }
  366. g.setOptions({params:{ listId:'309', sortName : "TEAM_COMP_ID", sortOrder:"DESC", condition:"IS_DEL= '0' and TEAM_NAME LIKE '%"+ $.trim($("#TEAM_NAME_309").val()) +"%'"}});
  367. g.setNewPage(1);//页号重置为1
  368. g.loadData();//加载数据
  369. };
  370. //新增
  371. function addRow(){
  372. var row = g.getRow(0);
  373. var rowData={ TEAM_NAME_309:"", TEAM_SYSTEM_309:"", TEAM_COMP_ID_309:"", TEAM_LEVEL_309:"", TEAM_TYPE_309:"", TEAM_OFFICE_TEL_309:"",
  374. TEAM_STAT_309:"", TEAM_LEADER_309:"", TEAM_TEL_309:"",TEAM_PHONE_309:"", TEAM_MEMBER_NUMBER_309:""};
  375. g.addEditRow(rowData, row, true);
  376. //在这里做新增处理
  377. $.post($.pathname() + '/ws/crud/CRUDService/create',rowToBO(rowData, false),function(result){
  378. if(result.Msg.sucsess){
  379. g.getRow(0).FD_OBJECTID_309 = result.Msg.objectID;
  380. };
  381. },"json");
  382. };
  383. function orderUnit(){
  384. g.setOptions({ sortName : "TEAM_COMP_ID", sortOrder:"DESC" });
  385. g.setNewPage(1);//页号重置为1
  386. g.loadData();//加载数据
  387. };
  388. function orderVoltage(){
  389. g.setOptions({ sortName : "TEAM_LEVEL", sortOrder:"DESC" });
  390. g.setNewPage(1);//页号重置为1
  391. g.loadData();//加载数据
  392. };
  393. function orderStat(){
  394. g.setOptions({ sortName : "TEAM_STAT", sortOrder:"asc" });
  395. g.setNewPage(1);//页号重置为1
  396. g.loadData();//加载数据
  397. };
  398. //同步系统中的队伍
  399. function synchronizationSystem(){
  400. top.Dialog.confirm("同步会将当前数据更换为日常管理模块中的应急队伍,这将丢失现在的所有数据,确定吗?",function(){
  401. //同步处理
  402. $.post($.pathname() + '/ws/icingZmap/IcingZmapService/synchronizationSystem', {type:"team"}, function(result){
  403. orderUnit();
  404. },"json");
  405. });
  406. };
  407. //查看统计
  408. function statisticsSystem(){
  409. window.parent.window.openStatisticsSystem();
  410. };
  411. //将row JSON对象转化为bo对象
  412. function rowToBO(row, flag) {
  413. var params = row;
  414. params.classid = 309;
  415. if(flag){ params.FD_OBJECTID309 = row.FD_OBJECTID_309; };
  416. var seri_params = $.param(params);
  417. return seri_params;
  418. };
  419. //删除
  420. function onDelete(fd_id){
  421. top.Dialog.confirm("确定要删除该记录吗?",function(){
  422. var result = sUtil.getJsonData($.pathname() +"/ws/crud/CRUDService/delete", {objectIDs : fd_id, classid : 309});
  423. g.loadData();//刷新表格
  424. });
  425. };
  426. */