(this.webpackJsonp=this.webpackJsonp||[]).push([[178],{eWQA:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=E(a("W9HT")),l=E(a("NUBc")),r=E(a("wCAj")),c=E(a("NJEC")),u=E(a("3S7+")),o=E(a("tsqr")),i=E(a("lrIw")),s=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],n=!0,l=!1,r=void 0;try{for(var c,u=e[Symbol.iterator]();!(n=(c=u.next()).done)&&(a.push(c.value),!t||a.length!==t);n=!0);}catch(e){l=!0,r=e}finally{try{!n&&u.return&&u.return()}finally{if(l)throw r}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};a("T2oS"),a("DjyN"),a("g9YV"),a("P2fV"),a("5Dmo"),a("miYZ"),a("O3gP");var d=a("cDcd"),f=E(d),m=E(a("vDqi")),p=a("spEH"),h=E(a("ess8"));function E(e){return e&&e.__esModule?e:{default:e}}var v=i.default.Option;t.default=function(e){var t=(0,d.useState)(!1),a=s(t,2),E=a[0],g=a[1],j=(0,d.useState)(void 0),y=s(j,2),_=y[0],w=y[1],S=(0,d.useState)(1),b=s(S,2),x=b[0],N=b[1],T=(0,d.useState)(0),k=s(T,2),C=k[0],z=k[1],A=(0,d.useState)(void 0),I=s(A,2),O=I[0],B=I[1],D=(0,d.useState)(""),J=s(D,2),P=J[0],H=J[1],M=(0,d.useState)(void 0),V=s(M,2),W=V[0],q=V[1],Y=e.match.params,F=Y.OIdentifier,Q=Y.groupId,R=e.includesAllProject;function U(){g(!0);var e="/organizations/"+F+"/teams/"+Q+"/team_projects.json";m.default.get(e,{params:{page:x,limit:15}}).then((function(e){e&&e.data&&(w(e.data.team_projects),z(e.data.total_count))})).catch((function(e){})),g(!1)}(0,d.useEffect)((function(){U()}),[x]),(0,d.useEffect)((function(){var e="/organizations/"+F+"/projects/search.json";m.default.get(e,{params:{search:P}}).then((function(e){var t,a;e&&e.data&&(a=(t=e.data.projects)&&t.map((function(e,t){return f.default.createElement(v,{key:t,value:""+e.id,searchValue:""+e.name},e.name)})),q(a))})).catch((function(e){}))}),[P]);var Z=[{title:"项目名称",dataIndex:"project",width:"85%",render:function(e,t){return f.default.createElement("a",{href:"/"+e.owner_login+"/"+e.identifier},e.owner_name,"/",e.name)}},{title:"操作",dataIndex:"operation",render:function(e,t){return R?f.default.createElement(u.default,{title:"该团队拥有所有项目权限，不支持移除，可在基本设置中进行调整。"},f.default.createElement("span",{style:{color:"gray"}},"移除")):f.default.createElement(c.default,{title:"确认移除项目吗？",onConfirm:function(){return function(e){g(!0);var t="/organizations/"+F+"/teams/"+Q+"/team_projects/"+e+".json";m.default.delete(t).then((function(e){e&&e.data.status>-1&&(N(1),U())})).catch((function(e){})),g(!1)}(t.project.identifier)},okText:"确认",cancelText:"取消"},f.default.createElement("a",{className:"color-red"},"移除"))}}];return f.default.createElement(n.default,{spinning:E},f.default.createElement(p.WhiteBack,{className:"mb30"},f.default.createElement(h.default,null,f.default.createElement("span",null,"团队项目管理")),f.default.createElement(p.FlexAJ,{style:{width:"100%"}},f.default.createElement("div",{className:"padding20-30"},f.default.createElement(i.default,{style:{width:300},placeholder:"搜索项目...",onChange:function(e){H(e||"")},onSelect:function(e){B(e),H(e)},allowClear:!0},W),f.default.createElement(p.Blueline,{className:"ml30",onClick:function(){return function(){if(O){g(!0);var t="/organizations/"+F+"/teams/"+Q+"/team_projects.json";m.default.post(t,{repo_name:O}).then((function(e){e&&e.data.id&&(N(1),U()),g(!1)})).catch((function(e){g(!1)}))}else e.showNotification("请选择要添加的项目!")}()}},"+ 添加项目")),!R&&f.default.createElement("div",{className:"pr30"},f.default.createElement(c.default,{title:"确认添加组织内所有项目至该团队？",onConfirm:function(){return g(!0),void m.default.post("/organizations/"+F+"/teams/"+Q+"/team_projects/create_all.json").then((function(e){e&&!e.data.status&&(o.default.success("添加成功"),U()),g(!1)})).catch((function(e){g(!1)}))},okText:"确认",cancelText:"取消"},f.default.createElement(p.Blueback,{className:"mr30"},"添加所有")),f.default.createElement(c.default,{title:"确认移除该团队内所有项目？",onConfirm:function(){return g(!0),void m.default.delete("/organizations/"+F+"/teams/"+Q+"/team_projects/destroy_all.json").then((function(e){e&&!e.data.status&&(o.default.success("移除成功"),U()),g(!1)})).catch((function(e){g(!1)}))},okText:"确认",cancelText:"取消"},f.default.createElement(p.Redback,null,"移除所有")))),f.default.createElement("div",{className:"padding20-30",style:{paddingTop:"0px",minHeight:"400px"}},f.default.createElement(r.default,{size:"small",columns:Z,dataSource:_,pagination:!1,className:"teamMemberTable"})),C>15?f.default.createElement("div",{className:"edu-txt-center mt30 mb20"},f.default.createElement(l.default,{simple:!0,defaultCurrent:x,total:C,pageSize:15,onChange:function(e){N(e)}})):""))}}}]);