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,t as u,w as d}from"./_plugin-vue_export-helper-9JxOV_6y.js";import{J as f,c as p,o as m}from"./GxPagination-CS4FI5Lo.js";import{n as h,t as g}from"./form-D3h-alBR.js";import{t as _}from"./GxDialog-CFvkSS2u.js";import{t as v}from"./button-BmZH_xSR.js";import{t as y}from"./directive-pNcZrfik.js";import{n as b}from"./view_base_options-DGV97Tsn.js";import{n as x}from"./AddOrEditDataTableField-BJKKkEnJ.js";import{t as S}from"./api-FE1fBqys.js";var C={tableName:[{required:!0,message:`请输入表名`,trigger:`blur`}],tableNameCn:[{required:!0,message:`请输入表中文名`,trigger:`blur`}]},w={props:{tgt:{type:Object,default:()=>({})},modelValue:{type:Boolean,default:!1}},emits:[`reloadTable`,`fire`,`update:modelValue`,`free`],computed:{...b,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:C,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 S.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 x(this),this.$emit(`reloadTable`),this.showValue=!1},async save(e){return await S.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})}}},T={style:{float:`right`,color:`#8492a6`,"font-size":`13px`}},E={style:{"text-align":`center`}};function D(u,b,x,S,C,w){let D=m,O=p,k=h,A=f,j=g,M=v,N=_,P=y;return i(),d(N,{modelValue:w.showValue,"onUpdate:modelValue":b[4]||=e=>w.showValue=e,title:w.title},{footer:s(()=>[t(`footer`,E,[e(M,{onClick:w.free},{default:s(()=>[...b[5]||=[l(` 取消 `,-1)]]),_:1},8,[`onClick`]),e(M,{type:`primary`,onClick:w.fire},{default:s(()=>[...b[6]||=[l(`提交`,-1)]]),_:1},8,[`onClick`])])]),default:s(()=>[c((i(),d(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":b[0]||=e=>C.tgt_.bizEntityObId=e,placeholder:`请选择数据实体`,filterable:``,clearable:``,onChange:w.entityChangeHandle},{default:s(()=>[(i(!0),n(a,null,r(C.dataEntityList,e=>(i(),d(D,{key:e.bizEntityObId,label:e.bizEntityNameCn,value:e.bizEntityObId},{default:s(()=>[t(`span`,null,o(e.bizEntityNameCn),1),t(`span`,T,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":b[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":b[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":b[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 O=u(w,[[`render`,D]]);export{O as t};