import{a3 as p,a4 as f,a5 as u}from"./index.DLhCD1Qz.js";import{_}from"./yb_admin_plugin.DNFUAscl.js";import{aZ as i,aL as g,s as c,bJ as s,I as o,v as h}from"./@vue.Da0bZ210.js";import"./vue.Bj6dTZYa.js";import"./@element-plus.pQhr8KT1.js";import"./echarts.Dms41JYJ.js";import"./tslib.BDyQ-Jie.js";import"./zrender.BueMfJu3.js";import"./axios.BjtuyMK1.js";import"./pinia.Tngw-S_5.js";import"./vue-router.DaVMGKLh.js";import"./element-plus.DC208N5p.js";import"./lodash-es.DVGGNlzX.js";import"./@vueuse.BhH-hw9p.js";import"./async-validator.9PlIezaS.js";import"./@popperjs.C5az9QE8.js";import"./@ctrl.C4Rzlq_k.js";import"./dayjs.BLMYetss.js";import"./memoize-one.BdPwpGay.js";import"./normalize-wheel-es.BQoi3Ox2.js";import"./@floating-ui.DCXYYTka.js";import"./vue-i18n.C7BagGww.js";import"./@intlify.TnaUIxGf.js";import"./moment.C5S46NFB.js";const b={title:"编辑",name:"AiServicesAgentAdd",props:{edit:{type:Object,default:()=>({id:0})}},data(){return{activeName:"first",classes:[],platforms:[],rulesOptions:[],images_arr:[],formData:{formItems:[],scene:"design"},form:{name:"",class_id:"",platform_id:"",result_time:"",description:"",agent_id:"",agent_type:"application",api_type:"workflow",workflow_id:"",rules_id:"",deduct_num:1,is_vip_free:0,is_recommend:0,status:1,images:"",setting:{}},rules:{name:[{required:!0,message:"智能体名称不能为空",trigger:"blur"}],class_id:[{required:!0,message:"分类不能为空",trigger:"blur"}],platform_id:[{required:!0,message:"平台不能为空",trigger:"blur"}],workflow_id:[{required:!0,message:"工作流ID不能为空",trigger:"blur"}],rules_id:[{required:!0,message:"规则不能为空",trigger:"blur"}],deduct_num:[{required:!0,message:"扣除点数不能为空",trigger:"blur"}]}}},created(){this.edit.id&&u(this.edit.id).then(r=>{let e=r.data.info;this.images_arr=e.images||[],this.formData=e.setting.form_data||{formItems:[],scene:"design"},delete e.images,this.form={...this.form,...e}})},methods:{handleForm(r){r.forEach(e=>{e.formType||(e.formType=e.tagIcon)}),this.formData.formItems=r},onSubmit(){this.images_arr.length>0&&(this.form.images=JSON.stringify(this.images_arr)),this.form.setting=JSON.stringify({form_data:this.formData}),this.$refs.form.validate(async r=>{if(r)(this.edit.id?p:f)(this.form).then(m=>{this.$baseMessage("保存成功"),this.callBack&&this.callBack()});else return!1})}}};function y(r,e,m,w,t,k){const a=i("el-input-number"),d=i("el-form-item"),l=i("el-form");return g(),c(l,{ref:"form",model:t.form,rules:t.rules,"label-width":"100px"},{default:s(()=>[o(d,{label:"扣除点数",prop:"deduct_num"},{default:s(()=>[o(a,{style:{margin:"0 6px"},modelValue:t.form.deduct_num,"onUpdate:modelValue":e[0]||(e[0]=n=>t.form.deduct_num=n),min:0},null,8,["modelValue"]),e[1]||(e[1]=h("span",null,"点",-1))]),_:1})]),_:1},8,["model","rules"])}const H=_(b,[["render",y],["__scopeId","data-v-f5a69858"]]);export{H as default};
