You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
297 lines
10 KiB
297 lines
10 KiB
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>组织机构选择</title>
|
|
<%@include file="/wdk/theme/je/module/public/common.jsp"%>
|
|
<script type="text/javascript" src="platform/report/js/pf.report.js"></script>
|
|
<script type="text/javascript">
|
|
var org_field_map = ORG_VARIABLE.CODE_TO_UUID;
|
|
/*组织机构选择界面参数详解:
|
|
person_uuid 操作人员标识,必填
|
|
org_uuid 上级组织标识,可为空
|
|
isrealunit 是否实体,可为空
|
|
orglevel 组织级别,为空时默认为全部、01-省公司、02-市公司、03-分公司、04-直属部门、05-隶属部门、06-普通部门、07-市场部、08-营销线
|
|
orgattr 组织属性,为空时默认为‘行政组织’ 00-行政组织 01-财务组织 02-成本中心 03-利润中心 04-采购组织 05-质检组织 06-销售组织 07-库存组织 08-发运组织 09-人力资源组织 10-生产组织
|
|
showlevel 根据组织的级别确定,上级组织标识为空时,显示级别不允许为空
|
|
isctrlperm 是否控制权限,'1':是; '0'否,为空时默认为'1'
|
|
|
|
ismulselect 是否多选,'1':是; '0'否,为空时默认为'0'
|
|
asyn 是否异步加载,'1':是; '0'否,为空时默认为'1'
|
|
cascadecheck 是否级联勾选,'1':是; '0'否 默认'0'
|
|
returnorglevel 返回的组织级别,默认空
|
|
|
|
*/
|
|
//界面参数
|
|
var _param_query = {person_uuid:"",isctrlperm:"1",org_uuid:"",person_uuid:"",isrealunit:"",orglevel:"",orgattr:"",ismulselect:"0",showlevel:"",asyn:"1",cascadecheck:"0",returnorglevel:""};
|
|
|
|
//获取父页面传入的参数
|
|
var _jparam = {};
|
|
var tmid = $.getURLParam('tmid');
|
|
var _strparam = '';
|
|
if(tmid){
|
|
_strparam = $.urlparam_decode($.method_call(tmid));
|
|
_jparam = $.str2json(_strparam);
|
|
}else{
|
|
_strparam = $.urlparam_decode($.getURLParam('param'));
|
|
_jparam = $.str2json(_strparam);
|
|
}
|
|
var orgchildMapping = ORG_VARIABLE.CODE_TO_CHILD_CODE;
|
|
_param_query.person_uuid = _jparam.queryParams.person_uuid!=null?_jparam.queryParams.person_uuid:$.getSessionUser().account_id;
|
|
_param_query.org_uuid = _jparam.queryParams.org_uuid!=null?_jparam.queryParams.org_uuid:'';
|
|
_param_query.isrealunit = _jparam.queryParams.isrealunit!=null?_jparam.queryParams.isrealunit:'';
|
|
_param_query.orglevel = _jparam.queryParams.orglevel?_jparam.queryParams.orglevel:'02';
|
|
_param_query.orgattr = _jparam.queryParams.orgattr!=null?_jparam.queryParams.orgattr:'00';
|
|
_param_query.showlevel = _jparam.queryParams.showlevel!=null?_jparam.queryParams.showlevel:'';
|
|
_param_query.isctrlperm = _jparam.queryParams.isctrlperm!=null?(_jparam.queryParams.isctrlperm==''?'1':_jparam.queryParams.isctrlperm):'1';
|
|
_param_query.ismulselect = _jparam.queryParams.ismulselect!=null?_jparam.queryParams.ismulselect:'0';
|
|
_param_query.asyn = _jparam.queryParams.asyn!=null?_jparam.queryParams.asyn:'1';
|
|
_param_query.cascadecheck = _jparam.queryParams.cascadecheck!=null?_jparam.queryParams.cascadecheck:'0';
|
|
_param_query.returnorglevel = _jparam.queryParams.returnorglevel?_jparam.queryParams.returnorglevel:_param_query.orglevel;
|
|
//过滤的组织级别
|
|
var filterorglevel = _jparam.queryParams.filterorglevel?_jparam.queryParams.filterorglevel:'';
|
|
var info = [{
|
|
id:'01'
|
|
,text:'省级'
|
|
},{
|
|
id:'02'
|
|
,text:'地区级'
|
|
},{
|
|
id:'03'
|
|
,text:'区县级'
|
|
},{
|
|
id:'07'
|
|
,text:'市场部'
|
|
},{
|
|
id:'08'
|
|
,text:'营销线'
|
|
}];
|
|
var _info = [];
|
|
if(filterorglevel){
|
|
var _newinfo = [];
|
|
for(var i=0;i<info.length;i++){
|
|
if(filterorglevel.indexOf(info[i].id)>-1){
|
|
_newinfo.push(info[i]);
|
|
}
|
|
}
|
|
_info = _newinfo;
|
|
}else{
|
|
_info = info;
|
|
}
|
|
var newinfo = [];
|
|
if(_param_query.orglevel){
|
|
for(var i=0;i<_info.length;i++){
|
|
if(_param_query.orglevel<=_info[i].id){
|
|
newinfo.push(_info[i]);
|
|
}
|
|
}
|
|
}else{
|
|
newinfo = _info;
|
|
}
|
|
var jparam = {};
|
|
$(function(){
|
|
var isExist = false;
|
|
for(var i=0;i<newinfo.length;i++){
|
|
if(newinfo[i].id == orgchildMapping[_param_query.orglevel]){
|
|
isExist = true;
|
|
break;
|
|
}
|
|
}
|
|
if(isExist == true){
|
|
_param_query.orglevel = orgchildMapping[_param_query.orglevel];
|
|
_param_query.returnorglevel = orgchildMapping[_param_query.returnorglevel];
|
|
}
|
|
jparam = {
|
|
_SRVNAME:'service.md.org',
|
|
_SRVMETHOD:'queryOrgTree',
|
|
_DATA:$.json2str({
|
|
op_acc:_param_query.person_uuid,
|
|
isctrlperm:_param_query.isctrlperm,
|
|
org_uuid:_param_query.org_uuid,
|
|
org_level:_param_query.orglevel,
|
|
org_attr:_param_query.orgattr,
|
|
asyn:_param_query.asyn=='0'?'0':'1',
|
|
parent_uuid:''
|
|
}),
|
|
_RSTYPE:'tree',
|
|
_RSPARAM:$.json2str({
|
|
asyn:_param_query.asyn=='0'?'0':'1',
|
|
idField:'org_uuid',
|
|
textField:'org_name',
|
|
parentField:'parent_uuid',
|
|
iconField:'',
|
|
attrs:'org_code,path_code,sys_code,org_type_scode,org_level_scode,parent_uuid,ext_id,ext_parent_id',
|
|
asyn_urlField:'pid',
|
|
asyn_dataField:'parent_uuid' //如果是异步,则从url中取出的参数替换_DATA参数的名
|
|
}),
|
|
_RSFIELD:'resultset',
|
|
_DATAFILTER:_param_query.isctrlperm//取值范围 1-启用数据权限 0或空-不启用
|
|
};
|
|
$.radio({
|
|
id:'org_type'
|
|
//,url:'wdk?action=pf.report&method=grid_dimension&ajaxparam='+new Date().getTime()
|
|
//,queryParams:{}
|
|
,data:newinfo
|
|
,idField:'id'
|
|
,textField:'text'
|
|
,initvalue:_param_query.orglevel
|
|
,onChange:function(record){
|
|
$.wait_open();
|
|
var id = 'layout_content';
|
|
_param_query.returnorglevel = record.id;
|
|
jparam._DATA = $.json2str({
|
|
op_acc:_param_query.person_uuid,
|
|
isctrlperm:_param_query.isctrlperm,
|
|
org_uuid:_param_query.org_uuid,
|
|
org_level:record.id,
|
|
org_attr:_param_query.orgattr,
|
|
asyn:_param_query.asyn=='0'?'0':'1',
|
|
parent_uuid:''
|
|
});
|
|
$("#"+id).empty();
|
|
renderTree(_param_query,jparam);
|
|
}
|
|
});
|
|
renderTree(_param_query,jparam);
|
|
|
|
|
|
});
|
|
function getRoot() {
|
|
var treeObj = $.fn.zTree.getZTreeObj("layout_content");
|
|
//返回一个根节点
|
|
var node = treeObj.getNodesByFilter(function (node) { return node.level == 0 }, true);
|
|
return node;
|
|
}
|
|
function renderTree(prop,jparam){
|
|
//初始化树
|
|
$.tree({
|
|
id: 'layout_content',
|
|
checkbox: prop.ismulselect=='1'?true:false,
|
|
expandall: true,
|
|
cascadeCheck: prop.cascadecheck=='1'?true:false,
|
|
asyn: prop.asyn=="0"?false:true,
|
|
url: 'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime(),
|
|
dataFilter: function (id, pnode, data) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
data[i].isParent = true;
|
|
}
|
|
return data;
|
|
},
|
|
queryParams:jparam,
|
|
onClick:function(event,treeid,node){
|
|
|
|
},
|
|
onLoadSuccess:function(data){
|
|
var treeObj = $.fn.zTree.getZTreeObj("layout_content");
|
|
treeObj.checkNode(getRoot(),true,true);
|
|
$.wait_close();
|
|
}
|
|
});
|
|
}
|
|
|
|
//控件返回结果的回调函数
|
|
function inputpop_getValue(){
|
|
|
|
|
|
var jres = {};
|
|
var rows = new Array();
|
|
if(_param_query.ismulselect=="1"){
|
|
//多选
|
|
rows = $.tree_getCheckedNode({id:'layout_content'});
|
|
}else{
|
|
//单选
|
|
rows = $.tree_getCheckedNode({id:'layout_content'});
|
|
}
|
|
|
|
if(rows == null || rows.length == 0){
|
|
alert("无记录选择!");
|
|
return false;
|
|
}
|
|
|
|
//组织返回参数
|
|
var value_id = "";
|
|
var value_text = "";
|
|
var value_value = "";
|
|
var selectcount = 0;
|
|
for(i=0; i < rows.length; i ++){
|
|
if(_param_query.returnorglevel!="" && rows[i].attributes.org_level_scode!= _param_query.returnorglevel){
|
|
continue;
|
|
}
|
|
|
|
if(selectcount>0){
|
|
value_id = value_id + ",";
|
|
value_text = value_text + ",";
|
|
value_value = value_value + ",";
|
|
}
|
|
value_id = value_id + rows[i].id;
|
|
value_text = value_text + rows[i].text;
|
|
value_value = value_value + rows[i].attributes.org_code;
|
|
selectcount = selectcount + 1;
|
|
}
|
|
|
|
if (selectcount == 0) {
|
|
var msg = "请选择组织级别为"+_param_query.returnorglevel+"的节点";
|
|
switch (_param_query.returnorglevel) {
|
|
case '01':
|
|
msg = "请选择省公司级别节点";
|
|
break;
|
|
case '02':
|
|
msg = "请选择市公司级别节点";
|
|
break;
|
|
case '03':
|
|
msg = "请选择分公司级别节点";
|
|
break;
|
|
case '04':
|
|
msg = "请选择直属部门级别节点";
|
|
break;
|
|
case '05':
|
|
msg = "请选择隶属部门级别节点";
|
|
break;
|
|
case '06':
|
|
msg = "请选择普通部门级别节点";
|
|
break;
|
|
case '07':
|
|
msg = "请选择市场部级别节点";
|
|
break;
|
|
case '08':
|
|
msg = "请选择营销线级别节点";
|
|
break;
|
|
case '09':
|
|
msg = "请选择送货部级别节点";
|
|
break;
|
|
case '10':
|
|
msg = "请选择送货线级别节点";
|
|
break;
|
|
default:
|
|
// statements_def
|
|
break;
|
|
}
|
|
|
|
alert(msg);
|
|
return;
|
|
}
|
|
var _org_field = org_field_map[$.checkbox_getValue('org_type')];
|
|
if(!_org_field){
|
|
alert('请勾选组织级别!');
|
|
return;
|
|
}
|
|
jres.value_id = value_id; //id值(保存值)
|
|
jres.value_text = value_text; //显示值
|
|
jres.value_value = value_value; //焦点显示值
|
|
jres.value_rows = rows;
|
|
jres.org_field = _org_field
|
|
return jres;
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body class="easyui-layout" style="padding:0px;margin:0px;background-color:#FFFFFF;">
|
|
<div data-options="region:'north',border:false,collapsed:false" style="height:40px;padding-top:8px;padding-left:10px;">
|
|
<div style="display: table"><label for="org_type" style="display: table-cell">请选择组织级别</label><div style="display: table-cell"> <input id="org_type" name="org_type"></input></div></div>
|
|
</div>
|
|
<!-- 中间表格 -->
|
|
<div data-options="region:'center',border:false,collapsed:false" style="border:1px solid #ddd;" >
|
|
<div id="layout_content" class="easyui-layout"></div>
|
|
</div>
|
|
</body>
|
|
</html>
|