text: var e=Object.defineProperty,t=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,a,o)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[a]=o,n=(e,t,a)=>new Promise(((o,r)=>{var n=e=>{try{i(a.next(e))}catch(t){r(t)}},l=e=>{try{i(a.throw(e))}catch(t){r(t)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(n,l);i((a=a.apply(e,t)).next())}));import{_ as l,a as i}from"./useModal.11986c6c.js";import{_ as s}from"./BasicForm.f252c294.js";import{u as d}from"./useForm.7c89f4ac.js";import{c,s as m}from"./role.97405a6b.js";import{g as p}from"./company.08334ec9.js";import{k as u,r as f,u as g,f as y,K as b,o as h,n as v,Q as I,q as x,N as w}from"./vendor.9d9efc92.js";const P=[{title:"名称",dataIndex:"name",align:"left"},{title:"编码",dataIndex:"sn",width:120,align:"left"},{title:"所属公司",dataIndex:"companyName",width:120,align:"left"},{title:"创建时间",dataIndex:"createTime",width:180},{title:"操作",dataIndex:"action",width:120,slots:{customRender:"action"}}],j=[{title:"操作",dataIndex:"action",width:50,slots:{customRender:"action"}},{dataIndex:"name",align:"left",width:200,slots:{title:"customName"},customRender:({record:e})=>e.name+" - ["+e.code+"]"},{title:"所属公司",dataIndex:"companyName",align:"left"},{title:"所属部门",dataIndex:"deptName",align:"left"}],N=[{field:"keyword",label:"关键字",component:"Input",componentProps:{placeholder:"请输入名称/标识"},labelWidth:60,colProps:{span:6,lg:{span:8,offset:0},sm:{span:14,offset:0},xs:{span:16,offset:0}}}],R=[{field:"id",label:"ID",required:!1,component:"Input",show:!1},{field:"name",label:"名称",component:"Input",required:!0,rules:[{required:!0,whitespace:!0,message:"编码不能为空！"},{max:64,message:"字符长度不能大于64！"}]},{field:"sn",label:"编码",component:"Input",required:!0},{field:"companyId",label:"所属公司",component:"TreeSelect",componentProps:{treeNodeFilterProp:"cname",replaceFields:{title:"cname",key:"id",value:"id"},getPopupContainer:()=>document.body},required:!0},{field:"orderNo",label:"排序号",required:!1,component:"InputNumber"},{label:"备注",field:"note",component:"InputTextArea",rules:[{max:1024,message:"字符长度不能大于1024！"}]}];var F=u({name:"RoleModal",components:{BasicModal:l,BasicForm:s},emits:["success","register"],setup(e,{emit:l}){const s=f(!0),[u,{setFieldsValue:b,updateSchema:h,resetFields:v,validate:I}]=d({labelWidth:100,schemas:R,showActionButtonGroup:!1,actionColOptions:{span:23}}),[x,{setModalProps:w,closeModal:P}]=i((e=>n(this,null,(function*(){yield v(),w({confirmLoading:!1}),s.value=!!(null==e?void 0:e.isUpdate);let n=e.record;const l=yield p();yield h([{field:"companyId",componentProps:{treeData:l}},{field:"sn",dynamicRules:()=>{return[{required:!0,whitespace:!0,message:"编码不能为空！"},{pattern:new RegExp("^[0-9a-zA-Z_]{1,}$"),type:"string",message:"请输入英文或数字！"},{max:64,message:"字符长度不能大于64！"},...(e={id:g(s)&&n&&n.id||"",field:"sn",fieldValue:"",fieldName:"编码"},[{trigger:"blur",validator:(t,a)=>a?c({id:e.id,field:e.field,fieldValue:a,fieldName:e.fieldName}).then((t=>t?Promise.resolve():Promise.reject(e.fieldName+"已存在，请修改！"))).catch((e=>Promise.reject(e))):Promise.resolve()}])];var e}}]),g(s)&&b(((e,n)=>{for(var l in n||(n={}))a.call(n,l)&&r(e,l,n[l]);if(t)for(var l of t(n))o.call(n,l)&&r(e,l,n[l]);return e})({},e.record))}))));return{registerModal:x,registerForm:u,getTitle:y((()=>g(s)?"修改":"新增")),handleSubmit:function(){return n(this,null,(function*(){try{w({confirmLoading:!0});const e=yield I();yield m(e),P(),l("success")}finally{w({confirmLoading:!1})}}))}}}});F.render=function(e,t,a,o,r,n){const l=b("BasicForm"),i=b("BasicModal");return h(),v(i,w(e.$attrs,{onRegister:e.registerModal,title:e.getTitle,onOk:e.handleSubmit}),{default:I((()=>[x(l,{onRegister:e.registerForm},null,8,["onRegister"])])),_:1},16,["onRegister","title","onOk"])};var O=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:F});export{O as R,F as _,P as c,j as p,N as s};
  