import{A as e,C as t,E as n,M as r,Q as i,T as a,X as o,_ as s,cn as c,dt as l,ft as u,in as d,k as f,t as p,w as m}from"./_plugin-vue_export-helper-9JxOV_6y.js";import{b as h,v as g}from"./GxPagination-1gJXbpdv.js";import{n as _,t as v}from"./form-CR2ksibI.js";import{t as y}from"./button-CENWFHkZ.js";import{t as b}from"./dialog-CTuQSeYb.js";import{t as x}from"./directive-CkUp73VW.js";import{n as S}from"./request-D0ipHUJ7.js";import{t as C}from"./Data_Table-CO0OwwxJ.js";import{x as w}from"./view_base_options-tpLT5NKN.js";function T(){return{loading:!0,mainForm:{},checkMap:{},configList:[],headList:[],result:[],showFlag:!1}}var E=r({name:`enable-op-config`,model:{prop:`showFlag`,event:`toggle`},data:T,props:{modelValue:{type:Boolean,default:!1},prop_functionId:String,reloadHandler:{type:Function,default:()=>{}},father:{type:Object,default:()=>({})}},computed:{},components:{DataTable:C},watch:{modelValue(e){this.showFlag=e},showFlag(e){e?this.loadData():Object.assign(this.$data,T())}},methods:{loadData(){this.loading=!0,S({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(e=>({dictId:e.dictId,dictLabel:e.dictLabel})));let t={};e.forEach(e=>{t[e.operationId]=e.dictList.filter(e=>e.selected===!0).map(e=>e.dictId)||[]}),this.checkMap=t,this.$nextTick(()=>{console.log(`this.checkMap`,this.checkMap)})}).finally(()=>this.loading=!1)},submitForm(){for(let[e,t]of Object.entries(this.checkMap))this.result.find(t=>t.operationId==e).dictList.forEach(e=>{e.selected=t.includes(e.dictId)});S({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)}}}),D={style:{"font-size":`14px`}},O={key:1,style:{"text-align":`center`,color:`rgb(144, 147, 153)`,margin:`30px`}},k={slot:`footer`,style:{"text-align":`center`}};function A(r,p,S,C,w,T){let E=g,A=h,j=_,M=v,N=y,P=b,F=x;return r.showFlag?(o(),m(P,{key:0,title:`根据字段${r.father.fatherInfo.authReferFieldName||r.father.functionInfo.authReferFieldName}的取值配置子功能的可用情形：`,modelValue:r.showFlag,"onUpdate:modelValue":p[0]||=e=>r.showFlag=e,width:r.headList.length?(r.headList.length+1)*150+`px`:`600px`,onClose:r.closeHandler,"append-to-body":``},{default:l(()=>[u((o(),m(M,{ref:`mainForm`,"label-width":`auto`,"label-position":`right`,model:r.mainForm},{default:l(()=>[r.configList.length>0?(o(),m(j,{key:0},{default:l(()=>[t(`header`,{style:d({display:`grid`,"grid-template-columns":`repeat(${r.headList.length+1}, 1fr)`})},[p[1]||=t(`span`,null,`子功能\\字段值`,-1),(o(!0),n(s,null,i(r.headList,e=>(o(),n(`span`,{key:e.dictId},c(e.dictLabel),1))),128))],4),t(`div`,null,[(o(!0),n(s,null,i(r.configList,e=>(o(),m(A,{key:e.operationId,modelValue:r.checkMap[e.operationId],"onUpdate:modelValue":t=>r.checkMap[e.operationId]=t,style:d({display:`grid`,"grid-template-columns":`repeat(${r.headList.length+1}, 1fr)`})},{default:l(()=>[t(`span`,D,c(e.subfunctionName),1),(o(!0),n(s,null,i(e.dictList,e=>(o(),m(E,{key:e.dictId,label:e.dictId},{default:l(()=>[...p[2]||=[f(c(null),-1)]]),_:1},8,[`label`]))),128))]),_:2},1032,[`modelValue`,`onUpdate:modelValue`,`style`]))),128))])]),_:1})):(o(),n(`div`,O,`暂无可配置信息`))]),_:1},8,[`model`])),[[F,r.loading]]),t(`aside`,k,[e(N,{type:`primary`,onClick:r.submitForm},{default:l(()=>[...p[3]||=[f(`提交`,-1)]]),_:1},8,[`onClick`])])]),_:1},8,[`title`,`modelValue`,`width`,`onClose`])):a(``,!0)}var j=p(E,[[`render`,A]]);export{j as t};