import{C as e,O as t,S as n,T as r,Y as i,Z as a,cn as o,dt as s,ft as c,g as l,in as u,j as d,k as f,w as p}from"./vue.runtime.esm-bundler-DpGzKKN4.js";import"./GxPagination-DOexUzbO.js";import{a as m,r as h}from"./table-C_Bpc8FZ.js";import{n as g,t as _}from"./form-Bb1_iOEA.js";import{t as v}from"./button-CHjzS7b0.js";import{t as y}from"./dialog-BLJqz3g4.js";import{t as b}from"./directive-9SA1IQHd.js";import{t as x}from"./_plugin-vue_export-helper-CnS4QQza.js";import"./css-DxP8XCTD.js";import"./css-CW_FwBqc2.js";import"./css-j23UczC-.js";import"./css-DunA3L7q.js";import{n as S}from"./request-CWxGgYu0.js";import"./css-DREb2J8s.js";import"./css-BrGVMe3H.js";import{t as C}from"./Data_Table-Do6EiT1s.js";import{x as w}from"./view_base_options-B9YSRjyH.js";function T(){return{loading:!0,mainForm:{},checkMap:{},configList:[],headList:[],result:[],showFlag:!1}}var E=d({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(d,x,S,C,w,T){let E=h,A=m,j=g,M=_,N=v,P=y,F=b;return d.showFlag?(i(),e(P,{key:0,title:`根据字段${d.father.fatherInfo.authReferFieldName||d.father.functionInfo.authReferFieldName}的取值配置子功能的可用情形：`,modelValue:d.showFlag,"onUpdate:modelValue":x[0]||=e=>d.showFlag=e,width:d.headList.length?(d.headList.length+1)*150+`px`:`600px`,onClose:d.closeHandler,"append-to-body":``},{default:s(()=>[c((i(),e(M,{ref:`mainForm`,"label-width":`auto`,"label-position":`right`,model:d.mainForm},{default:s(()=>[d.configList.length>0?(i(),e(j,{key:0},{default:s(()=>[n(`header`,{style:u({display:`grid`,"grid-template-columns":`repeat(${d.headList.length+1}, 1fr)`})},[x[1]||=n(`span`,null,`子功能\\字段值`,-1),(i(!0),r(l,null,a(d.headList,e=>(i(),r(`span`,{key:e.dictId},o(e.dictLabel),1))),128))],4),n(`div`,null,[(i(!0),r(l,null,a(d.configList,c=>(i(),e(A,{key:c.operationId,modelValue:d.checkMap[c.operationId],"onUpdate:modelValue":e=>d.checkMap[c.operationId]=e,style:u({display:`grid`,"grid-template-columns":`repeat(${d.headList.length+1}, 1fr)`})},{default:s(()=>[n(`span`,D,o(c.subfunctionName),1),(i(!0),r(l,null,a(c.dictList,n=>(i(),e(E,{key:n.dictId,label:n.dictId},{default:s(()=>[...x[2]||=[t(o(null),-1)]]),_:1},8,[`label`]))),128))]),_:2},1032,[`modelValue`,`onUpdate:modelValue`,`style`]))),128))])]),_:1})):(i(),r(`div`,O,`暂无可配置信息`))]),_:1},8,[`model`])),[[F,d.loading]]),n(`aside`,k,[f(N,{type:`primary`,onClick:d.submitForm},{default:s(()=>[...x[3]||=[t(`提交`,-1)]]),_:1},8,[`onClick`])])]),_:1},8,[`title`,`modelValue`,`width`,`onClose`])):p(``,!0)}var j=x(E,[[`render`,A]]);export{j as t};