import{d as u,s as y,k as v,l as B,r as j,o as D,x as P,b as s,a as c,X as E,z as L,a0 as S,u as l}from"./vue.1703796278973.js";import{Z as k,r as x}from"./index.17037962789732.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import"./index.170379627897320.js";import"./index.170379627897315.js";import"./index.170379627897321.js";import{u as C}from"./scene.1703796278973.js";import{_ as F}from"./ParamsItem.vue_vue_type_script_setup_true_name_ParamsItem_lang.17037962789732.js";import"./utils.1703796278973.js";import{i as _}from"./isArray.1703796278973.js";const g={class:"terms-params-delete"},A=u({name:"TermsItem"}),Z=u({...A,props:{isFirst:{type:Boolean,default:!0},isLast:{type:Boolean,default:!0},showDeleteBtn:{type:Boolean,default:!0},data:{type:Object,default:()=>({when:[],shakeLimit:{},then:[]})},class:{type:String,default:""},name:{type:Number,default:0},branchName:{type:Number,default:0},whenName:{type:Number,default:0}},setup(t){const r=t,h=C(),{data:n}=y(h),f=[{validator:async(o,e)=>{var a;if(e!==void 0&&!e.error){if(!Object.keys(e).length)return Promise.reject(new Error("该数据已发生变更，请重新配置"));if(!e.column)return Promise.reject(new Error("请选择参数"));if(!e.termType)return Promise.reject(new Error("请选择操作符"));if(((a=e.value)==null?void 0:a.value)===void 0)return Promise.reject(new Error("请选择或输入参数值"));if(_(e.value.value)&&e.value.value.some(i=>i===void 0))return Promise.reject(new Error("请选择或输入参数值"))}else return e!=null&&e.error?Promise.reject(new Error("该数据已发生变更，请重新配置")):Promise.reject(new Error("请选择参数"));return Promise.resolve()}}],m=v(!1);B(()=>r.data.terms);const w=()=>{r.showDeleteBtn&&(m.value=!0)},d=()=>{r.showDeleteBtn&&(m.value=!1)},N=()=>{var o,e,a;(a=(e=(o=n.value.branches)==null?void 0:o[r.branchName])==null?void 0:e.when)==null||a.splice(r.whenName,1),n.value.options.when[r.branchName].terms.splice(r.whenName,1)};return(o,e)=>{const a=j("AIcon"),i=k,p=x;return D(),P("div",{class:"terms-params-content",onMouseover:w,onMouseout:d},[s(i,{title:"确认删除？",overlayStyle:{minWidth:"180px"},onConfirm:N},{default:c(()=>[E(L("div",g,[s(a,{type:"CloseOutlined"})],512),[[S,l(m)]])]),_:1}),s(p,{name:["branches",t.branchName,"when",t.whenName,"terms",r.name],rules:f},{default:c(()=>[s(F,{value:l(n).branches[t.branchName].when[t.whenName].terms[r.name],"onUpdate:value":e[0]||(e[0]=b=>l(n).branches[t.branchName].when[t.whenName].terms[r.name]=b),isFirst:t.isFirst,isLast:t.isLast,showDeleteBtn:t.showDeleteBtn,termsName:t.name,whenName:t.whenName,branchName:t.branchName},null,8,["value","isFirst","isLast","showDeleteBtn","termsName","whenName","branchName"])]),_:1},8,["name"])],32)}}});export{Z as _};
