text: var b=Object.defineProperty;var g=Object.getOwnPropertySymbols;var x=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable;var E=(t,u,e)=>u in t?b(t,u,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[u]=e,B=(t,u)=>{for(var e in u||(u={}))x.call(u,e)&&E(t,e,u[e]);if(g)for(var e of g(u))y.call(u,e)&&E(t,e,u[e]);return t};var f=(t,u,e)=>new Promise((l,n)=>{var d=o=>{try{s(e.next(o))}catch(i){n(i)}},r=o=>{try{s(e.throw(o))}catch(i){n(i)}},s=o=>o.done?l(o.value):Promise.resolve(o.value).then(d,r);s((e=e.apply(t,u)).next())});import{B as _,a as A}from"./index.c505e96f.js";import{B as R}from"./BasicForm.0ba2e15f.js";import{u as M}from"./useForm.696aa965.js";import{c as N,s as P}from"./role.50d962e5.js";import{g as j}from"./company.54be1035.js";import{_ as v}from"./index.e84e956c.js";import{A as S,r as k,u as h,j as q,a0 as C,B as $,a1 as T,a6 as O,w as V,a4 as L}from"./vendor.5879c5ca.js";const te=[{title:"\u540D\u79F0",dataIndex:"name",align:"left"},{title:"\u7F16\u7801",dataIndex:"sn",width:120,align:"left"},{title:"\u6240\u5C5E\u516C\u53F8",dataIndex:"companyName",width:120,align:"left"},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createTime",width:180},{title:"\u64CD\u4F5C",dataIndex:"action",width:120,slots:{customRender:"action"}}],ue=[{title:"\u64CD\u4F5C",dataIndex:"action",width:50,slots:{customRender:"action"}},{dataIndex:"name",align:"left",width:200,slots:{title:"customName"},customRender:({record:t})=>t.name+" - ["+t.code+"]"},{title:"\u6240\u5C5E\u516C\u53F8",dataIndex:"companyName",align:"left"},{title:"\u6240\u5C5E\u90E8\u95E8",dataIndex:"deptName",align:"left"}],ae=[{field:"keyword",label:"\u5173\u952E\u5B57",component:"Input",componentProps:{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0/\u6807\u8BC6"},labelWidth:60,colProps:{span:6,lg:{span:8,offset:0},sm:{span:14,offset:0},xs:{span:16,offset:0}}}],U=[{field:"id",label:"ID",required:!1,component:"Input",show:!1},{field:"name",label:"\u540D\u79F0",component:"Input",required:!0,rules:[{required:!0,whitespace:!0,message:"\u7F16\u7801\u4E0D\u80FD\u4E3A\u7A7A\uFF01"},{max:64,message:"\u5B57\u7B26\u957F\u5EA6\u4E0D\u80FD\u5927\u4E8E64\uFF01"}]},{field:"sn",label:"\u7F16\u7801",component:"Input",required:!0},{field:"companyId",label:"\u6240\u5C5E\u516C\u53F8",component:"TreeSelect",componentProps:{treeNodeFilterProp:"cname",replaceFields:{title:"cname",key:"id",value:"id"},getPopupContainer:()=>document.body},required:!0},{field:"orderNo",label:"\u6392\u5E8F\u53F7",required:!1,component:"InputNumber"},{label:"\u5907\u6CE8",field:"note",component:"InputTextArea",rules:[{max:1024,message:"\u5B57\u7B26\u957F\u5EA6\u4E0D\u80FD\u5927\u4E8E1024\uFF01"}]}],z=S({name:"RoleModal",components:{BasicModal:_,BasicForm:R},emits:["success","register"],setup(t,{emit:u}){const e=k(!0),[l,{setFieldsValue:n,updateSchema:d,resetFields:r,validate:s}]=M({labelWidth:100,schemas:U,showActionButtonGroup:!1,actionColOptions:{span:23}}),o=a=>[{trigger:"blur",validator:(c,m)=>m?N({id:a.id,field:a.field,fieldValue:m,fieldName:a.fieldName}).then(F=>F?Promise.resolve():Promise.reject(a.fieldName+"\u5DF2\u5B58\u5728\uFF0C\u8BF7\u4FEE\u6539\uFF01")).catch(F=>Promise.reject(F)):Promise.resolve()}],[i,{setModalProps:p,closeModal:D}]=A(a=>f(this,null,function*(){yield r(),p({confirmLoading:!1}),e.value=!!(a==null?void 0:a.isUpdate);let c=a.record;const m=yield j();yield d([{field:"companyId",componentProps:{treeData:m}},{field:"sn",dynamicRules:()=>[{required:!0,whitespace:!0,message:"\u7F16\u7801\u4E0D\u80FD\u4E3A\u7A7A\uFF01"},{pattern:new RegExp("^[0-9a-zA-Z-_]{1,}$"),type:"string",message:"\u8BF7\u8F93\u5165\u82F1\u6587\u6216\u6570\u5B57\uFF01"},{max:64,message:"\u5B57\u7B26\u957F\u5EA6\u4E0D\u80FD\u5927\u4E8E64\uFF01"},...o({id:h(e)&&c&&c.id||"",field:"sn",fieldValue:"",fieldName:"\u7F16\u7801"})]}]),n(B({},c))})),w=q(()=>h(e)?"\u4FEE\u6539":"\u65B0\u589E");function I(){return f(this,null,function*(){try{p({confirmLoading:!0});const a=yield s();yield P(a),D(),u("success")}finally{p({confirmLoading:!1})}})}return{registerModal:i,registerForm:l,getTitle:w,handleSubmit:I}}});function W(t,u,e,l,n,d){const r=C("BasicForm"),s=C("BasicModal");return $(),T(s,L(t.$attrs,{onRegister:t.registerModal,title:t.getTitle,onOk:t.handleSubmit}),{default:O(()=>[V(r,{onRegister:t.registerForm},null,8,["onRegister"])]),_:1},16,["onRegister","title","onOk"])}var G=v(z,[["render",W]]),oe=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:G});export{G as R,oe as a,te as c,ue as p,ae as s};
  