import{_ as $}from"./index-sxX6oYqj.js";/* empty css                   *//* empty css                  *//* empty css                     *//* empty css                        */import"./el-checkbox-group-XJ3liq4A.js";import{r as h}from"./request-yGlVfSRy.js";import{D as w}from"./Data_Table-8GrTVIee.js";import{d as C}from"./view_base_options-B9MEmwMX.js";import{d as E,V as n,Y as D,N as l,W as i,X as M,O as s,M as d,ad as c,a0 as u,Q as f,a1 as v,_ as g,$ as m}from"./vue-ChXMuCsz.js";import{x as N,i as B,j as H,k as z,d as A,W as O,O as j}from"./element-plus-xvP3-5Ws.js";function y(){return{loading:!0,mainForm:{},checkMap:{},configList:[],headList:[],result:[],showFlag:!1}}const q=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:w},watch:{modelValue(e){this.showFlag=e},showFlag(e){e?this.loadData():Object.assign(this.$data,y())}},methods:{loadData(){this.loading=!0,h({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=C(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)});h({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)}}}),x={style:{"font-size":"14px"}},S={key:1,style:{"text-align":"center",color:"rgb(144, 147, 153)",margin:"30px"}},T={slot:"footer",style:{"text-align":"center"}};function U(e,t,o,r,P,R){const I=j,k=O,b=H,_=B,L=z,F=A,V=N;return e.showFlag?(l(),n(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:i(()=>[M((l(),n(_,{ref:"mainForm","label-width":"auto","label-position":"right",model:e.mainForm},{default:i(()=>[e.configList.length>0?(l(),n(b,{key:0},{default:i(()=>[s("header",{style:f({display:"grid","grid-template-columns":`repeat(${e.headList.length+1}, 1fr)`})},[t[1]||(t[1]=s("span",null,"子功能\\字段值",-1)),(l(!0),d(u,null,c(e.headList,a=>(l(),d("span",{key:a.dictId},m(a.dictLabel),1))),128))],4),s("div",null,[(l(!0),d(u,null,c(e.configList,a=>(l(),n(k,{key:a.operationId,modelValue:e.checkMap[a.operationId],"onUpdate:modelValue":p=>e.checkMap[a.operationId]=p,style:f({display:"grid","grid-template-columns":`repeat(${e.headList.length+1}, 1fr)`})},{default:i(()=>[s("span",x,m(a.subfunctionName),1),(l(!0),d(u,null,c(a.dictList,p=>(l(),n(I,{key:p.dictId,label:p.dictId},{default:i(()=>[...t[2]||(t[2]=[g(m(null),-1)])]),_:1},8,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","style"]))),128))])]),_:1})):(l(),d("div",S,"暂无可配置信息"))]),_:1},8,["model"])),[[V,e.loading]]),s("aside",T,[v(L,{type:"primary",onClick:e.submitForm},{default:i(()=>[...t[3]||(t[3]=[g("提交",-1)])]),_:1},8,["onClick"])])]),_:1},8,["title","modelValue","width","onClose"])):D("",!0)}const ae=$(q,[["render",U]]);export{ae as E};
