import{Z as I,_ as C,a as O}from"./index-design-C8wrC2s6.js";import{f as z}from"./AddOrEditDataTableField-6EgyjAa7.js";import{A as f}from"./index-BbmYVzBk.js";import{l as w,m as D,D as x,F as v,e as L,v as k,d as B}from"./element-plus-DXXGg0hD.js";import{X as u,O as d,Y as o,a1 as F,a4 as i,M as T,V as U,af as q,R as b,$ as c,ab as g}from"./vue-BQyCGvUQ.js";var j={tableName:[{required:!0,message:"请输入表名",trigger:"blur"}],tableNameCn:[{required:!0,message:"请输入表中文名",trigger:"blur"}]};const S={props:{tgt:{type:Object,default:()=>({})},modelValue:{type:Boolean,default:!1}},emits:["reloadTable","fire","update:modelValue","free"],computed:{...I,showValue:{get(){return this.$props.modelValue},set(e){this.$emit("update:modelValue",e)}},title(){const e="新增 "+this.description;let t="";return this.tgt&&(t=this.tgt[this.coreName+"ObId"]),t?"修改 "+this.description+" "+this.tgt[this.coreName+"No"]+" "+this.tgt[this.coreName+"Name"]:e}},components:{},data(){return{componentName:"database-table",loading:!0,rules:j,low_employeeNO:"",tgt_:{returnType:"",bizEntityObId:""},show_content:"base_info"+(this.tgt?.programNO?"__edit":"__create"),dataEntityList:[]}},watch:{async modelValue(e){e?(await this.loadDataEntityList(),this.tgt_=Object.assign({},this.tgt)):(this.$refs.editor_form?.resetFields(),this.loading=!1)}},methods:{entityChangeHandle(){const e=this,t=e.tgt_.bizEntityObId,s=t?e.dataEntityList.find(_=>_.bizEntityObId===t):null;s&&(e.tgt_.tableName||(e.tgt_.tableName=s?.name||""),e.tgt_.tableNameCn||(e.tgt_.tableNameCn=s?.bizEntityNameCn||""))},async loadDataEntityList(){try{this.loading=!0;const e=await f.getDataEntityList({productId:this.$route.query.productId,objectType:"ZxlPrdRequestEntity",page:1,pageSize:999999});this.dataEntityList=e?.data||[]}catch(e){console.error("加载数据实体列表失败:",e)}finally{this.loading=!1}},free(){this.$emit("free"),this.$refs.editor_form?.resetFields(),this.showValue=!1},async fire(){await z(this),this.$emit("reloadTable"),this.showValue=!1},async save(e){return await f.saveOrUpdate({tableObId:e.tableObId||null,tableNo:e.tableNo,tableName:e.tableName,tableNameCn:e.tableNameCn,primaryKeyId:e.primaryKeyId,tableDesc:e.tableDesc,bizEntityObId:e.bizEntityObId,zxlPrdId:this.$route.query.productId})}}},A={style:{float:"right",color:"#8492a6","font-size":"13px"}},H={style:{"text-align":"center"}};function K(e,t,s,_,a,n){const y=v,h=x,r=D,m=L,E=w,p=B,N=O,V=k;return d(),u(N,{modelValue:n.showValue,"onUpdate:modelValue":t[4]||(t[4]=l=>n.showValue=l),title:n.title},{footer:o(()=>[b("footer",H,[i(p,{onClick:n.free},{default:o(()=>[...t[5]||(t[5]=[g(" 取消 ",-1)])]),_:1},8,["onClick"]),i(p,{type:"primary",onClick:n.fire},{default:o(()=>[...t[6]||(t[6]=[g("提交",-1)])]),_:1},8,["onClick"])])]),default:o(()=>[F((d(),u(E,{model:a.tgt_,rules:a.rules,ref:"editor_form","label-width":"6em"},{default:o(()=>[i(r,{prop:"bizEntityObId",label:"数据实体"},{default:o(()=>[i(h,{modelValue:a.tgt_.bizEntityObId,"onUpdate:modelValue":t[0]||(t[0]=l=>a.tgt_.bizEntityObId=l),placeholder:"请选择数据实体",filterable:"",clearable:"",onChange:n.entityChangeHandle},{default:o(()=>[(d(!0),T(U,null,q(a.dataEntityList,l=>(d(),u(y,{key:l.bizEntityObId,label:l.bizEntityNameCn,value:l.bizEntityObId},{default:o(()=>[b("span",null,c(l.bizEntityNameCn),1),b("span",A,c(l.bizEntityNo),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1}),i(r,{prop:"tableName",label:"表名"},{default:o(()=>[i(m,{modelValue:a.tgt_.tableName,"onUpdate:modelValue":t[1]||(t[1]=l=>a.tgt_.tableName=l),placeholder:"请输入表名"},null,8,["modelValue"])]),_:1}),i(r,{prop:"tableNameCn",label:"表中文名"},{default:o(()=>[i(m,{modelValue:a.tgt_.tableNameCn,"onUpdate:modelValue":t[2]||(t[2]=l=>a.tgt_.tableNameCn=l),placeholder:"请输入表中文名"},null,8,["modelValue"])]),_:1}),i(r,{prop:"tableDesc",label:"表描述"},{default:o(()=>[i(m,{modelValue:a.tgt_.tableDesc,"onUpdate:modelValue":t[3]||(t[3]=l=>a.tgt_.tableDesc=l),placeholder:"多行输入",type:"textarea",rows:3,resize:"none"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[V,a.loading]])]),_:1},8,["modelValue","title"])}const Y=C(S,[["render",K]]);export{Y as E};
