import{B as e,C as t,O as n,R as r,S as i,St as a,T as o,Y as s,Z as c,at as l,bt as u,ct as d,dt as f,ft as p,g as m,in as h,j as g,k as _,wt as v,x as y}from"./vue.runtime.esm-bundler-DpGzKKN4.js";import{i as b,o as x}from"./GxPagination-DOexUzbO.js";import{m as S}from"./vnode-DU8g6Rf7.js";import{n as C,t as w}from"./form-Bb1_iOEA.js";import{p as T}from"./upload-CxV36kXa.js";import{t as ee}from"./button-CHjzS7b0.js";import{t as E}from"./dialog-BLJqz3g4.js";import{t as D}from"./directive-9SA1IQHd.js";import{t as O}from"./_plugin-vue_export-helper-CnS4QQza.js";import"./css-DxP8XCTD.js";import{bt as k,pn as A,sn as j}from"./stores-BWYw2E2w.js";import"./css-CW_FwBqc2.js";import"./css-j23UczC-.js";import{n as M}from"./validate-CTyV86Nm.js";import"./css-DunA3L7q.js";import{u as N}from"./uiController-DpxB3sua.js";var P={class:``,style:{}},F={key:0,class:`flex flex-row justify-center flex-nowrap w-full`},I={key:1,class:`flex flex-row justify-start flex-nowrap w-full`},L={style:{"text-align":`center`}},R=O(g({__name:`EditControllerThemeVariableDialog`,props:r({type:{},zxlPrdId:{},row:{},variableType:{},themeObId:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:r([`update-list`],[`update:visible`]),setup(r,{emit:g}){let O=k();a(!1);let R=r,z=y(()=>O.predefineHistoryColors),B=y(()=>R.type===`add`),V=y(()=>R.type===`edit`);y(()=>R.type===`view`);let H=y(()=>R.variableType===3),U=y(()=>R.variableType===2),W=y(()=>`${B.value?`新增`:`${V.value?`修改`:`查看`} ${R.row?.variableName||``} `}控件变量`),G=l(r,`visible`),K=g,q=a(),J=u({variableName:``,variableValue:``}),Y=a(!1),X=u({variableName:[M.requireChange,M.nonNullStr],variableValue:[M.requireChange,M.nonNullStr]}),Z=async t=>{let n=R.row;await e(),!(B.value||!n)&&Object.keys(J).forEach(e=>{J[e]=n[e]})},Q=async()=>{if(!await q.value?.validate())return;let e=R.zxlPrdId,t=R?.themeObId,n=R.variableType,r=R.row?.themeVariableObId;Y.value=!0;try{let{variableName:i,variableValue:a}=J,o={themeVariableObId:r,themeObId:t,variableName:i,variableType:n,variableValue:a,zxlPrdId:e};r?await A(o):(delete o.themeVariableObId,await j(o)),K(`update-list`),G.value=!1}catch{}Y.value=!1},te=()=>{q.value?.resetFields()},$=v([]),ne=async()=>{if(!$.value.length)try{$.value=await N(`17dc843d-37c4-4bed-b7a8-b9ba01943ece`)||[]}catch{}};return d(G,e=>{e&&(Z(),ne())},{immediate:!0}),(e,r)=>{let a=S,l=C,u=T,d=b,g=x,v=w,y=ee,O=E,k=D;return s(),t(O,{class:`edit-controller-theme-variable-dialog adap-sm-radius`,modelValue:G.value,"onUpdate:modelValue":r[5]||=e=>G.value=e,onClose:te,title:W.value,"append-to-body":!0,width:600,closeOnClickModal:!1,closeOnPressEscape:!1},{default:f(()=>[p((s(),o(`div`,P,[_(v,{rules:X,ref_key:`formRef`,ref:q,model:J,"label-width":`auto`,labelPosition:`left`},{default:f(()=>[_(l,{label:`变量名称`,prop:`variableName`},{default:f(()=>[_(a,{modelValue:J.variableName,"onUpdate:modelValue":r[0]||=e=>J.variableName=e,placeholder:`请输入`},null,8,[`modelValue`])]),_:1}),_(l,{label:`变量值`,prop:`variableValue`},{default:f(()=>[U.value?(s(),o(`div`,F,[_(a,{class:`flex-grow mr-1`,modelValue:J.variableValue,"onUpdate:modelValue":r[1]||=e=>J.variableValue=e,clearable:``},null,8,[`modelValue`]),_(u,{modelValue:J.variableValue,"onUpdate:modelValue":r[2]||=e=>J.variableValue=e,clearable:``,"show-alpha":``,predefine:z.value},null,8,[`modelValue`,`predefine`])])):H.value?(s(),o(`div`,I,[_(g,{modelValue:J.variableValue,"onUpdate:modelValue":r[3]||=e=>J.variableValue=e,clearable:``},{default:f(()=>[(s(!0),o(m,null,c($.value,e=>(s(),t(d,{label:`${e.enumName}${e.remark?`(`+e.remark+`)`:``}`,key:e.id,value:e.enumValue,style:h(`font-family: ${e.enumValue};`)},null,8,[`label`,`value`,`style`]))),128))]),_:1},8,[`modelValue`])])):(s(),t(a,{key:2,modelValue:J.variableValue,"onUpdate:modelValue":r[4]||=e=>J.variableValue=e,placeholder:`请输入`},null,8,[`modelValue`]))]),_:1})]),_:1},8,[`rules`,`model`]),i(`div`,L,[_(y,{onClick:Q,type:`primary`,loading:Y.value},{default:f(()=>[...r[6]||=[n(`确定`,-1)]]),_:1},8,[`loading`])])])),[[k,Y.value]])]),_:1},8,[`modelValue`,`title`])}}}),[[`__scopeId`,`data-v-5dac92fa`]]);export{R as t};