沙钢智慧能源系统前端代码
houzhongjian
2024-10-09 314507f8ddadd9c66e98d260c3b2a5dad1a04015
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import{_ as w}from"./Dialog.vue_vue_type_style_index_0_lang-DFckl8Er.js";import{d as z,J as A,Q as U,r as c,b as F,aA as K,a1 as Q,o as h,c as C,k as e,B as l,C as d,O as g,a as n,D as $,P,h as q,I as G,F as H,dB as W,dC as X,aT as Y,V as Z,am as ee,ap as ae,b3 as te}from"./index-BP6bNRoi.js";import{_ as le}from"./ContentWrap.vue_vue_type_script_setup_true_lang-CR_2gECF.js";import{u as ne}from"./useFormCreateDesigner-DHu111_t.js";import{H as v,j as se}from"./java-Dj9vEU5d.js";import"./el-card-bU92WWV4.js";import"./dict.type-FYuZ3DI6.js";function oe(r){const s=["true","false","null"],m={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0},r.QUOTE_STRING_MODE,m,r.C_NUMBER_MODE,r.C_LINE_COMMENT_MODE,r.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}const re={class:"float-right mb-2"},ie={key:0,ref:"editor"},ue={class:"hljs"},ce=z({name:"InfraBuild",__name:"index",setup(r){const{t:s}=A(),m=U(),o=c(),i=c(!1),y=c(""),p=c(-1),u=c("");ne(o);const _=a=>{i.value=!0,y.value=a},N=()=>{_("\u751F\u6210 JSON"),p.value=0,u.value=o.value.getRule()},S=()=>{_("\u751F\u6210 Options"),p.value=1,u.value=o.value.getOption()},E=()=>{_("\u751F\u6210\u7EC4\u4EF6"),p.value=2,u.value=J()},J=()=>{const a=o.value.getRule(),t=o.value.getOption();return`<template>
    <form-create
      v-model:api="fApi"
      :rule="rule"
      :option="option"
      @submit="onSubmit"
    ></form-create>
  </template>
  <script setup lang=ts>
    const faps = ref(null)
    const rule = ref('')
    const option = ref('')
    const init = () => {
      rule.value = formCreate.parseJson('${W.toJson(a).replaceAll("\\","\\\\")}')
      option.value = formCreate.parseJson('${JSON.stringify(t)}')
    }
    const onSubmit = (formData) => {
      //todo \u63D0\u4EA4\u8868\u5355
    }
    init()
  <\/script>`},M=a=>{let t="json";return p.value===2&&(t="xml"),Y(a)||(a=JSON.stringify(a)),v.highlight(t,a,!0).value||"&nbsp;"};return F(async()=>{v.registerLanguage("xml",se),v.registerLanguage("json",oe)}),(a,t)=>{const f=Z,b=ee,k=ae,j=K("FcDesigner"),D=le,x=te,B=w,I=Q("dompurify-html");return h(),C(H,null,[e(D,null,{default:l(()=>[e(k,null,{default:l(()=>[e(b,null,{default:l(()=>[d("div",re,[e(f,{size:"small",type:"primary",onClick:N},{default:l(()=>[g("\u751F\u6210 JSON")]),_:1}),e(f,{size:"small",type:"success",onClick:S},{default:l(()=>[g("\u751F\u6210 Options")]),_:1}),e(f,{size:"small",type:"danger",onClick:E},{default:l(()=>[g("\u751F\u6210\u7EC4\u4EF6")]),_:1})])]),_:1})]),_:1}),e(j,{ref_key:"designer",ref:o,height:"780px"},null,512)]),_:1}),e(B,{modelValue:n(i),"onUpdate:modelValue":t[1]||(t[1]=O=>G(i)?i.value=O:null),title:n(y),"max-height":"600"},{default:l(()=>[n(i)?(h(),C("div",ie,[e(f,{style:{float:"right"},onClick:t[0]||(t[0]=O=>(async T=>{const{copy:L,copied:R,isSupported:V}=X({source:T});V?(await L(),n(R)&&m.success(s("common.copySuccess"))):m.error(s("common.copyError"))})(n(u)))},{default:l(()=>[g($(n(s)("common.copy")),1)]),_:1}),e(x,{height:"580"},{default:l(()=>[d("div",null,[d("pre",null,[P(d("code",ue,null,512),[[I,M(n(u))]])])])]),_:1})],512)):q("",!0)]),_:1},8,["modelValue","title"])],64)}}});export{ce as default};