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,mn as p,t as m,w as h}from"./_plugin-vue_export-helper-C0lsYS1a.js";import{b as g,v as _}from"./GxPagination-DaT0MOF0.js";import{n as v,t as y}from"./form-B9CYF2OU.js";import{t as b}from"./button-CTBy3KbX.js";import{t as x}from"./dialog-C-zlcBiu.js";import{t as S}from"./directive-2hBfY9mU.js";import{n as C}from"./request-B9wfR4zJ.js";import{t as w}from"./Data_Table-D3M72EzC.js";import{x as T}from"./view_base_options-c2kiHw0P.js";function E(){return{loading:!0,mainForm:{},checkMap:{},configList:[],headList:[],result:[],showFlag:!1}}var D=r({name:`enable-op-config`,model:{prop:`showFlag`,event:`toggle`},data:E,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,E())}},methods:{loadData(){this.loading=!0,C({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=T(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)});C({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)}}}),O={style:{"font-size":`14px`}},k={key:1,style:{"text-align":`center`,color:`rgb(144, 147, 153)`,margin:`30px`}},A={slot:`footer`,style:{"text-align":`center`}};function j(r,p,m,C,w,T){let E=_,D=g,j=v,M=y,N=b,P=x,F=S;return r.showFlag?(o(),h(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(),h(M,{ref:`mainForm`,"label-width":`auto`,"label-position":`right`,model:r.mainForm},{default:l(()=>[r.configList.length>0?(o(),h(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(),h(D,{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`,O,c(e.subfunctionName),1),(o(!0),n(s,null,i(e.dictList,e=>(o(),h(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`,k,`暂无可配置信息`))]),_:1},8,[`model`])),[[F,r.loading]]),t(`aside`,A,[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 M=m(D,[[`render`,j]]);export{M as t};