text: var e=Object.defineProperty,i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable,s=(i,r,t)=>r in i?e(i,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[r]=t,o=(e,i,r)=>new Promise(((t,s)=>{var o=e=>{try{d(r.next(e))}catch(i){s(i)}},a=e=>{try{d(r.throw(e))}catch(i){s(i)}},d=e=>e.done?t(e.value):Promise.resolve(e.value).then(o,a);d((r=r.apply(e,i)).next())}));import{B as a,a as d}from"./index.393263b2.js";import{_ as n}from"./BasicForm.e292c287.js";import{u as l}from"./useForm.10272283.js";import{f as m}from"./app.data.b2b22b31.js";import{c,s as p}from"./app.1bdce5a2.js";import{j as f,r as u,u as b,i as j,K as g,o as x,m as v,Q as y,n as h,N as w}from"./vendor.686fd1d4.js";import"./index.f769efd5.js";import"./useWindowSizeFn.d82e06bf.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import"./index.9bee2b44.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import"./uuid.2b29000c.js";import"./download.d628f07d.js";import"./base64Conver.bb012c73.js";import"./index.48620b65.js";var P=f({name:"AppModal",components:{BasicModal:a,BasicForm:n},emits:["success","register"],setup(e,{emit:a}){const n=u(!0),[f,{resetFields:g,updateSchema:x,setFieldsValue:v,validate:y}]=l({labelWidth:100,schemas:m,showActionButtonGroup:!1}),[h,{setModalProps:w,closeModal:P}]=d((e=>o(this,null,(function*(){yield g(),w({confirmLoading:!1}),n.value=!!(null==e?void 0:e.isUpdate);let o=e.record;yield x([{field:"sn",dynamicRules:()=>{return[{required:!0,whitespace:!0,message:"标识不能为空！"},{pattern:new RegExp("^[0-9a-zA-Z_]{1,}$"),type:"string",message:"请输入英文或数字！"},{max:40,message:"字符长度不能大于40！"},...(e={id:b(n)&&o&&o.id||"",field:"sn",fieldValue:"",fieldName:"标识"},[{trigger:"blur",validator:(i,r)=>r?c({id:e.id,field:e.field,fieldValue:r,fieldName:e.fieldName}).then((i=>i?Promise.resolve():Promise.reject(e.fieldName+"已存在，请修改！"))).catch((e=>Promise.reject(e))):Promise.resolve()}])];var e}}]),b(n)&&v(((e,o)=>{for(var a in o||(o={}))r.call(o,a)&&s(e,a,o[a]);if(i)for(var a of i(o))t.call(o,a)&&s(e,a,o[a]);return e})({},e.record))}))));return{registerModal:h,registerForm:f,getTitle:j((()=>b(n)?"修改":"新增")),handleSubmit:function(){return o(this,null,(function*(){try{w({confirmLoading:!0});const e=yield y();e.status=e.status?1:0,yield p(e),P(),a("success")}finally{w({confirmLoading:!1})}}))}}}});P.render=function(e,i,r,t,s,o){const a=g("BasicForm"),d=g("BasicModal");return x(),v(d,w(e.$attrs,{onRegister:e.registerModal,title:e.getTitle,onOk:e.handleSubmit}),{default:y((()=>[h(a,{onRegister:e.registerForm},null,8,["onRegister"])])),_:1},16,["onRegister","title","onOk"])};export default P;
  