import{o as $,r as c,a as C,j as s}from"./react.b0bedc10.js";import{I as w,S as L}from"./zarm.80120c4d.js";import{U as i,L as D}from"./List.baa8939f.js";import{s as F}from"./index.9b0ee734.js";import{b as N,u as z,L as I}from"./index.a3f0fe79.js";import{l as M}from"./lodash.fc3c9220.js";import"./Fetch.e6ea9900.js";import"./Patrol.49bc16dd.js";import"./Empty.1ca4811e.js";import"./searchEmpty.9ddd526b.js";import"./Project.fe0152f3.js";const T="_button_bar_1fjb8_12",U="_button_1_1fjb8_22",V="_button_2_1fjb8_33",q="_unity_pop_new_1fjb8_42",G="_unity_pop_1fjb8_42",H="_unity_check_1fjb8_66",J="_unity_check_2_1fjb8_73",K="_unity_choose_1fjb8_79",O="_unity_empty_1fjb8_98",Q="_unity_close_1fjb8_108",R="_projects_1fjb8_126",W="_search_bar_1fjb8_130",X="_search_1fjb8_130",Y="_list_1fjb8_145",Z="_affix_1fjb8_149",ee="_circle_1fjb8_156",te="_pop_body_1fjb8_169";var n={"detail-cell":"_detail-cell_1fjb8_1",button_bar:T,button_1:U,button_2:V,unity_pop_new:q,unity_pop:G,unity_check:H,unity_check_2:J,unity_choose:K,unity_empty:O,unity_close:Q,projects:R,search_bar:W,search:X,list:Y,affix:Z,circle:ee,pop_body:te,"button-bar":"_button-bar_1fjb8_174"};const se=w.createFromIconfont("//at.alicdn.com/t/font_3322051_t57u0j0b1ek.js"),re=()=>{const{getProjects:j}=F.ProjectStore,t=N(),r=z(),[y,p]=c.exports.useState(""),[f,b]=c.exports.useState([]),[h,m]=c.exports.useState(""),[l,E]=c.exports.useState(""),[d,g]=c.exports.useState(!0);c.exports.useEffect(()=>{(async()=>{switch(t.role){case"self":document.title="\u5B9E\u9A8C\u5BA4\u81EA\u67E5",p("\u5B9E\u9A8C\u5BA4\u81EA\u67E5"),_({currentPage:1,pageSize:10,type:"0",refresh:!0});break;case"admin-self":document.title="\u5B9E\u9A8C\u5BA4\u81EA\u67E5",p("\u5B9E\u9A8C\u5BA4\u81EA\u67E5"),_({currentPage:1,pageSize:10,type:"0",refresh:!0});break;case"admin-specific":document.title="\u5B89\u5168\u5DE1\u67E5",p("\u5B89\u5168\u5DE1\u67E5"),_({currentPage:1,pageSize:10,type:"1,2",refresh:!0});break;case"inspector":document.title="\u6211\u8981\u68C0\u67E5",p("\u6211\u8981\u68C0\u67E5");const e=await i.getCurrentUser();e&&await _({currentPage:1,pageSize:10,type:"1,2",refresh:!0,currentUser:e});break}})()},[l]);const _=async({currentPage:e,pageSize:a,type:x,refresh:v,currentUser:P})=>{let o={};o.currentPage=e,o.pageSize=a,o.is_inspection=x,P&&(o.user_id=i.user.id),l&&(o.title=l);const u=await j(o);return(u==null?void 0:u.code)==200?(b(v?u.list:[...f,...u.list||[]]),m(u.total),g(!1),!0):!1},k=(e,a)=>{switch(e){case"\u5B9E\u9A8C\u5BA4\u81EA\u67E5":r(`/project-detail/${a.id}/${t.role}`);break;case"\u5B89\u5168\u5DE1\u67E5":r(`/project-detail/${a.id}/${t.role}`);break;case"\u8F96\u4E0B\u623F\u95F4":r(`/project-detail/${a.id}/${t.role}`);break;case"\u6211\u8981\u68C0\u67E5":r(`/project-detail/${a.id}/${t.role}`);break}},A=e=>{switch(t.role){case"self":r(`/add-project-self/${e}`);break;case"admin-self":r(`/add-project-self/${e}`,{state:{type:"init"}});break;case"admin-specific":r(`/add-projects/${e}`,{state:{type:"init"}});break;case"inspector":r(`/add-project/${e}`);break}},B=M.exports.debounce(e=>{E(e)},500),S=c.exports.useMemo(()=>{switch(t.role){case"admin-self":return!0;case"admin-specific":return!0;case"inspector":return i?!!(i.user.permissions&&i.user.permissions.includes("lsi-v1-edit-project")):!1}},[t.role,i.user]);return C("div",{className:n.projects,children:[d&&s(I,{}),s("div",{className:n.search_bar,children:s("div",{className:n.search,children:s(L,{shape:"rect",value:l,placeholder:"\u8BF7\u8F93\u5165\u9879\u76EE\u540D\u79F0",onChange:B})})}),s("div",{className:n.list,children:s(D,{loading:d,listData:f,total:h,type:y,getList:_,goDetail:k})}),S?s("div",{className:n.affix,children:s("div",{className:n.circle,onClick:()=>A(t.role),children:s(se,{type:"icon-plus"})})}):null]})};var de=$(re);export{de as default};
