1import{A as P,At as s,Ct as T,E as B,L,Q as V,T as R,_t as $,it as D,w as q,zt as F}from"./vue.runtime.esm-bundler-BXOQDxND.js";import{a as N,i as K}from"./vue-router-CA12YVzF.js";import{t as z}from"./_plugin-vue_export-helper-K9rsuiWd.js";import{t as v}from"./message-BWqmnC5I.js";import{t as M}from"./lodash-CP_M4Pzr.js";import{_ as Q,h as U,v as j}from"./index-DbIsMhdV.js";var u=M();T(),L();var G={class:"ma-content-block p-4"},H={__name:"form",setup(J){const l=K(),y=N(),d=U(),_=j(),b=Q(),i=s(),f=s(!0),c=s(l.query?.tagId??""),x=s(d.formList[c.value]?.returnPath??"/dashboard"),r=s(l.query?.op??""),g=s(l.query?.key??""),p=e=>{f.value&&(f.value=!1,v.error(e),_.removeTag({path:l.fullPath}),b.removeKeepAlive({path:l.fullPath}),y.push("/dashboard"))};(0,u.isEmpty)(c.value)?p("缺å°tagIdåæ°"):(0,u.isEmpty)(r.value)?p("缺å°opåæ°"):r.value==="edit"&&(0,u.isEmpty)(g.value)?p("缺å°keyåæ°"):d.formList[c.value]||p("缺å°Formé
ç½®");const h=d.formList[c.value],n=h?.config??{formColumns:[],sourceColumns:[],options:{}},o=s(r.value==="add"?h?.addData??{}:h?.editData?.[g.value]??{}),t=n.options??{},m=s(r.value==="add"?"æ°å¢":"ç¼è¾"),k=s(m.value+(n?.options?.formOption?.tagName??"æªå½å")),w=s(n?.options?.formOption?.subtitle??`æ°æ®${m.value}页`),I=n?.options?.formOption?.formOptions??{};_.updateTagTitle(l.fullPath,` ${k.value} ${r.value==="edit"?" | "+g.value:""} `),n.sourceColumns?.map(async e=>{e.dataIndex&&e.dataIndex.indexOf(".")>-1&&(o.value[e.dataIndex]=(0,u.get)(o.value,e.dataIndex)),r.value==="add"&&(e.addDefaultValue&&(0,u.isFunction)(e.addDefaultValue)?o.value[e.dataIndex]=await e.addDefaultValue(o.value):typeof e.addDefaultValue<"u"&&(o.value[e.dataIndex]=e.addDefaultValue)),r.value==="edit"&&(e.editDefaultValue&&(0,u.isFunction)(e.editDefaultValue)?o.value[e.dataIndex]=await e.editDefaultValue(o.value):typeof e.editDefaultValue<"u"&&(o.value[e.dataIndex]=e.editDefaultValue))});const E=()=>{window.history.back(-1)},A=async()=>{if(!f.value||!i.value)return!1;const e=i.value.getFormData();if(await i.value.validateForm())return!1;let a;if(r.value==="add"){if((0,u.isFunction)(t.beforeAdd)&&!t.beforeAdd(e))return!1;a=await t.add.api(e),(0,u.isFunction)(t.afterAdd)&&await t.afterAdd(a,e)}else{if((0,u.isFunction)(t.beforeEdit)&&!t.beforeEdit(e))return!1;a=await t.edit.api(e[t.pk],e),(0,u.isFunction)(t.afterEdit)&&await t.afterEdit(a,e)}a.success?(await i.value.resetForm(),v.success(a.message||`${m.value}æåï¼`),_.removeTag({path:l.fullPath}),b.removeKeepAlive({path:l.fullPath}),d.crudList[t.id]=!0,y.push(x.value)):a.success===!1&&(typeof a.code>"u"||a.code!==200)&&(v.clear(),v.error(a.message||`${m.value}失败ï¼`))};return(e,a)=>{const C=D("legacy-ma-form"),S=D("a-page-header");return V(),B("div",G,[P(S,{style:{background:"var(--color-bg-2)"},title:k.value,subtitle:w.value,onBack:E},{default:$(()=>[f.value?(V(),q(C,{key:0,modelValue:o.value,"onUpdate:modelValue":a[0]||(a[0]=O=>o.value=O),columns:F(n).formColumns,options:F(I),ref_key:"maFormRef",ref:i,onOnSubmit:A},null,8,["modelValue","columns","options"])):R("",!0)]),_:1},8,["title","subtitle"])])}}},te=z(H,[["__scopeId","data-v-efa5394a"]]);export{te as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.