import{d as L,L as U,h as f,Y as h,r as n,o as r,f as s,w as t,b as u,H as i,c as x,e as T,F as I,a2 as q,l as V,E as P}from"./index.e3896b23.js";import{b as S,c as $,e as R}from"./dataStandard.4ca18653.js";const H=V("\u53D6\u6D88"),K=V("\u786E\u5B9A"),z=L({__name:"standard-edit",emits:["refreshDataList"],setup(M,{expose:C,emit:E}){U(()=>{S().then(o=>{y.value=o.data})});const p=f(!1),b=f(),e=h({engName:"",cnName:"",type:"",dataType:"",dataLength:0,dataPrecision:0,nullable:"",note:"",standardCodeId:""}),y=f([]),A=(o,l,m)=>{p.value=!0,e.id="",b.value&&b.value.resetFields(),e.type=l,e.categoryId=m,o&&B(o)},B=o=>{$(o).then(l=>{Object.assign(e,l.data)})},D=f({engName:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],cnName:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],type:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],dataType:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],nullable:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),F=()=>{b.value.validate(o=>{if(!o)return!1;e.type==2&&(e.codeNum=e.codeNum?e.codeNum:0,e.dataType=null,e.dataLength=null,e.dataPrecision=null,e.nullable=null,e.standardCodeId=null),R(e).then(()=>{P.success({message:"\u64CD\u4F5C\u6210\u529F",duration:500,onClose:()=>{p.value=!1,E("refreshDataList")}})})})};return C({init:A}),(o,l)=>{const m=n("el-input"),d=n("el-form-item"),c=n("fast-select"),_=n("el-input-number"),v=n("el-option"),N=n("el-select"),w=n("el-form"),g=n("el-button"),k=n("el-dialog");return r(),s(k,{modelValue:p.value,"onUpdate:modelValue":l[12]||(l[12]=a=>p.value=a),title:e.id?"\u4FEE\u6539":"\u65B0\u589E","close-on-click-modal":!1},{footer:t(()=>[u(g,{onClick:l[10]||(l[10]=a=>p.value=!1)},{default:t(()=>[H]),_:1}),u(g,{type:"primary",onClick:l[11]||(l[11]=a=>F())},{default:t(()=>[K]),_:1})]),default:t(()=>[u(w,{ref_key:"dataFormRef",ref:b,model:e,rules:D.value,"label-width":"100px",onKeyup:l[9]||(l[9]=q(a=>F(),["enter"]))},{default:t(()=>[u(d,{label:"\u82F1\u6587\u540D\u79F0",prop:"engName","label-width":"auto"},{default:t(()=>[u(m,{modelValue:e.engName,"onUpdate:modelValue":l[0]||(l[0]=a=>e.engName=a),placeholder:"\u82F1\u6587\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(d,{label:"\u4E2D\u6587\u540D\u79F0",prop:"cnName","label-width":"auto"},{default:t(()=>[u(m,{modelValue:e.cnName,"onUpdate:modelValue":l[1]||(l[1]=a=>e.cnName=a),placeholder:"\u4E2D\u6587\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(d,{label:"\u6807\u51C6\u7C7B\u578B",prop:"type","label-width":"auto"},{default:t(()=>[u(c,{modelValue:e.type,"onUpdate:modelValue":l[2]||(l[2]=a=>e.type=a),disabled:"","dict-type":"standard_type",placeholder:"\u6807\u51C6\u7C7B\u578B",clearable:""},null,8,["modelValue"])]),_:1}),e.type==1?(r(),s(d,{key:0,label:"\u6570\u636E\u7C7B\u578B",prop:"dataType","label-width":"auto"},{default:t(()=>[u(c,{modelValue:e.dataType,"onUpdate:modelValue":l[3]||(l[3]=a=>e.dataType=a),"dict-type":"standard_data_type",placeholder:"\u6570\u636E\u7C7B\u578B",clearable:""},null,8,["modelValue"])]),_:1})):i("",!0),e.type==1?(r(),s(d,{key:1,label:"\u957F\u5EA6",prop:"dataLength","label-width":"auto"},{default:t(()=>[u(_,{modelValue:e.dataLength,"onUpdate:modelValue":l[4]||(l[4]=a=>e.dataLength=a),max:9999999,placeholder:"\u957F\u5EA6",clearable:""},null,8,["modelValue"])]),_:1})):i("",!0),e.type==1?(r(),s(d,{key:2,label:"\u7CBE\u5EA6(\u5C0F\u6570\u4F4D\u6570)",prop:"dataPrecision","label-width":"auto"},{default:t(()=>[u(_,{modelValue:e.dataPrecision,"onUpdate:modelValue":l[5]||(l[5]=a=>e.dataPrecision=a),max:10,placeholder:"\u7CBE\u5EA6",clearable:""},null,8,["modelValue"])]),_:1})):i("",!0),e.type==1?(r(),s(d,{key:3,label:"\u5141\u8BB8\u4E3A\u7A7A",prop:"nullable","label-width":"auto"},{default:t(()=>[u(c,{modelValue:e.nullable,"onUpdate:modelValue":l[6]||(l[6]=a=>e.nullable=a),"dict-type":"yes_or_no",placeholder:"\u8BF7\u9009\u62E9",clearable:""},null,8,["modelValue"])]),_:1})):i("",!0),u(d,{label:"\u63CF\u8FF0",prop:"note","label-width":"auto"},{default:t(()=>[u(m,{type:"textarea",rows:3,modelValue:e.note,"onUpdate:modelValue":l[7]||(l[7]=a=>e.note=a),placeholder:"\u63CF\u8FF0"},null,8,["modelValue"])]),_:1}),e.type==1?(r(),s(d,{key:4,label:"\u5173\u8054\u7801\u8868",prop:"standardCodeId","label-width":"auto"},{default:t(()=>[u(N,{modelValue:e.standardCodeId,"onUpdate:modelValue":l[8]||(l[8]=a=>e.standardCodeId=a),clearable:"",filterable:"",placeholder:"\u8BF7\u9009\u62E9"},{default:t(()=>[(r(!0),x(I,null,T(y.value,(a,j)=>(r(),s(v,{key:a.id,label:`[${a.engName}]${a.cnName}`,value:a.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):i("",!0)]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{z as _};
