Files
vben-app/web/dist/js/edit-vijMqaOa.js
2026-10-01 17:05:05 +08:00

2 lines
12 KiB
JavaScript

var F=(P,T,n)=>new Promise((l,V)=>{var $=k=>{try{C(n.next(k))}catch(x){V(x)}},D=k=>{try{C(n.throw(k))}catch(x){V(x)}},C=k=>k.done?l(k.value):Promise.resolve(k.value).then($,D);C((n=n.apply(P,T)).next())});import{az as se,t as U,aa as de,ai as ie,as as ne,at as re,ae as ce,af as ue,aK as pe,aL as me,aE as fe,aF as he,aG as be,aT as ge,a9 as _e,a7 as ke,aQ as ve,v as we,an as ye,a8 as Ve,_ as Ce}from"./bootstrap-Dvp__AlY.js";import{t as xe}from"./edit-DOYUCpv5.js";import{_ as Ue}from"./page.vue_vue_type_script_setup_true_lang-CDyLWsWA.js";import{a7 as Ne,T as R,X as Ee,a1 as Te,a9 as Re,n as Se,aN as E,aw as v,aO as s,x as a,ax as N,aq as i,Y as M,ar as I,F as K,ay as B,at as De,aP as $e,au as j,aR as O}from"../jse/index-index-D97IFaZ_.js";import{u as ze}from"./use-tabs-_Cji5SS7.js";import{b as S}from"./uuid-B0AYzFfo.js";const qe={class:"flex justify-between"},Fe={style:{height:"calc(100% - 50px)",overflow:"auto","padding-top":"5px","padding-left":"0","padding-right":"0"}},Ie={style:{"padding-left":"15px","padding-right":"15px","padding-top":"10px",height:"100%",border:"1px solid #eee"}},Ke={class:"zinput"},Be={class:"zinput"},je={class:"zinput"},Le={class:"zinput"},Oe=Ne({__name:"edit",setup(P){const T=R(),n=Ee({url:"/te/feat/comp",show:!0,form:{avtag:!0,comps:[],plist:[],llist:[],clist:[]},groups:[],cocas:[],tabs:[],links:[],checks:[],comps:[]}),{form:l,tabs:V}=Te(n),$=R("tab1"),D=R(""),C=R(),k=R([]),x=R(),z=R();Re(()=>F(null,null,function*(){var e,r;const b=(e=se().query)==null?void 0:e.id;b?(n.form=yield U.get(`${n.url}/info/${b}`),yield G(!0),Y()):n.form={avtag:!0,comps:[],plist:[],llist:[],clist:[]},(r=T==null?void 0:T.value)==null||r.clearValidate(),n.groups=yield U.get("/te/feat/group/list")}));const{closeCurrentTab:A}=ze(),Q=()=>F(null,null,function*(){const b=C.value.getCheckedNodes(),e=[];for(const f of b)e.push({id:S(),comid:f.id});l.value.comps=e,Z(),(yield xe({formRef:T.value,state:n}))&&(yield A())}),G=b=>F(null,null,function*(){n.cocas=yield U.get("/te/feat/coca/tree",{params:{groid:l.value.groid}}),b||(l.value.cocid=void 0),n.comps=yield U.get("/te/feat/comp/tree",{params:{groid:l.value.groid}});const e=[];for(const t of l.value.comps)e.push(t.comid);C.value.setCheckedKeys(e),V.value=yield U.get("/te/feat/tab/list",{params:{groid:l.value.groid}}),V.value.length>0&&(D.value=V.value[0].id),yield Se(()=>{for(let t=0;t<V.value.length;t++)V.value[t].params.forEach(u=>{for(const d of l.value.plist)if(d.parid===u.id){u.iteid=d.id,u.deval=d.deval,u.rotag=d.rotag,u.retag=d.retag,u.olist=d.olist,u.notes=d.notes,u.chtag=!0,k.value[t].toggleRowSelection(u,!0);break}})});const r=[],f=[],g=[],h=[];for(const t of l.value.comps){const u=yield U.get(`/te/feat/comp/rec?id=${t.comid}`);for(const d of n.tabs)for(const p of d.params){p.check=!1;for(const _ of u.plist)if(p.id===_.parid){if(!p.chtag){p.deval=_.deval,p.rotag=_.rotag,p.retag=_.retag,p.oparr=[];for(const w of _.olist)p.oparr.push(w.optid)}p.check=!0;break}}for(const d of u.llist)r.push(d.linid),f.push(d.linid);for(const d of u.clist)g.push(d.cheid),h.push(d.cheid)}n.links=yield U.get("/te/feat/link/tree",{params:{groid:l.value.groid}});for(const t of l.value.llist)r.push(t.linid);x.value.setCheckedKeys(r),q(f,n.links),n.checks=yield U.get("/te/feat/check/tree",{params:{groid:l.value.groid}});for(const t of l.value.clist)g.push(t.cheid);z.value.setCheckedKeys(g),q(h,n.checks)}),X=b=>{b.olist=[];for(const e of b.oparr)b.olist.push({id:S(),optid:e})},Y=()=>{for(const b of n.tabs)for(const e of b.params)if(e.shmod==="select"&&e.olist){e.oparr=[];for(const r of e.olist)e.oparr.push(r.optid)}},J=(b,e)=>{if(e.chtag=!e.chtag,e.olist=[],e.oparr)for(const f of e.oparr)e.olist.push({id:S(),optid:f});const r=C.value.getCheckedNodes();for(const f of r)if(f.data&&f.data.plist){for(const g of f.data.plist)if(e.id===g.parid){if(!e.chtag){e.deval=g.deval,e.rotag=g.rotag,e.retag=g.retag,e.oparr=[];for(const h of g.olist)e.oparr.push(h.optid)}break}}},W=(b,e)=>F(null,null,function*(){const r=[],f=[];for(const t of x.value.getCheckedNodes())t.disabled===!1&&r.push(t.id);const g=[],h=[];for(const t of z.value.getCheckedNodes())t.disabled===!1&&g.push(t.id);for(const t of e.checkedNodes)if(t.type==="comp"){const u=yield U.get(`/te/feat/comp/rec?id=${t.id}`);for(const d of n.tabs)for(const p of d.params){p.check=!1;for(const _ of u.plist)if(p.id===_.parid){if(!p.chtag){p.deval=_.deval,p.rotag=_.rotag,p.retag=_.retag,p.oparr=[];for(const w of _.olist)p.oparr.push(w.optid)}p.check=!0;break}}for(const d of u.llist)r.push(d.linid),f.push(d.linid);for(const d of u.clist)g.push(d.cheid),h.push(d.cheid)}x.value.setCheckedKeys(r),q(f,n.links),z.value.setCheckedKeys(g),q(h,n.checks)}),q=(b,e)=>{for(const r of e){r.disabled=!1;for(const f of b)if(r.id===f){r.disabled=!0;break}r.children!==null&&r.children.length>0&&q(b,r.children)}},Z=()=>{const b=C.value.getCheckedNodes(),e=[];for(const t of b)t.type!=="cate"&&t.id!==l.value.id&&e.push({id:S(),comid:t.id});l.value.comps=e,l.value.plist=[];for(let t=0;t<n.tabs.length;t++)for(let u=0;u<k.value[t].getSelectionRows().length;u++){const d=k.value[t].getSelectionRows()[u],p={id:d.iteid,parid:d.id,ornum:d.ornum,notes:d.notes,rotag:d.rotag,retag:d.retag,deval:d.deval,olist:d.olist};p.id||(p.id=S()),l.value.plist.push(p)}const r=x.value.getCheckedNodes(),f=[];for(const t of r)t.type!=="cate"&&t.disabled===!1&&f.push({id:S(),linid:t.id});l.value.llist=f;const g=z.value.getCheckedNodes(),h=[];for(const t of g)t.type!=="cate"&&t.disabled===!1&&h.push({id:S(),cheid:t.id});l.value.clist=h};return(b,e)=>{const r=ye,f=Ve,g=ue,h=ce,t=me,u=pe,d=fe,p=he,_=be,w=re,L=ge,ee=ve,y=ke,ae=_e,H=ne,te=ie,le=de;return v(),E(i(Ue),{"auto-content-height":""},{default:s(()=>[a(le,{class:"box-card",style:{height:"100%"},"body-style":"height: 100%"},{header:s(()=>[N("div",qe,[a(r,null,{default:s(()=>[...e[10]||(e[10]=[O("特性组件",-1)])]),_:1}),a(r,null,{default:s(()=>[a(f,{type:"primary",onClick:Q},{default:s(()=>[...e[11]||(e[11]=[O("保 存",-1)])]),_:1}),a(f,{onClick:e[0]||(e[0]=c=>i(A)())},{default:s(()=>[...e[12]||(e[12]=[O("关 闭",-1)])]),_:1})]),_:1})])]),default:s(()=>[N("div",Fe,[a(te,{inline:!0,ref_key:"formRef",ref:T,model:i(l),"label-width":"140px",class:"zform"},{default:s(()=>[a(H,{type:"card",modelValue:i($),"onUpdate:modelValue":e[9]||(e[9]=c=>M($)?$.value=c:null),style:{width:"100%"}},{default:s(()=>[a(w,{label:"基本信息",name:"tab1"},{default:s(()=>[a(h,{label:"组件名称:",prop:"name",rules:[{required:!0,message:"名称不能为空"}]},{default:s(()=>[a(g,{modelValue:i(l).name,"onUpdate:modelValue":e[1]||(e[1]=c=>i(l).name=c)},null,8,["modelValue"])]),_:1}),a(h,{label:"所属特性分组:",prop:"groid",rules:[{required:!0,message:"特性分组不能为空"}],style:{width:"25%"}},{default:s(()=>[a(u,{modelValue:i(l).groid,"onUpdate:modelValue":e[2]||(e[2]=c=>i(l).groid=c),placeholder:"请选择特性分组",onChange:e[3]||(e[3]=c=>G(!1)),style:{width:"100%"}},{default:s(()=>[(v(!0),I(K,null,B(i(n).groups,c=>(v(),E(t,{key:c.id,label:c.name,value:c.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(h,{label:"所属组件分类:",prop:"cocid",rules:[{required:!0,message:"组件分类不能为空"}],style:{width:"25%"}},{default:s(()=>[a(d,{placeholder:"请选择","default-expand-all":"",props:{value:"id",label:"name"},modelValue:i(l).cocid,"onUpdate:modelValue":e[4]||(e[4]=c=>i(l).cocid=c),data:i(n).cocas,"check-strictly":"",style:{width:"100%"},clearable:""},null,8,["modelValue","data"])]),_:1}),a(h,{label:"排序号:",style:{width:"25%"}},{default:s(()=>[a(p,{modelValue:i(l).ornum,"onUpdate:modelValue":e[5]||(e[5]=c=>i(l).ornum=c),"controls-position":"right",style:{width:"100%"}},null,8,["modelValue"])]),_:1}),a(h,{label:"是否可用:",style:{width:"25%"}},{default:s(()=>[a(_,{modelValue:i(l).avtag,"onUpdate:modelValue":e[6]||(e[6]=c=>i(l).avtag=c)},null,8,["modelValue"])]),_:1})]),_:1}),a(w,{label:"子组件分配",name:"tab2"},{default:s(()=>[N("div",null,[a(L,{ref_key:"compTreeRef",ref:C,onCheck:W,data:i(n).comps,"show-checkbox":"","node-key":"id",props:{label:"name"}},null,8,["data"])])]),_:1}),a(w,{label:"参数分配",name:"tab3"},{default:s(()=>[N("div",Ie,[a(H,{modelValue:i(D),"onUpdate:modelValue":e[7]||(e[7]=c=>M(D)?D.value=c:null)},{default:s(()=>[(v(!0),I(K,null,B(i(V),(c,oe)=>(v(),E(w,{label:c.name,name:c.id,key:c.id},{default:s(()=>[a(ae,{ref_for:!0,ref:o=>{o&&(i(k)[oe]=o)},data:c.params,style:{width:"100%"},onSelect:J},{default:s(()=>[a(y,{prop:"check",label:"##",width:"46"},{default:s(o=>[a(ee,{modelValue:o.row.check,"onUpdate:modelValue":m=>o.row.check=m,label:"",disabled:"",style:{"margin-top":"-4px"}},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),a(y,{type:"selection",width:"40"}),a(y,{prop:"id",label:"参数代码",width:"180"}),a(y,{prop:"name",label:"参数名称",width:"180"}),a(y,{prop:"ornum",label:"排序号",width:"100"}),a(y,{label:"初始可选项",width:"300"},{default:s(o=>[o.row.shmod==="select"?(v(),E(u,{key:0,disabled:o.row.check&&!o.row.chtag,modelValue:o.row.oparr,"onUpdate:modelValue":m=>o.row.oparr=m,onChange:m=>X(o.row),placeholder:" ",multiple:"",style:{width:"100%"}},{default:s(()=>[(v(!0),I(K,null,B(o.row.options,m=>(v(),E(t,{key:m.id,value:m.id,label:m.name},null,8,["value","label"]))),128))]),_:2},1032,["disabled","modelValue","onUpdate:modelValue","onChange"])):De("",!0)]),_:1}),a(y,{label:"初始默认值",width:"180"},{default:s(o=>[o.row.shmod==="select"?(v(),E(u,{key:0,disabled:o.row.check&&!o.row.chtag,modelValue:o.row.deval,"onUpdate:modelValue":m=>o.row.deval=m,placeholder:" ",style:{width:"100%"},clearable:""},{default:s(()=>[(v(!0),I(K,null,B(o.row.options,m=>(v(),E(t,{key:m.id,value:m.code,label:m.name},null,8,["value","label"]))),128))]),_:2},1032,["disabled","modelValue","onUpdate:modelValue"])):(v(),E(g,{key:1,modelValue:o.row.deval,"onUpdate:modelValue":m=>o.row.deval=m,placeholder:"默认值",disabled:o.row.check&&!o.row.chtag},null,8,["modelValue","onUpdate:modelValue","disabled"]))]),_:1}),a(y,{label:"只读?",width:"66"},{default:s(o=>[a(_,{modelValue:o.row.rotag,"onUpdate:modelValue":m=>o.row.rotag=m,disabled:o.row.check&&!o.row.chtag},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:1}),a(y,{label:"非必填?",width:"76"},{default:s(o=>[a(_,{modelValue:o.row.retag,"onUpdate:modelValue":m=>o.row.retag=m,disabled:o.row.check&&!o.row.chtag},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:1}),a(y,{align:"right"},{header:s(()=>[...e[13]||(e[13]=[])]),default:s(o=>[a(g,{modelValue:o.row.notes,"onUpdate:modelValue":m=>o.row.notes=m,placeholder:"备注",disabled:o.row.check},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:1})]),_:1},8,["data"])]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])])]),_:1}),a(w,{label:"联动分配",name:"tab4"},{default:s(()=>[a(L,{ref_key:"linkTreeRef",ref:x,"node-key":"id",style:{"max-width":"600px"},data:i(n).links,props:{label:"name"},"show-checkbox":""},null,8,["data"])]),_:1}),a(w,{label:"校验分配",name:"tab5"},{default:s(()=>[a(L,{ref_key:"checkTreeRef",ref:z,"node-key":"id",style:{"max-width":"600px"},data:i(n).checks,props:{label:"name"},"show-checkbox":""},null,8,["data"])]),_:1}),a(w,{label:"其他信息",name:"tab9"},{default:s(()=>[a(h,{label:"备注:",style:{width:"100%"}},{default:s(()=>[a(g,{style:{"font-family":"'Courier New', Helvetica, Arial, sans-serif","font-size":"16px"},type:"textarea",rows:4,modelValue:i(l).notes,"onUpdate:modelValue":e[8]||(e[8]=c=>i(l).notes=c)},null,8,["modelValue"])]),_:1}),$e(N("div",null,[a(h,{label:"创建人:"},{default:s(()=>[N("div",Ke,j(i(l).crman?i(l).crman.name:""),1)]),_:1}),a(h,{label:"创建时间:"},{default:s(()=>[N("div",Be,j(i(l).crtim),1)]),_:1}),a(h,{label:"更新人:"},{default:s(()=>[N("div",je,j(i(l).upman?i(l).upman.name:""),1)]),_:1}),a(h,{label:"更新时间:"},{default:s(()=>[N("div",Le,j(i(l).uptim),1)]),_:1})],512),[[we,i(l).crtim]])]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["model"])])]),_:1})]),_:1})}}}),Ye=Ce(Oe,[["__scopeId","data-v-cecfac52"]]);export{Ye as default};