role-modal.babe8c43.js 7.0 KB

1
  1. import{_ as $,d as J,m as y,cv as K,Q as X,a8 as Y,r as E,ag as Z,o as F,A as x,x as r,B as T,u as k,ct as ee,h as s,b as D,c as g,F as G,y as N,G as O,H as w,a as j,L as ue,M as le}from"./index.56449854.js";import{d as ae}from"./index.1b9de31e.js";function c(a,S,P=!1,b=!1,V="cost_field"){return{isOpen:!1,title:a,permission_id:S,needCompanyPermission:P,needFieldPermission:b,companyPermission:[],fieldPermission:[],cost_field_name:V}}function R(){return[c("\u4E1A\u52A1\u516C\u53F8\u4E1A\u7EE9\u62A5\u8868",1,!0,!1),c("\u5229\u6DA6\u770B\u677F",2,!0,!1),c("\u5E94\u6536\u8D26\u6B3E",3,!1,!1),c("\u8BA2\u5355\u60C5\u51B5",4,!1,!1),c("\u53D1\u8D27\u60C5\u51B5",5,!1,!1),c("\u4E1A\u7EE9\u62A5\u8868(\u65B0)",6,!0,!0),c("\u5E93\u5B58\u60C5\u51B5",7,!1,!1),c("\u7ED3\u7B97\u8BA2\u5355\u4E1A\u7EE9\u62A5\u8868",8,!1,!0,"cost_field_settle"),c("\u4E1A\u52A1\u516C\u53F8\u8BA2\u5355\u7EDF\u8BA1",9,!1,!1),c("\u4E1A\u52A1\u516C\u53F8\u5F00\u7968\u7EDF\u8BA1",10,!0,!1)]}const q=[{value:"GS2302231125079621",label:"\u5317\u4EAC\u767E\u8FB0\u8363\u8FBE\u56FD\u9645\u79D1\u8D38\u6709\u9650\u516C\u53F8"},{value:"GS2302231323386950",label:"\u5317\u4EAC\u6CD3\u6E90\u5E7F\u8BDA\u56FD\u9645\u5546\u8D38\u6709\u9650\u516C\u53F8"},{value:"GS2203161855277894",label:"\u5317\u4EAC\u4E07\u5B87\u6052\u901A\u56FD\u9645\u79D1\u8D38\u6709\u9650\u516C\u53F8"},{value:"GS2304031312553746",label:"\u5317\u4EAC\u9526\u5174\u5F18\u660C\u79D1\u6280\u6709\u9650\u516C\u53F8"},{value:"GS2302231124114965",label:"\u5317\u4EAC\u666E\u6DA6\u5FC3\u5802\u5546\u8D38\u6709\u9650\u516C\u53F8"},{value:"GS2401181650538135",label:"\u5317\u4EAC\u77E5\u4E8B\u6587\u5316\u4EA7\u4E1A\u53D1\u5C55\u6709\u9650\u516C\u53F8"},{value:"GS2402020907088731",label:"\u5317\u4EAC\u6CF0\u6587\u521B\u4F9B\u5E94\u94FE\u7BA1\u7406\u6709\u9650\u516C\u53F8"},{value:"GS2404151642335170",label:"\u5317\u4EAC\u5143\u9686\u96C5\u56FE\u6587\u5316\u4F20\u64AD\u80A1\u4EFD\u6709\u9650\u516C\u53F8"},{value:"GS2404151647395616",label:"\u7ED3\u7B97\u5355E\u4F01\u8D2D"}];var C=(a=>(a[a.update=0]="update",a[a.preview=1]="preview",a[a.create=2]="create",a))(C||{});const L=a=>(ue("data-v-2d35d1fe"),a=a(),le(),a),oe={class:"report"},se={class:"left"},te={class:"right"},ne={key:0,class:"company"},ie=L(()=>D("div",{class:"title"},"\u4E1A\u52A1\u516C\u53F8",-1)),re={key:1,class:"company"},de=L(()=>D("div",{class:"title"},"\u5B57\u6BB5\u6743\u9650",-1)),ce={class:"flex w-full justify-end"},me=J({__name:"role-modal",emits:["refresh"],setup(a,{expose:S,emit:P}){const b=y(!1),V=y(C.create),I=y(null),u=y(R()),U={mobile:"",nickname:"",is_show:[]},_=y({...U}),{run:M,loading:z}=K({success:()=>{P("refresh"),b.value=!1},responseCode:0}),H=X(()=>{const t="\u5FAE\u4FE1\u8D26\u53F7\u6743\u9650";switch(C.value){case C.create:return"\u521B\u5EFA"+t;case C.preview:return"\u67E5\u770B"+t;default:return"\u4FEE\u6539"+t}}),Q=Y({nickname:[{required:!0,message:"\u8BF7\u8F93\u5165\u771F\u5B9E\u59D3\u540D",trigger:"blur"}],mobile:[{required:!0,message:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",trigger:"blur"}]});function W(){I.value.validate(t=>{if(!t)return;let l=u.value.filter(e=>e.isOpen).map(({permission_id:e})=>e).join(",");const n=u.value.filter(e=>e.needFieldPermission).map(({fieldPermission:e})=>e.join(",")).join(",");n&&(l+=`,${n}`);const v=q.map(e=>({companyNo:e.value,companyName:e.label,info:u.value.reduce((o,d)=>d.companyPermission.includes(e.value)?[...o,d.permission_id]:o,[])})),{id:h,nickname:B,mobile:m}=_.value;M(ae({id:h,mobile:m,is_show:l,nickname:B,companyArr:v}))})}return S({onDisplay:(t,l)=>{_.value={...U},V.value=l,b.value=!0;const n=R(),{mobile:v,nickname:h,id:B}=t;let m=t.is_show.split(",");n.forEach(p=>{if(m.includes("cost_field")){m=m.filter(d=>d!=="cost_field");const e=n.findIndex(({permission_id:d})=>d===6),o=n.findIndex(({permission_id:d})=>d===8);e!==-1&&(n[e].fieldPermission=["cost_field"]),o!==-1&&(n[o].fieldPermission=["cost_field_settle"])}if(p.isOpen=m.includes(String(p.permission_id)),p.needCompanyPermission)for(const e in t.companyArr){const o=t.companyArr[e];!o.info||(o.info&&o.info.includes(String(p.permission_id))||o.info.includes(Number(p.permission_id)))&&p.companyPermission.push(o.companyNo)}}),u.value=n,_.value={id:B,mobile:v,nickname:h,is_show:t.is_show.split(",")}}}),(t,l)=>{const n=E("ElInput"),v=E("ElFormItem"),h=E("el-switch"),B=E("el-checkbox"),m=E("el-checkbox-group"),p=E("el-scrollbar"),e=E("ElButton"),o=E("ElDialog"),d=Z("loading");return F(),x(o,{center:"",modelValue:b.value,"onUpdate:modelValue":l[4]||(l[4]=A=>b.value=A),title:H.value,"close-on-click-modal":!1,width:"1024px"},{default:r(()=>[T((F(),x(k(ee),{ref_key:"formRef",ref:I,labelWidth:"100px","label-position":"left",model:_.value,rules:Q,disabled:V.value===k(C).preview},{default:r(()=>[s(v,{label:"\u771F\u5B9E\u59D3\u540D",prop:"nickname"},{default:r(()=>[s(n,{placeholder:"\u8BF7\u8F93\u5165\u771F\u5B9E\u59D3\u540D",modelValue:_.value.nickname,"onUpdate:modelValue":l[0]||(l[0]=A=>_.value.nickname=A),disabled:""},null,8,["modelValue"])]),_:1}),s(v,{label:"\u624B\u673A\u53F7",prop:"mobile",style:{"margin-bottom":"10px"}},{default:r(()=>[s(n,{placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",modelValue:_.value.mobile,"onUpdate:modelValue":l[1]||(l[1]=A=>_.value.mobile=A),disabled:""},null,8,["modelValue"])]),_:1}),s(v,{label:"\u53EF\u67E5\u770B\u62A5\u8868",required:"",style:{"margin-bottom":"0px","font-weight":"700"}}),s(p,{height:"350px"},{default:r(()=>[D("div",oe,[(F(!0),g(G,null,N(u.value,(A,i)=>(F(),g("div",{class:"report__wrapper",key:u.value[i].permission_id},[D("div",se,[D("p",null,O(A.title),1),s(h,{modelValue:u.value[i].isOpen,"onUpdate:modelValue":f=>u.value[i].isOpen=f},null,8,["modelValue","onUpdate:modelValue"])]),D("div",te,[u.value[i].needCompanyPermission?(F(),g("div",ne,[ie,s(m,{modelValue:u.value[i].companyPermission,"onUpdate:modelValue":f=>u.value[i].companyPermission=f,disabled:!u.value[i].isOpen},{default:r(()=>[(F(!0),g(G,null,N(k(q),f=>(F(),x(B,{key:f.value,label:f.value},{default:r(()=>[w(O(f.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):j("v-if",!0),u.value[i].needFieldPermission?(F(),g("div",re,[de,s(m,{modelValue:u.value[i].fieldPermission,"onUpdate:modelValue":f=>u.value[i].fieldPermission=f,disabled:!u.value[i].isOpen},{default:r(()=>[s(B,{label:u.value[i].cost_field_name},{default:r(()=>[w("\u6210\u672C")]),_:2},1032,["label"])]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])])):j("v-if",!0)])]))),128))])]),_:1}),s(v,null,{default:r(()=>[D("div",ce,[s(e,{type:"\u53D6\u6D88",onClick:l[2]||(l[2]=()=>b.value=!1)},{default:r(()=>[w("\u53D6\u6D88")]),_:1}),s(e,{type:"primary",onClick:l[3]||(l[3]=()=>W())},{default:r(()=>[w("\u4FDD\u5B58")]),_:1})])]),_:1})]),_:1},8,["model","rules","disabled"])),[[d,k(z)]])]),_:1},8,["modelValue","title"])}}});var pe=$(me,[["__scopeId","data-v-2d35d1fe"],["__file","C:/Users/89793/Desktop/projects/report-v3/src/views/system/wechatManager/components/role-modal.vue"]]),ve=Object.freeze(Object.defineProperty({__proto__:null,default:pe},Symbol.toStringTag,{value:"Module"}));export{C as M,pe as R,ve as r};