manage-detail.0f7c835e.js 5.3 KB

12
  1. import{d as y,r as T,$ as I,c as t,aj as x,q as d,B as h,m as f,ah as O,R as S,F as b,g as M,a$ as B,al as E,o as v}from"./index.332c7f08.js";import{O as w}from"./index.ed5fc819.js";import{G as k,a as F}from"./index.5e198b6f.js";import{I as _}from"./index.96a8db5e.js";import{S as V}from"./index.4aa8e076.js";import{i as N}from"./icon_teacher.df08d662.js";import{O as D}from"./index.d7c1b6ac.js";import{C}from"./index.324108a5.js";import{C as g}from"./index.91135ff9.js";const $="_detailCellGroup_x1k9o_1",q="_manageTeacher_x1k9o_6",L="_sectionCellGroup_x1k9o_9",j="_detailCell_x1k9o_1",P="_img_x1k9o_16",R="_name_x1k9o_23",z="_phone_x1k9o_30",H="_sectionTitle_x1k9o_36",K="_functionGrid_x1k9o_51",U="_functionImg_x1k9o_58",J="_functionText_x1k9o_62",Q="_dialogTitle_x1k9o_73";var s={detailCellGroup:$,manageTeacher:q,sectionCellGroup:L,detailCell:j,img:P,name:R,phone:z,sectionTitle:H,functionGrid:K,functionImg:U,functionText:J,dialogTitle:Q};const W="_menuFunction_1ghfh_1",X="_menuContent_1ghfh_5",Y="_functionImg_1ghfh_18",Z="_gray_1ghfh_22",tt="_functionText_1ghfh_27";var r={menuFunction:W,menuContent:X,functionImg:Y,gray:Z,functionText:tt},et=y({name:"menu-function",props:{teacherId:{type:String,default:""},menus:{type:Array||String,default:[]}},emits:["close","success"],setup(u,{slots:e,attrs:c,emit:m}){const a=T({list:[],selectMenus:[]}),i=async()=>{try{const{data:n}=await f.post("/api-school/sysMenuButton/page",{data:{auditFlag:!1,status:!0,clientType:"SCHOOL",page:1,rows:100}});a.list=n.rows||[]}catch{}},o=n=>a.selectMenus.includes(n),G=n=>{if(o(n.id)){const l=a.selectMenus.findIndex(p=>p===n.id);a.selectMenus.splice(l,1)}else a.selectMenus.push(n.id)},A=async()=>{try{const n=[];a.list&&a.list.forEach(l=>{o(l.id)&&n.push({buttonImage:l.buttonImage,sortOrder:l.order,id:l.id,title:l.title,homePage:l.homePage})}),await f.post("/api-school/schoolStaff/updateButton",{hideLoading:!1,data:{teacherId:u.teacherId,menuButtons:[...n]}}),m("close"),m("success")}catch{}};return I(()=>{i();const l=(u.menus?u.menus:[]).map(p=>p.id);a.selectMenus=[...l]}),()=>t("div",{class:r.menuFunction},[t(x,{desotry:!1},null),t("div",{class:r.menuContent},[t("h2",null,[d("\u5168\u90E8\u529F\u80FD")]),t(k,{border:!1,class:r.functionGrid},{default:()=>[a.list&&a.list.map(n=>t(F,{onClick:()=>G(n),class:o(n.id)?"":r.gray},{icon:()=>t(_,{class:[r.functionImg],src:n.buttonImage},null),text:()=>t("div",{class:[r.functionText,"van-ellipsis"]},[n.title])}))]})]),t(V,{position:"bottom"},{default:()=>[t("div",{class:"btnGroup"},[t(h,{block:!0,round:!0,type:"primary",onClick:A},{default:()=>[d("\u786E\u8BA4\u4FEE\u6539")]})])]})])}});function nt(u){return typeof u=="function"||Object.prototype.toString.call(u)==="[object Object]"&&!E(u)}var mt=y({name:"manage-detail",setup(){const u=O(),e=S({}),c=T({menuStatus:!1,status:!1}),m=async()=>{try{const i=u.query,{data:o}=await f.get("/api-school/schoolStaff/detail/"+i.id);e.value={...o}}catch{}},a=async()=>{try{const i=u.query;await f.post("/api-school/schoolStaff/freeze/"+i.id,{hideLoading:!1}),setTimeout(()=>{e.value.status==="ACTIVATION"?(e.value.status="LOCKED",v("\u51BB\u7ED3\u6210\u529F")):(e.value.status="ACTIVATION",v("\u89E3\u51BB\u6210\u529F"))},100)}catch{}};return I(()=>{m()}),()=>{let i;return t("div",{class:s.manageTeacher},[t(x,null,null),t(C,{inset:!0,class:s.detailCellGroup},{default:()=>[t(g,{center:!0,class:s.detailCell},{icon:()=>t(_,{class:s.img,src:e.value.avatar?e.value.avatar:N},null),title:()=>t("div",{class:s.content},[t("p",{class:[s.name,"van-ellipsis"]},[e.value.nickname]),t("p",{class:s.phone},[e.value.phone])])})]}),t("div",{class:s.sectionTitle},[t("i",null,null),d("\u57FA\u672C\u4FE1\u606F")]),t(C,{inset:!0,class:[s.detailCellGroup,s.sectionCellGroup]},{default:()=>[t(g,{title:"\u624B\u673A\u53F7\u7801",value:e.value.phone},null),t(g,{title:"\u6027\u522B",value:e.value.gender==1?"\u7537":e.value.gender==0?"\u5973":""},null)]}),e.value.menuButtons&&e.value.menuButtons.length>0&&t(b,null,[t("div",{class:s.sectionTitle},[t("i",null,null),d("\u529F\u80FD\u6743\u9650")]),t(k,{border:!1,class:s.functionGrid},nt(i=e.value.menuButtons.map(o=>t(F,null,{icon:()=>t(_,{class:s.functionImg,src:o.buttonImage},null),text:()=>t("div",{class:[s.functionText,"van-ellipsis"]},[o.title])})))?i:{default:()=>[i]})]),t(D,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup","btnMore"],style:{paddingLeft:"13px",paddingRight:"13px"}},[M.user.data.manageAdmin&&t(h,{type:"primary",round:!0,onClick:()=>c.menuStatus=!0},{default:()=>[d("\u4FEE\u6539\u6743\u9650")]}),t(h,{type:"primary",round:!0,color:"#64A9FF",onClick:()=>c.status=!0},{default:()=>[e.value.status==="ACTIVATION"&&"\u51BB\u7ED3\u8D26\u53F7",e.value.status==="LOCKED"&&"\u89E3\u51BB\u8D26\u53F7"]})])]}),t(w,{modelValue:c.menuStatus,"onUpdate:modelValue":o=>c.menuStatus=o,destroy:!0},{default:()=>[t(et,{onClose:()=>c.menuStatus=!1,onSuccess:()=>m(),teacherId:e.value.id,menus:e.value.menuButtons},null)]}),t(B,{show:c.status,"onUpdate:show":o=>c.status=o,message:`${e.value.status==="ACTIVATION"?`\u51BB\u7ED3\u540E\u8BE5\u7BA1\u7406\u8001\u5E08\u5C06\u65E0\u6CD5\u767B\u5F55
  2. \u786E\u8BA4\u9700\u8981\u51BB\u7ED3\u5417\uFF1F`:"\u786E\u8BA4\u9700\u8981\u89E3\u51BB\u5417\uFF1F"}`,messageAlign:"left",showCancelButton:!0,onConfirm:a},{title:()=>t("div",{class:s.dialogTitle},[t("i",null,null),e.value.status==="ACTIVATION"?"\u51BB\u7ED3":"\u89E3\u51BB",d("\u7BA1\u7406\u8001\u5E08")])})])}}});export{mt as default};