import{r as s,H as _,K as w}from"./index.ad3efb29.js";import"./elementPlus.4833989a.js";import{t as h}from"./index.1e2ff30c.js";import{d as v,r as V,w as x,ai as M,o as b,c as y,F as q,a8 as R,M as C,O as L,S as O,T as k,k as S,B as T,s as o}from"./vue.adf17aba.js";import{_ as j}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";const u="/api/system/message_center/";function B(t){return s({url:u,method:"get",params:t})}function D(t){return s({url:u+t+"/",method:"get"})}function F(t){return s({url:u+"get_self_receive/",method:"get",params:t})}function G(t){return s({url:u,method:"post",data:t})}function H(t){return s({url:u+t.id+"/",method:"put",data:t})}function P(t){return s({url:u+t+"/",method:"delete",data:{id:t}})}const I=v({__name:"index",props:{modelValue:Array,bindValue:Array,displayLabel:{type:String,default:""}},setup(t){const r=t,c=V();x(()=>r.bindValue,i=>{const{displayLabel:p}=r,d=i?i.map(l=>l[p]):null;c.value=d},{immediate:!0});const m=["success","info","warning","danger"],f=()=>m[Math.floor(Math.random()*m.length)];return(i,p)=>{const d=M("el-tag");return b(),y("div",null,[(b(!0),y(q,null,R(c.value,(l,e)=>(b(),C(d,{class:"many-to-many-tag",type:f,key:e},{default:L(()=>[O(k(l),1)]),_:2},1024))),128))])}}});const g=j(I,[["__scopeId","data-v-4dbdd8c1"]]),{compute:a}=w(),z=function({crudExpose:t,tabActivted:r}){const c=async e=>r.value==="receive"?await F(e):await B(e),m=async({form:e,row:n})=>(e.id=n.id,await H(e)),f=async({row:e})=>await P(e.id),i=async({form:e})=>await G(e),p=async({row:e})=>await D(e.id),d=S(()=>r.value==="receive"),l=T("$hasPermissions");return{crudOptions:{request:{pageRequest:c,addRequest:i,editRequest:m,delRequest:f},rowHandle:{fixed:"right",width:150,buttons:{edit:{show:!1},view:{text:"查看",type:"text",iconRight:"View",show:l("messageCenter:Search"),click({index:e,row:n}){t.openView({index:e,row:n}),r.value==="receive"&&(p({row:n}),t.doRefresh())}},remove:{iconRight:"Delete",type:"text",show:l("messageCenter:Delete")}}},columns:{id:{title:"id",form:{show:!1}},title:{title:"标题",search:{show:!0},type:["text","colspan"],column:{minWidth:120},form:{rules:[{required:!0,message:"必填项"}],component:{span:24,placeholder:"请输入标题"}}},is_read:{title:"是否已读",type:"dict-select",column:{show:d.value},dict:_({data:[{label:"已读",value:!0,color:"success"},{label:"未读",value:!1,color:"danger"}]}),form:{show:!1}},target_type:{title:"目标类型",type:["dict-radio","colspan"],column:{minWidth:120},dict:_({data:[{value:0,label:"按用户"},{value:1,label:"按角色"},{value:2,label:"按部门"},{value:3,label:"通知公告"}]}),form:{component:{optionName:"el-radio-button"},rules:[{required:!0,message:"必选项",trigger:["blur","change"]}]}},target_user:{title:"目标用户",search:{disabled:!0},form:{component:{name:o(h),vModel:"modelValue",displayLabel:a(({row:e})=>e?e.user_info:null),tableConfig:{url:"/api/system/user/",label:"name",value:"id",isMultiple:!0,columns:[{prop:"name",label:"用户名称",width:120},{prop:"phone",label:"用户电话",width:120}]}},show:a(({form:e})=>e.target_type===0),rules:[{required:!0,message:"必填项"}]},column:{show:!1,component:{name:o(g),vModel:"modelValue",bindValue:a(({row:e})=>e.user_info),displayLabel:"name"}}},target_role:{title:"目标角色",search:{disabled:!0},width:130,form:{component:{name:o(h),vModel:"modelValue",displayLabel:a(({row:e})=>e?e.role_info:null),tableConfig:{url:"/api/system/role/",label:"name",value:"id",isMultiple:!0,columns:[{prop:"name",label:"角色名称"},{prop:"key",label:"权限标识"}]}},show:a(({form:e})=>e.target_type===1),rules:[{required:!0,message:"必填项"}]},column:{show:!1,component:{name:o(g),vModel:"modelValue",bindValue:a(({row:e})=>e.role_info),displayLabel:"name"}}},target_dept:{title:"目标部门",search:{disabled:!0},width:130,type:"table-selector",form:{component:{name:o(h),vModel:"modelValue",displayLabel:a(({form:e})=>e.target_dept_name),tableConfig:{url:"/api/system/dept/all_dept/",label:"name",value:"id",isTree:!0,isMultiple:!0,columns:[{prop:"name",label:"部门名称"},{prop:"status_label",label:"状态"},{prop:"parent_name",label:"父级部门"}]}},show:a(({form:e})=>e.target_type===2),rules:[{required:!0,message:"必填项"}]},column:{show:!1,component:{name:o(g),vModel:"modelValue",bindValue:a(({row:e})=>e.dept_info),displayLabel:"name"}}},content:{title:"内容",column:{width:300,show:!1},type:["editor-wang5","colspan"],form:{rules:[{required:!0,message:"必填项"}],component:{disabled:!0,id:"1",editorConfig:{readOnly:a(e=>{const{mode:n}=e;return n!=="add"})},uploader:{type:"form",buildUrl(e){return e.url}}}}}}}}};export{z as createCrudOptions};
