import{r as o,P as y,I as v}from"./index.K_MFulpu.js";import"./elementPlus.CSBdF9Zt.js";import{t as f}from"./index.DIw38cNH.js";import{d as V,r as M,w as q,ai as C,o as h,c as w,F as x,a8 as R,M as L,O,S as k,T as S,k as _,s as n}from"./vue.1RczIYhx.js";import{_ as T}from"./_plugin-vue_export-helper.DlAUqK2U.js";import{a as b}from"./authFunction.CJG6xplX.js";const s="/api/system/message_center/";function D(t){return o({url:s,method:"get",params:t})}function I(t){return o({url:s+t+"/",method:"get"})}function j(t){return o({url:s+"get_self_receive/",method:"get",params:t})}function B(t){return o({url:s,method:"post",data:t})}function F(t){return o({url:s+t.id+"/",method:"put",data:t})}function G(t){return o({url:s+t+"/",method:"delete",data:{id:t}})}const P=V({__name:"index",props:{modelValue:Array,bindValue:Array,displayLabel:{type:String,default:""}},setup(t){const l=t,d=M();q(()=>l.bindValue,u=>{const{displayLabel:c}=l,i=u?u.map(e=>e[c]):null;d.value=i},{immediate:!0});const m=["success","info","warning","danger"],p=()=>m[Math.floor(Math.random()*m.length)];return(u,c)=>{const i=C("el-tag");return h(),w("div",null,[(h(!0),w(x,null,R(d.value,(e,r)=>(h(),L(i,{class:"many-to-many-tag",type:p,key:r},{default:O(()=>[k(S(e),1)]),_:2},1024))),128))])}}}),g=T(P,[["__scopeId","data-v-4dbdd8c1"]]),{compute:a}=v(),E=function({crudExpose:t,tabActivted:l}){const d=async e=>l.value==="receive"?await j(e):await D(e),m=async({form:e,row:r})=>(e.id=r.id,await F(e)),p=async({row:e})=>await G(e.id),u=async({form:e})=>await B(e),c=async({row:e})=>await I(e.id),i=_(()=>l.value==="receive");return{crudOptions:{request:{pageRequest:d,addRequest:u,editRequest:m,delRequest:p},actionbar:{buttons:{add:{show:_(()=>l.value!=="receive"&&b("messageCenter:Create"))}}},rowHandle:{fixed:"right",width:150,buttons:{edit:{show:!1},view:{text:"查看",type:"text",iconRight:"View",show:b("messageCenter:Search"),click({index:e,row:r}){t.openView({index:e,row:r}),l.value==="receive"&&(c({row:r}),t.doRefresh())}},remove:{iconRight:"Delete",type:"text",show:b("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:i.value},dict:y({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:y({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:n(f),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:n(g),vModel:"modelValue",bindValue:a(({row:e})=>e.user_info),displayLabel:"name"}}},target_role:{title:"目标角色",search:{disabled:!0},width:130,form:{component:{name:n(f),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:n(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:n(f),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:"部门名称",width:150},{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:n(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:r}=e;return r!=="add"})},uploader:{type:"form",buildUrl(e){return e.url}}}}}}}}};export{E as createCrudOptions};
