import{F as B,G as j,h as g}from"./elementPlus.CSBdF9Zt.js";import{u as q}from"./useResponse.DqThFJSa.js";import{a as z}from"./api.DDtP7LcA.js";import{d as G,aJ as b,r as V,aK as I,aI as J,Z as k,ai as s,o as K,M as L,O as o,U as a,S as v,u as l}from"./vue.1RczIYhx.js";const h=G({__name:"CreateLabelDialog",props:b({rowData:Object},{modelValue:{default:!1},modelModifiers:{}}),emits:b(["refresh"],["update:modelValue"]),setup(c,{emit:x}){const y=c,{rowData:C}=y,f=V(!1),u=I(c,"modelValue"),p=J("createDialog"),D=x,m=V(),t=k({raw_label:"",kind:""}),F=k({raw_label:[{required:!0,message:"请输入原始标签",trigger:"blur"}]}),R=async r=>{r&&await r.validate(async(e,d)=>{if(e){const i={review:C.id,raw_label:t.raw_label,kind:t.kind};(await q(z,i,f)).code===2e3&&(g.success({message:"创建成功",plain:!0,icon:"CirclePlus"}),u.value=!1,D("refresh"))}else g.error("创建失败，请检查表单")})};function M(){U(m.value),p.value.visible=!1}const U=r=>{r&&r.resetFields()};return(r,e)=>{const d=s("el-input"),i=s("el-form-item"),_=s("el-col"),N=s("el-row"),O=s("el-form"),w=s("el-button"),T=s("el-dialog");return K(),L(T,{ref_key:"createDialog",ref:p,modelValue:u.value,"onUpdate:modelValue":e[3]||(e[3]=n=>u.value=n),"close-on-click-modal":!1,"close-on-press-escape":!1,title:"负面标签 - 创建 ",style:{width:"35%"}},{footer:o(()=>[a(w,{icon:l(B),onClick:M},{default:o(()=>e[4]||(e[4]=[v("取 消")])),_:1},8,["icon"]),a(w,{icon:l(j),loading:l(f),type:"primary",onClick:e[2]||(e[2]=n=>R(l(m)))},{default:o(()=>e[5]||(e[5]=[v("确 定")])),_:1},8,["icon","loading"])]),default:o(()=>[a(O,{ref_key:"ruleFormRef",ref:m,model:l(t),rules:l(F),class:"mx-2.5 mt-5","label-width":"auto","status-icon":""},{default:o(()=>[a(N,{gutter:20},{default:o(()=>[a(_,{span:24},{default:o(()=>[a(i,{class:"font-medium",label:"原始标签",prop:"raw_label"},{default:o(()=>[a(d,{modelValue:l(t).raw_label,"onUpdate:modelValue":e[0]||(e[0]=n=>l(t).raw_label=n),type:"textarea",maxlength:"150","show-word-limit":"",autosize:{minRows:2,maxRows:4}},null,8,["modelValue"])]),_:1}),a(i,{class:"font-medium",label:"类别",prop:"kind"},{default:o(()=>[a(d,{modelValue:l(t).kind,"onUpdate:modelValue":e[1]||(e[1]=n=>l(t).kind=n),type:"textarea",maxlength:"150","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])}}});export{h as _};
