"use strict";app.controller("cmdbViewCtrl",["$rootScope","$scope","$state","$timeout","$interval","$aside","SweetAlert","toaster","Restangular","api_bpm_domain","api_configure_data","api_cmdb","api_configure_form",function(e,t,n,a,r,l,i,s,o,d,c,p,u){function f(e,t){for(var n={},a=null,r=null,l=0;l'+H[t].iconname+""}),ee.exit().remove(),W.start()}function w(){Y.classed("active",!0),re&&T(re),d3.event.ctrlKey||re||ae||x()}function T(e){t.selected_node.name+"-["+t.selected_node.uuid+"]";t.selected_node.props.state?t.selected_node.props.state&&("1"==t.selected_node.props.state?t.selected_node.props.state="未审核":"2"==t.selected_node.props.state?t.selected_node.props.state="已审核":"3"==t.selected_node.props.state?t.selected_node.props.state="不匹配":"4"==t.selected_node.props.state&&(t.selected_node.props.state="丢失")):t.selected_node.props.state="空",t.selected_node.name||(t.selected_node.name="空"),t.selected_node.status||(t.selected_node.statu="空"),t.selected_node.props.useradmin||(t.selected_node.props.useradmin="空"),s.pop({body:"

搜索代码:"+t.selected_node.uuid+"

资产标题:"+t.selected_node.name+"

状态:"+t.selected_node.status+"

审核状态:"+t.selected_node.props.state+"

维护人员:"+t.selected_node.props.useradmin+"

",bodyOutputType:"trustedHtml",timeout:3e3})}function _(){re&&(Q.attr("d","M"+re.x+","+re.y+"L"+d3.mouse(this)[0]+","+d3.mouse(this)[1]),x())}function j(){re&&Q.classed("hidden",!0).style("marker-end",""),Y.classed("active",!1),k()}function A(){if(ie===-1&&(ie=d3.event.keyCode,17===d3.event.keyCode&&(ee.call(W.drag),Y.classed("ctrl",!0)),te||ne))switch(d3.event.keyCode){case 8:case 66:ne&&(ne.left=!0,ne.right=!0),x();break;case 76:ne&&(ne.left=!0,ne.right=!1),x();break;case 82:te?te.reflexive=!te.reflexive:ne&&(ne.left=!1,ne.right=!0),x()}}function N(){ie=-1,17===d3.event.keyCode&&(ee.on("mousedown.drag",null).on("touchstart.drag",null),Y.classed("ctrl",!1))}function B(e){for(var t=0;t',t+='未定义:'+a+' "}for(var l=0;l':'',1==i.fix){t+=''+i.descName+':'+a+' ";break}t+=''+i.descName+':'+a+' ";break}}return t}),v(!1)}function S(){te||ne?jConfirm("确定删除?","提示",function(e){if(e){if(te){var t=te.id,n=te.name,a=te.type,r=te.label,l=te.assetNo,i=te.props,s=CMConstants.DISCARDE;$.ajax({type:"PUT",contentType:"application/json; charset=UTF-8",url:window.basePath+"/api/cmdb/ci/"+t,data:JSON.stringify({id:t,name:n,status:s,type:a,label:r,assetNo:l,props:i}),dataType:"json",success:function(e){200==e.status&&(jAlert("删除成功!","提示"),te.type=a,te.status=s,te.label=r,te.assetNo=l,te.props=i,te.name=n,x(),query(r,""))},error:function(e){jAlert("服务器请求异常","提示")}})}}else jAlert("请求异常","提示")}):jAlert("请先选择删除项!","提示")}function D(e){if(te){var t=null;d3.xhr(window.basePath+"/api/cm/findLabel?sign="+e).send("GET",function(e,n){e||(t=JSON.parse(n.responseText).id,$.ajax({type:"GET",url:window.basePath+"/api/cm/findByPro",data:{sourceType:1,sourceId:t},dataType:"json",success:function(e){for(var t=[],n=0;n':'',n+=''+l.descName+':'+a+' ";break}}return n})},error:function(e){jAlert("服务器访问异常!","提示")}}))})}else if(ne){for(var n=null,a=0;a':'',n+=''+l.descName+':'+a+' ";break}}return n})},error:function(e){jAlert("服务器访问异常!","提示")}})}}function O(){te.props?te.props[""]="未定义":te.props={"":"未定义"},M(),C()}function M(){te?(te.assetNo=d3.select("#nodeAssetNo").property("value"),te.name=d3.select("#nodeName").property("value"),te.type=d3.select("#nodeType").property("value"),te.label=d3.select("#nodeLabel").property("value"),te.status=d3.select("#nodeStatus").property("value")):ne&&(ne.name=d3.select("#linkName").property("value"),ne.cost=d3.select("#linkCost").property("value"))}function U(){ne&&(ne.props?ne.props[""]="未定义":ne.props={"":"未定义"},M(),P())}function E(){for(var e=0;e=1);else{var n=e.prefix.toLowerCase()+e.sign;t.cifilter_classic=n,u.renderTabForm(n).then(function(e){var n=o.stripRestangular(e);t.propTypeOptions=n})}},t.onPropTypeChange=function(e){t.propOptions=e.fields},t.onPropChange=function(e){t.cifilter_prop=e},t.searchCI=function(e,n,a){var r={};angular.isUndefined(n)&&(n=t.cifilter_prop),angular.isUndefined(a)&&(a=t.cifilter_classic),r.sign=a,angular.isDefined(n)&&(r[n.key]=e),p.query(r).then(function(e){for(var t=o.stripRestangular(e),n=t.data.node,a=[],r=0;r0?jConfirm("更换名称选项,动态属性将会被删除,是否继续?","提示",function(e){return e?(ne.name=n.value,ne.props={},P(),ne.props={},D(n.value),void 0):void(n.value=ne.name)}):(ne.name=n.value,ne.props={},D(n.value))}),d3.select("#addBtn").on("click",function(){var e=d3.select("#nodeLabel").property("value");""!=e?O():jAlert("请先选择资产类型!","提示")}),d3.select("#proType").selectAll("option").data(V).enter().append("option").attr("value",function(e){return e.key}).html(function(e){return e.value}),d3.select("#addSubBtn").on("click",function(){if(te){for(var e=d3.select("#proType").property("value"),t=d3.select("#proNo").property("value"),n=d3.select("#select"+de).property("value"),a=d3.select("#nodeLabel").property("value"),r="",l=0;l