import{A as e,C as t,E as n,Q as r,X as i,_ as a,cn as o,dt as s,ft as c,k as l,mn as u,t as d,w as f}from"./_plugin-vue_export-helper-C0lsYS1a.js";import{J as p,c as m,o as h}from"./GxPagination-DaT0MOF0.js";import{n as g,t as _}from"./form-B9CYF2OU.js";import{t as v}from"./GxDialog-DixGJxSz.js";import{t as y}from"./button-CTBy3KbX.js";import{t as b}from"./directive-2hBfY9mU.js";import{n as x}from"./view_base_options-c2kiHw0P.js";import{n as S}from"./AddOrEditDataTableField-mMNCmR7i.js";import{n as C}from"./api-CzsNAX5W.js";var w={tableName:[{required:!0,message:`请输入表名`,trigger:`blur`}],tableNameCn:[{required:!0,message:`请输入表中文名`,trigger:`blur`}]},T={props:{tgt:{type:Object,default:()=>({})},modelValue:{type:Boolean,default:!1}},emits:[`reloadTable`,`fire`,`update:modelValue`,`free`],computed:{...x,showValue:{get(){return this.$props.modelValue},set(e){this.$emit(`update:modelValue`,e)}},title(){let e=`新增 `+this.description,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:w,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(){let e=this,t=e.tgt_.bizEntityObId,n=t?e.dataEntityList.find(e=>e.bizEntityObId===t):null;n&&(e.tgt_.tableName||(e.tgt_.tableName=n?.name||``),e.tgt_.tableNameCn||(e.tgt_.tableNameCn=n?.bizEntityNameCn||``))},async loadDataEntityList(){try{this.loading=!0,this.dataEntityList=(await C.getDataEntityList({productId:this.$route.query.productId,objectType:`ZxlPrdRequestEntity`,page:1,pageSize:999999}))?.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 S(this),this.$emit(`reloadTable`),this.showValue=!1},async save(e){return await C.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})}}},E={style:{float:`right`,color:`#8492a6`,"font-size":`13px`}},D={style:{"text-align":`center`}};function O(u,d,x,S,C,w){let T=h,O=m,k=g,A=p,j=_,M=y,N=v,P=b;return i(),f(N,{modelValue:w.showValue,"onUpdate:modelValue":d[4]||=e=>w.showValue=e,title:w.title},{footer:s(()=>[t(`footer`,D,[e(M,{onClick:w.free},{default:s(()=>[...d[5]||=[l(` 取消 `,-1)]]),_:1},8,[`onClick`]),e(M,{type:`primary`,onClick:w.fire},{default:s(()=>[...d[6]||=[l(`提交`,-1)]]),_:1},8,[`onClick`])])]),default:s(()=>[c((i(),f(j,{model:C.tgt_,rules:C.rules,ref:`editor_form`,"label-width":`6em`},{default:s(()=>[e(k,{prop:`bizEntityObId`,label:`数据实体`},{default:s(()=>[e(O,{modelValue:C.tgt_.bizEntityObId,"onUpdate:modelValue":d[0]||=e=>C.tgt_.bizEntityObId=e,placeholder:`请选择数据实体`,filterable:``,clearable:``,onChange:w.entityChangeHandle},{default:s(()=>[(i(!0),n(a,null,r(C.dataEntityList,e=>(i(),f(T,{key:e.bizEntityObId,label:e.bizEntityNameCn,value:e.bizEntityObId},{default:s(()=>[t(`span`,null,o(e.bizEntityNameCn),1),t(`span`,E,o(e.bizEntityNo),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onChange`])]),_:1}),e(k,{prop:`tableName`,label:`表名`},{default:s(()=>[e(A,{modelValue:C.tgt_.tableName,"onUpdate:modelValue":d[1]||=e=>C.tgt_.tableName=e,placeholder:`请输入表名`},null,8,[`modelValue`])]),_:1}),e(k,{prop:`tableNameCn`,label:`表中文名`},{default:s(()=>[e(A,{modelValue:C.tgt_.tableNameCn,"onUpdate:modelValue":d[2]||=e=>C.tgt_.tableNameCn=e,placeholder:`请输入表中文名`},null,8,[`modelValue`])]),_:1}),e(k,{prop:`tableDesc`,label:`表描述`},{default:s(()=>[e(A,{modelValue:C.tgt_.tableDesc,"onUpdate:modelValue":d[3]||=e=>C.tgt_.tableDesc=e,placeholder:`多行输入`,type:`textarea`,rows:3,resize:`none`},null,8,[`modelValue`])]),_:1})]),_:1},8,[`model`,`rules`])),[[P,C.loading]])]),_:1},8,[`modelValue`,`title`])}var k=d(T,[[`render`,O]]);export{k as t};