123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543 |
- //数据表格使用
- var g;
- var gridArray=[];
- // 公司名称数组--X轴数据
- var compIds = "";
- var series = "";
- var gridData = "";
- //单位ID
- var deptName = null;
- var sUtil = null;
- $(function(){
- sUtil = new SearchUtil();
- deptName = sUtil.resolveUrl().dept_id;
- });
- var myCols1= [
- { display: '线路', name: 'sd_xianlu', width:"5%" ,render:showMsg} ,
- { display: '电缆', name: 'sd_xianlang', width:"5%" ,render:showMsg} ,
- { display: '合计', name: 'sd_sum', width:"5%" ,render:showMsg }];
- var myCols2= [
- { display: '一次', name: 'bd_yici', width:"5%" ,render:showMsg} ,
- { display: '二次', name: 'bd_erci', width:"5%" ,render:showMsg} ,
- { display: '合计', name: 'bd_sum', width:"5%" ,render:showMsg }];
- var myCols3= [
- { display: '配电线路', name: 'pd_xianlu', width:"5%" ,render:showMsg} ,
- { display: '配电电缆', name: 'pd_xianlang', width:"5%" ,render:showMsg} ,
- { display: '低压电房', name: 'pd_dianfang', width:"5%" ,render:showMsg} ,
- { display: '应急保电', name: 'pd_baodian', width:"5%" ,render:showMsg} ,
- { display: '合计', name: 'pd_sum', width:"5%" ,render:showMsg }];
- var myCols4= [
- { display: '可调拨', name: 'kused', width:"5%" ,render:showMsg } ,
- { display: '不可调拨', name: 'bused', width:"5%" ,render:showMsg }];
- var myCols5= [
- { display: '内部', name: 'team_in', width:"5%" ,render:showMsg } ,
- { display: '外部', name: 'team_out', width:"5%" ,render:showMsg },
- { display: '合计', name: 'team_count', width:"5%" ,render:showMsg }];
-
- var columns =[
- {display : '供电局',"name" : 'name',id : 'name', width : "10%",dept_id:'dept_id',align : 'center',render: addStatus, frozen: true },
- { display: '队伍总数(支)', columns: myCols5, width: "5%", align: 'center' ,render:showMsg},//name: 'team_count'
- { display: '队伍人数(人)', name: 'team_member', width: "5%", align: 'center' ,render:showMsg},
- { display: '输电队伍(人)', columns: myCols1, width: "5%", align: 'center' },
- { display: '变电队伍(人)', columns: myCols2, width: "5%", align: 'center' },
- { display: '配电队伍(人)', columns: myCols3, width: "5%", align: 'center' },
- { display: '通信队伍(人)', name: 'tongxing', width: "5%", align: 'center' ,render:showMsg},
- { display: '网络信息队伍(人)', name: 'wangluo', width: "5%", align: 'center' ,render:showMsg},
- { display: '试验队伍(人)', name: 'shiyan', width: "5%", align: 'center' ,render:showMsg},
- { display: '队伍调拨(支)', columns: myCols4, width: "5%", align: 'center' }
- ];
- //初始化方法
- $(function(){
-
- $("body").eq(0).showLoading();
- $.post($.pathname()+ "/ws/Team/TeamService/getTeamInfo",{id : deptName},function (data){
- console.log("aaaaaa:"+JSON.stringify(data));
- //初始化表格
- initCompletes(data);
- //重设高度
- $(parent.document.body).find("iframe").height($(window.document.body).height()+580);
- $(top.document.body).find("iframe").height($(window.document.body).height()+580);
- $("body").eq(0).hideLoading();
-
- },"json" );
-
- });
- //加载表格
- function initCompletes(json){
- g = $("#maingrid").quiGrid({
- columns: columns,
- data:json,
- rownumbers : true,
- usePager : false
- });
-
- };
- function addStatus(rowdata, rowindex, value, column){
- if("总计"==rowdata.name||rowdata.dept_id==deptName){
- return value;
- }else{
- var comp_id='"'+rowdata.dept_id+'"';
- var name = '"'+value+'"';
- return "<a href='javascript:newHtml("+comp_id+","+name+")'>" + value +" </a>";
- };
- };
- function newHtml(comp_id,name){
- if(name=="总计"){
- return;
- }else if(deptName==comp_id){
- return;
- }else{
-
- };
- };
- function showMsg(rowdata ,rowindex,value,column){
-
- if("总计"==rowdata.name){
- return value;
- }else{
- return '<a href="javascript:void(0)" '
- + 'onclick=showDetail("'
- + rowdata.dept_id
- + '",'+'"'+column.name+ '",'+'"'+value+'") title="'+value+'" >'+value+'</a>';
- };
- };
- function showDetail(index,name,val){
- if(index=="11111"){
- return;
- };
-
- var teamtype = "";
- if(name=="team_count"){
- teamtype = "";
- }else if(name=="team_in"){
- teamtype = "AND TEAM_SYSTEM='122'";
- }else if(name=="team_out"){
- teamtype = "AND TEAM_SYSTEM='123'";
- }else if(name=="kused"){
- teamtype = "AND (TEAM_STAT=1 OR TEAM_STAT=3)";
- }else if(name=="bused"){
- teamtype = "AND (TEAM_STAT=2 OR TEAM_STAT=4)";
- }else if(name=="sd_xianlu"){
- teamtype = "PROFESSIONAL='1'";
- }else if(name=="sd_xianlang"){
- teamtype = "PROFESSIONAL='2'";
- }else if(name=="sd_sum"){
- teamtype = "PROFESSIONAL in('1','2')";
- }else if(name=="bd_yici"){
- teamtype = "PROFESSIONAL='3'";
- }else if(name=="bd_erci"){
- teamtype = "PROFESSIONAL='4'";
- }else if(name=="bd_sum"){
- teamtype = "PROFESSIONAL in('3','4')";
- }else if(name=="pd_xianlu"){
- teamtype = "PROFESSIONAL='5'";
- }else if(name=="pd_xianlang"){
- teamtype = "PROFESSIONAL='6'";
- }else if(name=="pd_dianfang"){
- teamtype = "PROFESSIONAL='7'";
- }else if(name=="pd_baodian"){
- teamtype = "PROFESSIONAL='8'";
- }else if(name=="pd_sum"){
- teamtype = "PROFESSIONAL in('5','6','7','8')";
- }else if(name=="tongxing"){
- teamtype = "PROFESSIONAL='9'";
- }else if(name=="wangluo"){
- teamtype = "PROFESSIONAL='10'";
- }else if(name=="shiyan"){
- teamtype = "PROFESSIONAL='11'";
- };
- if(name=="team_count"||name=="team_in"||name=="team_out"||name=="kused"||name=="bused"){
- teamtype = encodeURI(teamtype);
-
- }else{
- teamtype = encodeURI(teamtype);
-
- };
- };
- function showMsger(rowdata ,rowindex,value,column){
- if("总计"==rowdata.name){
- return value;
- }else{
- var dept_id="<a href='javascript:void(0)'"
- + "onclick=showDetailer('"
- + rowdata.dept_id
- + "',"+"'"+column.name+ "',"+"'"+value+"')>"+value+"</a>";
- return dept_id;
- };
- };
- function showDetailer(index,name,val){
- if(index=="11111"){
- return;
- };
- var teamtype = "";
- var system_team = $('#TEAM_SYSTEM_261').attr("relValue");
- if(name=="team_count"){
- if(system_team==""){
- teamtype = "";
- }else if(system_team=="122"){
- teamtype = "AND TEAM_SYSTEM='122'";
- }else if(system_team=="123"){
- teamtype = "AND TEAM_SYSTEM='123'";
- };
- }else if(name=="kused"){
- if(system_team==""){
- teamtype = "13";
- }else if(system_team=="122"){
- teamtype = "AND (TEAM_STAT=1 OR TEAM_STAT=3) AND TEAM_SYSTEM='122'";
- }else if(system_team=="123"){
- teamtype = "AND (TEAM_STAT=1 OR TEAM_STAT=3) AND TEAM_SYSTEM='123'";
- };
- }else if(name=="bused"){
- if(system_team==""){
- teamtype = "AND (TEAM_STAT=2 OR TEAM_STAT=4)";
- }else if(system_team=="122"){
- teamtype = "AND (TEAM_STAT=2 OR TEAM_STAT=4) AND TEAM_SYSTEM='122'";
- }else if(system_team=="123"){
- teamtype = "AND (TEAM_STAT=2 OR TEAM_STAT=4) AND TEAM_SYSTEM='123'";
- };
- }else if(name=="sd_xianlu"){
- teamtype = "PROFESSIONAL='1'";
- }else if(name=="sd_xianlang"){
- teamtype = "PROFESSIONAL='2'";
- }else if(name=="sd_sum"){
- teamtype = "PROFESSIONAL in('1','2')";
- }else if(name=="bd_yici"){
- teamtype = "PROFESSIONAL='3'";
- }else if(name=="bd_erci"){
- teamtype = "PROFESSIONAL='4'";
- }else if(name=="bd_sum"){
- teamtype = "PROFESSIONAL in('3','4')";
- }else if(name=="pd_xianlu"){
- teamtype = "PROFESSIONAL='5'";
- }else if(name=="pd_xianlang"){
- teamtype = "PROFESSIONAL='6'";
- }else if(name=="pd_dianfang"){
- teamtype = "PROFESSIONAL='7'";
- }else if(name=="pd_baodian"){
- teamtype = "PROFESSIONAL='8'";
- }else if(name=="pd_sum"){
- teamtype = "PROFESSIONAL in('5','6','7','8')";
- }else if(name=="tongxing"){
- teamtype = "PROFESSIONAL='9'";
- }else if(name=="wangluo"){
- teamtype = "PROFESSIONAL='10'";
- }else if(name=="shiyan"){
- teamtype = "PROFESSIONAL='11'";
- };
-
- if(name=="team_count"||name=="team_in"||name=="team_out"||name=="kused"||name=="bused"){
- teamtype = encodeURI(teamtype);
-
- }else{
- var teamtype1 = "";
- if(system_team=="122"){
- teamtype1 = " AND TEAM_SYSTEM='122'";
- }else if(system_team=="123"){
- teamtype1 = " AND TEAM_SYSTEM='123'";
- }
- //解决chrome内核传值时空格出现乱码问题
- teamtype = encodeURI(teamtype);
- teamtype1 = encodeURI(teamtype1);
- };
- };
- /*
- var columns = [ { display: '队伍名称', name: 'TEAM_NAME_309', align: 'left', width: 200,isPrimaryKey:true,
- render : function(rowdata, rowindex, value, column) {
- return "<a href='javascript:;' style='width:100%;height:100%;display:block' title='" + value + "' onclick='openDetail(" + rowindex + ")'>" + value + "</a>";
- },editor: { type: 'text',maxlength:64, }
- },
- { display: '队伍来源', name: 'TEAM_SYSTEM_309', align: 'center', width: 200,showTitle:true,editor: { type: 'select',data:team_source,maxlength:64 }},
- { display: '所属单位', name: 'TEAM_COMP_ID_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
- { display: '电压等级', name: 'TEAM_LEVEL_309', align: 'center', width: 200,showTitle:true,editor: { type: 'select',data:voltage,maxlength:64 }},
- { display: '队伍类型', name: 'TEAM_TYPE_309', align: 'center', width: 200,showTitle:true,editor: { type: 'select',data:team_type,maxlength:64 }},
- { display: '负责人', name: 'TEAM_LEADER_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
- { display: '值班电话', name: 'TEAM_TEL_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
- { display: '手机', name: 'TEAM_PHONE_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
- { display: '办公电话', name: 'TEAM_OFFICE_TEL_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
- { display: '总人数', name: 'TEAM_MEMBER_NUMBER_309', align: 'center', width: 200,showTitle:true,editor: { type: 'text',maxlength:64 }},
- { display: '操作', isAllowHide:false, width : "130",align : 'left',frozen:true,
- render:function(rowdata,rowindex,value,column){
- var h = '<div class="padding_top4 padding_left5"> ';
- if (rowdata._editing){
- h += '<span class="bul_ok hand" title="提交" onclick="endEdit(' + rowindex + ')"></span> ' +
- '<span class="img_delete hand" title="取消" onclick="cancelAllEdit(' + rowindex + ')"></span> ' ;
- }else{
- h += '<span class="img_edit hand" title="修改" onclick="beginEdit(' + rowindex + ')"></span> ' +
- '<span class="img_delete hand" title="删除" onclick="onDelete(\'' + rowdata.FD_OBJECTID_309+"\'" + ')"></span>' ;
- };
- h += ' <span class="team_adjust hand" onclick="adjustEdit(' + rowindex + ')" title="调整"></span></div>';
- return h;
- }
- },
- { display: '状态', name: 'TEAM_STAT_309', align: 'center', width: 200,frozen:true,editor: {type: 'select',data:adjust,maxlength:64 } }];
- // 表格的初始化
- function initComplete() {//gridData
-
- $("body").eq(0).showLoading();
-
- g = $("#maingrid").quiGrid({
- columns:columns,
- url : $.pathname() + '/ws/crud/CRUDService/queryQui',
- params:{"listId":'309', "condition":"IS_DEL='0'"},
- rownumbers : true,
- usePager : true,
- width : "100%",
- height:"550",
- pageSize : 10,
- sortName : "UPDATEDATE",
- autoCheckChildren : true,
- tree : { columnId : 'name' },
- toolbar:{items:[{text: '新增', click: addRow , iconClass: 'icon_add'}, {line : true },
- {text: '单位排序', click: orderUnit , iconClass: 'order_icon'}, {line : true },
- {text: '等级排序', click: orderVoltage , iconClass: 'order_icon'}, {line : true },
- {text: '状态排序', click: orderStat, iconClass: 'order_icon'}, {line : true },
- {text: '同步系统队伍', click: synchronizationSystem , iconClass: 'synchronization_icing'}, {line : true },
- {text: '查看统计', click: statisticsSystem , iconClass: 'import_tem'}]},
- enabledEdit: true,
- alternatingRow:false,
- rowAttrRender: function(rowdata, rowindex, rowid){
- return rowdata["__index"] % 2 == 0 ? "style='background-color:#f5f5f5;'" : "" ;
- },
- clickToEdit: false,
- onDblClickRow:function(rowdata, rowindex){ g.beginEdit(rowindex); },
- onBeforeEdit: onBeforeEdit,
- onBeforeSubmitEdit: onBeforeSubmitEdit,
- onAfterSubmitEdit: onAfterSubmitEdit
-
- });
- $("body").eq(0).hideLoading();
- }
- function openDetail(){
- window.open("http://10.112.56.182/login.do");
- // var cookie = $.getCookie("openerror");
- // //console.log("cookie:"+cookie);
- // if("error"!=cookie){
- // window.open("http://10.112.56.182/login.do");
- // }else{
- // //console.log(sessionID+"openerror:错误");
- // top.window.location = '../';
- // }
- };
- function addUnit(){
-
- };
- function onView(){
-
- };
- //编辑整行
- function beginEdit(rowid) { g.beginEdit(rowid); }
- //任务调整
- function adjustEdit(rowid){
- var rowData = g.getRow(rowid);
- delete rowData.IS_DEL_309;
- delete rowData.UPDATEDATE_309;
- delete rowData.__id;
- delete rowData.__previd;
- delete rowData.__index;
- delete rowData.__pid;
- delete rowData.__level;
- delete rowData.__hasChildren;
- delete rowData.__status;
- delete rowData.rowPosition;
- if(rowData.TEAM_STAT_309=="任务中"){
- rowData.TEAM_STAT_309="待命";
- }else{
- rowData.TEAM_STAT_309="任务中";
- };
- $.post($.pathname() +'/ws/crud/CRUDService/update/',rowToBO(rowData, true),function(result){
- if(result.Msg.sucsess){ top.Dialog.alert("调整成功"); }
- g.loadData();//刷新表格
-
- },"json");
- };
- //编辑前事件
- function onBeforeEdit(e){
- var str="编辑前事件,可阻止某些行或列进行编辑。列名:"+e.column.name+";行号:"+e.rowindex+";编辑前的值:"+e.value+"\n";
- }
- //编辑提交前事件
- function onBeforeSubmitEdit(e){
- }
- //编辑后事件
- function onAfterSubmitEdit(e){
- //在这里一律作修改处理
- var rowData = e.newdata;
- rowData.FD_OBJECTID_309 = e.record.FD_OBJECTID_309;
- $.post($.pathname() +'/ws/crud/CRUDService/update/',rowToBO(rowData, true),function(result){
-
- if(result.Msg.sucsess){ top.Dialog.alert(result.Msg.info); }
-
- },"json");
- };
- //结束编辑
- function endEdit(){
- g.endEdit();
- };
- //全部取消修改
- function cancelAllEdit(){
- g.cancelEdit();
- };
- //查询
- function searchHandler(){
- var tn = $.trim($("#TEAM_NAME_309").val());
- //去掉水印
- if(tn!="" && tn=="请输入名称"){
- $("#TEAM_NAME_309").val("");
- }
- g.setOptions({params:{ listId:'309', sortName : "TEAM_COMP_ID", sortOrder:"DESC", condition:"IS_DEL= '0' and TEAM_NAME LIKE '%"+ $.trim($("#TEAM_NAME_309").val()) +"%'"}});
- g.setNewPage(1);//页号重置为1
- g.loadData();//加载数据
-
- };
- //新增
- function addRow(){
- var row = g.getRow(0);
- var rowData={ TEAM_NAME_309:"", TEAM_SYSTEM_309:"", TEAM_COMP_ID_309:"", TEAM_LEVEL_309:"", TEAM_TYPE_309:"", TEAM_OFFICE_TEL_309:"",
- TEAM_STAT_309:"", TEAM_LEADER_309:"", TEAM_TEL_309:"",TEAM_PHONE_309:"", TEAM_MEMBER_NUMBER_309:""};
-
- g.addEditRow(rowData, row, true);
- //在这里做新增处理
- $.post($.pathname() + '/ws/crud/CRUDService/create',rowToBO(rowData, false),function(result){
- if(result.Msg.sucsess){
- g.getRow(0).FD_OBJECTID_309 = result.Msg.objectID;
- };
- },"json");
- };
- function orderUnit(){
-
- g.setOptions({ sortName : "TEAM_COMP_ID", sortOrder:"DESC" });
- g.setNewPage(1);//页号重置为1
- g.loadData();//加载数据
- };
- function orderVoltage(){
-
- g.setOptions({ sortName : "TEAM_LEVEL", sortOrder:"DESC" });
- g.setNewPage(1);//页号重置为1
- g.loadData();//加载数据
-
- };
- function orderStat(){
-
- g.setOptions({ sortName : "TEAM_STAT", sortOrder:"asc" });
- g.setNewPage(1);//页号重置为1
- g.loadData();//加载数据
-
- };
- //同步系统中的队伍
- function synchronizationSystem(){
- top.Dialog.confirm("同步会将当前数据更换为日常管理模块中的应急队伍,这将丢失现在的所有数据,确定吗?",function(){
- //同步处理
- $.post($.pathname() + '/ws/icingZmap/IcingZmapService/synchronizationSystem', {type:"team"}, function(result){
- orderUnit();
- },"json");
- });
- };
- //查看统计
- function statisticsSystem(){
- window.parent.window.openStatisticsSystem();
- };
- //将row JSON对象转化为bo对象
- function rowToBO(row, flag) {
- var params = row;
- params.classid = 309;
- if(flag){ params.FD_OBJECTID309 = row.FD_OBJECTID_309; };
- var seri_params = $.param(params);
- return seri_params;
- };
- //删除
- function onDelete(fd_id){
- top.Dialog.confirm("确定要删除该记录吗?",function(){
- var result = sUtil.getJsonData($.pathname() +"/ws/crud/CRUDService/delete", {objectIDs : fd_id, classid : 309});
- g.loadData();//刷新表格
- });
- };
- */
|