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.
 
 
 
 
 
 

345 lines
10 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/wdk/theme/je/module/public/common.jsp"%>
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<%
String menu_code = request.getParameter("menucode");
WDK.writeButton(out, su, menu_code);
%>
<title>人员管理--兼职部门</title>
<script type="text/javascript">
//获取参数数据
var param = $.getURLParam('param');
var jparam = $.str2json($.urlparam_decode(param));
var _actionflag = jparam.queryParams.actionflag; //操作类型 add-新增 update-修改,读取原信息
var _mid = jparam.queryParams.mid; //父界面刷新方法标识
var _selected_id = jparam.queryParams.selected_id; //主键
var person_name = jparam.queryParams.person_name;
var _gridcode = 'platform.uum.uumuserdeptexgrid';
var _gridid = $.getUUID();
//初始化对象
$(function(){
//加载兼职结果
init();
});
//初始化数据
function init(){
$.wait_open();
//初始化人员信息
$('#person_name').val(jparam.queryParams.person_info.person_name);
$('#login_name').val(jparam.queryParams.person_info.login_name);
$('#depart_name').val(jparam.queryParams.person_info.depart_name);
//请求地址参数
var dataParam = {
_SRVNAME:'service.usr.staff'
,_SRVMETHOD:'queryStaffParttimeOrgByStaffID'
,_DATA:$.json2str({
op_account_uuid:$.getSessionUser().account_id
,person_uuid:_selected_id
})
,_RSTYPE:'grid'
,_RSFIELD:'persondeptex_info'
,_RSPARAM:$.json2str({pagequery:'0'})
};
//加载grid列表
var gridid = $.grid({
id : _gridid,
containerid : 'layout_grid',
gridcode : _gridcode,
checkbox : false,
checkOnSelect : false,
selectOnCheck : false,
url : 'wdk?action=wdk.pub&method=call_service&ajaxparam='+ new Date().getTime(),
queryParams : dataParam,
idField : 'persondeptex_uuid',
fitColumns:true, //是否自动填充满
nowrap:false, //自动换行
formatter:{},
editor: setEditorFields(),
onLoadSuccess:function(data){
}
});
$.wait_close();
}
/**
* 组装兼职部门的inputpop的参数,这个和顶部的是不一样的,grid里面修改的时候可选的部门树是限制在本管理单元内的
*/
function getInputpopParams(){
//组织参数
var dataJson = {
op_acc: $.getSessionUser().account_id
,parent_uuid: '-1'
,org_id: $.getSessionUser().companyuuid
,level:1
,include_self : 1
,result_fields:'org_uuid,org_code,org_name,parent_uuid'
,order_expr:'display_order'
};
//方法名
var queryMethod="queryAccountOrgListByParentID";
//组织请求数据集
return {
_SRVNAME: 'service.usr.org',
_SRVMETHOD: queryMethod,
_DATA: $.json2str(dataJson),
_RSFIELD: 'resultset',//TODO:待确认
_RSTYPE: 'tree',
_RSPARAM: $.json2str({
idField: 'org_uuid'
,valueField: 'org_uuid'
,textField: 'org_name'
,parentField: 'parent_uuid'
,asyn:'1' //是否是异步 0:同步;1:异步
,asyn_urlField:'parent_uuid'
,asyn_dataField:'parent_uuid' //如果是异步,则从url中取出的参数替换_DATA参数的名
})
};
}
//保存兼职部门 changeStaffParttimeOrg
function opt_saveDeptexDisplayOrder() {
$.grid_editor_ending({
id : _gridid
});
var totalRows = $.grid_getRows({ id:_gridid }); //$.grid_getData({ id:_gridid });
var jArr = []; //加入需要修改的兼职数组
for(var i=0;i<totalRows.length;i++){
if ('' == totalRows[i].depart_uuid) {
alert('【兼职部门】不能为空!');
return false;
}
if (totalRows[i].depart_uuid == jparam.queryParams.person_info.depart_uuid) {
alert('兼职部门不能与主职部门重复!');
return false;
}
var jObj = {}; //单行对象
//获取行对象
jObj.persondeptex_uuid=totalRows[i].persondeptex_uuid;
jObj.person_uuid=_selected_id;
jObj.depart_uuid = totalRows[i].depart_uuid;
jObj.display_order = totalRows[i].display_order;
jArr[i] = jObj; //数组加入值
}
$.wait_open();
//请求地址参数
var dataParam = {
_SRVNAME:'service.usr.staff'
,_SRVMETHOD:'saveStaffParttimeOrg'
,_DATA:$.json2str({
op_account_uuid: $.getSessionUser().account_id
,op_person_uuid: $.getSessionUser().personuuid
,person_uuid: _selected_id
,persondeptex_info:$.json2str(jArr)
})
};
//调用保存组织数据
$.cuajax({
url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
,method:"post"
,timeout:WDK_Timeout
,data:dataParam
,success : function(result) {
$.wait_close();
//返回值字符串转json
var jres = $.str2json(result);
alert(jres.desc);
if (jres.code == '1') {
opt_close();
}
}
,error : function(result) {
$.wait_close();
alert('网络错误!result=' + result);
}
});
}
function setEditorFields(){
return [
{ //兼职部门
field: 'depart_uuidname',
editor: {
type: 'inputpop',
options: {
gridid: _gridid,
type: 'tree',
field: 'depart_uuidname',
title: '兼职部门',
height: 480,
width: 320,
editable: false,
required: true,
asyn: true,
parentField: 'parent_uuid',
dataurl: 'wdk?action=wdk.pub&method=call_service&ajaxparam=' + new Date().getTime(),
queryParams: getInputpopParams(),
callback: function (jparam) {
var totalRows = $.grid_getRows({ id:_gridid });
var flag = true;
for(var i=0;i<totalRows.length;i++){
if (totalRows[i].depart_uuid == jparam.value_id) {
alert('不可重复添加兼职部门!');
flag = false;
}
}
if (flag) {
var depart_uuidnamecorp = null;
var dataParam = {
_SRVNAME: 'service.usr.org',
_SRVMETHOD: 'queryCorpInfoByDepartID',
_DATA: $.json2str({
op_acc: $.getSessionUser().account_id,
org_uuid: jparam.value_id,
org_level: '03',
result_fields: 'org_name,simple_name,org_type_scode'
}),
_RSFIELD: 'corp_info'
};
//通过界面直接调用服务
$.cuajax({
url: 'wdk?action=wdk.pub&method=call_service&ajaxparam=' + new Date().getTime(),
method: "post",
timeout: WDK_Timeout,
data: dataParam,
success: function (response) {
var jres = $.str2json(response);
if (jres) {
//depart_uuidnamecorp = jres.simple_name;
depart_uuidnamecorp = jres.org_name;
$.grid_setData({
id: _gridid,
data: {
depart_uuidnamecorp: depart_uuidnamecorp,
depart_uuid: jparam.value_id,
depart_uuidname: jparam.value_text
}
});
}
},
error: function (response) {
alert('网络错误!result=' + response);
}
});
} else {
$.grid_setData({
id: _gridid,
data: {
depart_uuid: jparam.row.depart_uuid,//此处value_id_old不可用
depart_uuidname: jparam.value_text_old
}
});
}
}
}
}
},
{
field: 'display_order',
editor: {
type: 'numberbox',
options: {
tipPosition: 'bottom',
precision: 0,
min: 1
}
}
}
];
}
function opt_add(){
if (!$.grid_editor_validate({id: _gridid})) {
return false;
}
$.grid_editor_append({
id : _gridid,
beginedit : true,
data : {
display_order: '100'
}
});
}
function opt_del(){
var row = $("#"+_gridid).datagrid('getSelected');
if(!row){
alert("请选择删除的纪录");
}
$.grid_editor_remove({id:_gridid});
}
//关闭
function opt_close() {
var wid = $.getURLParam("wid");
$.closeWin(wid);
}
</script>
</head>
<body class="easyui-layout" data-options="fit:true" style="background:#fff;">
<div data-options="region:'north',border:false,collapsed:false" class="page-title">
<div class="page-title-text"></div>
<div class="page-toolbar">
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-save'" onclick="opt_saveDeptexDisplayOrder()">保存</a>
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-window-close'" onclick="opt_close()">关闭</a>
</div>
</div>
<div data-options="region:'center',border:false,collapsed:false" >
<div class="edit-container-win" style="padding: 0 30px;">
<div class="form-title">
<span class="form-title-text">员工信息</span>
</div>
<div class="row">
<div class="formgroup">
<label>姓名</label>
<div>
<input type="text" id="person_name" name="person_name" title="" readonly />
</div>
</div>
<div class="formgroup">
<label>登录账户</label>
<div>
<input type="text" id="login_name" name="login_name" title="" readonly />
</div>
</div>
</div>
<div class="row">
<div class="formgroup">
<label>所属部门</label>
<div>
<input type="text" id="depart_name" name="depart_name" title="" readonly />
</div>
</div>
</div>
<div class="form-title" style="margin-top:10px;">
<span class="form-title-text">兼职信息</span>
<a href="javascript:void(0);" style="float:right;margin-top:5px;" class="easyui-linkbutton" data-options="iconCls:'fa fa-trash-o'" onclick="opt_del()">删除</a>
<a href="javascript:void(0);" style="float:right;margin-top:5px;margin-right:5px;" class="easyui-linkbutton" data-options="iconCls:'fa fa-plus'" onclick="opt_add()">新增</a>
</div>
<div id="layout_grid" style="padding:0 10px;margin-top: 6px;height: 200px;"></div>
</div>
</div>
</body>
</html>