1 |
- import{d as F,r as o,d_ as M,w as E,o as _,c as j,C as p,A as d,a as i,f as r,D as w,a3 as b,k as B,Y as J,F as K,J as Y,K as G,X as Q,Z as V,Q as X,_ as Z,__tla as H}from"./index-286756b9.js";import{_ as $,__tla as ee}from"./DictTag-f72b04ca.js";import{d as ae,__tla as te}from"./formatTime-83e416ef.js";import{P as m,d as le,a as re,g as ie,__tla as se}from"./index-77ab00f0.js";import ne,{__tla as oe}from"./PermissionForm-754d7e54.js";import{D as ue,__tla as _e}from"./dict-82dca549.js";import{u as de,__tla as ce}from"./useMessage-084b1e70.js";import"./color-6e929987.js";import{__tla as pe}from"./Dialog-4c2de357.js";import{__tla as me}from"./index-c725f8b2.js";let R,fe=Promise.all([(()=>{try{return H}catch{}})(),(()=>{try{return ee}catch{}})(),(()=>{try{return te}catch{}})(),(()=>{try{return se}catch{}})(),(()=>{try{return oe}catch{}})(),(()=>{try{return _e}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return pe}catch{}})(),(()=>{try{return me}catch{}})()]).then(async()=>{R=Z(F({name:"CrmPermissionList",__name:"PermissionList",props:{bizType:{type:Number,required:!0},bizId:{type:null,required:!0},showAction:{type:Boolean,required:!0}},setup(N,{expose:U}){const f=de(),s=N,I=o(!0),n=o([]),O=o({ownerUserId:0}),v=M(),T=async()=>{I.value=!0;try{const e=await ie({bizType:s.bizType,bizId:s.bizId});n.value=e,n.value.find(a=>a.userId===v.getUser.id&&a.level===m.OWNER)&&(O.value.ownerUserId=v.getUser.id)}finally{I.value=!1}},y=o([]),x=o(),P=e=>{var a;if(e.findIndex(l=>l.level===m.OWNER)!==-1)return f.warning("\u4E0D\u80FD\u9009\u62E9\u8D1F\u8D23\u4EBA\uFF01"),void((a=x.value)==null?void 0:a.clearSelection());y.value=e},z=o(),W=()=>{var a,l,t;if(((a=y.value)==null?void 0:a.length)===0)return void f.warning("\u8BF7\u5148\u9009\u62E9\u56E2\u961F\u6210\u5458\u540E\u64CD\u4F5C\uFF01");const e=(l=y.value)==null?void 0:l.map(k=>k.id);(t=z.value)==null||t.open("update",s.bizType,s.bizId,e)},L=async()=>{var a,l;if(((a=y.value)==null?void 0:a.length)===0)return void f.warning("\u8BF7\u5148\u9009\u62E9\u56E2\u961F\u6210\u5458\u540E\u64CD\u4F5C\uFF01");await f.delConfirm();const e=(l=y.value)==null?void 0:l.map(t=>t.id);await le({bizType:s.bizType,bizId:s.bizId,ids:e})},C=()=>{var e;(e=z.value)==null||e.open("create",s.bizType,s.bizId)},u=o(!1),g=o(!1),h=o(!1);E(n,e=>{var a;if(h.value=!1,(e==null?void 0:e.length)>0){h.value=!n.value.some(t=>t.level===m.OWNER),u.value=!1,g.value=!1;const l=(a=v.getUser)==null?void 0:a.id;n.value.filter(t=>t.userId===l).forEach(t=>{t.level===m.OWNER?(u.value=!0,g.value=!0):t.level===m.WRITE&&(g.value=!0)})}else h.value=!0},{immediate:!0}),U({openForm:C,validateOwnerUser:u,validateWrite:g,isPool:h});const S=async()=>{if(n.value.find(a=>a.userId===v.getUser.id&&a.level===m.OWNER))return void f.warning("\u8D1F\u8D23\u4EBA\u4E0D\u80FD\u9000\u51FA\u56E2\u961F\uFF01");const e=n.value.find(a=>a.userId===v.getUser.id);e&&await re(e.id)};return E(()=>s.bizId,e=>{e&&T()},{immediate:!0,deep:!0}),(e,a)=>{const l=X,t=Y,k=G,c=Q,q=$,A=V;return _(),j(K,null,[e.showAction?(_(),p(k,{key:0,justify:"end"},{default:d(()=>[i(u)?(_(),p(t,{key:0,type:"primary",onClick:C},{default:d(()=>[r(l,{class:"mr-5px",icon:"ep:plus"}),w(" \u65B0\u589E ")]),_:1})):b("",!0),i(u)?(_(),p(t,{key:1,onClick:W},{default:d(()=>[r(l,{class:"mr-5px",icon:"ep:edit"}),w(" \u7F16\u8F91 ")]),_:1})):b("",!0),i(u)?(_(),p(t,{key:2,onClick:L},{default:d(()=>[r(l,{class:"mr-5px",icon:"ep:delete"}),w(" \u79FB\u9664 ")]),_:1})):b("",!0),!i(u)&&i(n).length>0?(_(),p(t,{key:3,type:"danger",onClick:S},{default:d(()=>[w(" \u9000\u51FA\u56E2\u961F ")]),_:1})):b("",!0)]),_:1})):b("",!0),B((_(),p(i(J),{ref_key:"elTableRef",ref:x,data:i(n),"show-overflow-tooltip":!0,stripe:!0,class:"mt-20px",onSelectionChange:P},{default:d(()=>[r(c,{type:"selection",width:"55"}),r(c,{align:"center",label:"\u59D3\u540D",prop:"nickname"}),r(c,{align:"center",label:"\u90E8\u95E8",prop:"deptName"}),r(c,{align:"center",label:"\u5C97\u4F4D",prop:"postNames"}),r(c,{align:"center",label:"\u6743\u9650\u7EA7\u522B",prop:"level"},{default:d(({row:D})=>[r(q,{type:i(ue).CRM_PERMISSION_LEVEL,value:D.level},null,8,["type","value"])]),_:1}),r(c,{formatter:i(ae),align:"center",label:"\u52A0\u5165\u65F6\u95F4",prop:"createTime"},null,8,["formatter"])]),_:1},8,["data"])),[[A,i(I)]]),r(ne,{ref_key:"formRef",ref:z,onSuccess:T},null,512)],64)}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/crm/permission/components/PermissionList.vue"]])});export{fe as __tla,R as default};
|