import{D as $,r as m,Q as w,d as C}from"./index-mobile-Cdp4yXnt.js";import{d as E,Z as s,X as v,Q as l,_ as n,a3 as D,U as i,P as d,a2 as f,F as u,af as p,a1 as h,ab as g,m as M}from"./vue-C-_v7KcX.js";import{l as B,m as H,t as N,s as z,v as A,d as q,k as j}from"./element-plus-iuNPLb4-.js";function y(){return{loading:!0,mainForm:{},checkMap:{},configList:[],headList:[],result:[],showFlag:!1}}const O=E({name:"enable-op-config",model:{prop:"showFlag",event:"toggle"},data:y,props:{modelValue:{type:Boolean,default:!1},prop_functionId:String,reloadHandler:{type:Function,default:()=>{}},father:{type:Object,default:()=>({})}},computed:{},components:{DataTable:$},watch:{modelValue(e){this.showFlag=e},showFlag(e){e?this.loadData():Object.assign(this.$data,y())}},methods:{loadData(){this.loading=!0,m({method:"post",url:"/zxl_pm/request/functionAuth.svc?cmd=preBatchAdd",data:{zxlPrdId:this.$route.query.productId,functionId:this.prop_functionId}}).then(e=>{this.configList=e,this.result=w(e),e instanceof Array&&(this.headList=e[0].dictList?.map(o=>({dictId:o.dictId,dictLabel:o.dictLabel})));const t={};e.forEach(o=>{t[o.operationId]=o.dictList.filter(r=>r.selected===!0).map(r=>r.dictId)||[]}),this.checkMap=t,this.$nextTick(()=>{console.log("this.checkMap",this.checkMap)})}).finally(()=>this.loading=!1)},submitForm(){for(const[e,t]of Object.entries(this.checkMap))this.result.find(o=>o.operationId==e).dictList.forEach(o=>{o.selected=t.includes(o.dictId)});m({method:"post",url:"/zxl_pm/request/functionAuth.svc?cmd=batchAdd",data:{zxlPrdId:this.$route.query.productId,functionId:this.prop_functionId,jsonArrayInfo:this.result}}).then(()=>{this.closeHandler(),this.father.$props.reloadHandler&&this.father.$props.reloadHandler(),this.reloadHandler()})},closeHandler(){this.$emit("update:modelValue",!1)}}}),U={style:{"font-size":"14px"}},P={key:1,style:{"text-align":"center",color:"rgb(144, 147, 153)",margin:"30px"}},S={slot:"footer",style:{"text-align":"center"}};function T(e,t,o,r,x,Q){const I=z,b=N,k=H,_=B,L=q,F=j,V=A;return e.showFlag?(l(),s(F,{key:0,title:`根据字段${e.father.fatherInfo.authReferFieldName||e.father.functionInfo.authReferFieldName}的取值配置子功能的可用情形：`,modelValue:e.showFlag,"onUpdate:modelValue":t[0]||(t[0]=a=>e.showFlag=a),width:e.headList.length?(e.headList.length+1)*150+"px":"600px",onClose:e.closeHandler,"append-to-body":""},{default:n(()=>[D((l(),s(_,{ref:"mainForm","label-width":"auto","label-position":"right",model:e.mainForm},{default:n(()=>[e.configList.length>0?(l(),s(k,{key:0},{default:n(()=>[i("header",{style:f({display:"grid","grid-template-columns":`repeat(${e.headList.length+1}, 1fr)`})},[t[1]||(t[1]=i("span",null,"子功能\\字段值",-1)),(l(!0),d(u,null,p(e.headList,a=>(l(),d("span",{key:a.dictId},h(a.dictLabel),1))),128))],4),i("div",null,[(l(!0),d(u,null,p(e.configList,a=>(l(),s(b,{key:a.operationId,modelValue:e.checkMap[a.operationId],"onUpdate:modelValue":c=>e.checkMap[a.operationId]=c,style:f({display:"grid","grid-template-columns":`repeat(${e.headList.length+1}, 1fr)`})},{default:n(()=>[i("span",U,h(a.subfunctionName),1),(l(!0),d(u,null,p(a.dictList,c=>(l(),s(I,{key:c.dictId,label:c.dictId},{default:n(()=>[...t[2]||(t[2]=[g(h(null),-1)])]),_:1},8,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","style"]))),128))])]),_:1})):(l(),d("div",P,"暂无可配置信息"))]),_:1},8,["model"])),[[V,e.loading]]),i("aside",S,[M(L,{type:"primary",onClick:e.submitForm},{default:n(()=>[...t[3]||(t[3]=[g("提交",-1)])]),_:1},8,["onClick"])])]),_:1},8,["title","modelValue","width","onClose"])):v("",!0)}const Z=C(O,[["render",T]]);export{Z as E};
