<?php
/**
*	模块：person.员工档案
*	说明：自定义区域内可写你想要的代码
*	来源：流程模块→表单元素管理→[模块.员工档案]→生成列表页
*/
defined('HOST') or die ('not access');
?>
<script>
$(document).ready(function(){
	{params}
	var modenum = 'person',modename='员工档案',isflow=0,modeid='109',atype = params.atype,pnum=params.pnum,modenames='';
	if(!atype)atype='';if(!pnum)pnum='';
	var fieldsarr = [{"name":"\u7533\u8bf7\u4eba","fields":"base_name"},{"name":"\u7533\u8bf7\u4eba\u90e8\u95e8","fields":"base_deptname"},{"name":"\u5355\u53f7","fields":"sericnum"},{"fields":"gonncode","name":"\u5458\u5de5\u7f16\u53f7","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"},{"fields":"name","name":"\u59d3\u540d","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"},{"fields":"sex","name":"\u6027\u522b","fieldstype":"select","ispx":"0","isalign":"0","islb":"0"},{"fields":"borndt","name":"\u51fa\u751f\u65e5\u671f","fieldstype":"date","ispx":"1","isalign":"0","islb":"0"},{"fields":"nation","name":"\u6c11\u65cf","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"dept2","name":"\u4e8c\u7ea7\u90e8\u95e8","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"},{"fields":"dept","name":"\u4e09\u7ea7\u90e8\u95e8","fieldstype":"text","ispx":"1","isalign":"0","islb":"1"},{"fields":"post","name":"\u5c97\u4f4d","fieldstype":"text","ispx":"1","isalign":"0","islb":"0"},{"fields":"position","name":"\u804c\u4f4d","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"joindt","name":"\u5165\u804c\u65f6\u95f4","fieldstype":"date","ispx":"1","isalign":"0","islb":"0"},{"fields":"turndt","name":"\u8f6c\u6b63\u65f6\u95f4","fieldstype":"date","ispx":"0","isalign":"0","islb":"0"},{"fields":"isleave","name":"\u4eba\u5458\u72b6\u6001","fieldstype":"select","ispx":"1","isalign":"0","islb":"1"},{"fields":"leavedt","name":"\u79bb\u804c\u65f6\u95f4","fieldstype":"date","ispx":"0","isalign":"0","islb":"0"},{"fields":"idcardnum","name":"\u8eab\u4efd\u8bc1\u53f7\u7801","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"bjbanknum","name":"\u5317\u4eac\u94f6\u884c\u5361\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"pfbanknum","name":"\u6d66\u53d1\u94f6\u884c\u5361\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"idcardenddt","name":"\u8eab\u4efd\u8bc1\u5230\u671f\u65e5\u671f","fieldstype":"date","ispx":"0","isalign":"0","islb":"0"},{"fields":"homenow","name":"\u73b0\u5c45\u5730\u5740","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"hukoutype","name":"\u6237\u53e3\u6027\u8d28","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"hukouaddress","name":"\u6237\u53e3\u6240\u5728\u5730","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"eduschool","name":"\u6bd5\u4e1a\u9662\u6821","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"degree","name":"\u5b66\u4f4d","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"education","name":"\u5b66\u5386","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"discipline","name":"\u4e13\u4e1a","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"zhicheng","name":"\u804c\u79f0","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"political","name":"\u653f\u6cbb\u9762\u8c8c","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"ismarry","name":"\u5a5a\u5426","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"jinjiname","name":"\u7d27\u6025\u8054\u7cfb\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"jinjitel","name":"\u7d27\u6025\u8054\u7cfb\u4eba\u7535\u8bdd","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"relation","name":"\u5173\u7cfb","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"contracttype","name":"\u5408\u540c\u6027\u8d28","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"contractenddt","name":"\u5408\u540c\u671f\u9650","fieldstype":"date","ispx":"0","isalign":"0","islb":"0"},{"fields":"contractnum","name":"\u5408\u540c\u7f16\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"isshebao","name":"\u793e\u4fdd\u60c5\u51b5","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"gwxynum","name":"\u5e7f\u7f51\u5b66\u9662\u8d26\u6237","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"anquanyuan","name":"\u5b89\u5168\u5458","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"jianzaoshi","name":"\u5efa\u9020\u5e08","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"gaiyusuan","name":"\u6982\u9884\u7b97","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"tel","name":"\u8054\u7cfb\u7535\u8bdd","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"youxiankongjian","name":"\u6709\u9650\u7a7a\u95f4\u4f5c\u4e1a\u8bc1","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"email","name":"\u516c\u53f8\u90ae\u7bb1","fieldstype":"text","ispx":"0","isalign":"0","islb":"1"},{"fields":"netschool","name":"\u7f51\u7edc\u5b66\u5802\u8d26\u53f7","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"menjin","name":"\u95e8\u7981\u5361","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"zhiwen","name":"\u6307\u7eb9","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"age","name":"\u5e74\u9f84","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"joinage","name":"\u5165\u53f8\u5e74\u9650","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"joinshouxu","name":"\u5165\u53f8\u624b\u7eed","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"joindata","name":"\u5165\u804c\u626b\u63cf\u4ef6","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"edudt","name":"\u6bd5\u4e1a\u65f6\u95f4","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"eduage","name":"\u6bd5\u4e1a\u5e74\u9650","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"joinchannel","name":"\u62db\u8058\u6e20\u9053","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"joinby","name":"\u63a8\u8350\u4eba","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"},{"fields":"isgangweisms","name":"\u5c97\u4f4d\u8bf4\u660e\u4e66\u7b7e\u8ba2\u60c5\u51b5","fieldstype":"text","ispx":"0","isalign":"0","islb":"0"}],fieldsselarr= [];
	
	var c = {
		reload:function(){
			a.reload();
		},
		clickwin:function(o1,lx){
			var id=0;
			if(lx==1)id=a.changeid;
			openinput(modename,modenum,id,'opegs{rand}');
		},
		view:function(){
			var d=a.changedata;
			openxiangs(modename,modenum,d.id,'opegs{rand}');
		},
		searchbtn:function(){
			this.search({});
		},
		search:function(cans){
			var s=get('key_{rand}').value,zt='';
			if(get('selstatus_{rand}'))zt=get('selstatus_{rand}').value;
			var canss = js.apply({key:s,keystatus:zt,search_value:''}, cans);
			a.setparams(canss,true);
		},
		searchhigh:function(){
			new highsearchclass({
				modenum:modenum,
				oncallback:function(d){
					c.searchhighb(d);
				}
			});
		},
		searchhighb:function(d){
			d.key='';
			d.search_value='';
			get('key_{rand}').value='';
			a.setparams(d,true);
		},
		searchuname:function(d){
			js.getuser({
				type:'deptusercheck',
				title:'搜索'+d.name,
				changevalue:this.search_value,
				callback:function(sna,sid){
					c.searchunames(d,sna,sid);
				}
			});
		},
		search_value:'',
		searchunames:function(d,sna,sid){
			get('key_{rand}').value=sna;
			this.search_value = sid;
			var cs = {key:'','search_fields':d.fields,'search_value':sid};
			a.setparams(cs,true);
		},
		daochu:function(o1,lx,lx1,e){
			publicdaochuobj({
				'objtable':a,
				'modename':modename,
				'fieldsarr':fieldsarr,
				'modenum':modenum,
				'modenames':modenames,
				'isflow':isflow,
				'btnobj':o1
			});
		},
		getacturl:function(act){
			return js.getajaxurl(act,'mode_person|input','flow',{'modeid':modeid});
		},
		changatype:function(o1,lx){
			$("button[id^='changatype{rand}']").removeClass('active');
			$('#changatype{rand}_'+lx+'').addClass('active');
			a.setparams({atype:lx},true);
			var tit = $(o1).html();if(tit.indexOf(modename)<0)tit=modename+'('+tit+')';
			nowtabssettext(tit);
		},
		init:function(){
			$('#key_{rand}').keyup(function(e){
				if(e.keyCode==13)c.searchbtn();
			});
			this.initpage();
		},
		initpage:function(){
			
		},
		loaddata:function(d){
			this.setdownsodata(d.souarr);
			if(!d.atypearr)return;
			get('addbtn_{rand}').disabled=(d.isadd!=true);
			get('daobtn_{rand}').disabled=(d.isdaochu!=true);
			if(d.isdaochu)$('#daobtn_{rand}').show();
			if(d.isdaoru)$('#daoruspan_{rand}').show();
			var d1 = d.atypearr,len=d1.length,i,str='';
			for(i=0;i<len;i++){
				str+='<button class="btn btn-default" click="changatype,'+d1[i].num+'" id="changatype{rand}_'+d1[i].num+'" type="button">'+d1[i].name+'</button>';
			}
			$('#changatype{rand}').html(str);
			$('#changatype{rand}_'+atype+'').addClass('active');
			js.initbtn(c);
		},
		setdownsodata:function(darr){
			var ddata = [{name:'高级搜索',lx:0}],dsd,i;
			if(darr)for(i=0;i<darr.length;i++){
				dsd = darr[i];
				dsd.lx=3;
				ddata.push(dsd);
			}
			if(admintype==1)ddata.push({name:'自定义列显示',lx:2});
			ddata.push({name:'打印',lx:1});
			this.soudownobj.setData(ddata);
		},
		setcolumns:function(fid, cnas){
			var d = false,i,ad=bootparams.columns,len=ad.length,oi=-1;
			for(i=0;i<len;i++){
				if(ad[i].dataIndex==fid){
					d = ad[i];
					oi= i;
					break;
				}
			}
			if(d){
				d = js.apply(d, cnas);
				bootparams.columns[oi]=d;
			}
		},
		daoru:function(){
			window.managelistperson = a;
			addtabs({num:'daoruperson',url:'flow,input,daoru,modenum=person',icons:'plus',name:'导入员工档案'});
		},
		initcolumns:function(bots){
			var num = 'columns_'+modenum+'_'+pnum+'',d=[],d1,d2={},i,len=fieldsarr.length,bok;
			var nstr= fieldsselarr[num];if(!nstr)nstr='';
			if(nstr)nstr=','+nstr+',';
			if(nstr=='' && isflow>0){
				d.push({text:'申请人',dataIndex:'base_name',sortable:true});
				d.push({text:'申请人部门',dataIndex:'base_deptname',sortable:true});
			}
			for(i=0;i<len;i++){
				d1 = fieldsarr[i];
				bok= false;
				if(nstr==''){
					if(d1['islb']=='1')bok=true;
				}else{
					if(nstr.indexOf(','+d1.fields+',')>=0)bok=true;
				}
				if(bok){
					d2={text:d1.name,dataIndex:d1.fields};
					if(d1.ispx=='1')d2.sortable=true;
					if(d1.isalign=='1')d2.align='left';
					if(d1.isalign=='2')d2.align='right';
					d.push(d2);
				}
			}
			if(isflow>0)d.push({text:'状态',dataIndex:'statustext'});
			if(nstr=='' || nstr.indexOf(',caozuo,')>=0)d.push({text:'',dataIndex:'caozuo',callback:'opegs{rand}'});
			if(!bots){
				bootparams.columns=d;
			}else{
				a.setColumns(d);
			}
		},
		setparams:function(cs){
			var ds = js.apply({},cs);
			a.setparams(ds);
		},
		storeurl:function(){
			var url = this.getacturl('publicstore')+'&pnum='+pnum+'';
			return url;
		},
		printlist:function(){
			js.msg('success','可使用导出，然后打开在打印');
		},
		getbtnstr:function(txt, click, ys, ots){
			if(!ys)ys='default';
			if(!ots)ots='';
			return '<button class="btn btn-'+ys+'" id="btn'+click+'_{rand}" click="'+click+'" '+ots+' type="button">'+txt+'</button>';
		},
		setfieldslist:function(){
			new highsearchclass({
				modenum:modenum,
				modeid:modeid,
				type:1,
				isflow:isflow,
				pnum:pnum,atype:atype,
				fieldsarr:fieldsarr,
				fieldsselarr:fieldsselarr,
				oncallback:function(str){
					fieldsselarr[this.columnsnum]=str;
					c.initcolumns(true);
					c.reload();
				}
			});
		}
	};
	
	var bootparams = {
		fanye:true,modenum:modenum,modename:modename,statuschange:false,tablename:jm.base64decode('cGVyc29uZmlsZQ::'),
		url:c.storeurl(),storeafteraction:'storeaftershow',storebeforeaction:'storebeforeshow',
		params:{atype:atype},
		columns:[{text:"员工编号",dataIndex:"gonncode",sortable:true},{text:"姓名",dataIndex:"name",sortable:true},{text:"二级部门",dataIndex:"dept2",sortable:true},{text:"三级部门",dataIndex:"dept",sortable:true},{text:"人员状态",dataIndex:"isleave",sortable:true},{text:"联系电话",dataIndex:"tel"},{text:"公司邮箱",dataIndex:"email"},{
			text:'',dataIndex:'caozuo',callback:'opegs{rand}'
		}],
		itemdblclick:function(){
			c.view();
		},
		load:function(d){
			c.loaddata(d);
		}
	};
	c.initcolumns(false);
	opegs{rand}=function(){
		c.reload();
	}
	
//[自定义区域start]



//[自定义区域end]

	js.initbtn(c);
	var a = $('#viewperson_{rand}').bootstable(bootparams);
	c.init();
	c.soudownobj = $('#downbtn_{rand}').rockmenu({
		width:120,top:35,donghua:false,
		data:[{name:'高级搜索',lx:0}],
		itemsclick:function(d, i){
			if(d.lx==0)c.searchhigh();
			if(d.lx==1)c.printlist();
			if(d.lx==2)c.setfieldslist();
			if(d.lx==3)c.searchuname(d);
		}
	});
	
	
});
</script>
<!--SCRIPTend-->
<!--HTMLstart-->
<div>
	<table width="100%">
	<tr>
		<td style="padding-right:10px;" id="tdleft_{rand}" nowrap><button id="addbtn_{rand}" class="btn btn-primary" click="clickwin,0" disabled type="button"><i class="icon-plus"></i> 新增</button></td>
		<td>
			<input class="form-control" style="width:160px" id="key_{rand}" placeholder="关键字">
		</td>
		
		<td style="padding-left:10px">
			<div style="white-space:nowrap">
			<button style="border-right:0;border-top-right-radius:0;border-bottom-right-radius:0" class="btn btn-default" click="searchbtn" type="button">搜索</button><button class="btn btn-default" id="downbtn_{rand}" type="button" style="padding-left:8px;padding-right:8px;border-top-left-radius:0;border-bottom-left-radius:0"><i class="icon-angle-down"></i></button> 
			</div>
		</td>
		<td  width="90%" style="padding-left:10px"><div id="changatype{rand}" class="btn-group"></div></td>
	
		<td align="right" id="tdright_{rand}" nowrap>
			<button class="btn btn-default" style="display:none" id="daobtn_{rand}" disabled click="daochu" type="button">导出 <i class="icon-angle-down"></i></button> 
		</td>
	</tr>
	</table>
</div>
<div class="blank10"></div>
<div id="viewperson_{rand}"></div>
<!--HTMLend-->