123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- var compId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var g;
- var classes={"list":[
- {value:"R002105430201",key:"应急总指挥",suggest:""},
- {value:"R002105430202",key:"应急副总指挥",suggest:""},
- {value:"R002105430203",key:"应急办主任",suggest:""},
- {value:"R002105430204",key:"应急办副主任",suggest:""},
- {value:"R002105430205",key:"应急办成员",suggest:""},
- {value:"R002105430213",key:"专业管理部门(安全监管部)",suggest:""},
- {value:"R002105430210",key:"专业管理部门(系统运行部)",suggest:""},
- {value:"R002105430211",key:"专业管理部门(生产设备部)",suggest:""},
- {value:"R002105430212",key:"专业管理部门(市场营销部)",suggest:""}]};
- var yesorno = {"list":[
- {value:"0",key:"是",suggest:""},
- {value:"1",key:"否",suggest:""}]};
- function initGrid(data){
- g = $("#maingrid").quiGrid({
- columns: [
- { display: '姓名', name: 'NAME_777', align: 'center', width: "25%" ,editor: { type: 'text',maxlength:20}},
- { display: '电话', name: 'TELPHONE_777', align: 'center', width: "25%" ,editor: { type: 'text',maxlength:20}},
- { display: '职能', name: 'COMPETENCY_777', align: 'center', width: "25%" ,
- editor: { type: 'select',data:classes,selWidth:200 },render:function (item){
- for (var i = 0; i < classes["list"].length; i++)
- {
- if (classes["list"][i]['value'] == item.COMPETENCY_777)
- return classes["list"][i]['key'];
- }
- return item.COMPETENCY_777;
- }
- },
- { display: '是否领导', name: 'ISLEADER_777', align: 'center', width: "25%" ,
- editor: { type: 'select',data:yesorno,selWidth:200 },render:function (item){
- for (var i = 0; i < yesorno["list"].length; i++)
- {
- if (yesorno["list"][i]['value'] == item.ISLEADER_777)
- return yesorno["list"][i]['key'];
- }
- return item.ISLEADER_777;
- }
- }
- ],
- data:data,
- sortName : '',
- sortOrder : '',
- rownumbers:true,
- checkbox:true,
- // height: '100%',
- width:"100%",
- usePager : false,
- enabledEdit: true, //编辑用
- percentWidthMode:true,
- //顶部图标按钮栏
- toolbar:{
- items:[
-
- {text: '批量保存', click: saveAll, iconClass: 'icon_add'},
- { line : true }
- ]
- }
- });
- //监听页面显示的下拉框
- $("select[name=rp]").bind("change",function(){
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- });
- //下拉框高度自适应
- $(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
- }
-
- function saveAll(){
-
- var PatternsDict=/^(\d{4})-(0\d{1}|1[0-2])-(0\d{1}|[12]\d{1}|3[01])$/;//日期验证
- var PatternsDict1= new RegExp("[%@~!%#$*&',;=?$\x22]+");//特殊字符验证
-
- var rows=g.getSelectedRows();
- var rowsLength = rows.length;
- if (rowsLength == 0) {
- top.Dialog.alert("请选中要导入的信息!");
- return;
- }
- var json=JSON.stringify(rows);
- var myobj=eval(json);
- for(var i=0;i<myobj.length;i++){
- var NAME_777 = myobj[i].NAME_777;
- var TELPHONE_777 = myobj[i].TELPHONE_777;
- var COMPETENCY_777 = myobj[i].COMPETENCY_777;
- var ISLEADER_777 = myobj[i].ISLEADER_777;
-
- var fff =1;
- fff = fff+i;
-
- if(NAME_777.length==0){
- top.Dialog.alert("第"+ fff + "行的姓名不能为空,请检查!");
- return;
- }
-
- if(TELPHONE_777.length==0){
- top.Dialog.alert("第"+ fff + "行的电话不能为空,请检查!");
- return;
- }
-
- for(var j=0;j<myobj.length;j++){
- var HHH =1;
- HHH = HHH+j;
- if(j!=i){
- if(TELPHONE_777==myobj[j].TELPHONE_777){
- top.Dialog.alert("第"+ fff + "行和第"+HHH+"行的电话重复,请检查!");
- return;
- }
- }
- }
-
- if(COMPETENCY_777.length==0){
- top.Dialog.alert("第"+ fff + "行的职能不能为空,请检查!");
- return;
- }
- if(ISLEADER_777.length==0){
- top.Dialog.alert("第"+ fff + "行的是否领导不能为空,请检查!");
- return;
- }
-
- }
-
- var url = $.pathname() + "/ws/MsgUserExcel/MsgUserExcelToDBTableTool/msguserToDb";
- var params = {
- classId : '777',
- compid:compId,
- json:json
- };
- $.ajax({
- url : url,
- type : 'post',
- timeout : 15000,
- data : params,
- dataType : 'json',
- success : function(data) {
- if(data.Msg.sucsess!=true){
- top.Dialog.alert(data.Msg.info);
- }else{
- $.messager.alert('保存成功');
- window.location.href="msguser.jsp";
- }
- },
- error : function(e) {
- $.messager.alert('系统提示信息', '访问服务失败!', 'error');
- }
- });
- }
-
- //下模板
- function xiazai(){
- window.open("/nwyj/excels/msguser.xls");
- }
- //返回
- function goBack() {
- window.location.href="msguser.jsp";
- }
- $.messager = top.Dialog;
|