| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- var managerTree = "";
- var dialog = "";
- var manager = "";
- var class_id= "";
- var typeRootId = "";
- $(document).ready(function(){
- loadTree();
- });
- function loadTree(){
- $("#targetclassTree").empty();
- manager = targetclassTree("hrPerformanceTargetAction.do?task=targetclassTree","targetclassTree",clickEvent,onSuccess);
- }
- function targetclassTree(treeAction, treeId, clickEvent) {
- managerTree=$("#" + treeId).ligerTree({
- url : PROJECT_NAME + "/" + changePath(treeAction)+"&time="+new Date().getTime(),
- checkbox : false,
- folderCheckbox : false,
- single : true,
- childIcon : 'folder',
- idFieldName : 'id',
- parentIDFieldName : 'pid',
- slide : false,
- nodeWidth : 160,
- openFolderEven: false,
- attribute : [ 'id', 'url' ],
- onSelect : function(node) {
- class_id=node.data.id;
- $("#class_id").val(class_id);
- selectEvent(node);
- },
- onclick : function(node) {
- clickEvent(node);
- },
- onSuccess : function() {
- if (onSuccess)
- onSuccess();
- }
- });
- managerTree = $("#" + treeId).ligerGetTreeManager();
- return managerTree;
- }
- function selectEvent(node){
- // var id = node.data.id;
- var pid = node.data.pid;
- if(pid == '0'){
- $('#editClassTypeBtn').attr("disabled","disabled");
- $('#delClassTypeBtn').attr("disabled","disabled");
- }else{
- $('#editClassTypeBtn').attr("disabled","");
- $('#delClassTypeBtn').attr("disabled","");
- }
- searchByKword("tree");
- }
- function clickEvent(node){
-
- }
- function onSuccess(){
- $('#editClassTypeBtn').attr("disabled","disabled");
- $('#delClassTypeBtn').attr("disabled","disabled");
- }
- function addClassType(){
- dialog = $.ligerDialog.open({ height: 260,
- width:500,
- url: 'hrPerformanceTargetAction.do?task=toAddClass',
- allowClose:false,
- title:'新增指标分类',
- buttons : [ {
- text : '保存',
- onclick : function(item,dialog){
- dialog.frame.saveClass();
- // loadTree();
- }
- },{
- text : '关闭',
- onclick : addClassCloseOk
- }]
- });
- }
- function editClassType(){
- var class_id = $("#class_id").val();
- dialog = $.ligerDialog.open({ height: 260,
- width:500,
- url: 'hrPerformanceTargetAction.do?task=toEditClass&class_id='+class_id,
- allowClose:false,
- title:'编辑指标分类',
- buttons : [ {
- text : '保存',
- onclick : function(item,dialog){
- dialog.frame.editClassType();
- loadTree();
- }
- },{
- text : '关闭',
- onclick : addClassCloseOk
- }]
- });
- }
- function delClassType(){
- var param={'class_id':class_id};
- if (window.confirm("确定要删除吗?")){
- sendAjaxParam(param,"hrPerformanceTargetAction.do?task=delClassType",'json',delTypeProcess);
- }
- }
- function delTypeProcess(data){
- if(data.result>0){
- $.ligerDialog.success("删除成功");
- class_id="";
- $("#class_id").val("");
- }else if(data.result==0){
- $.ligerDialog.warn("请检查指标分类是否被指标信息引用");
- }else if(data.result==-1){
- $.ligerDialog.error("删除失败");
- }
- loadTree();
- }
- function addClassCloseOk(item,dialog){
- dialog.close();
- loadTree();
- }
|