1import{u as le,f as ue,e as k,r as u,a as e,j as r,b as N,d as f,a8 as ie}from"./index.7613290f.js";import{t as y}from"./[email protected]";import{u as T}from"./[email protected]";import{c as ce}from"./[email protected]";import{c as de}from"./[email protected]";import{a as R}from"./[email protected]";import{A as C}from"./Alert.40f5355b.js";import{M as g}from"./Modal.43fb08e1.js";import{F as p}from"./Form.00ebacfa.js";import{B as pe}from"./Button.cf4fad43.js";import"./appInsights.79eb1af4.js";import"./hook.20acd621.js";import"./TransitionWrapper.b92fa3dc.js";import"./CloseButton.35ab5273.js";const ye=()=>{le();const j=ue(),b=sessionStorage.getItem("token"),l=k(t=>t.menu.menu),F=k(t=>t.groupDeviceNumber),[U,w]=u.exports.useState(!1),[h,G]=u.exports.useState([]),[L,E]=u.exports.useState(!1),[z,O]=u.exports.useState(!1),[W,m]=u.exports.useState(!1),[H,_]=u.exports.useState(!1),[S,x]=u.exports.useState([]),[q,v]=u.exports.useState(""),[P,B]=u.exports.useState(!1),[i,D]=u.exports.useState([{className:"",classDescription:""}]),J=[{className:"",classDescription:""}],[c,I]=u.exports.useState({Group_ID:"",Group_Name:"",Group_Description:""}),K=(t,s)=>{const o=[...i];o[s].className=t.target.value,D(o)},Q=(t,s)=>{const o=[...i];o[s].classDescription=t.target.value,D(o)},V=()=>{for(const t of i)if(t.className===""||t.classDescription==="")return!1;return!0},X=()=>{if(!l.schoolOption){alert("\u8ACB\u5148\u9078\u64C7\u5B78\u6821");return}D([...i,{className:"",classDescription:""}])},Y=t=>{const s=[...i];s.splice(t,1),D(s)},Z=()=>{const t=i.map(o=>o.className),s=new Set(t);return t.length!==s.size},ee=()=>{const t=i.map(s=>s.className);return h.some(s=>t.includes(s.Group_Name))},te=(t,s)=>{x(s?[...S,t]:S.filter(o=>o.Group_ID!==t.Group_ID))},se=async()=>{if(!l.schoolOption){alert("\u8ACB\u5148\u9078\u64C7\u5B78\u6821");return}let t=[];for(let s of S){const o=F.find(n=>n.unit===s.Group_Name);if(o){let n=`<strong>\u73ED\u7D1A ${s.Group_Name} \u7121\u6CD5\u79FB\u9664\uFF0C\u5C1A\u6709\u8F09\u5177: </strong>`,a=[];o.Windows>0&&a.push(`Windows: ${o.Windows}`),o.iOS>0&&a.push(`iOS: ${o.iOS}`),o.Android>0&&a.push(`Android: ${o.Android}`),o.ChromeOS>0&&a.push(`ChromeOS: ${o.ChromeOS}`),n+=`<br>${a.join(", ")}`,t.push(n)}else await M(s.Group_ID,s.Group_Name,s.Group_Description)}t.length>0?(v(t.join("<br><br>")),m(!0),setTimeout(()=>{m(!1)},6e3)):m(!1),A(),x([])},A=async()=>{if(!l.schoolOption){alert("\u8ACB\u5148\u9078\u64C7\u5B78\u6821");return}let t=l.schoolOption;try{const o=(await N.get(`${f}/api/Group/${t}/Class`,{headers:{"Content-Type":"application/json;charset=UTF-8","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${b}`}})).data;G(o),j(ie(o)),console.log(o)}catch(s){console.log("group_device_number_error",s)}},oe=async t=>{if(t.preventDefault(),!l.schoolOption){alert("\u8ACB\u5148\u9078\u64C7\u5B78\u6821"),setSubmitButtonDisabled(!1);return}if(!V()){E(!0),setSubmitButtonDisabled(!1);return}if(Z()){_(!0),setSubmitButtonDisabled(!1);return}if(ee()){_(!0),setSubmitButtonDisabled(!1);return}w(!0),E(!1),_(!1);let s=l.schoolOption;const o=i.reduce((n,a,d)=>(n[d]=a,n),{});for(const n in o){const a=o[n];try{const d=await N.post(`${f}/api/Group/${s}/Class/Add`,{Group_Name:a.className,Group_Description:a.classDescription},{headers:{"Content-Type":"application/json;charset=UTF-8","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${b}`}});console.log(d.data),O(!0),setTimeout(()=>{O(!1)},6e3)}catch(d){console.log("\u65B0\u589E\u932F\u8AA4",d)}}A(),D(J),w(!1)},re=(t,s,o)=>{I({Group_ID:t,Group_Name:s,Group_Description:o}),B(!0)},$=(t,s)=>{I({...c,[s]:t.target.value})},ae=async t=>{t.preventDefault();const s=h.findIndex(a=>a.Group_ID===c.Group_ID),o=[...h];o[s]=c;let n=l.schoolOption;try{const a=await N.post(`${f}/api/Group/${n}/Class/Update`,{Group_ID:c.Group_ID,Group_Name:c.Group_Name,Group_Description:c.Group_Description},{headers:{"Content-Type":"application/json;charset=UTF-8","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${b}`}});console.log(a.data),G(o),console.log(h),B(!1)}catch(a){console.log("\u65B0\u589E\u6216\u66F4\u65B0\u73ED\u7D1A",a)}A()},M=async(t,s,o)=>
1{if(!l.schoolOption){alert("\u8ACB\u5148\u9078\u64C7\u5B78\u6821");return}let n=l.schoolOption;await N({method:"post",url:`${f}/api/Group/${n}/Class/Delete`,data:{Group_ID:t,Group_Name:s,Group_Description:o},credentials:"same-origin",headers:{"Content-Type":"application/json;charset=UTF-8","Access-Control-Allow-Origin":"*",Authorization:`Bearer ${b}`}}).then(a=>{console.log(a),G(h.filter(d=>d.Group_ID!==t))}).catch(a=>{console.log("\u522A\u9664\u73ED\u7D1A",a)}),A()};u.exports.useEffect(()=>{l.schoolOption&&A()},[l.schoolOption]);const ne=[{Group_ID:"1",Group_Name:"ipad01",Group_Description:"\u672A\u6307\u6D3E"},{Group_ID:"2",Group_Name:"ipad02",Group_Description:"\u5B78\u751F"},{Group_ID:"3",Group_Name:"ipad03",Group_Description:"\u5B78\u751F"},{Group_ID:"4",Group_Name:"ipad04",Group_Description:"\u5B78\u751F"},{Group_ID:"5",Group_Name:"iPad05",Group_Description:"\u6559\u5E2B"}];return e("div",{className:"MDMUnitRoleManage",children:e("div",{className:"device-group-box",children:e("div",{className:"default-content",children:r("div",{children:[e("div",{className:"page-title",children:"\u55AE\u4F4D\u7BA1\u7406"}),r("div",{className:"row",children:[r("div",{className:"col-lg-6 col-12",style:{paddingRight:"0px"},children:[r("table",{className:"table-set",children:[r("div",{className:"title title_mobile",children:[l.schoolNameOption,"\u73ED\u7D1A\u7BA1\u7406"]}),e("div",{className:"move-box mobile_box",children:r("table",{className:"test ",align:"center",children:[e("thead",{className:"disappear",children:r("tr",{className:"border-b-0.5 border-moe-blue-border",children:[e("th",{colSpan:2,children:"\u73ED\u7D1A\u540D\u7A31"}),e("th",{colSpan:2,children:"\u8AAA\u660E"})]})}),r("tbody",{children:[h.map(t=>r("tr",{className:"border-b-0.5 border-moe-blue-border",children:[e("td",{children:e("input",{className:"checkbox",type:"checkbox",name:"code",value:"",style:{width:"20px",height:"20px"},onChange:s=>te(t,s.target.checked)})}),e("td",{children:t.Group_Name}),e("td",{style:{color:"#46c5e3"},className:"disappear",children:"|"}),e("td",{className:"disappear",children:t.Group_Description}),r("td",{style:{textAlign:"end"},children:[e("img",{src:ce,className:"writeIcon"})," ","\xA0",e("img",{className:"writeIcon",src:de,onClick:()=>re(t.Group_ID,t.Group_Name,t.Group_Description)})," ","\xA0",e("img",{className:"trashIcon",src:y,onClick:()=>{const s=F.find(o=>o.unit===t.Group_Name);if(s){let o=`<strong> \u73ED\u7D1A${t.Group_Name}\u7121\u6CD5\u79FB\u9664\uFF0C\u5C1A\u6709\u8F09\u5177</strong><br>`,n=[];s.Windows>0&&n.push(`Windows: ${s.Windows}`),s.iOS>0&&n.push(`iOS: ${s.iOS}`),s.Android>0&&n.push(`Android: ${s.Android}`),s.ChromeOS>0&&n.push(`ChromeOS: ${s.ChromeOS}`),o+=`<br>${n.join(", ")}`,v(o),m(!0),setTimeout(()=>{m(!1)},6e3)}else m(!1),M(t.Group_ID,t.Group_Name,t.Group_Description)}})]})]},t.Group_ID)),r("tr",{children:[e("td",{colSpan:5,style:{textAlign:"center"},children:r("button",{className:"btn-style",type:"submit",onClick:se,children:[e("img",{src:y})," \xA0\u591A\u9078\u522A\u9664"]})}),e("td",{colSpan:5,style:{textAlign:"center"},children:r("button",{className:"btn-style",type:"submit",children:[e("img",{src:T})," \xA0\u6A39\u72C0\u5716\u532F\u51FA"]})})]})]}),e("tr",{children:e("td",{style:{textAlign:"center",paddingTop:"20px"},colSpan:6,children:W&&e(C,{variant:"danger",children:e("div",{dangerouslySetInnerHTML:{__html:q}})})})})]})})]}),e("form",{onSubmit:oe,children:r("table",{className:"table-set",children:[e("div",{className:"title title_mobile",children:"\u65
1B0\u589E\u55AE\u4F4D"}),e("div",{className:"move-box mobile_box",children:r("table",{align:"center",className:"add",children:[e("thead",{className:"disappear",children:r("tr",{children:[e("th",{children:"\u73ED\u7D1A\u540D\u7A31"}),e("th",{children:"\u8AAA\u660E"})]})}),e("tbody",{children:i.map((t,s)=>r("tr",{children:[e("td",{children:e("input",{type:"text",name:"class1",value:t.className,onChange:o=>K(o,s),placeholder:"\u8F38\u5165\u73ED\u7D1A\u540D\u7A31"})}),e("td",{children:e("input",{type:"text",name:"explain1",value:t.classDescription,onChange:o=>Q(o,s),placeholder:"\u8F38\u5165\u8AAA\u660E"})}),e("td",{children:e("img",{className:"addRow",src:R,alt:"Add row",onClick:X})}),i.length>1&&e("td",{children:e("img",{src:y,alt:"delete row",onClick:()=>Y(s)})})]},s))}),r("tfoot",{children:[e("tr",{children:e("td",{colSpan:4,style:{textAlign:"center"},children:r("button",{className:"btn-style",type:"submit",disabled:U,children:[e("img",{src:R})," \xA0\u65B0\u589E"]})})}),e("tr",{children:r("td",{style:{textAlign:"center",paddingTop:"20px"},colSpan:4,children:[L&&e(C,{variant:"danger",children:e("strong",{children:"\u73ED\u7D1A\u540D\u7A31\u548C\u8AAA\u660E\u90FD\u9700\u586B\u5BEB"})}),H&&e(C,{variant:"danger",children:e("strong",{children:"\u73ED\u7D1A\u540D\u7A31\u4E0D\u53EF\u4EE5\u91CD\u8907"})}
1),z&&e(C,{variant:"danger",children:e("strong",{children:"\u65B0\u589E\u73ED\u7D1A\u6210\u529F\uFF0C\u7A0D\u5F85\u91CD\u65B0\u6574\u7406\u5F8C\u66F4\u65B0"})})]})})]})]})})]})})]}),r(g,{show:P,onHide:()=>B(!1),children:[e(g.Header,{closeButton:!0,children:e(g.Title,{children:"\u4FEE\u6539\u73ED\u7D1A\u8CC7\u6599"})}),e(g.Body,{children:r(p,{style:{gap:"10px"},children:[r(p.Group,{children:[e(p.Label,{style:{color:"#46c5e3",fontSize:"20px"},children:"\u73ED\u7D1A\u540D\u7A31"}),e(p.Control,{type:"text",value:c.Group_Name||"",onChange:t=>$(t,"Group_Name")})]}),r(p.Group,{children:[e(p.Label,{style:{color:"#46c5e3",fontSize:"20px"},children:"\u8AAA\u660E"}),e(p.Control,{type:"text",value:c.Group_Description||"",onChange:t=>$(t,"Group_Description")})]})]})}),e(g.Footer,{children:e(pe,{variant:"primary",onClick:ae,children:"\u66F4\u65B0"})})]}),e("div",{className:"col-lg-6 col-12",style:{paddingRight:"0px"},children:e("form",{children:r("table",{className:"table-set",children:[e("div",{className:"title title_mobile",children:"\u89D2\u8272\u7BA1\u7406"}),e("div",{className:"move-box mobile_box",children:r("table",{className:"test ",align:"center",children:[e("thead",{className:"disappear",children:r("tr",{className:"border-b-0.5 border-moe-blue-border",children:[e("th",{colSpan:1}),e("th",{colSpan:1,children:"\u8F09\u5177\u540D\u7A31"}),e("th",{colSpan:1}),e("th",{colSpan:1,children:"\u89D2\u8272"})]})}),r("tbody",{children:[ne.map((t,s)=>r("tr",{className:"border-b-0.5 border-moe-blue-border",children:[e("td",{children:s+1}),e("td",{children:t.Group_Name}),e("td",{style:{color:"#46c5e3"},className:"disappear",children:"|"}),e("td",{className:"disappear",children:r("select",{value:t.Group_Description,className:"select-style-w-full ",children:[e("option",{disabled:!0,value:"\u672A\u6307\u6D3E",children:"\u5C1A\u672A\u6307\u6D3E\u8ACB\u9078\u64C7\u89D2\u8272"}),e("option",{value:"\u6559\u5E2B",children:"\u6559\u5E2B"}),e("option",{value:"\u5B78\u751F",children:"\u5B78\u751F"})]})})]},t.Group_ID)),e("tr",{children:e("td",{colSpan:5,style:{textAlign:"center"},children:r("button",{className:"btn-style",type:"button",children:[e("img",{src:T})," \xA0\u6307\u6D3E"]})})})]})]})})]})})})]})]})})})})};export{ye as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.