Files
qhmes/deploy-qhmes/frontend/js/CategoryModal-BC8EkPON.js
2026-05-15 11:34:12 +08:00

2 lines
3.2 KiB
Java
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var I=Object.defineProperty;var w=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var x=(n,t,o)=>t in n?I(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o,y=(n,t)=>{for(var o in t||(t={}))M.call(t,o)&&x(n,o,t[o]);if(w)for(var o of w(t))F.call(t,o)&&x(n,o,t[o]);return n};var v=(n,t,o)=>new Promise((c,i)=>{var d=a=>{try{p(o.next(a))}catch(m){i(m)}},u=a=>{try{p(o.throw(a))}catch(m){i(m)}},p=a=>a.done?c(a.value):Promise.resolve(a.value).then(d,u);p((o=o.apply(n,t)).next())});import{d as O,aC as A,as as R,aF as U,k as D,u as l,aG as L,e as T,f}from"./vue-vendor-C7Zq48Yl.js";import{B as K}from"./index-Du0A3ksf.js";import"./index-Di-j2gt4.js";import{l as j,s as E}from"./category.api-C7wOYjoR.js";import{ak as G}from"./index-BI6CMai0.js";import{B as H}from"./BasicForm-BJnSRkIE.js";import{u as J}from"./useForm-BZtHZyx2.js";const ee=[{title:"分类名称",dataIndex:"name",width:350,align:"left"},{title:"分类编码",dataIndex:"code"}],oe=[{label:"名称",field:"name",component:"JInput",colProps:{span:6}},{label:"编码",field:"code",component:"JInput",colProps:{span:6}}],N=[{label:"",field:"id",component:"Input",show:!1},{label:"父级节点",field:"pid",component:"TreeSelect",componentProps:{fieldNames:{value:"key"},dropdownStyle:{maxHeight:"50vh"},getPopupContainer:()=>document.body},show:({values:n})=>n.pid!=="0",dynamicDisabled:({values:n})=>!!n.id},{label:"分类名称",field:"name",required:!0,component:"Input"},{label:"分类编码",field:"code",component:"Input",componentProps:{placeholder:"留空将按规则自动生成(如 A01.A02"}}],V=O({__name:"CategoryModal",emits:["register","success"],setup(n,{emit:t}){const o=t,c=f(!0),i=f([]),d=f([]),u=f(!1),[p,{resetFields:a,setFieldsValue:m,validate:_,updateSchema:P}]=J({schemas:N,showActionButtonGroup:!1,labelCol:{xs:{span:24},sm:{span:4}},wrapperCol:{xs:{span:24},sm:{span:18}}}),[S,{setModalProps:h,closeModal:k}]=G(e=>v(null,null,function*(){yield a(),i.value=[],h({confirmLoading:!1,minHeight:80}),c.value=!!(e!=null&&e.isUpdate),u.value=!(e!=null&&e.isUpdate)&&e.record&&e.record.id,e!=null&&e.record&&(yield m(y({},e.record))),d.value=yield j({async:!1,pcode:""}),P({field:"pid",componentProps:{treeData:d}})})),C=T(()=>l(c)?"编辑字典":"新增字典");function g(e,s){if(e&&s&&s.length>0)for(let r=0;r<s.length;r++)s[r].key==e&&l(i).indexOf(e)<0?(b(s[r]),i.value.push(s[r].key),g(s[r].parentId,l(d))):g(e,s[r].children)}function B(){return v(this,null,function*(){try{let e=yield _();h({confirmLoading:!0}),yield E(e,c.value),k(),yield g(e.pid,l(d)),o("success",{isUpdate:l(c),isSubAdd:l(u),values:y({},e),expandedArr:l(i).reverse()})}finally{h({confirmLoading:!1})}})}function b(e){if(e.children&&e.children.length>0)for(const s of e.children)l(i).indexOf(s.key)<0&&s.children&&s.children.length>0&&(b(s),i.value.push(s.key))}return(e,s)=>(R(),A(l(K),L(e.$attrs,{onRegister:l(S),destroyOnClose:"",width:"550px",title:C.value,onOk:B}),{default:U(()=>[D(l(H),{onRegister:l(p)},null,8,["onRegister"])]),_:1},16,["onRegister","title"]))}}),se=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));export{se as C,V as _,ee as c,oe as s};