y9-interface-platform/y9vue-interfacePlatform/interface/assets/parameterTable-f92cb2bf.js

2 lines
8.6 KiB
JavaScript
Raw Normal View History

import{a as V,E as q,b as te}from"./element-plus-53a783a7.js";import"./vue-20eed888.js";import{u as ae}from"./index-03a63030.js";import{u as le}from"./vue-i18n-d6e8419a.js";import{d as re,G as ie,r as m,k as r,ah as v,ai as I,o as w,c as se,e as F,P as x,b as L,u as b,L as A,a as C,U as E,S as R,i as oe,F as ne}from"./@vue-e95c845e.js";import{_ as pe}from"./y9plugin-components-412bad23.js";const ue=re({__name:"parameterTable",props:{parameterStatus:{type:String,default:()=>"3"},data:{type:Array,default:()=>[]},isView:{type:Boolean,default:()=>!1}},setup(z,{expose:O}){const S=ie("sizeObjInfo"),M=ae(),{t:a}=le(),N=m({}),P=m(),g=m(!1),T=m([]),c=z;let h=1e4,d=m({rowKey:"id",headerBackground:!0,pageConfig:!1,border:!0,defaultExpandAll:!0,height:"200px",columns:[{type:"selection",width:60},{type:"index",title:r(()=>a("序号")),width:80,fixed:"left"},{title:r(()=>a("参数key")),width:180,key:"parameterKey",render:e=>JSON.parse(e.isItems)?v("span",{class:"isItems"},e.parameterKey):e.parameterKey},{title:r(()=>a("层级")),key:"level",render:e=>v("span",X(e.level)+"级")},{title:r(()=>a("参数类型")),key:"parameterType"},{title:r(()=>a("是否必填")),key:"required"},{title:r(()=>a("参数描述")),key:"notes"},{title:r(()=>a("操作")),width:150,fixed:"right",render:e=>v("div",j(e))}],tableData:c.data});function j(e){let t=[],l=v("span",{onClick:()=>{H(e)}},a("详情")),o=v("span",{class:"leftMargin",onClick:()=>{G(e)}},a("添加")),i=v("span",{class:"leftMargin",onClick:()=>{W(e)}},a("编辑")),f=v("span",{class:"leftMargin",onClick:()=>{Q(e.id)}},a("删除"));return c.isView?(t.push(l),t.push(i),e.parameterType=="map"&&t.push(o),e.isItems!=null&&e.isItems||t.push(f)):t.push(l),t}const U=m({filtersValueCallBack:e=>{N.value=e},itemList:[{type:"slot",slotName:"slotBtns",span:(M.device==="mobile",24),justify:"flex-end"}],showBorder:!0}),B=m();let u=m({show:!1,title:r(()=>a("新增参数")),showFooter:!0,onOkLoading:!0,onOk:e=>new Promise(async(t,l)=>{var i;await((i=B.value)==null?void 0:i.elFormRef).validate(async f=>{let s=B.value.model;if(f){if(s.pid!="0"){let y=[];for(let p of d.value.tableData)p.children instanceof Array&&k(p.children,y),y.push(p);for(let p of y)if(g.value){if(p.id==s.id){K(p,s);break}}else if(p.id==s.pid){p.children||(p.children=[]),s.parameterType=="array"&&(s.children=[{id:h++,pid:s.id,parameterType:"String",parameterStatus:c.parameterStatus,parameterKey:"items",required:"否",isItems:!0,level:s.level+1}]),p.children.push(s);break}t()}else if(g.value){let y=[];for(let p of d.value.tableData)p.children instanceof Array&&k(p.children,y),y.push(p);for(let p of y)if(p.id==s.id){K(p,s);break}t()}else s.parameterType=="array"&&(s.children=[{id:h++,pid:s.id,parameterType:"String",parameterStatus:c.parameterStatus,parameterKey:"items",required:"否",isItems:!0,level:s.level+1}]),d.value.tableData.push(s),t();l()}else l()})})}),n=m({model:{},rules:{parameterKey:[{required:!0,message:r(()=>a("参数key不能为空")),trigger:"blur"}],parameterType:[{required:!0,message:r(()=>a("字段类型不能为空")),trigger:"blur"}],required:[{required:!0,message:r(()=>a("是否必填不能为空")),trigger:"blur"}],pid:[{required:!0,message:r(()=>a("父级不能不选择")),trigger:"blur"}]},itemList:[{type:"input",label:r(()=>a("参数key")),prop:"parameterKey"},{type:"select",label:r(()=>a("字段类型")),prop:"parameterType",props:{options:[{label:r(()=>a("String")),value:"String"},{label:r(()=>a("integer")),value:"integer"},{label:r(()=>a("boolean")),value:"boolean"},{label:r(()=>a("double")),value:"double"},{label:r(()=>a("array")),value:"array"},{label:r(()=>a("map")),value:"map"},{label:r(()=>a("number")),value:"number"}],events:{change:e=>{n.value.model.parameterType!=null&&(n.value.model.parameterType=="map"||n.value.model.parameterType=="array")&&V.alert('参数类型由"'+n.value.model.parameterType+'"变更为"'+e+'"将会覆盖子级节点数据',"参数类型变更确认",{confirmButtonText:"确认"})}}}},{type:"select",label:r(()=>a("是否必填")),prop:"required",props:{options:[{label:r(()=>a("是")),