@jecloud/func
Version:
JECloud 功能库
1 lines • 3.41 kB
JavaScript
var e=this&&this.__assign||function(){return e=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},e.apply(this,arguments)};import{mergeProps as t,createVNode as n,createTextVNode as a}from"vue";import{reactive as o}from"vue";import{Button as u,Dropdown as l,Menu as r,Form as i,Input as c,InputSelect as s,Modal as f}from"@jecloud/ui";import{collectionFormData as d,shareFormData as m}from"../../../data/api/message";export function useStarButton(e){var t=e.$func;return{starButtonSlot:function(){return n(l,{trigger:["click"]},{default:function(){return[n(u,{icon:"fal fa-star",class:"bgcolor-grey"},null)]},overlay:function(){return n(r,{onClick:function(e){"collection"===e.key?g({$func:t}):v({$func:t})},style:"padding:0;"},{default:function(){return[n(r.Item,{style:"padding-right:17px;",icon:"fal fa-star",key:"collection"},{default:function(){return[a("收藏")]}}),n(r.Item,{style:"padding-right:17px;",icon:"fal fa-share",key:"share"},{default:function(){return[a("共享")]}})]}})}})}}}function g(a){var u=a.$func,l=u.getFuncData().info,r=l.tableCode,s=l.funcCode,m=l.funcName,g=l.pkCode,v=o({title:""}),p=o({title:[{required:!0,message:"该输入项为必填项"},{max:40,message:"不能大于40个字符"},{pattern:'^[^\\\\/*?:"\'<>|"]+$',message:"不能输入非法字符"}]}),h=i.useForm(v,p),b=h.validate,C=h.validateInfos,N=n(i,{model:v,labelCol:{style:"width:100px"}},{default:function(){return[n(i.Item,t({colon:!1,label:"收藏标题",name:"title"},C.title),{default:function(){return[n(c,{value:v.title,"onUpdate:value":function(e){return v.title=e}},null)]}})]}});f.dialog({title:"收藏",width:600,content:function(){return N},buttonAlign:"center",okButton:{closable:!1,handler:function(t){var n=t.$modal;b().then((function(){var t,a=null===(t=u.store.activeBean)||void 0===t?void 0:t[g],o=e({tableCode:r,funcCode:s,funcName:m,pkValue:a},v);d(o).then((function(){f.notice("收藏成功!","success"),n.close()}))})).catch((function(){}))}}})}function v(a){var u=a.$func,l=u.getFuncData().info,r=l.tableCode,d=l.funcCode,g=l.funcName,v=l.pkCode,p=o({title:"",userNames:"",accountIds:""}),h=o({title:[{required:!0,message:"该输入项为必填项"},{max:40,message:"不能大于40个字符"},{pattern:'^[^\\\\/*?:"\'<>|"]+$',message:"不能输入非法字符"}],userNames:[{required:!0,message:"该输入项为必填项"}]}),b=i.useForm(p,h),C=b.validate,N=b.validateInfos,y=n(i,{model:p,labelCol:{style:"width:100px"}},{default:function(){return[n(i.Item,t({colon:!1,label:"共享标题",name:"title"},N.title),{default:function(){return[n(c,{value:p.title,"onUpdate:value":function(e){return p.title=e}},null)]}}),n(i.Item,t({colon:!1,label:"共享人",name:"userNames"},N.userNames),{default:function(){return[n(s.User,{height:"200",value:p.userNames,"onUpdate:value":function(e){return p.userNames=e},textarea:!0,configInfo:"JE_RBAC_VACCOUNTDEPT,accountIds~userNames,id~text,M"},null)]}})]}});f.dialog({title:"共享",width:600,buttonAlign:"center",content:function(){return y},okButton:{closable:!1,handler:function(t){var n=t.$modal;C().then((function(){var t,a=null===(t=u.store.activeBean)||void 0===t?void 0:t[v],o=e({tableCode:r,funcCode:d,funcName:g,pkValue:a},p);m(o).then((function(){f.notice("共享成功!","success"),n.close()}))})).catch((function(){}))}}})}