import{aP as O,a9 as A,a5 as U,aK as z}from"./index.17037962789732.js";import"./index.1703796278973305.js";import"./index.170379627897315.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import{d as C,s as E,k as h,l as w,o as _,x as y,z as v,b as M,a as I,A as g,B as S,c as P,F as J,h as L,u as f,t as R,an as W}from"./vue.1703796278973.js";import{u as q}from"./product.17037962789738.js";import{d as G}from"./accessConfig.1703796278973.js";import{g as H,a as Q}from"./plugin.17037962789733.js";import{a as X,o as Y}from"./comm.1703796278973.js";import{al as Z,am as $}from"./instance.1703796278973.js";import{_ as ee}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./product.17037962789737.js";import"./system.1703796278973.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";import"./encodeQuery.1703796278973.js";const te={class:"metadata-map"},ae={class:"left"},se={key:0,class:"metadata-title"},oe={class:"right"},ne=W('
功能说明
该功能用于将插件中的 物模型属性标识与 平台物模型属性标识进行映射,当两方属性标识不一致时,可在当前页面直接修改映射管理,系统将以映射后的物模型属性进行数据处理。
未完成映射的属性标识“目标属性”列数据为空,代表该属性值来源以在平台配置的来源为准。
数据条背景亮起代表标识一致或已完成映射的属性。
功能图示
',5),ie=["src"],re=C({name:"MetadataMap"}),de=C({...re,setup(le){const B=q(),{current:u}=E(B),b=h([]),l=h([]),x=h([]),k=[{title:"序号",dataIndex:"index",width:120},{title:"平台属性",dataIndex:"name"},{title:"目标属性",dataIndex:"plugin",sorter:(t,e)=>(console.log(t,e),!0)}],N=w(()=>{var t;return((t=l.value)==null?void 0:t.filter(e=>!!(e!=null&&e.plugin)).map(e=>e.id))||[]}),D=w(()=>{var t;return((t=l.value)==null?void 0:t.filter(e=>!!(e!=null&&e.plugin)).map(e=>e.plugin))||[]}),K=()=>new Promise(t=>{var e;$((e=u.value)==null?void 0:e.id).then(s=>{var n,r;s.success&&t(((r=(n=s.result)==null?void 0:n.filter(i=>i.customMapping))==null?void 0:r.map(i=>({id:i.metadataId,pluginId:i.originalId})))||[])})}),T=t=>{t?l.value=b.value.filter(e=>{var s;return!!((s=e.name)!=null&&s.includes(t))}):l.value=b.value},V=async()=>{var c;const e=JSON.parse(((c=u.value)==null?void 0:c.metadata)||"{}").properties,s=await j(),n=(s==null?void 0:s.properties)||[],r=await K();x.value=n.map(a=>({...a,label:a.name,value:a.id}));const i=[...n.map(a=>({id:a.id,pluginId:a.id})),...r];l.value=(e==null?void 0:e.map((a,d)=>{var o;const p=i.find(m=>m.id===a.id);return{index:d+1,id:a.id,name:a.name,type:(o=a.valueType)==null?void 0:o.type,plugin:p==null?void 0:p.pluginId}}))||[],b.value=l.value},j=()=>new Promise(t=>{var e;G((e=u.value)==null?void 0:e.accessId).then(async s=>{var n,r,i;if(s.success){const c=s.result.channelId,a=await H("product",(n=u.value)==null?void 0:n.accessId,(r=u.value)==null?void 0:r.id).catch(()=>({success:!1,result:{}})),d=await Q(c).catch(()=>({success:!1,result:[]}));if(d.success){const p=(i=d.result)==null?void 0:i.find(o=>{var m;return o.id===((m=a==null?void 0:a.result)==null?void 0:m.externalId)});t(p?p.metadata:{properties:[]})}}t({properties:[]})})}),F=async(t,e)=>{var n;(await Z((n=u.value)==null?void 0:n.id,[{metadataType:"property",metadataId:t.id,originalId:e}])).success&&Y("操作成功")};return V(),(t,e)=>{const s=O,n=A,r=U,i=z;return _(),y("div",te,[v("div",ae,[M(s,{style:{width:"350px","margin-bottom":"24px"},placeholder:"搜索平台属性名称",allowClear:"",onSearch:T}),M(i,{columns:k,"data-source":f(l),pagination:!1,rowSelection:{selectedRowKeys:f(N),hideSelectAll:!0,columnWidth:0},rowKey:"id"},{bodyCell:I(({column:c,text:a,record:d,index:p})=>[c.dataIndex==="name"?(_(),y("span",se,g(a)+" ("+g(d.id)+")",1)):S("",!0),c.dataIndex==="plugin"?(_(),P(r,{key:1,value:d.plugin,"onUpdate:value":o=>d.plugin=o,style:{width:"100%"},onChange:o=>F(d,o)},{default:I(()=>[(_(!0),y(J,null,L(f(x),(o,m)=>(_(),P(n,{key:m+"_"+o.id,value:o.value,disabled:f(D).includes(o.id)},{default:I(()=>[R(g(o.label)+" ("+g(o.id)+")",1)]),_:2},1032,["value","disabled"]))),128))]),_:2},1032,["value","onUpdate:value","onChange"])):S("",!0)]),_:1},8,["data-source","rowSelection"])]),v("div",oe,[ne,v("div",null,[v("img",{src:f(X)("/device/matadataMap.png")},null,8,ie)])])])}}});const We=ee(de,[["__scopeId","data-v-192bef05"]]);export{We as default};