import{u as e,a,r as l,b as t,cK as s,d as o,e as r,f as d,h as i,w as u,g as m,j as n,k as p,i as c,n as f,E as v,q as b}from"./index.286e9b79.js";import{v as g}from"./loading.c49775a6.js";import{E as j,a as h}from"./form.ad10dcd5.js";import{E as _,a as V}from"./tab-pane.1cc0f769.js";import{E as x}from"./switch.197584d0.js";import"./form-item.9355e6dc.js";import{E as w}from"./input.31de1b37.js";import{_ as y}from"./page-header.29890ed0.js";import{g as k,p as q}from"./http.f588794f.js";import"./_initCloneObject.fb8fbaea.js";import"./strings.8c60bfae.js";import"./event.776e7e11.js";import"./validator.18338d56.js";import"./index.ed3ed02e.js";import"./divider.948c4b18.js";const E={class:"card goods-wrap"},C={class:"editor-card"},U={class:"editor-card-box"},F={class:"tool"},K={class:"tool-box"},M={__name:"editor",setup(M){const N=e(),O=a().query.id;let R=l(!1),T=l(!1),z=l(0),A=l();const B=(e,a)=>{z.value=e.paneName};let D=t({data:{name:"",sort:0,status:1,id:0}});R.value=!0,k("users.group/editor",{id:O}).then((e=>{R.value=!1,e.code&&!s(e.data)&&(D.data=e.data)}));const G=t({name:[{required:!0,message:"请输入分组名称",trigger:"blur"}],sort:[{required:!0,message:"请输入排序值",trigger:"blur"}]}),H=async()=>{A.value&&await A.value.validate(((e,a)=>{T.value=!1,e?(T.value=!0,q("users.group/editor",D.data).then((e=>{T.value=!1,e.code?(A.value.resetFields(),N.replace("/group/index"),v.success("编辑成功")):v.error(e.msg)})).catch((e=>{v.error(e)}))):v.error("请完善内容")}))},I=()=>{N.go(-1)};return(e,a)=>{const l=y,t=w,s=j,v=x,k=_,q=V,M=h,N=b,O=g;return o(),r("div",E,[d(l,{title:"编辑分组"}),i("div",C,[u((o(),n(M,{model:m(D).data,rules:m(G),ref_key:"ruleFormRef",ref:A},{default:p((()=>[i("div",U,[d(q,{modelValue:m(z),"onUpdate:modelValue":a[3]||(a[3]=e=>c(z)?z.value=e:z=e),onTabClick:B},{default:p((()=>[d(k,{label:"基本信息",name:0},{default:p((()=>[d(s,{label:"分组名称",prop:"name","label-width":"100px"},{default:p((()=>[d(t,{modelValue:m(D).data.name,"onUpdate:modelValue":a[0]||(a[0]=e=>m(D).data.name=e),"show-word-limit":"",maxlength:"15",placeholder:"请输入分组名称"},null,8,["modelValue"])])),_:1}),d(s,{label:"排序",prop:"sort","label-width":"100px"},{default:p((()=>[d(t,{type:"number",modelValue:m(D).data.sort,"onUpdate:modelValue":a[1]||(a[1]=e=>m(D).data.sort=e),modelModifiers:{number:!0},oninput:"if(value.length > 3) value=value.slice(0, 3)"},null,8,["modelValue"])])),_:1}),d(s,{label:"状态",required:!0,"label-width":"100px"},{default:p((()=>[d(v,{modelValue:m(D).data.status,"onUpdate:modelValue":a[2]||(a[2]=e=>m(D).data.status=e),"active-value":1,"inactive-value":0},null,8,["modelValue"])])),_:1})])),_:1})])),_:1},8,["modelValue"])])])),_:1},8,["model","rules"])),[[O,m(R)]])]),i("div",F,[i("div",K,[d(N,{onClick:I},{default:p((()=>[f("取消")])),_:1}),d(N,{type:"primary",loading:m(T),onClick:H},{default:p((()=>[f("保存")])),_:1},8,["loading"])])])])}}};export{M as default};
